fix: Update LabelTo, SendMessage, etc to Interpolated Strings (#1283)

This commit is contained in:
Fabrizio 2022-11-29 04:58:12 +01:00 committed by GitHub
parent 0facd73842
commit 537526a328
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
94 changed files with 514 additions and 769 deletions

View file

@ -672,7 +672,14 @@ public class Container : Item
if (CheckContentDisplay(from))
{
LabelTo(from, "({0} item{2}, {1} stones)", TotalItems, TotalWeight, TotalItems != 1 ? "s" : string.Empty);
if (TotalItems == 1)
{
LabelTo(from, $"({TotalItems} item, {TotalWeight} stones)");
}
else
{
LabelTo(from, $"({TotalItems} items, {TotalWeight} stones)");
}
}
// LabelTo( from, 1050044, String.Format( "{0}\t{1}", TotalItems.ToString(), TotalWeight.ToString() ) );

View file

@ -2235,11 +2235,6 @@ public class Item : IHued, IComparable<Item>, ISpawnable, IObjectPropertyListEnt
to.NetState.SendMessage(Serial, m_ItemID, MessageType.Label, 0x3B2, 3, false, "ENU", "", text);
}
public void LabelTo(Mobile to, string format, params object[] args)
{
LabelTo(to, string.Format(format, args));
}
public void LabelToAffix(Mobile to, int number, AffixType type, string affix, string args = "")
{
to.NetState.SendMessageLocalizedAffix(Serial, m_ItemID, MessageType.Label, 0x3B2, 3, number, "", type, affix, args);

View file

@ -117,7 +117,7 @@ public sealed class VirtualCheck : Item
public override void OnSingleClick(Mobile from)
{
LabelTo(from, "Offer: {0:#,0} platinum, {1:#,0} gold", Plat, Gold);
LabelTo(from, $"Offer: {Plat:#,0} platinum, {Gold:#,0} gold");
}
public override void GetProperties(IPropertyList list)

View file

@ -1004,7 +1004,7 @@ public class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPropertyLis
Delta(MobileDelta.Noto);
InvalidateProperties();
SendMessage("Your access level has been changed. You are now {0}.", GetAccessLevelName(value));
SendMessage($"Your access level has been changed. You are now {GetAccessLevelName(value)}.");
ClearScreen();
SendEverything();
@ -8092,11 +8092,6 @@ public class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPropertyLis
public void SayTo(Mobile to, string text) => SayTo(to, false, text);
public void SayTo(Mobile to, string format, params object[] args) => SayTo(to, false, string.Format(format, args));
public void SayTo(Mobile to, bool ascii, string format, params object[] args) =>
SayTo(to, ascii, string.Format(format, args));
public void SayTo(Mobile to, int number, string args = "") =>
to.NetState.SendMessageLocalized(Serial, Body, MessageType.Regular, SpeechHue, 3, number, Name, args);
@ -8104,8 +8099,6 @@ public class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPropertyLis
public void Say(string text) => PublicOverheadMessage(MessageType.Regular, SpeechHue, false, text);
public void Say(string format, params object[] args) => Say(string.Format(format, args));
public void Say(int number, AffixType type, string affix, string args) =>
PublicOverheadMessage(MessageType.Regular, SpeechHue, number, type, affix, args);
@ -8113,21 +8106,15 @@ public class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPropertyLis
public void Emote(string text) => PublicOverheadMessage(MessageType.Emote, EmoteHue, false, text);
public void Emote(string format, params object[] args) => Emote(string.Format(format, args));
public void Emote(int number, string args = "") => PublicOverheadMessage(MessageType.Emote, EmoteHue, number, args);
public void Whisper(string text) => PublicOverheadMessage(MessageType.Whisper, WhisperHue, false, text);
public void Whisper(string format, params object[] args) => Whisper(string.Format(format, args));
public void Whisper(int number, string args = "") =>
PublicOverheadMessage(MessageType.Whisper, WhisperHue, number, args);
public void Yell(string text) => PublicOverheadMessage(MessageType.Yell, YellHue, false, text);
public void Yell(string format, params object[] args) => Yell(string.Format(format, args));
public void Yell(int number, string args = "") =>
PublicOverheadMessage(MessageType.Yell, YellHue, number, args);
@ -9105,26 +9092,14 @@ public class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPropertyLis
public void SendMessage(string text) => SendMessage(0x3B2, text);
public void SendMessage(string format, params object[] args) =>
SendMessage(0x3B2, string.Format(format, args));
public void SendMessage(int hue, string text) =>
m_NetState.SendMessage(Serial.MinusOne, -1, MessageType.Regular, hue, 3, false, "ENU", "System", text);
public void SendMessage(int hue, string format, params object[] args) =>
SendMessage(hue, string.Format(format, args));
public void SendAsciiMessage(string text) => SendAsciiMessage(0x3B2, text);
public void SendAsciiMessage(string format, params object[] args) =>
SendAsciiMessage(0x3B2, string.Format(format, args));
public void SendAsciiMessage(int hue, string text) =>
m_NetState.SendMessage(Serial.MinusOne, -1, MessageType.Regular, hue, 3, true, null, "System", text);
public void SendAsciiMessage(int hue, string format, params object[] args) =>
SendAsciiMessage(hue, string.Format(format, args));
/// <summary>
/// Overridable. Event invoked when the Mobile is double clicked. By default, this method can either dismount or open the
/// paperdoll.

View file

@ -378,19 +378,16 @@ public class SecureTrade
if (platSend > 0 && goldSend > 0)
{
left.SendMessage(
"You traded {0:#,0} platinum and {1:#,0} gold to {2}.",
platSend,
goldSend,
right.RawName
$"You traded {platSend:#,0} platinum and {goldSend:#,0} gold to {right.RawName}."
);
}
else if (platSend > 0)
{
left.SendMessage("You traded {0:#,0} platinum to {1}.", platSend, right.RawName);
left.SendMessage($"You traded {platSend:#,0} platinum to {right.RawName}.");
}
else if (goldSend > 0)
{
left.SendMessage("You traded {0:#,0} gold to {1}.", goldSend, right.RawName);
left.SendMessage($"You traded {goldSend:#,0} gold to {right.RawName}.");
}
}
@ -399,19 +396,16 @@ public class SecureTrade
if (platRecv > 0 && goldRecv > 0)
{
left.SendMessage(
"You received {0:#,0} platinum and {1:#,0} gold from {2}.",
platRecv,
goldRecv,
right.RawName
$"You received {platRecv:#,0} platinum and {goldRecv:#,0} gold from {right.RawName}."
);
}
else if (platRecv > 0)
{
left.SendMessage("You received {0:#,0} platinum from {1}.", platRecv, right.RawName);
left.SendMessage($"You received {platRecv:#,0} platinum from {right.RawName}.");
}
else if (goldRecv > 0)
{
left.SendMessage("You received {0:#,0} gold from {1}.", goldRecv, right.RawName);
left.SendMessage($"You received {goldRecv:#,0} gold from {right.RawName}.");
}
}
}

View file

@ -246,10 +246,6 @@ public static class World
NetState.FlushAll();
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Broadcast(int hue, bool ascii, string format, params object[] args) =>
Broadcast(hue, ascii, string.Format(format, args));
internal static void LoadEntities(string basePath, Dictionary<ulong, string> typesDb)
{
IIndexInfo<Serial> itemIndexInfo = new EntityTypeIndex("Items");

View file

@ -795,11 +795,14 @@ namespace Server.Accounting
var ts = YoungDuration - acc.TotalGameTime;
var hours = Math.Max((int)ts.TotalHours, 0);
m.SendAsciiMessage(
"You will enjoy the benefits and relatively safe status of a young player for {0} more hour{1}.",
hours,
hours != 1 ? "s" : ""
);
if (hours == 1)
{
m.SendAsciiMessage($"You will enjoy the benefits and relatively safe status of a young player for {hours} more hour.");
}
else
{
m.SendAsciiMessage($"You will enjoy the benefits and relatively safe status of a young player for {hours} more hours.");
}
}
}

View file

@ -48,15 +48,14 @@ namespace Server.Commands
if (command == null)
{
e.Mobile.SendMessage(
"That is either an invalid command name or one that does not support this modifier: {0}.",
commandString
$"That is either an invalid command name or one that does not support this modifier: {commandString}."
);
return;
}
if (e.Mobile.AccessLevel < command.AccessLevel)
{
e.Mobile.SendMessage("You do not have access to that command: {0}.", commandString);
e.Mobile.SendMessage($"You do not have access to that command: {commandString}.");
return;
}

View file

@ -13,13 +13,27 @@ namespace Server.Commands
{
if (e.Length == 0)
{
e.Mobile.SendMessage("Drag effects are currently {0}.", Mobile.DragEffects ? "enabled" : "disabled");
if (Mobile.DragEffects)
{
e.Mobile.SendMessage($"Drag effects are currently enabled.");
}
else
{
e.Mobile.SendMessage($"Drag effects are currently disabled.");
}
}
else
{
Mobile.DragEffects = e.GetBoolean(0);
e.Mobile.SendMessage("Drag effects have been {0}.", Mobile.DragEffects ? "enabled" : "disabled");
if (Mobile.DragEffects)
{
e.Mobile.SendMessage($"Drag effects have been enabled.");
}
else
{
e.Mobile.SendMessage($"Drag effects have been disabled.");
}
}
}
}

View file

@ -86,12 +86,7 @@ namespace Server.Commands
CommandLogging.WriteLine(
from,
"{0} {1} duping {2} (inBag={3}; amount={4})",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(targ),
m_InBag,
m_Amount
$"{from.AccessLevel} {CommandLogging.Format(from)} duping {CommandLogging.Format(targ)} (inBag={m_InBag}; amount={m_Amount})"
);
var copy = (Item)targ;
@ -123,7 +118,7 @@ namespace Server.Commands
try
{
from.SendMessage("Duping {0}...", m_Amount);
from.SendMessage($"Duping {m_Amount}...");
for (var i = 0; i < m_Amount; i++)
{
if (c.Invoke(args) is Item newItem)
@ -146,11 +141,7 @@ namespace Server.Commands
CommandLogging.WriteLine(
from,
"{0} {1} duped {2} creating {3}",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(targ),
CommandLogging.Format(newItem)
$"{from.AccessLevel} {CommandLogging.Format(from)} duped {CommandLogging.Format(targ)} creating {CommandLogging.Format(newItem)}"
);
}
}

View file

@ -19,7 +19,7 @@ namespace Server.Commands
var remove = new List<Item>();
var count = 0;
e.Mobile.SendMessage("Exporting all static items to \"{0}\"...", ExportFile);
e.Mobile.SendMessage($"Exporting all static items to \"{ExportFile}\"...");
e.Mobile.SendMessage("This will delete all static items in the world. Please make a backup.");
foreach (var item in World.Items.Values)
@ -60,7 +60,7 @@ namespace Server.Commands
item.Delete();
}
e.Mobile.SendMessage("Export complete. Exported {0} statics.", count);
e.Mobile.SendMessage($"Export complete. Exported {count} statics.");
}
}
}

View file

@ -234,7 +234,7 @@ namespace Server.Commands.Generic
{
if (echo)
{
gm.SendMessage("{0} : has opened their web browser to : {1}", from.Name, url);
gm.SendMessage($"{from.Name} : has opened their web browser to : {url}");
}
from.LaunchBrowser(url);
@ -243,7 +243,7 @@ namespace Server.Commands.Generic
{
if (echo)
{
gm.SendMessage("{0} : has chosen not to open their web browser to : {1}", from.Name, url);
gm.SendMessage($"{from.Name} : has chosen not to open their web browser to : {url}");
}
from.SendMessage("You have chosen not to open your web browser.");
@ -271,11 +271,7 @@ namespace Server.Commands.Generic
CommandLogging.WriteLine(
from,
"{0} {1} requesting to open web browser of {2} to {3}",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(mob),
url
$"{from.AccessLevel} {CommandLogging.Format(from)} requesting to open web browser of {CommandLogging.Format(mob)} to {url}"
);
if (echo)
@ -386,11 +382,7 @@ namespace Server.Commands.Generic
CommandLogging.WriteLine(
from,
"{0} {1} playing sound {2} for {3}",
from.AccessLevel,
CommandLogging.Format(from),
index,
CommandLogging.Format(mob)
$"{from.AccessLevel} {CommandLogging.Format(from)} playing sound {index} for {CommandLogging.Format(mob)}"
);
mob.SendSound(index);
}
@ -434,12 +426,7 @@ namespace Server.Commands.Generic
CommandLogging.WriteLine(
from,
"{0} {1} {2} {3} \"{4}\"",
from.AccessLevel,
CommandLogging.Format(from),
m_InGump ? "messaging" : "telling",
CommandLogging.Format(mob),
e.ArgString
$"{from.AccessLevel} {CommandLogging.Format(from)} {(m_InGump ? "messaging" : "telling")} {CommandLogging.Format(mob)} \"{e.ArgString}\""
);
if (m_InGump)
@ -642,10 +629,7 @@ namespace Server.Commands.Generic
CommandLogging.WriteLine(
from,
"{0} {1} dismounting {2}",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(mob)
$"{from.AccessLevel} {CommandLogging.Format(from)} dismounting {CommandLogging.Format(mob)}"
);
var takenAction = false;
@ -713,10 +697,7 @@ namespace Server.Commands.Generic
{
CommandLogging.WriteLine(
e.Mobile,
"{0} {1} restocking {2}",
e.Mobile.AccessLevel,
CommandLogging.Format(e.Mobile),
CommandLogging.Format(vendor)
$"{e.Mobile.AccessLevel} {CommandLogging.Format(e.Mobile)} restocking {CommandLogging.Format(vendor)}"
);
vendor.Restock();
@ -955,10 +936,7 @@ namespace Server.Commands.Generic
{
CommandLogging.WriteLine(
e.Mobile,
"{0} {1} deleting {2}",
e.Mobile.AccessLevel,
CommandLogging.Format(e.Mobile),
CommandLogging.Format(item)
$"{e.Mobile.AccessLevel} {CommandLogging.Format(e.Mobile)} deleting {CommandLogging.Format(item)}"
);
item.Delete();
AddResponse("The item has been deleted.");
@ -967,10 +945,7 @@ namespace Server.Commands.Generic
{
CommandLogging.WriteLine(
e.Mobile,
"{0} {1} deleting {2}",
e.Mobile.AccessLevel,
CommandLogging.Format(e.Mobile),
CommandLogging.Format(mobile)
$"{e.Mobile.AccessLevel} {CommandLogging.Format(e.Mobile)} deleting {CommandLogging.Format(mobile)}"
);
mobile.Delete();
AddResponse("The mobile has been deleted.");
@ -1026,10 +1001,7 @@ namespace Server.Commands.Generic
{
CommandLogging.WriteLine(
from,
"{0} {1} killing {2}",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(mob)
$"{from.AccessLevel} {CommandLogging.Format(from)} killing {CommandLogging.Format(mob)}"
);
mob.Kill();
@ -1044,10 +1016,7 @@ namespace Server.Commands.Generic
{
CommandLogging.WriteLine(
from,
"{0} {1} resurrecting {2}",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(mob)
$"{from.AccessLevel} {CommandLogging.Format(from)} resurrecting {CommandLogging.Format(mob)}"
);
bc.PlaySound(0x214);
@ -1062,10 +1031,7 @@ namespace Server.Commands.Generic
{
CommandLogging.WriteLine(
from,
"{0} {1} resurrecting {2}",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(mob)
$"{ from.AccessLevel} {CommandLogging.Format(from)} resurrecting {CommandLogging.Format(mob)}"
);
mob.PlaySound(0x214);
@ -1114,11 +1080,7 @@ namespace Server.Commands.Generic
CommandLogging.WriteLine(
e.Mobile,
"{0} {1} {2} {3}",
e.Mobile.AccessLevel,
CommandLogging.Format(e.Mobile),
m_Value ? "hiding" : "unhiding",
CommandLogging.Format(m)
$"{e.Mobile.AccessLevel} {CommandLogging.Format(e.Mobile)} {(m_Value ? "hiding" : "unhiding")} {CommandLogging.Format(m)}"
);
Effects.SendLocationEffect(new Point3D(m.X + 1, m.Y, m.Z + 4), m.Map, 0x3728, 13);
@ -1170,10 +1132,7 @@ namespace Server.Commands.Generic
{
CommandLogging.WriteLine(
from,
"{0} {1} firewalling {2}",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(targ)
$"{from.AccessLevel} {CommandLogging.Format(from)} firewalling {CommandLogging.Format(targ)}"
);
try
@ -1233,14 +1192,10 @@ namespace Server.Commands.Generic
{
CommandLogging.WriteLine(
from,
"{0} {1} {2} {3}",
from.AccessLevel,
CommandLogging.Format(from),
m_Ban ? "banning" : "kicking",
CommandLogging.Format(targ)
$"{from.AccessLevel} {CommandLogging.Format(from)} {(m_Ban ? "banning" : "kicking")} {(CommandLogging.Format(targ))}"
);
targ.Say("I've been {0}!", m_Ban ? "banned" : "kicked");
targ.Say(m_Ban ? "I've been banned." : "I've been kicked");
AddResponse($"They have been {(m_Ban ? "banned" : "kicked")}.");

View file

@ -382,10 +382,7 @@ namespace Server.Commands.Generic
{
CommandLogging.WriteLine(
m_From,
"{0} {1} deleting {2}",
m_From.AccessLevel,
CommandLogging.Format(m_From),
CommandLogging.Format(m_Item)
$"{m_From.AccessLevel} {CommandLogging.Format(m_From)} deleting {CommandLogging.Format(m_Item)}"
);
m_Item.Delete();
m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Item));
@ -553,10 +550,7 @@ namespace Server.Commands.Generic
{
CommandLogging.WriteLine(
m_From,
"{0} {1} deleting {2}",
m_From.AccessLevel,
CommandLogging.Format(m_From),
CommandLogging.Format(m_Mobile)
$"{m_From.AccessLevel} {CommandLogging.Format(m_From)} deleting {CommandLogging.Format(m_Mobile)}"
);
m_Mobile.Delete();
m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Mobile));

View file

@ -105,7 +105,7 @@ namespace Server.Commands
var from = e.Mobile;
var map = from.Map;
from.SendMessage("You are at {0} {1} {2} in {3}.", from.X, from.Y, from.Z, map);
from.SendMessage($"You are at {from.X} {from.Y} {from.Z} in {map}.");
if (map != null)
{
@ -124,7 +124,7 @@ namespace Server.Commands
reg = reg.Parent;
}
from.SendMessage("Your region is {0}.", builder.ToString());
from.SendMessage($"Your region is {builder}.");
}
}
}
@ -192,11 +192,7 @@ namespace Server.Commands
{
CommandLogging.WriteLine(
from,
"{0} {1} deleting {2} object{3}",
from.AccessLevel,
CommandLogging.Format(from),
list.Count,
list.Count == 1 ? "" : "s"
$"{from.AccessLevel} {CommandLogging.Format(from)} deleting {list.Count} object{(list.Count == 1 ? "" : "s")}"
);
NetState.FlushAll();
@ -206,7 +202,14 @@ namespace Server.Commands
list[i].Delete();
}
from.SendMessage("You have deleted {0} object{1}.", list.Count, list.Count == 1 ? "" : "s");
if (list.Count == 1)
{
from.SendMessage($"You have deleted {list.Count} object.");
}
else
{
from.SendMessage($"You have deleted {list.Count} objects.");
}
}
else
{
@ -249,12 +252,7 @@ namespace Server.Commands
{
CommandLogging.WriteLine(
from,
"{0} {1} starting facet clear of {2} ({3} object{4})",
from.AccessLevel,
CommandLogging.Format(from),
map,
list.Count,
list.Count == 1 ? "" : "s"
$"{from.AccessLevel} {CommandLogging.Format(from)} starting facet clear of {map} ({list.Count} object{(list.Count == 1 ? "" : "s")})"
);
from.SendGump(
@ -293,13 +291,17 @@ namespace Server.Commands
{
CommandLogging.WriteLine(
from,
"{0} {1} getting all followers of {2}",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(pm)
$"{from.AccessLevel} {CommandLogging.Format(from)} getting all followers of {CommandLogging.Format(pm)}"
);
from.SendMessage("That player has {0} pet{1}.", pets.Count, pets.Count != 1 ? "s" : "");
if (pets.Count == 1)
{
from.SendMessage($"That player has {pets.Count} pet.");
}
else
{
from.SendMessage($"That player has {pets.Count} pets.");
}
for (var i = 0; i < pets.Count; ++i)
{
@ -337,13 +339,17 @@ namespace Server.Commands
{
CommandLogging.WriteLine(
from,
"{0} {1} getting all followers of {2}",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(master)
$"{from.AccessLevel} {CommandLogging.Format(from)} getting all followers of {CommandLogging.Format(master)}"
);
from.SendMessage("That player has {0} pet{1}.", pets.Count, pets.Count != 1 ? "s" : "");
if (pets.Count == 1)
{
from.SendMessage($"That player has {pets.Count} pet.");
}
else
{
from.SendMessage($"That player has {pets.Count} pets.");
}
for (var i = 0; i < pets.Count; ++i)
{
@ -405,11 +411,7 @@ namespace Server.Commands
CommandLogging.WriteLine(
m,
"{0} {1} playing sound {2} (toAll={3})",
m.AccessLevel,
CommandLogging.Format(m),
index,
toAll
$"{m.AccessLevel} {CommandLogging.Format(m)} playing sound {index} (toAll={toAll})"
);
Span<byte> buffer = stackalloc byte[OutgoingEffectPackets.SoundPacketLength].InitializePacket();
@ -773,7 +775,14 @@ namespace Server.Commands
m.AutoPageNotify = !m.AutoPageNotify;
m.SendMessage("Your auto-page-notify has been turned {0}.", m.AutoPageNotify ? "on" : "off");
if (m.AutoPageNotify)
{
m.SendMessage($"Your auto-page-notify has been turned on.");
}
else
{
m.SendMessage($"Your auto-page-notify has been turned off.");
}
}
[Usage("Animate <action> <frameCount> <repeatCount> <forward> <repeat> <delay>"),
@ -843,9 +852,9 @@ namespace Server.Commands
[Description("View some stats about the server.")]
public static void Stats_OnCommand(CommandEventArgs e)
{
e.Mobile.SendMessage("Open Connections: {0}", TcpServer.Instances.Count);
e.Mobile.SendMessage("Mobiles: {0}", World.Mobiles.Count);
e.Mobile.SendMessage("Items: {0}", World.Items.Count);
e.Mobile.SendMessage($"Open Connections: {TcpServer.Instances.Count}");
e.Mobile.SendMessage($"Mobiles: {World.Mobiles.Count}");
e.Mobile.SendMessage($"Items: {World.Items.Count}");
}
private class ViewEqTarget : Target
@ -892,10 +901,7 @@ namespace Server.Commands
CommandLogging.WriteLine(
from,
"{0} {1} viewing equipment of {2}",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(m)
$"{from.AccessLevel} {CommandLogging.Format(from)} viewing equipment of {CommandLogging.Format(m)}"
);
}
@ -934,11 +940,7 @@ namespace Server.Commands
{
CommandLogging.WriteLine(
state.Mobile,
"{0} {1} moving equipment item {2} of {3}",
state.Mobile.AccessLevel,
CommandLogging.Format(state.Mobile),
CommandLogging.Format(m_Item),
CommandLogging.Format(m_Mobile)
$"{state.Mobile.AccessLevel} {CommandLogging.Format(state.Mobile)} moving equipment item {CommandLogging.Format(m_Item)} of {CommandLogging.Format(m_Mobile)}"
);
state.Mobile.Target = new MoveTarget(m_Item);
}
@ -946,11 +948,7 @@ namespace Server.Commands
{
CommandLogging.WriteLine(
state.Mobile,
"{0} {1} deleting equipment item {2} of {3}",
state.Mobile.AccessLevel,
CommandLogging.Format(state.Mobile),
CommandLogging.Format(m_Item),
CommandLogging.Format(m_Mobile)
$"{state.Mobile.AccessLevel} {CommandLogging.Format(state.Mobile)} deleting equipment item {CommandLogging.Format(m_Item)} of {CommandLogging.Format(m_Mobile)}"
);
m_Item.Delete();
}
@ -958,11 +956,7 @@ namespace Server.Commands
{
CommandLogging.WriteLine(
state.Mobile,
"{0} {1} opening properties for equipment item {2} of {3}",
state.Mobile.AccessLevel,
CommandLogging.Format(state.Mobile),
CommandLogging.Format(m_Item),
CommandLogging.Format(m_Mobile)
$"{state.Mobile.AccessLevel} {CommandLogging.Format(state.Mobile)} opening properties for equipment item {CommandLogging.Format(m_Item)} of {CommandLogging.Format(m_Mobile)}"
);
state.Mobile.SendGump(new PropertiesGump(state.Mobile, m_Item));
}
@ -987,10 +981,7 @@ namespace Server.Commands
{
CommandLogging.WriteLine(
from,
"{0} {1} opening bank box of {2}",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(m)
$"{from.AccessLevel} {CommandLogging.Format(from)} opening bank box of {CommandLogging.Format(m)}"
);
if (from == m)
@ -1022,10 +1013,7 @@ namespace Server.Commands
{
CommandLogging.WriteLine(
from,
"{0} {1} opening client menu of {2}",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(targ)
$"{from.AccessLevel} {CommandLogging.Format(from)} opening client menu of {CommandLogging.Format(targ)}"
);
from.SendGump(new ClientGump(from, targ.NetState));
}

View file

@ -50,16 +50,6 @@ namespace Server.Commands
_ => o
};
public static void WriteLine(Mobile from, string format, params object[] args)
{
if (!Enabled)
{
return;
}
WriteLine(from, string.Format(format, args));
}
public static void WriteLine(Mobile from, string text)
{
if (!Enabled)
@ -132,27 +122,13 @@ namespace Server.Commands
public static void EventSink_Command(CommandEventArgs e)
{
WriteLine(
e.Mobile,
"{0} {1} used command '{2} {3}'",
e.Mobile.AccessLevel,
Format(e.Mobile),
e.Command,
e.ArgString
);
var from = e.Mobile;
WriteLine(from, $"{from.AccessLevel} {Format(from)} used command '{e.Command} {e.ArgString}'");
}
public static void LogChangeProperty(Mobile from, object o, string name, string value)
{
WriteLine(
from,
"{0} {1} set property '{2}' of {3} to '{4}'",
from.AccessLevel,
Format(from),
name,
Format(o),
value
);
WriteLine(from, $"{from.AccessLevel} {Format(from)} set property '{name}' of {Format(o)} to '{value}'");
}
}
}

View file

@ -102,12 +102,14 @@ namespace Server.Commands
if (built > 0)
{
watch.Stop();
from.SendMessage(
"{0} object{1} generated in {2:F2} seconds.",
built,
built != 1 ? "s" : "",
watch.Elapsed.TotalSeconds
);
if (built == 1)
{
from.SendMessage($"{built} object generated in {watch.Elapsed.TotalSeconds:F2} seconds.");
}
else
{
from.SendMessage($"{built} objects generated in {watch.Elapsed.TotalSeconds:F2} seconds.");
}
}
else
{
@ -307,7 +309,7 @@ namespace Server.Commands
if (objectCount >= 20)
{
from.SendMessage("Constructing {0} objects, please wait.", objectCount);
from.SendMessage($"Constructing {objectCount} objects, please wait.");
}
var sendError = true;
@ -467,10 +469,14 @@ namespace Server.Commands
}
else
{
from.SendMessage(
"Format: {0} <type> [params] [set {{<propertyName> <value> ...}}]",
outline ? "Outline" : "Tile"
);
if (outline)
{
from.SendMessage($"Format: Outline <type> [params] [set {{<propertyName> <value> ...}}]");
}
else
{
from.SendMessage($"Format: Tile <type> [params] [set {{<propertyName> <value> ...}}]");
}
}
}
@ -492,10 +498,14 @@ namespace Server.Commands
}
else
{
e.Mobile.SendMessage(
"Format: {0}RXYZ <x> <y> <w> <h> <z> <type> [params] [set {{<propertyName> <value> ...}}]",
outline ? "Outline" : "Tile"
);
if (outline)
{
e.Mobile.SendMessage($"Format: OutlineRXYZ <x> <y> <w> <h> <z> <type> [params] [set {{<propertyName> <value> ...}}]");
}
else
{
e.Mobile.SendMessage($"Format: TileRXYZ <x> <y> <w> <h> <z> <type> [params] [set {{<propertyName> <value> ...}}]");
}
}
}
@ -517,10 +527,14 @@ namespace Server.Commands
}
else
{
e.Mobile.SendMessage(
"Format: {0}XYZ <x> <y> <w> <h> <z> <type> [params] [set {{<propertyName> <value> ...}}]",
outline ? "Outline" : "Tile"
);
if (outline)
{
e.Mobile.SendMessage($"Format: OutlineXYZ <x> <y> <w> <h> <z> <type> [params] [set {{<propertyName> <value> ...}}]" );
}
else
{
e.Mobile.SendMessage($"Format: TileXYZ <x> <y> <w> <h> <z> <type> [params] [set {{<propertyName> <value> ...}}]");
}
}
}
@ -545,10 +559,14 @@ namespace Server.Commands
}
else
{
from.SendMessage(
"Format: {0}Z <z> <type> [params] [set {{<propertyName> <value> ...}}]",
outline ? "Outline" : "Tile"
);
if (outline)
{
from.SendMessage($"Format: OutlineZ <z> <type> [params] [set {{<propertyName> <value> ...}}]");
}
else
{
from.SendMessage($"Format: TileZ <z> <type> [params] [set {{<propertyName> <value> ...}}]");
}
}
}
@ -566,10 +584,14 @@ namespace Server.Commands
}
else
{
from.SendMessage(
"Format: {0}Avg <type> [params] [set {{<propertyName> <value> ...}}]",
outline ? "Outline" : "Tile"
);
if (outline)
{
from.SendMessage($"Format: OutlineAvg <type> [params] [set {{<propertyName> <value> ...}}]");
}
else
{
from.SendMessage($"Format: TileAvg <type> [params] [set {{<propertyName> <value> ...}}]");
}
}
}

View file

@ -38,7 +38,7 @@ namespace Server.Commands
Generate("Data/Decoration/Malas", Map.Malas);
Generate("Data/Decoration/Tokuno", Map.Tokuno);
m_Mobile.SendMessage("World generating complete. {0} items were generated.", m_Count);
m_Mobile.SendMessage($"World generating complete. {m_Count} items were generated.");
}
public static void Generate(string folder, params Map[] maps)

View file

@ -34,7 +34,7 @@ namespace Server.Commands
Generate("Data/Decoration/RuinedMaginciaTram", Map.Trammel);
Generate("Data/Decoration/RuinedMaginciaFel", Map.Felucca);
m_Mobile.SendMessage("World generating complete. {0} items were generated.", m_Count);
m_Mobile.SendMessage($"World generating complete. {m_Count} items were generated.");
}
public static void Generate(string folder, params Map[] maps)

View file

@ -68,7 +68,14 @@ namespace Server.Commands
Core.Profiling = !Core.Profiling;
}
e.Mobile.SendMessage("Profiling has been {0}.", Core.Profiling ? "enabled" : "disabled");
if (Core.Profiling)
{
e.Mobile.SendMessage($"Profiling has been enabled.");
}
else
{
e.Mobile.SendMessage($"Profiling has been disabled.");
}
}
[Usage("DumpTimers"),

View file

@ -85,7 +85,7 @@ namespace Server.Commands
}
else
{
from.SendMessage("{0} not found!", cfg);
from.SendMessage($"{cfg} not found!");
}
}

View file

@ -130,7 +130,7 @@ namespace Server.Commands
CommandLogging.LogChangeProperty(from, targ, $"{m_Skill}.Base", m_Value.ToString());
}
from.SendMessage("{0} : {1} (Base: {2})", m_Skill, skill.Value, skill.Base);
from.SendMessage($"{m_Skill} : {skill.Value} (Base: {skill.Base})");
}
else
{

View file

@ -43,11 +43,18 @@ namespace Server.Commands
if (list.Count > 0)
{
pm.SendMessage("You are visible to {0} mobile{1}:", list.Count, list.Count == 1 ? "" : "s");
if (list.Count == 1)
{
pm.SendMessage($"You are visible to {list.Count} mobile:");
}
else
{
pm.SendMessage($"You are visible to {list.Count} mobiles:");
}
for (var i = 0; i < list.Count; ++i)
{
pm.SendMessage("#{0}: {1}", i + 1, list[i].Name);
pm.SendMessage($"#{i + 1}: {list[i].Name}");
}
}
else
@ -103,12 +110,12 @@ namespace Server.Commands
if (list.Contains(targ))
{
list.Remove(targ);
pm.SendMessage("{0} has been removed from your visibility list.", targ.Name);
pm.SendMessage($"{targ.Name} has been removed from your visibility list.");
}
else
{
list.Add(targ);
pm.SendMessage("{0} has been added to your visibility list.", targ.Name);
pm.SendMessage($"{targ.Name} has been added to your visibility list.");
}
if (Utility.InUpdateRange(targ.Location, from.Location))

View file

@ -61,13 +61,7 @@ namespace Server.Commands
{
CommandLogging.WriteLine(
from,
"{0} {1} wiping from {2} to {3} in {5} ({4})",
from.AccessLevel,
CommandLogging.Format(from),
start,
end,
type,
map
$"{from.AccessLevel} {CommandLogging.Format(from)} wiping from {start} to {end} in {type} ({map})"
);
var mobiles = (type & WipeType.Mobiles) != 0;

View file

@ -116,7 +116,7 @@ namespace Server.Engines.ConPVP
m_Challenged.CloseGump<AcceptDuelGump>();
m_Challenger.SendMessage("{0} seems unresponsive.", m_Challenged.Name);
m_Challenger.SendMessage($"{m_Challenged.Name} seems unresponsive.");
m_Challenged.SendMessage("You decline the challenge.");
}
@ -202,7 +202,7 @@ namespace Server.Engines.ConPVP
pm.SendMessage(0x22, "You have already been challenged in a duel.");
}
m_Challenger.SendMessage("{0} cannot fight because they are already assigned to another duel.", pm.Name);
m_Challenger.SendMessage($"{pm.Name} cannot fight because they are already assigned to another duel.");
}
else if (DuelContext.CheckCombat(pm))
{
@ -211,8 +211,7 @@ namespace Server.Engines.ConPVP
"You have recently been in combat with another player and must wait before starting a duel."
);
m_Challenger.SendMessage(
"{0} cannot fight because they have recently been in combat with another player.",
pm.Name
$"{pm.Name} cannot fight because they have recently been in combat with another player."
);
}
else if (TournamentController.IsActive)
@ -244,8 +243,8 @@ namespace Server.Engines.ConPVP
if (added)
{
m_Challenger.SendMessage("{0} has accepted the request.", m_Challenged.Name);
m_Challenged.SendMessage("You have accepted the request from {0}.", m_Challenger.Name);
m_Challenger.SendMessage($"{m_Challenged.Name} has accepted the request.");
m_Challenged.SendMessage($"You have accepted the request from {m_Challenger.Name}.");
var ns = m_Challenger.NetState;
@ -270,14 +269,17 @@ namespace Server.Engines.ConPVP
else
{
m_Challenger.SendMessage(
"The participant list was full and so {0} could not join.",
m_Challenged.Name
);
m_Challenged.SendMessage(
"The participant list was full and so you could not join the fight {1} {0}.",
m_Challenger.Name,
m_Participant.Contains(m_Challenger) ? "with" : "against"
$"The participant list was full and so {m_Challenged.Name} could not join."
);
if (m_Participant.Contains(m_Challenger))
{
m_Challenged.SendMessage($"The participant list was full and so you could not join the fight with {m_Challenger.Name}.");
}
else
{
m_Challenged.SendMessage($"The participant list was full and so you could not join the fight against {m_Challenger.Name}.");
}
}
}
}
@ -288,12 +290,16 @@ namespace Server.Engines.ConPVP
BeginIgnore(m_Challenged, m_Challenger);
}
m_Challenger.SendMessage("{0} does not wish to fight.", m_Challenged.Name);
m_Challenged.SendMessage(
"You chose not to fight {1} {0}.",
m_Challenger.Name,
m_Participant.Contains(m_Challenger) ? "with" : "against"
);
m_Challenger.SendMessage($"{m_Challenged.Name} does not wish to fight.");
if (m_Participant.Contains(m_Challenger))
{
m_Challenged.SendMessage($"You chose not to fight with {m_Challenger.Name}.");
}
else
{
m_Challenged.SendMessage($"You chose not to fight against {m_Challenger.Name}.");
}
}
}

View file

@ -893,11 +893,11 @@ namespace Server.Engines.ConPVP
if (newLevel > oldLevel)
{
us.SendMessage(0x59, "You have achieved level {0}!", newLevel);
us.SendMessage(0x59, $"You have achieved level {newLevel}!");
}
else if (newLevel < oldLevel)
{
us.SendMessage(0x22, "You have lost a level. You are now at {0}.", newLevel);
us.SendMessage(0x22, $"You have lost a level. You are now at {newLevel}.");
}
}
@ -1768,18 +1768,32 @@ namespace Server.Engines.ConPVP
{
if (mob != rejector)
{
mob.SendMessage(0x22, "{0} has yielded.", rejector.Name);
mob.SendMessage(0x22, $"{rejector.Name} has yielded.");
}
}
else
{
if (mob == rejector)
{
mob.SendMessage(0x22, "You have rejected the {0}.", Rematch ? "rematch" : page);
if (Rematch)
{
mob.SendMessage(0x22, $"You have rejected the rematch.");
}
else
{
mob.SendMessage(0x22, $"You have rejected the {page}.");
}
}
else
{
mob.SendMessage(0x22, "{0} has rejected the {1}.", rejector.Name, Rematch ? "rematch" : page);
if (Rematch)
{
mob.SendMessage(0x22, $"{rejector.Name} has rejected the rematch.");
}
else
{
mob.SendMessage(0x22, $"{rejector.Name} has rejected the {page}.");
}
}
}
@ -2086,7 +2100,7 @@ namespace Server.Engines.ConPVP
var ruleset = Ruleset;
var basedef = ruleset.Base;
mob.SendMessage("Ruleset: {0}", basedef.Title);
mob.SendMessage($"Ruleset: {basedef.Title}");
BitArray defs;
@ -2098,7 +2112,7 @@ namespace Server.Engines.ConPVP
{
defs.Or(ruleset.Flavors[i].Options);
mob.SendMessage(" + {0}", ruleset.Flavors[i].Title);
mob.SendMessage($" + {ruleset.Flavors[i].Title}");
}
}
else
@ -2125,7 +2139,14 @@ namespace Server.Engines.ConPVP
mob.SendMessage("Modifications:");
}
mob.SendMessage("{0}: {1}", name, opts[i] ? "enabled" : "disabled");
if (opts[i])
{
mob.SendMessage($"{name}: enabled");
}
else
{
mob.SendMessage($"{name}: disabled");
}
}
}
}
@ -2337,7 +2358,7 @@ namespace Server.Engines.ConPVP
{
var dp = p.Players[j];
dp?.Mobile.SendMessage("The duel could not be started because {0}.", error);
dp?.Mobile.SendMessage($"The duel could not be started because {error}.");
}
}

View file

@ -712,11 +712,11 @@ namespace Server.Engines.ConPVP
if (points > 3)
{
m_Game.Alert("Touchdown {0} ({1})!", team.Name, m.Name);
m_Game.Alert($"Touchdown {team.Name} ({m.Name})!");
}
else
{
m_Game.Alert("Field goal {0} ({1})!", team.Name, m.Name);
m_Game.Alert($"Field goal {team.Name} ({m.Name})!");
}
for (var i = m_Helpers.Count - 1; i >= 0; i--)
@ -761,7 +761,7 @@ namespace Server.Engines.ConPVP
m.RevealingAction();
m.LocalOverheadMessage(MessageType.Regular, 0x59, false, "You got the bomb!");
m_Game.Alert("{1} ({2}) {0} the bomb!", verb, m.Name, team.Name);
m_Game.Alert($"{verb} ({m.Name}) {team.Name} the bomb!");
m.Target = new BombTarget(this, m);
@ -1661,11 +1661,6 @@ namespace Server.Engines.ConPVP
}
}
public void Alert(string format, params object[] args)
{
Alert(string.Format(format, args));
}
public BRTeamInfo GetTeamInfo(Mobile mob)
{
var teamID = GetTeamID(mob);
@ -1954,17 +1949,14 @@ namespace Server.Engines.ConPVP
mob.BankBox.DropItem(item);
}
mob.SendMessage(
"You have been awarded a {0} trophy and {1:N0}gp for your participation in this tournament.",
rank.ToString().ToLower(),
cash
mob.SendMessage( //There is no formatting flag for Lowercase, we may need a custom interface to get rid of it
$"You have been awarded a {rank.ToString().ToLower()} trophy and {cash:N0}gp for your participation in this tournament."
);
}
else
{
mob.SendMessage(
"You have been awarded a {0} trophy for your participation in this tournament.",
rank.ToString().ToLower()
$"You have been awarded a {rank.ToString().ToLower()} trophy for your participation in this tournament."
);
}
}

View file

@ -317,7 +317,7 @@ namespace Server.Engines.ConPVP
SendHome();
from.LocalOverheadMessage(MessageType.Regular, 0x59, false, "You returned the cookies!");
m_TeamInfo.Game.Alert("The {1} cookies have been returned by {0}.", from.Name, ourTeam.Name);
m_TeamInfo.Game.Alert($"The {from.Name} cookies have been returned by {ourTeam.Name}.");
}
}
else if (!from.PlaceInBackpack(this))
@ -329,12 +329,7 @@ namespace Server.Engines.ConPVP
from.RevealingAction();
from.LocalOverheadMessage(MessageType.Regular, 0x59, false, "You stole the cookies!");
m_TeamInfo.Game.Alert(
"The {1} cookies have been stolen by {0} ({2}).",
from.Name,
ourTeam.Name,
useTeam.Name
);
m_TeamInfo.Game.Alert($"The {ourTeam.Name} cookies have been stolen by {from.Name} ({useTeam.Name}).");
BeginCountdown(120);
}
@ -393,12 +388,14 @@ namespace Server.Engines.ConPVP
case 2:
case 1:
{
owner?.SendMessage(
0x26,
"You have {0} {1} to capture the cookies!",
m_ReturnCount,
m_ReturnCount == 1 ? "second" : "seconds"
);
if (m_ReturnCount == 1)
{
owner?.SendMessage(0x26, $"You have {m_ReturnCount} second to capture the cookies!");
}
else
{
owner?.SendMessage(0x26, $"You have {m_ReturnCount} seconds to capture the cookies!");
}
break;
}
@ -413,7 +410,7 @@ namespace Server.Engines.ConPVP
SendHome();
m_TeamInfo?.Game?.Alert("The {0} cookies have been returned.", m_TeamInfo.Name);
m_TeamInfo?.Game?.Alert($"The {m_TeamInfo.Name} cookies have been returned.");
return;
}
@ -442,7 +439,7 @@ namespace Server.Engines.ConPVP
if (obj == useTeam.Flag)
{
from.LocalOverheadMessage(MessageType.Regular, 0x59, false, "You captured the cookies!");
m_TeamInfo.Game.Alert("{0} captured the {1} cookies!", from.Name, ourTeam.Name);
m_TeamInfo.Game.Alert($"{from.Name} captured the {ourTeam.Name} cookies!");
SendHome();
@ -934,11 +931,6 @@ namespace Server.Engines.ConPVP
}
}
public void Alert(string format, params object[] args)
{
Alert(string.Format(format, args));
}
public CTFTeamInfo GetTeamInfo(Mobile mob)
{
var teamID = GetTeamID(mob);
@ -1280,16 +1272,13 @@ namespace Server.Engines.ConPVP
}
mob.SendMessage(
"You have been awarded a {0} trophy and {1:N0}gp for your participation in this tournament.",
rank.ToString().ToLower(),
cash
$"You have been awarded a {rank.ToString().ToLower()} trophy and {cash:N0}gp for your participation in this tournament."
);
}
else
{
mob.SendMessage(
"You have been awarded a {0} trophy for your participation in this tournament.",
rank.ToString().ToLower()
$"You have been awarded a {rank.ToString().ToLower()} trophy for your participation in this tournament."
);
}
}

View file

@ -503,18 +503,7 @@ namespace Server.Engines.ConPVP
public DDController Controller { get; }
public Map Facet
{
get
{
if (m_Context.Arena != null)
{
return m_Context.Arena.Facet;
}
return Controller.Map;
}
}
public Map Facet => m_Context.Arena?.Facet ?? Controller.Map;
public void Alert(string text)
{
@ -534,11 +523,6 @@ namespace Server.Engines.ConPVP
}
}
public void Alert(string format, params object[] args)
{
Alert(string.Format(format, args));
}
public DDTeamInfo GetTeamInfo(Mobile mob)
{
var teamID = GetTeamID(mob);
@ -847,16 +831,13 @@ namespace Server.Engines.ConPVP
}
mob.SendMessage(
"You have been awarded a {0} trophy and {1:N0}gp for your participation in this tournament.",
rank.ToString().ToLower(),
cash
$"You have been awarded a {rank.ToString().ToLower()} trophy and {cash:N0}gp for your participation in this tournament."
);
}
else
{
mob.SendMessage(
"You have been awarded a {0} trophy for your participation in this tournament.",
rank.ToString().ToLower()
$"You have been awarded a {rank.ToString().ToLower()} trophy for your participation in this tournament."
);
}
}
@ -945,7 +926,7 @@ namespace Server.Engines.ConPVP
Controller.PointA?.TeamOwner != null;
point.TeamOwner = team;
Alert("{0} has captured {1}!", team.Name, point.Name);
Alert($"{team.Name} has captured {point.Name}!");
var isDom = Controller.PointA?.TeamOwner == Controller.PointB?.TeamOwner && Controller.PointA?.TeamOwner != null;
@ -978,14 +959,14 @@ namespace Server.Engines.ConPVP
if (++m_CapStage < 10)
{
Alert("{0} is dominating... {1}", team.Name, 10 - m_CapStage);
Alert($"{team.Name} is dominating... {10 - m_CapStage}");
Controller.PointA?.SetCaptureHue(m_CapStage);
Controller.PointB?.SetCaptureHue(m_CapStage);
}
else
{
Alert("{0} has scored!", team.Name);
Alert($"{team.Name} has scored!");
team.Score += 100;
team.Captures += 1;

View file

@ -149,7 +149,7 @@ namespace Server.Engines.ConPVP
var kingName = king.Name ?? "";
var killerName = killer.Name ?? "";
m_Game.Alert("{0} ({1}) was dethroned by {2} ({3})!", kingName, kingTeam.Name, killerName, killerTeam.Name);
m_Game.Alert($"{kingName} ({kingTeam.Name}) was dethroned by {killerName} ({killerTeam.Name})!");
}
DeKingify();
@ -251,7 +251,7 @@ namespace Server.Engines.ConPVP
var hill = m_Hill.Name.DefaultIfNullOrEmpty("the hill");
var king = m_Hill.King.Name ?? "";
m_Hill.Game.Alert("{0} ({1}) is king of {2}!", king, ti.Name, hill);
m_Hill.Game.Alert($"{king} ({ti.Name}) is king of {hill}!");
m_Hill.PublicOverheadMessage(MessageType.Regular, 0x0481, false, "Capture!");
@ -905,11 +905,6 @@ namespace Server.Engines.ConPVP
}
}
public void Alert(string format, params object[] args)
{
Alert(string.Format(format, args));
}
public KHTeamInfo GetTeamInfo(Mobile mob)
{
var teamID = GetTeamID(mob);
@ -1212,16 +1207,13 @@ namespace Server.Engines.ConPVP
}
mob.SendMessage(
"You have been awarded a {0} trophy and {1:N0}gp for your participation in this game.",
rank.ToString().ToLower(),
cash
$"You have been awarded a {rank.ToString().ToLower()} trophy and {cash:N0}gp for your participation in this game."
);
}
else
{
mob.SendMessage(
"You have been awarded a {0} trophy for your participation in this game.",
rank.ToString().ToLower()
$"You have been awarded a {rank.ToString().ToLower()} trophy for your participation in this game."
);
}
}

View file

@ -245,26 +245,29 @@ namespace Server.Engines.ConPVP
if (pm.DuelContext != null)
{
from.SendMessage("{0} cannot fight because they are already assigned to another duel.", pm.Name);
from.SendMessage($"{pm.Name} cannot fight because they are already assigned to another duel.");
}
else if (DuelContext.CheckCombat(pm))
{
from.SendMessage(
"{0} cannot fight because they have recently been in combat with another player.",
pm.Name
$"{pm.Name} cannot fight because they have recently been in combat with another player."
);
}
else if (mob.HasGump<AcceptDuelGump>())
{
from.SendMessage("{0} has already been offered a duel.");
from.SendMessage($"{mob.Name} has already been offered a duel.");
}
else
{
from.SendMessage(
"You send {0} to {1}.",
m_Participant.Find(from) == null ? "a challenge" : "an invitation",
mob.Name
);
if (m_Participant.Find(from) == null)
{
from.SendMessage($"You send a challenge to {mob.Name}.");
}
else
{
from.SendMessage($"You send an invitation to {mob.Name}.");
}
mob.SendGump(new AcceptDuelGump(from, mob, m_Context, m_Participant, m_Index));
}
}

View file

@ -662,16 +662,13 @@ namespace Server.Engines.ConPVP
}
mob.SendMessage(
"You have been awarded a {0} trophy and {1:N0}gp for your participation in this tournament.",
rank.ToString().ToLower(),
cash
$"You have been awarded a {rank.ToString().ToLower()} trophy and {cash:N0}gp for your participation in this tournament."
);
}
else
{
mob.SendMessage(
"You have been awarded a {0} trophy for your participation in this tournament.",
rank.ToString().ToLower()
$"You have been awarded a {rank.ToString().ToLower()} trophy for your participation in this tournament."
);
}
}

View file

@ -92,15 +92,7 @@ namespace Server.Engines.ConPVP
public int CompareTo(TourneyParticipant p) => p.TotalLadderXP - TotalLadderXP;
public void AddLog(string text)
{
Log.Add(text);
}
public void AddLog(string format, params object[] args)
{
AddLog(string.Format(format, args));
}
public void AddLog(string text) => Log.Add(text);
public void WonMatch(TourneyMatch match)
{

View file

@ -92,7 +92,7 @@ namespace Server.Items
if (Owner != null)
{
LabelTo(from, "{0} -- {1}", Title, Owner.RawName);
LabelTo(from, $"{Title} -- {Owner.RawName}");
}
else if (Title != null)
{

View file

@ -1161,9 +1161,7 @@ namespace Server.Engines.Craft
{
CommandLogging.WriteLine(
from,
"Crafting {0} with craft system {1}",
CommandLogging.Format(item),
craftSystem.GetType().Name
$"Crafting {CommandLogging.Format(item)} with craft system {craftSystem.GetType().Name}"
);
}

View file

@ -116,16 +116,6 @@ namespace Server.Factions
}
}
public void Broadcast(string format, params object[] args)
{
Broadcast(string.Format(format, args));
}
public void Broadcast(int hue, string format, params object[] args)
{
Broadcast(hue, string.Format(format, args));
}
public void BeginBroadcast(Mobile from)
{
from.SendLocalizedMessage(1010265); // Enter Faction Message
@ -139,7 +129,7 @@ namespace Server.Factions
State.RegisterBroadcast();
}
Broadcast(Definition.HueBroadcast, "{0} [Commander] {1} : {2}", from.Name, Definition.FriendlyName, text);
Broadcast(Definition.HueBroadcast, $"{from.Name} [Commander] {Definition.FriendlyName} : {text}");
}
public static void HandleAtrophy()
@ -816,7 +806,7 @@ namespace Server.Factions
}
}
e.Mobile.SendMessage("{0} items reset", count);
e.Mobile.SendMessage($"{count} items reset");
}
public static void FactionCommander_OnCommand(CommandEventArgs e)

View file

@ -183,7 +183,7 @@ namespace Server.Factions
type = "guard";
}
from.SendMessage("Target the {0} you wish to dismiss.", type);
from.SendMessage($"Target the {type} you wish to dismiss.");
from.BeginTarget(12, false, TargetFlags.None, EndOrderFiring);
}
@ -216,7 +216,7 @@ namespace Server.Factions
}
else
{
from.SendMessage("That is not a {0}!", type);
from.SendMessage($"That is not a {type}!");
}
}
@ -557,9 +557,7 @@ namespace Server.Factions
{
town.Silver += e.GetInt32(0);
e.Mobile.SendMessage(
"You have granted {0:N0} silver to the town. It now has {1:N0} silver.",
e.GetInt32(0),
town.Silver
$"You have granted {e.GetInt32(0):N0} silver to the town. It now has {town.Silver:N0} silver."
);
}
}

View file

@ -65,8 +65,7 @@ namespace Server.Factions
else
{
m_From.SendMessage(
"You will be removed from the faction in {0} days.",
Faction.LeavePeriod.TotalDays
$"You will be removed from the faction in {Faction.LeavePeriod.TotalDays} days."
);
}
}
@ -97,8 +96,7 @@ namespace Server.Factions
else
{
mob.SendMessage(
"Your guild will quit the faction in {0} days.",
Faction.LeavePeriod.TotalDays
$"Your guild will quit the faction in {Faction.LeavePeriod.TotalDays} days."
);
}
}

View file

@ -83,9 +83,7 @@ namespace Server.Factions
if (from.Alive)
{
Placer.SendMessage(
"You have earned {0} silver pieces because {1} fell for your trap.",
silverGiven,
from.Name
$"You have earned {silverGiven} silver pieces because {from.Name} fell for your trap."
);
}
else

View file

@ -140,29 +140,19 @@ namespace Server.Factions
var warning = Utility.Random(6) switch
{
0 => "I warn you, {0}, you would do well to leave this area before someone shows you the world of gray.",
1 => "It would be wise to leave this area, {0}, lest your head become my commanders' trophy.",
2 => "You are bold, {0}, for one of the meager {1}. Leave now, lest you be taught the taste of dirt.",
3 => "Your presence here is an insult, {0}. Be gone now, knave.",
4 => "Dost thou wish to be hung by your toes, {0}? Nay? Then come no closer.",
_ => "Hey, {0}. Yeah, you. Get out of here before I beat you with a stick." // 5
0 => $"I warn you, {m.Name}, you would do well to leave this area before someone shows you the world of gray.",
1 => $"It would be wise to leave this area, {m.Name}, lest your head become my commanders' trophy.",
2 => $"You are bold, {m.Name}, for one of the meager {Faction.Find(m)?.Definition.FriendlyName ?? "civilians"}. Leave now, lest you be taught the taste of dirt.",
3 => $"Your presence here is an insult, {m.Name}. Be gone now, knave.",
4 => $"Dost thou wish to be hung by your toes, {m.Name}? Nay? Then come no closer.",
_ => $"Hey, {m.Name}. Yeah, you. Get out of here before I beat you with a stick." // 5
};
var faction = Faction.Find(m);
Say(warning, m.Name, faction == null ? "civilians" : faction.Definition.FriendlyName);
Say(warning);
}
}
public override bool HandlesOnSpeech(Mobile from)
{
if (InRange(from, ListenRange))
{
return true;
}
return base.HandlesOnSpeech(from);
}
public override bool HandlesOnSpeech(Mobile from) => InRange(from, ListenRange) || base.HandlesOnSpeech(from);
private void ChangeReaction(Faction faction, ReactionType type)
{
@ -171,12 +161,19 @@ namespace Server.Factions
switch (type)
{
case ReactionType.Ignore:
Say(1005179);
break; // Civilians will now be ignored.
{
Say(1005179);
break; // Civilians will now be ignored.
}
case ReactionType.Warn:
Say(1005180);
break; // Civilians will now be warned of their impending deaths.
case ReactionType.Attack: return;
{
Say(1005180);
break; // Civilians will now be warned of their impending deaths.
}
case ReactionType.Attack:
{
return;
}
}
}
else

View file

@ -96,23 +96,31 @@ namespace Server.Engines.Help
}
else if (from != targeted && from.AccessLevel <= pm.AccessLevel && from.AccessLevel != AccessLevel.Owner)
{
from.SendMessage(
"You don't have the required access level to view {0} speech log.",
pm.Female ? "her" : "his"
);
if (pm.Female)
{
from.SendMessage($"You don't have the required access level to view her speech log.");
}
else
{
from.SendMessage($"You don't have the required access level to view his speech log.");
}
}
else if (pm.SpeechLog == null)
{
from.SendMessage("{0} has no speech log.", pm.Female ? "She" : "He");
if (pm.Female)
{
from.SendMessage($"She has no speech log.");
}
else
{
from.SendMessage($"He has no speech log.");
}
}
else
{
CommandLogging.WriteLine(
from,
"{0} {1} viewing speech log of {2}",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(targeted)
$"{from.AccessLevel} {CommandLogging.Format(from)} viewing speech log of {CommandLogging.Format(targeted)}"
);
Gump gump = new SpeechLogGump(pm, pm.SpeechLog);

View file

@ -261,7 +261,7 @@ namespace Server.Engines.MLQuests.Gumps
}
else
{
pm.SendMessage("You have fully changed your race to {0}.", targetRace.Name);
pm.SendMessage($"You have fully changed your race to {targetRace.Name}.");
}
owner?.ConsumeNeeded(pm);

View file

@ -186,7 +186,7 @@ namespace Server.Engines.MLQuests
if (e.Length == 0)
{
m.SendMessage("Quest table length: {0}", Quests.Count);
m.SendMessage($"Quest table length: {Quests.Count}");
return;
}
@ -198,10 +198,10 @@ namespace Server.Engines.MLQuests
return;
}
m.SendMessage("Activated: {0}", quest.Activated);
m.SendMessage("Number of objectives: {0}", quest.Objectives.Count);
m.SendMessage("Objective type: {0}", quest.ObjectiveType);
m.SendMessage("Number of active instances: {0}", quest.Instances.Count);
m.SendMessage($"Activated: {quest.Activated}");
m.SendMessage($"Number of objectives: {quest.Objectives.Count}");
m.SendMessage($"Objective type: {quest.ObjectiveType}");
m.SendMessage($"Number of active instances: {quest.Instances.Count}");
}
[Usage("SaveQuest <type> [saveEnabled=true]"),
@ -227,7 +227,15 @@ namespace Server.Engines.MLQuests
var enable = e.Length == 2 ? e.GetBoolean(1) : true;
quest.SaveEnabled = enable;
m.SendMessage("Serialization for quest {0} is now {1}.", quest.GetType().Name, enable ? "enabled" : "disabled");
if (enable)
{
m.SendMessage($"Serialization for quest {quest.GetType().Name} is now enabled.");
}
else
{
m.SendMessage($"Serialization for quest {quest.GetType().Name} is now disabled.");
}
if (AutoGenerateNew && !enable)
{
@ -256,7 +264,14 @@ namespace Server.Engines.MLQuests
quest.SaveEnabled = enable;
}
m.SendMessage("Serialization for all quests is now {0}.", enable ? "enabled" : "disabled");
if (enable)
{
m.SendMessage($"Serialization for all quests is now enabled.");
}
else
{
m.SendMessage($"Serialization for all quests is now disabled.");
}
if (AutoGenerateNew && !enable)
{
@ -817,10 +832,7 @@ namespace Server.Engines.MLQuests
CommandLogging.WriteLine(
from,
"{0} {1} viewing quest overview of {2}",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(pm)
$"{from.AccessLevel} {CommandLogging.Format(from)} viewing quest overview of {CommandLogging.Format(pm)}"
);
from.SendGump(new QuestLogGump(pm, false));
}

View file

@ -78,11 +78,11 @@ namespace Server
if (!path.Success)
{
from.SendMessage("{0} path failed: {1}ms", name, watch.ElapsedMilliseconds);
from.SendMessage($"{name} path failed: {watch.ElapsedMilliseconds}ms");
}
else
{
from.SendMessage("{0} path success: {1}ms", name, watch.ElapsedMilliseconds);
from.SendMessage($"{name} path success: {watch.ElapsedMilliseconds}ms");
var x = from.X;
var y = from.Y;

View file

@ -69,7 +69,7 @@ namespace Server.Engines.Spawners
for (var i = 0; i < files.Count; i++)
{
var (file, stem) = files[i];
from.SendMessage("ConvertPremiumSpawners: Converting spawners for {0}...", stem);
from.SendMessage($"ConvertPremiumSpawners: Converting spawners for {stem}...");
NetState.FlushAll();

View file

@ -84,7 +84,7 @@ namespace Server.Engines.Spawners
for (var i = 0; i < files.Count; i++)
{
var file = files[i];
from.SendMessage("GenerateSpawners: Generating spawners from {0}...", file.Name);
from.SendMessage($"GenerateSpawners: Generating spawners from {file.Name}...");
logger.Information("{User} is generating spawners from {File}", from, file.FullName);
NetState.FlushAll();
@ -99,8 +99,7 @@ namespace Server.Engines.Spawners
catch (JsonException)
{
from.SendMessage(
"GenerateSpawners: Exception parsing {0}, file may not be in the correct format.",
file.FullName
$"GenerateSpawners: Exception parsing {file.FullName}, file may not be in the correct format."
);
}
}

View file

@ -254,7 +254,7 @@ public class SpawnerGump : Gump
if (type == null)
{
from.SendMessage("{0} is not a valid type name for entry #{1}.", str, i);
from.SendMessage($"{str} is not a valid type name for entry #{i}.");
return;
}

View file

@ -187,7 +187,7 @@ namespace Server
}
else
{
pm.SendMessage("You have gained a path in {0}!", virtueName);
pm.SendMessage($"You have gained a path in {virtueName}!");
}
}
else
@ -199,7 +199,7 @@ namespace Server
}
else
{
pm.SendMessage("You have gained in {0}.", virtueName);
pm.SendMessage($"You have gained in {virtueName}.");
}
}
@ -223,7 +223,7 @@ namespace Server
}
else
{
pm.SendMessage("You have achieved the highest path in {0} and can no longer gain any further.", virtueName);
pm.SendMessage($"You have achieved the highest path in {virtueName} and can no longer gain any further.");
}
}

View file

@ -1706,10 +1706,7 @@ namespace Server.Gumps
{
CommandLogging.WriteLine(
from,
"{0} {1} deleting account {2}",
from.AccessLevel,
CommandLogging.Format(from),
a.Username
$"{from.AccessLevel} {CommandLogging.Format(from)} deleting account {a.Username}"
);
a.Delete();
@ -1770,10 +1767,7 @@ namespace Server.Gumps
{
CommandLogging.WriteLine(
from,
"{0} {1} banning account {2}",
from.AccessLevel,
CommandLogging.Format(from),
acct.Username
$"{from.AccessLevel} {CommandLogging.Format(from)} banning account {acct.Username}"
);
acct.SetUnspecifiedBan(from);
acct.Banned = true;
@ -1782,10 +1776,7 @@ namespace Server.Gumps
{
CommandLogging.WriteLine(
from,
"{0} {1} deleting account {2}",
from.AccessLevel,
CommandLogging.Format(from),
acct.Username
$"{from.AccessLevel} {CommandLogging.Format(from)} deleting account {acct.Username}"
);
acct.Delete();
rads.RemoveAt(i--);
@ -2816,10 +2807,7 @@ namespace Server.Gumps
notice = $"{un} : Account added.";
CommandLogging.WriteLine(
from,
"{0} {1} adding new account: {2}",
from.AccessLevel,
CommandLogging.Format(from),
un
$"{from.AccessLevel} {CommandLogging.Format(from)} adding new account: {un}"
);
}
}
@ -2931,11 +2919,7 @@ namespace Server.Gumps
a.Banned = index == 10;
CommandLogging.WriteLine(
from,
"{0} {1} {3} account {2}",
from.AccessLevel,
CommandLogging.Format(from),
a.Username,
a.Banned ? "banning" : "unbanning"
$"{from.AccessLevel} {CommandLogging.Format(from)} {a.Username} account {(a.Banned ? "banning" : "unbanning")}"
);
from.SendGump(
new AdminGump(
@ -2987,10 +2971,7 @@ namespace Server.Gumps
page = AdminGumpPage.AccountDetails_Information;
CommandLogging.WriteLine(
from,
"{0} {1} changing password of account {2}",
from.AccessLevel,
CommandLogging.Format(from),
a.Username
$"{from.AccessLevel} {CommandLogging.Format(from)} changing password of account {a.Username}"
);
}
@ -3238,11 +3219,7 @@ namespace Server.Gumps
CommandLogging.WriteLine(
from,
"{0} {1} changing access level of account {2} to {3}",
from.AccessLevel,
CommandLogging.Format(from),
a.Username,
a.AccessLevel
$"{from.AccessLevel} {CommandLogging.Format(from)} changing access level of account {a.Username} to {a.AccessLevel}"
);
from.SendGump(
new AdminGump(
@ -3759,10 +3736,7 @@ namespace Server.Gumps
CommandLogging.WriteLine(
from,
"{0} {1} firewalling {2}",
from.AccessLevel,
CommandLogging.Format(from),
toAdd
$"{from.AccessLevel} {CommandLogging.Format(from)} firewalling {toAdd}"
);
Firewall.Add(toAdd);
@ -3801,10 +3775,7 @@ namespace Server.Gumps
{
CommandLogging.WriteLine(
from,
"{0} {1} removing {2} from firewall list",
from.AccessLevel,
CommandLogging.Format(from),
m_State
$"{from.AccessLevel} {CommandLogging.Format(from)} removing {m_State} from firewall list"
);
Firewall.Remove(m_State);
@ -3883,11 +3854,7 @@ namespace Server.Gumps
{
CommandLogging.WriteLine(
from,
"{0} {1} {2} {3}",
from.AccessLevel,
CommandLogging.Format(from),
"kicking",
CommandLogging.Format(m)
$"{from.AccessLevel} {CommandLogging.Format(from)} kicking {CommandLogging.Format(m)}"
);
ns.Disconnect($"Kicked by {from}.");
notice = "They have been kicked.";
@ -3905,11 +3872,7 @@ namespace Server.Gumps
{
CommandLogging.WriteLine(
from,
"{0} {1} {2} {3}",
from.AccessLevel,
CommandLogging.Format(from),
"banning",
CommandLogging.Format(m)
$"{from.AccessLevel} {CommandLogging.Format(from)} banning {CommandLogging.Format(m)}"
);
a.Banned = true;
@ -3962,10 +3925,7 @@ namespace Server.Gumps
{
CommandLogging.WriteLine(
from,
"{0} {1} killing {2}",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(m)
$"{from.AccessLevel} {CommandLogging.Format(from)} killing {CommandLogging.Format(m)}"
);
m.Kill();
notice = "They have been killed.";
@ -3975,10 +3935,7 @@ namespace Server.Gumps
{
CommandLogging.WriteLine(
from,
"{0} {1} resurrecting {2}",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(m)
$"{from.AccessLevel} {CommandLogging.Format(from)} resurrecting {CommandLogging.Format(m)}"
);
m.Resurrect();
notice = "They have been resurrected.";
@ -4167,11 +4124,7 @@ namespace Server.Gumps
{
CommandLogging.WriteLine(
m_From,
"{0} {1} shutting down server (Restart: {2}) (Save: {3})",
m_From.AccessLevel,
CommandLogging.Format(m_From),
restart,
save
$"{m_From.AccessLevel} {CommandLogging.Format(m_From)} shutting down server (Restart: {restart}) (Save: {save})"
);
if (save)

View file

@ -248,7 +248,7 @@ namespace Server.Gumps
}
else
{
from.SendMessage("Ban Duration: {0}", duration);
from.SendMessage($"Ban Duration: {duration}");
}
}
else

View file

@ -181,16 +181,12 @@ namespace Server.Gumps
if (text != null)
{
focus.SendMessage(0x482, "{0} tells you:", from.Name);
focus.SendMessage(0x482, $"{from.Name} tells you:");
focus.SendMessage(0x482, text.Text);
CommandLogging.WriteLine(
from,
"{0} {1} telling {2} \"{3}\" ",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(focus),
text.Text
$"{from.AccessLevel} {CommandLogging.Format(from)} telling {CommandLogging.Format(focus)} \"{text.Text}\""
);
}
@ -211,10 +207,7 @@ namespace Server.Gumps
from.SendGump(new PropertiesGump(from, focus));
CommandLogging.WriteLine(
from,
"{0} {1} opening properties gump of {2} ",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(focus)
$"{from.AccessLevel} {CommandLogging.Format(from)} opening properties gump of {CommandLogging.Format(focus)}"
);
}
@ -233,12 +226,7 @@ namespace Server.Gumps
CommandLogging.WriteLine(
from,
"{0} {1} going to {2}, Location {3}, Map {4}",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(focus),
focus.Location,
focus.Map
$"{from.AccessLevel} {CommandLogging.Format(from)} going to {CommandLogging.Format(focus)}, {focus.Location} ({focus.Map})"
);
}
@ -257,12 +245,7 @@ namespace Server.Gumps
CommandLogging.WriteLine(
from,
"{0} {1} bringing {2} to Location {3}, Map {4}",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(focus),
from.Location,
from.Map
$"{from.AccessLevel} {CommandLogging.Format(from)} bringing {CommandLogging.Format(focus)} to {focus.Location} ({focus.Map})"
);
}
@ -285,10 +268,7 @@ namespace Server.Gumps
CommandLogging.WriteLine(
from,
"{0} {1} kicking {2} ",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(focus)
$"{from.AccessLevel} {CommandLogging.Format(from)} kicking {CommandLogging.Format(focus)}"
);
}
@ -301,10 +281,7 @@ namespace Server.Gumps
focus.Kill();
CommandLogging.WriteLine(
from,
"{0} {1} killing {2} ",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(focus)
$"{from.AccessLevel} {CommandLogging.Format(from)} killing {CommandLogging.Format(focus)}"
);
}
@ -323,10 +300,7 @@ namespace Server.Gumps
CommandLogging.WriteLine(
from,
"{0} {1} resurrecting {2} ",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(focus)
$"{from.AccessLevel} {CommandLogging.Format(from)} resurrecting {CommandLogging.Format(focus)}"
);
}
@ -343,10 +317,7 @@ namespace Server.Gumps
from.SendGump(new SkillsGump(from, focus));
CommandLogging.WriteLine(
from,
"{0} {1} Opening Skills gump of {2} ",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(focus)
$"{from.AccessLevel} {CommandLogging.Format(from)} opening Skills gump of {CommandLogging.Format(focus)}"
);
}

View file

@ -43,7 +43,7 @@ namespace Server.Gumps
{
if (BaseGuild.FindByAbbrev(text) != null)
{
m_Mobile.SendMessage("{0} conflicts with the abbreviation of an existing guild.", text);
m_Mobile.SendMessage($"{text} conflicts with the abbreviation of an existing guild.");
}
else
{

View file

@ -45,7 +45,7 @@ namespace Server.Gumps
g.WarDeclarations.Remove(m_Guild);
m_Guild.AddEnemy(g);
m_Guild.GuildMessage(1018020, true, "{0} ({1})", g.Name, g.Abbreviation);
m_Guild.GuildMessage(1018020, true, $"{g.Name} ({g.Abbreviation})");
GuildGump.EnsureClosed(m_Mobile);

View file

@ -42,13 +42,8 @@ namespace Server.Gumps
if (g != null)
{
m_Guild.RemoveEnemy(g);
m_Guild.GuildMessage(
1018018,
true,
"{0} ({1})",
g.Name,
g.Abbreviation
); // Guild Message: You are now at peace with this guild:
// Guild Message: You are now at peace with this guild:
m_Guild.GuildMessage(1018018, true, $"{g.Name} ({g.Abbreviation})");
GuildGump.EnsureClosed(m_Mobile);

View file

@ -62,26 +62,15 @@ namespace Server.Gumps
if (!m_Guild.WarDeclarations.Contains(g))
{
m_Guild.WarDeclarations.Add(g);
m_Guild.GuildMessage(
1018019,
true,
"{0} ({1})",
g.Name,
g.Abbreviation
); // Guild Message: Your guild has sent an invitation for war:
// Guild Message: Your guild has sent an invitation for war:
m_Guild.GuildMessage(1018019, true, $"{g.Name} ({g.Abbreviation})");
}
if (!g.WarInvitations.Contains(m_Guild))
{
g.WarInvitations.Add(m_Guild);
g.GuildMessage(
1018021,
true,
"{0} ({1})",
m_Guild.Name,
m_Guild
.Abbreviation
); // Guild Message: Your guild has received an invitation to war:
// Guild Message: Your guild has received an invitation to war:
g.GuildMessage(1018021, true, $"{m_Guild.Name} ({m_Guild.Abbreviation})");
}
}

View file

@ -43,7 +43,7 @@ namespace Server.Gumps
{
if (BaseGuild.FindByName(text) != null)
{
m_Mobile.SendMessage("{0} conflicts with the name of an existing guild.", text);
m_Mobile.SendMessage($"{text} conflicts with the name of an existing guild.");
}
else
{

View file

@ -137,7 +137,7 @@ namespace Server.Guilds
}
else
{
pm.SendMessage("You can't demote a {0}.", RankDefinition.Lowest.Name);
pm.SendMessage($"You can't demote a {RankDefinition.Lowest.Name}.");
}
}
else

View file

@ -242,8 +242,7 @@ namespace Server.Gumps
else if (!m_Type.IsInstanceOfType(toSet))
{
m_Mobile.SendMessage(
"The object with that serial could not be assigned to a property of type : {0}",
m_Type.Name
$"The object with that serial could not be assigned to a property of type : {m_Type.Name}"
);
}
else

View file

@ -47,7 +47,7 @@ namespace Server.Gumps
}
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

View file

@ -183,9 +183,7 @@ namespace Server.Items
World.Broadcast(
0x35,
true,
"{0} solen hives teleporters have been created. The entire process took {1:0.#} seconds.",
count,
(endTime - startTime).TotalSeconds
$"{count} solen hives teleporters have been created. The entire process took {(endTime - startTime).TotalSeconds:0.#} seconds."
);
}

View file

@ -202,8 +202,8 @@ namespace Server.Items
public override void OnSingleClick(Mobile from)
{
LabelTo(from, "{0} by {1}", _title, _author);
LabelTo(from, "[{0} pages]", _pages.Length);
LabelTo(from, $"{_title} by {_author}");
LabelTo(from, $"[{_pages.Length} pages]");
}
public override void OnDoubleClick(Mobile from)

View file

@ -441,7 +441,7 @@ namespace Server.Items
}
else
{
from.SendMessage("Only {0} may use this.", RequiredRace.PluralName);
from.SendMessage($"Only {RequiredRace.PluralName} may use this.");
}
return false;
@ -553,7 +553,7 @@ namespace Server.Items
}
else
{
m.SendMessage("Only {0} may use this.", clothing.RequiredRace.PluralName);
m.SendMessage($"Only {clothing.RequiredRace.PluralName} may use this.");
}
m.AddToBackpack(clothing);

View file

@ -83,7 +83,7 @@ public partial class StrongBox : BaseContainer, IChoppable
if (CheckContentDisplay(from))
{
LabelTo(from, "({0} items, {1} stones)", TotalItems, TotalWeight);
LabelTo(from, $"({TotalItems} items, {TotalWeight} stones)");
}
}

View file

@ -658,7 +658,7 @@ public partial class TreasureMap : MapItem
_ => "northwest"
};
from.SendAsciiMessage(0x44, "Try looking for the treasure chest more to the {0}.", sDir);
from.SendAsciiMessage(0x44, $"Try looking for the treasure chest more to the {sDir}.");
}
}
}

View file

@ -111,7 +111,7 @@ public partial class PublicMoongate : Item
count += MoonGen(PMList.Malas);
count += MoonGen(PMList.Tokuno);
World.Broadcast(0x35, true, "{0} moongates generated.", count);
World.Broadcast(0x35, true, $"{count} moongates generated.");
}
private static void DeleteAll()
@ -133,7 +133,7 @@ public partial class PublicMoongate : Item
if (list.Count > 0)
{
World.Broadcast(0x35, true, "{0} moongates removed.", list.Count);
World.Broadcast(0x35, true, $"{list.Count} moongates removed.");
}
}

View file

@ -162,11 +162,11 @@ public partial class Teleporter : Item
{
if (_mapDest != null && _pointDest != Point3D.Zero)
{
LabelTo(from, "{0} [{1}]", _pointDest, _mapDest);
LabelTo(from, $"{_pointDest} [{_mapDest}]");
}
else if (_mapDest != null)
{
LabelTo(from, "[{0}]", _mapDest);
LabelTo(from, $"[{_mapDest}]");
}
else if (_pointDest != Point3D.Zero)
{

View file

@ -57,7 +57,7 @@ public partial class WayPoint : Item
}
else
{
LabelTo(from, "(Linked: {0})", _nextPoint.Location);
LabelTo(from, $"(Linked: {_nextPoint.Location})");
}
}
}

View file

@ -7,7 +7,6 @@ namespace Server.Items
[Flippable(0x1f14, 0x1f15, 0x1f16, 0x1f17)]
public class RecallRune : Item
{
private const string RuneFormat = "a recall rune for {0}";
private string m_Description;
private BaseHouse m_House;
private bool m_Marked;
@ -268,7 +267,7 @@ namespace Server.Items
LabelTo(
from,
House != null ? 1063260 : 1063259, // ~1_val~ (Tokuno Islands)[(House)]
string.Format(RuneFormat, desc)
$"a recall rune for {desc}"
);
}
else if (m_TargetMap == Map.Malas)
@ -276,7 +275,7 @@ namespace Server.Items
LabelTo(
from,
House != null ? 1062454 : 1060804, // ~1_val~ (Malas)[(House)]
string.Format(RuneFormat, desc)
$"a recall rune for {desc}"
);
}
else if (m_TargetMap == Map.Felucca)
@ -284,7 +283,7 @@ namespace Server.Items
LabelTo(
from,
House != null ? 1062452 : 1060805, // ~1_val~ (Felucca)[(House)]
string.Format(RuneFormat, desc)
$"a recall rune for {desc}"
);
}
else if (m_TargetMap == Map.Trammel)
@ -292,17 +291,19 @@ namespace Server.Items
LabelTo(
from,
House != null ? 1062453 : 1060806, // ~1_val~ (Trammel)[(House)]
string.Format(RuneFormat, desc)
$"a recall rune for {desc}"
);
}
else
{
LabelTo(
from,
House != null ? "{0} ({1})(House)" : "{0} ({1})",
string.Format(RuneFormat, desc),
m_TargetMap
);
if (House != null)
{
LabelTo(from, $"a recall rune for {desc} ({m_TargetMap})(House)");
}
else
{
LabelTo(from, $"a recall rune for {desc} ({m_TargetMap})");
}
}
}
else

View file

@ -283,10 +283,7 @@ namespace Server.Items
CommandLogging.WriteLine(
from,
"{0} {1} filling spellbook {2}",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(book)
$"{from.AccessLevel} {CommandLogging.Format(from)} filling spellbook {CommandLogging.Format(book)}"
);
}
else

View file

@ -527,7 +527,7 @@ namespace Server.Items
}
else
{
from.SendMessage(MessageHue, "You do not have the {0} required to enter the raffle.", FormatPrice());
from.SendMessage(MessageHue, $"You do not have the {FormatPrice()} required to enter the raffle.");
}
}
else
@ -555,9 +555,7 @@ namespace Server.Items
m_Winner.SendMessage(
MessageHue,
"Congratulations, {0}! You have won the raffle for the plot located at {1}.",
m_Winner.Name,
FormatLocation()
$"Congratulations, {m_Winner.Name}! You have won the raffle for the plot located at {FormatLocation()}."
);
if (m_Winner.AddToBackpack(Deed))

View file

@ -145,7 +145,7 @@ namespace Server.Misc
if (shouldKick)
{
state.Mobile.SendMessage(0x22, "You will be disconnected in {0} seconds.", KickDelay.TotalSeconds);
state.Mobile.SendMessage(0x22, $"You will be disconnected in {KickDelay.TotalSeconds} seconds.");
Timer.StartTimer(KickDelay, () => OnKick(state));
return;
}
@ -189,9 +189,7 @@ namespace Server.Misc
if (_invalidClientResponse == InvalidClientResponse.LenientKick)
{
from.SendMessage(
"Invalid clients will be kicked after {0} days of character age and {1} hours of play time",
_ageLeniency,
_gameTimeLeniency
$"Invalid clients will be kicked after {_ageLeniency} days of character age and {_gameTimeLeniency} hours of play time"
);
}

View file

@ -392,11 +392,7 @@ namespace Server
World.Broadcast(
0x35,
true,
"Door generation complete. Trammel: {0}; Felucca: {1}; Ilshenar: {2}; Malas: {3};",
trammelCount,
feluccaCount,
ilshenarCount,
malasCount
$"Door generation complete. Trammel: {trammelCount}; Felucca: {feluccaCount}; Ilshenar: {ilshenarCount}; Malas: {malasCount};"
);
}

View file

@ -274,11 +274,6 @@ namespace Server.Guilds
}
}
public void AllianceMessage(int num, bool append, string format, params object[] args)
{
AllianceMessage(num, append, string.Format(format, args));
}
public void AllianceMessage(int number)
{
for (var i = 0; i < m_Members.Count; ++i)
@ -303,15 +298,7 @@ namespace Server.Guilds
}
}
public void AllianceTextMessage(string text)
{
AllianceTextMessage(0x3B2, text);
}
public void AllianceTextMessage(string format, params object[] args)
{
AllianceTextMessage(0x3B2, string.Format(format, args));
}
public void AllianceTextMessage(string text) => AllianceTextMessage(0x3B2, text);
public void AllianceTextMessage(int hue, string text)
{
@ -321,11 +308,6 @@ namespace Server.Guilds
}
}
public void AllianceTextMessage(int hue, string format, params object[] args)
{
AllianceTextMessage(hue, string.Format(format, args));
}
public void AllianceChat(Mobile from, int hue, string text)
{
Span<byte> buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLength(text)].InitializePacket();
@ -1462,11 +1444,6 @@ namespace Server.Guilds
}
}
public void GuildMessage(int num, bool append, string format, params object[] args)
{
GuildMessage(num, append, string.Format(format, args));
}
public void GuildMessage(int number)
{
for (var i = 0; i < Members.Count; ++i)
@ -1491,15 +1468,7 @@ namespace Server.Guilds
}
}
public void GuildTextMessage(string text)
{
GuildTextMessage(0x3B2, text);
}
public void GuildTextMessage(string format, params object[] args)
{
GuildTextMessage(0x3B2, string.Format(format, args));
}
public void GuildTextMessage(string text) => GuildTextMessage(0x3B2, text);
public void GuildTextMessage(int hue, string text)
{
@ -1509,11 +1478,6 @@ namespace Server.Guilds
}
}
public void GuildTextMessage(int hue, string format, params object[] args)
{
GuildTextMessage(hue, string.Format(format, args));
}
public void GuildChat(Mobile from, int hue, string text)
{
Span<byte> buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLength(text)].InitializePacket();

View file

@ -113,10 +113,7 @@ namespace Server
{
CommandLogging.WriteLine(
from,
"{0} {1} viewing hardware info of {2}",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(m)
$"{from.AccessLevel} {CommandLogging.Format(from)} viewing hardware info of {CommandLogging.Format(m)}"
);
}

View file

@ -31,16 +31,14 @@ namespace Server.Misc
{
if (!Core.SE)
{
from.SendMessage("Short Term Murders : {0}", from.ShortTermMurders);
from.SendMessage("Long Term Murders : {0}", from.Kills);
from.SendMessage($"Short Term Murders : {from.ShortTermMurders}");
from.SendMessage($"Long Term Murders : {from.Kills}");
}
else
{
from.SendMessage(
0x3B2,
"Short Term Murders: {0} Long Term Murders: {1}",
from.ShortTermMurders,
from.Kills
$"Short Term Murders: {from.ShortTermMurders} Long Term Murders: {from.Kills}"
);
}

View file

@ -44,7 +44,7 @@ namespace Server
if (e.Length >= 1)
{
LevelOverride = e.GetInt32(0);
e.Mobile.SendMessage("Global light level override has been changed to {0}.", m_LevelOverride);
e.Mobile.SendMessage($"Global light level override has been changed to {m_LevelOverride}.");
}
else
{

View file

@ -17,15 +17,8 @@ namespace Server.Misc
var mobileCount = World.Mobiles.Count;
m.SendMessage(
"Welcome, {0}! There {1} currently {2} user{3} online, with {4} item{5} and {6} mobile{7} in the world.",
m.Name,
userCount == 1 ? "is" : "are",
userCount,
userCount == 1 ? "" : "s",
itemCount,
itemCount == 1 ? "" : "s",
mobileCount,
mobileCount == 1 ? "" : "s"
$"Welcome, {m.Name}! There {(userCount == 1 ? "is" : "are")} currently {userCount} user{(userCount == 1 ? "" : "s")} " +
$"online, with {itemCount} item{(itemCount == 1 ? "" : "s")} and {mobileCount} mobile{(mobileCount == 1 ? "" : "s")} in the world."
);
}
}

View file

@ -72,7 +72,7 @@ namespace Server.Network
return;
}
e.Mobile.SendMessage("Packet 0x{0:X} throttle is currently {1}ms.", packetID, Delays[packetID]);
e.Mobile.SendMessage($"Packet 0x{packetID:X} throttle is currently {Delays[packetID]}ms.");
}
[Usage("SetThrottle <packetID> <timeInMilliseconds>")]

View file

@ -555,10 +555,15 @@ namespace Server.Misc
{
if (!m_Poller.Active)
{
m_From.SendMessage(
"Enter a title for the option. Escape to cancel.{0}",
opt == null ? "" : " Use \"DEL\" to delete."
);
if (opt == null)
{
m_From.SendMessage($"Enter a title for the option. Escape to cancel.");
}
else
{
m_From.SendMessage($"Enter a title for the option. Escape to cancel. Use \"DEL\" to delete.");
}
m_From.Prompt = new ShardPollPrompt(m_Poller, opt);
}
else

View file

@ -3476,11 +3476,11 @@ namespace Server.Mobiles
{
if (target.Title == null)
{
SendMessage("{0} cannot be harmed.", target.Name);
SendMessage($"{target.Name} cannot be harmed.");
}
else
{
SendMessage("{0} {1} cannot be harmed.", target.Name, target.Title);
SendMessage($"{target.Name} {target.Title} cannot be harmed.");
}
}

View file

@ -1643,11 +1643,11 @@ namespace Server.Mobiles
{
if (target.Title == null)
{
SendMessage("{0} cannot be harmed.", target.Name);
SendMessage($"{target.Name} cannot be harmed.");
}
else
{
SendMessage("{0} {1} cannot be harmed.", target.Name, target.Title);
SendMessage($"{target.Name} {target.Title} cannot be harmed.");
}
}
@ -2747,7 +2747,7 @@ namespace Server.Mobiles
{
// g.Alliance.AllianceTextMessage( hue, "[Alliance][{0}]: {1}", this.Name, text );
g.Alliance.AllianceChat(this, text);
SendToStaffMessage(this, "[Alliance]: {0}", text);
SendToStaffMessage(this, $"[Alliance]: {text}");
AllianceMessageHue = hue;
}
@ -2761,7 +2761,7 @@ namespace Server.Mobiles
GuildMessageHue = hue;
g.GuildChat(this, text);
SendToStaffMessage(this, "[Guild]: {0}", text);
SendToStaffMessage(this, $"[Guild]: {text}");
}
}
else
@ -2803,11 +2803,6 @@ namespace Server.Mobiles
}
}
private static void SendToStaffMessage(Mobile from, string format, params object[] args)
{
SendToStaffMessage(from, string.Format(format, args));
}
public override void Damage(int amount, Mobile from = null, bool informMount = true)
{
var damageBonus = 1.0;

View file

@ -246,8 +246,7 @@ namespace Server.Mobiles
if (escorter == null)
{
Say(
"I am looking to go to {0}, will you take me?",
dest.Name == "Ocllo" && m.Map == Map.Trammel ? "Haven" : dest.Name
$"I am looking to go to {(dest.Name == "Ocllo" && m.Map == Map.Trammel ? "Haven" : dest.Name)}, will you take me?"
);
return true;
}
@ -255,8 +254,7 @@ namespace Server.Mobiles
if (escorter == m)
{
Say(
"Lead on! Payment will be made when we arrive in {0}.",
dest.Name == "Ocllo" && m.Map == Map.Trammel ? "Haven" : dest.Name
$"Lead on! Payment will be made when we arrive in {(dest.Name == "Ocllo" && m.Map == Map.Trammel ? "Haven" : dest.Name)}."
);
return true;
}
@ -290,7 +288,15 @@ namespace Server.Mobiles
var minutes =
(int)Math.Ceiling((mobile.LastEscortTime + EscortDelay - Core.Now).TotalMinutes);
Say("You must rest {0} minute{1} before we set out on this journey.", minutes, minutes == 1 ? "" : "s");
if (minutes == 1)
{
Say($"You must rest {minutes} minute before we set out on this journey.");
}
else
{
Say($"You must rest {minutes} minutes before we set out on this journey.");
}
return false;
}
@ -304,8 +310,7 @@ namespace Server.Mobiles
}
Say(
"Lead on! Payment will be made when we arrive in {0}.",
dest.Name == "Ocllo" && m.Map == Map.Trammel ? "Haven" : dest.Name
$"Lead on! Payment will be made when we arrive in {(dest.Name == "Ocllo" && m.Map == Map.Trammel ? "Haven" : dest.Name)}."
);
EscortTable[m] = this;
StartFollow();

View file

@ -127,7 +127,7 @@ namespace Server.Mobiles
ts = TimeSpan.Zero;
}
from.SendMessage("Duration set to: {0}", ts);
from.SendMessage($"Duration set to: {ts}");
from.SendMessage("Enter the first line to shout:");
from.Prompt = new TownCrierLinesPrompt(m_Owner, null, new List<string>(), ts);
@ -284,7 +284,7 @@ namespace Server.Mobiles
var tce = entries[index];
var ts = Utility.Max(tce.ExpireTime - Core.Now, TimeSpan.Zero);
m_From.SendMessage("Editing entry #{0}.", index + 1);
m_From.SendMessage($"Editing entry #{index + 1}.");
m_From.SendMessage("Enter the first line to shout:");
m_From.Prompt = new TownCrierLinesPrompt(m_Owner, tce, new List<string>(), ts);
}

View file

@ -387,8 +387,7 @@ namespace Server.Mobiles
SayTo(
buyer,
true,
"The total of thy purchase is {0} gold, which has been withdrawn from your bank account. My thanks for the patronage. Unfortunately, I could not sell you all the goods you requested.",
totalCost
$"The total of thy purchase is {totalCost} gold, which has been withdrawn from your bank account. My thanks for the patronage. Unfortunately, I could not sell you all the goods you requested."
);
}
else
@ -396,8 +395,7 @@ namespace Server.Mobiles
SayTo(
buyer,
true,
"The total of thy purchase is {0} gold. My thanks for the patronage. Unfortunately, I could not sell you all the goods you requested.",
totalCost
$"The total of thy purchase is {totalCost} gold. My thanks for the patronage. Unfortunately, I could not sell you all the goods you requested."
);
}
}
@ -450,7 +448,7 @@ namespace Server.Mobiles
if (Sold > MaxSell)
{
SayTo(seller, true, "You may only sell {0} items at a time!", MaxSell);
SayTo(seller, true, $"You may only sell {MaxSell} items at a time!");
return false;
}

View file

@ -219,7 +219,7 @@ namespace Server.Mobiles
if (!string.IsNullOrEmpty(vi.Description))
{
item.LabelTo(from, "Description: {0}", vi.Description);
item.LabelTo(from, $"Description: {vi.Description}");
}
}
}
@ -1079,7 +1079,7 @@ namespace Server.Mobiles
{
if (HoldGold > 0)
{
SayTo(to, "How much of the {0} that I'm holding would you like?", HoldGold.ToString());
SayTo(to, $"How much of the {HoldGold} that I'm holding would you like?");
to.SendMessage("Enter the amount of gold you wish to withdraw (ESC = CANCEL):");
to.Prompt = new CollectGoldPrompt(this);
@ -1099,7 +1099,7 @@ namespace Server.Mobiles
if (amount > HoldGold)
{
SayTo(to, "I'm sorry, but I'm only holding {0} gold for you.", HoldGold.ToString());
SayTo(to, $"I'm sorry, but I'm only holding {HoldGold} gold for you.");
return 0;
}

View file

@ -1155,11 +1155,14 @@ namespace Server.Multis
// Temporary Fix. We should be booting a client out of customization mode in the delete handler.
if (from.AccessLevel >= AccessLevel.GameMaster && cost != 0)
{
from.SendMessage(
"{0} gold would have been {1} your bank if you were not a GM.",
cost.ToString(),
cost > 0 ? "withdrawn from" : "deposited into"
);
if (cost > 0)
{
from.SendMessage($"{cost} gold would have been withdrawn from your bank if you were not a GM.");
}
else
{
from.SendMessage($"{cost} gold would have been deposited into your bank if you were not a GM.");
}
}
else
{

View file

@ -2033,8 +2033,7 @@ namespace Server.Items
if (from.AccessLevel >= AccessLevel.GameMaster)
{
from.SendMessage(
"{0} gold would have been withdrawn from your bank if you were not a GM.",
Cost.ToString()
$"{Cost} gold would have been withdrawn from your bank if you were not a GM."
);
}
else

View file

@ -103,7 +103,7 @@ namespace Server.Multis
_ => "in danger of collapsing"
};
LabelTo(from, "This house is {0}.", message);
LabelTo(from, $"This house is {message}.");
}
base.OnSingleClick(from);

View file

@ -61,9 +61,7 @@ namespace Server.Misc
else if (m_MoveHistory.Remove(from, out var orig))
{
from.SendMessage(
"Your character was moved from {0} ({1}) due to a detected client crash.",
orig.Location,
orig.Map
$"Your character was moved from {orig.Location} ({orig.Map}) due to a detected client crash."
);
}
}

View file

@ -757,7 +757,7 @@ namespace Server.Misc
}
case 3: // Command list
{
sender.Mobile.SendAsciiMessage(0x482, "The command prefix is \"{0}\"", CommandSystem.Prefix);
sender.Mobile.SendAsciiMessage(0x482, $"The command prefix is \"{CommandSystem.Prefix}\"");
CommandHandlers.Help_OnCommand(new CommandEventArgs(sender.Mobile, "help", "", Array.Empty<string>()));
break;

View file

@ -58,7 +58,7 @@ namespace Server.Items
{
var maxCheck = 1000000;
from.SendMessage(0x35, "You win the {0}gp jackpot!", m_GamblePot);
from.SendMessage(0x35, $"You win the {m_GamblePot}gp jackpot!");
while (m_GamblePot > maxCheck)
{

View file

@ -58,7 +58,14 @@ namespace Server.Spells.First
}
else
{
from.SendMessage("{0} already have nightsight.", from == targ ? "You" : "They");
if (from == targ)
{
from.SendMessage("You already have nightsight.");
}
else
{
from.SendMessage("They already have nightsight.");
}
}
}

View file

@ -32,11 +32,7 @@ namespace Server.Targets
CommandLogging.WriteLine(
from,
"{0} {1} moving {2} to {3}",
from.AccessLevel,
CommandLogging.Format(from),
CommandLogging.Format(m_Object),
p
$"{from.AccessLevel} {CommandLogging.Format(from)} moving {CommandLogging.Format(m_Object)} to {p}"
);
if (m_Object is Item item)

View file

@ -104,20 +104,16 @@ namespace Server.Saves
World.Broadcast(
0x35,
true,
"The world will save in {0} minute{1} and {2} second{3}.",
m,
m != 1 ? "s" : "",
s,
s != 1 ? "s" : ""
$"The world will save in {m} minute{(m != 1 ? "s" : "")} and {s} second{(s != 1 ? "s" : "")}."
);
}
else if (m > 0)
{
World.Broadcast(0x35, true, "The world will save in {0} minute{1}.", m, m != 1 ? "s" : "");
World.Broadcast(0x35, true, $"The world will save in {m} minute{(m != 1 ? "s" : "")}.");
}
else
{
World.Broadcast(0x35, true, "The world will save in {0} second{1}.", s, s != 1 ? "s" : "");
World.Broadcast(0x35, true, $"The world will save in {s} second{(s != 1 ? "s" : "")}.");
}
}

View file

@ -32,7 +32,15 @@ namespace Server.Commands
{
var enabled = AutoSave.SavesEnabled = e.GetBoolean(0);
e.Mobile.SendMessage("Saves have been {0}.", enabled ? "enabled" : "disabled");
if (enabled)
{
e.Mobile.SendMessage($"Saves have been enabled.");
}
else
{
e.Mobile.SendMessage($"Saves have been disabled.");
}
}
else
{