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

@ -142,7 +142,7 @@ namespace Server.Gumps
if (notice != null)
{
AddHtml(12, 392, 396, 36, Color(notice, LabelColor32));
AddHtml(12, 392, 396, 36, notice.Color(LabelColor32));
}
switch (pageType)
@ -259,7 +259,7 @@ namespace Server.Gumps
}
case AdminGumpPage.Administer_WorldBuilding:
{
AddHtml(10, 125, 400, 20, Color(Center("Generating"), LabelColor32));
AddHtml(10, 125, 400, 20, "Generating".Center(LabelColor32));
AddButtonLabeled(20, 175, GetButtonID(3, 101), "Teleporters");
AddButtonLabeled(220, 175, GetButtonID(3, 102), "Moongates");
@ -285,7 +285,7 @@ namespace Server.Gumps
}
case AdminGumpPage.Administer_Server:
{
AddHtml(10, 125, 400, 20, Color(Center("Server"), LabelColor32));
AddHtml(10, 125, 400, 20, "Server".Center(LabelColor32));
AddButtonLabeled(20, 150, GetButtonID(3, 200), "Save");
@ -302,7 +302,7 @@ namespace Server.Gumps
AddLabel( 20, 215, LabelHue, "Shutdown/Restart not available." );
}*/
AddHtml(10, 295, 400, 20, Color(Center("Broadcast"), LabelColor32));
AddHtml(10, 295, 400, 20, "Broadcast".Center(LabelColor32));
AddTextField(20, 320, 380, 20, 0);
AddButtonLabeled(20, 350, GetButtonID(3, 210), "To Everyone");
@ -312,15 +312,14 @@ namespace Server.Gumps
}
case AdminGumpPage.Administer_Access_Lockdown:
{
AddHtml(10, 125, 400, 20, Color(Center("Server Lockdown"), LabelColor32));
AddHtml(10, 125, 400, 20, "Server Lockdown".Center(LabelColor32));
AddHtml(
20,
150,
380,
80,
Color(
"When enabled, only clients with an access level equal to or greater than the specified lockdown level may access the server. After setting a lockdown level, use the <em>Purge Invalid Clients</em> button to disconnect those clients without access.",
"When enabled, only clients with an access level equal to or greater than the specified lockdown level may access the server. After setting a lockdown level, use the <em>Purge Invalid Clients</em> button to disconnect those clients without access.".Color(
LabelColor32
)
);
@ -358,9 +357,9 @@ namespace Server.Gumps
}
case AdminGumpPage.Administer_Access:
{
AddHtml(10, 125, 400, 20, Color(Center("Access"), LabelColor32));
AddHtml(10, 125, 400, 20, "Access".Center(LabelColor32));
AddHtml(10, 155, 400, 20, Color(Center("Connectivity"), LabelColor32));
AddHtml(10, 155, 400, 20, "Connectivity".Center(LabelColor32));
AddButtonLabeled(20, 180, GetButtonID(3, 300), "Kick");
AddButtonLabeled(220, 180, GetButtonID(3, 301), "Ban");
@ -368,7 +367,7 @@ namespace Server.Gumps
AddButtonLabeled(20, 210, GetButtonID(3, 302), "Firewall");
AddButtonLabeled(220, 210, GetButtonID(3, 303), "Lockdown");
AddHtml(10, 245, 400, 20, Color(Center("Staff"), LabelColor32));
AddHtml(10, 245, 400, 20, "Staff".Center(LabelColor32));
AddButtonLabeled(20, 270, GetButtonID(3, 310), "Make Player");
AddButtonLabeled(20, 290, GetButtonID(3, 311), "Make Counselor");
@ -394,7 +393,7 @@ namespace Server.Gumps
}
case AdminGumpPage.Administer_Commands:
{
AddHtml(10, 125, 400, 20, Color(Center("Commands"), LabelColor32));
AddHtml(10, 125, 400, 20, "Commands".Center(LabelColor32));
AddButtonLabeled(20, 150, GetButtonID(3, 400), "Add");
AddButtonLabeled(220, 150, GetButtonID(3, 401), "Remove");
@ -532,7 +531,7 @@ namespace Server.Gumps
AddClientHeader();
AddHtml(10, 125, 400, 20, Color(Center("Information"), LabelColor32));
AddHtml(10, 125, 400, 20, "Information".Center(LabelColor32));
var y = 146;
@ -816,7 +815,7 @@ namespace Server.Gumps
break;
}
AddHtml(10, 125, 400, 20, Color(Center("Change Password"), LabelColor32));
AddHtml(10, 125, 400, 20, "Change Password".Center(LabelColor32));
AddLabel(20, 150, LabelHue, "Username:");
AddLabel(200, 150, LabelHue, a.Username);
@ -838,7 +837,7 @@ namespace Server.Gumps
break;
}
AddHtml(10, 125, 400, 20, Color(Center("Change Access Level"), LabelColor32));
AddHtml(10, 125, 400, 20, "Change Access Level".Center(LabelColor32));
AddLabel(20, 150, LabelHue, "Username:");
AddLabel(200, 150, LabelHue, a.Username);
@ -885,7 +884,7 @@ namespace Server.Gumps
}
}
AddHtml(10, 125, 400, 20, Color(Center("Information"), LabelColor32));
AddHtml(10, 125, 400, 20, "Information".Center(LabelColor32));
AddLabel(20, 150, LabelHue, "Username:");
AddLabel(200, 150, LabelHue, a.Username);
@ -960,7 +959,7 @@ namespace Server.Gumps
break;
}
AddHtml(10, 125, 400, 20, Color(Center("Access"), LabelColor32));
AddHtml(10, 125, 400, 20, "Access".Center(LabelColor32));
AddPageButton(
20,
@ -988,7 +987,7 @@ namespace Server.Gumps
m_List ??= a.LoginIPs.ToList<object>();
AddHtml(10, 195, 400, 20, Color(Center("Client Addresses"), LabelColor32));
AddHtml(10, 195, 400, 20, "Client Addresses".Center(LabelColor32));
AddButtonLabeled(227, 225, GetButtonID(5, 16), "View all shared accounts");
AddButtonLabeled(227, 245, GetButtonID(5, 17), "Ban all shared accounts");
@ -1000,13 +999,13 @@ namespace Server.Gumps
315,
180,
80,
Color("List of IP addresses which have accessed this account.", LabelColor32)
"List of IP addresses which have accessed this account.".Color(LabelColor32)
);
AddImageTiled(15, 219, 206, 156, 0xBBC);
AddBlackAlpha(16, 220, 204, 154);
AddHtml(18, 221, 114, 20, Color("IP Address", LabelColor32));
AddHtml(18, 221, 114, 20, "IP Address".Color(LabelColor32));
if (listPage > 0)
{
@ -1028,12 +1027,12 @@ namespace Server.Gumps
if (m_List.Count == 0)
{
AddHtml(18, 243, 200, 60, Color("This account has not yet been accessed.", LabelColor32));
AddHtml(18, 243, 200, 60, "This account has not yet been accessed.".Color(LabelColor32));
}
for (int i = 0, index = listPage * 6; i < 6 && index >= 0 && index < m_List.Count; ++i, ++index)
{
AddHtml(18, 243 + i * 22, 114, 20, Color(m_List[index].ToString(), LabelColor32));
AddHtml(18, 243 + i * 22, 114, 20, m_List[index].ToString().Color(LabelColor32));
AddButton(130, 242 + i * 22, 0xFA2, 0xFA4, GetButtonID(8, index));
AddButton(160, 242 + i * 22, 0xFA8, 0xFAA, GetButtonID(9, index));
AddButton(190, 242 + i * 22, 0xFB1, 0xFB3, GetButtonID(10, index));
@ -1050,7 +1049,7 @@ namespace Server.Gumps
m_List ??= a.IpRestrictions.ToList<object>();
AddHtml(10, 195, 400, 20, Color(Center("Address Restrictions"), LabelColor32));
AddHtml(10, 195, 400, 20, "Address Restrictions".Center(LabelColor32));
AddTextField(227, 225, 120, 20, 0);
@ -1061,8 +1060,7 @@ namespace Server.Gumps
255,
180,
120,
Color(
"Any clients connecting from an address not in this list will be rejected. Or, if the list is empty, any client may connect.",
"Any clients connecting from an address not in this list will be rejected. Or, if the list is empty, any client may connect.".Color(
LabelColor32
)
);
@ -1070,7 +1068,7 @@ namespace Server.Gumps
AddImageTiled(15, 219, 206, 156, 0xBBC);
AddBlackAlpha(16, 220, 204, 154);
AddHtml(18, 221, 114, 20, Color("IP Address", LabelColor32));
AddHtml(18, 221, 114, 20, "IP Address".Color(LabelColor32));
if (listPage > 0)
{
@ -1092,12 +1090,12 @@ namespace Server.Gumps
if (m_List.Count == 0)
{
AddHtml(18, 243, 200, 60, Color("There are no addresses in this list.", LabelColor32));
AddHtml(18, 243, 200, 60, "There are no addresses in this list.".Color(LabelColor32));
}
for (int i = 0, index = listPage * 6; i < 6 && index >= 0 && index < m_List.Count; ++i, ++index)
{
AddHtml(18, 243 + i * 22, 114, 20, Color((string)m_List[index], LabelColor32));
AddHtml(18, 243 + i * 22, 114, 20, ((string)m_List[index]).Color(LabelColor32));
AddButton(190, 242 + i * 22, 0xFB1, 0xFB3, GetButtonID(8, index));
}
@ -1110,7 +1108,7 @@ namespace Server.Gumps
break;
}
AddHtml(10, 125, 400, 20, Color(Center("Characters"), LabelColor32));
AddHtml(10, 125, 400, 20, "Characters".Center(LabelColor32));
AddLabelCropped(12, 150, 120, 20, LabelHue, "Name");
AddLabelCropped(132, 150, 120, 20, LabelHue, "Access Level");
@ -1160,7 +1158,7 @@ namespace Server.Gumps
break;
}
AddHtml(10, 125, 400, 20, Color(Center("Comments"), LabelColor32));
AddHtml(10, 125, 400, 20, "Comments".Center(LabelColor32));
AddButtonLabeled(20, 150, GetButtonID(5, 4), "Add Comment");
@ -1199,7 +1197,7 @@ namespace Server.Gumps
break;
}
AddHtml(10, 125, 400, 20, Color(Center("Tags"), LabelColor32));
AddHtml(10, 125, 400, 20, "Tags".Center(LabelColor32));
AddButtonLabeled(20, 150, GetButtonID(5, 5), "Add Tag");
@ -1288,11 +1286,11 @@ namespace Server.Gumps
break;
}
AddHtml(10, 125, 400, 20, Color(Center(firewallEntry.ToString()), LabelColor32));
AddHtml(10, 125, 400, 20, firewallEntry.ToString().Center(LabelColor32));
AddButtonLabeled(20, 150, GetButtonID(6, 3), "Remove");
AddHtml(10, 175, 400, 20, Color(Center("Potentially Affected Accounts"), LabelColor32));
AddHtml(10, 175, 400, 20, "Potentially Affected Accounts".Center(LabelColor32));
if (m_List == null)
{
@ -1394,19 +1392,15 @@ namespace Server.Gumps
public void AddSelectedButton(int x, int y, int buttonID, string text, bool isSelection)
{
AddButton(x, y - 1, isSelection ? 4006 : 4005, 4007, buttonID);
AddHtml(x + 35, y, 200, 20, Color(text, isSelection ? SelectedColor32 : LabelColor32));
AddHtml(x + 35, y, 200, 20, text.Color(isSelection ? SelectedColor32 : LabelColor32));
}
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, LabelColor32));
AddHtml(x + 35, y, 240, 20, text.Color(LabelColor32));
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
public void AddBlackAlpha(int x, int y, int width, int height)
{
AddImageTiled(x, y, width, height, 2624);

View file

@ -1,5 +1,4 @@
using System.Runtime.CompilerServices;
using Server.Utilities;
namespace Server.Gumps
{

View file

@ -31,57 +31,57 @@ namespace Server.Gumps
AddImageTiled(10, 32, 400, 272, 0xA40);
AddAlphaRegion(10, 32, 400, 272);
AddHtml(10, 10, 380, 20, Color(Center("User Information"), LabelColor32));
AddHtml(10, 10, 380, 20, "User Information".Center(LabelColor32));
var line = 0;
AddHtml(14, 36 + line * 20, 200, 20, Color("Address:", LabelColor32));
AddHtml(70, 36 + line++ * 20, 200, 20, Color(state.ToString(), LabelColor32));
AddHtml(14, 36 + line * 20, 200, 20, "Address:".Color(LabelColor32));
AddHtml(70, 36 + line++ * 20, 200, 20, state.ToString().Color(LabelColor32));
AddHtml(14, 36 + line * 20, 200, 20, Color("Client:", LabelColor32));
AddHtml(14, 36 + line * 20, 200, 20, "Client:".Color(LabelColor32));
AddHtml(
72,
36 + line++ * 20,
200,
20,
Color(state.Version?.ToString().DefaultIfNullOrEmpty("(null)"), LabelColor32)
(state.Version?.ToString().DefaultIfNullOrEmpty("(null)")).Color(LabelColor32)
);
AddHtml(14, 36 + line * 20, 200, 20, Color("Assistant:", LabelColor32));
AddHtml(14, 36 + line * 20, 200, 20, "Assistant:".Color(LabelColor32));
AddHtml(
72,
36 + line++ * 20,
200,
20,
Color(state.Assistant ?? "(-none-)", LabelColor32)
(state.Assistant ?? "(-none-)").Color(LabelColor32)
);
AddHtml(14, 36 + line * 20, 200, 20, Color("Version:", LabelColor32));
AddHtml(14, 36 + line * 20, 200, 20, "Version:".Color(LabelColor32));
var info = state.ExpansionInfo;
var expansionName = info.Name;
AddHtml(72, 36 + line++ * 20, 200, 20, Color(expansionName, LabelColor32));
AddHtml(72, 36 + line++ * 20, 200, 20, expansionName.Color(LabelColor32));
var a = state.Account as Account;
var m = state.Mobile;
if (from.AccessLevel >= AccessLevel.GameMaster && a != null)
{
AddHtml(14, 36 + line * 20, 200, 20, Color("Account:", LabelColor32));
AddHtml(72, 36 + line++ * 20, 200, 20, Color(a.Username, LabelColor32));
AddHtml(14, 36 + line * 20, 200, 20, "Account:".Color(LabelColor32));
AddHtml(72, 36 + line++ * 20, 200, 20, a.Username.Color(LabelColor32));
}
if (m != null)
{
AddHtml(14, 36 + line * 20, 200, 20, Color("Mobile:", LabelColor32));
AddHtml(72, 36 + line++ * 20, 200, 20, Color($"{m.Name} ({m.Serial})", LabelColor32));
AddHtml(14, 36 + line * 20, 200, 20, "Mobile:".Color(LabelColor32));
AddHtml(72, 36 + line++ * 20, 200, 20, $"{m.Name} ({m.Serial})".Color(LabelColor32));
AddHtml(14, 36 + line * 20, 200, 20, Color("Location:", LabelColor32));
AddHtml(72, 36 + line++ * 20, 200, 20, Color($"{m.Location} [{m.Map}]", LabelColor32));
AddHtml(14, 36 + line * 20, 200, 20, "Location:".Color(LabelColor32));
AddHtml(72, 36 + line++ * 20, 200, 20, $"{m.Location} [{m.Map}]".Color(LabelColor32));
AddButton(13, 197, 0xFAB, 0xFAD, 1);
AddHtml(48, 198, 200, 20, Color("Send Message", LabelColor32));
AddHtml(48, 198, 200, 20, "Send Message".Color(LabelColor32));
AddImageTiled(12, 222, 376, 80, 0xA40);
AddImageTiled(13, 223, 374, 78, 0xBBC);
@ -97,42 +97,42 @@ namespace Server.Gumps
if (BaseCommand.IsAccessible(from, m))
{
AddButton(266, 36 + line * 20, 0xFA5, 0xFA7, 4);
AddHtml(300, 38 + line++ * 20, 100, 20, Color("Properties", LabelColor32));
AddHtml(300, 38 + line++ * 20, 100, 20, "Properties".Color(LabelColor32));
}
if (from != m)
{
AddButton(266, 36 + line * 20, 0xFA5, 0xFA7, 5);
AddHtml(300, 38 + line++ * 20, 100, 20, Color("Go to them", LabelColor32));
AddHtml(300, 38 + line++ * 20, 100, 20, "Go to them".Color(LabelColor32));
AddButton(266, 36 + line * 20, 0xFA5, 0xFA7, 6);
AddHtml(300, 38 + line++ * 20, 100, 20, Color("Bring them here", LabelColor32));
AddHtml(300, 38 + line++ * 20, 100, 20, "Bring them here".Color(LabelColor32));
}
AddButton(266, 36 + line * 20, 0xFA5, 0xFA7, 7);
AddHtml(300, 38 + line++ * 20, 100, 20, Color("Move to target", LabelColor32));
AddHtml(300, 38 + line++ * 20, 100, 20, "Move to target".Color(LabelColor32));
if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > m.AccessLevel)
{
AddButton(266, 36 + line * 20, 0xFA5, 0xFA7, 8);
AddHtml(300, 38 + line++ * 20, 100, 20, Color("Disconnect", LabelColor32));
AddHtml(300, 38 + line++ * 20, 100, 20, "Disconnect".Color(LabelColor32));
if (m.Alive)
{
AddButton(266, 36 + line * 20, 0xFA5, 0xFA7, 9);
AddHtml(300, 38 + line++ * 20, 100, 20, Color("Kill", LabelColor32));
AddHtml(300, 38 + line++ * 20, 100, 20, "Kill".Color(LabelColor32));
}
else
{
AddButton(266, 36 + line * 20, 0xFA5, 0xFA7, 10);
AddHtml(300, 38 + line++ * 20, 100, 20, Color("Resurrect", LabelColor32));
AddHtml(300, 38 + line++ * 20, 100, 20, "Resurrect".Color(LabelColor32));
}
}
if (from.AccessLevel >= AccessLevel.Counselor && from.AccessLevel > m.AccessLevel)
{
AddButton(266, 36 + line * 20, 0xFA5, 0xFA7, 11);
AddHtml(300, 38 + line++ * 20, 100, 20, Color("Skills browser", LabelColor32));
AddHtml(300, 38 + line++ * 20, 100, 20, "Skills browser".Color(LabelColor32));
}
}
}
@ -323,9 +323,5 @@ namespace Server.Gumps
}
}
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
}

View file

@ -1,7 +1,6 @@
using System;
using Server.Items;
using Server.Network;
using Server.Utilities;
namespace Server.Gumps
{

View file

@ -139,7 +139,5 @@ namespace Server.Guilds
AddHtml(x, y, width, height, text.String, back, scroll);
}
}
public static string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
}

View file

@ -117,7 +117,7 @@ namespace Server.Guilds
{
var defs = new TextDefinition[aryLength];
defs[0] = g == guild ? Color(g.Name, 0x006600) : g.Name;
defs[0] = g == guild ? g.Name.Color(0x006600) : g.Name;
defs[1] = g.Abbreviation;
defs[2] = 3000085; // Peace
@ -186,7 +186,7 @@ namespace Server.Guilds
}
else if (m_LowerText?.String != null)
{
AddHtml(66, 153 + itemNumber * 28, 280, 26, Color(m_LowerText.String, 0x99));
AddHtml(66, 153 + itemNumber * 28, 280, 26, m_LowerText.String.Color(0x99));
}
if (AllowAdvancedSearch)

View file

@ -61,11 +61,11 @@ namespace Server.Guilds
if (pm == player)
{
name = Color(name, 0x006600);
name = name.Color(0x006600);
}
else if (pm.NetState != null)
{
name = Color(name, 0x000066);
name = name.Color(0x000066);
}
defs[0] = name;

View file

@ -85,13 +85,13 @@ namespace Server.Guilds
}
else if (PendingWar)
{
kills = Color($"{war.Kills}/{war.MaxKills}", 0x990000);
time = Color($"{war.WarLength.Hours:D2}:{DateTime.MinValue + war.WarLength:mm}", 0x990000);
kills = $"{war.Kills}/{war.MaxKills}".Color(0x990000);
time = $"{war.WarLength.Hours:D2}:{DateTime.MinValue + war.WarLength:mm}".Color(0x990000);
otherWar = m_Other.FindPendingWar(guild);
if (otherWar != null)
{
otherKills = Color($"{otherWar.Kills}/{otherWar.MaxKills}", 0x990000);
otherKills = $"{otherWar.Kills}/{otherWar.MaxKills}".Color(0x990000);
}
}
@ -159,7 +159,7 @@ namespace Server.Guilds
// Withdraw Request
AddButtonAndBackground(20, 290, 14, 1062986); // Withdraw Request
AddHtml(150, 83, 360, 26, Color(alliance.Name, 0x99));
AddHtml(150, 83, 360, 26, alliance.Name.Color(0x99));
}
else if (alliance.Leader == m_Other && alliance.IsPendingMember(guild))
{
@ -172,7 +172,7 @@ namespace Server.Guilds
AddButtonAndBackground(20, 260, 15, 1062988); // Deny Request
AddButtonAndBackground(20, 290, 16, 1062987); // Accept Request
AddHtml(150, 83, 360, 26, Color(alliance.Name, 0x99));
AddHtml(150, 83, 360, 26, alliance.Name.Color(0x99));
}
}
else

View file

@ -4,7 +4,6 @@ using Server.HuePickers;
using Server.Items;
using Server.Mobiles;
using Server.Network;
using Server.Utilities;
namespace Server.Gumps
{

View file

@ -168,7 +168,7 @@ namespace Server.Gumps
y,
emptyWidth,
EntryHeight,
$"<BASEFONT COLOR=#FAFAFA><CENTER>{m_Type.Name}</CENTER></BASEFONT>"
m_Type.Name.Center(0xFAFAFA)
);
}

View file

@ -88,7 +88,7 @@ public abstract class StaticWarningGump<T> : StaticGump<T> where T : StaticWarni
protected sealed override void BuildStrings(ref GumpStringsBuilder builder)
{
builder.SetStringSlot("content", $"<BASEFONT COLOR=#{ContentColor:X6}>{Content}</BASEFONT>");
builder.SetStringSlot("content", Content.Color(ContentColor));
}
public override void OnResponse(NetState sender, in RelayInfo info) => _callback?.Invoke(info.ButtonID == 1);

View file

@ -33,11 +33,11 @@ namespace Server.Gumps
{
m_Selection = null;
AddHtml(35, 15, 120, 20, Color("House Type", White));
AddHtml(35, 15, 120, 20, "House Type".Color(White));
if (list.Count == 0)
{
AddHtml(35, 40, 160, 40, Color("There were no houses found for that player.", White));
AddHtml(35, 40, 160, 40, "There were no houses found for that player.".Color(White));
}
AddImage(190, 17, 0x25EA);
@ -64,7 +64,7 @@ namespace Server.Gumps
var name = FindHouseName(list[i]);
AddHtml(15, 40 + i % 15 * 20, 20, 20, Color($"{i + 1}.", White));
AddHtml(15, 40 + i % 15 * 20, 20, 20, $"{i + 1}.".Color(White));
if (name.Number > 0)
{
@ -72,7 +72,7 @@ namespace Server.Gumps
}
else
{
AddHtml(35, 40 + i % 15 * 20, 160, 20, Color(name, White));
AddHtml(35, 40 + i % 15 * 20, 160, 20, Html.Color(name, White));
}
AddButton(198, 39 + i % 15 * 20, 4005, 4007, i + 1);
@ -109,49 +109,49 @@ namespace Server.Gumps
location = "unknown";
}
AddHtml(10, 15, 220, 20, Color(Center("House Properties"), White));
AddHtml(10, 15, 220, 20, "House Properties".Center(White));
AddHtml(15, 40, 210, 20, Color("Facet:", White));
AddHtml(15, 40, 210, 20, Color(Right(map == null ? "(null)" : map.Name), White));
AddHtml(15, 40, 210, 20, "Facet:".Color(White));
AddHtml(15, 40, 210, 20, (map == null ? "(null)" : map.Name).Right(White));
AddHtml(15, 60, 210, 20, Color("Location:", White));
AddHtml(15, 60, 210, 20, Color(Right(sel.Location.ToString()), White));
AddHtml(15, 60, 210, 20, "Location:".Color(White));
AddHtml(15, 60, 210, 20, sel.Location.ToString().Right(White));
AddHtml(15, 80, 210, 20, Color("Sextant:", White));
AddHtml(15, 80, 210, 20, Color(Right(location), White));
AddHtml(15, 80, 210, 20, "Sextant:".Color(White));
AddHtml(15, 80, 210, 20, location.Right(White));
AddHtml(15, 100, 210, 20, Color("Owner:", White));
AddHtml(15, 100, 210, 20, Color(Right(owner), White));
AddHtml(15, 100, 210, 20, "Owner:".Color(White));
AddHtml(15, 100, 210, 20, owner.Right(White));
AddHtml(15, 120, 210, 20, Color("Name:", White));
AddHtml(15, 120, 210, 20, Color(Right(houseName), White));
AddHtml(15, 120, 210, 20, "Name:".Color(White));
AddHtml(15, 120, 210, 20, houseName.Right(White));
AddHtml(15, 140, 210, 20, Color("Friends:", White));
AddHtml(15, 140, 210, 20, Color(Right(sel.Friends.Count.ToString()), White));
AddHtml(15, 140, 210, 20, "Friends:".Color(White));
AddHtml(15, 140, 210, 20, sel.Friends.Count.ToString().Right(White));
AddHtml(15, 160, 210, 20, Color("Co-Owners:", White));
AddHtml(15, 160, 210, 20, Color(Right(sel.CoOwners.Count.ToString()), White));
AddHtml(15, 160, 210, 20, "Co-Owners:".Color(White));
AddHtml(15, 160, 210, 20, sel.CoOwners.Count.ToString().Right(White));
AddHtml(15, 180, 210, 20, Color("Bans:", White));
AddHtml(15, 180, 210, 20, Color(Right(sel.Bans.Count.ToString()), White));
AddHtml(15, 180, 210, 20, "Bans:".Color(White));
AddHtml(15, 180, 210, 20, sel.Bans.Count.ToString().Right(White));
AddHtml(15, 200, 210, 20, Color("Decays:", White));
AddHtml(15, 200, 210, 20, Color(Right(sel.CanDecay ? "Yes" : "No"), White));
AddHtml(15, 200, 210, 20, "Decays:".Color(White));
AddHtml(15, 200, 210, 20, (sel.CanDecay ? "Yes" : "No").Right(White));
AddHtml(15, 220, 210, 20, Color("Decay Level:", White));
AddHtml(15, 220, 210, 20, Color(Right(sel.DecayLevel.ToString()), White));
AddHtml(15, 220, 210, 20, "Decay Level:".Color(White));
AddHtml(15, 220, 210, 20, sel.DecayLevel.ToString().Right(White));
AddButton(15, 245, 4005, 4007, 1);
AddHtml(50, 245, 120, 20, Color("Go to house", White));
AddHtml(50, 245, 120, 20, "Go to house".Color(White));
AddButton(15, 265, 4005, 4007, 2);
AddHtml(50, 265, 120, 20, Color("Open house menu", White));
AddHtml(50, 265, 120, 20, "Open house menu".Color(White));
AddButton(15, 285, 4005, 4007, 3);
AddHtml(50, 285, 120, 20, Color("Demolish house", White));
AddHtml(50, 285, 120, 20, "Demolish house".Color(White));
AddButton(15, 305, 4005, 4007, 4);
AddHtml(50, 305, 120, 20, Color("Refresh house", White));
AddHtml(50, 305, 120, 20, "Refresh house".Color(White));
}
}
@ -302,12 +302,6 @@ namespace Server.Gumps
return house.GetType().Name;
}
public string Right(string text) => $"<div align=right>{text}</div>";
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
public void AddBlackAlpha(int x, int y, int width, int height)
{
AddImageTiled(x, y, width, height, 2624);

View file

@ -60,25 +60,16 @@ public class WarningGump : DynamicGump
builder.AddImageTiled(10, 40, _width - 20, _height - 80, 2624);
builder.AddAlphaRegion(10, 40, _width - 20, _height - 80);
if (_content != null)
{
if (_content.Number > 0)
{
builder.AddHtmlLocalized(10, 40, _width - 20, _height - 80, _content.Number, (short)_contentColor, false, true);
}
else
{
builder.AddHtml(
10,
40,
_width - 20,
_height - 80,
$"<BASEFONT COLOR=#{_contentColor:X6}>{_content.String}</BASEFONT>",
false,
true
);
}
}
_content.AddHtmlText(
ref builder,
10,
40,
_width - 20,
_height - 80,
scroll: true,
numberColor: _contentColor,
stringColor: _contentColor
);
builder.AddImageTiled(10, _height - 30, _width - 20, 20, 2624);
builder.AddAlphaRegion(10, _height - 30, _width - 20, 20);