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

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