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

@ -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.");
}
}