diff --git a/Projects/Server/Mobiles/Mobile.cs b/Projects/Server/Mobiles/Mobile.cs index 9c138641a..e425dcf70 100644 --- a/Projects/Server/Mobiles/Mobile.cs +++ b/Projects/Server/Mobiles/Mobile.cs @@ -7908,14 +7908,26 @@ public partial class Mobile : IHued, IComparable, ISpawnable, IObjectPro type = ""; } - var text = string.Format( - title.Length <= 0 ? "[{1}]{2}" : "[{0}, {1}]{2}", - title, - guild.Abbreviation, - type - ); - - PrivateOverheadMessage(MessageType.Regular, SpeechHue, true, text, from.NetState); + if (title.Length <= 0) + { + PrivateOverheadMessage( + MessageType.Regular, + SpeechHue, + true, + $"[{guild.Abbreviation}]{type}", + from.NetState + ); + } + else + { + PrivateOverheadMessage( + MessageType.Regular, + SpeechHue, + true, + $"[{title}, {guild.Abbreviation}]{type}", + from.NetState + ); + } } } diff --git a/Projects/UOContent/Engines/ConPVP/DuelContext.cs b/Projects/UOContent/Engines/ConPVP/DuelContext.cs index 38a257014..2a62259f8 100644 --- a/Projects/UOContent/Engines/ConPVP/DuelContext.cs +++ b/Projects/UOContent/Engines/ConPVP/DuelContext.cs @@ -1334,16 +1334,26 @@ public partial class DuelContext return; // sanity } - var text = - $"{{0}} are ranked {LadderGump.Rank(entry.Index + 1)} at level {Ladder.GetLevel(entry.Experience)}."; - - pm.PrivateOverheadMessage( - MessageType.Regular, - pm.SpeechHue, - true, - string.Format(text, from == pm ? "You" : "They"), - from.NetState - ); + if (from == pm) + { + pm.PrivateOverheadMessage( + MessageType.Regular, + pm.SpeechHue, + true, + $"You are ranked {LadderGump.Rank(entry.Index + 1)} at level {Ladder.GetLevel(entry.Experience)}.", + from.NetState + ); + } + else + { + pm.PrivateOverheadMessage( + MessageType.Regular, + pm.SpeechHue, + true, + $"They are ranked {LadderGump.Rank(entry.Index + 1)} at level {Ladder.GetLevel(entry.Experience)}.", + from.NetState + ); + } } else if (obj is Mobile mob) { @@ -1460,15 +1470,17 @@ public partial class DuelContext return; // sanity } - var text = - $"{{0}} {{1}} ranked {LadderGump.Rank(entry.Index + 1)} at level {Ladder.GetLevel(entry.Experience)}."; - - pm.LocalOverheadMessage(MessageType.Regular, pm.SpeechHue, true, string.Format(text, "You", "are")); + pm.LocalOverheadMessage( + MessageType.Regular, + pm.SpeechHue, + true, + $"You are ranked {LadderGump.Rank(entry.Index + 1)} at level {Ladder.GetLevel(entry.Experience)}." + ); pm.NonlocalOverheadMessage( MessageType.Regular, pm.SpeechHue, true, - string.Format(text, pm.Name, "is") + $"{pm.Name} is ranked {LadderGump.Rank(entry.Index + 1)} at level {Ladder.GetLevel(entry.Experience)}." ); // pm.PublicOverheadMessage( MessageType.Regular, pm.SpeechHue, true, String.Format( "Level {0} with {1} win{2} and {3} loss{4}.", Ladder.GetLevel( entry.Experience ), entry.Wins, entry.Wins==1?"":"s", entry.Losses, entry.Losses==1?"":"es" ) ); diff --git a/Projects/UOContent/Engines/ConPVP/Gumps/ConfirmSignupGump.cs b/Projects/UOContent/Engines/ConPVP/Gumps/ConfirmSignupGump.cs index 5104acb2a..ee02edf60 100644 --- a/Projects/UOContent/Engines/ConPVP/Gumps/ConfirmSignupGump.cs +++ b/Projects/UOContent/Engines/ConPVP/Gumps/ConfirmSignupGump.cs @@ -499,13 +499,6 @@ public class ConfirmSignupGump : DynamicGump if (_registrar != null) { - string fmt = _tournament.PlayersPerParticipant switch - { - 1 => "As you say m'{0}. I've written your name to the bracket. The tournament will begin {1}.", - 2 => "As you wish m'{0}. The tournament will begin {1}, but first you must name your partner.", - _ => "As you wish m'{0}. The tournament will begin {1}, but first you must name your team." - }; - var minutesUntil = (int)Math.Round( (_tournament.SignupStart + _tournament.SignupPeriod - Core.Now) .TotalMinutes @@ -515,13 +508,44 @@ public class ConfirmSignupGump : DynamicGump ? "momentarily" : $"in {minutesUntil} minute{(minutesUntil == 1 ? "" : "s")}"; - _registrar.PrivateOverheadMessage( - MessageType.Regular, - 0x35, - false, - string.Format(fmt, from.Female ? "Lady" : "Lord", timeUntil), - from.NetState - ); + var title = from.Female ? "Lady" : "Lord"; + + switch (_tournament.PlayersPerParticipant) + { + case 1: + { + _registrar.PrivateOverheadMessage( + MessageType.Regular, + 0x35, + false, + $"As you say m'{title}. I've written your name to the bracket. The tournament will begin {timeUntil}.", + from.NetState + ); + break; + } + case 2: + { + _registrar.PrivateOverheadMessage( + MessageType.Regular, + 0x35, + false, + $"As you wish m'{title}. The tournament will begin {timeUntil}, but first you must name your partner.", + from.NetState + ); + break; + } + default: + { + _registrar.PrivateOverheadMessage( + MessageType.Regular, + 0x35, + false, + $"As you wish m'{title}. The tournament will begin {timeUntil}, but first you must name your team.", + from.NetState + ); + break; + } + } } var part = new TourneyParticipant(from); diff --git a/Projects/UOContent/Engines/ConPVP/Participant.cs b/Projects/UOContent/Engines/ConPVP/Participant.cs index aaa9059cb..54563bbdc 100644 --- a/Projects/UOContent/Engines/ConPVP/Participant.cs +++ b/Projects/UOContent/Engines/ConPVP/Participant.cs @@ -135,6 +135,7 @@ namespace Server.Engines.ConPVP if (nonLocalOverhead != null) { + // Phase 3 audit: Format string passed by caller; restructuring requires changing all callers — out of scope for this PR. Players[i] .Mobile.NonlocalOverheadMessage( MessageType.Regular, diff --git a/Projects/UOContent/Mobiles/Monsters/LBR/Jukas/JukaLord.cs b/Projects/UOContent/Mobiles/Monsters/LBR/Jukas/JukaLord.cs index eb276888a..4529489d8 100644 --- a/Projects/UOContent/Mobiles/Monsters/LBR/Jukas/JukaLord.cs +++ b/Projects/UOContent/Mobiles/Monsters/LBR/Jukas/JukaLord.cs @@ -74,15 +74,29 @@ namespace Server.Mobiles { if (!willKill && amount > 5 && from?.Player == true && Utility.Random(100) < 5) { - string[] toSay = + switch (Utility.Random(4)) { - "{0}!! You will have to do better than that!", - "{0}!! Prepare to meet your doom!", - "{0}!! My armies will crush you!", - "{0}!! You will pay for that!" - }; - - Say(true, string.Format(toSay.RandomElement(), from.Name)); + case 0: + { + Say(true, $"{from.Name}!! You will have to do better than that!"); + break; + } + case 1: + { + Say(true, $"{from.Name}!! Prepare to meet your doom!"); + break; + } + case 2: + { + Say(true, $"{from.Name}!! My armies will crush you!"); + break; + } + default: + { + Say(true, $"{from.Name}!! You will pay for that!"); + break; + } + } } base.OnDamage(amount, from, willKill);