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

@ -126,10 +126,7 @@ namespace Server.Engines.ConPVP
height - 12 - 2 - 18,
400,
20,
Color(
string.Format("Top {3} of {0:N0} duelists, page {1} of {2}", m_List.Count, page + 1, (lc + 14) / 15, lc),
0xFFC000
)
$"Top {lc} of {m_List.Count:N0} duelists, page {page + 1} of {(lc + 14) / 15}".Color(0xFFC000)
);
AddColumnHeader(75, "Rank");
@ -146,7 +143,7 @@ namespace Server.Engines.ConPVP
var y = 32 + (i - start) * 20;
var x = 12;
AddBorderedText(x, y, 75, Center(Rank(i + 1)), 0xFFFFFF, 0);
AddBorderedText(x, y, 75, Rank(i + 1).Center(), 0xFFFFFF, 0);
x += 75;
/*AddImage( 20, y + 5, 0x2616, 0x96C );
@ -178,14 +175,14 @@ namespace Server.Engines.ConPVP
// AddImageTiled( 21, y + 6, width, 8, 0x2617 );
AddImageTiled(x + 3, y + 4, width, 11, 0x806);
AddBorderedText(x, y, 115, Center(level.ToString()), 0xFFFFFF, 0);
AddBorderedText(x, y, 115, level.ToString().Center(), 0xFFFFFF, 0);
x += 115;
var mob = entry.Mobile;
if (mob.Guild != null)
{
AddBorderedText(x, y, 50, Center(mob.Guild.Abbreviation), 0xFFFFFF, 0);
AddBorderedText(x, y, 50, mob.Guild.Abbreviation.Center(), 0xFFFFFF, 0);
}
x += 50;
@ -193,10 +190,10 @@ namespace Server.Engines.ConPVP
AddBorderedText(x + 5, y, 115 - 5, mob.Name, 0xFFFFFF, 0);
x += 115;
AddBorderedText(x, y, 60, Center(entry.Wins.ToString()), 0xFFFFFF, 0);
AddBorderedText(x, y, 60, entry.Wins.ToString().Center(), 0xFFFFFF, 0);
x += 60;
AddBorderedText(x, y, 60, Center(entry.Losses.ToString()), 0xFFFFFF, 0);
AddBorderedText(x, y, 60, entry.Losses.ToString().Center(), 0xFFFFFF, 0);
x += 60;
// AddBorderedText( 292 + 15, y, 115 - 30, String.Format( "{0} <DIV ALIGN=CENTER>/</DIV> <DIV ALIGN=RIGHT>{1}</DIV>", entry.Wins, entry.Losses ), 0xFFC000, 0 );
@ -235,10 +232,6 @@ namespace Server.Engines.ConPVP
}
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
private void AddBorderedText(int x, int y, int width, string text, int color, int borderColor)
{
/*AddColoredText( x - 1, y, width, text, borderColor );
@ -252,21 +245,14 @@ namespace Server.Engines.ConPVP
private void AddColoredText(int x, int y, int width, string text, int color)
{
if (color == 0)
{
AddHtml(x, y, width, 20, text);
}
else
{
AddHtml(x, y, width, 20, Color(text, color));
}
AddHtml(x, y, width, 20, color == 0 ? text : text.Color(color));
}
private void AddColumnHeader(int width, string name)
{
AddBackground(m_ColumnX, 12, width, 20, 0x242C);
AddImageTiled(m_ColumnX + 2, 14, width - 4, 16, 0x2430);
AddBorderedText(m_ColumnX, 13, width, Center(name), 0xFFFFFF, 0);
AddBorderedText(m_ColumnX, 13, width, name.Center(), 0xFFFFFF, 0);
m_ColumnX += width;
}