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

@ -49,62 +49,60 @@ namespace Server.Engines.ConPVP
AddImage(215, -43, 0xEE40);
// AddImage( 330, 141, 0x8BA );
AddHtml(22 - 1, 22, 294, 20, Color(Center("Duel Challenge"), BlackColor32));
AddHtml(22 + 1, 22, 294, 20, Color(Center("Duel Challenge"), BlackColor32));
AddHtml(22, 22 - 1, 294, 20, Color(Center("Duel Challenge"), BlackColor32));
AddHtml(22, 22 + 1, 294, 20, Color(Center("Duel Challenge"), BlackColor32));
AddHtml(22, 22, 294, 20, Color(Center("Duel Challenge"), LabelColor32));
var duelChallengeBlack = "Duel Challenge".Center(BlackColor32);
AddHtml(22 - 1, 22, 294, 20, duelChallengeBlack);
AddHtml(22 + 1, 22, 294, 20, duelChallengeBlack);
AddHtml(22, 22 - 1, 294, 20, duelChallengeBlack);
AddHtml(22, 22 + 1, 294, 20, duelChallengeBlack);
AddHtml(22, 22, 294, 20, "Duel Challenge".Center(LabelColor32));
string fmt;
var accept = p.Contains(challenger)
? $"You have been asked to join sides with {challenger.Name} in a duel. Do you accept?"
: $"You have been challenged to a duel from {challenger.Name}. Do you accept?";
if (p.Contains(challenger))
{
fmt = "You have been asked to join sides with {0} in a duel. Do you accept?";
}
else
{
fmt = "You have been challenged to a duel from {0}. Do you accept?";
}
var acceptBlack = accept.Color(BlackColor32);
AddHtml(22 - 1, 50, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32));
AddHtml(22 + 1, 50, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32));
AddHtml(22, 50 - 1, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32));
AddHtml(22, 50 + 1, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32));
AddHtml(22, 50, 294, 40, Color(string.Format(fmt, challenger.Name), 0xB0C868));
AddHtml(22 - 1, 50, 294, 40, acceptBlack);
AddHtml(22 + 1, 50, 294, 40, acceptBlack);
AddHtml(22, 50 - 1, 294, 40, acceptBlack);
AddHtml(22, 50 + 1, 294, 40, acceptBlack);
AddHtml(22, 50, 294, 40, accept.Color(0xB0C868));
AddImageTiled(32, 88, 264, 1, 9107);
AddImageTiled(42, 90, 264, 1, 9157);
var yesBlack = "Yes, I will fight this duel.".Color(BlackColor32);
AddRadio(24, 100, 9727, 9730, true, 1);
AddHtml(60 - 1, 105, 250, 20, Color("Yes, I will fight this duel.", BlackColor32));
AddHtml(60 + 1, 105, 250, 20, Color("Yes, I will fight this duel.", BlackColor32));
AddHtml(60, 105 - 1, 250, 20, Color("Yes, I will fight this duel.", BlackColor32));
AddHtml(60, 105 + 1, 250, 20, Color("Yes, I will fight this duel.", BlackColor32));
AddHtml(60, 105, 250, 20, Color("Yes, I will fight this duel.", LabelColor32));
AddHtml(60 - 1, 105, 250, 20, yesBlack);
AddHtml(60 + 1, 105, 250, 20, yesBlack);
AddHtml(60, 105 - 1, 250, 20, yesBlack);
AddHtml(60, 105 + 1, 250, 20, yesBlack);
AddHtml(60, 105, 250, 20, "Yes, I will fight this duel.".Color(LabelColor32));
var noBlack = "No, I do not wish to fight.".Color(BlackColor32);
AddRadio(24, 135, 9727, 9730, false, 2);
AddHtml(60 - 1, 140, 250, 20, Color("No, I do not wish to fight.", BlackColor32));
AddHtml(60 + 1, 140, 250, 20, Color("No, I do not wish to fight.", BlackColor32));
AddHtml(60, 140 - 1, 250, 20, Color("No, I do not wish to fight.", BlackColor32));
AddHtml(60, 140 + 1, 250, 20, Color("No, I do not wish to fight.", BlackColor32));
AddHtml(60, 140, 250, 20, Color("No, I do not wish to fight.", LabelColor32));
AddHtml(60 - 1, 140, 250, 20, noBlack);
AddHtml(60 + 1, 140, 250, 20, noBlack);
AddHtml(60, 140 - 1, 250, 20, noBlack);
AddHtml(60, 140 + 1, 250, 20, noBlack);
AddHtml(60, 140, 250, 20, "No, I do not wish to fight.".Color(LabelColor32));
var noAskBlack = "No, knave. Do not ask again.".Color(BlackColor32);
AddRadio(24, 170, 9727, 9730, false, 3);
AddHtml(60 - 1, 175, 250, 20, Color("No, knave. Do not ask again.", BlackColor32));
AddHtml(60 + 1, 175, 250, 20, Color("No, knave. Do not ask again.", BlackColor32));
AddHtml(60, 175 - 1, 250, 20, Color("No, knave. Do not ask again.", BlackColor32));
AddHtml(60, 175 + 1, 250, 20, Color("No, knave. Do not ask again.", BlackColor32));
AddHtml(60, 175, 250, 20, Color("No, knave. Do not ask again.", LabelColor32));
AddHtml(60 - 1, 175, 250, 20, noAskBlack);
AddHtml(60 + 1, 175, 250, 20, noAskBlack);
AddHtml(60, 175 - 1, 250, 20, noAskBlack);
AddHtml(60, 175 + 1, 250, 20, noAskBlack);
AddHtml(60, 175, 250, 20, "No, knave. Do not ask again.".Color(LabelColor32));
AddButton(314, 173, 247, 248, 1);
Timer.StartTimer(TimeSpan.FromSeconds(15.0), AutoReject);
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
public void AutoReject()
{
if (!m_Active)

View file

@ -1147,7 +1147,7 @@ namespace Server.Engines.ConPVP
AddImage(215, -45, 0xEE40);
// AddImage( 330, 141, 0x8BA );
AddBorderedText(22, 22, 294, 20, Center("BR Scoreboard"), LabelColor32, BlackColor32);
AddBorderedText(22, 22, 294, 20, "BR Scoreboard".Center(), LabelColor32, BlackColor32);
AddImageTiled(32, 50, 264, 1, 9107);
AddImageTiled(42, 52, 264, 1, 9157);
@ -1165,40 +1165,18 @@ namespace Server.Engines.ConPVP
AddImage(24, 60 + i * 75, teamInfo == ourTeam ? 9730 : 9727, teamInfo.Color - 1);
var nameColor = LabelColor32;
var borderColor = BlackColor32;
switch (teamInfo.Color)
var borderColor = teamInfo.Color == 0x455 ? LabelColor32 : BlackColor32;
var nameColor = teamInfo.Color switch
{
case 0x47E:
nameColor = 0xFFFFFF;
break;
case 0x4F2:
nameColor = 0x3399FF;
break;
case 0x4F7:
nameColor = 0x33FF33;
break;
case 0x4FC:
nameColor = 0xFF00FF;
break;
case 0x021:
nameColor = 0xFF3333;
break;
case 0x01A:
nameColor = 0xFF66FF;
break;
case 0x455:
nameColor = 0x333333;
borderColor = 0xFFFFFF;
break;
}
0x47E => 0xFFFFFF,
0x4F2 => 0x3399FF,
0x4F7 => 0x33FF33,
0x4FC => 0xFF00FF,
0x021 => 0xFF3333,
0x01A => 0xFF66FF,
0x455 => 0x333333,
_ => LabelColor32
};
AddBorderedText(
60,
@ -1241,10 +1219,6 @@ namespace Server.Engines.ConPVP
AddButton(314, height - 42, 247, 248, 1);
}
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, int height, string text, int color, int borderColor)
{
AddColoredText(x - 1, y - 1, width, height, text, borderColor);
@ -1256,14 +1230,7 @@ namespace Server.Engines.ConPVP
private void AddColoredText(int x, int y, int width, int height, string text, int color)
{
if (color == 0)
{
AddHtml(x, y, width, height, text);
}
else
{
AddHtml(x, y, width, height, Color(text, color));
}
AddHtml(x, y, width, height, color == 0 ? text : text.Color(color));
}
}

View file

@ -117,7 +117,7 @@ namespace Server.Engines.ConPVP
AddImage(215, -45, 0xEE40);
// AddImage( 330, 141, 0x8BA );
AddBorderedText(22, 22, 294, 20, Center("CTF Scoreboard"), LabelColor32, BlackColor32);
AddBorderedText(22, 22, 294, 20, "CTF Scoreboard".Center(), LabelColor32, BlackColor32);
AddImageTiled(32, 50, 264, 1, 9107);
AddImageTiled(42, 52, 264, 1, 9157);
@ -140,40 +140,18 @@ namespace Server.Engines.ConPVP
AddImage(24, 60 + i * 75, teamInfo == ourTeam ? 9730 : 9727, teamInfo.Color - 1);
var nameColor = LabelColor32;
var borderColor = BlackColor32;
switch (teamInfo.Color)
var borderColor = teamInfo.Color == 0x455 ? LabelColor32 : BlackColor32;
var nameColor = teamInfo.Color switch
{
case 0x47E:
nameColor = 0xFFFFFF;
break;
case 0x4F2:
nameColor = 0x3399FF;
break;
case 0x4F7:
nameColor = 0x33FF33;
break;
case 0x4FC:
nameColor = 0xFF00FF;
break;
case 0x021:
nameColor = 0xFF3333;
break;
case 0x01A:
nameColor = 0xFF66FF;
break;
case 0x455:
nameColor = 0x333333;
borderColor = 0xFFFFFF;
break;
}
0x47E => 0xFFFFFF,
0x4F2 => 0x3399FF,
0x4F7 => 0x33FF33,
0x4FC => 0xFF00FF,
0x021 => 0xFF3333,
0x01A => 0xFF66FF,
0x455 => 0x333333,
_ => LabelColor32
};
AddBorderedText(
60,
@ -216,10 +194,6 @@ namespace Server.Engines.ConPVP
AddButton(314, height - 42, 247, 248, 1);
}
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, int height, string text, int color, int borderColor)
{
AddColoredText(x - 1, y - 1, width, height, text, borderColor);
@ -231,14 +205,7 @@ namespace Server.Engines.ConPVP
private void AddColoredText(int x, int y, int width, int height, string text, int color)
{
if (color == 0)
{
AddHtml(x, y, width, height, text);
}
else
{
AddHtml(x, y, width, height, Color(text, color));
}
AddHtml(x, y, width, height, color == 0 ? text : text.Color(color));
}
}

View file

@ -113,7 +113,7 @@ namespace Server.Engines.ConPVP
AddImage(215, -45, 0xEE40);
// AddImage( 330, 141, 0x8BA );
AddBorderedText(22, 22, 294, 20, Center("DD Scoreboard"), LabelColor32, BlackColor32);
AddBorderedText(22, 22, 294, 20, "DD Scoreboard".Center(), LabelColor32, BlackColor32);
AddImageTiled(32, 50, 264, 1, 9107);
AddImageTiled(42, 52, 264, 1, 9157);
@ -134,40 +134,18 @@ namespace Server.Engines.ConPVP
AddImage(24, 60 + i * 75, teamInfo == ourTeam ? 9730 : 9727, teamInfo.Color - 1);
var nameColor = LabelColor32;
var borderColor = BlackColor32;
switch (teamInfo.Color)
var borderColor = teamInfo.Color == 0x455 ? LabelColor32 : BlackColor32;
var nameColor = teamInfo.Color switch
{
case 0x47E:
nameColor = 0xFFFFFF;
break;
case 0x4F2:
nameColor = 0x3399FF;
break;
case 0x4F7:
nameColor = 0x33FF33;
break;
case 0x4FC:
nameColor = 0xFF00FF;
break;
case 0x021:
nameColor = 0xFF3333;
break;
case 0x01A:
nameColor = 0xFF66FF;
break;
case 0x455:
nameColor = 0x333333;
borderColor = 0xFFFFFF;
break;
}
0x47E => 0xFFFFFF,
0x4F2 => 0x3399FF,
0x4F7 => 0x33FF33,
0x4FC => 0xFF00FF,
0x021 => 0xFF3333,
0x01A => 0xFF66FF,
0x455 => 0x333333,
_ => LabelColor32
};
AddBorderedText(
60,
@ -210,10 +188,6 @@ namespace Server.Engines.ConPVP
AddButton(314, height - 42, 247, 248, 1);
}
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, int height, string text, int color, int borderColor)
{
AddColoredText(x - 1, y - 1, width, height, text, borderColor);
@ -225,14 +199,7 @@ namespace Server.Engines.ConPVP
private void AddColoredText(int x, int y, int width, int height, string text, int color)
{
if (color == 0)
{
AddHtml(x, y, width, height, text);
}
else
{
AddHtml(x, y, width, height, Color(text, color));
}
AddHtml(x, y, width, height, color == 0 ? text : text.Color(color));
}
}

View file

@ -399,7 +399,7 @@ namespace Server.Engines.ConPVP
AddImage(215, -45, 0xEE40);
// AddImage( 330, 141, 0x8BA );
AddBorderedText(22, 22, 294, 20, Center("King of the Hill Scoreboard"), LabelColor32, BlackColor32);
AddBorderedText(22, 22, 294, 20, "King of the Hill Scoreboard".Center(), LabelColor32, BlackColor32);
AddImageTiled(32, 50, 264, 1, 9107);
AddImageTiled(42, 52, 264, 1, 9157);
@ -415,40 +415,18 @@ namespace Server.Engines.ConPVP
AddImage(24, 60 + i * 75, teamInfo == ourTeam ? 9730 : 9727, teamInfo.Color - 1);
var nameColor = LabelColor32;
var borderColor = BlackColor32;
switch (teamInfo.Color)
var borderColor = teamInfo.Color == 0x455 ? LabelColor32 : BlackColor32;
var nameColor = teamInfo.Color switch
{
case 0x47E:
nameColor = 0xFFFFFF;
break;
case 0x4F2:
nameColor = 0x3399FF;
break;
case 0x4F7:
nameColor = 0x33FF33;
break;
case 0x4FC:
nameColor = 0xFF00FF;
break;
case 0x021:
nameColor = 0xFF3333;
break;
case 0x01A:
nameColor = 0xFF66FF;
break;
case 0x455:
nameColor = 0x333333;
borderColor = 0xFFFFFF;
break;
}
0x47E => 0xFFFFFF,
0x4F2 => 0x3399FF,
0x4F7 => 0x33FF33,
0x4FC => 0xFF00FF,
0x021 => 0xFF3333,
0x01A => 0xFF66FF,
0x455 => 0x333333,
_ => LabelColor32
};
AddBorderedText(
60,
@ -478,10 +456,6 @@ namespace Server.Engines.ConPVP
AddButton(314, height - 42, 247, 248, 1);
}
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, int height, string text, int color, int borderColor)
{
AddColoredText(x - 1, y - 1, width, height, text, borderColor);
@ -493,14 +467,7 @@ namespace Server.Engines.ConPVP
private void AddColoredText(int x, int y, int width, int height, string text, int color)
{
if (color == 0)
{
AddHtml(x, y, width, height, text);
}
else
{
AddHtml(x, y, width, height, Color(text, color));
}
AddHtml(x, y, width, height, color == 0 ? text : text.Color(color));
}
}

View file

@ -122,7 +122,7 @@ namespace Server.Engines.ConPVP
sb.Append(" Tournament Invitation");
AddBorderedText(22, 22, 294, 20, Center(sb.ToString()), LabelColor32, BlackColor32);
AddBorderedText(22, 22, 294, 20, sb.ToString().Center(), LabelColor32, BlackColor32);
AddBorderedText(
22,
@ -244,10 +244,6 @@ namespace Server.Engines.ConPVP
Timer.StartTimer(TimeSpan.FromSeconds(15.0), AutoReject);
}
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, int height, string text, int color, int borderColor)
{
AddColoredText(x - 1, y - 1, width, height, text, borderColor);
@ -259,14 +255,7 @@ namespace Server.Engines.ConPVP
private void AddColoredText(int x, int y, int width, int height, string text, int color)
{
if (color == 0)
{
AddHtml(x, y, width, height, text);
}
else
{
AddHtml(x, y, width, height, Color(text, color));
}
AddHtml(x, y, width, height, color == 0 ? text : text.Color(color));
}
public void AutoReject()

View file

@ -188,7 +188,7 @@ namespace Server.Engines.ConPVP
AddBorderedText(x + 5, y + 5, 325 - 5, sb.ToString(), color, 0);
x += 325;
AddBorderedText(x, y + 5, 40, Center(ar.Spectators.ToString()), color, 0);
AddBorderedText(x, y + 5, 40, ar.Spectators.ToString().Center(), color, 0);
}
}
@ -263,10 +263,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 );
@ -280,14 +276,7 @@ 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)
@ -297,7 +286,7 @@ namespace Server.Engines.ConPVP
if (name != null)
{
AddBorderedText(m_ColumnX, 13, width, Center(name), 0xFFFFFF, 0);
AddBorderedText(m_ColumnX, 13, width, name.Center(), 0xFFFFFF, 0);
}
m_ColumnX += width;

View file

@ -20,77 +20,31 @@ namespace Server.Engines.ConPVP
AddImage(215, -43, 0xEE40);
AddHtml(22 - 1, 22, 294, 20, Color(Center("Duel Countdown"), BlackColor32));
AddHtml(22 + 1, 22, 294, 20, Color(Center("Duel Countdown"), BlackColor32));
AddHtml(22, 22 - 1, 294, 20, Color(Center("Duel Countdown"), BlackColor32));
AddHtml(22, 22 + 1, 294, 20, Color(Center("Duel Countdown"), BlackColor32));
AddHtml(22, 22, 294, 20, Color(Center("Duel Countdown"), LabelColor32));
var duelCountdownBlack = "Duel Countdown".Center(BlackColor32);
AddHtml(22 - 1, 22, 294, 20, duelCountdownBlack);
AddHtml(22 + 1, 22, 294, 20, duelCountdownBlack);
AddHtml(22, 22 - 1, 294, 20, duelCountdownBlack);
AddHtml(22, 22 + 1, 294, 20, duelCountdownBlack);
AddHtml(22, 22, 294, 20, "Duel Countdown".Center(LabelColor32));
AddHtml(
22 - 1,
50,
294,
80,
Color(
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
BlackColor32
)
);
AddHtml(
22 + 1,
50,
294,
80,
Color(
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
BlackColor32
)
);
AddHtml(
22,
50 - 1,
294,
80,
Color(
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
BlackColor32
)
);
AddHtml(
22,
50 + 1,
294,
80,
Color(
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
BlackColor32
)
);
AddHtml(
22,
50,
294,
80,
Color(
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
0xFFCC66
)
);
var beginMessageBlack =
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends."
.Color(BlackColor32);
/*AddImageTiled( 32, 128, 264, 1, 9107 );
AddImageTiled( 42, 130, 264, 1, 9157 );
AddHtml( 60-1, 140, 250, 20, Color( String.Format( "Duel will begin in <BASEFONT COLOR=#{2:X6}>{0} <BASEFONT COLOR=#{2:X6}>second{1}.", count, count==1?"":"s", BlackColor32 ), BlackColor32 ), false, false );
AddHtml( 60+1, 140, 250, 20, Color( String.Format( "Duel will begin in <BASEFONT COLOR=#{2:X6}>{0} <BASEFONT COLOR=#{2:X6}>second{1}.", count, count==1?"":"s", BlackColor32 ), BlackColor32 ), false, false );
AddHtml( 60, 140-1, 250, 20, Color( String.Format( "Duel will begin in <BASEFONT COLOR=#{2:X6}>{0} <BASEFONT COLOR=#{2:X6}>second{1}.", count, count==1?"":"s", BlackColor32 ), BlackColor32 ), false, false );
AddHtml( 60, 140+1, 250, 20, Color( String.Format( "Duel will begin in <BASEFONT COLOR=#{2:X6}>{0} <BASEFONT COLOR=#{2:X6}>second{1}.", count, count==1?"":"s", BlackColor32 ), BlackColor32 ), false, false );
AddHtml( 60, 140, 250, 20, Color( String.Format( "Duel will begin in <BASEFONT COLOR=#FF6666>{0} <BASEFONT COLOR=#{2:X6}>second{1}.", count, count==1?"":"s", 0x66AACC ), 0x66AACC ), false, false );*/
AddHtml(22 - 1, 50, 294, 80, beginMessageBlack);
AddHtml(22 + 1, 50, 294, 80, beginMessageBlack);
AddHtml(22, 50 - 1, 294, 80, beginMessageBlack);
AddHtml(22, 50 + 1, 294, 80, beginMessageBlack);
AddHtml(
22,
50,
294,
80,
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends."
.Color(0xFFCC66)
);
AddButton(314 - 50, 157 - offset, 247, 248, 1);
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
}

View file

@ -129,7 +129,7 @@ namespace Server.Engines.ConPVP
sb.Append(" Tournament Signup");
AddBorderedText(22, 22, 294, 20, Center(sb.ToString()), LabelColor32, BlackColor32);
AddBorderedText(22, 22, 294, 20, sb.ToString().Center(), LabelColor32, BlackColor32);
AddBorderedText(
22,
50,
@ -283,10 +283,6 @@ namespace Server.Engines.ConPVP
AddButton(314, y, 247, 248, 1);
}
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, int height, string text, int color, int borderColor)
{
AddColoredText(x - 1, y - 1, width, height, text, borderColor);
@ -298,14 +294,7 @@ namespace Server.Engines.ConPVP
private void AddColoredText(int x, int y, int width, int height, string text, int color)
{
if (color == 0)
{
AddHtml(x, y, width, height, text);
}
else
{
AddHtml(x, y, width, height, Color(text, color));
}
AddHtml(x, y, width, height, color == 0 ? text : text.Color(color));
}
public void AddGoldenButton(int x, int y, int bid)

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;
}

View file

@ -91,7 +91,7 @@ namespace Server.Engines.ConPVP
sb.Append(" Tournament Bracket");
AddHtml(25, 35, 250, 20, Center(sb.ToString()));
AddHtml(25, 35, 250, 20, sb.ToString().Center());
AddRightArrow(25, 53, ToButtonID(0, 4), "Rules");
AddRightArrow(25, 71, ToButtonID(0, 1), "Participants");
@ -181,7 +181,7 @@ namespace Server.Engines.ConPVP
);
AddLeftArrow(25, 11, ToButtonID(0, 0));
AddHtml(25, 35, 250, 20, Center("Rules"));
AddHtml(25, 35, 250, 20, "Rules".Center());
var y = 53;
@ -278,7 +278,7 @@ namespace Server.Engines.ConPVP
?? new List<TourneyParticipant>(tourney.Participants);
AddLeftArrow(25, 11, ToButtonID(0, 0));
AddHtml(25, 35, 250, 20, Center($"{pList.Count} Participant{(pList.Count == 1 ? "" : "s")}"));
AddHtml(25, 35, 250, 20, $"{pList.Count} Participant{(pList.Count == 1 ? "" : "s")}".Center());
StartPage(out var index, out var count, out var y, 12);
@ -291,7 +291,7 @@ namespace Server.Engines.ConPVP
{
if (part.Players[0] is PlayerMobile pm && pm.DuelPlayer != null)
{
name = Color(name, pm.DuelPlayer.Eliminated ? 0x6633333 : 0x336666);
name = name.Color(pm.DuelPlayer.Eliminated ? 0x6633333 : 0x336666);
}
}
@ -311,7 +311,7 @@ namespace Server.Engines.ConPVP
AddBackground(0, 0, 300, 60 + 18 + 20 + part.Players.Count * 18 + 20 + 20 + 160, 9380);
AddLeftArrow(25, 11, ToButtonID(0, 1));
AddHtml(25, 35, 250, 20, Center("Participants"));
AddHtml(25, 35, 250, 20, "Participants".Center());
var y = 53;
@ -327,7 +327,7 @@ namespace Server.Engines.ConPVP
{
if (mob is PlayerMobile pm && pm.DuelPlayer != null)
{
name = Color(name, pm.DuelPlayer.Eliminated ? 0x6633333 : 0x336666);
name = name.Color(pm.DuelPlayer.Eliminated ? 0x6633333 : 0x336666);
}
}
@ -364,7 +364,7 @@ namespace Server.Engines.ConPVP
sb.Append("Nothing logged yet.");
}
AddHtml(25, y, 250, 150, Color(sb.ToString(), BlackColor32), false, true);
AddHtml(25, y, 250, 150, sb.ToString().Color(BlackColor32), false, true);
break;
}
@ -374,7 +374,7 @@ namespace Server.Engines.ConPVP
AddBackground(0, 0, 300, 300, 9380);
AddLeftArrow(25, 11, ToButtonID(0, 3));
AddHtml(25, 35, 250, 20, Center("Participants"));
AddHtml(25, 35, 250, 20, "Participants".Center());
if (obj is not Mobile mob)
{
@ -405,7 +405,7 @@ namespace Server.Engines.ConPVP
AddBackground(0, 0, 300, 300, 9380);
AddLeftArrow(25, 11, ToButtonID(0, 0));
AddHtml(25, 35, 250, 20, Center("Rounds"));
AddHtml(25, 35, 250, 20, "Rounds".Center());
StartPage(out var index, out var count, out var y, 12);
@ -422,7 +422,7 @@ namespace Server.Engines.ConPVP
AddBackground(0, 0, 300, 300, 9380);
AddLeftArrow(25, 11, ToButtonID(0, 2));
AddHtml(25, 35, 250, 20, Center("Rounds"));
AddHtml(25, 35, 250, 20, "Rounds".Center());
if (m_Object is not PyramidLevel level)
{
@ -475,11 +475,11 @@ namespace Server.Engines.ConPVP
if (color == -1 && match.Context != null && match.Winner == part)
{
txt = Color(txt, 0x336633);
txt = txt.Color(0x336633);
}
else if (color == -1 && match.Context != null)
{
txt = Color(txt, 0x663333);
txt = txt.Color(0x663333);
}
sb.Append(txt);
@ -537,11 +537,11 @@ namespace Server.Engines.ConPVP
if (color == -1 && match.Context != null && match.Winner == part)
{
txt = Color(txt, 0x336633);
txt = txt.Color(0x336633);
}
else if (color == -1 && match.Context != null)
{
txt = Color(txt, 0x663333);
txt = txt.Color(0x663333);
}
sb.Append(txt);
@ -556,7 +556,7 @@ namespace Server.Engines.ConPVP
if (color >= 0)
{
str = Color(str, color);
str = str.Color(color);
}
AddRightArrow(25, y, ToButtonID(5, index + i + 1), str);
@ -577,7 +577,7 @@ namespace Server.Engines.ConPVP
AddBackground(0, 0, 300, 60 + 18 + 20 + 20 + 20 + ct * 18 + 6, 9380);
AddLeftArrow(25, 11, ToButtonID(0, 5));
AddHtml(25, 35, 250, 20, Center("Rounds"));
AddHtml(25, 35, 250, 20, "Rounds".Center());
AddHtml(25, 53, 250, 20, $"Winner: {(match.Winner == null ? "N/A" : match.Winner.NameList)}");
AddHtml(
@ -683,10 +683,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, int height, string text, int color, int borderColor)
{
AddColoredText(x - 1, y - 1, width, height, text, borderColor);
@ -704,7 +700,7 @@ namespace Server.Engines.ConPVP
}
else
{
AddHtml(x, y, width, height, Color(text, color));
AddHtml(x, y, width, height, text.Color(color));
}
}

View file

@ -254,10 +254,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, y, width, text, color);
@ -265,14 +261,7 @@ 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)
@ -282,7 +271,7 @@ namespace Server.Engines.ConPVP
if (name != null)
{
AddBorderedText(m_ColumnX, 13, width, Center(name), 0xFFFFFF, 0);
AddBorderedText(m_ColumnX, 13, width, name.Center(), 0xFFFFFF, 0);
}
m_ColumnX += width;