Converted the GetAttribute methods in the ToolBox class to extension methods

This commit is contained in:
Joonas Rikkonen
2017-10-04 18:38:40 +03:00
parent 6c7c97a875
commit 1ff2054ca8
99 changed files with 854 additions and 875 deletions
@@ -39,14 +39,14 @@ namespace Barotrauma
public MonsterEvent(XElement element)
: base (element)
{
characterFile = ToolBox.GetAttributeString(element, "characterfile", "");
characterFile = element.GetAttributeString("characterfile", "");
int defaultAmount = ToolBox.GetAttributeInt(element, "amount", 1);
int defaultAmount = element.GetAttributeInt("amount", 1);
minAmount = ToolBox.GetAttributeInt(element, "minamount", defaultAmount);
maxAmount = Math.Max(ToolBox.GetAttributeInt(element, "maxamount", 1), minAmount);
minAmount = element.GetAttributeInt("minamount", defaultAmount);
maxAmount = Math.Max(element.GetAttributeInt("maxamount", 1), minAmount);
var spawnPosTypeStr = ToolBox.GetAttributeString(element, "spawntype", "");
var spawnPosTypeStr = element.GetAttributeString("spawntype", "");
if (string.IsNullOrWhiteSpace(spawnPosTypeStr) ||
!Enum.TryParse<Level.PositionType>(spawnPosTypeStr, true, out spawnPosType))
@@ -54,9 +54,9 @@ namespace Barotrauma
spawnPosType = Level.PositionType.MainPath;
}
spawnDeep = ToolBox.GetAttributeBool(element, "spawndeep", false);
spawnDeep = element.GetAttributeBool("spawndeep", false);
repeat = ToolBox.GetAttributeBool(element, "repeat", repeat);
repeat = element.GetAttributeBool("repeat", repeat);
if (GameMain.NetworkMember != null)
{