feat: Adds size/style support to gump builders, optimizes EscapeHtml (#2257)

> [!IMPORTANT]
> **Developer Note**
> THIS IS A BREAKING CHANGE TO THE NEW API GUMP.
> Please give us feedback in [discord ](https://muo.gg/discord) if you have issues, need help, or have ideas for a better API change!

### Summary

* Adds support for size/style to dynamic/static builder.
* Drastically simplifies the dynamic/static builder api for AddHtml.
* Cleans up some legacy gump files.
This commit is contained in:
Kamron Batman 2025-11-23 11:35:31 -08:00 • committed by GitHub
parent ea86d5b2a6
commit 7bd5a853a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
40 changed files with 398 additions and 635 deletions

View file

@ -57,7 +57,7 @@ namespace Server.Items
AddItem(150, 80, item.ItemID, item.Hue);
// item number / all items
AddHtml(20, 195, 250, 20, $"{page}/{m_Aquarium.Items.Count}".Color(0xFFFFFF));
AddHtml(20, 195, 250, 20, Html.Color($"{page}/{m_Aquarium.Items.Count}", 0xFFFFFF));
// remove item
if (edit)

View file

@ -68,7 +68,7 @@ public class HouseRaffleManagementGump : Gump
AddHtml(145, 55, 250, 20, HouseRaffleStone.FormatPrice(stone.TicketPrice).Color(LabelColor));
AddHtml(45, 75, 100, 20, "Total Entries:".Color(LabelColor));
AddHtml(145, 75, 250, 20, _stone.Entries.Count.ToString().Color(LabelColor));
AddHtml(145, 75, 250, 20, Html.Color($"{_stone.Entries.Count}", LabelColor));
AddButton(440, 33, 0xFA5, 0xFA7, 3);
AddHtml(474, 35, 120, 20, "Sort by name".Color(LabelColor));
@ -130,7 +130,7 @@ public class HouseRaffleManagementGump : Gump
{
if (entry.From.Account is Account acc)
{
AddHtml(x + 2, 140 + idx * 20, 250, 20, $"{entry.From.RawName} ({acc})".Color(color));
AddHtml(x + 2, 140 + idx * 20, 250, 20, Html.Color($"{entry.From.RawName} ({acc})", color));
}
else
{

View file

@ -647,10 +647,9 @@ public partial class HouseRaffleStone : Item
{
public override int Header => 1150470; // CONFIRM TICKET PURCHASE
public override int HeaderColor => 0x7F00;
public override int ContentColor => 0xFFFFFF;
public override string ContentColor => "#FFFFFF";
public override int Width => 420;
public override int Height => 280;
public override string Content { get; }
public ConfirmTicketPurchaseGump(Rectangle2D bounds, Point3D center, Map map, int price, Action<bool> callback) : base(callback)

View file

@ -110,7 +110,7 @@ public partial class PowerScroll : SpecialScroll
}
}
public override string DefaultTitle => $"Power Scroll ({Math.Floor(Value * 10) / 10:0.#} Skill):".Color(0xFFFFFF);
public override string DefaultTitle => Html.Color($"Power Scroll ({Math.Floor(Value * 10) / 10:0.#} Skill):", 0xFFFFFF);
public static SkillName[] Skills
{

View file

@ -25,7 +25,7 @@ public partial class ScrollofTranscendence : SpecialScroll
public override int Message => 1094933;
public override string DefaultTitle =>
$"Scroll of Transcendence ({Math.Floor(Value * 10) / 10:0.#} Skill):".Color(0xFFFFFF);
Html.Color( $"Scroll of Transcendence ({Math.Floor(Value * 10) / 10:0.#} Skill):", 0xFFFFFF);
public static ScrollofTranscendence CreateRandom(int min, int max) =>
new(SkillsInfo.RandomSkill(), Utility.RandomMinMax(min, max) / 10.0);

View file

@ -42,7 +42,7 @@ public partial class StatCapScroll : SpecialScroll
}
public override string DefaultTitle =>
$"Power Scroll ({((int)Value - 225 >= 0 ? "+" : "")}{(int)Value - 225} Maximum Stats):".Color(0xFFFFFF);
Html.Color($"Power Scroll ({((int)Value - 225 >= 0 ? "+" : "")}{(int)Value - 225} Maximum Stats):", 0xFFFFFF);
public override void AddNameProperty(IPropertyList list)
{