From cbac58fb7d61e87b36b2e4aaa29be5fd90ce722d Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Sat, 19 Oct 2024 00:30:48 -0700 Subject: [PATCH] fix: Converts accept protection gump to StaticGump --- Projects/UOContent/Engines/Virtues/Justice.cs | 80 ++++++++++--------- 1 file changed, 44 insertions(+), 36 deletions(-) diff --git a/Projects/UOContent/Engines/Virtues/Justice.cs b/Projects/UOContent/Engines/Virtues/Justice.cs index 5813bb950..abbb8da1e 100644 --- a/Projects/UOContent/Engines/Virtues/Justice.cs +++ b/Projects/UOContent/Engines/Virtues/Justice.cs @@ -267,67 +267,75 @@ public static void CheckAtrophy(PlayerMobile pm) } } -public class AcceptProtectorGump : Gump +public class AcceptProtectorGump : StaticGump { - private readonly PlayerMobile _protectee; private readonly PlayerMobile _protector; + private readonly PlayerMobile _protectee; public AcceptProtectorGump(PlayerMobile protector, PlayerMobile protectee) : base(150, 50) { _protector = protector; _protectee = protectee; + } - Closable = false; + protected override void BuildLayout(ref StaticGumpBuilder builder) + { + builder.SetNoClose(); - AddPage(0); + builder.AddPage(); - AddBackground(0, 0, 396, 218, 3600); + builder.AddBackground(0, 0, 396, 218, 3600); - AddImageTiled(15, 15, 365, 190, 2624); - AddAlphaRegion(15, 15, 365, 190); + builder.AddImageTiled(15, 15, 365, 190, 2624); + builder.AddAlphaRegion(15, 15, 365, 190); // Another player is offering you their protection: - AddHtmlLocalized(30, 20, 360, 25, 1049365, 0x7FFF); - AddLabel(90, 55, 1153, protector.Name); + builder.AddHtmlLocalized(30, 20, 360, 25, 1049365, 0x7FFF); + builder.AddLabelPlaceholder(90, 55, 1153, "protector"); - AddImage(50, 45, 9005); - AddImageTiled(80, 80, 200, 1, 9107); - AddImageTiled(95, 82, 200, 1, 9157); + builder.AddImage(50, 45, 9005); + builder.AddImageTiled(80, 80, 200, 1, 9107); + builder.AddImageTiled(95, 82, 200, 1, 9157); - AddRadio(30, 110, 9727, 9730, true, 1); - AddHtmlLocalized(65, 115, 300, 25, 1049444, 0x7FFF); // Yes, I would like their protection. + builder.AddRadio(30, 110, 9727, 9730, true, 1); + builder.AddHtmlLocalized(65, 115, 300, 25, 1049444, 0x7FFF); // Yes, I would like their protection. - AddRadio(30, 145, 9727, 9730, false, 0); - AddHtmlLocalized(65, 148, 300, 25, 1049445, 0x7FFF); // No thanks, I can take care of myself. + builder.AddRadio(30, 145, 9727, 9730, false, 0); + builder.AddHtmlLocalized(65, 148, 300, 25, 1049445, 0x7FFF); // No thanks, I can take care of myself. - AddButton(160, 175, 247, 248, 2); + builder.AddButton(160, 175, 247, 248, 2); - AddImage(215, 0, 50581); + builder.AddImage(215, 0, 50581); - AddImageTiled(15, 14, 365, 1, 9107); - AddImageTiled(380, 14, 1, 190, 9105); - AddImageTiled(15, 205, 365, 1, 9107); - AddImageTiled(15, 14, 1, 190, 9105); - AddImageTiled(0, 0, 395, 1, 9157); - AddImageTiled(394, 0, 1, 217, 9155); - AddImageTiled(0, 216, 395, 1, 9157); - AddImageTiled(0, 0, 1, 217, 9155); + builder.AddImageTiled(15, 14, 365, 1, 9107); + builder.AddImageTiled(380, 14, 1, 190, 9105); + builder.AddImageTiled(15, 205, 365, 1, 9107); + builder.AddImageTiled(15, 14, 1, 190, 9105); + builder.AddImageTiled(0, 0, 395, 1, 9157); + builder.AddImageTiled(394, 0, 1, 217, 9155); + builder.AddImageTiled(0, 216, 395, 1, 9157); + builder.AddImageTiled(0, 0, 1, 217, 9155); + } + + protected override void BuildStrings(ref GumpStringsBuilder builder) + { + builder.SetStringSlot("protector", _protector.Name); } public override void OnResponse(NetState sender, in RelayInfo info) { - if (info.ButtonID == 2) + if (info.ButtonID != 2) { - var okay = info.IsSwitched(1); + return; + } - if (okay) - { - JusticeVirtue.OnVirtueAccepted(_protector, _protectee); - } - else - { - JusticeVirtue.OnVirtueRejected(_protector, _protectee); - } + if (info.IsSwitched(1)) // okay + { + JusticeVirtue.OnVirtueAccepted(_protector, _protectee); + } + else + { + JusticeVirtue.OnVirtueRejected(_protector, _protectee); } } }