ModernUO/Projects/UOContent/Engines/ConPVP
Kamron Batman ca6064b775
perf(messages): restructure format-string call sites (#2437)
## Summary

Phase 3 PR B of the message-interpolation cleanup. Handles the multi-line restructure sites flagged in `dev-docs/string-handling-message-interp-audit.md` (Phase 2). Phase 3.1 (PR #2436) handled trivial sweeps; this PR handles sites that needed an `if/else` hoist or switch restructure to eliminate `string.Format` while preserving exact message text.

Each site previously allocated an intermediate `string.Format(...)` result before passing to the message handler, despite Phase 1 making the handler accept interpolated string handlers natively.

## Sites fixed

- **`Projects/Server/Mobiles/Mobile.cs:7911`** - Title/guild header was using `string.Format` with a conditional template (`"[{1}]{2}"` vs `"[{0}, {1}]{2}"`). Split into `if (title.Length <= 0)` / `else` with direct `$"..."` interpolation.
- **`Projects/UOContent/Engines/ConPVP/DuelContext.cs:1337`** - View-ladder rank text used `string.Format(text, from == pm ? "You" : "They")`. Split into `if (from == pm)` / `else` with direct `$"..."` interpolation in each branch.
- **`Projects/UOContent/Engines/ConPVP/DuelContext.cs:1463`** - Showladder text reused a single format string for both `LocalOverheadMessage` ("You ... are ...") and `NonlocalOverheadMessage` ("`{pm.Name}` ... is ..."). Each call now uses an inline `$"..."` directly; no shared template.
- **`Projects/UOContent/Engines/ConPVP/Gumps/ConfirmSignupGump.cs:518`** - The signup confirmation message used a `switch` expression assigning a literal format string to `fmt`, then `string.Format(fmt, from.Female ? "Lady" : "Lord", timeUntil)`. Converted to a `switch` statement where each case calls `_registrar.PrivateOverheadMessage(...)` directly with an inline `$"..."`. Lady/Lord branching is hoisted to a `title` local.

## Exempted

- **`Projects/UOContent/Engines/ConPVP/Participant.cs:138`** - The `nonLocalOverhead` format string is a parameter passed in by callers of `Participant.Broadcast`. Investigation found 5 call sites in `DuelContext.cs` (lines 782, 802, 1187, 1196, and three at 1535/1564/1608) that pass distinct literal format strings. Refactoring would require changing all 5 callers and the method signature - out of scope for this PR. Marked with a `// Phase 3 audit:` comment per the audit's exemption convention.
2026-05-03 18:29:11 -07:00
..
Games perf: Migrate ConPVP game board gumps to DynamicGump (#2419) 2026-04-26 09:55:46 -07:00
Gumps perf(messages): restructure format-string call sites (#2437) 2026-05-03 18:29:11 -07:00
AcceptDuelGump.cs perf: Migrates ConPVP lobby gumps from legacy Gump. (#2423) 2026-05-03 01:06:04 -07:00
Arena.cs fix: Fixes region priority and resolution. (#1254) 2022-11-21 10:38:20 -08:00
DuelContext.cs perf(messages): restructure format-string call sites (#2437) 2026-05-03 18:29:11 -07:00
DuelTeleporterAddon.cs fix: Converts ConPVP to serialization generator (#2338) 2026-02-14 14:50:10 -08:00
Ladder.cs chore: Cleans up pattern checks. (#892) 2021-12-24 15:53:59 -08:00
Participant.cs perf(messages): restructure format-string call sites (#2437) 2026-05-03 18:29:11 -07:00
Preferences.cs perf: Migrates ConPVP lobby gumps from legacy Gump. (#2423) 2026-05-03 01:06:04 -07:00
Ruleset.cs C# 9 Cleanup (#325) 2020-11-27 00:29:21 -08:00
RulesetLayout.cs C# 9 Cleanup (#325) 2020-11-27 00:29:21 -08:00
SafeZone.cs fix: Fixes region priority and resolution. (#1254) 2022-11-21 10:38:20 -08:00
Tournament.cs feat: Add zero-alloc interpolation handler to ValueStringBuilder, replace all StringBuilder usage (#2387) 2026-03-22 14:23:44 -07:00
TournamentBracketItem.cs perf: Migrates ConPVP lobby gumps from legacy Gump. (#2423) 2026-05-03 01:06:04 -07:00
TournamentController.cs perf: Migrates ConPVP lobby gumps from legacy Gump. (#2423) 2026-05-03 01:06:04 -07:00
TournamentPyramid.cs feat: Adds Mobile.Murderer virtual property, consolidates kill-threshold checks (#2355) 2026-03-06 08:36:41 -08:00
TournamentRegistrar.cs fix: Converts ConPVP to serialization generator (#2338) 2026-02-14 14:50:10 -08:00
TournamentSignupItem.cs perf: Migrates ConPVP lobby gumps from legacy Gump. (#2423) 2026-05-03 01:06:04 -07:00
TourneyParticipant.cs feat: Add zero-alloc interpolation handler to ValueStringBuilder, replace all StringBuilder usage (#2387) 2026-03-22 14:23:44 -07:00
Trophy.cs fix: Codegens faction items and questers (#1764) 2024-05-08 17:16:36 -07:00