fix: Optimizes gump relay info (Prep for Static Gumps) (#1698)

This commit is contained in:
Kamron Batman 2024-03-07 20:54:53 -08:00 • committed by GitHub
parent 50fcee12dc
commit cfe9e04c78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
220 changed files with 364 additions and 402 deletions

View file

@ -76,7 +76,7 @@ public class SpawnPropsGump : PropertiesGump
public static object GetPropValue(object src, string propName) =>
src.GetType().GetProperty(propName)?.GetValue(src, null);
public override void OnResponse(NetState state, RelayInfo info)
public override void OnResponse(NetState state, in RelayInfo info)
{
var from = state.Mobile;

View file

@ -399,7 +399,7 @@ public class SpawnerControllerGump : GumpGrid
}
}
public override void OnResponse(NetState sender, RelayInfo info)
public override void OnResponse(NetState sender, in RelayInfo info)
{
var buttonID = info.ButtonID - 1;
var type = buttonID % TypeCount;
@ -427,9 +427,9 @@ public class SpawnerControllerGump : GumpGrid
{
var entry = info.GetTextEntry(0xFFFF);
if (entry?.Text?.Length > 0)
if (entry?.Length > 0)
{
_search.SearchPattern = entry.Text;
_search.SearchPattern = entry;
}
}
else if (index == 5 && _copy != null && _spawners?.Length > 0)
@ -500,27 +500,27 @@ public class SpawnerControllerGump : GumpGrid
var indexEntry = index >= _lineCount ? (index - _lineCount * _page) * EntryCount : index * EntryCount;
var name = info.GetTextEntry(indexEntry);
if (name?.Text.Length > 0)
if (name?.Length > 0)
{
spawner.Name = name.Text;
spawner.Name = name;
}
if (int.TryParse(info.GetTextEntry(indexEntry + 1)?.Text, out var walkRange))
if (int.TryParse(info.GetTextEntry(indexEntry + 1), out var walkRange))
{
spawner.WalkingRange = walkRange;
}
if (int.TryParse(info.GetTextEntry(indexEntry + 2)?.Text, out var homeHange))
if (int.TryParse(info.GetTextEntry(indexEntry + 2), out var homeHange))
{
spawner.HomeRange = homeHange;
}
if (TimeSpan.TryParse(info.GetTextEntry(indexEntry + 3)?.Text, out var minDelay))
if (TimeSpan.TryParse(info.GetTextEntry(indexEntry + 3), out var minDelay))
{
spawner.MinDelay = minDelay;
}
if (TimeSpan.TryParse(info.GetTextEntry(indexEntry + 4)?.Text, out var maxDelay))
if (TimeSpan.TryParse(info.GetTextEntry(indexEntry + 4), out var maxDelay))
{
spawner.MaxDelay = maxDelay;
}

View file

@ -246,7 +246,7 @@ public class SpawnerGump : Gump
continue;
}
var str = cte.Text.Trim().ToLower();
var str = cte.Trim().ToLower();
if (str.Length > 0)
{
@ -267,12 +267,12 @@ public class SpawnerGump : Gump
if (mte != null)
{
entry.SpawnedMaxCount = Utility.ToInt32(mte.Text.Trim());
entry.SpawnedMaxCount = Utility.ToInt32(mte.Trim());
}
if (poste != null)
{
entry.SpawnedProbability = Utility.ToInt32(poste.Text.Trim());
entry.SpawnedProbability = Utility.ToInt32(poste.Trim());
}
}
else
@ -282,12 +282,12 @@ public class SpawnerGump : Gump
if (mte != null)
{
maxcount = Utility.ToInt32(mte.Text.Trim());
maxcount = Utility.ToInt32(mte.Trim());
}
if (poste != null)
{
probcount = Utility.ToInt32(poste.Text.Trim());
probcount = Utility.ToInt32(poste.Trim());
}
entry = spawner.AddEntry(str, probcount, maxcount);
@ -295,12 +295,12 @@ public class SpawnerGump : Gump
if (parmte != null)
{
entry.Parameters = parmte.Text.Trim();
entry.Parameters = parmte.Trim();
}
if (propte != null)
{
entry.Properties = propte.Text.Trim();
entry.Properties = propte.Trim();
}
}
else if (entryindex < ocount && spawner.Entries[entryindex] != null)
@ -320,7 +320,7 @@ public class SpawnerGump : Gump
}
}
public override void OnResponse(NetState state, RelayInfo info)
public override void OnResponse(NetState state, in RelayInfo info)
{
if (_spawner.Deleted)
{