fix: Consolidates Color/Center html (#1762)

### Summary
- Fixes bad color in virtual check gump
- Consolidates the Color/Center html strings for all gumps
This commit is contained in:
Kamron Batman 2024-05-07 23:56:32 -07:00 • committed by GitHub
parent 05535ec9d1
commit 26dfde19ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
109 changed files with 473 additions and 752 deletions

View file

@ -4,7 +4,6 @@ using ModernUO.Serialization;
using Server.ContextMenus;
using Server.Multis;
using Server.Network;
using Server.Utilities;
namespace Server.Items
{

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, $"<BASEFONT COLOR=#FFFFFF>{page}/{m_Aquarium.Items.Count}</BASEFONT>");
AddHtml(20, 195, 250, 20, $"{page}/{m_Aquarium.Items.Count}".Color(0xFFFFFF));
// remove item
if (edit)

View file

@ -5,7 +5,6 @@ using Server.Engines.Craft;
using Server.Ethics;
using Server.Factions;
using Server.Network;
using Server.Utilities;
using AMA = Server.Items.ArmorMeditationAllowance;
using AMT = Server.Items.ArmorMaterialType;

View file

@ -5,7 +5,6 @@ using Server.Engines.Craft;
using Server.Ethics;
using Server.Factions;
using Server.Network;
using Server.Utilities;
namespace Server.Items
{

View file

@ -4,7 +4,6 @@ using ModernUO.Serialization;
using Server.ContextMenus;
using Server.Engines.Craft;
using Server.Network;
using Server.Utilities;
namespace Server.Items;

View file

@ -5,7 +5,6 @@ using Server.ContextMenus;
using Server.Engines.PartySystem;
using Server.Gumps;
using Server.Network;
using Server.Utilities;
namespace Server.Items;

View file

@ -42,7 +42,7 @@ public class NameChangeDeedGump : Gump
AddPage(0);
AddBlackAlpha(10, 120, 250, 85);
AddHtml(10, 125, 250, 20, Color(Center("Name Change Deed"), 0xFFFFFF));
AddHtml(10, 125, 250, 20, "Name Change Deed".Center(0xFFFFFF));
AddLabel(73, 15, 1152, "");
AddLabel(20, 150, 0x480, "New Name:");
@ -63,14 +63,10 @@ public class NameChangeDeedGump : Gump
AddTextEntry(x + 2, y + 2, width - 4, height - 4, 0, index, "");
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
public void AddButtonLabeled(int x, int y, int buttonID, string text)
{
AddButton(x, y - 1, 4005, 4007, buttonID);
AddHtml(x + 35, y, 240, 20, Color(text, 0xFFFFFF));
AddHtml(x + 35, y, 240, 20, text.Color(0xFFFFFF));
}
public override void OnResponse(NetState sender, in RelayInfo info)

View file

@ -7,7 +7,6 @@ using Server.Engines.Harvest;
using Server.Mobiles;
using Server.Network;
using Server.Targeting;
using Server.Utilities;
namespace Server.Items;

View file

@ -1,7 +1,6 @@
using System;
using ModernUO.Serialization;
using Server.Mobiles;
using Server.Utilities;
namespace Server.Items;

View file

@ -2,7 +2,6 @@ using System;
using ModernUO.Serialization;
using Server.Engines.ConPVP;
using Server.Engines.Craft;
using Server.Utilities;
namespace Server.Items;

View file

@ -6,7 +6,6 @@ using Server.Spells.Chivalry;
using Server.Spells.Necromancy;
using Server.Spells.Ninjitsu;
using Server.Targeting;
using Server.Utilities;
/*
* There really was no prettier way to do this, other than the one

View file

@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Server.Accounting;
using Server.Items;
using Server.Network;
@ -60,31 +59,31 @@ public class HouseRaffleManagementGump : Gump
AddBackground(0, 0, 618, 354, 9270);
AddAlphaRegion(10, 10, 598, 334);
AddHtml(10, 10, 598, 20, Color(Center("Raffle Management"), LabelColor));
AddHtml(10, 10, 598, 20, "Raffle Management".Center(LabelColor));
AddHtml(45, 35, 100, 20, Color("Location:", LabelColor));
AddHtml(145, 35, 250, 20, Color(HouseRaffleStone.FormatLocation(stone.PlotBounds, stone.GetPlotCenter(), stone.PlotFacet), LabelColor));
AddHtml(45, 35, 100, 20, "Location:".Color(LabelColor));
AddHtml(145, 35, 250, 20, HouseRaffleStone.FormatLocation(stone.PlotBounds, stone.GetPlotCenter(), stone.PlotFacet).Color(LabelColor));
AddHtml(45, 55, 100, 20, Color("Ticket Price:", LabelColor));
AddHtml(145, 55, 250, 20, Color(HouseRaffleStone.FormatPrice(stone.TicketPrice), LabelColor));
AddHtml(45, 55, 100, 20, "Ticket Price:".Color(LabelColor));
AddHtml(145, 55, 250, 20, HouseRaffleStone.FormatPrice(stone.TicketPrice).Color(LabelColor));
AddHtml(45, 75, 100, 20, Color("Total Entries:", LabelColor));
AddHtml(145, 75, 250, 20, Color(_stone.Entries.Count.ToString(), LabelColor));
AddHtml(45, 75, 100, 20, "Total Entries:".Color(LabelColor));
AddHtml(145, 75, 250, 20, _stone.Entries.Count.ToString().Color(LabelColor));
AddButton(440, 33, 0xFA5, 0xFA7, 3);
AddHtml(474, 35, 120, 20, Color("Sort by name", LabelColor));
AddHtml(474, 35, 120, 20, "Sort by name".Color(LabelColor));
AddButton(440, 53, 0xFA5, 0xFA7, 4);
AddHtml(474, 55, 120, 20, Color("Sort by account", LabelColor));
AddHtml(474, 55, 120, 20, "Sort by account".Color(LabelColor));
AddButton(440, 73, 0xFA5, 0xFA7, 5);
AddHtml(474, 75, 120, 20, Color("Sort by address", LabelColor));
AddHtml(474, 75, 120, 20, "Sort by address".Color(LabelColor));
AddImageTiled(13, 99, 592, 242, 9264);
AddImageTiled(14, 100, 590, 240, 9274);
AddAlphaRegion(14, 100, 590, 240);
AddHtml(14, 100, 590, 20, Color(Center("Entries"), LabelColor));
AddHtml(14, 100, 590, 20, "Entries".Center(LabelColor));
if (page > 0)
{
@ -104,11 +103,11 @@ public class HouseRaffleManagementGump : Gump
AddImage(584, 104, 0x25E6);
}
AddHtml(14, 120, 30, 20, Color(Center("DEL"), LabelColor));
AddHtml(47, 120, 250, 20, Color("Name", LabelColor));
AddHtml(295, 120, 100, 20, Color(Center("Address"), LabelColor));
AddHtml(395, 120, 150, 20, Color(Center("Date"), LabelColor));
AddHtml(545, 120, 60, 20, Color(Center("Num"), LabelColor));
AddHtml(14, 120, 30, 20, "DEL".Center(LabelColor));
AddHtml(47, 120, 250, 20, "Name".Color(LabelColor));
AddHtml(295, 120, 100, 20, "Address".Center(LabelColor));
AddHtml(395, 120, 150, 20, "Date".Center(LabelColor));
AddHtml(545, 120, 60, 20, "Num".Center(LabelColor));
var idx = 0;
var winner = _stone.Winner;
@ -131,11 +130,11 @@ public class HouseRaffleManagementGump : Gump
{
if (entry.From.Account is Account acc)
{
AddHtml(x + 2, 140 + idx * 20, 250, 20, Color($"{entry.From.RawName} ({acc})", color));
AddHtml(x + 2, 140 + idx * 20, 250, 20, $"{entry.From.RawName} ({acc})".Color(color));
}
else
{
AddHtml(x + 2, 140 + idx * 20, 250, 20, Color(entry.From.RawName, color));
AddHtml(x + 2, 140 + idx * 20, 250, 20, entry.From.RawName.Color(color));
}
}
@ -143,27 +142,18 @@ public class HouseRaffleManagementGump : Gump
if (entry.Address != null)
{
AddHtml(x, 140 + idx * 20, 100, 20, Color(Center(entry.Address.ToString()), color));
AddHtml(x, 140 + idx * 20, 100, 20, entry.Address.ToString().Center(color));
}
x += 100;
AddHtml(x, 140 + idx * 20, 150, 20, Color(Center(entry.Date.ToString()), color));
AddHtml(x, 140 + idx * 20, 150, 20, entry.Date.ToString().Center(color));
x += 150;
AddHtml(x, 140 + idx * 20, 60, 20, Color(Center("1"), color));
AddHtml(x, 140 + idx * 20, 60, 20, "1".Center(color));
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string Right(string text) => $"<DIV ALIGN=RIGHT>{text}</DIV>";
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string Center(string text) => $"<CENTER>{text}</CENTER>";
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
public override void OnResponse(NetState sender, in RelayInfo info)
{
var from = sender.Mobile;

View file

@ -110,7 +110,7 @@ public partial class PowerScroll : SpecialScroll
}
}
public override string DefaultTitle => $"<basefont color=#FFFFFF>Power Scroll ({Math.Floor(Value * 10) / 10:0.#} Skill):</basefont>";
public override string DefaultTitle => $"Power Scroll ({Math.Floor(Value * 10) / 10:0.#} Skill):".Color(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 =>
$"<basefont color=#FFFFFF>Scroll of Transcendence ({Math.Floor(Value * 10) / 10:0.#} Skill):</basefont>";
$"Scroll of Transcendence ({Math.Floor(Value * 10) / 10:0.#} Skill):".Color(0xFFFFFF);
public static ScrollofTranscendence CreateRandom(int min, int max) =>
new(Utility.RandomSkill(), Utility.RandomMinMax(min, max) / 10.0);

View file

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

View file

@ -7,7 +7,6 @@ using Server.Spells.Fourth;
using Server.Spells.Necromancy;
using Server.Spells.Second;
using Server.Targeting;
using Server.Utilities;
namespace Server.Items;