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

@ -19,6 +19,106 @@ namespace Server;
public static class TextDefinitionExtensions
{
public static void AddHtmlText(
this TextDefinition def,
ref DynamicGumpBuilder builder,
int x,
int y,
int width,
int height,
bool back = false,
bool scroll = false,
int numberColor = -1,
int stringColor = -1
)
{
if (def == null)
{
return;
}
if (def.Number > 0)
{
if (numberColor >= 0) // 5 bits per RGB component (15 bit RGB)
{
builder.AddHtmlLocalized(x, y, width, height, def.Number, numberColor, back, scroll);
}
else
{
builder.AddHtmlLocalized(x, y, width, height, def.Number, back, scroll);
}
}
else if (def.String != null)
{
if (stringColor >= 0) // 8 bits per RGB component (24 bit RGB)
{
builder.AddHtml(
x,
y,
width,
height,
def.String.Color(stringColor),
back,
scroll
);
}
else
{
builder.AddHtml(x, y, width, height, def.String, back, scroll);
}
}
}
public static void AddHtmlText(
this TextDefinition def,
ref StaticGumpBuilder builder,
int x,
int y,
int width,
int height,
bool back = false,
bool scroll = false,
int numberColor = -1,
int stringColor = -1
)
{
if (def == null)
{
return;
}
if (def.Number > 0)
{
if (numberColor >= 0) // 5 bits per RGB component (15 bit RGB)
{
builder.AddHtmlLocalized(x, y, width, height, def.Number, numberColor, back, scroll);
}
else
{
builder.AddHtmlLocalized(x, y, width, height, def.Number, back, scroll);
}
}
else if (def.String != null)
{
if (stringColor >= 0) // 8 bits per RGB component (24 bit RGB)
{
builder.AddHtml(
x,
y,
width,
height,
def.String.Color(stringColor),
back,
scroll
);
}
else
{
builder.AddHtml(x, y, width, height, def.String, back, scroll);
}
}
}
public static void AddHtmlText(
this TextDefinition def,
Gump g,
@ -57,7 +157,7 @@ public static class TextDefinitionExtensions
y,
width,
height,
$"<BASEFONT COLOR=#{stringColor:X6}>{def.String}</BASEFONT>",
def.String.Color(stringColor),
back,
scroll
);
@ -102,7 +202,7 @@ public static class TextDefinitionExtensions
y,
width,
height,
$"<BASEFONT COLOR=#{stringColor:X6}>{string.Format(def.String, args)}</BASEFONT>",
string.Format(def.String, args).Color(stringColor),
back,
scroll
);