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

@ -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