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

@ -84,7 +84,7 @@ public class NameChangeDeedGump : Gump
AddPage(0); AddPage(0);
AddBlackAlpha(10, 120, 250, 85); 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(73, 15, 1152, "");
AddLabel(20, 150, 0x480, "New Name:"); AddLabel(20, 150, 0x480, "New Name:");
@ -105,13 +105,9 @@ public class NameChangeDeedGump : Gump
AddTextEntry(x + 2, y + 2, width - 4, height - 4, 0, index, ""); AddTextEntry(x + 2, y + 2, width - 4, height - 4, 0, index, "");
} }
public static string Center(string text) => $"<CENTER>{text}</CENTER>";
public static string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
public void AddButtonLabeled(int x, int y, int buttonID, string text) public void AddButtonLabeled(int x, int y, int buttonID, string text)
{ {
AddButton(x, y - 1, 4005, 4007, buttonID); 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));
} }
} }

View file

@ -1,4 +1,3 @@
using Server.Utilities;
using Xunit; using Xunit;
namespace Server.Tests namespace Server.Tests

View file

@ -15,7 +15,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using Server.Network; using Server.Network;
using Server.Utilities;
namespace Server.Gumps; namespace Server.Gumps;

View file

@ -13,6 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * * along with this program. If not, see <http://www.gnu.org/licenses/>. *
*************************************************************************/ *************************************************************************/
using System.Drawing;
using ModernUO.Serialization; using ModernUO.Serialization;
using Server.Gumps; using Server.Gumps;
using Server.Network; using Server.Network;
@ -268,10 +269,7 @@ public sealed partial class VirtualCheck : Item
AddImage(10, 8, 113); AddImage(10, 8, 113);
AddImage(360, 8, 113); AddImage(360, 8, 113);
var title = AddHtml(40, 15, 320, 20, $"BANK OF {User.RawName.ToUpper()}".Center(0x2F4F4F));
$"<BASEFONT COLOR=#FF2F4F4F><CENTER>BANK OF {User.RawName.ToUpper()}</CENTER>";
AddHtml(40, 15, 320, 20, title);
// Platinum Row // Platinum Row
AddBackground(15, 60, 175, 20, 9300); AddBackground(15, 60, 175, 20, 9300);

View file

@ -15,7 +15,6 @@ using Server.Network;
using Server.Prompts; using Server.Prompts;
using Server.Targeting; using Server.Targeting;
using Server.Text; using Server.Text;
using Server.Utilities;
using CalcMoves = Server.Movement.Movement; using CalcMoves = Server.Movement.Movement;
namespace Server; namespace Server;

View file

@ -19,6 +19,106 @@ namespace Server;
public static class TextDefinitionExtensions 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( public static void AddHtmlText(
this TextDefinition def, this TextDefinition def,
Gump g, Gump g,
@ -57,7 +157,7 @@ public static class TextDefinitionExtensions
y, y,
width, width,
height, height,
$"<BASEFONT COLOR=#{stringColor:X6}>{def.String}</BASEFONT>", def.String.Color(stringColor),
back, back,
scroll scroll
); );
@ -102,7 +202,7 @@ public static class TextDefinitionExtensions
y, y,
width, width,
height, height,
$"<BASEFONT COLOR=#{stringColor:X6}>{string.Format(def.String, args)}</BASEFONT>", string.Format(def.String, args).Color(stringColor),
back, back,
scroll scroll
); );

View file

@ -16,7 +16,7 @@
using System; using System;
using System.Reflection; using System.Reflection;
namespace Server.Utilities; namespace Server;
public static class ActivatorExtensions public static class ActivatorExtensions
{ {

View file

@ -16,7 +16,7 @@
using System; using System;
using System.Reflection; using System.Reflection;
namespace Server.Utilities; namespace Server;
public static class EntityActivatorExtensions public static class EntityActivatorExtensions
{ {

View file

@ -16,7 +16,7 @@
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text; using System.Text;
namespace Server.Utilities; namespace Server;
public static class Html public static class Html
{ {
@ -47,6 +47,21 @@ public static class Html
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string Center(this string text, string color, int size) => $"<BASEFONT COLOR={color} SIZE={size}><CENTER>{text}</CENTER></BASEFONT>"; public static string Center(this string text, string color, int size) => $"<BASEFONT COLOR={color} SIZE={size}><CENTER>{text}</CENTER></BASEFONT>";
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string Right(this string text) => $"<RIGHT>{text}</RIGHT>";
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string Right(this string text, int color) => $"<BASEFONT COLOR=#{color:X6}><RIGHT>{text}</RIGHT></BASEFONT>";
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string Right(this string text, int color, int size) => $"<BASEFONT COLOR=#{color:X6} SIZE={size}><RIGHT>{text}</RIGHT></BASEFONT>";
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string Right(this string text, string color) => $"<BASEFONT COLOR={color}><RIGHT>{text}</RIGHT></BASEFONT>";
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string Right(this string text, string color, int size) => $"<BASEFONT COLOR={color} SIZE={size}><RIGHT>{text}</RIGHT></BASEFONT>";
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string EscapeHtml(this string input) => public static string EscapeHtml(this string input) =>
new StringBuilder(input.Length).Append(input) new StringBuilder(input.Length).Append(input)

View file

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

View file

@ -4,7 +4,6 @@ using System.Text;
using System.Text.Json; using System.Text.Json;
using Server.Commands.Generic; using Server.Commands.Generic;
using Server.Json; using Server.Json;
using Server.Utilities;
namespace Server.Commands; namespace Server.Commands;

View file

@ -2,7 +2,6 @@ using System;
using System.Globalization; using System.Globalization;
using System.Reflection; using System.Reflection;
using System.Reflection.Emit; using System.Reflection.Emit;
using Server.Utilities;
namespace Server.Commands.Generic namespace Server.Commands.Generic
{ {

View file

@ -2,7 +2,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Reflection.Emit; using System.Reflection.Emit;
using Server.Utilities;
namespace Server.Commands.Generic namespace Server.Commands.Generic
{ {

View file

@ -2,7 +2,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Reflection.Emit; using System.Reflection.Emit;
using Server.Utilities;
namespace Server.Commands.Generic namespace Server.Commands.Generic
{ {

View file

@ -349,7 +349,7 @@ public static class HelpInfo
AddBackground(0, 0, width, height, 5054); AddBackground(0, 0, width, height, 5054);
AddHtml(10, 10, width - 20, 20, Color(Center(info.Name), 0xFF0000)); AddHtml(10, 10, width - 20, 20, info.Name.Center(0xFF0000));
using var sb = ValueStringBuilder.Create(); using var sb = ValueStringBuilder.Create();
@ -402,9 +402,5 @@ public static class HelpInfo
AddHtml(10, 40, width - 20, height - 80, sb.ToString(), false, true); AddHtml(10, 40, width - 20, height - 80, sb.ToString(), false, true);
} }
public static string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
public static string Center(string text) => $"<CENTER>{text}</CENTER>";
} }
} }

View file

@ -21,7 +21,6 @@ using System.Text.Json.Serialization;
using Server.Items; using Server.Items;
using Server.Json; using Server.Json;
using Server.Logging; using Server.Logging;
using Server.Utilities;
namespace Server.Commands; namespace Server.Commands;

View file

@ -8,7 +8,6 @@ using Server.Engines.Quests.Necro;
using Server.Engines.Spawners; using Server.Engines.Spawners;
using Server.Items; using Server.Items;
using Server.Network; using Server.Network;
using Server.Utilities;
using MemoryExtensions = System.MemoryExtensions; using MemoryExtensions = System.MemoryExtensions;
namespace Server.Commands namespace Server.Commands

View file

@ -8,7 +8,6 @@ using Server.Engines.Quests.Necro;
using Server.Engines.Spawners; using Server.Engines.Spawners;
using Server.Items; using Server.Items;
using Server.Network; using Server.Network;
using Server.Utilities;
using MemoryExtensions = System.MemoryExtensions; using MemoryExtensions = System.MemoryExtensions;
namespace Server.Commands namespace Server.Commands

View file

@ -22,7 +22,7 @@ public abstract class AdvancedSearchWarningGump : Gump
10, 10,
width - 20, width - 20,
20, 20,
$"<BASEFONT COLOR=#{headerColor:X6}>{header}</BASEFONT>" header.Color(headerColor)
); );
AddImageTiled(10, 40, width - 20, height - 80, 2624); AddImageTiled(10, 40, width - 20, height - 80, 2624);
@ -35,9 +35,8 @@ public abstract class AdvancedSearchWarningGump : Gump
40, 40,
width - 20, width - 20,
height - 80, height - 80,
$"<BASEFONT COLOR=#{contentColor:X6}>{content}</BASEFONT>", content.Color(contentColor),
false, scrollbar: true
true
); );
} }

View file

@ -24,7 +24,6 @@ using Server.Items;
using Server.Mobiles; using Server.Mobiles;
using Server.Regions; using Server.Regions;
using Server.Logging; using Server.Logging;
using Server.Utilities;
namespace Server.Engines.CannedEvil; namespace Server.Engines.CannedEvil;

View file

@ -49,62 +49,60 @@ namespace Server.Engines.ConPVP
AddImage(215, -43, 0xEE40); AddImage(215, -43, 0xEE40);
// AddImage( 330, 141, 0x8BA ); // AddImage( 330, 141, 0x8BA );
AddHtml(22 - 1, 22, 294, 20, Color(Center("Duel Challenge"), BlackColor32)); var duelChallengeBlack = "Duel Challenge".Center(BlackColor32);
AddHtml(22 + 1, 22, 294, 20, Color(Center("Duel Challenge"), BlackColor32)); AddHtml(22 - 1, 22, 294, 20, duelChallengeBlack);
AddHtml(22, 22 - 1, 294, 20, Color(Center("Duel Challenge"), BlackColor32)); AddHtml(22 + 1, 22, 294, 20, duelChallengeBlack);
AddHtml(22, 22 + 1, 294, 20, Color(Center("Duel Challenge"), BlackColor32)); AddHtml(22, 22 - 1, 294, 20, duelChallengeBlack);
AddHtml(22, 22, 294, 20, Color(Center("Duel Challenge"), LabelColor32)); 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)) var acceptBlack = accept.Color(BlackColor32);
{
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?";
}
AddHtml(22 - 1, 50, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32)); AddHtml(22 - 1, 50, 294, 40, acceptBlack);
AddHtml(22 + 1, 50, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32)); AddHtml(22 + 1, 50, 294, 40, acceptBlack);
AddHtml(22, 50 - 1, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32)); AddHtml(22, 50 - 1, 294, 40, acceptBlack);
AddHtml(22, 50 + 1, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32)); AddHtml(22, 50 + 1, 294, 40, acceptBlack);
AddHtml(22, 50, 294, 40, Color(string.Format(fmt, challenger.Name), 0xB0C868)); AddHtml(22, 50, 294, 40, accept.Color(0xB0C868));
AddImageTiled(32, 88, 264, 1, 9107); AddImageTiled(32, 88, 264, 1, 9107);
AddImageTiled(42, 90, 264, 1, 9157); AddImageTiled(42, 90, 264, 1, 9157);
var yesBlack = "Yes, I will fight this duel.".Color(BlackColor32);
AddRadio(24, 100, 9727, 9730, true, 1); 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, yesBlack);
AddHtml(60 + 1, 105, 250, 20, Color("Yes, I will fight this duel.", BlackColor32)); AddHtml(60 + 1, 105, 250, 20, yesBlack);
AddHtml(60, 105 - 1, 250, 20, Color("Yes, I will fight this duel.", BlackColor32)); AddHtml(60, 105 - 1, 250, 20, yesBlack);
AddHtml(60, 105 + 1, 250, 20, Color("Yes, I will fight this duel.", BlackColor32)); AddHtml(60, 105 + 1, 250, 20, yesBlack);
AddHtml(60, 105, 250, 20, Color("Yes, I will fight this duel.", LabelColor32)); 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); 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, noBlack);
AddHtml(60 + 1, 140, 250, 20, Color("No, I do not wish to fight.", BlackColor32)); AddHtml(60 + 1, 140, 250, 20, noBlack);
AddHtml(60, 140 - 1, 250, 20, Color("No, I do not wish to fight.", BlackColor32)); AddHtml(60, 140 - 1, 250, 20, noBlack);
AddHtml(60, 140 + 1, 250, 20, Color("No, I do not wish to fight.", BlackColor32)); AddHtml(60, 140 + 1, 250, 20, noBlack);
AddHtml(60, 140, 250, 20, Color("No, I do not wish to fight.", LabelColor32)); 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); 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, noAskBlack);
AddHtml(60 + 1, 175, 250, 20, Color("No, knave. Do not ask again.", BlackColor32)); AddHtml(60 + 1, 175, 250, 20, noAskBlack);
AddHtml(60, 175 - 1, 250, 20, Color("No, knave. Do not ask again.", BlackColor32)); AddHtml(60, 175 - 1, 250, 20, noAskBlack);
AddHtml(60, 175 + 1, 250, 20, Color("No, knave. Do not ask again.", BlackColor32)); AddHtml(60, 175 + 1, 250, 20, noAskBlack);
AddHtml(60, 175, 250, 20, Color("No, knave. Do not ask again.", LabelColor32)); AddHtml(60, 175, 250, 20, "No, knave. Do not ask again.".Color(LabelColor32));
AddButton(314, 173, 247, 248, 1); AddButton(314, 173, 247, 248, 1);
Timer.StartTimer(TimeSpan.FromSeconds(15.0), AutoReject); 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() public void AutoReject()
{ {
if (!m_Active) if (!m_Active)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -188,7 +188,7 @@ namespace Server.Engines.ConPVP
AddBorderedText(x + 5, y + 5, 325 - 5, sb.ToString(), color, 0); AddBorderedText(x + 5, y + 5, 325 - 5, sb.ToString(), color, 0);
x += 325; 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) private void AddBorderedText(int x, int y, int width, string text, int color, int borderColor)
{ {
/*AddColoredText( x - 1, y, width, text, 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) private void AddColoredText(int x, int y, int width, string text, int color)
{ {
if (color == 0) AddHtml(x, y, width, 20, color == 0 ? text : text.Color(color));
{
AddHtml(x, y, width, 20, text);
}
else
{
AddHtml(x, y, width, 20, Color(text, color));
}
} }
private void AddColumnHeader(int width, string name) private void AddColumnHeader(int width, string name)
@ -297,7 +286,7 @@ namespace Server.Engines.ConPVP
if (name != null) if (name != null)
{ {
AddBorderedText(m_ColumnX, 13, width, Center(name), 0xFFFFFF, 0); AddBorderedText(m_ColumnX, 13, width, name.Center(), 0xFFFFFF, 0);
} }
m_ColumnX += width; m_ColumnX += width;

View file

@ -20,77 +20,31 @@ namespace Server.Engines.ConPVP
AddImage(215, -43, 0xEE40); AddImage(215, -43, 0xEE40);
AddHtml(22 - 1, 22, 294, 20, Color(Center("Duel Countdown"), BlackColor32)); var duelCountdownBlack = "Duel Countdown".Center(BlackColor32);
AddHtml(22 + 1, 22, 294, 20, Color(Center("Duel Countdown"), BlackColor32)); AddHtml(22 - 1, 22, 294, 20, duelCountdownBlack);
AddHtml(22, 22 - 1, 294, 20, Color(Center("Duel Countdown"), BlackColor32)); AddHtml(22 + 1, 22, 294, 20, duelCountdownBlack);
AddHtml(22, 22 + 1, 294, 20, Color(Center("Duel Countdown"), BlackColor32)); AddHtml(22, 22 - 1, 294, 20, duelCountdownBlack);
AddHtml(22, 22, 294, 20, Color(Center("Duel Countdown"), LabelColor32)); AddHtml(22, 22 + 1, 294, 20, duelCountdownBlack);
AddHtml(22, 22, 294, 20, "Duel Countdown".Center(LabelColor32));
AddHtml( var beginMessageBlack =
22 - 1, "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."
50, .Color(BlackColor32);
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
)
);
/*AddImageTiled( 32, 128, 264, 1, 9107 ); AddHtml(22 - 1, 50, 294, 80, beginMessageBlack);
AddImageTiled( 42, 130, 264, 1, 9157 ); AddHtml(22 + 1, 50, 294, 80, beginMessageBlack);
AddHtml(22, 50 - 1, 294, 80, beginMessageBlack);
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(22, 50 + 1, 294, 80, beginMessageBlack);
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(
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 ); 22,
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 ); 50,
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 );*/ 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); 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"); 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( AddBorderedText(
22, 22,
50, 50,
@ -283,10 +283,6 @@ namespace Server.Engines.ConPVP
AddButton(314, y, 247, 248, 1); 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) 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); 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) private void AddColoredText(int x, int y, int width, int height, string text, int color)
{ {
if (color == 0) AddHtml(x, y, width, height, color == 0 ? text : text.Color(color));
{
AddHtml(x, y, width, height, text);
}
else
{
AddHtml(x, y, width, height, Color(text, color));
}
} }
public void AddGoldenButton(int x, int y, int bid) public void AddGoldenButton(int x, int y, int bid)

View file

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

View file

@ -91,7 +91,7 @@ namespace Server.Engines.ConPVP
sb.Append(" Tournament Bracket"); 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, 53, ToButtonID(0, 4), "Rules");
AddRightArrow(25, 71, ToButtonID(0, 1), "Participants"); AddRightArrow(25, 71, ToButtonID(0, 1), "Participants");
@ -181,7 +181,7 @@ namespace Server.Engines.ConPVP
); );
AddLeftArrow(25, 11, ToButtonID(0, 0)); AddLeftArrow(25, 11, ToButtonID(0, 0));
AddHtml(25, 35, 250, 20, Center("Rules")); AddHtml(25, 35, 250, 20, "Rules".Center());
var y = 53; var y = 53;
@ -278,7 +278,7 @@ namespace Server.Engines.ConPVP
?? new List<TourneyParticipant>(tourney.Participants); ?? new List<TourneyParticipant>(tourney.Participants);
AddLeftArrow(25, 11, ToButtonID(0, 0)); 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); 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) 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); AddBackground(0, 0, 300, 60 + 18 + 20 + part.Players.Count * 18 + 20 + 20 + 160, 9380);
AddLeftArrow(25, 11, ToButtonID(0, 1)); AddLeftArrow(25, 11, ToButtonID(0, 1));
AddHtml(25, 35, 250, 20, Center("Participants")); AddHtml(25, 35, 250, 20, "Participants".Center());
var y = 53; var y = 53;
@ -327,7 +327,7 @@ namespace Server.Engines.ConPVP
{ {
if (mob is PlayerMobile pm && pm.DuelPlayer != null) 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."); 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; break;
} }
@ -374,7 +374,7 @@ namespace Server.Engines.ConPVP
AddBackground(0, 0, 300, 300, 9380); AddBackground(0, 0, 300, 300, 9380);
AddLeftArrow(25, 11, ToButtonID(0, 3)); 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) if (obj is not Mobile mob)
{ {
@ -405,7 +405,7 @@ namespace Server.Engines.ConPVP
AddBackground(0, 0, 300, 300, 9380); AddBackground(0, 0, 300, 300, 9380);
AddLeftArrow(25, 11, ToButtonID(0, 0)); 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); 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); AddBackground(0, 0, 300, 300, 9380);
AddLeftArrow(25, 11, ToButtonID(0, 2)); 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) if (m_Object is not PyramidLevel level)
{ {
@ -475,11 +475,11 @@ namespace Server.Engines.ConPVP
if (color == -1 && match.Context != null && match.Winner == part) if (color == -1 && match.Context != null && match.Winner == part)
{ {
txt = Color(txt, 0x336633); txt = txt.Color(0x336633);
} }
else if (color == -1 && match.Context != null) else if (color == -1 && match.Context != null)
{ {
txt = Color(txt, 0x663333); txt = txt.Color(0x663333);
} }
sb.Append(txt); sb.Append(txt);
@ -537,11 +537,11 @@ namespace Server.Engines.ConPVP
if (color == -1 && match.Context != null && match.Winner == part) if (color == -1 && match.Context != null && match.Winner == part)
{ {
txt = Color(txt, 0x336633); txt = txt.Color(0x336633);
} }
else if (color == -1 && match.Context != null) else if (color == -1 && match.Context != null)
{ {
txt = Color(txt, 0x663333); txt = txt.Color(0x663333);
} }
sb.Append(txt); sb.Append(txt);
@ -556,7 +556,7 @@ namespace Server.Engines.ConPVP
if (color >= 0) if (color >= 0)
{ {
str = Color(str, color); str = str.Color(color);
} }
AddRightArrow(25, y, ToButtonID(5, index + i + 1), str); 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); AddBackground(0, 0, 300, 60 + 18 + 20 + 20 + 20 + ct * 18 + 6, 9380);
AddLeftArrow(25, 11, ToButtonID(0, 5)); 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(25, 53, 250, 20, $"Winner: {(match.Winner == null ? "N/A" : match.Winner.NameList)}");
AddHtml( 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) 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); AddColoredText(x - 1, y - 1, width, height, text, borderColor);
@ -704,7 +700,7 @@ namespace Server.Engines.ConPVP
} }
else 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) private void AddBorderedText(int x, int y, int width, string text, int color, int borderColor)
{ {
AddColoredText(x, y, width, text, color); 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) private void AddColoredText(int x, int y, int width, string text, int color)
{ {
if (color == 0) AddHtml(x, y, width, 20, color == 0 ? text : text.Color(color));
{
AddHtml(x, y, width, 20, text);
}
else
{
AddHtml(x, y, width, 20, Color(text, color));
}
} }
private void AddColumnHeader(int width, string name) private void AddColumnHeader(int width, string name)
@ -282,7 +271,7 @@ namespace Server.Engines.ConPVP
if (name != null) if (name != null)
{ {
AddBorderedText(m_ColumnX, 13, width, Center(name), 0xFFFFFF, 0); AddBorderedText(m_ColumnX, 13, width, name.Center(), 0xFFFFFF, 0);
} }
m_ColumnX += width; m_ColumnX += width;

View file

@ -106,17 +106,7 @@ namespace Server.Engines.Craft
} }
// **************************************** // ****************************************
if (notice != null) notice.AddHtmlText(this, 170, 295, 350, 40, numberColor: LabelColor, stringColor: FontColor);
{
if (notice.Number > 0)
{
AddHtmlLocalized(170, 295, 350, 40, notice.Number, LabelColor);
}
else
{
AddHtml(170, 295, 350, 40, $"<BASEFONT COLOR=#{FontColor:X6}>{notice.String}</BASEFONT>");
}
}
// If the system has more than one resource // If the system has more than one resource
if (craftSystem.CraftSubRes.Init) if (craftSystem.CraftSubRes.Init)

View file

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

View file

@ -1,7 +1,6 @@
using Server.Ethics; using Server.Ethics;
using Server.Items; using Server.Items;
using Server.Targeting; using Server.Targeting;
using Server.Utilities;
namespace Server.Engines.Craft namespace Server.Engines.Craft
{ {

View file

@ -2,7 +2,6 @@ using System;
using Server.Engines.BulkOrders; using Server.Engines.BulkOrders;
using Server.Items; using Server.Items;
using Server.Spells; using Server.Spells;
using Server.Utilities;
namespace Server.Engines.Craft; namespace Server.Engines.Craft;

View file

@ -2,7 +2,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using ModernUO.Serialization; using ModernUO.Serialization;
using Server.Items; using Server.Items;
using Server.Utilities;
namespace Server.Engines.Doom; namespace Server.Engines.Doom;

View file

@ -1,5 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using Server.Utilities;
namespace Server.Factions namespace Server.Factions
{ {

View file

@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Server.Utilities;
namespace Server.Factions namespace Server.Factions
{ {

View file

@ -1,5 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using Server.Utilities;
namespace Server.Factions namespace Server.Factions
{ {

View file

@ -26,22 +26,22 @@ namespace Server.Factions
AddBackground(0, 0, 448, 354, 9270); AddBackground(0, 0, 448, 354, 9270);
AddAlphaRegion(10, 10, 428, 334); AddAlphaRegion(10, 10, 428, 334);
AddHtml(10, 10, 428, 20, Color(Center("Candidate Management"), LabelColor)); AddHtml(10, 10, 428, 20, "Candidate Management".Center(LabelColor));
AddHtml(45, 35, 100, 20, Color("Player Name:", LabelColor)); AddHtml(45, 35, 100, 20, "Player Name:".Color(LabelColor));
AddHtml(145, 35, 100, 20, Color(candidate.Mobile == null ? "null" : candidate.Mobile.Name, LabelColor)); AddHtml(145, 35, 100, 20, (candidate.Mobile == null ? "null" : candidate.Mobile.Name).Color(LabelColor));
AddHtml(45, 55, 100, 20, Color("Vote Count:", LabelColor)); AddHtml(45, 55, 100, 20, "Vote Count:".Color(LabelColor));
AddHtml(145, 55, 100, 20, Color(candidate.Votes.ToString(), LabelColor)); AddHtml(145, 55, 100, 20, candidate.Votes.ToString().Color(LabelColor));
AddButton(12, 73, 4005, 4007, 1); AddButton(12, 73, 4005, 4007, 1);
AddHtml(45, 75, 100, 20, Color("Drop Candidate", LabelColor)); AddHtml(45, 75, 100, 20, "Drop Candidate".Color(LabelColor));
AddImageTiled(13, 99, 422, 242, 9264); AddImageTiled(13, 99, 422, 242, 9264);
AddImageTiled(14, 100, 420, 240, 9274); AddImageTiled(14, 100, 420, 240, 9274);
AddAlphaRegion(14, 100, 420, 240); AddAlphaRegion(14, 100, 420, 240);
AddHtml(14, 100, 420, 20, Color(Center("Voters"), LabelColor)); AddHtml(14, 100, 420, 20, "Voters".Center(LabelColor));
if (page > 0) if (page > 0)
{ {
@ -61,11 +61,11 @@ namespace Server.Factions
AddImage(414, 104, 0x25E6); AddImage(414, 104, 0x25E6);
} }
AddHtml(14, 120, 30, 20, Color(Center("DEL"), LabelColor)); AddHtml(14, 120, 30, 20, "DEL".Center(LabelColor));
AddHtml(47, 120, 150, 20, Color("Name", LabelColor)); AddHtml(47, 120, 150, 20, "Name".Color(LabelColor));
AddHtml(195, 120, 100, 20, Color(Center("Address"), LabelColor)); AddHtml(195, 120, 100, 20, "Address".Center(LabelColor));
AddHtml(295, 120, 80, 20, Color(Center("Time"), LabelColor)); AddHtml(295, 120, 80, 20, "Time".Center(LabelColor));
AddHtml(355, 120, 60, 20, Color(Center("Legit"), LabelColor)); AddHtml(355, 120, 60, 20, "Legit".Center(LabelColor));
var idx = 0; var idx = 0;
@ -85,12 +85,12 @@ namespace Server.Factions
if (obj is Mobile mobile) if (obj is Mobile mobile)
{ {
AddHtml(x + 2, 140 + idx * 20, 150, 20, Color(mobile.Name, LabelColor)); AddHtml(x + 2, 140 + idx * 20, 150, 20, mobile.Name.Color(LabelColor));
x += 150; x += 150;
} }
else if (obj is IPAddress) else if (obj is IPAddress)
{ {
AddHtml(x, 140 + idx * 20, 100, 20, Color(Center(obj.ToString()), LabelColor)); AddHtml(x, 140 + idx * 20, 100, 20, obj.ToString().Center(LabelColor));
x += 100; x += 100;
} }
else if (obj is DateTime time) else if (obj is DateTime time)
@ -100,13 +100,13 @@ namespace Server.Factions
140 + idx * 20, 140 + idx * 20,
80, 80,
20, 20,
Color(Center(FormatTimeSpan(time - election.LastStateTime)), LabelColor) FormatTimeSpan(time - election.LastStateTime).Center(LabelColor)
); );
x += 80; x += 80;
} }
else if (obj is int i1) else if (obj is int i1)
{ {
AddHtml(x, 140 + idx * 20, 60, 20, Color(Center($"{i1}%"), LabelColor)); AddHtml(x, 140 + idx * 20, 60, 20, $"{i1}%".Center(LabelColor));
x += 60; x += 60;
} }
} }
@ -117,23 +117,23 @@ namespace Server.Factions
AddBackground(0, 0, 288, 334, 9270); AddBackground(0, 0, 288, 334, 9270);
AddAlphaRegion(10, 10, 268, 314); AddAlphaRegion(10, 10, 268, 314);
AddHtml(10, 10, 268, 20, Color(Center("Election Management"), LabelColor)); AddHtml(10, 10, 268, 20, "Election Management".Center(LabelColor));
AddHtml(45, 35, 100, 20, Color("Current State:", LabelColor)); AddHtml(45, 35, 100, 20, "Current State:".Color(LabelColor));
AddHtml(145, 35, 100, 20, Color(election.State.ToString(), LabelColor)); AddHtml(145, 35, 100, 20, election.State.ToString().Color(LabelColor));
AddButton(12, 53, 4005, 4007, 1); AddButton(12, 53, 4005, 4007, 1);
AddHtml(45, 55, 100, 20, Color("Transition Time:", LabelColor)); AddHtml(45, 55, 100, 20, "Transition Time:".Color(LabelColor));
AddHtml(145, 55, 100, 20, Color(FormatTimeSpan(election.NextStateTime), LabelColor)); AddHtml(145, 55, 100, 20, FormatTimeSpan(election.NextStateTime).Color(LabelColor));
AddImageTiled(13, 79, 262, 242, 9264); AddImageTiled(13, 79, 262, 242, 9264);
AddImageTiled(14, 80, 260, 240, 9274); AddImageTiled(14, 80, 260, 240, 9274);
AddAlphaRegion(14, 80, 260, 240); AddAlphaRegion(14, 80, 260, 240);
AddHtml(14, 80, 260, 20, Color(Center("Candidates"), LabelColor)); AddHtml(14, 80, 260, 20, "Candidates".Center(LabelColor));
AddHtml(14, 100, 30, 20, Color(Center("-->"), LabelColor)); AddHtml(14, 100, 30, 20, "-->".Center(LabelColor));
AddHtml(47, 100, 150, 20, Color("Name", LabelColor)); AddHtml(47, 100, 150, 20, "Name".Color(LabelColor));
AddHtml(195, 100, 80, 20, Color(Center("Votes"), LabelColor)); AddHtml(195, 100, 80, 20, "Votes".Center(LabelColor));
for (var i = 0; i < election.Candidates.Count; ++i) for (var i = 0; i < election.Candidates.Count; ++i)
{ {
@ -146,18 +146,12 @@ namespace Server.Factions
} }
AddButton(13, 118 + i * 20, 4005, 4007, 2 + i); AddButton(13, 118 + i * 20, 4005, 4007, 2 + i);
AddHtml(47, 120 + i * 20, 150, 20, Color(mob.Name, LabelColor)); AddHtml(47, 120 + i * 20, 150, 20, mob.Name.Color(LabelColor));
AddHtml(195, 120 + i * 20, 80, 20, Color(Center(cd.Votes.ToString()), LabelColor)); AddHtml(195, 120 + i * 20, 80, 20, cd.Votes.ToString().Center(LabelColor));
} }
} }
} }
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 static string FormatTimeSpan(TimeSpan ts) => public static string FormatTimeSpan(TimeSpan ts) =>
$"{ts.Days:D2}:{ts.Hours % 24:D2}:{ts.Minutes % 60:D2}:{ts.Seconds % 60:D2}"; $"{ts.Days:D2}:{ts.Hours % 24:D2}:{ts.Minutes % 60:D2}:{ts.Seconds % 60:D2}";
@ -168,50 +162,41 @@ namespace Server.Factions
if (m_Candidate == null) if (m_Candidate == null)
{ {
if (bid == 0) if (bid > 1)
{
}
else if (bid == 1)
{
}
else
{ {
bid -= 2; bid -= 2;
if (bid >= 0 && bid < m_Election.Candidates.Count) if (bid < m_Election.Candidates.Count)
{ {
from.SendGump(new ElectionManagementGump(m_Election, m_Election.Candidates[bid])); from.SendGump(new ElectionManagementGump(m_Election, m_Election.Candidates[bid]));
} }
} }
} }
else if (bid == 0)
{
from.SendGump(new ElectionManagementGump(m_Election));
}
else if (bid == 1)
{
m_Election.RemoveCandidate(m_Candidate.Mobile);
from.SendGump(new ElectionManagementGump(m_Election));
}
else if (bid == 2 && m_Page > 0)
{
from.SendGump(new ElectionManagementGump(m_Election, m_Candidate, m_Page - 1));
}
else if (bid == 3 && (m_Page + 1) * 10 < m_Candidate.Voters.Count)
{
from.SendGump(new ElectionManagementGump(m_Election, m_Candidate, m_Page + 1));
}
else else
{ {
if (bid == 0) bid -= 4;
{
from.SendGump(new ElectionManagementGump(m_Election));
}
else if (bid == 1)
{
m_Election.RemoveCandidate(m_Candidate.Mobile);
from.SendGump(new ElectionManagementGump(m_Election));
}
else if (bid == 2 && m_Page > 0)
{
from.SendGump(new ElectionManagementGump(m_Election, m_Candidate, m_Page - 1));
}
else if (bid == 3 && (m_Page + 1) * 10 < m_Candidate.Voters.Count)
{
from.SendGump(new ElectionManagementGump(m_Election, m_Candidate, m_Page + 1));
}
else
{
bid -= 4;
if (bid >= 0 && bid < m_Candidate.Voters.Count) if (bid >= 0 && bid < m_Candidate.Voters.Count)
{ {
m_Candidate.Voters.RemoveAt(bid); m_Candidate.Voters.RemoveAt(bid);
from.SendGump(new ElectionManagementGump(m_Election, m_Candidate, m_Page)); from.SendGump(new ElectionManagementGump(m_Election, m_Candidate, m_Page));
}
} }
} }
} }

View file

@ -2,7 +2,6 @@ using System;
using System.IO; using System.IO;
using Server.Factions; using Server.Factions;
using Server.Mobiles; using Server.Mobiles;
using Server.Utilities;
namespace Server namespace Server
{ {

View file

@ -1,7 +1,6 @@
using System; using System;
using Server.Engines.Craft; using Server.Engines.Craft;
using Server.Items; using Server.Items;
using Server.Utilities;
namespace Server.Factions namespace Server.Factions
{ {

View file

@ -12,7 +12,6 @@ using Server.Spells.Seventh;
using Server.Spells.Sixth; using Server.Spells.Sixth;
using Server.Spells.Third; using Server.Spells.Third;
using Server.Targeting; using Server.Targeting;
using Server.Utilities;
namespace Server.Factions namespace Server.Factions
{ {

View file

@ -1,7 +1,6 @@
using System; using System;
using Server.Items; using Server.Items;
using Server.Targeting; using Server.Targeting;
using Server.Utilities;
namespace Server.Engines.Harvest namespace Server.Engines.Harvest
{ {

View file

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

View file

@ -247,7 +247,7 @@ namespace Server.Engines.Help
AddAlphaRegion(1, 1, 408, 446); AddAlphaRegion(1, 1, 408, 446);
} }
AddHtml(10, 10, 390, 20, Color(Center("Predefined Responses"), LabelColor32)); AddHtml(10, 10, 390, 20, "Predefined Responses".Center(LabelColor32));
var list = PredefinedResponse.List; var list = PredefinedResponse.List;
@ -308,7 +308,7 @@ namespace Server.Engines.Help
} }
AddButton(12, 44 + i % 5 * 80, 0xFAB, 0xFAD, 1); AddButton(12, 44 + i % 5 * 80, 0xFAB, 0xFAD, 1);
AddHtml(45, 44 + i % 5 * 80, 200, 20, Color("New Response", LabelColor32)); AddHtml(45, 44 + i % 5 * 80, 200, 20, "New Response".Color(LabelColor32));
} }
} }
else if (canEdit) else if (canEdit)
@ -324,25 +324,21 @@ namespace Server.Engines.Help
AddAlphaRegion(1, 1, 408, 248); AddAlphaRegion(1, 1, 408, 248);
} }
AddHtml(10, 10, 390, 20, Color(Center("Predefined Response Editor"), LabelColor32)); AddHtml(10, 10, 390, 20, "Predefined Response Editor".Center(LabelColor32));
AddButton(10, 40, 0xFB1, 0xFB3, 1); AddButton(10, 40, 0xFB1, 0xFB3, 1);
AddHtml(45, 40, 200, 20, Color("Remove", LabelColor32)); AddHtml(45, 40, 200, 20, "Remove".Color(LabelColor32));
AddButton(10, 70, 0xFA5, 0xFA7, 2); AddButton(10, 70, 0xFA5, 0xFA7, 2);
AddHtml(45, 70, 200, 20, Color("Title:", LabelColor32)); AddHtml(45, 70, 200, 20, "Title:".Color(LabelColor32));
AddTextInput(10, 90, 300, 20, 0, response.Title); AddTextInput(10, 90, 300, 20, 0, response.Title);
AddButton(10, 120, 0xFA5, 0xFA7, 3); AddButton(10, 120, 0xFA5, 0xFA7, 3);
AddHtml(45, 120, 200, 20, Color("Message:", LabelColor32)); AddHtml(45, 120, 200, 20, "Message:".Color(LabelColor32));
AddTextInput(10, 140, 390, 100, 1, response.Message); AddTextInput(10, 140, 390, 100, 1, response.Message);
} }
} }
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
public void AddTextInput(int x, int y, int w, int h, int id, string def) public void AddTextInput(int x, int y, int w, int h, int id, string def)
{ {
AddImageTiled(x, y, w, h, 0xA40); AddImageTiled(x, y, w, h, 0xA40);

View file

@ -46,7 +46,7 @@ namespace Server.Engines.Help
10, 10,
280, 280,
20, 20,
$"<basefont color=#A0A0FF><center>SPEECH LOG - {playerName} (<i>{playerAccount.FixHtmlFormattable()}</i>)</center></basefont>" $"SPEECH LOG - {playerName} (<i>{playerAccount.FixHtmlFormattable()}</i>)".Center(0xA0A0FF)
); );
var lastPage = (log.Count - 1) / MaxEntriesPerPage; var lastPage = (log.Count - 1) / MaxEntriesPerPage;

View file

@ -8,7 +8,6 @@ using Server.Engines.MLQuests.Objectives;
using Server.Gumps; using Server.Gumps;
using Server.Items; using Server.Items;
using Server.Mobiles; using Server.Mobiles;
using Server.Utilities;
namespace Server.Engines.MLQuests namespace Server.Engines.MLQuests
{ {

View file

@ -3,7 +3,6 @@ using System.Collections.Generic;
using Server.Gumps; using Server.Gumps;
using Server.Items; using Server.Items;
using Server.Logging; using Server.Logging;
using Server.Utilities;
namespace Server.Engines.MLQuests.Objectives namespace Server.Engines.MLQuests.Objectives
{ {

View file

@ -2,7 +2,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using Server.Engines.MLQuests.Items; using Server.Engines.MLQuests.Items;
using Server.Mobiles; using Server.Mobiles;
using Server.Utilities;
namespace Server.Engines.MLQuests.Rewards namespace Server.Engines.MLQuests.Rewards
{ {

View file

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

View file

@ -1,6 +1,5 @@
using System; using System;
using Server.Items; using Server.Items;
using Server.Utilities;
namespace Server.Engines.Plants namespace Server.Engines.Plants
{ {

View file

@ -1,5 +1,4 @@
using System; using System;
using Server.Utilities;
namespace Server.Engines.Quests namespace Server.Engines.Quests
{ {

View file

@ -706,8 +706,6 @@ namespace Server.Engines.Quests
return (r << 10) | (g << 5) | b; return (r << 10) | (g << 5) | b;
} }
public static string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
public void AddHtmlObject(int x, int y, int width, int height, object message, int color, bool back, bool scroll) public void AddHtmlObject(int x, int y, int width, int height, object message, int color, bool back, bool scroll)
{ {
if (message is int html) if (message is int html)
@ -716,7 +714,7 @@ namespace Server.Engines.Quests
} }
else else
{ {
AddHtml(x, y, width, height, Color(message.ToString(), C16232(color)), back, scroll); AddHtml(x, y, width, height, message.ToString().Color(C16232(color)), back, scroll);
} }
} }
} }

View file

@ -2,7 +2,6 @@ using System;
using Server.Logging; using Server.Logging;
using Server.Regions; using Server.Regions;
using Server.Mobiles; using Server.Mobiles;
using Server.Utilities;
namespace Server.Engines.Quests; namespace Server.Engines.Quests;

View file

@ -7,7 +7,6 @@ using Server.Commands;
using Server.Items; using Server.Items;
using Server.Json; using Server.Json;
using Server.Mobiles; using Server.Mobiles;
using Server.Utilities;
using static Server.Attributes; using static Server.Attributes;
namespace Server.Engines.Spawners; namespace Server.Engines.Spawners;

View file

@ -11,7 +11,6 @@ using Server.Collections;
using Server.Json; using Server.Json;
using Server.Logging; using Server.Logging;
using Server.Network; using Server.Network;
using Server.Utilities;
namespace Server.Engines.Spawners; namespace Server.Engines.Spawners;

View file

@ -167,8 +167,8 @@ public class SpawnerGump : Gump
totalWeight += spawnerEntry.SpawnedProbability; totalWeight += spawnerEntry.SpawnedProbability;
} }
AddHtml(270, 308 + offset, 35, 20, $"<BASEFONT COLOR=#F4F4F4><CENTER>{totalSpawns}</CENTER></BASEFONT>"); AddHtml(270, 308 + offset, 35, 20, totalSpawns.ToString().Center(0xF4F4F4));
AddHtml(308, 308 + offset, 35, 20, $"<BASEFONT COLOR=#F4F4F4><CENTER>{totalWeight}</CENTER></BASEFONT>"); AddHtml(308, 308 + offset, 35, 20, totalWeight.ToString().Center(0xF4F4F4));
AddHtml(5, 1, 161, 20, $"<BASEFONT COLOR=#FFEA00>{spawner.Name}</BASEFONT><BASEFONT COLOR={GetCountColor(totalSpawned, spawner.Count)}> ({totalSpawned}/{spawner.Count})</BASEFONT>"); AddHtml(5, 1, 161, 20, $"<BASEFONT COLOR=#FFEA00>{spawner.Name}</BASEFONT><BASEFONT COLOR={GetCountColor(totalSpawned, spawner.Count)}> ({totalSpawned}/{spawner.Count})</BASEFONT>");

View file

@ -2,7 +2,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using Server.Items; using Server.Items;
using Server.Logging; using Server.Logging;
using Server.Utilities;
namespace Server.Engines.Stealables; namespace Server.Engines.Stealables;

View file

@ -11,7 +11,6 @@ using Server.Mobiles;
using Server.Multis; using Server.Multis;
using Server.Network; using Server.Network;
using Server.Regions; using Server.Regions;
using Server.Utilities;
namespace Server.Misc namespace Server.Misc
{ {

View file

@ -1,5 +1,4 @@
using System; using System;
using Server.Utilities;
namespace Server.Engines.VeteranRewards namespace Server.Engines.VeteranRewards
{ {

View file

@ -142,7 +142,7 @@ namespace Server.Gumps
if (notice != null) if (notice != null)
{ {
AddHtml(12, 392, 396, 36, Color(notice, LabelColor32)); AddHtml(12, 392, 396, 36, notice.Color(LabelColor32));
} }
switch (pageType) switch (pageType)
@ -259,7 +259,7 @@ namespace Server.Gumps
} }
case AdminGumpPage.Administer_WorldBuilding: 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(20, 175, GetButtonID(3, 101), "Teleporters");
AddButtonLabeled(220, 175, GetButtonID(3, 102), "Moongates"); AddButtonLabeled(220, 175, GetButtonID(3, 102), "Moongates");
@ -285,7 +285,7 @@ namespace Server.Gumps
} }
case AdminGumpPage.Administer_Server: 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"); AddButtonLabeled(20, 150, GetButtonID(3, 200), "Save");
@ -302,7 +302,7 @@ namespace Server.Gumps
AddLabel( 20, 215, LabelHue, "Shutdown/Restart not available." ); 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); AddTextField(20, 320, 380, 20, 0);
AddButtonLabeled(20, 350, GetButtonID(3, 210), "To Everyone"); AddButtonLabeled(20, 350, GetButtonID(3, 210), "To Everyone");
@ -312,15 +312,14 @@ namespace Server.Gumps
} }
case AdminGumpPage.Administer_Access_Lockdown: 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( AddHtml(
20, 20,
150, 150,
380, 380,
80, 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.".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.",
LabelColor32 LabelColor32
) )
); );
@ -358,9 +357,9 @@ namespace Server.Gumps
} }
case AdminGumpPage.Administer_Access: 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(20, 180, GetButtonID(3, 300), "Kick");
AddButtonLabeled(220, 180, GetButtonID(3, 301), "Ban"); AddButtonLabeled(220, 180, GetButtonID(3, 301), "Ban");
@ -368,7 +367,7 @@ namespace Server.Gumps
AddButtonLabeled(20, 210, GetButtonID(3, 302), "Firewall"); AddButtonLabeled(20, 210, GetButtonID(3, 302), "Firewall");
AddButtonLabeled(220, 210, GetButtonID(3, 303), "Lockdown"); 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, 270, GetButtonID(3, 310), "Make Player");
AddButtonLabeled(20, 290, GetButtonID(3, 311), "Make Counselor"); AddButtonLabeled(20, 290, GetButtonID(3, 311), "Make Counselor");
@ -394,7 +393,7 @@ namespace Server.Gumps
} }
case AdminGumpPage.Administer_Commands: 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(20, 150, GetButtonID(3, 400), "Add");
AddButtonLabeled(220, 150, GetButtonID(3, 401), "Remove"); AddButtonLabeled(220, 150, GetButtonID(3, 401), "Remove");
@ -532,7 +531,7 @@ namespace Server.Gumps
AddClientHeader(); AddClientHeader();
AddHtml(10, 125, 400, 20, Color(Center("Information"), LabelColor32)); AddHtml(10, 125, 400, 20, "Information".Center(LabelColor32));
var y = 146; var y = 146;
@ -816,7 +815,7 @@ namespace Server.Gumps
break; 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(20, 150, LabelHue, "Username:");
AddLabel(200, 150, LabelHue, a.Username); AddLabel(200, 150, LabelHue, a.Username);
@ -838,7 +837,7 @@ namespace Server.Gumps
break; 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(20, 150, LabelHue, "Username:");
AddLabel(200, 150, LabelHue, a.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(20, 150, LabelHue, "Username:");
AddLabel(200, 150, LabelHue, a.Username); AddLabel(200, 150, LabelHue, a.Username);
@ -960,7 +959,7 @@ namespace Server.Gumps
break; break;
} }
AddHtml(10, 125, 400, 20, Color(Center("Access"), LabelColor32)); AddHtml(10, 125, 400, 20, "Access".Center(LabelColor32));
AddPageButton( AddPageButton(
20, 20,
@ -988,7 +987,7 @@ namespace Server.Gumps
m_List ??= a.LoginIPs.ToList<object>(); 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, 225, GetButtonID(5, 16), "View all shared accounts");
AddButtonLabeled(227, 245, GetButtonID(5, 17), "Ban all shared accounts"); AddButtonLabeled(227, 245, GetButtonID(5, 17), "Ban all shared accounts");
@ -1000,13 +999,13 @@ namespace Server.Gumps
315, 315,
180, 180,
80, 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); AddImageTiled(15, 219, 206, 156, 0xBBC);
AddBlackAlpha(16, 220, 204, 154); 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) if (listPage > 0)
{ {
@ -1028,12 +1027,12 @@ namespace Server.Gumps
if (m_List.Count == 0) 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) 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(130, 242 + i * 22, 0xFA2, 0xFA4, GetButtonID(8, index));
AddButton(160, 242 + i * 22, 0xFA8, 0xFAA, GetButtonID(9, index)); AddButton(160, 242 + i * 22, 0xFA8, 0xFAA, GetButtonID(9, index));
AddButton(190, 242 + i * 22, 0xFB1, 0xFB3, GetButtonID(10, index)); AddButton(190, 242 + i * 22, 0xFB1, 0xFB3, GetButtonID(10, index));
@ -1050,7 +1049,7 @@ namespace Server.Gumps
m_List ??= a.IpRestrictions.ToList<object>(); 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); AddTextField(227, 225, 120, 20, 0);
@ -1061,8 +1060,7 @@ namespace Server.Gumps
255, 255,
180, 180,
120, 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.".Color(
"Any clients connecting from an address not in this list will be rejected. Or, if the list is empty, any client may connect.",
LabelColor32 LabelColor32
) )
); );
@ -1070,7 +1068,7 @@ namespace Server.Gumps
AddImageTiled(15, 219, 206, 156, 0xBBC); AddImageTiled(15, 219, 206, 156, 0xBBC);
AddBlackAlpha(16, 220, 204, 154); 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) if (listPage > 0)
{ {
@ -1092,12 +1090,12 @@ namespace Server.Gumps
if (m_List.Count == 0) 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) 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)); AddButton(190, 242 + i * 22, 0xFB1, 0xFB3, GetButtonID(8, index));
} }
@ -1110,7 +1108,7 @@ namespace Server.Gumps
break; 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(12, 150, 120, 20, LabelHue, "Name");
AddLabelCropped(132, 150, 120, 20, LabelHue, "Access Level"); AddLabelCropped(132, 150, 120, 20, LabelHue, "Access Level");
@ -1160,7 +1158,7 @@ namespace Server.Gumps
break; 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"); AddButtonLabeled(20, 150, GetButtonID(5, 4), "Add Comment");
@ -1199,7 +1197,7 @@ namespace Server.Gumps
break; 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"); AddButtonLabeled(20, 150, GetButtonID(5, 5), "Add Tag");
@ -1288,11 +1286,11 @@ namespace Server.Gumps
break; 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"); 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) if (m_List == null)
{ {
@ -1394,19 +1392,15 @@ namespace Server.Gumps
public void AddSelectedButton(int x, int y, int buttonID, string text, bool isSelection) public void AddSelectedButton(int x, int y, int buttonID, string text, bool isSelection)
{ {
AddButton(x, y - 1, isSelection ? 4006 : 4005, 4007, buttonID); 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) public void AddButtonLabeled(int x, int y, int buttonID, string text)
{ {
AddButton(x, y - 1, 4005, 4007, buttonID); 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) public void AddBlackAlpha(int x, int y, int width, int height)
{ {
AddImageTiled(x, y, width, height, 2624); AddImageTiled(x, y, width, height, 2624);

View file

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

View file

@ -31,57 +31,57 @@ namespace Server.Gumps
AddImageTiled(10, 32, 400, 272, 0xA40); AddImageTiled(10, 32, 400, 272, 0xA40);
AddAlphaRegion(10, 32, 400, 272); 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; var line = 0;
AddHtml(14, 36 + line * 20, 200, 20, Color("Address:", LabelColor32)); AddHtml(14, 36 + line * 20, 200, 20, "Address:".Color(LabelColor32));
AddHtml(70, 36 + line++ * 20, 200, 20, Color(state.ToString(), 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( AddHtml(
72, 72,
36 + line++ * 20, 36 + line++ * 20,
200, 200,
20, 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( AddHtml(
72, 72,
36 + line++ * 20, 36 + line++ * 20,
200, 200,
20, 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 info = state.ExpansionInfo;
var expansionName = info.Name; 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 a = state.Account as Account;
var m = state.Mobile; var m = state.Mobile;
if (from.AccessLevel >= AccessLevel.GameMaster && a != null) if (from.AccessLevel >= AccessLevel.GameMaster && a != null)
{ {
AddHtml(14, 36 + line * 20, 200, 20, Color("Account:", LabelColor32)); AddHtml(14, 36 + line * 20, 200, 20, "Account:".Color(LabelColor32));
AddHtml(72, 36 + line++ * 20, 200, 20, Color(a.Username, LabelColor32)); AddHtml(72, 36 + line++ * 20, 200, 20, a.Username.Color(LabelColor32));
} }
if (m != null) if (m != null)
{ {
AddHtml(14, 36 + line * 20, 200, 20, Color("Mobile:", LabelColor32)); AddHtml(14, 36 + line * 20, 200, 20, "Mobile:".Color(LabelColor32));
AddHtml(72, 36 + line++ * 20, 200, 20, Color($"{m.Name} ({m.Serial})", 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(14, 36 + line * 20, 200, 20, "Location:".Color(LabelColor32));
AddHtml(72, 36 + line++ * 20, 200, 20, Color($"{m.Location} [{m.Map}]", LabelColor32)); AddHtml(72, 36 + line++ * 20, 200, 20, $"{m.Location} [{m.Map}]".Color(LabelColor32));
AddButton(13, 197, 0xFAB, 0xFAD, 1); 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(12, 222, 376, 80, 0xA40);
AddImageTiled(13, 223, 374, 78, 0xBBC); AddImageTiled(13, 223, 374, 78, 0xBBC);
@ -97,42 +97,42 @@ namespace Server.Gumps
if (BaseCommand.IsAccessible(from, m)) if (BaseCommand.IsAccessible(from, m))
{ {
AddButton(266, 36 + line * 20, 0xFA5, 0xFA7, 4); 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) if (from != m)
{ {
AddButton(266, 36 + line * 20, 0xFA5, 0xFA7, 5); 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); 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); 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) if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > m.AccessLevel)
{ {
AddButton(266, 36 + line * 20, 0xFA5, 0xFA7, 8); 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) if (m.Alive)
{ {
AddButton(266, 36 + line * 20, 0xFA5, 0xFA7, 9); 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 else
{ {
AddButton(266, 36 + line * 20, 0xFA5, 0xFA7, 10); 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) if (from.AccessLevel >= AccessLevel.Counselor && from.AccessLevel > m.AccessLevel)
{ {
AddButton(266, 36 + line * 20, 0xFA5, 0xFA7, 11); 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 System;
using Server.Items; using Server.Items;
using Server.Network; using Server.Network;
using Server.Utilities;
namespace Server.Gumps namespace Server.Gumps
{ {

View file

@ -139,7 +139,5 @@ namespace Server.Guilds
AddHtml(x, y, width, height, text.String, back, scroll); 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]; 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[1] = g.Abbreviation;
defs[2] = 3000085; // Peace defs[2] = 3000085; // Peace
@ -186,7 +186,7 @@ namespace Server.Guilds
} }
else if (m_LowerText?.String != null) 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) if (AllowAdvancedSearch)

View file

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

View file

@ -85,13 +85,13 @@ namespace Server.Guilds
} }
else if (PendingWar) else if (PendingWar)
{ {
kills = Color($"{war.Kills}/{war.MaxKills}", 0x990000); kills = $"{war.Kills}/{war.MaxKills}".Color(0x990000);
time = Color($"{war.WarLength.Hours:D2}:{DateTime.MinValue + war.WarLength:mm}", 0x990000); time = $"{war.WarLength.Hours:D2}:{DateTime.MinValue + war.WarLength:mm}".Color(0x990000);
otherWar = m_Other.FindPendingWar(guild); otherWar = m_Other.FindPendingWar(guild);
if (otherWar != null) 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 // Withdraw Request
AddButtonAndBackground(20, 290, 14, 1062986); // 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)) 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, 260, 15, 1062988); // Deny Request
AddButtonAndBackground(20, 290, 16, 1062987); // Accept 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 else

View file

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

View file

@ -168,7 +168,7 @@ namespace Server.Gumps
y, y,
emptyWidth, emptyWidth,
EntryHeight, 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) 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); 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; 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) 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); AddImage(190, 17, 0x25EA);
@ -64,7 +64,7 @@ namespace Server.Gumps
var name = FindHouseName(list[i]); 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) if (name.Number > 0)
{ {
@ -72,7 +72,7 @@ namespace Server.Gumps
} }
else 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); AddButton(198, 39 + i % 15 * 20, 4005, 4007, i + 1);
@ -109,49 +109,49 @@ namespace Server.Gumps
location = "unknown"; 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, "Facet:".Color(White));
AddHtml(15, 40, 210, 20, Color(Right(map == null ? "(null)" : map.Name), 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, "Location:".Color(White));
AddHtml(15, 60, 210, 20, Color(Right(sel.Location.ToString()), White)); AddHtml(15, 60, 210, 20, sel.Location.ToString().Right(White));
AddHtml(15, 80, 210, 20, Color("Sextant:", White)); AddHtml(15, 80, 210, 20, "Sextant:".Color(White));
AddHtml(15, 80, 210, 20, Color(Right(location), White)); AddHtml(15, 80, 210, 20, location.Right(White));
AddHtml(15, 100, 210, 20, Color("Owner:", White)); AddHtml(15, 100, 210, 20, "Owner:".Color(White));
AddHtml(15, 100, 210, 20, Color(Right(owner), White)); AddHtml(15, 100, 210, 20, owner.Right(White));
AddHtml(15, 120, 210, 20, Color("Name:", White)); AddHtml(15, 120, 210, 20, "Name:".Color(White));
AddHtml(15, 120, 210, 20, Color(Right(houseName), White)); AddHtml(15, 120, 210, 20, houseName.Right(White));
AddHtml(15, 140, 210, 20, Color("Friends:", White)); AddHtml(15, 140, 210, 20, "Friends:".Color(White));
AddHtml(15, 140, 210, 20, Color(Right(sel.Friends.Count.ToString()), 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, "Co-Owners:".Color(White));
AddHtml(15, 160, 210, 20, Color(Right(sel.CoOwners.Count.ToString()), 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, "Bans:".Color(White));
AddHtml(15, 180, 210, 20, Color(Right(sel.Bans.Count.ToString()), 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, "Decays:".Color(White));
AddHtml(15, 200, 210, 20, Color(Right(sel.CanDecay ? "Yes" : "No"), 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, "Decay Level:".Color(White));
AddHtml(15, 220, 210, 20, Color(Right(sel.DecayLevel.ToString()), White)); AddHtml(15, 220, 210, 20, sel.DecayLevel.ToString().Right(White));
AddButton(15, 245, 4005, 4007, 1); 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); 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); 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); 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; 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) public void AddBlackAlpha(int x, int y, int width, int height)
{ {
AddImageTiled(x, y, width, height, 2624); 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.AddImageTiled(10, 40, _width - 20, _height - 80, 2624);
builder.AddAlphaRegion(10, 40, _width - 20, _height - 80); builder.AddAlphaRegion(10, 40, _width - 20, _height - 80);
if (_content != null) _content.AddHtmlText(
{ ref builder,
if (_content.Number > 0) 10,
{ 40,
builder.AddHtmlLocalized(10, 40, _width - 20, _height - 80, _content.Number, (short)_contentColor, false, true); _width - 20,
} _height - 80,
else scroll: true,
{ numberColor: _contentColor,
builder.AddHtml( stringColor: _contentColor
10, );
40,
_width - 20,
_height - 80,
$"<BASEFONT COLOR=#{_contentColor:X6}>{_content.String}</BASEFONT>",
false,
true
);
}
}
builder.AddImageTiled(10, _height - 30, _width - 20, 20, 2624); builder.AddImageTiled(10, _height - 30, _width - 20, 20, 2624);
builder.AddAlphaRegion(10, _height - 30, _width - 20, 20); builder.AddAlphaRegion(10, _height - 30, _width - 20, 20);

View file

@ -1,6 +1,5 @@
using System; using System;
using Server.Items; using Server.Items;
using Server.Utilities;
namespace Server.Events.Halloween namespace Server.Events.Halloween
{ {

View file

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

View file

@ -57,7 +57,7 @@ namespace Server.Items
AddItem(150, 80, item.ItemID, item.Hue); AddItem(150, 80, item.ItemID, item.Hue);
// item number / all items // 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 // remove item
if (edit) if (edit)

View file

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

View file

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

View file

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

View file

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

View file

@ -42,7 +42,7 @@ public class NameChangeDeedGump : Gump
AddPage(0); AddPage(0);
AddBlackAlpha(10, 120, 250, 85); 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(73, 15, 1152, "");
AddLabel(20, 150, 0x480, "New Name:"); 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, ""); 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) public void AddButtonLabeled(int x, int y, int buttonID, string text)
{ {
AddButton(x, y - 1, 4005, 4007, buttonID); 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) public override void OnResponse(NetState sender, in RelayInfo info)

View file

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

View file

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

View file

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

View file

@ -6,7 +6,6 @@ using Server.Spells.Chivalry;
using Server.Spells.Necromancy; using Server.Spells.Necromancy;
using Server.Spells.Ninjitsu; using Server.Spells.Ninjitsu;
using Server.Targeting; using Server.Targeting;
using Server.Utilities;
/* /*
* There really was no prettier way to do this, other than the one * 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.Collections.Generic;
using System.Runtime.CompilerServices;
using Server.Accounting; using Server.Accounting;
using Server.Items; using Server.Items;
using Server.Network; using Server.Network;
@ -60,31 +59,31 @@ public class HouseRaffleManagementGump : Gump
AddBackground(0, 0, 618, 354, 9270); AddBackground(0, 0, 618, 354, 9270);
AddAlphaRegion(10, 10, 598, 334); 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(45, 35, 100, 20, "Location:".Color(LabelColor));
AddHtml(145, 35, 250, 20, Color(HouseRaffleStone.FormatLocation(stone.PlotBounds, stone.GetPlotCenter(), stone.PlotFacet), 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(45, 55, 100, 20, "Ticket Price:".Color(LabelColor));
AddHtml(145, 55, 250, 20, Color(HouseRaffleStone.FormatPrice(stone.TicketPrice), LabelColor)); AddHtml(145, 55, 250, 20, HouseRaffleStone.FormatPrice(stone.TicketPrice).Color(LabelColor));
AddHtml(45, 75, 100, 20, Color("Total Entries:", LabelColor)); AddHtml(45, 75, 100, 20, "Total Entries:".Color(LabelColor));
AddHtml(145, 75, 250, 20, Color(_stone.Entries.Count.ToString(), LabelColor)); AddHtml(145, 75, 250, 20, _stone.Entries.Count.ToString().Color(LabelColor));
AddButton(440, 33, 0xFA5, 0xFA7, 3); 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); 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); 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(13, 99, 592, 242, 9264);
AddImageTiled(14, 100, 590, 240, 9274); AddImageTiled(14, 100, 590, 240, 9274);
AddAlphaRegion(14, 100, 590, 240); 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) if (page > 0)
{ {
@ -104,11 +103,11 @@ public class HouseRaffleManagementGump : Gump
AddImage(584, 104, 0x25E6); AddImage(584, 104, 0x25E6);
} }
AddHtml(14, 120, 30, 20, Color(Center("DEL"), LabelColor)); AddHtml(14, 120, 30, 20, "DEL".Center(LabelColor));
AddHtml(47, 120, 250, 20, Color("Name", LabelColor)); AddHtml(47, 120, 250, 20, "Name".Color(LabelColor));
AddHtml(295, 120, 100, 20, Color(Center("Address"), LabelColor)); AddHtml(295, 120, 100, 20, "Address".Center(LabelColor));
AddHtml(395, 120, 150, 20, Color(Center("Date"), LabelColor)); AddHtml(395, 120, 150, 20, "Date".Center(LabelColor));
AddHtml(545, 120, 60, 20, Color(Center("Num"), LabelColor)); AddHtml(545, 120, 60, 20, "Num".Center(LabelColor));
var idx = 0; var idx = 0;
var winner = _stone.Winner; var winner = _stone.Winner;
@ -131,11 +130,11 @@ public class HouseRaffleManagementGump : Gump
{ {
if (entry.From.Account is Account acc) 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 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) 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; 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; 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) public override void OnResponse(NetState sender, in RelayInfo info)
{ {
var from = sender.Mobile; 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 public static SkillName[] Skills
{ {

View file

@ -25,7 +25,7 @@ public partial class ScrollofTranscendence : SpecialScroll
public override int Message => 1094933; public override int Message => 1094933;
public override string DefaultTitle => 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) => public static ScrollofTranscendence CreateRandom(int min, int max) =>
new(Utility.RandomSkill(), Utility.RandomMinMax(min, max) / 10.0); new(Utility.RandomSkill(), Utility.RandomMinMax(min, max) / 10.0);

View file

@ -42,7 +42,7 @@ public partial class StatCapScroll : SpecialScroll
} }
public override string DefaultTitle => 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) public override void AddNameProperty(IPropertyList list)
{ {

View file

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

View file

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

View file

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

View file

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

View file

@ -445,15 +445,15 @@ namespace Server.Misc
title = "Shard Poll"; title = "Shard Poll";
} }
AddHtml(22, 22, 294, 20, Color(Center(title), LabelColor32)); AddHtml(22, 22, 294, 20, title.Center(LabelColor32));
if (editing) if (editing)
{ {
AddHtml(22, 22, 294, 20, Color($"{totalVotes} total", LabelColor32)); AddHtml(22, 22, 294, 20, $"{totalVotes} total".Color(LabelColor32));
AddButton(287, 23, 0x2622, 0x2623, 2); AddButton(287, 23, 0x2622, 0x2623, 2);
} }
AddHtml(22, 50, 294, 40, Color(poller.Title, 0x99CC66)); AddHtml(22, 50, 294, 40, poller.Title.Color(0x99CC66));
AddImageTiled(32, 88, 264, 1, 9107); AddImageTiled(32, 88, 264, 1, 9107);
AddImageTiled(42, 90, 264, 1, 9157); AddImageTiled(42, 90, 264, 1, 9157);
@ -485,7 +485,7 @@ namespace Server.Misc
AddRadio(24, y - 15, 0x25F9, 0x25FC, false, 1 + i); AddRadio(24, y - 15, 0x25F9, 0x25FC, false, 1 + i);
} }
AddHtml(60, y - 9 * option.LineBreaks, 250, 18 * option.LineBreaks, Color(text, LabelColor32)); AddHtml(60, y - 9 * option.LineBreaks, 250, 18 * option.LineBreaks, text.Color(LabelColor32));
y += optHeight / 2; y += optHeight / 2;
y += 5; y += 5;
@ -494,7 +494,7 @@ namespace Server.Misc
if (editing && !isViewingResults) if (editing && !isViewingResults)
{ {
AddRadio(24, y + 15 - 15, 0x25F9, 0x25FC, false, 1 + poller.Options.Length); AddRadio(24, y + 15 - 15, 0x25F9, 0x25FC, false, 1 + poller.Options.Length);
AddHtml(60, y + 15 - 9, 250, 18, Color("Create new option.", 0x99CC66)); AddHtml(60, y + 15 - 9, 250, 18, "Create new option.".Color(0x99CC66));
} }
AddButton(314, height - 73, 247, 248, 1); AddButton(314, height - 73, 247, 248, 1);
@ -510,10 +510,6 @@ namespace Server.Misc
m_Polls.Enqueue(poller); m_Polls.Enqueue(poller);
} }
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
public override void OnResponse(NetState sender, in RelayInfo info) public override void OnResponse(NetState sender, in RelayInfo info)
{ {
if (m_Polls?.Count > 0) if (m_Polls?.Count > 0)

View file

@ -35,7 +35,6 @@ using Server.Spells.Seventh;
using Server.Spells.Sixth; using Server.Spells.Sixth;
using Server.Spells.Spellweaving; using Server.Spells.Spellweaving;
using Server.Targeting; using Server.Targeting;
using Server.Utilities;
using BaseQuestGump = Server.Engines.MLQuests.Gumps.BaseQuestGump; using BaseQuestGump = Server.Engines.MLQuests.Gumps.BaseQuestGump;
using CalcMoves = Server.Movement.Movement; using CalcMoves = Server.Movement.Movement;
using QuestOfferGump = Server.Engines.MLQuests.Gumps.QuestOfferGump; using QuestOfferGump = Server.Engines.MLQuests.Gumps.QuestOfferGump;

View file

@ -1,6 +1,5 @@
using System; using System;
using Server.Items; using Server.Items;
using Server.Utilities;
namespace Server.Mobiles; namespace Server.Mobiles;

View file

@ -1,6 +1,5 @@
using System; using System;
using Server.Items; using Server.Items;
using Server.Utilities;
namespace Server.Mobiles namespace Server.Mobiles
{ {

View file

@ -1,7 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Server.Items; using Server.Items;
using Server.Utilities;
namespace Server.Mobiles namespace Server.Mobiles
{ {

Some files were not shown because too many files have changed in this diff Show more