fix: Adds ISpanFormattable support to Serial (#1065)
This commit is contained in:
parent
4b2b7e2277
commit
b779d7737f
18 changed files with 269 additions and 204 deletions
|
|
@ -255,7 +255,7 @@ namespace Server.Misc
|
|||
}
|
||||
else
|
||||
{
|
||||
state.LogInfo($"Deleting character {index} (0x{m.Serial.Value:X})");
|
||||
state.LogInfo($"Deleting character {index} ({m.Serial})");
|
||||
|
||||
acct.Comments.Add(new AccountComment("System", $"Character #{index + 1} {m} deleted by {state}"));
|
||||
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ namespace Server.Commands.Generic
|
|||
case 4: // Go there
|
||||
{
|
||||
m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item));
|
||||
InvokeCommand($"Go {m_Item.Serial.Value}");
|
||||
InvokeCommand($"Go {m_Item.Serial}");
|
||||
break;
|
||||
}
|
||||
case 5: // Move to target
|
||||
|
|
@ -567,7 +567,7 @@ namespace Server.Commands.Generic
|
|||
case 4: // Go there
|
||||
{
|
||||
m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
|
||||
InvokeCommand($"Go {m_Mobile.Serial.Value}");
|
||||
InvokeCommand($"Go {m_Mobile.Serial}");
|
||||
break;
|
||||
}
|
||||
case 5: // Bring them here
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace Server.Commands
|
|||
o switch
|
||||
{
|
||||
Mobile m => m.Account == null ? $"{m} (no account)" : $"{m} ('{m.Account.Username}')",
|
||||
Item item => $"0x{item.Serial.Value:X} ({item.GetType().Name})",
|
||||
Item item => $"{item.Serial} ({item.GetType().Name})",
|
||||
_ => o
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -35,22 +35,22 @@ namespace Server.Commands
|
|||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
sb.AppendFormat("{0} {1} building ", from.AccessLevel, CommandLogging.Format(from));
|
||||
sb.Append($"{from.AccessLevel} {CommandLogging.Format(from)} building ");
|
||||
|
||||
if (start == end)
|
||||
{
|
||||
sb.AppendFormat("at {0} in {1}", start, from.Map);
|
||||
sb.Append($"at {start} in {from.Map}");
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.AppendFormat("from {0} to {1} in {2}", start, end, from.Map);
|
||||
sb.Append($"from {start} to {end} in {from.Map}");
|
||||
}
|
||||
|
||||
sb.Append(':');
|
||||
|
||||
for (var i = 0; i < args.Length; ++i)
|
||||
{
|
||||
sb.AppendFormat(" \"{0}\"", args[i]);
|
||||
sb.Append($" \"{args[i]}\"");
|
||||
}
|
||||
|
||||
CommandLogging.WriteLine(from, sb.ToString());
|
||||
|
|
@ -321,7 +321,7 @@ namespace Server.Commands
|
|||
{
|
||||
var built = Build(from, ctor, values, props, realProps, ref sendError);
|
||||
|
||||
sb.AppendFormat("0x{0:X}; ", built.Serial.Value);
|
||||
sb.Append($"{built.Serial}; ");
|
||||
|
||||
if (built is Item item)
|
||||
{
|
||||
|
|
@ -353,7 +353,7 @@ namespace Server.Commands
|
|||
|
||||
var built = Build(from, ctor, values, props, realProps, ref sendError);
|
||||
|
||||
sb.AppendFormat("0x{0:X}; ", built.Serial.Value);
|
||||
sb.Append($"{built.Serial}; ");
|
||||
|
||||
if (built is Item item)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ namespace Server.Gumps
|
|||
if (m != null)
|
||||
{
|
||||
AddHtml(14, 36 + line * 20, 200, 20, Color("Mobile:", LabelColor32));
|
||||
AddHtml(70, 36 + line++ * 20, 200, 20, Color($"{m.Name} (0x{m.Serial.Value:X})", LabelColor32));
|
||||
AddHtml(70, 36 + line++ * 20, 200, 20, Color($"{m.Name} ({m.Serial})", LabelColor32));
|
||||
|
||||
AddHtml(14, 36 + line * 20, 200, 20, Color("Location:", LabelColor32));
|
||||
AddHtml(70, 36 + line++ * 20, 200, 20, Color($"{m.Location} [{m.Map}]", LabelColor32));
|
||||
|
|
|
|||
|
|
@ -511,16 +511,16 @@ namespace Server.Gumps
|
|||
{
|
||||
if (serial.IsItem)
|
||||
{
|
||||
return $"(I) 0x{serial.Value:X}";
|
||||
return $"(I) {serial}";
|
||||
}
|
||||
|
||||
if (serial.IsMobile)
|
||||
{
|
||||
return $"(M) 0x{serial.Value:X}";
|
||||
return $"(M) {serial}";
|
||||
}
|
||||
}
|
||||
|
||||
return $"(?) 0x{serial.Value:X}";
|
||||
return $"(?) {serial}";
|
||||
}
|
||||
|
||||
if (o is byte or sbyte or short or ushort or int or uint or long or ulong)
|
||||
|
|
@ -530,12 +530,12 @@ namespace Server.Gumps
|
|||
|
||||
if (o is Mobile mobile)
|
||||
{
|
||||
return $"(M) 0x{mobile.Serial.Value:X} \"{mobile.Name}\"";
|
||||
return $"(M) {mobile.Serial} \"{mobile.Name}\"";
|
||||
}
|
||||
|
||||
if (o is Item item)
|
||||
{
|
||||
return $"(I) 0x{item.Serial.Value:X}";
|
||||
return $"(I) {item.Serial}";
|
||||
}
|
||||
|
||||
if (o is Type type)
|
||||
|
|
|
|||
|
|
@ -1056,21 +1056,21 @@ namespace Server.Items
|
|||
|
||||
if (m != null && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
|
||||
{
|
||||
var modName = Serial.ToString();
|
||||
var serial = Serial;
|
||||
|
||||
if (strBonus != 0)
|
||||
{
|
||||
m.AddStatMod(new StatMod(StatType.Str, $"{modName}Str", strBonus, TimeSpan.Zero));
|
||||
m.AddStatMod(new StatMod(StatType.Str, $"{serial}Str", strBonus, TimeSpan.Zero));
|
||||
}
|
||||
|
||||
if (dexBonus != 0)
|
||||
{
|
||||
m.AddStatMod(new StatMod(StatType.Dex, $"{modName}Dex", dexBonus, TimeSpan.Zero));
|
||||
m.AddStatMod(new StatMod(StatType.Dex, $"{serial}Dex", dexBonus, TimeSpan.Zero));
|
||||
}
|
||||
|
||||
if (intBonus != 0)
|
||||
{
|
||||
m.AddStatMod(new StatMod(StatType.Int, $"{modName}Int", intBonus, TimeSpan.Zero));
|
||||
m.AddStatMod(new StatMod(StatType.Int, $"{serial}Int", intBonus, TimeSpan.Zero));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1180,21 +1180,21 @@ namespace Server.Items
|
|||
|
||||
if (strBonus != 0 || dexBonus != 0 || intBonus != 0)
|
||||
{
|
||||
var modName = Serial.ToString();
|
||||
var serial = Serial;
|
||||
|
||||
if (strBonus != 0)
|
||||
{
|
||||
from.AddStatMod(new StatMod(StatType.Str, $"{modName}Str", strBonus, TimeSpan.Zero));
|
||||
from.AddStatMod(new StatMod(StatType.Str, $"{serial}Str", strBonus, TimeSpan.Zero));
|
||||
}
|
||||
|
||||
if (dexBonus != 0)
|
||||
{
|
||||
from.AddStatMod(new StatMod(StatType.Dex, $"{modName}Dex", dexBonus, TimeSpan.Zero));
|
||||
from.AddStatMod(new StatMod(StatType.Dex, $"{serial}Dex", dexBonus, TimeSpan.Zero));
|
||||
}
|
||||
|
||||
if (intBonus != 0)
|
||||
{
|
||||
from.AddStatMod(new StatMod(StatType.Int, $"{modName}Int", intBonus, TimeSpan.Zero));
|
||||
from.AddStatMod(new StatMod(StatType.Int, $"{serial}Int", intBonus, TimeSpan.Zero));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1205,11 +1205,11 @@ namespace Server.Items
|
|||
{
|
||||
if (parent is Mobile m)
|
||||
{
|
||||
var modName = Serial.ToString();
|
||||
var serial = Serial;
|
||||
|
||||
m.RemoveStatMod($"{modName}Str");
|
||||
m.RemoveStatMod($"{modName}Dex");
|
||||
m.RemoveStatMod($"{modName}Int");
|
||||
m.RemoveStatMod($"{serial}Str");
|
||||
m.RemoveStatMod($"{serial}Dex");
|
||||
m.RemoveStatMod($"{serial}Int");
|
||||
|
||||
if (Core.AOS)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -518,21 +518,21 @@ namespace Server.Items
|
|||
return;
|
||||
}
|
||||
|
||||
var modName = Serial.ToString();
|
||||
var serial = Serial;
|
||||
|
||||
if (strBonus != 0)
|
||||
{
|
||||
parent.AddStatMod(new StatMod(StatType.Str, $"{modName}Str", strBonus, TimeSpan.Zero));
|
||||
parent.AddStatMod(new StatMod(StatType.Str, $"{serial}Str", strBonus, TimeSpan.Zero));
|
||||
}
|
||||
|
||||
if (dexBonus != 0)
|
||||
{
|
||||
parent.AddStatMod(new StatMod(StatType.Dex, $"{modName}Dex", dexBonus, TimeSpan.Zero));
|
||||
parent.AddStatMod(new StatMod(StatType.Dex, $"{serial}Dex", dexBonus, TimeSpan.Zero));
|
||||
}
|
||||
|
||||
if (intBonus != 0)
|
||||
{
|
||||
parent.AddStatMod(new StatMod(StatType.Int, $"{modName}Int", intBonus, TimeSpan.Zero));
|
||||
parent.AddStatMod(new StatMod(StatType.Int, $"{serial}Int", intBonus, TimeSpan.Zero));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -619,11 +619,11 @@ namespace Server.Items
|
|||
SkillBonuses.Remove();
|
||||
}
|
||||
|
||||
var modName = Serial.ToString();
|
||||
var serial = Serial;
|
||||
|
||||
mob.RemoveStatMod($"{modName}Str");
|
||||
mob.RemoveStatMod($"{modName}Dex");
|
||||
mob.RemoveStatMod($"{modName}Int");
|
||||
mob.RemoveStatMod($"{serial}Str");
|
||||
mob.RemoveStatMod($"{serial}Dex");
|
||||
mob.RemoveStatMod($"{serial}Int");
|
||||
|
||||
mob.CheckStatTimers();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -212,21 +212,21 @@ public abstract partial class BaseJewel : Item, ICraftable
|
|||
|
||||
if (strBonus != 0 || dexBonus != 0 || intBonus != 0)
|
||||
{
|
||||
var modName = Serial.ToString();
|
||||
var serial = Serial;
|
||||
|
||||
if (strBonus != 0)
|
||||
{
|
||||
from.AddStatMod(new StatMod(StatType.Str, $"{modName}Str", strBonus, TimeSpan.Zero));
|
||||
from.AddStatMod(new StatMod(StatType.Str, $"{serial}Str", strBonus, TimeSpan.Zero));
|
||||
}
|
||||
|
||||
if (dexBonus != 0)
|
||||
{
|
||||
from.AddStatMod(new StatMod(StatType.Dex, $"{modName}Dex", dexBonus, TimeSpan.Zero));
|
||||
from.AddStatMod(new StatMod(StatType.Dex, $"{serial}Dex", dexBonus, TimeSpan.Zero));
|
||||
}
|
||||
|
||||
if (intBonus != 0)
|
||||
{
|
||||
from.AddStatMod(new StatMod(StatType.Int, $"{modName}Int", intBonus, TimeSpan.Zero));
|
||||
from.AddStatMod(new StatMod(StatType.Int, $"{serial}Int", intBonus, TimeSpan.Zero));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -240,11 +240,11 @@ public abstract partial class BaseJewel : Item, ICraftable
|
|||
{
|
||||
SkillBonuses.Remove();
|
||||
|
||||
var modName = Serial.ToString();
|
||||
var serial = Serial;
|
||||
|
||||
from.RemoveStatMod($"{modName}Str");
|
||||
from.RemoveStatMod($"{modName}Dex");
|
||||
from.RemoveStatMod($"{modName}Int");
|
||||
from.RemoveStatMod($"{serial}Str");
|
||||
from.RemoveStatMod($"{serial}Dex");
|
||||
from.RemoveStatMod($"{serial}Int");
|
||||
|
||||
from.CheckStatTimers();
|
||||
}
|
||||
|
|
@ -421,21 +421,21 @@ public abstract partial class BaseJewel : Item, ICraftable
|
|||
|
||||
if (m != null && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
|
||||
{
|
||||
var modName = Serial.ToString();
|
||||
var serial = Serial;
|
||||
|
||||
if (strBonus != 0)
|
||||
{
|
||||
m.AddStatMod(new StatMod(StatType.Str, $"{modName}Str", strBonus, TimeSpan.Zero));
|
||||
m.AddStatMod(new StatMod(StatType.Str, $"{serial}Str", strBonus, TimeSpan.Zero));
|
||||
}
|
||||
|
||||
if (dexBonus != 0)
|
||||
{
|
||||
m.AddStatMod(new StatMod(StatType.Dex, $"{modName}Dex", dexBonus, TimeSpan.Zero));
|
||||
m.AddStatMod(new StatMod(StatType.Dex, $"{serial}Dex", dexBonus, TimeSpan.Zero));
|
||||
}
|
||||
|
||||
if (intBonus != 0)
|
||||
{
|
||||
m.AddStatMod(new StatMod(StatType.Int, $"{modName}Int", intBonus, TimeSpan.Zero));
|
||||
m.AddStatMod(new StatMod(StatType.Int, $"{serial}Int", intBonus, TimeSpan.Zero));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -623,21 +623,21 @@ namespace Server.Items
|
|||
|
||||
if (strBonus != 0 || dexBonus != 0 || intBonus != 0)
|
||||
{
|
||||
var modName = Serial.ToString();
|
||||
var serial = Serial;
|
||||
|
||||
if (strBonus != 0)
|
||||
{
|
||||
from.AddStatMod(new StatMod(StatType.Str, $"{modName}Str", strBonus, TimeSpan.Zero));
|
||||
from.AddStatMod(new StatMod(StatType.Str, $"{serial}Str", strBonus, TimeSpan.Zero));
|
||||
}
|
||||
|
||||
if (dexBonus != 0)
|
||||
{
|
||||
from.AddStatMod(new StatMod(StatType.Dex, $"{modName}Dex", dexBonus, TimeSpan.Zero));
|
||||
from.AddStatMod(new StatMod(StatType.Dex, $"{serial}Dex", dexBonus, TimeSpan.Zero));
|
||||
}
|
||||
|
||||
if (intBonus != 0)
|
||||
{
|
||||
from.AddStatMod(new StatMod(StatType.Int, $"{modName}Int", intBonus, TimeSpan.Zero));
|
||||
from.AddStatMod(new StatMod(StatType.Int, $"{serial}Int", intBonus, TimeSpan.Zero));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -651,11 +651,11 @@ namespace Server.Items
|
|||
{
|
||||
SkillBonuses.Remove();
|
||||
|
||||
var modName = Serial.ToString();
|
||||
var serial = Serial;
|
||||
|
||||
from.RemoveStatMod($"{modName}Str");
|
||||
from.RemoveStatMod($"{modName}Dex");
|
||||
from.RemoveStatMod($"{modName}Int");
|
||||
from.RemoveStatMod($"{serial}Str");
|
||||
from.RemoveStatMod($"{serial}Dex");
|
||||
from.RemoveStatMod($"{serial}Int");
|
||||
|
||||
from.CheckStatTimers();
|
||||
}
|
||||
|
|
@ -974,21 +974,21 @@ namespace Server.Items
|
|||
{
|
||||
if (strBonus != 0 || dexBonus != 0 || intBonus != 0)
|
||||
{
|
||||
var modName = Serial.ToString();
|
||||
var serial = Serial;
|
||||
|
||||
if (strBonus != 0)
|
||||
{
|
||||
m.AddStatMod(new StatMod(StatType.Str, $"{modName}Str", strBonus, TimeSpan.Zero));
|
||||
m.AddStatMod(new StatMod(StatType.Str, $"{serial}Str", strBonus, TimeSpan.Zero));
|
||||
}
|
||||
|
||||
if (dexBonus != 0)
|
||||
{
|
||||
m.AddStatMod(new StatMod(StatType.Dex, $"{modName}Dex", dexBonus, TimeSpan.Zero));
|
||||
m.AddStatMod(new StatMod(StatType.Dex, $"{serial}Dex", dexBonus, TimeSpan.Zero));
|
||||
}
|
||||
|
||||
if (intBonus != 0)
|
||||
{
|
||||
m.AddStatMod(new StatMod(StatType.Int, $"{modName}Int", intBonus, TimeSpan.Zero));
|
||||
m.AddStatMod(new StatMod(StatType.Int, $"{serial}Int", intBonus, TimeSpan.Zero));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -939,21 +939,21 @@ namespace Server.Items
|
|||
{
|
||||
var m = from;
|
||||
|
||||
var modName = Serial.ToString();
|
||||
var serial = Serial;
|
||||
|
||||
if (strBonus != 0)
|
||||
{
|
||||
m.AddStatMod(new StatMod(StatType.Str, $"{modName}Str", strBonus, TimeSpan.Zero));
|
||||
m.AddStatMod(new StatMod(StatType.Str, $"{serial}Str", strBonus, TimeSpan.Zero));
|
||||
}
|
||||
|
||||
if (dexBonus != 0)
|
||||
{
|
||||
m.AddStatMod(new StatMod(StatType.Dex, $"{modName}Dex", dexBonus, TimeSpan.Zero));
|
||||
m.AddStatMod(new StatMod(StatType.Dex, $"{serial}Dex", dexBonus, TimeSpan.Zero));
|
||||
}
|
||||
|
||||
if (intBonus != 0)
|
||||
{
|
||||
m.AddStatMod(new StatMod(StatType.Int, $"{modName}Int", intBonus, TimeSpan.Zero));
|
||||
m.AddStatMod(new StatMod(StatType.Int, $"{serial}Int", intBonus, TimeSpan.Zero));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1004,11 +1004,11 @@ namespace Server.Items
|
|||
return;
|
||||
}
|
||||
|
||||
var modName = Serial.ToString();
|
||||
var serial = Serial;
|
||||
|
||||
m.RemoveStatMod($"{modName}Str");
|
||||
m.RemoveStatMod($"{modName}Dex");
|
||||
m.RemoveStatMod($"{modName}Int");
|
||||
m.RemoveStatMod($"{serial}Str");
|
||||
m.RemoveStatMod($"{serial}Dex");
|
||||
m.RemoveStatMod($"{serial}Int");
|
||||
|
||||
if (!_enableInstaHit && m.Weapon is BaseWeapon weapon)
|
||||
{
|
||||
|
|
@ -4148,21 +4148,21 @@ namespace Server.Items
|
|||
|
||||
if (parentMobile != null && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
|
||||
{
|
||||
var modName = Serial.ToString();
|
||||
var serial = Serial;
|
||||
|
||||
if (strBonus != 0)
|
||||
{
|
||||
parentMobile.AddStatMod(new StatMod(StatType.Str, $"{modName}Str", strBonus, TimeSpan.Zero));
|
||||
parentMobile.AddStatMod(new StatMod(StatType.Str, $"{serial}Str", strBonus, TimeSpan.Zero));
|
||||
}
|
||||
|
||||
if (dexBonus != 0)
|
||||
{
|
||||
parentMobile.AddStatMod(new StatMod(StatType.Dex, $"{modName}Dex", dexBonus, TimeSpan.Zero));
|
||||
parentMobile.AddStatMod(new StatMod(StatType.Dex, $"{serial}Dex", dexBonus, TimeSpan.Zero));
|
||||
}
|
||||
|
||||
if (intBonus != 0)
|
||||
{
|
||||
parentMobile.AddStatMod(new StatMod(StatType.Int, $"{modName}Int", intBonus, TimeSpan.Zero));
|
||||
parentMobile.AddStatMod(new StatMod(StatType.Int, $"{serial}Int", intBonus, TimeSpan.Zero));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -566,21 +566,21 @@ namespace Server
|
|||
|
||||
if (strBonus != 0 || dexBonus != 0 || intBonus != 0)
|
||||
{
|
||||
var modName = Owner.Serial.ToString();
|
||||
var serial = Owner.Serial;
|
||||
|
||||
if (strBonus != 0)
|
||||
{
|
||||
to.AddStatMod(new StatMod(StatType.Str, $"{modName}Str", strBonus, TimeSpan.Zero));
|
||||
to.AddStatMod(new StatMod(StatType.Str, $"{serial}Str", strBonus, TimeSpan.Zero));
|
||||
}
|
||||
|
||||
if (dexBonus != 0)
|
||||
{
|
||||
to.AddStatMod(new StatMod(StatType.Dex, $"{modName}Dex", dexBonus, TimeSpan.Zero));
|
||||
to.AddStatMod(new StatMod(StatType.Dex, $"{serial}Dex", dexBonus, TimeSpan.Zero));
|
||||
}
|
||||
|
||||
if (intBonus != 0)
|
||||
{
|
||||
to.AddStatMod(new StatMod(StatType.Int, $"{modName}Int", intBonus, TimeSpan.Zero));
|
||||
to.AddStatMod(new StatMod(StatType.Int, $"{serial}Int", intBonus, TimeSpan.Zero));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -589,11 +589,11 @@ namespace Server
|
|||
|
||||
public void RemoveStatBonuses(Mobile from)
|
||||
{
|
||||
var modName = Owner.Serial.ToString();
|
||||
var serial = Owner.Serial;
|
||||
|
||||
from.RemoveStatMod($"{modName}Str");
|
||||
from.RemoveStatMod($"{modName}Dex");
|
||||
from.RemoveStatMod($"{modName}Int");
|
||||
from.RemoveStatMod($"{serial}Str");
|
||||
from.RemoveStatMod($"{serial}Dex");
|
||||
from.RemoveStatMod($"{serial}Int");
|
||||
|
||||
from.CheckStatTimers();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ namespace Server.Misc
|
|||
|
||||
if (m != null)
|
||||
{
|
||||
op.Write($" (mobile = 0x{m.Serial.Value:X} '{m.Name}')");
|
||||
op.Write($" (mobile = {m.Serial} '{m.Name}')");
|
||||
}
|
||||
|
||||
op.WriteLine();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue