Fixes SendMessages

This commit is contained in:
Kamron Batman 2023-10-10 20:34:48 -07:00
parent 13c3e52639
commit d984df1c16
No known key found for this signature in database
GPG key ID: 7D81DF26D9A5D94A
18 changed files with 309 additions and 1962 deletions

View file

@ -164,7 +164,7 @@ public static class Core
{ {
// See notes above for _now and why this is a volatile variable. // See notes above for _now and why this is a volatile variable.
var now = _now; var now = _now;
return now == DateTime.MinValue ? DateTime.UtcNow : now; return now == DateTime.MinValue ? Core.Now : now;
} }
} }
@ -557,7 +557,7 @@ public static class Core
while (!Closing) while (!Closing)
{ {
_tickCount = TickCount; _tickCount = TickCount;
_now = DateTime.UtcNow; _now = Core.Now;
Mobile.ProcessDeltaQueue(); Mobile.ProcessDeltaQueue();
Item.ProcessDeltaQueue(); Item.ProcessDeltaQueue();

View file

@ -255,7 +255,7 @@ public class GenericEntityPersistence<T> : Persistence, IGenericEntityPersistenc
try try
{ {
using var op = new StreamWriter("world-save-errors.log", true); using var op = new StreamWriter("world-save-errors.log", true);
op.WriteLine("{0}\t{1}", DateTime.UtcNow, message); op.WriteLine("{0}\t{1}", Core.Now, message);
op.WriteLine(new StackTrace(2).ToString()); op.WriteLine(new StackTrace(2).ToString());
op.WriteLine(); op.WriteLine();
} }

View file

@ -51,7 +51,7 @@ public interface IGenericReader
{ {
long.MinValue => DateTime.MinValue, long.MinValue => DateTime.MinValue,
long.MaxValue => DateTime.MaxValue, long.MaxValue => DateTime.MaxValue,
var delta => new DateTime(delta + DateTime.UtcNow.Ticks, DateTimeKind.Utc) var delta => new DateTime(delta + Core.Now.Ticks, DateTimeKind.Utc)
}; };
} }
decimal ReadDecimal() => new(stackalloc int[4] { ReadInt(), ReadInt(), ReadInt(), ReadInt() }); decimal ReadDecimal() => new(stackalloc int[4] { ReadInt(), ReadInt(), ReadInt(), ReadInt() });

View file

@ -70,7 +70,7 @@ public interface IGenericWriter
} }
// Technically supports negative deltas for times in the past // Technically supports negative deltas for times in the past
Write(value.Ticks - DateTime.UtcNow.Ticks); Write(value.Ticks - Core.Now.Ticks);
} }
void Write(IPAddress value) void Write(IPAddress value)
{ {

View file

@ -119,7 +119,7 @@ public static class EntityPersistence
return map; return map;
} }
var now = DateTime.UtcNow; var now = Core.Now;
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
{ {

View file

@ -28,11 +28,8 @@ public class BaseXmlSpawner
} }
private static readonly Type typeofTimeSpan = typeof(TimeSpan); private static readonly Type typeofTimeSpan = typeof(TimeSpan);
private static readonly Type typeofParsable = typeof(ParsableAttribute);
private static readonly Type typeofCustomEnum = typeof(CustomEnumAttribute); private static readonly Type typeofCustomEnum = typeof(CustomEnumAttribute);
private static bool IsParsable(Type t) => t == typeofTimeSpan || t.IsDefined(typeofParsable, false);
private static readonly Type[] m_ParseTypes = { typeof(string) }; private static readonly Type[] m_ParseTypes = { typeof(string) };
private static readonly object[] m_ParseParams = new object[1]; private static readonly object[] m_ParseParams = new object[1];
@ -204,7 +201,7 @@ public class BaseXmlSpawner
Type = type; Type = type;
m_Delay = delay; m_Delay = delay;
m_Timeout = timeout; m_Timeout = timeout;
m_TimeoutEnd = DateTime.UtcNow + timeout; m_TimeoutEnd = Core.Now + timeout;
m_Spawner = spawner; m_Spawner = spawner;
m_Condition = condition; m_Condition = condition;
m_Goto = gotogroup; m_Goto = gotogroup;
@ -280,7 +277,7 @@ public class BaseXmlSpawner
private void DoTimer(TimeSpan delay, TimeSpan repeatdelay, string condition, int gotogroup) private void DoTimer(TimeSpan delay, TimeSpan repeatdelay, string condition, int gotogroup)
{ {
m_End = DateTime.UtcNow + delay; m_End = Core.Now + delay;
if (m_Timer != null) if (m_Timer != null)
{ {
@ -303,11 +300,11 @@ public class BaseXmlSpawner
if (Type == 0) if (Type == 0)
{ {
// save any timer information // save any timer information
writer.Write(m_End - DateTime.UtcNow); writer.Write(m_End - Core.Now);
writer.Write(m_Delay); writer.Write(m_Delay);
writer.Write(m_Condition); writer.Write(m_Condition);
writer.Write(m_Goto); writer.Write(m_Goto);
writer.Write(m_TimeoutEnd - DateTime.UtcNow); writer.Write(m_TimeoutEnd - Core.Now);
writer.Write(m_Timeout); writer.Write(m_Timeout);
writer.Write(m_TrigMob); writer.Write(m_TrigMob);
} }
@ -337,7 +334,7 @@ public class BaseXmlSpawner
m_Goto = reader.ReadInt(); m_Goto = reader.ReadInt();
TimeSpan timeoutdelay = reader.ReadTimeSpan(); TimeSpan timeoutdelay = reader.ReadTimeSpan();
m_TimeoutEnd = DateTime.UtcNow + timeoutdelay; m_TimeoutEnd = Core.Now + timeoutdelay;
m_Timeout = reader.ReadTimeSpan(); m_Timeout = reader.ReadTimeSpan();
m_TrigMob = reader.ReadEntity<Mobile>(); m_TrigMob = reader.ReadEntity<Mobile>();
@ -373,9 +370,8 @@ public class BaseXmlSpawner
if (!string.IsNullOrEmpty(m_Condition) && m_Spawner != null && m_Spawner.Running) if (!string.IsNullOrEmpty(m_Condition) && m_Spawner != null && m_Spawner.Running)
{ {
// if the test is valid then terminate the timer // if the test is valid then terminate the timer
string status_str;
if (TestItemProperty(m_Spawner, m_Spawner, m_Condition, out status_str)) if (TestItemProperty(m_Spawner, m_Spawner, m_Condition, out _))
{ {
// spawn the designated subgroup if specified // spawn the designated subgroup if specified
if (m_Goto >= 0 && m_Spawner != null && !m_Spawner.Deleted) if (m_Goto >= 0 && m_Spawner != null && !m_Spawner.Deleted)
@ -403,7 +399,7 @@ public class BaseXmlSpawner
if (m_Tag != null && !m_Tag.Deleted) if (m_Tag != null && !m_Tag.Deleted)
{ {
// check the timeout if applicable // check the timeout if applicable
if (m_Tag.m_Timeout > TimeSpan.Zero && m_Tag.m_TimeoutEnd < DateTime.UtcNow) if (m_Tag.m_Timeout > TimeSpan.Zero && m_Tag.m_TimeoutEnd < Core.Now)
{ {
// release the hold on spawning and delete the tag // release the hold on spawning and delete the tag
m_Tag.Delete(); m_Tag.Delete();
@ -578,17 +574,6 @@ public class BaseXmlSpawner
return "No type with that name was found."; return "No type with that name was found.";
} }
} }
else if (IsParsable(type))
{
try
{
toSet = Parse(obj, type, value);
}
catch
{
return "That is not properly formatted.";
}
}
else if (value == null) else if (value == null)
{ {
toSet = null; toSet = null;
@ -2553,11 +2538,6 @@ public class BaseXmlSpawner
} }
catch { } catch { }
} }
// try to find the attachment on the mob
if (XmlAttach.FindAttachmentOnMobile(m, atype, aname) != null)
{
return true;
}
return false; return false;
} }
@ -2603,87 +2583,13 @@ public class BaseXmlSpawner
// found the item // found the item
if (testitem != null) if (testitem != null)
{ {
// check to see if it is a quest token item. If so, then check validity, otherwise just finding it is enough // is the equippedonly flag set? If so then see if the item is equipped
if (testitem is IXmlQuest token) if (equippedonly && testitem.Parent == m || !equippedonly)
{ {
if (token.IsValid) has_valid_item = true;
{
if (objstr.Length > objoffset)
{
has_valid_item = true;
// get any objectives and test for them. If any of the required conditions are false, then dont trigger
for (int n = objoffset; n < objstr.Length; n++)
{
try
{
switch (int.Parse(objstr[n]) - objoffset + 1)
{
case 1:
{
if (!token.Completed1)
{
has_valid_item = false;
}
break;
}
case 2:
{
if (!token.Completed2)
{
has_valid_item = false;
}
break;
}
case 3:
{
if (!token.Completed3)
{
has_valid_item = false;
}
break;
}
case 4:
{
if (!token.Completed4)
{
has_valid_item = false;
}
break;
}
case 5:
{
if (!token.Completed5)
{
has_valid_item = false;
}
break;
}
}
}
catch { }
}
}
else
// if an objective list has not been specified then just a valid item is enough
{
has_valid_item = true;
}
}
}
else
{
// is the equippedonly flag set? If so then see if the item is equipped
if (equippedonly && testitem.Parent == m || !equippedonly)
{
has_valid_item = true;
}
} }
} }
return has_valid_item; return has_valid_item;
} }
public static bool CheckForNotCarried(Mobile m, string objectivestr) public static bool CheckForNotCarried(Mobile m, string objectivestr)
@ -2767,12 +2673,6 @@ public class BaseXmlSpawner
catch { } catch { }
} }
// try to find the attachment on the mob
if (XmlAttach.FindAttachmentOnMobile(m, atype, aname) != null)
{
return false;
}
return true; return true;
} }
@ -2818,81 +2718,10 @@ public class BaseXmlSpawner
// found the item // found the item
if (testitem != null) if (testitem != null)
{ {
// check to see if it is a quest token item. If so, then check validity, otherwise just finding it is enough // is the equippedonly flag set? If so then see if the item is equipped
if (testitem is IXmlQuest token && token.IsValid) if (equippedonly && testitem.Parent == m || !equippedonly)
{ {
if (objstr.Length > objoffset) has_no_such_item = false;
{
has_no_such_item = true;
// get any objectives and test for them. If any of the required conditions are true, then block trigger
for (int n = objoffset; n < objstr.Length; n++)
{
try
{
switch (int.Parse(objstr[n]) - objoffset + 1)
{
case 1:
{
if (token.Completed1)
{
has_no_such_item = false;
}
break;
}
case 2:
{
if (token.Completed2)
{
has_no_such_item = false;
}
break;
}
case 3:
{
if (token.Completed3)
{
has_no_such_item = false;
}
break;
}
case 4:
{
if (token.Completed4)
{
has_no_such_item = false;
}
break;
}
case 5:
{
if (token.Completed5)
{
has_no_such_item = false;
}
break;
}
}
}
catch { }
}
}
else
{
has_no_such_item = false;
}
}
else
{
// is the equippedonly flag set? If so then see if the item is equipped
if (equippedonly && testitem.Parent == m || !equippedonly)
{
has_no_such_item = false;
}
} }
} }
return has_no_such_item; return has_no_such_item;
@ -3296,9 +3125,8 @@ public class BaseXmlSpawner
string keypart = remaining.Substring(startindex + 1, endindex); string keypart = remaining.Substring(startindex + 1, endindex);
// try to evaluate and then substitute the arg // try to evaluate and then substitute the arg
Type ptype;
string value = ParseForKeywords(spawner, o, keypart.Trim(), true, out ptype); string value = ParseForKeywords(spawner, o, keypart.Trim(), true, out _);
// trim off the " from strings // trim off the " from strings
if (value != null) if (value != null)

View file

@ -64,7 +64,7 @@ public partial class ItemFlags
{ {
bool state = item.GetSavedFlag(m_flag); bool state = item.GetSavedFlag(m_flag);
from.SendMessage("Flag (0x{0:X}) = {1}",m_flag,state); from.SendMessage($"Flag (0x{m_flag:X}) = {state}");
} else } else
{ {
from.SendMessage("Must target an Item"); from.SendMessage("Must target an Item");
@ -123,7 +123,7 @@ public partial class ItemFlags
bool state = GetStealable(item); bool state = GetStealable(item);
from.SendMessage("Stealable = {0}",state); from.SendMessage($"Stealable = {state}");
} else } else
{ {

View file

@ -206,11 +206,11 @@ public class SpawnerExporter
} }
} }
e.Mobile.SendMessage("{0} spawners loaded successfully from {1}, {2} failures.", successes, filePath, failures); e.Mobile.SendMessage($"{successes} spawners loaded successfully from {filePath}, {failures} failures.");
} }
else else
{ {
e.Mobile.SendMessage("File {0} does not exist.", filePath); e.Mobile.SendMessage($"File {filePath} does not exist.");
} }
} }
else else

View file

@ -608,10 +608,10 @@ public class XmlPropertiesGump : Gump
{ {
if (t == typeof(ulong) || t == typeof(uint) || t == typeof(ushort) || t == typeof(byte)) if (t == typeof(ulong) || t == typeof(uint) || t == typeof(ushort) || t == typeof(byte))
{ {
return Convert.ChangeType(Convert.ToUInt64(s.Substring(2), 16), t); return Convert.ChangeType(Convert.ToUInt64(s[2..], 16), t);
} }
return Convert.ChangeType(Convert.ToInt64(s.Substring(2), 16), t); return Convert.ChangeType(Convert.ToInt64(s[2..], 16), t);
} }
return Convert.ChangeType(s, t); return Convert.ChangeType(s, t);
@ -621,12 +621,6 @@ public class XmlPropertiesGump : Gump
{ {
return Convert.ChangeType(s, t); return Convert.ChangeType(s, t);
} }
if (t.IsDefined(typeof(ParsableAttribute), false))
{
MethodInfo parseMethod = t.GetMethod("Parse", new[] { typeof(string) });
return parseMethod.Invoke(null, new object[] { s });
}
throw new Exception("bad"); throw new Exception("bad");
} }

View file

@ -181,7 +181,7 @@ public class XmlSetObjectGump : Gump
{ {
toSet = null; toSet = null;
shouldSet = false; shouldSet = false;
m_Mobile.SendMessage("The object with that serial could not be assigned to a property of type : {0}", m_Type.Name); m_Mobile.SendMessage($"The object with that serial could not be assigned to a property of type : {m_Type.Name}");
} }
else else
{ {

View file

@ -49,7 +49,7 @@ public class XmlSetObjectTarget : Target
} }
else else
{ {
m_Mobile.SendMessage("That cannot be assigned to a property of type : {0}", m_Type.Name); m_Mobile.SendMessage($"That cannot be assigned to a property of type : {m_Type.Name}");
} }
} }
catch catch

File diff suppressed because it is too large Load diff

View file

@ -510,18 +510,18 @@ public class XmlSpawnerGump : Gump
} }
string strnext; string strnext;
if (m_Spawner.SpawnObjects[i].NextSpawn > DateTime.UtcNow) if (m_Spawner.SpawnObjects[i].NextSpawn > Core.Now)
{ {
// if the next spawn tick of the spawner will occur after the subgroup is available for spawning // if the next spawn tick of the spawner will occur after the subgroup is available for spawning
// then report the next spawn tick since that is the earliest that the subgroup can actually be spawned // then report the next spawn tick since that is the earliest that the subgroup can actually be spawned
if (DateTime.UtcNow + m_Spawner.NextSpawn > m_Spawner.SpawnObjects[i].NextSpawn) if (Core.Now + m_Spawner.NextSpawn > m_Spawner.SpawnObjects[i].NextSpawn)
{ {
strnext = m_Spawner.NextSpawn.ToString(); strnext = m_Spawner.NextSpawn.ToString();
} }
else else
{ {
// estimate the earliest the next spawn could occur as the first spawn tick after reaching the subgroup nextspawn // estimate the earliest the next spawn could occur as the first spawn tick after reaching the subgroup nextspawn
strnext = (m_Spawner.SpawnObjects[i].NextSpawn - DateTime.UtcNow + m_Spawner.NextSpawn).ToString(); strnext = (m_Spawner.SpawnObjects[i].NextSpawn - Core.Now + m_Spawner.NextSpawn).ToString();
} }
} }
else else
@ -665,16 +665,7 @@ public class XmlSpawnerGump : Gump
{ {
CommandLogging.WriteLine( CommandLogging.WriteLine(
from, from,
"{0} {1} changed XmlSpawner {2} '{3}' [{4}, {5}] ({6}) : {7} to {8}", $"{from.AccessLevel} {CommandLogging.Format(from)} changed XmlSpawner {m_Spawner.Serial} '{m_Spawner.Name}' [{m_Spawner.GetWorldLocation().X}, {m_Spawner.GetWorldLocation().Y}] ({m_Spawner.Map}) : {m_Spawner.SpawnObjects[i].TypeName} to {str}"
from.AccessLevel,
CommandLogging.Format(from),
m_Spawner.Serial,
m_Spawner.Name,
m_Spawner.GetWorldLocation().X,
m_Spawner.GetWorldLocation().Y,
m_Spawner.Map,
m_Spawner.SpawnObjects[i].TypeName,
str
); );
} }
@ -740,7 +731,7 @@ public class XmlSpawnerGump : Gump
if (from != null && !from.Deleted) if (from != null && !from.Deleted)
{ {
from.SendMessage("{0} is not available", i); from.SendMessage($"{i} is not available");
} }
} }
else if (o is Mobile m) else if (o is Mobile m)
@ -752,7 +743,7 @@ public class XmlSpawnerGump : Gump
if (from != null && !from.Deleted) if (from != null && !from.Deleted)
{ {
from.SendMessage("{0} is not available", m); from.SendMessage($"{m} is not available");
} }
} }

View file

@ -270,25 +270,11 @@ public class XmlSpawnerSkillCheck
// determine whether there are any registered objects for this skill // determine whether there are any registered objects for this skill
foreach(RegisteredSkill rs in skilllist) foreach(RegisteredSkill rs in skilllist)
{ {
if (rs.sid == skill.SkillName) // if so then invoke their skill handlers
// call the spawner handler
if (rs.sid == skill.SkillName && rs.target is XmlSpawner spawner && spawner.HandlesOnSkillUse)
{ {
// if so then invoke their skill handlers spawner.OnSkillUse(m, skill, success);
if (rs.target is XmlSpawner spawner)
{
if (spawner.HandlesOnSkillUse)
{
// call the spawner handler
spawner.OnSkillUse(m, skill, success);
}
} else
if (rs.target is IXmlQuest quest)
{
if (quest.HandlesOnSkillUse)
{
// call the xmlquest handler
quest.OnSkillUse(m, skill, success);
}
}
} }
} }
} }

View file

@ -46,7 +46,7 @@ public class WriteMulti
if (e.Arguments != null && e.Arguments.Length < 1) if (e.Arguments != null && e.Arguments.Length < 1)
{ {
e.Mobile.SendMessage("Usage: {0} <MultiFile> [zmin zmax][-noitems][-nostatics][-nomultis][-noaddons][-invisible]", e.Command); e.Mobile.SendMessage($"Usage: {e.Command} <MultiFile> [zmin zmax][-noitems][-nostatics][-nomultis][-noaddons][-invisible]");
return; return;
} }
@ -99,7 +99,7 @@ public class WriteMulti
} }
catch catch
{ {
e.Mobile.SendMessage("{0} : Invalid zmin zmax arguments", e.Command); e.Mobile.SendMessage($"{e.Command} : Invalid zmin zmax arguments");
return; return;
} }
} }
@ -126,13 +126,6 @@ public class WriteMulti
try try
{ {
StreamReader op = new StreamReader(dirname, false); StreamReader op = new StreamReader(dirname, false);
if (op == null)
{
e.Mobile.SendMessage("Cannot access file {0}", dirname);
return;
}
string line = op.ReadLine(); string line = op.ReadLine();
op.Close(); op.Close();
@ -142,28 +135,28 @@ public class WriteMulti
{ {
string[] args = line.Split(" ".ToCharArray(), 3); string[] args = line.Split(" ".ToCharArray(), 3);
if (args == null || args.Length < 3) if (args.Length < 3)
{ {
e.Mobile.SendMessage("Cannot overwrite file {0} : not owner", dirname); e.Mobile.SendMessage($"Cannot overwrite file {dirname} : not owner");
return; return;
} }
if (args[2] != e.Mobile.Name) if (args[2] != e.Mobile.Name)
{ {
e.Mobile.SendMessage("Cannot overwrite file {0} : not owner", dirname); e.Mobile.SendMessage($"Cannot overwrite file {dirname} : not owner");
return; return;
} }
} }
else else
{ {
e.Mobile.SendMessage("Cannot overwrite file {0} : not owner", dirname); e.Mobile.SendMessage($"Cannot overwrite file {dirname} : not owner");
return; return;
} }
} }
catch catch
{ {
e.Mobile.SendMessage("Cannot overwrite file {0}", dirname); e.Mobile.SendMessage($"Cannot overwrite file {dirname}");
return; return;
} }
@ -410,7 +403,7 @@ public class WriteMulti
} }
catch catch
{ {
from.SendMessage("Error writing multi file {0}", dirname); from.SendMessage($"Error writing multi file {dirname}");
return; return;
} }
@ -418,11 +411,11 @@ public class WriteMulti
if (includeitems) if (includeitems)
{ {
from.SendMessage(66, "Included {0} items", nitems); from.SendMessage(66, $"Included {nitems} items");
if (includemultis) if (includemultis)
{ {
from.SendMessage("{0} multis", nmultis); from.SendMessage($"{nmultis} multis");
} }
else else
{ {
@ -431,7 +424,7 @@ public class WriteMulti
if (includeinvisible) if (includeinvisible)
{ {
from.SendMessage("{0} invisible", ninvisible); from.SendMessage($"{ninvisible} invisible");
} }
else else
{ {
@ -440,7 +433,7 @@ public class WriteMulti
if (includeaddons) if (includeaddons)
{ {
from.SendMessage("{0} addons", naddons); from.SendMessage($"{naddons} addons");
} }
else else
{ {
@ -455,14 +448,14 @@ public class WriteMulti
if (includestatics) if (includestatics)
{ {
from.SendMessage(66, "Included {0} statics", nstatics); from.SendMessage(66, $"Included {nstatics} statics");
} }
else else
{ {
from.SendMessage(33, "Ignored statics"); from.SendMessage(33, "Ignored statics");
} }
from.SendMessage(66, "Saved {0} components to {1}", ntotal, dirname); from.SendMessage(66, $"Saved {ntotal} components to {dirname}");
} }
} }
} }

View file

@ -378,7 +378,7 @@ public class XmlAddGump : Gump
{ {
if (from != null && !from.Deleted) if (from != null && !from.Deleted)
{ {
from.SendMessage("Error trying to save to file {0}", dirname); from.SendMessage($"Error trying to save to file {dirname}");
} }
return; return;
@ -386,7 +386,7 @@ public class XmlAddGump : Gump
if (from != null && !from.Deleted) if (from != null && !from.Deleted)
{ {
from.SendMessage("Saved defs to file {0}", dirname); from.SendMessage($"Saved defs to file {dirname}");
} }
} }
@ -426,7 +426,7 @@ public class XmlAddGump : Gump
if (fs == null) if (fs == null)
{ {
from.SendMessage("Unable to open {0} for loading", dirname); from.SendMessage($"Unable to open {dirname} for loading");
return; return;
} }
@ -447,7 +447,7 @@ public class XmlAddGump : Gump
{ {
if (from != null && !from.Deleted) if (from != null && !from.Deleted)
{ {
from.SendMessage(33, "Error reading defs file {0}", dirname); from.SendMessage(33, $"Error reading defs file {dirname}");
} }
return; return;
@ -590,7 +590,7 @@ public class XmlAddGump : Gump
if (from != null && !from.Deleted) if (from != null && !from.Deleted)
{ {
from.SendMessage("Loaded defs from file {0}", dirname); from.SendMessage($"Loaded defs from file {dirname}");
} }
} }
} }
@ -599,7 +599,7 @@ public class XmlAddGump : Gump
{ {
if (from != null && !from.Deleted) if (from != null && !from.Deleted)
{ {
from.SendMessage(33, "File not found: {0}", dirname); from.SendMessage(33, $"File not found: {dirname}");
} }
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -59,7 +59,7 @@ public class XmlFindGump : Gump
from.SendGump(gump); from.SendGump(gump);
if (status_str != null) if (status_str != null)
{ {
from.SendMessage(33, "XmlFind: {0}", status_str); from.SendMessage(33, $"XmlFind: {status_str}");
} }
} }
} }
@ -280,7 +280,7 @@ public class XmlFindGump : Gump
if (direction) if (direction)
{ {
// true means allow only mobs greater than the age // true means allow only mobs greater than the age
if (DateTime.UtcNow - mob.Created > TimeSpan.FromHours(age)) if (Core.Now - mob.Created > TimeSpan.FromHours(age))
{ {
return true; return true;
} }
@ -288,7 +288,7 @@ public class XmlFindGump : Gump
else else
{ {
// false means allow only mobs less than the age // false means allow only mobs less than the age
if (DateTime.UtcNow - mob.Created < TimeSpan.FromHours(age)) if (Core.Now - mob.Created < TimeSpan.FromHours(age))
{ {
return true; return true;
} }
@ -843,7 +843,7 @@ public class XmlFindGump : Gump
catch catch
{ {
dorange = false; dorange = false;
e.Mobile.SendMessage("Invalid range argument {0}", e.Arguments[1]); e.Mobile.SendMessage($"Invalid range argument {e.Arguments[1]}");
} }
} }
@ -1844,7 +1844,7 @@ public class XmlFindGump : Gump
return; return;
} }
} }
from.SendMessage("Invalid command: {0}", args[0]); from.SendMessage($"Invalid command: {args[0]}");
} }
} }
} }
@ -1987,8 +1987,7 @@ public class XmlFindGump : Gump
case 4: // SubSearch case 4: // SubSearch
{ {
// do the search // do the search
string status_str; m_SearchList = Search(m_SearchCriteria, out _);
m_SearchList = Search(m_SearchCriteria, out status_str);
break; break;
} }
case 150: // Open the map gump case 150: // Open the map gump