Fixes null propogation and expression is always true/false
This commit is contained in:
parent
a48ebb3a5f
commit
8da55d6043
6 changed files with 37 additions and 58 deletions
|
|
@ -3188,16 +3188,8 @@ namespace Server.Multis
|
||||||
{
|
{
|
||||||
base.GetProperties(list);
|
base.GetProperties(list);
|
||||||
|
|
||||||
string houseName, owner, location;
|
string houseName = m_House == null ? "an unnamed house" : m_House.Sign.GetName();
|
||||||
|
string owner = m_House?.Owner?.Name ?? "nobody";
|
||||||
houseName = m_House == null ? "an unnamed house" : m_House.Sign.GetName();
|
|
||||||
|
|
||||||
Mobile houseOwner = m_House?.Owner;
|
|
||||||
|
|
||||||
if (houseOwner == null)
|
|
||||||
owner = "nobody";
|
|
||||||
else
|
|
||||||
owner = houseOwner.Name;
|
|
||||||
|
|
||||||
int xLong = 0, yLat = 0, xMins = 0, yMins = 0;
|
int xLong = 0, yLat = 0, xMins = 0, yMins = 0;
|
||||||
bool xEast = false, ySouth = false;
|
bool xEast = false, ySouth = false;
|
||||||
|
|
@ -3205,10 +3197,8 @@ namespace Server.Multis
|
||||||
bool valid = m_House != null && Sextant.Format(m_House.Location, m_House.Map, ref xLong, ref yLat, ref xMins,
|
bool valid = m_House != null && Sextant.Format(m_House.Location, m_House.Map, ref xLong, ref yLat, ref xMins,
|
||||||
ref yMins, ref xEast, ref ySouth);
|
ref yMins, ref xEast, ref ySouth);
|
||||||
|
|
||||||
if (valid)
|
string location =
|
||||||
location = $"{yLat}° {yMins}'{(ySouth ? "S" : "N")}, {xLong}° {xMins}'{(xEast ? "E" : "W")}";
|
valid ? $"{yLat}° {yMins}'{(ySouth ? "S" : "N")}, {xLong}° {xMins}'{(xEast ? "E" : "W")}" : "unknown";
|
||||||
else
|
|
||||||
location = "unknown";
|
|
||||||
|
|
||||||
list.Add(1061112, Utility.FixHtml(houseName)); // House Name: ~1_val~
|
list.Add(1061112, Utility.FixHtml(houseName)); // House Name: ~1_val~
|
||||||
list.Add(1061113, owner); // Owner: ~1_val~
|
list.Add(1061113, owner); // Owner: ~1_val~
|
||||||
|
|
@ -3764,7 +3754,7 @@ namespace Server.Multis
|
||||||
|
|
||||||
ISecurable sec = null;
|
ISecurable sec = null;
|
||||||
|
|
||||||
if (item is ISecurable)
|
if (item is ISecurable securable)
|
||||||
{
|
{
|
||||||
bool isOwned = house.Doors.Contains(item);
|
bool isOwned = house.Doors.Contains(item);
|
||||||
|
|
||||||
|
|
@ -3775,7 +3765,7 @@ namespace Server.Multis
|
||||||
isOwned = house.HasLockedDownItem(item);
|
isOwned = house.HasLockedDownItem(item);
|
||||||
|
|
||||||
if (isOwned)
|
if (isOwned)
|
||||||
sec = (ISecurable)item;
|
sec = securable;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -913,8 +913,8 @@ namespace Server.Spells
|
||||||
|
|
||||||
m_Spell.OnCast();
|
m_Spell.OnCast();
|
||||||
|
|
||||||
if (m_Spell.Caster.Player && m_Spell.Caster.Target != originalTarget && m_Spell.Caster.Target != null)
|
if (m_Spell.Caster.Player && m_Spell.Caster.Target != originalTarget)
|
||||||
m_Spell.Caster.Target.BeginTimeout(m_Spell.Caster, TimeSpan.FromSeconds(30.0));
|
m_Spell.Caster.Target?.BeginTimeout(m_Spell.Caster, TimeSpan.FromSeconds(30.0));
|
||||||
|
|
||||||
m_Spell.m_CastTimer = null;
|
m_Spell.m_CastTimer = null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3189,8 +3189,7 @@ namespace Server
|
||||||
|
|
||||||
private void StopAggrExpire()
|
private void StopAggrExpire()
|
||||||
{
|
{
|
||||||
if (m_ExpireAggrTimer != null)
|
m_ExpireAggrTimer?.Stop();
|
||||||
m_ExpireAggrTimer.Stop();
|
|
||||||
|
|
||||||
m_ExpireAggrTimer = null;
|
m_ExpireAggrTimer = null;
|
||||||
}
|
}
|
||||||
|
|
@ -8221,16 +8220,17 @@ namespace Server
|
||||||
|
|
||||||
public override void OnResponse(Mobile from, string text)
|
public override void OnResponse(Mobile from, string text)
|
||||||
{
|
{
|
||||||
if (m_Callback != null)
|
m_Callback?.Invoke(@from, text);
|
||||||
m_Callback(from, text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnCancel(Mobile from)
|
public override void OnCancel(Mobile from)
|
||||||
{
|
{
|
||||||
if (m_CallbackHandlesCancel && m_Callback != null)
|
if (m_CallbackHandlesCancel && m_Callback != null)
|
||||||
m_Callback(from, "");
|
m_Callback(from, "");
|
||||||
else if (m_CancelCallback != null)
|
else
|
||||||
m_CancelCallback(from, "");
|
{
|
||||||
|
m_CancelCallback?.Invoke(@from, "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -8285,16 +8285,17 @@ namespace Server
|
||||||
|
|
||||||
public override void OnResponse(Mobile from, string text)
|
public override void OnResponse(Mobile from, string text)
|
||||||
{
|
{
|
||||||
if (m_Callback != null)
|
m_Callback?.Invoke(@from, text, m_State);
|
||||||
m_Callback(from, text, m_State);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnCancel(Mobile from)
|
public override void OnCancel(Mobile from)
|
||||||
{
|
{
|
||||||
if (m_CallbackHandlesCancel && m_Callback != null)
|
if (m_CallbackHandlesCancel && m_Callback != null)
|
||||||
m_Callback(from, "", m_State);
|
m_Callback(from, "", m_State);
|
||||||
else if (m_CancelCallback != null)
|
else
|
||||||
m_CancelCallback(from, "", m_State);
|
{
|
||||||
|
m_CancelCallback?.Invoke(@from, "", m_State);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -8349,16 +8350,17 @@ namespace Server
|
||||||
|
|
||||||
public override void OnResponse(Mobile from, string text)
|
public override void OnResponse(Mobile from, string text)
|
||||||
{
|
{
|
||||||
if (m_Callback != null)
|
m_Callback?.Invoke(@from, text, m_State);
|
||||||
m_Callback(from, text, m_State);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnCancel(Mobile from)
|
public override void OnCancel(Mobile from)
|
||||||
{
|
{
|
||||||
if (m_CallbackHandlesCancel && m_Callback != null)
|
if (m_CallbackHandlesCancel && m_Callback != null)
|
||||||
m_Callback(from, "", m_State);
|
m_Callback(from, "", m_State);
|
||||||
else if (m_CancelCallback != null)
|
else
|
||||||
m_CancelCallback(from, "", m_State);
|
{
|
||||||
|
m_CancelCallback?.Invoke(@from, "", m_State);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -10058,10 +10060,7 @@ namespace Server
|
||||||
|
|
||||||
public void PrivateOverheadMessage(MessageType type, int hue, int number, string args, NetState state)
|
public void PrivateOverheadMessage(MessageType type, int hue, int number, string args, NetState state)
|
||||||
{
|
{
|
||||||
if (state == null)
|
state?.Send(new MessageLocalized(Serial, Body, type, hue, 3, number, Name, args));
|
||||||
return;
|
|
||||||
|
|
||||||
state.Send(new MessageLocalized(Serial, Body, type, hue, 3, number, Name, args));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LocalOverheadMessage(MessageType type, int hue, bool ascii, string text)
|
public void LocalOverheadMessage(MessageType type, int hue, bool ascii, string text)
|
||||||
|
|
@ -10086,8 +10085,7 @@ namespace Server
|
||||||
{
|
{
|
||||||
NetState ns = m_NetState;
|
NetState ns = m_NetState;
|
||||||
|
|
||||||
if (ns != null)
|
ns?.Send(new MessageLocalized(Serial, Body, type, hue, 3, number, Name, args));
|
||||||
ns.Send(new MessageLocalized(Serial, Body, type, hue, 3, number, Name, args));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NonlocalOverheadMessage(MessageType type, int hue, int number)
|
public void NonlocalOverheadMessage(MessageType type, int hue, int number)
|
||||||
|
|
@ -10146,8 +10144,7 @@ namespace Server
|
||||||
{
|
{
|
||||||
NetState ns = m_NetState;
|
NetState ns = m_NetState;
|
||||||
|
|
||||||
if (ns != null)
|
ns?.Send(MessageLocalized.InstantiateGeneric(number));
|
||||||
ns.Send(MessageLocalized.InstantiateGeneric(number));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendLocalizedMessage(int number, string args)
|
public void SendLocalizedMessage(int number, string args)
|
||||||
|
|
@ -10161,15 +10158,13 @@ namespace Server
|
||||||
{
|
{
|
||||||
NetState ns = m_NetState;
|
NetState ns = m_NetState;
|
||||||
|
|
||||||
if (ns != null)
|
ns?.Send(MessageLocalized.InstantiateGeneric(number));
|
||||||
ns.Send(MessageLocalized.InstantiateGeneric(number));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NetState ns = m_NetState;
|
NetState ns = m_NetState;
|
||||||
|
|
||||||
if (ns != null)
|
ns?.Send(new MessageLocalized(Serial.MinusOne, -1, MessageType.Regular, hue, 3, number, "System", args));
|
||||||
ns.Send(new MessageLocalized(Serial.MinusOne, -1, MessageType.Regular, hue, 3, number, "System", args));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -10187,9 +10182,8 @@ namespace Server
|
||||||
{
|
{
|
||||||
NetState ns = m_NetState;
|
NetState ns = m_NetState;
|
||||||
|
|
||||||
if (ns != null)
|
ns?.Send(new MessageLocalizedAffix(Serial.MinusOne, -1, MessageType.Regular, hue, 3, number, "System",
|
||||||
ns.Send(new MessageLocalizedAffix(Serial.MinusOne, -1, MessageType.Regular, hue, 3, number, "System",
|
(append ? AffixType.Append : AffixType.Prepend) | AffixType.System, affix, args));
|
||||||
(append ? AffixType.Append : AffixType.Prepend) | AffixType.System, affix, args));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -10210,8 +10204,7 @@ namespace Server
|
||||||
{
|
{
|
||||||
NetState ns = m_NetState;
|
NetState ns = m_NetState;
|
||||||
|
|
||||||
if (ns != null)
|
ns?.Send(new UnicodeMessage(Serial.MinusOne, -1, MessageType.Regular, hue, 3, "ENU", "System", text));
|
||||||
ns.Send(new UnicodeMessage(Serial.MinusOne, -1, MessageType.Regular, hue, 3, "ENU", "System", text));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendMessage(int hue, string format, params object[] args)
|
public void SendMessage(int hue, string format, params object[] args)
|
||||||
|
|
@ -10233,8 +10226,7 @@ namespace Server
|
||||||
{
|
{
|
||||||
NetState ns = m_NetState;
|
NetState ns = m_NetState;
|
||||||
|
|
||||||
if (ns != null)
|
ns?.Send(new AsciiMessage(Serial.MinusOne, -1, MessageType.Regular, hue, 3, "System", text));
|
||||||
ns.Send(new AsciiMessage(Serial.MinusOne, -1, MessageType.Regular, hue, 3, "System", text));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendAsciiMessage(int hue, string format, params object[] args)
|
public void SendAsciiMessage(int hue, string format, params object[] args)
|
||||||
|
|
|
||||||
|
|
@ -518,7 +518,7 @@ namespace Server.Network
|
||||||
{
|
{
|
||||||
EquipInfoAttribute[] attrs = info.Attributes;
|
EquipInfoAttribute[] attrs = info.Attributes;
|
||||||
|
|
||||||
EnsureCapacity(17 + (info.Crafter == null ? 0 : 6 + info.Crafter.Name == null ? 0 : info.Crafter.Name.Length) +
|
EnsureCapacity(17 + (info.Crafter?.Name.Length ?? 0) +
|
||||||
(info.Unidentified ? 4 : 0) + attrs.Length * 6);
|
(info.Unidentified ? 4 : 0) + attrs.Length * 6);
|
||||||
|
|
||||||
m_Stream.Write((short)0x10);
|
m_Stream.Write((short)0x10);
|
||||||
|
|
|
||||||
|
|
@ -716,10 +716,9 @@ namespace Server
|
||||||
{
|
{
|
||||||
object[] attrs = type.GetCustomAttributes(typeofTypeAliasAttribute, false);
|
object[] attrs = type.GetCustomAttributes(typeofTypeAliasAttribute, false);
|
||||||
|
|
||||||
if (attrs != null && attrs.Length > 0)
|
if (attrs.Length > 0 && attrs[0] is TypeAliasAttribute attr)
|
||||||
if (attrs[0] is TypeAliasAttribute attr)
|
for (int j = 0; j < attr.Aliases.Length; ++j)
|
||||||
for (int j = 0; j < attr.Aliases.Length; ++j)
|
FullNames.Add(attr.Aliases[j], type);
|
||||||
FullNames.Add(attr.Aliases[j], type);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -154,8 +154,6 @@ namespace Server
|
||||||
|
|
||||||
string name = ToString();
|
string name = ToString();
|
||||||
|
|
||||||
if (name == null) name = "null";
|
|
||||||
|
|
||||||
return TimerProfile.Acquire(name);
|
return TimerProfile.Acquire(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue