diff --git a/Projects/Server.Tests/Tests/Network/Packets/Outgoing/GumpPacketTests.cs b/Projects/Server.Tests/Tests/Network/Packets/Outgoing/GumpPacketTests.cs index 56a8c0ead..4b9148df8 100644 --- a/Projects/Server.Tests/Tests/Network/Packets/Outgoing/GumpPacketTests.cs +++ b/Projects/Server.Tests/Tests/Network/Packets/Outgoing/GumpPacketTests.cs @@ -84,7 +84,7 @@ public class NameChangeDeedGump : Gump AddPage(0); 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(20, 150, 0x480, "New Name:"); @@ -105,13 +105,9 @@ public class NameChangeDeedGump : Gump AddTextEntry(x + 2, y + 2, width - 4, height - 4, 0, index, ""); } - public static string Center(string text) => $"
{text}
"; - - public static string Color(string text, int color) => $"{text}"; - public void AddButtonLabeled(int x, int y, int buttonID, string text) { AddButton(x, y - 1, 4005, 4007, buttonID); - AddHtml(x + 35, y, 240, 20, Color(text, 0xFFFFFF)); + AddHtml(x + 35, y, 240, 20, text.Color(0xFFFFFF)); } } diff --git a/Projects/Server.Tests/Tests/Utility/ActivatorExtensionsTests.cs b/Projects/Server.Tests/Tests/Utility/ActivatorExtensionsTests.cs index e4e5dddbd..ed331c2ff 100644 --- a/Projects/Server.Tests/Tests/Utility/ActivatorExtensionsTests.cs +++ b/Projects/Server.Tests/Tests/Utility/ActivatorExtensionsTests.cs @@ -1,4 +1,3 @@ -using Server.Utilities; using Xunit; namespace Server.Tests diff --git a/Projects/Server/Gumps/Legacy/Gump.cs b/Projects/Server/Gumps/Legacy/Gump.cs index 404db4a96..ac058dbf1 100644 --- a/Projects/Server/Gumps/Legacy/Gump.cs +++ b/Projects/Server/Gumps/Legacy/Gump.cs @@ -15,7 +15,6 @@ using System.Collections.Generic; using Server.Network; -using Server.Utilities; namespace Server.Gumps; diff --git a/Projects/Server/Items/VirtualCheck.cs b/Projects/Server/Items/VirtualCheck.cs index 05c56c45e..6adb3cd47 100644 --- a/Projects/Server/Items/VirtualCheck.cs +++ b/Projects/Server/Items/VirtualCheck.cs @@ -13,6 +13,7 @@ * along with this program. If not, see . * *************************************************************************/ +using System.Drawing; using ModernUO.Serialization; using Server.Gumps; using Server.Network; @@ -268,10 +269,7 @@ public sealed partial class VirtualCheck : Item AddImage(10, 8, 113); AddImage(360, 8, 113); - var title = - $"
BANK OF {User.RawName.ToUpper()}
"; - - AddHtml(40, 15, 320, 20, title); + AddHtml(40, 15, 320, 20, $"BANK OF {User.RawName.ToUpper()}".Center(0x2F4F4F)); // Platinum Row AddBackground(15, 60, 175, 20, 9300); diff --git a/Projects/Server/Mobiles/Mobile.cs b/Projects/Server/Mobiles/Mobile.cs index 9c49f0f1f..9f86c773b 100644 --- a/Projects/Server/Mobiles/Mobile.cs +++ b/Projects/Server/Mobiles/Mobile.cs @@ -15,7 +15,6 @@ using Server.Network; using Server.Prompts; using Server.Targeting; using Server.Text; -using Server.Utilities; using CalcMoves = Server.Movement.Movement; namespace Server; diff --git a/Projects/Server/Text/TextDefinitionExtensions.cs b/Projects/Server/Text/TextDefinitionExtensions.cs index a57b98643..d7f69278f 100644 --- a/Projects/Server/Text/TextDefinitionExtensions.cs +++ b/Projects/Server/Text/TextDefinitionExtensions.cs @@ -19,6 +19,106 @@ namespace Server; public static class TextDefinitionExtensions { + public static void AddHtmlText( + this TextDefinition def, + ref DynamicGumpBuilder builder, + int x, + int y, + int width, + int height, + bool back = false, + bool scroll = false, + int numberColor = -1, + int stringColor = -1 + ) + { + if (def == null) + { + return; + } + + if (def.Number > 0) + { + if (numberColor >= 0) // 5 bits per RGB component (15 bit RGB) + { + builder.AddHtmlLocalized(x, y, width, height, def.Number, numberColor, back, scroll); + } + else + { + builder.AddHtmlLocalized(x, y, width, height, def.Number, back, scroll); + } + } + else if (def.String != null) + { + if (stringColor >= 0) // 8 bits per RGB component (24 bit RGB) + { + builder.AddHtml( + x, + y, + width, + height, + def.String.Color(stringColor), + back, + scroll + ); + } + else + { + builder.AddHtml(x, y, width, height, def.String, back, scroll); + } + } + } + + public static void AddHtmlText( + this TextDefinition def, + ref StaticGumpBuilder builder, + int x, + int y, + int width, + int height, + bool back = false, + bool scroll = false, + int numberColor = -1, + int stringColor = -1 + ) + { + if (def == null) + { + return; + } + + if (def.Number > 0) + { + if (numberColor >= 0) // 5 bits per RGB component (15 bit RGB) + { + builder.AddHtmlLocalized(x, y, width, height, def.Number, numberColor, back, scroll); + } + else + { + builder.AddHtmlLocalized(x, y, width, height, def.Number, back, scroll); + } + } + else if (def.String != null) + { + if (stringColor >= 0) // 8 bits per RGB component (24 bit RGB) + { + builder.AddHtml( + x, + y, + width, + height, + def.String.Color(stringColor), + back, + scroll + ); + } + else + { + builder.AddHtml(x, y, width, height, def.String, back, scroll); + } + } + } + public static void AddHtmlText( this TextDefinition def, Gump g, @@ -57,7 +157,7 @@ public static class TextDefinitionExtensions y, width, height, - $"{def.String}", + def.String.Color(stringColor), back, scroll ); @@ -102,7 +202,7 @@ public static class TextDefinitionExtensions y, width, height, - $"{string.Format(def.String, args)}", + string.Format(def.String, args).Color(stringColor), back, scroll ); diff --git a/Projects/Server/Utilities/ActivatorExtensions.cs b/Projects/Server/Utilities/ActivatorExtensions.cs index f2c0b69ee..724fd7d72 100644 --- a/Projects/Server/Utilities/ActivatorExtensions.cs +++ b/Projects/Server/Utilities/ActivatorExtensions.cs @@ -16,7 +16,7 @@ using System; using System.Reflection; -namespace Server.Utilities; +namespace Server; public static class ActivatorExtensions { diff --git a/Projects/Server/Utilities/EntityActivatorExtensions.cs b/Projects/Server/Utilities/EntityActivatorExtensions.cs index 131df0d3c..191b96458 100644 --- a/Projects/Server/Utilities/EntityActivatorExtensions.cs +++ b/Projects/Server/Utilities/EntityActivatorExtensions.cs @@ -16,7 +16,7 @@ using System; using System.Reflection; -namespace Server.Utilities; +namespace Server; public static class EntityActivatorExtensions { diff --git a/Projects/Server/Utilities/Html.cs b/Projects/Server/Utilities/Html.cs index 86a1f5e6b..ef2f18b8b 100644 --- a/Projects/Server/Utilities/Html.cs +++ b/Projects/Server/Utilities/Html.cs @@ -16,7 +16,7 @@ using System.Runtime.CompilerServices; using System.Text; -namespace Server.Utilities; +namespace Server; public static class Html { @@ -47,6 +47,21 @@ public static class Html [MethodImpl(MethodImplOptions.AggressiveInlining)] public static string Center(this string text, string color, int size) => $"
{text}
"; + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static string Right(this string text) => $"{text}"; + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static string Right(this string text, int color) => $"{text}"; + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static string Right(this string text, int color, int size) => $"{text}"; + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static string Right(this string text, string color) => $"{text}"; + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static string Right(this string text, string color, int size) => $"{text}"; + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static string EscapeHtml(this string input) => new StringBuilder(input.Length).Append(input) diff --git a/Projects/UOContent/Commands/Dupe.cs b/Projects/UOContent/Commands/Dupe.cs index 0f43a116b..092f84bb3 100644 --- a/Projects/UOContent/Commands/Dupe.cs +++ b/Projects/UOContent/Commands/Dupe.cs @@ -1,7 +1,6 @@ using System; using Server.Items; using Server.Targeting; -using Server.Utilities; namespace Server.Commands { diff --git a/Projects/UOContent/Commands/GenCommands.cs b/Projects/UOContent/Commands/GenCommands.cs index 22fab6953..0892e1539 100644 --- a/Projects/UOContent/Commands/GenCommands.cs +++ b/Projects/UOContent/Commands/GenCommands.cs @@ -4,7 +4,6 @@ using System.Text; using System.Text.Json; using Server.Commands.Generic; using Server.Json; -using Server.Utilities; namespace Server.Commands; diff --git a/Projects/UOContent/Commands/Generic/Extensions/Compilers/ConditionalCompiler.cs b/Projects/UOContent/Commands/Generic/Extensions/Compilers/ConditionalCompiler.cs index 76b14a2a5..9722d6f36 100644 --- a/Projects/UOContent/Commands/Generic/Extensions/Compilers/ConditionalCompiler.cs +++ b/Projects/UOContent/Commands/Generic/Extensions/Compilers/ConditionalCompiler.cs @@ -2,7 +2,6 @@ using System; using System.Globalization; using System.Reflection; using System.Reflection.Emit; -using Server.Utilities; namespace Server.Commands.Generic { diff --git a/Projects/UOContent/Commands/Generic/Extensions/Compilers/DistinctCompiler.cs b/Projects/UOContent/Commands/Generic/Extensions/Compilers/DistinctCompiler.cs index f64d1e62a..9e96ff2f7 100644 --- a/Projects/UOContent/Commands/Generic/Extensions/Compilers/DistinctCompiler.cs +++ b/Projects/UOContent/Commands/Generic/Extensions/Compilers/DistinctCompiler.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Reflection; using System.Reflection.Emit; -using Server.Utilities; namespace Server.Commands.Generic { diff --git a/Projects/UOContent/Commands/Generic/Extensions/Compilers/SortCompiler.cs b/Projects/UOContent/Commands/Generic/Extensions/Compilers/SortCompiler.cs index bce1d53ae..a597ece98 100644 --- a/Projects/UOContent/Commands/Generic/Extensions/Compilers/SortCompiler.cs +++ b/Projects/UOContent/Commands/Generic/Extensions/Compilers/SortCompiler.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Reflection; using System.Reflection.Emit; -using Server.Utilities; namespace Server.Commands.Generic { diff --git a/Projects/UOContent/Commands/HelpInfo.cs b/Projects/UOContent/Commands/HelpInfo.cs index 4b1e81186..25429088d 100644 --- a/Projects/UOContent/Commands/HelpInfo.cs +++ b/Projects/UOContent/Commands/HelpInfo.cs @@ -349,7 +349,7 @@ public static class HelpInfo 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(); @@ -402,9 +402,5 @@ public static class HelpInfo AddHtml(10, 40, width - 20, height - 80, sb.ToString(), false, true); } - - public static string Color(string text, int color) => $"{text}"; - - public static string Center(string text) => $"
{text}
"; } } diff --git a/Projects/UOContent/Commands/Object Creation/CAGLoader.cs b/Projects/UOContent/Commands/Object Creation/CAGLoader.cs index a9aa27cb4..add061da8 100644 --- a/Projects/UOContent/Commands/Object Creation/CAGLoader.cs +++ b/Projects/UOContent/Commands/Object Creation/CAGLoader.cs @@ -21,7 +21,6 @@ using System.Text.Json.Serialization; using Server.Items; using Server.Json; using Server.Logging; -using Server.Utilities; namespace Server.Commands; diff --git a/Projects/UOContent/Commands/Object Creation/Decorate.cs b/Projects/UOContent/Commands/Object Creation/Decorate.cs index a092bcaac..8746fbf46 100644 --- a/Projects/UOContent/Commands/Object Creation/Decorate.cs +++ b/Projects/UOContent/Commands/Object Creation/Decorate.cs @@ -8,7 +8,6 @@ using Server.Engines.Quests.Necro; using Server.Engines.Spawners; using Server.Items; using Server.Network; -using Server.Utilities; using MemoryExtensions = System.MemoryExtensions; namespace Server.Commands diff --git a/Projects/UOContent/Commands/Object Creation/DecorateMag.cs b/Projects/UOContent/Commands/Object Creation/DecorateMag.cs index f263a2ad7..ddcb80d22 100644 --- a/Projects/UOContent/Commands/Object Creation/DecorateMag.cs +++ b/Projects/UOContent/Commands/Object Creation/DecorateMag.cs @@ -8,7 +8,6 @@ using Server.Engines.Quests.Necro; using Server.Engines.Spawners; using Server.Items; using Server.Network; -using Server.Utilities; using MemoryExtensions = System.MemoryExtensions; namespace Server.Commands diff --git a/Projects/UOContent/Engines/Advanced Search/AdvancedSearchWarningGump.cs b/Projects/UOContent/Engines/Advanced Search/AdvancedSearchWarningGump.cs index 83748de55..0bcc51014 100644 --- a/Projects/UOContent/Engines/Advanced Search/AdvancedSearchWarningGump.cs +++ b/Projects/UOContent/Engines/Advanced Search/AdvancedSearchWarningGump.cs @@ -22,7 +22,7 @@ public abstract class AdvancedSearchWarningGump : Gump 10, width - 20, 20, - $"{header}" + header.Color(headerColor) ); AddImageTiled(10, 40, width - 20, height - 80, 2624); @@ -35,9 +35,8 @@ public abstract class AdvancedSearchWarningGump : Gump 40, width - 20, height - 80, - $"{content}", - false, - true + content.Color(contentColor), + scrollbar: true ); } diff --git a/Projects/UOContent/Engines/CannedEvil/ChampionSpawn.cs b/Projects/UOContent/Engines/CannedEvil/ChampionSpawn.cs index 1f081fa90..76c791ef1 100755 --- a/Projects/UOContent/Engines/CannedEvil/ChampionSpawn.cs +++ b/Projects/UOContent/Engines/CannedEvil/ChampionSpawn.cs @@ -24,7 +24,6 @@ using Server.Items; using Server.Mobiles; using Server.Regions; using Server.Logging; -using Server.Utilities; namespace Server.Engines.CannedEvil; diff --git a/Projects/UOContent/Engines/ConPVP/AcceptDuelGump.cs b/Projects/UOContent/Engines/ConPVP/AcceptDuelGump.cs index 847d7613b..6d005605d 100644 --- a/Projects/UOContent/Engines/ConPVP/AcceptDuelGump.cs +++ b/Projects/UOContent/Engines/ConPVP/AcceptDuelGump.cs @@ -49,62 +49,60 @@ namespace Server.Engines.ConPVP AddImage(215, -43, 0xEE40); // AddImage( 330, 141, 0x8BA ); - AddHtml(22 - 1, 22, 294, 20, Color(Center("Duel Challenge"), BlackColor32)); - AddHtml(22 + 1, 22, 294, 20, Color(Center("Duel Challenge"), BlackColor32)); - AddHtml(22, 22 - 1, 294, 20, Color(Center("Duel Challenge"), BlackColor32)); - AddHtml(22, 22 + 1, 294, 20, Color(Center("Duel Challenge"), BlackColor32)); - AddHtml(22, 22, 294, 20, Color(Center("Duel Challenge"), LabelColor32)); + var duelChallengeBlack = "Duel Challenge".Center(BlackColor32); + AddHtml(22 - 1, 22, 294, 20, duelChallengeBlack); + AddHtml(22 + 1, 22, 294, 20, duelChallengeBlack); + AddHtml(22, 22 - 1, 294, 20, duelChallengeBlack); + AddHtml(22, 22 + 1, 294, 20, duelChallengeBlack); + AddHtml(22, 22, 294, 20, "Duel Challenge".Center(LabelColor32)); - string fmt; + var accept = p.Contains(challenger) + ? $"You have been asked to join sides with {challenger.Name} in a duel. Do you accept?" + : $"You have been challenged to a duel from {challenger.Name}. Do you accept?"; - if (p.Contains(challenger)) - { - fmt = "You have been asked to join sides with {0} in a duel. Do you accept?"; - } - else - { - fmt = "You have been challenged to a duel from {0}. Do you accept?"; - } + var acceptBlack = accept.Color(BlackColor32); - AddHtml(22 - 1, 50, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32)); - AddHtml(22 + 1, 50, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32)); - AddHtml(22, 50 - 1, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32)); - AddHtml(22, 50 + 1, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32)); - AddHtml(22, 50, 294, 40, Color(string.Format(fmt, challenger.Name), 0xB0C868)); + AddHtml(22 - 1, 50, 294, 40, acceptBlack); + AddHtml(22 + 1, 50, 294, 40, acceptBlack); + AddHtml(22, 50 - 1, 294, 40, acceptBlack); + AddHtml(22, 50 + 1, 294, 40, acceptBlack); + AddHtml(22, 50, 294, 40, accept.Color(0xB0C868)); AddImageTiled(32, 88, 264, 1, 9107); AddImageTiled(42, 90, 264, 1, 9157); + var yesBlack = "Yes, I will fight this duel.".Color(BlackColor32); + AddRadio(24, 100, 9727, 9730, true, 1); - AddHtml(60 - 1, 105, 250, 20, Color("Yes, I will fight this duel.", BlackColor32)); - AddHtml(60 + 1, 105, 250, 20, Color("Yes, I will fight this duel.", BlackColor32)); - AddHtml(60, 105 - 1, 250, 20, Color("Yes, I will fight this duel.", BlackColor32)); - AddHtml(60, 105 + 1, 250, 20, Color("Yes, I will fight this duel.", BlackColor32)); - AddHtml(60, 105, 250, 20, Color("Yes, I will fight this duel.", LabelColor32)); + AddHtml(60 - 1, 105, 250, 20, yesBlack); + AddHtml(60 + 1, 105, 250, 20, yesBlack); + AddHtml(60, 105 - 1, 250, 20, yesBlack); + AddHtml(60, 105 + 1, 250, 20, yesBlack); + AddHtml(60, 105, 250, 20, "Yes, I will fight this duel.".Color(LabelColor32)); + + var noBlack = "No, I do not wish to fight.".Color(BlackColor32); AddRadio(24, 135, 9727, 9730, false, 2); - AddHtml(60 - 1, 140, 250, 20, Color("No, I do not wish to fight.", BlackColor32)); - AddHtml(60 + 1, 140, 250, 20, Color("No, I do not wish to fight.", BlackColor32)); - AddHtml(60, 140 - 1, 250, 20, Color("No, I do not wish to fight.", BlackColor32)); - AddHtml(60, 140 + 1, 250, 20, Color("No, I do not wish to fight.", BlackColor32)); - AddHtml(60, 140, 250, 20, Color("No, I do not wish to fight.", LabelColor32)); + AddHtml(60 - 1, 140, 250, 20, noBlack); + AddHtml(60 + 1, 140, 250, 20, noBlack); + AddHtml(60, 140 - 1, 250, 20, noBlack); + AddHtml(60, 140 + 1, 250, 20, noBlack); + AddHtml(60, 140, 250, 20, "No, I do not wish to fight.".Color(LabelColor32)); + + var noAskBlack = "No, knave. Do not ask again.".Color(BlackColor32); AddRadio(24, 170, 9727, 9730, false, 3); - AddHtml(60 - 1, 175, 250, 20, Color("No, knave. Do not ask again.", BlackColor32)); - AddHtml(60 + 1, 175, 250, 20, Color("No, knave. Do not ask again.", BlackColor32)); - AddHtml(60, 175 - 1, 250, 20, Color("No, knave. Do not ask again.", BlackColor32)); - AddHtml(60, 175 + 1, 250, 20, Color("No, knave. Do not ask again.", BlackColor32)); - AddHtml(60, 175, 250, 20, Color("No, knave. Do not ask again.", LabelColor32)); + AddHtml(60 - 1, 175, 250, 20, noAskBlack); + AddHtml(60 + 1, 175, 250, 20, noAskBlack); + AddHtml(60, 175 - 1, 250, 20, noAskBlack); + AddHtml(60, 175 + 1, 250, 20, noAskBlack); + AddHtml(60, 175, 250, 20, "No, knave. Do not ask again.".Color(LabelColor32)); AddButton(314, 173, 247, 248, 1); Timer.StartTimer(TimeSpan.FromSeconds(15.0), AutoReject); } - public string Center(string text) => $"
{text}
"; - - public string Color(string text, int color) => $"{text}"; - public void AutoReject() { if (!m_Active) diff --git a/Projects/UOContent/Engines/ConPVP/Games/BombingRun.cs b/Projects/UOContent/Engines/ConPVP/Games/BombingRun.cs index 5b4a22e93..6e87cef44 100644 --- a/Projects/UOContent/Engines/ConPVP/Games/BombingRun.cs +++ b/Projects/UOContent/Engines/ConPVP/Games/BombingRun.cs @@ -1147,7 +1147,7 @@ namespace Server.Engines.ConPVP AddImage(215, -45, 0xEE40); // AddImage( 330, 141, 0x8BA ); - AddBorderedText(22, 22, 294, 20, Center("BR Scoreboard"), LabelColor32, BlackColor32); + AddBorderedText(22, 22, 294, 20, "BR Scoreboard".Center(), LabelColor32, BlackColor32); AddImageTiled(32, 50, 264, 1, 9107); AddImageTiled(42, 52, 264, 1, 9157); @@ -1165,40 +1165,18 @@ namespace Server.Engines.ConPVP AddImage(24, 60 + i * 75, teamInfo == ourTeam ? 9730 : 9727, teamInfo.Color - 1); - var nameColor = LabelColor32; - var borderColor = BlackColor32; - - switch (teamInfo.Color) + var borderColor = teamInfo.Color == 0x455 ? LabelColor32 : BlackColor32; + var nameColor = teamInfo.Color switch { - case 0x47E: - nameColor = 0xFFFFFF; - break; - - case 0x4F2: - nameColor = 0x3399FF; - break; - - case 0x4F7: - nameColor = 0x33FF33; - break; - - case 0x4FC: - nameColor = 0xFF00FF; - break; - - case 0x021: - nameColor = 0xFF3333; - break; - - case 0x01A: - nameColor = 0xFF66FF; - break; - - case 0x455: - nameColor = 0x333333; - borderColor = 0xFFFFFF; - break; - } + 0x47E => 0xFFFFFF, + 0x4F2 => 0x3399FF, + 0x4F7 => 0x33FF33, + 0x4FC => 0xFF00FF, + 0x021 => 0xFF3333, + 0x01A => 0xFF66FF, + 0x455 => 0x333333, + _ => LabelColor32 + }; AddBorderedText( 60, @@ -1241,10 +1219,6 @@ namespace Server.Engines.ConPVP AddButton(314, height - 42, 247, 248, 1); } - public string Center(string text) => $"
{text}
"; - - public string Color(string text, int color) => $"{text}"; - private void AddBorderedText(int x, int y, int width, int height, string text, int color, int borderColor) { AddColoredText(x - 1, y - 1, width, height, text, borderColor); @@ -1256,14 +1230,7 @@ namespace Server.Engines.ConPVP private void AddColoredText(int x, int y, int width, int height, string text, int color) { - if (color == 0) - { - AddHtml(x, y, width, height, text); - } - else - { - AddHtml(x, y, width, height, Color(text, color)); - } + AddHtml(x, y, width, height, color == 0 ? text : text.Color(color)); } } diff --git a/Projects/UOContent/Engines/ConPVP/Games/CTF.cs b/Projects/UOContent/Engines/ConPVP/Games/CTF.cs index 9f9d42b14..eea8bb3fa 100644 --- a/Projects/UOContent/Engines/ConPVP/Games/CTF.cs +++ b/Projects/UOContent/Engines/ConPVP/Games/CTF.cs @@ -117,7 +117,7 @@ namespace Server.Engines.ConPVP AddImage(215, -45, 0xEE40); // AddImage( 330, 141, 0x8BA ); - AddBorderedText(22, 22, 294, 20, Center("CTF Scoreboard"), LabelColor32, BlackColor32); + AddBorderedText(22, 22, 294, 20, "CTF Scoreboard".Center(), LabelColor32, BlackColor32); AddImageTiled(32, 50, 264, 1, 9107); AddImageTiled(42, 52, 264, 1, 9157); @@ -140,40 +140,18 @@ namespace Server.Engines.ConPVP AddImage(24, 60 + i * 75, teamInfo == ourTeam ? 9730 : 9727, teamInfo.Color - 1); - var nameColor = LabelColor32; - var borderColor = BlackColor32; - - switch (teamInfo.Color) + var borderColor = teamInfo.Color == 0x455 ? LabelColor32 : BlackColor32; + var nameColor = teamInfo.Color switch { - case 0x47E: - nameColor = 0xFFFFFF; - break; - - case 0x4F2: - nameColor = 0x3399FF; - break; - - case 0x4F7: - nameColor = 0x33FF33; - break; - - case 0x4FC: - nameColor = 0xFF00FF; - break; - - case 0x021: - nameColor = 0xFF3333; - break; - - case 0x01A: - nameColor = 0xFF66FF; - break; - - case 0x455: - nameColor = 0x333333; - borderColor = 0xFFFFFF; - break; - } + 0x47E => 0xFFFFFF, + 0x4F2 => 0x3399FF, + 0x4F7 => 0x33FF33, + 0x4FC => 0xFF00FF, + 0x021 => 0xFF3333, + 0x01A => 0xFF66FF, + 0x455 => 0x333333, + _ => LabelColor32 + }; AddBorderedText( 60, @@ -216,10 +194,6 @@ namespace Server.Engines.ConPVP AddButton(314, height - 42, 247, 248, 1); } - public string Center(string text) => $"
{text}
"; - - public string Color(string text, int color) => $"{text}"; - private void AddBorderedText(int x, int y, int width, int height, string text, int color, int borderColor) { AddColoredText(x - 1, y - 1, width, height, text, borderColor); @@ -231,14 +205,7 @@ namespace Server.Engines.ConPVP private void AddColoredText(int x, int y, int width, int height, string text, int color) { - if (color == 0) - { - AddHtml(x, y, width, height, text); - } - else - { - AddHtml(x, y, width, height, Color(text, color)); - } + AddHtml(x, y, width, height, color == 0 ? text : text.Color(color)); } } diff --git a/Projects/UOContent/Engines/ConPVP/Games/DoubleDom.cs b/Projects/UOContent/Engines/ConPVP/Games/DoubleDom.cs index 5df33519e..8644f6631 100644 --- a/Projects/UOContent/Engines/ConPVP/Games/DoubleDom.cs +++ b/Projects/UOContent/Engines/ConPVP/Games/DoubleDom.cs @@ -113,7 +113,7 @@ namespace Server.Engines.ConPVP AddImage(215, -45, 0xEE40); // AddImage( 330, 141, 0x8BA ); - AddBorderedText(22, 22, 294, 20, Center("DD Scoreboard"), LabelColor32, BlackColor32); + AddBorderedText(22, 22, 294, 20, "DD Scoreboard".Center(), LabelColor32, BlackColor32); AddImageTiled(32, 50, 264, 1, 9107); AddImageTiled(42, 52, 264, 1, 9157); @@ -134,40 +134,18 @@ namespace Server.Engines.ConPVP AddImage(24, 60 + i * 75, teamInfo == ourTeam ? 9730 : 9727, teamInfo.Color - 1); - var nameColor = LabelColor32; - var borderColor = BlackColor32; - - switch (teamInfo.Color) + var borderColor = teamInfo.Color == 0x455 ? LabelColor32 : BlackColor32; + var nameColor = teamInfo.Color switch { - case 0x47E: - nameColor = 0xFFFFFF; - break; - - case 0x4F2: - nameColor = 0x3399FF; - break; - - case 0x4F7: - nameColor = 0x33FF33; - break; - - case 0x4FC: - nameColor = 0xFF00FF; - break; - - case 0x021: - nameColor = 0xFF3333; - break; - - case 0x01A: - nameColor = 0xFF66FF; - break; - - case 0x455: - nameColor = 0x333333; - borderColor = 0xFFFFFF; - break; - } + 0x47E => 0xFFFFFF, + 0x4F2 => 0x3399FF, + 0x4F7 => 0x33FF33, + 0x4FC => 0xFF00FF, + 0x021 => 0xFF3333, + 0x01A => 0xFF66FF, + 0x455 => 0x333333, + _ => LabelColor32 + }; AddBorderedText( 60, @@ -210,10 +188,6 @@ namespace Server.Engines.ConPVP AddButton(314, height - 42, 247, 248, 1); } - public string Center(string text) => $"
{text}
"; - - public string Color(string text, int color) => $"{text}"; - private void AddBorderedText(int x, int y, int width, int height, string text, int color, int borderColor) { AddColoredText(x - 1, y - 1, width, height, text, borderColor); @@ -225,14 +199,7 @@ namespace Server.Engines.ConPVP private void AddColoredText(int x, int y, int width, int height, string text, int color) { - if (color == 0) - { - AddHtml(x, y, width, height, text); - } - else - { - AddHtml(x, y, width, height, Color(text, color)); - } + AddHtml(x, y, width, height, color == 0 ? text : text.Color(color)); } } diff --git a/Projects/UOContent/Engines/ConPVP/Games/KingOfTheHill.cs b/Projects/UOContent/Engines/ConPVP/Games/KingOfTheHill.cs index 5f9372d9b..ddd09d80b 100644 --- a/Projects/UOContent/Engines/ConPVP/Games/KingOfTheHill.cs +++ b/Projects/UOContent/Engines/ConPVP/Games/KingOfTheHill.cs @@ -399,7 +399,7 @@ namespace Server.Engines.ConPVP AddImage(215, -45, 0xEE40); // AddImage( 330, 141, 0x8BA ); - AddBorderedText(22, 22, 294, 20, Center("King of the Hill Scoreboard"), LabelColor32, BlackColor32); + AddBorderedText(22, 22, 294, 20, "King of the Hill Scoreboard".Center(), LabelColor32, BlackColor32); AddImageTiled(32, 50, 264, 1, 9107); AddImageTiled(42, 52, 264, 1, 9157); @@ -415,40 +415,18 @@ namespace Server.Engines.ConPVP AddImage(24, 60 + i * 75, teamInfo == ourTeam ? 9730 : 9727, teamInfo.Color - 1); - var nameColor = LabelColor32; - var borderColor = BlackColor32; - - switch (teamInfo.Color) + var borderColor = teamInfo.Color == 0x455 ? LabelColor32 : BlackColor32; + var nameColor = teamInfo.Color switch { - case 0x47E: - nameColor = 0xFFFFFF; - break; - - case 0x4F2: - nameColor = 0x3399FF; - break; - - case 0x4F7: - nameColor = 0x33FF33; - break; - - case 0x4FC: - nameColor = 0xFF00FF; - break; - - case 0x021: - nameColor = 0xFF3333; - break; - - case 0x01A: - nameColor = 0xFF66FF; - break; - - case 0x455: - nameColor = 0x333333; - borderColor = 0xFFFFFF; - break; - } + 0x47E => 0xFFFFFF, + 0x4F2 => 0x3399FF, + 0x4F7 => 0x33FF33, + 0x4FC => 0xFF00FF, + 0x021 => 0xFF3333, + 0x01A => 0xFF66FF, + 0x455 => 0x333333, + _ => LabelColor32 + }; AddBorderedText( 60, @@ -478,10 +456,6 @@ namespace Server.Engines.ConPVP AddButton(314, height - 42, 247, 248, 1); } - public string Center(string text) => $"
{text}
"; - - public string Color(string text, int color) => $"{text}"; - private void AddBorderedText(int x, int y, int width, int height, string text, int color, int borderColor) { AddColoredText(x - 1, y - 1, width, height, text, borderColor); @@ -493,14 +467,7 @@ namespace Server.Engines.ConPVP private void AddColoredText(int x, int y, int width, int height, string text, int color) { - if (color == 0) - { - AddHtml(x, y, width, height, text); - } - else - { - AddHtml(x, y, width, height, Color(text, color)); - } + AddHtml(x, y, width, height, color == 0 ? text : text.Color(color)); } } diff --git a/Projects/UOContent/Engines/ConPVP/Gumps/AcceptTeamGump.cs b/Projects/UOContent/Engines/ConPVP/Gumps/AcceptTeamGump.cs index d4c8418f1..d7a93a578 100644 --- a/Projects/UOContent/Engines/ConPVP/Gumps/AcceptTeamGump.cs +++ b/Projects/UOContent/Engines/ConPVP/Gumps/AcceptTeamGump.cs @@ -122,7 +122,7 @@ namespace Server.Engines.ConPVP sb.Append(" Tournament Invitation"); - AddBorderedText(22, 22, 294, 20, Center(sb.ToString()), LabelColor32, BlackColor32); + AddBorderedText(22, 22, 294, 20, sb.ToString().Center(), LabelColor32, BlackColor32); AddBorderedText( 22, @@ -244,10 +244,6 @@ namespace Server.Engines.ConPVP Timer.StartTimer(TimeSpan.FromSeconds(15.0), AutoReject); } - public string Center(string text) => $"
{text}
"; - - public string Color(string text, int color) => $"{text}"; - private void AddBorderedText(int x, int y, int width, int height, string text, int color, int borderColor) { AddColoredText(x - 1, y - 1, width, height, text, borderColor); @@ -259,14 +255,7 @@ namespace Server.Engines.ConPVP private void AddColoredText(int x, int y, int width, int height, string text, int color) { - if (color == 0) - { - AddHtml(x, y, width, height, text); - } - else - { - AddHtml(x, y, width, height, Color(text, color)); - } + AddHtml(x, y, width, height, color == 0 ? text : text.Color(color)); } public void AutoReject() diff --git a/Projects/UOContent/Engines/ConPVP/Gumps/ArenaGump.cs b/Projects/UOContent/Engines/ConPVP/Gumps/ArenaGump.cs index 8792d33b1..63ba39031 100644 --- a/Projects/UOContent/Engines/ConPVP/Gumps/ArenaGump.cs +++ b/Projects/UOContent/Engines/ConPVP/Gumps/ArenaGump.cs @@ -188,7 +188,7 @@ namespace Server.Engines.ConPVP AddBorderedText(x + 5, y + 5, 325 - 5, sb.ToString(), color, 0); x += 325; - AddBorderedText(x, y + 5, 40, Center(ar.Spectators.ToString()), color, 0); + AddBorderedText(x, y + 5, 40, ar.Spectators.ToString().Center(), color, 0); } } @@ -263,10 +263,6 @@ namespace Server.Engines.ConPVP } } - public string Center(string text) => $"
{text}
"; - - public string Color(string text, int color) => $"{text}"; - private void AddBorderedText(int x, int y, int width, string text, int color, int borderColor) { /*AddColoredText( x - 1, y, width, text, borderColor ); @@ -280,14 +276,7 @@ namespace Server.Engines.ConPVP private void AddColoredText(int x, int y, int width, string text, int color) { - if (color == 0) - { - AddHtml(x, y, width, 20, text); - } - else - { - AddHtml(x, y, width, 20, Color(text, color)); - } + AddHtml(x, y, width, 20, color == 0 ? text : text.Color(color)); } private void AddColumnHeader(int width, string name) @@ -297,7 +286,7 @@ namespace Server.Engines.ConPVP if (name != null) { - AddBorderedText(m_ColumnX, 13, width, Center(name), 0xFFFFFF, 0); + AddBorderedText(m_ColumnX, 13, width, name.Center(), 0xFFFFFF, 0); } m_ColumnX += width; diff --git a/Projects/UOContent/Engines/ConPVP/Gumps/BeginGump.cs b/Projects/UOContent/Engines/ConPVP/Gumps/BeginGump.cs index 0eda38ff0..c4dce0189 100644 --- a/Projects/UOContent/Engines/ConPVP/Gumps/BeginGump.cs +++ b/Projects/UOContent/Engines/ConPVP/Gumps/BeginGump.cs @@ -20,77 +20,31 @@ namespace Server.Engines.ConPVP AddImage(215, -43, 0xEE40); - AddHtml(22 - 1, 22, 294, 20, Color(Center("Duel Countdown"), BlackColor32)); - AddHtml(22 + 1, 22, 294, 20, Color(Center("Duel Countdown"), BlackColor32)); - AddHtml(22, 22 - 1, 294, 20, Color(Center("Duel Countdown"), BlackColor32)); - AddHtml(22, 22 + 1, 294, 20, Color(Center("Duel Countdown"), BlackColor32)); - AddHtml(22, 22, 294, 20, Color(Center("Duel Countdown"), LabelColor32)); + var duelCountdownBlack = "Duel Countdown".Center(BlackColor32); + AddHtml(22 - 1, 22, 294, 20, duelCountdownBlack); + AddHtml(22 + 1, 22, 294, 20, duelCountdownBlack); + AddHtml(22, 22 - 1, 294, 20, duelCountdownBlack); + AddHtml(22, 22 + 1, 294, 20, duelCountdownBlack); + AddHtml(22, 22, 294, 20, "Duel Countdown".Center(LabelColor32)); - AddHtml( - 22 - 1, - 50, - 294, - 80, - Color( - "The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.", - BlackColor32 - ) - ); - AddHtml( - 22 + 1, - 50, - 294, - 80, - Color( - "The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.", - BlackColor32 - ) - ); - AddHtml( - 22, - 50 - 1, - 294, - 80, - Color( - "The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.", - BlackColor32 - ) - ); - AddHtml( - 22, - 50 + 1, - 294, - 80, - Color( - "The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.", - BlackColor32 - ) - ); - AddHtml( - 22, - 50, - 294, - 80, - Color( - "The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.", - 0xFFCC66 - ) - ); + var beginMessageBlack = + "The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends." + .Color(BlackColor32); - /*AddImageTiled( 32, 128, 264, 1, 9107 ); - AddImageTiled( 42, 130, 264, 1, 9157 ); - - AddHtml( 60-1, 140, 250, 20, Color( String.Format( "Duel will begin in {0} second{1}.", count, count==1?"":"s", BlackColor32 ), BlackColor32 ), false, false ); - AddHtml( 60+1, 140, 250, 20, Color( String.Format( "Duel will begin in {0} second{1}.", count, count==1?"":"s", BlackColor32 ), BlackColor32 ), false, false ); - AddHtml( 60, 140-1, 250, 20, Color( String.Format( "Duel will begin in {0} second{1}.", count, count==1?"":"s", BlackColor32 ), BlackColor32 ), false, false ); - AddHtml( 60, 140+1, 250, 20, Color( String.Format( "Duel will begin in {0} second{1}.", count, count==1?"":"s", BlackColor32 ), BlackColor32 ), false, false ); - AddHtml( 60, 140, 250, 20, Color( String.Format( "Duel will begin in {0} second{1}.", count, count==1?"":"s", 0x66AACC ), 0x66AACC ), false, false );*/ + AddHtml(22 - 1, 50, 294, 80, beginMessageBlack); + AddHtml(22 + 1, 50, 294, 80, beginMessageBlack); + AddHtml(22, 50 - 1, 294, 80, beginMessageBlack); + AddHtml(22, 50 + 1, 294, 80, beginMessageBlack); + AddHtml( + 22, + 50, + 294, + 80, + "The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends." + .Color(0xFFCC66) + ); AddButton(314 - 50, 157 - offset, 247, 248, 1); } - - public string Center(string text) => $"
{text}
"; - - public string Color(string text, int color) => $"{text}"; } } diff --git a/Projects/UOContent/Engines/ConPVP/Gumps/ConfirmSignupGump.cs b/Projects/UOContent/Engines/ConPVP/Gumps/ConfirmSignupGump.cs index 518f5fc51..4ca656f78 100644 --- a/Projects/UOContent/Engines/ConPVP/Gumps/ConfirmSignupGump.cs +++ b/Projects/UOContent/Engines/ConPVP/Gumps/ConfirmSignupGump.cs @@ -129,7 +129,7 @@ namespace Server.Engines.ConPVP sb.Append(" Tournament Signup"); - AddBorderedText(22, 22, 294, 20, Center(sb.ToString()), LabelColor32, BlackColor32); + AddBorderedText(22, 22, 294, 20, sb.ToString().Center(), LabelColor32, BlackColor32); AddBorderedText( 22, 50, @@ -283,10 +283,6 @@ namespace Server.Engines.ConPVP AddButton(314, y, 247, 248, 1); } - public string Center(string text) => $"
{text}
"; - - public string Color(string text, int color) => $"{text}"; - private void AddBorderedText(int x, int y, int width, int height, string text, int color, int borderColor) { AddColoredText(x - 1, y - 1, width, height, text, borderColor); @@ -298,14 +294,7 @@ namespace Server.Engines.ConPVP private void AddColoredText(int x, int y, int width, int height, string text, int color) { - if (color == 0) - { - AddHtml(x, y, width, height, text); - } - else - { - AddHtml(x, y, width, height, Color(text, color)); - } + AddHtml(x, y, width, height, color == 0 ? text : text.Color(color)); } public void AddGoldenButton(int x, int y, int bid) diff --git a/Projects/UOContent/Engines/ConPVP/Gumps/LadderGump.cs b/Projects/UOContent/Engines/ConPVP/Gumps/LadderGump.cs index d884d26dc..8debcacfc 100644 --- a/Projects/UOContent/Engines/ConPVP/Gumps/LadderGump.cs +++ b/Projects/UOContent/Engines/ConPVP/Gumps/LadderGump.cs @@ -126,10 +126,7 @@ namespace Server.Engines.ConPVP height - 12 - 2 - 18, 400, 20, - Color( - string.Format("Top {3} of {0:N0} duelists, page {1} of {2}", m_List.Count, page + 1, (lc + 14) / 15, lc), - 0xFFC000 - ) + $"Top {lc} of {m_List.Count:N0} duelists, page {page + 1} of {(lc + 14) / 15}".Color(0xFFC000) ); AddColumnHeader(75, "Rank"); @@ -146,7 +143,7 @@ namespace Server.Engines.ConPVP var y = 32 + (i - start) * 20; var x = 12; - AddBorderedText(x, y, 75, Center(Rank(i + 1)), 0xFFFFFF, 0); + AddBorderedText(x, y, 75, Rank(i + 1).Center(), 0xFFFFFF, 0); x += 75; /*AddImage( 20, y + 5, 0x2616, 0x96C ); @@ -178,14 +175,14 @@ namespace Server.Engines.ConPVP // AddImageTiled( 21, y + 6, width, 8, 0x2617 ); AddImageTiled(x + 3, y + 4, width, 11, 0x806); - AddBorderedText(x, y, 115, Center(level.ToString()), 0xFFFFFF, 0); + AddBorderedText(x, y, 115, level.ToString().Center(), 0xFFFFFF, 0); x += 115; var mob = entry.Mobile; if (mob.Guild != null) { - AddBorderedText(x, y, 50, Center(mob.Guild.Abbreviation), 0xFFFFFF, 0); + AddBorderedText(x, y, 50, mob.Guild.Abbreviation.Center(), 0xFFFFFF, 0); } x += 50; @@ -193,10 +190,10 @@ namespace Server.Engines.ConPVP AddBorderedText(x + 5, y, 115 - 5, mob.Name, 0xFFFFFF, 0); x += 115; - AddBorderedText(x, y, 60, Center(entry.Wins.ToString()), 0xFFFFFF, 0); + AddBorderedText(x, y, 60, entry.Wins.ToString().Center(), 0xFFFFFF, 0); x += 60; - AddBorderedText(x, y, 60, Center(entry.Losses.ToString()), 0xFFFFFF, 0); + AddBorderedText(x, y, 60, entry.Losses.ToString().Center(), 0xFFFFFF, 0); x += 60; // AddBorderedText( 292 + 15, y, 115 - 30, String.Format( "{0}
/
{1}
", entry.Wins, entry.Losses ), 0xFFC000, 0 ); @@ -235,10 +232,6 @@ namespace Server.Engines.ConPVP } } - public string Center(string text) => $"
{text}
"; - - public string Color(string text, int color) => $"{text}"; - private void AddBorderedText(int x, int y, int width, string text, int color, int borderColor) { /*AddColoredText( x - 1, y, width, text, borderColor ); @@ -252,21 +245,14 @@ namespace Server.Engines.ConPVP private void AddColoredText(int x, int y, int width, string text, int color) { - if (color == 0) - { - AddHtml(x, y, width, 20, text); - } - else - { - AddHtml(x, y, width, 20, Color(text, color)); - } + AddHtml(x, y, width, 20, color == 0 ? text : text.Color(color)); } private void AddColumnHeader(int width, string name) { AddBackground(m_ColumnX, 12, width, 20, 0x242C); AddImageTiled(m_ColumnX + 2, 14, width - 4, 16, 0x2430); - AddBorderedText(m_ColumnX, 13, width, Center(name), 0xFFFFFF, 0); + AddBorderedText(m_ColumnX, 13, width, name.Center(), 0xFFFFFF, 0); m_ColumnX += width; } diff --git a/Projects/UOContent/Engines/ConPVP/Gumps/TournamentBracketGump.cs b/Projects/UOContent/Engines/ConPVP/Gumps/TournamentBracketGump.cs index 896a61cc9..c5c89fcd7 100644 --- a/Projects/UOContent/Engines/ConPVP/Gumps/TournamentBracketGump.cs +++ b/Projects/UOContent/Engines/ConPVP/Gumps/TournamentBracketGump.cs @@ -91,7 +91,7 @@ namespace Server.Engines.ConPVP sb.Append(" Tournament Bracket"); - AddHtml(25, 35, 250, 20, Center(sb.ToString())); + AddHtml(25, 35, 250, 20, sb.ToString().Center()); AddRightArrow(25, 53, ToButtonID(0, 4), "Rules"); AddRightArrow(25, 71, ToButtonID(0, 1), "Participants"); @@ -181,7 +181,7 @@ namespace Server.Engines.ConPVP ); AddLeftArrow(25, 11, ToButtonID(0, 0)); - AddHtml(25, 35, 250, 20, Center("Rules")); + AddHtml(25, 35, 250, 20, "Rules".Center()); var y = 53; @@ -278,7 +278,7 @@ namespace Server.Engines.ConPVP ?? new List(tourney.Participants); AddLeftArrow(25, 11, ToButtonID(0, 0)); - AddHtml(25, 35, 250, 20, Center($"{pList.Count} Participant{(pList.Count == 1 ? "" : "s")}")); + AddHtml(25, 35, 250, 20, $"{pList.Count} Participant{(pList.Count == 1 ? "" : "s")}".Center()); StartPage(out var index, out var count, out var y, 12); @@ -291,7 +291,7 @@ namespace Server.Engines.ConPVP { if (part.Players[0] is PlayerMobile pm && pm.DuelPlayer != null) { - name = Color(name, pm.DuelPlayer.Eliminated ? 0x6633333 : 0x336666); + name = name.Color(pm.DuelPlayer.Eliminated ? 0x6633333 : 0x336666); } } @@ -311,7 +311,7 @@ namespace Server.Engines.ConPVP AddBackground(0, 0, 300, 60 + 18 + 20 + part.Players.Count * 18 + 20 + 20 + 160, 9380); AddLeftArrow(25, 11, ToButtonID(0, 1)); - AddHtml(25, 35, 250, 20, Center("Participants")); + AddHtml(25, 35, 250, 20, "Participants".Center()); var y = 53; @@ -327,7 +327,7 @@ namespace Server.Engines.ConPVP { if (mob is PlayerMobile pm && pm.DuelPlayer != null) { - name = Color(name, pm.DuelPlayer.Eliminated ? 0x6633333 : 0x336666); + name = name.Color(pm.DuelPlayer.Eliminated ? 0x6633333 : 0x336666); } } @@ -364,7 +364,7 @@ namespace Server.Engines.ConPVP sb.Append("Nothing logged yet."); } - AddHtml(25, y, 250, 150, Color(sb.ToString(), BlackColor32), false, true); + AddHtml(25, y, 250, 150, sb.ToString().Color(BlackColor32), false, true); break; } @@ -374,7 +374,7 @@ namespace Server.Engines.ConPVP AddBackground(0, 0, 300, 300, 9380); AddLeftArrow(25, 11, ToButtonID(0, 3)); - AddHtml(25, 35, 250, 20, Center("Participants")); + AddHtml(25, 35, 250, 20, "Participants".Center()); if (obj is not Mobile mob) { @@ -405,7 +405,7 @@ namespace Server.Engines.ConPVP AddBackground(0, 0, 300, 300, 9380); AddLeftArrow(25, 11, ToButtonID(0, 0)); - AddHtml(25, 35, 250, 20, Center("Rounds")); + AddHtml(25, 35, 250, 20, "Rounds".Center()); StartPage(out var index, out var count, out var y, 12); @@ -422,7 +422,7 @@ namespace Server.Engines.ConPVP AddBackground(0, 0, 300, 300, 9380); AddLeftArrow(25, 11, ToButtonID(0, 2)); - AddHtml(25, 35, 250, 20, Center("Rounds")); + AddHtml(25, 35, 250, 20, "Rounds".Center()); if (m_Object is not PyramidLevel level) { @@ -475,11 +475,11 @@ namespace Server.Engines.ConPVP if (color == -1 && match.Context != null && match.Winner == part) { - txt = Color(txt, 0x336633); + txt = txt.Color(0x336633); } else if (color == -1 && match.Context != null) { - txt = Color(txt, 0x663333); + txt = txt.Color(0x663333); } sb.Append(txt); @@ -537,11 +537,11 @@ namespace Server.Engines.ConPVP if (color == -1 && match.Context != null && match.Winner == part) { - txt = Color(txt, 0x336633); + txt = txt.Color(0x336633); } else if (color == -1 && match.Context != null) { - txt = Color(txt, 0x663333); + txt = txt.Color(0x663333); } sb.Append(txt); @@ -556,7 +556,7 @@ namespace Server.Engines.ConPVP if (color >= 0) { - str = Color(str, color); + str = str.Color(color); } AddRightArrow(25, y, ToButtonID(5, index + i + 1), str); @@ -577,7 +577,7 @@ namespace Server.Engines.ConPVP AddBackground(0, 0, 300, 60 + 18 + 20 + 20 + 20 + ct * 18 + 6, 9380); AddLeftArrow(25, 11, ToButtonID(0, 5)); - AddHtml(25, 35, 250, 20, Center("Rounds")); + AddHtml(25, 35, 250, 20, "Rounds".Center()); AddHtml(25, 53, 250, 20, $"Winner: {(match.Winner == null ? "N/A" : match.Winner.NameList)}"); AddHtml( @@ -683,10 +683,6 @@ namespace Server.Engines.ConPVP } } - public string Center(string text) => $"
{text}
"; - - public string Color(string text, int color) => $"{text}"; - private void AddBorderedText(int x, int y, int width, int height, string text, int color, int borderColor) { AddColoredText(x - 1, y - 1, width, height, text, borderColor); @@ -704,7 +700,7 @@ namespace Server.Engines.ConPVP } else { - AddHtml(x, y, width, height, Color(text, color)); + AddHtml(x, y, width, height, text.Color(color)); } } diff --git a/Projects/UOContent/Engines/ConPVP/Preferences.cs b/Projects/UOContent/Engines/ConPVP/Preferences.cs index 39464350b..4b761a6ca 100644 --- a/Projects/UOContent/Engines/ConPVP/Preferences.cs +++ b/Projects/UOContent/Engines/ConPVP/Preferences.cs @@ -254,10 +254,6 @@ namespace Server.Engines.ConPVP } } - public string Center(string text) => $"
{text}
"; - - public string Color(string text, int color) => $"{text}"; - private void AddBorderedText(int x, int y, int width, string text, int color, int borderColor) { AddColoredText(x, y, width, text, color); @@ -265,14 +261,7 @@ namespace Server.Engines.ConPVP private void AddColoredText(int x, int y, int width, string text, int color) { - if (color == 0) - { - AddHtml(x, y, width, 20, text); - } - else - { - AddHtml(x, y, width, 20, Color(text, color)); - } + AddHtml(x, y, width, 20, color == 0 ? text : text.Color(color)); } private void AddColumnHeader(int width, string name) @@ -282,7 +271,7 @@ namespace Server.Engines.ConPVP if (name != null) { - AddBorderedText(m_ColumnX, 13, width, Center(name), 0xFFFFFF, 0); + AddBorderedText(m_ColumnX, 13, width, name.Center(), 0xFFFFFF, 0); } m_ColumnX += width; diff --git a/Projects/UOContent/Engines/Craft/Core/CraftGump.cs b/Projects/UOContent/Engines/Craft/Core/CraftGump.cs index 331dc4603..1664ea711 100644 --- a/Projects/UOContent/Engines/Craft/Core/CraftGump.cs +++ b/Projects/UOContent/Engines/Craft/Core/CraftGump.cs @@ -106,17 +106,7 @@ namespace Server.Engines.Craft } // **************************************** - if (notice != null) - { - if (notice.Number > 0) - { - AddHtmlLocalized(170, 295, 350, 40, notice.Number, LabelColor); - } - else - { - AddHtml(170, 295, 350, 40, $"{notice.String}"); - } - } + notice.AddHtmlText(this, 170, 295, 350, 40, numberColor: LabelColor, stringColor: FontColor); // If the system has more than one resource if (craftSystem.CraftSubRes.Init) diff --git a/Projects/UOContent/Engines/Craft/Core/CraftItem.cs b/Projects/UOContent/Engines/Craft/Core/CraftItem.cs index 73261b4c3..86633d2f2 100644 --- a/Projects/UOContent/Engines/Craft/Core/CraftItem.cs +++ b/Projects/UOContent/Engines/Craft/Core/CraftItem.cs @@ -5,7 +5,6 @@ using Server.Factions; using Server.Items; using Server.Logging; using Server.Mobiles; -using Server.Utilities; namespace Server.Engines.Craft { diff --git a/Projects/UOContent/Engines/Craft/Core/Resmelt.cs b/Projects/UOContent/Engines/Craft/Core/Resmelt.cs index 33b5f7ac1..05dbe1e6f 100644 --- a/Projects/UOContent/Engines/Craft/Core/Resmelt.cs +++ b/Projects/UOContent/Engines/Craft/Core/Resmelt.cs @@ -1,7 +1,6 @@ using Server.Ethics; using Server.Items; using Server.Targeting; -using Server.Utilities; namespace Server.Engines.Craft { diff --git a/Projects/UOContent/Engines/Craft/DefInscription.cs b/Projects/UOContent/Engines/Craft/DefInscription.cs index c9fbe0eae..d4b33b717 100644 --- a/Projects/UOContent/Engines/Craft/DefInscription.cs +++ b/Projects/UOContent/Engines/Craft/DefInscription.cs @@ -2,7 +2,6 @@ using System; using Server.Engines.BulkOrders; using Server.Items; using Server.Spells; -using Server.Utilities; namespace Server.Engines.Craft; diff --git a/Projects/UOContent/Engines/Doom/GauntletSpawner.cs b/Projects/UOContent/Engines/Doom/GauntletSpawner.cs index 77655cc2e..24279d08b 100644 --- a/Projects/UOContent/Engines/Doom/GauntletSpawner.cs +++ b/Projects/UOContent/Engines/Doom/GauntletSpawner.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using ModernUO.Serialization; using Server.Items; -using Server.Utilities; namespace Server.Engines.Doom; diff --git a/Projects/UOContent/Engines/Factions/Core/GuardList.cs b/Projects/UOContent/Engines/Factions/Core/GuardList.cs index b3845d241..52333670a 100644 --- a/Projects/UOContent/Engines/Factions/Core/GuardList.cs +++ b/Projects/UOContent/Engines/Factions/Core/GuardList.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Server.Utilities; namespace Server.Factions { diff --git a/Projects/UOContent/Engines/Factions/Core/Reflector.cs b/Projects/UOContent/Engines/Factions/Core/Reflector.cs index a4da897af..196d45bbe 100644 --- a/Projects/UOContent/Engines/Factions/Core/Reflector.cs +++ b/Projects/UOContent/Engines/Factions/Core/Reflector.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using Server.Utilities; namespace Server.Factions { diff --git a/Projects/UOContent/Engines/Factions/Core/VendorList.cs b/Projects/UOContent/Engines/Factions/Core/VendorList.cs index 0c54f9f94..e4550e95d 100644 --- a/Projects/UOContent/Engines/Factions/Core/VendorList.cs +++ b/Projects/UOContent/Engines/Factions/Core/VendorList.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Server.Utilities; namespace Server.Factions { diff --git a/Projects/UOContent/Engines/Factions/Gumps/ElectionManagementGump.cs b/Projects/UOContent/Engines/Factions/Gumps/ElectionManagementGump.cs index efdcc6036..4525af44f 100644 --- a/Projects/UOContent/Engines/Factions/Gumps/ElectionManagementGump.cs +++ b/Projects/UOContent/Engines/Factions/Gumps/ElectionManagementGump.cs @@ -26,22 +26,22 @@ namespace Server.Factions AddBackground(0, 0, 448, 354, 9270); 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(145, 35, 100, 20, Color(candidate.Mobile == null ? "null" : candidate.Mobile.Name, LabelColor)); + AddHtml(45, 35, 100, 20, "Player Name:".Color(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(145, 55, 100, 20, Color(candidate.Votes.ToString(), LabelColor)); + AddHtml(45, 55, 100, 20, "Vote Count:".Color(LabelColor)); + AddHtml(145, 55, 100, 20, candidate.Votes.ToString().Color(LabelColor)); 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(14, 100, 420, 240, 9274); 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) { @@ -61,11 +61,11 @@ namespace Server.Factions AddImage(414, 104, 0x25E6); } - AddHtml(14, 120, 30, 20, Color(Center("DEL"), LabelColor)); - AddHtml(47, 120, 150, 20, Color("Name", LabelColor)); - AddHtml(195, 120, 100, 20, Color(Center("Address"), LabelColor)); - AddHtml(295, 120, 80, 20, Color(Center("Time"), LabelColor)); - AddHtml(355, 120, 60, 20, Color(Center("Legit"), LabelColor)); + AddHtml(14, 120, 30, 20, "DEL".Center(LabelColor)); + AddHtml(47, 120, 150, 20, "Name".Color(LabelColor)); + AddHtml(195, 120, 100, 20, "Address".Center(LabelColor)); + AddHtml(295, 120, 80, 20, "Time".Center(LabelColor)); + AddHtml(355, 120, 60, 20, "Legit".Center(LabelColor)); var idx = 0; @@ -85,12 +85,12 @@ namespace Server.Factions 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; } 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; } else if (obj is DateTime time) @@ -100,13 +100,13 @@ namespace Server.Factions 140 + idx * 20, 80, 20, - Color(Center(FormatTimeSpan(time - election.LastStateTime)), LabelColor) + FormatTimeSpan(time - election.LastStateTime).Center(LabelColor) ); x += 80; } 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; } } @@ -117,23 +117,23 @@ namespace Server.Factions AddBackground(0, 0, 288, 334, 9270); 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(145, 35, 100, 20, Color(election.State.ToString(), LabelColor)); + AddHtml(45, 35, 100, 20, "Current State:".Color(LabelColor)); + AddHtml(145, 35, 100, 20, election.State.ToString().Color(LabelColor)); AddButton(12, 53, 4005, 4007, 1); - AddHtml(45, 55, 100, 20, Color("Transition Time:", LabelColor)); - AddHtml(145, 55, 100, 20, Color(FormatTimeSpan(election.NextStateTime), LabelColor)); + AddHtml(45, 55, 100, 20, "Transition Time:".Color(LabelColor)); + AddHtml(145, 55, 100, 20, FormatTimeSpan(election.NextStateTime).Color(LabelColor)); AddImageTiled(13, 79, 262, 242, 9264); AddImageTiled(14, 80, 260, 240, 9274); AddAlphaRegion(14, 80, 260, 240); - AddHtml(14, 80, 260, 20, Color(Center("Candidates"), LabelColor)); - AddHtml(14, 100, 30, 20, Color(Center("-->"), LabelColor)); - AddHtml(47, 100, 150, 20, Color("Name", LabelColor)); - AddHtml(195, 100, 80, 20, Color(Center("Votes"), LabelColor)); + AddHtml(14, 80, 260, 20, "Candidates".Center(LabelColor)); + AddHtml(14, 100, 30, 20, "-->".Center(LabelColor)); + AddHtml(47, 100, 150, 20, "Name".Color(LabelColor)); + AddHtml(195, 100, 80, 20, "Votes".Center(LabelColor)); 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); - AddHtml(47, 120 + i * 20, 150, 20, Color(mob.Name, LabelColor)); - AddHtml(195, 120 + i * 20, 80, 20, Color(Center(cd.Votes.ToString()), LabelColor)); + AddHtml(47, 120 + i * 20, 150, 20, mob.Name.Color(LabelColor)); + AddHtml(195, 120 + i * 20, 80, 20, cd.Votes.ToString().Center(LabelColor)); } } } - public string Right(string text) => $"
{text}
"; - - public string Center(string text) => $"
{text}
"; - - public string Color(string text, int color) => $"{text}"; - public static string FormatTimeSpan(TimeSpan ts) => $"{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 (bid == 0) - { - } - else if (bid == 1) - { - } - else + if (bid > 1) { 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])); } } } + 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 { - 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 - { - bid -= 4; + bid -= 4; - if (bid >= 0 && bid < m_Candidate.Voters.Count) - { - m_Candidate.Voters.RemoveAt(bid); - from.SendGump(new ElectionManagementGump(m_Election, m_Candidate, m_Page)); - } + if (bid >= 0 && bid < m_Candidate.Voters.Count) + { + m_Candidate.Voters.RemoveAt(bid); + from.SendGump(new ElectionManagementGump(m_Election, m_Candidate, m_Page)); } } } diff --git a/Projects/UOContent/Engines/Factions/Items/Power Faction Items/PowerFactionItem.cs b/Projects/UOContent/Engines/Factions/Items/Power Faction Items/PowerFactionItem.cs index 911601b34..4097fedcc 100644 --- a/Projects/UOContent/Engines/Factions/Items/Power Faction Items/PowerFactionItem.cs +++ b/Projects/UOContent/Engines/Factions/Items/Power Faction Items/PowerFactionItem.cs @@ -2,7 +2,6 @@ using System; using System.IO; using Server.Factions; using Server.Mobiles; -using Server.Utilities; namespace Server { diff --git a/Projects/UOContent/Engines/Factions/Items/Traps/BaseFactionTrapDeed.cs b/Projects/UOContent/Engines/Factions/Items/Traps/BaseFactionTrapDeed.cs index cfdbb803e..f0d83b038 100644 --- a/Projects/UOContent/Engines/Factions/Items/Traps/BaseFactionTrapDeed.cs +++ b/Projects/UOContent/Engines/Factions/Items/Traps/BaseFactionTrapDeed.cs @@ -1,7 +1,6 @@ using System; using Server.Engines.Craft; using Server.Items; -using Server.Utilities; namespace Server.Factions { diff --git a/Projects/UOContent/Engines/Factions/Mobiles/Guards/GuardAI.cs b/Projects/UOContent/Engines/Factions/Mobiles/Guards/GuardAI.cs index 83bc0150a..2345d09bc 100644 --- a/Projects/UOContent/Engines/Factions/Mobiles/Guards/GuardAI.cs +++ b/Projects/UOContent/Engines/Factions/Mobiles/Guards/GuardAI.cs @@ -12,7 +12,6 @@ using Server.Spells.Seventh; using Server.Spells.Sixth; using Server.Spells.Third; using Server.Targeting; -using Server.Utilities; namespace Server.Factions { diff --git a/Projects/UOContent/Engines/Harvest/Core/HarvestSystem.cs b/Projects/UOContent/Engines/Harvest/Core/HarvestSystem.cs index 99ccdd10a..84337d61d 100644 --- a/Projects/UOContent/Engines/Harvest/Core/HarvestSystem.cs +++ b/Projects/UOContent/Engines/Harvest/Core/HarvestSystem.cs @@ -1,7 +1,6 @@ using System; using Server.Items; using Server.Targeting; -using Server.Utilities; namespace Server.Engines.Harvest { diff --git a/Projects/UOContent/Engines/Harvest/Mining.cs b/Projects/UOContent/Engines/Harvest/Mining.cs index d27e1848b..b7f6e3085 100644 --- a/Projects/UOContent/Engines/Harvest/Mining.cs +++ b/Projects/UOContent/Engines/Harvest/Mining.cs @@ -2,7 +2,6 @@ using System; using Server.Items; using Server.Mobiles; using Server.Targeting; -using Server.Utilities; namespace Server.Engines.Harvest { diff --git a/Projects/UOContent/Engines/Help/PageQueueGump.cs b/Projects/UOContent/Engines/Help/PageQueueGump.cs index 4d7af15e0..50708d9d5 100644 --- a/Projects/UOContent/Engines/Help/PageQueueGump.cs +++ b/Projects/UOContent/Engines/Help/PageQueueGump.cs @@ -247,7 +247,7 @@ namespace Server.Engines.Help 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; @@ -308,7 +308,7 @@ namespace Server.Engines.Help } 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) @@ -324,25 +324,21 @@ namespace Server.Engines.Help 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); - AddHtml(45, 40, 200, 20, Color("Remove", LabelColor32)); + AddHtml(45, 40, 200, 20, "Remove".Color(LabelColor32)); 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); 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); } } - public string Center(string text) => $"
{text}
"; - - public string Color(string text, int color) => $"{text}"; - public void AddTextInput(int x, int y, int w, int h, int id, string def) { AddImageTiled(x, y, w, h, 0xA40); diff --git a/Projects/UOContent/Engines/Help/SpeechLogGump.cs b/Projects/UOContent/Engines/Help/SpeechLogGump.cs index cfcfbb3ef..5c81a1b35 100644 --- a/Projects/UOContent/Engines/Help/SpeechLogGump.cs +++ b/Projects/UOContent/Engines/Help/SpeechLogGump.cs @@ -46,7 +46,7 @@ namespace Server.Engines.Help 10, 280, 20, - $"
SPEECH LOG - {playerName} ({playerAccount.FixHtmlFormattable()})
" + $"SPEECH LOG - {playerName} ({playerAccount.FixHtmlFormattable()})".Center(0xA0A0FF) ); var lastPage = (log.Count - 1) / MaxEntriesPerPage; diff --git a/Projects/UOContent/Engines/ML Quests/MLQuestSystem.cs b/Projects/UOContent/Engines/ML Quests/MLQuestSystem.cs index 618569849..7b56b477d 100644 --- a/Projects/UOContent/Engines/ML Quests/MLQuestSystem.cs +++ b/Projects/UOContent/Engines/ML Quests/MLQuestSystem.cs @@ -8,7 +8,6 @@ using Server.Engines.MLQuests.Objectives; using Server.Gumps; using Server.Items; using Server.Mobiles; -using Server.Utilities; namespace Server.Engines.MLQuests { diff --git a/Projects/UOContent/Engines/ML Quests/Objectives/DeliverObjective.cs b/Projects/UOContent/Engines/ML Quests/Objectives/DeliverObjective.cs index 124f17def..add665a1f 100644 --- a/Projects/UOContent/Engines/ML Quests/Objectives/DeliverObjective.cs +++ b/Projects/UOContent/Engines/ML Quests/Objectives/DeliverObjective.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using Server.Gumps; using Server.Items; using Server.Logging; -using Server.Utilities; namespace Server.Engines.MLQuests.Objectives { diff --git a/Projects/UOContent/Engines/ML Quests/Rewards/ItemReward.cs b/Projects/UOContent/Engines/ML Quests/Rewards/ItemReward.cs index ff5a579ef..a44169f8b 100644 --- a/Projects/UOContent/Engines/ML Quests/Rewards/ItemReward.cs +++ b/Projects/UOContent/Engines/ML Quests/Rewards/ItemReward.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using Server.Engines.MLQuests.Items; using Server.Mobiles; -using Server.Utilities; namespace Server.Engines.MLQuests.Rewards { diff --git a/Projects/UOContent/Engines/Plants/MiscItems/GreenThorns.cs b/Projects/UOContent/Engines/Plants/MiscItems/GreenThorns.cs index aea8e4d4b..e3db73227 100644 --- a/Projects/UOContent/Engines/Plants/MiscItems/GreenThorns.cs +++ b/Projects/UOContent/Engines/Plants/MiscItems/GreenThorns.cs @@ -2,7 +2,6 @@ using System; using ModernUO.Serialization; using Server.Mobiles; using Server.Targeting; -using Server.Utilities; namespace Server.Items; diff --git a/Projects/UOContent/Engines/Plants/PlantResources.cs b/Projects/UOContent/Engines/Plants/PlantResources.cs index 9811d38e5..955129450 100644 --- a/Projects/UOContent/Engines/Plants/PlantResources.cs +++ b/Projects/UOContent/Engines/Plants/PlantResources.cs @@ -1,6 +1,5 @@ using System; using Server.Items; -using Server.Utilities; namespace Server.Engines.Plants { diff --git a/Projects/UOContent/Engines/Quests/Core/QuestSerializer.cs b/Projects/UOContent/Engines/Quests/Core/QuestSerializer.cs index a5c01dfb4..4cae90ac8 100644 --- a/Projects/UOContent/Engines/Quests/Core/QuestSerializer.cs +++ b/Projects/UOContent/Engines/Quests/Core/QuestSerializer.cs @@ -1,5 +1,4 @@ using System; -using Server.Utilities; namespace Server.Engines.Quests { diff --git a/Projects/UOContent/Engines/Quests/Core/QuestSystem.cs b/Projects/UOContent/Engines/Quests/Core/QuestSystem.cs index 6e805a471..a5c4927ae 100644 --- a/Projects/UOContent/Engines/Quests/Core/QuestSystem.cs +++ b/Projects/UOContent/Engines/Quests/Core/QuestSystem.cs @@ -706,8 +706,6 @@ namespace Server.Engines.Quests return (r << 10) | (g << 5) | b; } - public static string Color(string text, int color) => $"{text}"; - public void AddHtmlObject(int x, int y, int width, int height, object message, int color, bool back, bool scroll) { if (message is int html) @@ -716,7 +714,7 @@ namespace Server.Engines.Quests } 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); } } } diff --git a/Projects/UOContent/Engines/Quests/Regions/QuestOfferRegion.cs b/Projects/UOContent/Engines/Quests/Regions/QuestOfferRegion.cs index 069379c58..6cd9ea3aa 100644 --- a/Projects/UOContent/Engines/Quests/Regions/QuestOfferRegion.cs +++ b/Projects/UOContent/Engines/Quests/Regions/QuestOfferRegion.cs @@ -2,7 +2,6 @@ using System; using Server.Logging; using Server.Regions; using Server.Mobiles; -using Server.Utilities; namespace Server.Engines.Quests; diff --git a/Projects/UOContent/Engines/Spawners/BaseSpawner.cs b/Projects/UOContent/Engines/Spawners/BaseSpawner.cs index 7a3324067..928d4fe07 100644 --- a/Projects/UOContent/Engines/Spawners/BaseSpawner.cs +++ b/Projects/UOContent/Engines/Spawners/BaseSpawner.cs @@ -7,7 +7,6 @@ using Server.Commands; using Server.Items; using Server.Json; using Server.Mobiles; -using Server.Utilities; using static Server.Attributes; namespace Server.Engines.Spawners; diff --git a/Projects/UOContent/Engines/Spawners/Commands/ImportSpawnersCommand.cs b/Projects/UOContent/Engines/Spawners/Commands/ImportSpawnersCommand.cs index 6094de015..cba03feaf 100644 --- a/Projects/UOContent/Engines/Spawners/Commands/ImportSpawnersCommand.cs +++ b/Projects/UOContent/Engines/Spawners/Commands/ImportSpawnersCommand.cs @@ -11,7 +11,6 @@ using Server.Collections; using Server.Json; using Server.Logging; using Server.Network; -using Server.Utilities; namespace Server.Engines.Spawners; diff --git a/Projects/UOContent/Engines/Spawners/SpawnerGump.cs b/Projects/UOContent/Engines/Spawners/SpawnerGump.cs index 4c0e015c2..e7f9cf1be 100644 --- a/Projects/UOContent/Engines/Spawners/SpawnerGump.cs +++ b/Projects/UOContent/Engines/Spawners/SpawnerGump.cs @@ -167,8 +167,8 @@ public class SpawnerGump : Gump totalWeight += spawnerEntry.SpawnedProbability; } - AddHtml(270, 308 + offset, 35, 20, $"
{totalSpawns}
"); - AddHtml(308, 308 + offset, 35, 20, $"
{totalWeight}
"); + AddHtml(270, 308 + offset, 35, 20, totalSpawns.ToString().Center(0xF4F4F4)); + AddHtml(308, 308 + offset, 35, 20, totalWeight.ToString().Center(0xF4F4F4)); AddHtml(5, 1, 161, 20, $"{spawner.Name} ({totalSpawned}/{spawner.Count})"); diff --git a/Projects/UOContent/Engines/Stealables/StealableArtifacts.cs b/Projects/UOContent/Engines/Stealables/StealableArtifacts.cs index 4257a2480..1ac218ad2 100644 --- a/Projects/UOContent/Engines/Stealables/StealableArtifacts.cs +++ b/Projects/UOContent/Engines/Stealables/StealableArtifacts.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using Server.Items; using Server.Logging; -using Server.Utilities; namespace Server.Engines.Stealables; diff --git a/Projects/UOContent/Engines/Treasures of Tokuno/TreasuresOfTokuno.cs b/Projects/UOContent/Engines/Treasures of Tokuno/TreasuresOfTokuno.cs index 2425f94b9..0ff5f1b73 100644 --- a/Projects/UOContent/Engines/Treasures of Tokuno/TreasuresOfTokuno.cs +++ b/Projects/UOContent/Engines/Treasures of Tokuno/TreasuresOfTokuno.cs @@ -11,7 +11,6 @@ using Server.Mobiles; using Server.Multis; using Server.Network; using Server.Regions; -using Server.Utilities; namespace Server.Misc { diff --git a/Projects/UOContent/Engines/Veteran Rewards/RewardEntry.cs b/Projects/UOContent/Engines/Veteran Rewards/RewardEntry.cs index 7388c6fdb..6821ec018 100644 --- a/Projects/UOContent/Engines/Veteran Rewards/RewardEntry.cs +++ b/Projects/UOContent/Engines/Veteran Rewards/RewardEntry.cs @@ -1,5 +1,4 @@ using System; -using Server.Utilities; namespace Server.Engines.VeteranRewards { diff --git a/Projects/UOContent/Gumps/AdminGump.cs b/Projects/UOContent/Gumps/AdminGump.cs index d85b6230c..51450d7c9 100644 --- a/Projects/UOContent/Gumps/AdminGump.cs +++ b/Projects/UOContent/Gumps/AdminGump.cs @@ -142,7 +142,7 @@ namespace Server.Gumps if (notice != null) { - AddHtml(12, 392, 396, 36, Color(notice, LabelColor32)); + AddHtml(12, 392, 396, 36, notice.Color(LabelColor32)); } switch (pageType) @@ -259,7 +259,7 @@ namespace Server.Gumps } case AdminGumpPage.Administer_WorldBuilding: { - AddHtml(10, 125, 400, 20, Color(Center("Generating"), LabelColor32)); + AddHtml(10, 125, 400, 20, "Generating".Center(LabelColor32)); AddButtonLabeled(20, 175, GetButtonID(3, 101), "Teleporters"); AddButtonLabeled(220, 175, GetButtonID(3, 102), "Moongates"); @@ -285,7 +285,7 @@ namespace Server.Gumps } case AdminGumpPage.Administer_Server: { - AddHtml(10, 125, 400, 20, Color(Center("Server"), LabelColor32)); + AddHtml(10, 125, 400, 20, "Server".Center(LabelColor32)); AddButtonLabeled(20, 150, GetButtonID(3, 200), "Save"); @@ -302,7 +302,7 @@ namespace Server.Gumps AddLabel( 20, 215, LabelHue, "Shutdown/Restart not available." ); }*/ - AddHtml(10, 295, 400, 20, Color(Center("Broadcast"), LabelColor32)); + AddHtml(10, 295, 400, 20, "Broadcast".Center(LabelColor32)); AddTextField(20, 320, 380, 20, 0); AddButtonLabeled(20, 350, GetButtonID(3, 210), "To Everyone"); @@ -312,15 +312,14 @@ namespace Server.Gumps } case AdminGumpPage.Administer_Access_Lockdown: { - AddHtml(10, 125, 400, 20, Color(Center("Server Lockdown"), LabelColor32)); + AddHtml(10, 125, 400, 20, "Server Lockdown".Center(LabelColor32)); AddHtml( 20, 150, 380, 80, - Color( - "When enabled, only clients with an access level equal to or greater than the specified lockdown level may access the server. After setting a lockdown level, use the Purge Invalid Clients button to disconnect those clients without access.", + "When enabled, only clients with an access level equal to or greater than the specified lockdown level may access the server. After setting a lockdown level, use the Purge Invalid Clients button to disconnect those clients without access.".Color( LabelColor32 ) ); @@ -358,9 +357,9 @@ namespace Server.Gumps } case AdminGumpPage.Administer_Access: { - AddHtml(10, 125, 400, 20, Color(Center("Access"), LabelColor32)); + AddHtml(10, 125, 400, 20, "Access".Center(LabelColor32)); - AddHtml(10, 155, 400, 20, Color(Center("Connectivity"), LabelColor32)); + AddHtml(10, 155, 400, 20, "Connectivity".Center(LabelColor32)); AddButtonLabeled(20, 180, GetButtonID(3, 300), "Kick"); AddButtonLabeled(220, 180, GetButtonID(3, 301), "Ban"); @@ -368,7 +367,7 @@ namespace Server.Gumps AddButtonLabeled(20, 210, GetButtonID(3, 302), "Firewall"); AddButtonLabeled(220, 210, GetButtonID(3, 303), "Lockdown"); - AddHtml(10, 245, 400, 20, Color(Center("Staff"), LabelColor32)); + AddHtml(10, 245, 400, 20, "Staff".Center(LabelColor32)); AddButtonLabeled(20, 270, GetButtonID(3, 310), "Make Player"); AddButtonLabeled(20, 290, GetButtonID(3, 311), "Make Counselor"); @@ -394,7 +393,7 @@ namespace Server.Gumps } case AdminGumpPage.Administer_Commands: { - AddHtml(10, 125, 400, 20, Color(Center("Commands"), LabelColor32)); + AddHtml(10, 125, 400, 20, "Commands".Center(LabelColor32)); AddButtonLabeled(20, 150, GetButtonID(3, 400), "Add"); AddButtonLabeled(220, 150, GetButtonID(3, 401), "Remove"); @@ -532,7 +531,7 @@ namespace Server.Gumps AddClientHeader(); - AddHtml(10, 125, 400, 20, Color(Center("Information"), LabelColor32)); + AddHtml(10, 125, 400, 20, "Information".Center(LabelColor32)); var y = 146; @@ -816,7 +815,7 @@ namespace Server.Gumps break; } - AddHtml(10, 125, 400, 20, Color(Center("Change Password"), LabelColor32)); + AddHtml(10, 125, 400, 20, "Change Password".Center(LabelColor32)); AddLabel(20, 150, LabelHue, "Username:"); AddLabel(200, 150, LabelHue, a.Username); @@ -838,7 +837,7 @@ namespace Server.Gumps break; } - AddHtml(10, 125, 400, 20, Color(Center("Change Access Level"), LabelColor32)); + AddHtml(10, 125, 400, 20, "Change Access Level".Center(LabelColor32)); AddLabel(20, 150, LabelHue, "Username:"); AddLabel(200, 150, LabelHue, a.Username); @@ -885,7 +884,7 @@ namespace Server.Gumps } } - AddHtml(10, 125, 400, 20, Color(Center("Information"), LabelColor32)); + AddHtml(10, 125, 400, 20, "Information".Center(LabelColor32)); AddLabel(20, 150, LabelHue, "Username:"); AddLabel(200, 150, LabelHue, a.Username); @@ -960,7 +959,7 @@ namespace Server.Gumps break; } - AddHtml(10, 125, 400, 20, Color(Center("Access"), LabelColor32)); + AddHtml(10, 125, 400, 20, "Access".Center(LabelColor32)); AddPageButton( 20, @@ -988,7 +987,7 @@ namespace Server.Gumps m_List ??= a.LoginIPs.ToList(); - AddHtml(10, 195, 400, 20, Color(Center("Client Addresses"), LabelColor32)); + AddHtml(10, 195, 400, 20, "Client Addresses".Center(LabelColor32)); AddButtonLabeled(227, 225, GetButtonID(5, 16), "View all shared accounts"); AddButtonLabeled(227, 245, GetButtonID(5, 17), "Ban all shared accounts"); @@ -1000,13 +999,13 @@ namespace Server.Gumps 315, 180, 80, - Color("List of IP addresses which have accessed this account.", LabelColor32) + "List of IP addresses which have accessed this account.".Color(LabelColor32) ); AddImageTiled(15, 219, 206, 156, 0xBBC); AddBlackAlpha(16, 220, 204, 154); - AddHtml(18, 221, 114, 20, Color("IP Address", LabelColor32)); + AddHtml(18, 221, 114, 20, "IP Address".Color(LabelColor32)); if (listPage > 0) { @@ -1028,12 +1027,12 @@ namespace Server.Gumps if (m_List.Count == 0) { - AddHtml(18, 243, 200, 60, Color("This account has not yet been accessed.", LabelColor32)); + AddHtml(18, 243, 200, 60, "This account has not yet been accessed.".Color(LabelColor32)); } for (int i = 0, index = listPage * 6; i < 6 && index >= 0 && index < m_List.Count; ++i, ++index) { - AddHtml(18, 243 + i * 22, 114, 20, Color(m_List[index].ToString(), LabelColor32)); + AddHtml(18, 243 + i * 22, 114, 20, m_List[index].ToString().Color(LabelColor32)); AddButton(130, 242 + i * 22, 0xFA2, 0xFA4, GetButtonID(8, index)); AddButton(160, 242 + i * 22, 0xFA8, 0xFAA, GetButtonID(9, index)); AddButton(190, 242 + i * 22, 0xFB1, 0xFB3, GetButtonID(10, index)); @@ -1050,7 +1049,7 @@ namespace Server.Gumps m_List ??= a.IpRestrictions.ToList(); - AddHtml(10, 195, 400, 20, Color(Center("Address Restrictions"), LabelColor32)); + AddHtml(10, 195, 400, 20, "Address Restrictions".Center(LabelColor32)); AddTextField(227, 225, 120, 20, 0); @@ -1061,8 +1060,7 @@ namespace Server.Gumps 255, 180, 120, - Color( - "Any clients connecting from an address not in this list will be rejected. Or, if the list is empty, any client may connect.", + "Any clients connecting from an address not in this list will be rejected. Or, if the list is empty, any client may connect.".Color( LabelColor32 ) ); @@ -1070,7 +1068,7 @@ namespace Server.Gumps AddImageTiled(15, 219, 206, 156, 0xBBC); AddBlackAlpha(16, 220, 204, 154); - AddHtml(18, 221, 114, 20, Color("IP Address", LabelColor32)); + AddHtml(18, 221, 114, 20, "IP Address".Color(LabelColor32)); if (listPage > 0) { @@ -1092,12 +1090,12 @@ namespace Server.Gumps if (m_List.Count == 0) { - AddHtml(18, 243, 200, 60, Color("There are no addresses in this list.", LabelColor32)); + AddHtml(18, 243, 200, 60, "There are no addresses in this list.".Color(LabelColor32)); } for (int i = 0, index = listPage * 6; i < 6 && index >= 0 && index < m_List.Count; ++i, ++index) { - AddHtml(18, 243 + i * 22, 114, 20, Color((string)m_List[index], LabelColor32)); + AddHtml(18, 243 + i * 22, 114, 20, ((string)m_List[index]).Color(LabelColor32)); AddButton(190, 242 + i * 22, 0xFB1, 0xFB3, GetButtonID(8, index)); } @@ -1110,7 +1108,7 @@ namespace Server.Gumps break; } - AddHtml(10, 125, 400, 20, Color(Center("Characters"), LabelColor32)); + AddHtml(10, 125, 400, 20, "Characters".Center(LabelColor32)); AddLabelCropped(12, 150, 120, 20, LabelHue, "Name"); AddLabelCropped(132, 150, 120, 20, LabelHue, "Access Level"); @@ -1160,7 +1158,7 @@ namespace Server.Gumps break; } - AddHtml(10, 125, 400, 20, Color(Center("Comments"), LabelColor32)); + AddHtml(10, 125, 400, 20, "Comments".Center(LabelColor32)); AddButtonLabeled(20, 150, GetButtonID(5, 4), "Add Comment"); @@ -1199,7 +1197,7 @@ namespace Server.Gumps break; } - AddHtml(10, 125, 400, 20, Color(Center("Tags"), LabelColor32)); + AddHtml(10, 125, 400, 20, "Tags".Center(LabelColor32)); AddButtonLabeled(20, 150, GetButtonID(5, 5), "Add Tag"); @@ -1288,11 +1286,11 @@ namespace Server.Gumps break; } - AddHtml(10, 125, 400, 20, Color(Center(firewallEntry.ToString()), LabelColor32)); + AddHtml(10, 125, 400, 20, firewallEntry.ToString().Center(LabelColor32)); AddButtonLabeled(20, 150, GetButtonID(6, 3), "Remove"); - AddHtml(10, 175, 400, 20, Color(Center("Potentially Affected Accounts"), LabelColor32)); + AddHtml(10, 175, 400, 20, "Potentially Affected Accounts".Center(LabelColor32)); if (m_List == null) { @@ -1394,19 +1392,15 @@ namespace Server.Gumps public void AddSelectedButton(int x, int y, int buttonID, string text, bool isSelection) { AddButton(x, y - 1, isSelection ? 4006 : 4005, 4007, buttonID); - AddHtml(x + 35, y, 200, 20, Color(text, isSelection ? SelectedColor32 : LabelColor32)); + AddHtml(x + 35, y, 200, 20, text.Color(isSelection ? SelectedColor32 : LabelColor32)); } public void AddButtonLabeled(int x, int y, int buttonID, string text) { AddButton(x, y - 1, 4005, 4007, buttonID); - AddHtml(x + 35, y, 240, 20, Color(text, LabelColor32)); + AddHtml(x + 35, y, 240, 20, text.Color(LabelColor32)); } - public string Center(string text) => $"
{text}
"; - - public string Color(string text, int color) => $"{text}"; - public void AddBlackAlpha(int x, int y, int width, int height) { AddImageTiled(x, y, width, height, 2624); diff --git a/Projects/UOContent/Gumps/BaseGridGump.cs b/Projects/UOContent/Gumps/BaseGridGump.cs index c5d69ec15..72d27ca00 100644 --- a/Projects/UOContent/Gumps/BaseGridGump.cs +++ b/Projects/UOContent/Gumps/BaseGridGump.cs @@ -1,5 +1,4 @@ using System.Runtime.CompilerServices; -using Server.Utilities; namespace Server.Gumps { diff --git a/Projects/UOContent/Gumps/ClientGump.cs b/Projects/UOContent/Gumps/ClientGump.cs index 473753acf..6fdd0a84e 100644 --- a/Projects/UOContent/Gumps/ClientGump.cs +++ b/Projects/UOContent/Gumps/ClientGump.cs @@ -31,57 +31,57 @@ namespace Server.Gumps AddImageTiled(10, 32, 400, 272, 0xA40); AddAlphaRegion(10, 32, 400, 272); - AddHtml(10, 10, 380, 20, Color(Center("User Information"), LabelColor32)); + AddHtml(10, 10, 380, 20, "User Information".Center(LabelColor32)); var line = 0; - AddHtml(14, 36 + line * 20, 200, 20, Color("Address:", LabelColor32)); - AddHtml(70, 36 + line++ * 20, 200, 20, Color(state.ToString(), LabelColor32)); + AddHtml(14, 36 + line * 20, 200, 20, "Address:".Color(LabelColor32)); + AddHtml(70, 36 + line++ * 20, 200, 20, state.ToString().Color(LabelColor32)); - AddHtml(14, 36 + line * 20, 200, 20, Color("Client:", LabelColor32)); + AddHtml(14, 36 + line * 20, 200, 20, "Client:".Color(LabelColor32)); AddHtml( 72, 36 + line++ * 20, 200, 20, - Color(state.Version?.ToString().DefaultIfNullOrEmpty("(null)"), LabelColor32) + (state.Version?.ToString().DefaultIfNullOrEmpty("(null)")).Color(LabelColor32) ); - AddHtml(14, 36 + line * 20, 200, 20, Color("Assistant:", LabelColor32)); + AddHtml(14, 36 + line * 20, 200, 20, "Assistant:".Color(LabelColor32)); AddHtml( 72, 36 + line++ * 20, 200, 20, - Color(state.Assistant ?? "(-none-)", LabelColor32) + (state.Assistant ?? "(-none-)").Color(LabelColor32) ); - AddHtml(14, 36 + line * 20, 200, 20, Color("Version:", LabelColor32)); + AddHtml(14, 36 + line * 20, 200, 20, "Version:".Color(LabelColor32)); var info = state.ExpansionInfo; var expansionName = info.Name; - AddHtml(72, 36 + line++ * 20, 200, 20, Color(expansionName, LabelColor32)); + AddHtml(72, 36 + line++ * 20, 200, 20, expansionName.Color(LabelColor32)); var a = state.Account as Account; var m = state.Mobile; if (from.AccessLevel >= AccessLevel.GameMaster && a != null) { - AddHtml(14, 36 + line * 20, 200, 20, Color("Account:", LabelColor32)); - AddHtml(72, 36 + line++ * 20, 200, 20, Color(a.Username, LabelColor32)); + AddHtml(14, 36 + line * 20, 200, 20, "Account:".Color(LabelColor32)); + AddHtml(72, 36 + line++ * 20, 200, 20, a.Username.Color(LabelColor32)); } if (m != null) { - AddHtml(14, 36 + line * 20, 200, 20, Color("Mobile:", LabelColor32)); - AddHtml(72, 36 + line++ * 20, 200, 20, Color($"{m.Name} ({m.Serial})", LabelColor32)); + AddHtml(14, 36 + line * 20, 200, 20, "Mobile:".Color(LabelColor32)); + AddHtml(72, 36 + line++ * 20, 200, 20, $"{m.Name} ({m.Serial})".Color(LabelColor32)); - AddHtml(14, 36 + line * 20, 200, 20, Color("Location:", LabelColor32)); - AddHtml(72, 36 + line++ * 20, 200, 20, Color($"{m.Location} [{m.Map}]", LabelColor32)); + AddHtml(14, 36 + line * 20, 200, 20, "Location:".Color(LabelColor32)); + AddHtml(72, 36 + line++ * 20, 200, 20, $"{m.Location} [{m.Map}]".Color(LabelColor32)); AddButton(13, 197, 0xFAB, 0xFAD, 1); - AddHtml(48, 198, 200, 20, Color("Send Message", LabelColor32)); + AddHtml(48, 198, 200, 20, "Send Message".Color(LabelColor32)); AddImageTiled(12, 222, 376, 80, 0xA40); AddImageTiled(13, 223, 374, 78, 0xBBC); @@ -97,42 +97,42 @@ namespace Server.Gumps if (BaseCommand.IsAccessible(from, m)) { AddButton(266, 36 + line * 20, 0xFA5, 0xFA7, 4); - AddHtml(300, 38 + line++ * 20, 100, 20, Color("Properties", LabelColor32)); + AddHtml(300, 38 + line++ * 20, 100, 20, "Properties".Color(LabelColor32)); } if (from != m) { AddButton(266, 36 + line * 20, 0xFA5, 0xFA7, 5); - AddHtml(300, 38 + line++ * 20, 100, 20, Color("Go to them", LabelColor32)); + AddHtml(300, 38 + line++ * 20, 100, 20, "Go to them".Color(LabelColor32)); AddButton(266, 36 + line * 20, 0xFA5, 0xFA7, 6); - AddHtml(300, 38 + line++ * 20, 100, 20, Color("Bring them here", LabelColor32)); + AddHtml(300, 38 + line++ * 20, 100, 20, "Bring them here".Color(LabelColor32)); } AddButton(266, 36 + line * 20, 0xFA5, 0xFA7, 7); - AddHtml(300, 38 + line++ * 20, 100, 20, Color("Move to target", LabelColor32)); + AddHtml(300, 38 + line++ * 20, 100, 20, "Move to target".Color(LabelColor32)); if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > m.AccessLevel) { AddButton(266, 36 + line * 20, 0xFA5, 0xFA7, 8); - AddHtml(300, 38 + line++ * 20, 100, 20, Color("Disconnect", LabelColor32)); + AddHtml(300, 38 + line++ * 20, 100, 20, "Disconnect".Color(LabelColor32)); if (m.Alive) { AddButton(266, 36 + line * 20, 0xFA5, 0xFA7, 9); - AddHtml(300, 38 + line++ * 20, 100, 20, Color("Kill", LabelColor32)); + AddHtml(300, 38 + line++ * 20, 100, 20, "Kill".Color(LabelColor32)); } else { AddButton(266, 36 + line * 20, 0xFA5, 0xFA7, 10); - AddHtml(300, 38 + line++ * 20, 100, 20, Color("Resurrect", LabelColor32)); + AddHtml(300, 38 + line++ * 20, 100, 20, "Resurrect".Color(LabelColor32)); } } if (from.AccessLevel >= AccessLevel.Counselor && from.AccessLevel > m.AccessLevel) { AddButton(266, 36 + line * 20, 0xFA5, 0xFA7, 11); - AddHtml(300, 38 + line++ * 20, 100, 20, Color("Skills browser", LabelColor32)); + AddHtml(300, 38 + line++ * 20, 100, 20, "Skills browser".Color(LabelColor32)); } } } @@ -323,9 +323,5 @@ namespace Server.Gumps } } } - - public string Center(string text) => $"
{text}
"; - - public string Color(string text, int color) => $"{text}"; } } diff --git a/Projects/UOContent/Gumps/ConfirmHeritageGump.cs b/Projects/UOContent/Gumps/ConfirmHeritageGump.cs index eb2aa4bc5..9aa8ff3ec 100644 --- a/Projects/UOContent/Gumps/ConfirmHeritageGump.cs +++ b/Projects/UOContent/Gumps/ConfirmHeritageGump.cs @@ -1,7 +1,6 @@ using System; using Server.Items; using Server.Network; -using Server.Utilities; namespace Server.Gumps { diff --git a/Projects/UOContent/Gumps/Guilds/New Guild System/BaseGuildGump.cs b/Projects/UOContent/Gumps/Guilds/New Guild System/BaseGuildGump.cs index cb3222c55..d863c8299 100644 --- a/Projects/UOContent/Gumps/Guilds/New Guild System/BaseGuildGump.cs +++ b/Projects/UOContent/Gumps/Guilds/New Guild System/BaseGuildGump.cs @@ -139,7 +139,5 @@ namespace Server.Guilds AddHtml(x, y, width, height, text.String, back, scroll); } } - - public static string Color(string text, int color) => $"{text}"; } } diff --git a/Projects/UOContent/Gumps/Guilds/New Guild System/DiplomacyGump.cs b/Projects/UOContent/Gumps/Guilds/New Guild System/DiplomacyGump.cs index 0402086e3..65a924461 100644 --- a/Projects/UOContent/Gumps/Guilds/New Guild System/DiplomacyGump.cs +++ b/Projects/UOContent/Gumps/Guilds/New Guild System/DiplomacyGump.cs @@ -117,7 +117,7 @@ namespace Server.Guilds { var defs = new TextDefinition[aryLength]; - defs[0] = g == guild ? Color(g.Name, 0x006600) : g.Name; + defs[0] = g == guild ? g.Name.Color(0x006600) : g.Name; defs[1] = g.Abbreviation; defs[2] = 3000085; // Peace @@ -186,7 +186,7 @@ namespace Server.Guilds } else if (m_LowerText?.String != null) { - AddHtml(66, 153 + itemNumber * 28, 280, 26, Color(m_LowerText.String, 0x99)); + AddHtml(66, 153 + itemNumber * 28, 280, 26, m_LowerText.String.Color(0x99)); } if (AllowAdvancedSearch) diff --git a/Projects/UOContent/Gumps/Guilds/New Guild System/GuildRosterGump.cs b/Projects/UOContent/Gumps/Guilds/New Guild System/GuildRosterGump.cs index f5bb56ccb..ede71d4d8 100644 --- a/Projects/UOContent/Gumps/Guilds/New Guild System/GuildRosterGump.cs +++ b/Projects/UOContent/Gumps/Guilds/New Guild System/GuildRosterGump.cs @@ -61,11 +61,11 @@ namespace Server.Guilds if (pm == player) { - name = Color(name, 0x006600); + name = name.Color(0x006600); } else if (pm.NetState != null) { - name = Color(name, 0x000066); + name = name.Color(0x000066); } defs[0] = name; diff --git a/Projects/UOContent/Gumps/Guilds/New Guild System/OtherGuildInfo.cs b/Projects/UOContent/Gumps/Guilds/New Guild System/OtherGuildInfo.cs index 7f922bfcc..efccd97cd 100644 --- a/Projects/UOContent/Gumps/Guilds/New Guild System/OtherGuildInfo.cs +++ b/Projects/UOContent/Gumps/Guilds/New Guild System/OtherGuildInfo.cs @@ -85,13 +85,13 @@ namespace Server.Guilds } else if (PendingWar) { - kills = Color($"{war.Kills}/{war.MaxKills}", 0x990000); - time = Color($"{war.WarLength.Hours:D2}:{DateTime.MinValue + war.WarLength:mm}", 0x990000); + kills = $"{war.Kills}/{war.MaxKills}".Color(0x990000); + time = $"{war.WarLength.Hours:D2}:{DateTime.MinValue + war.WarLength:mm}".Color(0x990000); otherWar = m_Other.FindPendingWar(guild); if (otherWar != null) { - otherKills = Color($"{otherWar.Kills}/{otherWar.MaxKills}", 0x990000); + otherKills = $"{otherWar.Kills}/{otherWar.MaxKills}".Color(0x990000); } } @@ -159,7 +159,7 @@ namespace Server.Guilds // Withdraw Request AddButtonAndBackground(20, 290, 14, 1062986); // Withdraw Request - AddHtml(150, 83, 360, 26, Color(alliance.Name, 0x99)); + AddHtml(150, 83, 360, 26, alliance.Name.Color(0x99)); } else if (alliance.Leader == m_Other && alliance.IsPendingMember(guild)) { @@ -172,7 +172,7 @@ namespace Server.Guilds AddButtonAndBackground(20, 260, 15, 1062988); // Deny Request AddButtonAndBackground(20, 290, 16, 1062987); // Accept Request - AddHtml(150, 83, 360, 26, Color(alliance.Name, 0x99)); + AddHtml(150, 83, 360, 26, alliance.Name.Color(0x99)); } } else diff --git a/Projects/UOContent/Gumps/PlayerVendorGumps.cs b/Projects/UOContent/Gumps/PlayerVendorGumps.cs index 6484845e6..0d8b1355c 100644 --- a/Projects/UOContent/Gumps/PlayerVendorGumps.cs +++ b/Projects/UOContent/Gumps/PlayerVendorGumps.cs @@ -4,7 +4,6 @@ using Server.HuePickers; using Server.Items; using Server.Mobiles; using Server.Network; -using Server.Utilities; namespace Server.Gumps { diff --git a/Projects/UOContent/Gumps/Props/PropsGump.cs b/Projects/UOContent/Gumps/Props/PropsGump.cs index c3377f3a0..381f28176 100644 --- a/Projects/UOContent/Gumps/Props/PropsGump.cs +++ b/Projects/UOContent/Gumps/Props/PropsGump.cs @@ -168,7 +168,7 @@ namespace Server.Gumps y, emptyWidth, EntryHeight, - $"
{m_Type.Name}
" + m_Type.Name.Center(0xFAFAFA) ); } diff --git a/Projects/UOContent/Gumps/StaticWarningGump.cs b/Projects/UOContent/Gumps/StaticWarningGump.cs index 2cf54a5e4..00e4b1b97 100644 --- a/Projects/UOContent/Gumps/StaticWarningGump.cs +++ b/Projects/UOContent/Gumps/StaticWarningGump.cs @@ -88,7 +88,7 @@ public abstract class StaticWarningGump : StaticGump where T : StaticWarni protected sealed override void BuildStrings(ref GumpStringsBuilder builder) { - builder.SetStringSlot("content", $"{Content}"); + builder.SetStringSlot("content", Content.Color(ContentColor)); } public override void OnResponse(NetState sender, in RelayInfo info) => _callback?.Invoke(info.ButtonID == 1); diff --git a/Projects/UOContent/Gumps/ViewHousesGump.cs b/Projects/UOContent/Gumps/ViewHousesGump.cs index b741afd5d..d6ba01ec1 100644 --- a/Projects/UOContent/Gumps/ViewHousesGump.cs +++ b/Projects/UOContent/Gumps/ViewHousesGump.cs @@ -33,11 +33,11 @@ namespace Server.Gumps { m_Selection = null; - AddHtml(35, 15, 120, 20, Color("House Type", White)); + AddHtml(35, 15, 120, 20, "House Type".Color(White)); if (list.Count == 0) { - AddHtml(35, 40, 160, 40, Color("There were no houses found for that player.", White)); + AddHtml(35, 40, 160, 40, "There were no houses found for that player.".Color(White)); } AddImage(190, 17, 0x25EA); @@ -64,7 +64,7 @@ namespace Server.Gumps var name = FindHouseName(list[i]); - AddHtml(15, 40 + i % 15 * 20, 20, 20, Color($"{i + 1}.", White)); + AddHtml(15, 40 + i % 15 * 20, 20, 20, $"{i + 1}.".Color(White)); if (name.Number > 0) { @@ -72,7 +72,7 @@ namespace Server.Gumps } else { - AddHtml(35, 40 + i % 15 * 20, 160, 20, Color(name, White)); + AddHtml(35, 40 + i % 15 * 20, 160, 20, Html.Color(name, White)); } AddButton(198, 39 + i % 15 * 20, 4005, 4007, i + 1); @@ -109,49 +109,49 @@ namespace Server.Gumps location = "unknown"; } - AddHtml(10, 15, 220, 20, Color(Center("House Properties"), White)); + AddHtml(10, 15, 220, 20, "House Properties".Center(White)); - AddHtml(15, 40, 210, 20, Color("Facet:", White)); - AddHtml(15, 40, 210, 20, Color(Right(map == null ? "(null)" : map.Name), White)); + AddHtml(15, 40, 210, 20, "Facet:".Color(White)); + AddHtml(15, 40, 210, 20, (map == null ? "(null)" : map.Name).Right(White)); - AddHtml(15, 60, 210, 20, Color("Location:", White)); - AddHtml(15, 60, 210, 20, Color(Right(sel.Location.ToString()), White)); + AddHtml(15, 60, 210, 20, "Location:".Color(White)); + AddHtml(15, 60, 210, 20, sel.Location.ToString().Right(White)); - AddHtml(15, 80, 210, 20, Color("Sextant:", White)); - AddHtml(15, 80, 210, 20, Color(Right(location), White)); + AddHtml(15, 80, 210, 20, "Sextant:".Color(White)); + AddHtml(15, 80, 210, 20, location.Right(White)); - AddHtml(15, 100, 210, 20, Color("Owner:", White)); - AddHtml(15, 100, 210, 20, Color(Right(owner), White)); + AddHtml(15, 100, 210, 20, "Owner:".Color(White)); + AddHtml(15, 100, 210, 20, owner.Right(White)); - AddHtml(15, 120, 210, 20, Color("Name:", White)); - AddHtml(15, 120, 210, 20, Color(Right(houseName), White)); + AddHtml(15, 120, 210, 20, "Name:".Color(White)); + AddHtml(15, 120, 210, 20, houseName.Right(White)); - AddHtml(15, 140, 210, 20, Color("Friends:", White)); - AddHtml(15, 140, 210, 20, Color(Right(sel.Friends.Count.ToString()), White)); + AddHtml(15, 140, 210, 20, "Friends:".Color(White)); + AddHtml(15, 140, 210, 20, sel.Friends.Count.ToString().Right(White)); - AddHtml(15, 160, 210, 20, Color("Co-Owners:", White)); - AddHtml(15, 160, 210, 20, Color(Right(sel.CoOwners.Count.ToString()), White)); + AddHtml(15, 160, 210, 20, "Co-Owners:".Color(White)); + AddHtml(15, 160, 210, 20, sel.CoOwners.Count.ToString().Right(White)); - AddHtml(15, 180, 210, 20, Color("Bans:", White)); - AddHtml(15, 180, 210, 20, Color(Right(sel.Bans.Count.ToString()), White)); + AddHtml(15, 180, 210, 20, "Bans:".Color(White)); + AddHtml(15, 180, 210, 20, sel.Bans.Count.ToString().Right(White)); - AddHtml(15, 200, 210, 20, Color("Decays:", White)); - AddHtml(15, 200, 210, 20, Color(Right(sel.CanDecay ? "Yes" : "No"), White)); + AddHtml(15, 200, 210, 20, "Decays:".Color(White)); + AddHtml(15, 200, 210, 20, (sel.CanDecay ? "Yes" : "No").Right(White)); - AddHtml(15, 220, 210, 20, Color("Decay Level:", White)); - AddHtml(15, 220, 210, 20, Color(Right(sel.DecayLevel.ToString()), White)); + AddHtml(15, 220, 210, 20, "Decay Level:".Color(White)); + AddHtml(15, 220, 210, 20, sel.DecayLevel.ToString().Right(White)); AddButton(15, 245, 4005, 4007, 1); - AddHtml(50, 245, 120, 20, Color("Go to house", White)); + AddHtml(50, 245, 120, 20, "Go to house".Color(White)); AddButton(15, 265, 4005, 4007, 2); - AddHtml(50, 265, 120, 20, Color("Open house menu", White)); + AddHtml(50, 265, 120, 20, "Open house menu".Color(White)); AddButton(15, 285, 4005, 4007, 3); - AddHtml(50, 285, 120, 20, Color("Demolish house", White)); + AddHtml(50, 285, 120, 20, "Demolish house".Color(White)); AddButton(15, 305, 4005, 4007, 4); - AddHtml(50, 305, 120, 20, Color("Refresh house", White)); + AddHtml(50, 305, 120, 20, "Refresh house".Color(White)); } } @@ -302,12 +302,6 @@ namespace Server.Gumps return house.GetType().Name; } - public string Right(string text) => $"
{text}
"; - - public string Center(string text) => $"
{text}
"; - - public string Color(string text, int color) => $"{text}"; - public void AddBlackAlpha(int x, int y, int width, int height) { AddImageTiled(x, y, width, height, 2624); diff --git a/Projects/UOContent/Gumps/WarningGump.cs b/Projects/UOContent/Gumps/WarningGump.cs index b635655a2..3e125770d 100644 --- a/Projects/UOContent/Gumps/WarningGump.cs +++ b/Projects/UOContent/Gumps/WarningGump.cs @@ -60,25 +60,16 @@ public class WarningGump : DynamicGump builder.AddImageTiled(10, 40, _width - 20, _height - 80, 2624); builder.AddAlphaRegion(10, 40, _width - 20, _height - 80); - if (_content != null) - { - if (_content.Number > 0) - { - builder.AddHtmlLocalized(10, 40, _width - 20, _height - 80, _content.Number, (short)_contentColor, false, true); - } - else - { - builder.AddHtml( - 10, - 40, - _width - 20, - _height - 80, - $"{_content.String}", - false, - true - ); - } - } + _content.AddHtmlText( + ref builder, + 10, + 40, + _width - 20, + _height - 80, + scroll: true, + numberColor: _contentColor, + stringColor: _contentColor + ); builder.AddImageTiled(10, _height - 30, _width - 20, 20, 2624); builder.AddAlphaRegion(10, _height - 30, _width - 20, 20); diff --git a/Projects/UOContent/Holiday Stuff/Halloween/HolidaySettings.cs b/Projects/UOContent/Holiday Stuff/Halloween/HolidaySettings.cs index 05b39d443..06efc9174 100644 --- a/Projects/UOContent/Holiday Stuff/Halloween/HolidaySettings.cs +++ b/Projects/UOContent/Holiday Stuff/Halloween/HolidaySettings.cs @@ -1,6 +1,5 @@ using System; using Server.Items; -using Server.Utilities; namespace Server.Events.Halloween { diff --git a/Projects/UOContent/Items/Aquarium/Aquarium.cs b/Projects/UOContent/Items/Aquarium/Aquarium.cs index f4a5d78ce..3446c9c0b 100644 --- a/Projects/UOContent/Items/Aquarium/Aquarium.cs +++ b/Projects/UOContent/Items/Aquarium/Aquarium.cs @@ -4,7 +4,6 @@ using ModernUO.Serialization; using Server.ContextMenus; using Server.Multis; using Server.Network; -using Server.Utilities; namespace Server.Items { diff --git a/Projects/UOContent/Items/Aquarium/AquariumGump.cs b/Projects/UOContent/Items/Aquarium/AquariumGump.cs index fe2a86d3a..131d1961e 100644 --- a/Projects/UOContent/Items/Aquarium/AquariumGump.cs +++ b/Projects/UOContent/Items/Aquarium/AquariumGump.cs @@ -57,7 +57,7 @@ namespace Server.Items AddItem(150, 80, item.ItemID, item.Hue); // item number / all items - AddHtml(20, 195, 250, 20, $"{page}/{m_Aquarium.Items.Count}"); + AddHtml(20, 195, 250, 20, $"{page}/{m_Aquarium.Items.Count}".Color(0xFFFFFF)); // remove item if (edit) diff --git a/Projects/UOContent/Items/Armor/BaseArmor.cs b/Projects/UOContent/Items/Armor/BaseArmor.cs index 379073949..82c34b067 100644 --- a/Projects/UOContent/Items/Armor/BaseArmor.cs +++ b/Projects/UOContent/Items/Armor/BaseArmor.cs @@ -5,7 +5,6 @@ using Server.Engines.Craft; using Server.Ethics; using Server.Factions; using Server.Network; -using Server.Utilities; using AMA = Server.Items.ArmorMeditationAllowance; using AMT = Server.Items.ArmorMaterialType; diff --git a/Projects/UOContent/Items/Clothing/BaseClothing.cs b/Projects/UOContent/Items/Clothing/BaseClothing.cs index f38a39c41..c5b7f6e01 100644 --- a/Projects/UOContent/Items/Clothing/BaseClothing.cs +++ b/Projects/UOContent/Items/Clothing/BaseClothing.cs @@ -5,7 +5,6 @@ using Server.Engines.Craft; using Server.Ethics; using Server.Factions; using Server.Network; -using Server.Utilities; namespace Server.Items { diff --git a/Projects/UOContent/Items/Containers/SalvageBag.cs b/Projects/UOContent/Items/Containers/SalvageBag.cs index d9c846104..ab9121093 100644 --- a/Projects/UOContent/Items/Containers/SalvageBag.cs +++ b/Projects/UOContent/Items/Containers/SalvageBag.cs @@ -4,7 +4,6 @@ using ModernUO.Serialization; using Server.ContextMenus; using Server.Engines.Craft; using Server.Network; -using Server.Utilities; namespace Server.Items; diff --git a/Projects/UOContent/Items/Containers/TreasureMapChest.cs b/Projects/UOContent/Items/Containers/TreasureMapChest.cs index 297ecf419..451996ad9 100644 --- a/Projects/UOContent/Items/Containers/TreasureMapChest.cs +++ b/Projects/UOContent/Items/Containers/TreasureMapChest.cs @@ -5,7 +5,6 @@ using Server.ContextMenus; using Server.Engines.PartySystem; using Server.Gumps; using Server.Network; -using Server.Utilities; namespace Server.Items; diff --git a/Projects/UOContent/Items/Deeds/NameChangeDeed.cs b/Projects/UOContent/Items/Deeds/NameChangeDeed.cs index b9c6926d9..181b9479c 100644 --- a/Projects/UOContent/Items/Deeds/NameChangeDeed.cs +++ b/Projects/UOContent/Items/Deeds/NameChangeDeed.cs @@ -42,7 +42,7 @@ public class NameChangeDeedGump : Gump AddPage(0); 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(20, 150, 0x480, "New Name:"); @@ -63,14 +63,10 @@ public class NameChangeDeedGump : Gump AddTextEntry(x + 2, y + 2, width - 4, height - 4, 0, index, ""); } - public string Center(string text) => $"
{text}
"; - - public string Color(string text, int color) => $"{text}"; - public void AddButtonLabeled(int x, int y, int buttonID, string text) { AddButton(x, y - 1, 4005, 4007, buttonID); - AddHtml(x + 35, y, 240, 20, Color(text, 0xFFFFFF)); + AddHtml(x + 35, y, 240, 20, text.Color(0xFFFFFF)); } public override void OnResponse(NetState sender, in RelayInfo info) diff --git a/Projects/UOContent/Items/Maps/TreasureMap.cs b/Projects/UOContent/Items/Maps/TreasureMap.cs index 20d733126..823474938 100644 --- a/Projects/UOContent/Items/Maps/TreasureMap.cs +++ b/Projects/UOContent/Items/Maps/TreasureMap.cs @@ -7,7 +7,6 @@ using Server.Engines.Harvest; using Server.Mobiles; using Server.Network; using Server.Targeting; -using Server.Utilities; namespace Server.Items; diff --git a/Projects/UOContent/Items/Misc/DeceitBrazier.cs b/Projects/UOContent/Items/Misc/DeceitBrazier.cs index a0ef2ce7a..60f78e49a 100644 --- a/Projects/UOContent/Items/Misc/DeceitBrazier.cs +++ b/Projects/UOContent/Items/Misc/DeceitBrazier.cs @@ -1,7 +1,6 @@ using System; using ModernUO.Serialization; using Server.Mobiles; -using Server.Utilities; namespace Server.Items; diff --git a/Projects/UOContent/Items/Skill Items/Magical/Potions/BasePotion.cs b/Projects/UOContent/Items/Skill Items/Magical/Potions/BasePotion.cs index 9080686ef..e01099fec 100644 --- a/Projects/UOContent/Items/Skill Items/Magical/Potions/BasePotion.cs +++ b/Projects/UOContent/Items/Skill Items/Magical/Potions/BasePotion.cs @@ -2,7 +2,6 @@ using System; using ModernUO.Serialization; using Server.Engines.ConPVP; using Server.Engines.Craft; -using Server.Utilities; namespace Server.Items; diff --git a/Projects/UOContent/Items/Skill Items/Ninjitsu/NinjaWeapons.cs b/Projects/UOContent/Items/Skill Items/Ninjitsu/NinjaWeapons.cs index 5508d1e21..d9c0daaa2 100644 --- a/Projects/UOContent/Items/Skill Items/Ninjitsu/NinjaWeapons.cs +++ b/Projects/UOContent/Items/Skill Items/Ninjitsu/NinjaWeapons.cs @@ -6,7 +6,6 @@ using Server.Spells.Chivalry; using Server.Spells.Necromancy; using Server.Spells.Ninjitsu; using Server.Targeting; -using Server.Utilities; /* * There really was no prettier way to do this, other than the one diff --git a/Projects/UOContent/Items/Special/House Raffle/HouseRaffleManagementGump.cs b/Projects/UOContent/Items/Special/House Raffle/HouseRaffleManagementGump.cs index 711115b67..dfa50ae44 100644 --- a/Projects/UOContent/Items/Special/House Raffle/HouseRaffleManagementGump.cs +++ b/Projects/UOContent/Items/Special/House Raffle/HouseRaffleManagementGump.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Runtime.CompilerServices; using Server.Accounting; using Server.Items; using Server.Network; @@ -60,31 +59,31 @@ public class HouseRaffleManagementGump : Gump AddBackground(0, 0, 618, 354, 9270); 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(145, 35, 250, 20, Color(HouseRaffleStone.FormatLocation(stone.PlotBounds, stone.GetPlotCenter(), stone.PlotFacet), LabelColor)); + AddHtml(45, 35, 100, 20, "Location:".Color(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(145, 55, 250, 20, Color(HouseRaffleStone.FormatPrice(stone.TicketPrice), LabelColor)); + AddHtml(45, 55, 100, 20, "Ticket Price:".Color(LabelColor)); + AddHtml(145, 55, 250, 20, HouseRaffleStone.FormatPrice(stone.TicketPrice).Color(LabelColor)); - AddHtml(45, 75, 100, 20, Color("Total Entries:", LabelColor)); - AddHtml(145, 75, 250, 20, Color(_stone.Entries.Count.ToString(), LabelColor)); + AddHtml(45, 75, 100, 20, "Total Entries:".Color(LabelColor)); + AddHtml(145, 75, 250, 20, _stone.Entries.Count.ToString().Color(LabelColor)); 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); - 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); - 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(14, 100, 590, 240, 9274); 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) { @@ -104,11 +103,11 @@ public class HouseRaffleManagementGump : Gump AddImage(584, 104, 0x25E6); } - AddHtml(14, 120, 30, 20, Color(Center("DEL"), LabelColor)); - AddHtml(47, 120, 250, 20, Color("Name", LabelColor)); - AddHtml(295, 120, 100, 20, Color(Center("Address"), LabelColor)); - AddHtml(395, 120, 150, 20, Color(Center("Date"), LabelColor)); - AddHtml(545, 120, 60, 20, Color(Center("Num"), LabelColor)); + AddHtml(14, 120, 30, 20, "DEL".Center(LabelColor)); + AddHtml(47, 120, 250, 20, "Name".Color(LabelColor)); + AddHtml(295, 120, 100, 20, "Address".Center(LabelColor)); + AddHtml(395, 120, 150, 20, "Date".Center(LabelColor)); + AddHtml(545, 120, 60, 20, "Num".Center(LabelColor)); var idx = 0; var winner = _stone.Winner; @@ -131,11 +130,11 @@ public class HouseRaffleManagementGump : Gump { 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 { - 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) { - 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; - 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; - 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) => $"
{text}
"; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public string Center(string text) => $"
{text}
"; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public string Color(string text, int color) => $"{text}"; - public override void OnResponse(NetState sender, in RelayInfo info) { var from = sender.Mobile; diff --git a/Projects/UOContent/Items/Special/Special Scrolls/PowerScroll.cs b/Projects/UOContent/Items/Special/Special Scrolls/PowerScroll.cs index 0e29302a3..267f8e971 100644 --- a/Projects/UOContent/Items/Special/Special Scrolls/PowerScroll.cs +++ b/Projects/UOContent/Items/Special/Special Scrolls/PowerScroll.cs @@ -110,7 +110,7 @@ public partial class PowerScroll : SpecialScroll } } - public override string DefaultTitle => $"Power Scroll ({Math.Floor(Value * 10) / 10:0.#} Skill):"; + public override string DefaultTitle => $"Power Scroll ({Math.Floor(Value * 10) / 10:0.#} Skill):".Color(0xFFFFFF); public static SkillName[] Skills { diff --git a/Projects/UOContent/Items/Special/Special Scrolls/ScrollofTranscendence.cs b/Projects/UOContent/Items/Special/Special Scrolls/ScrollofTranscendence.cs index d0457bc3c..68687ef18 100644 --- a/Projects/UOContent/Items/Special/Special Scrolls/ScrollofTranscendence.cs +++ b/Projects/UOContent/Items/Special/Special Scrolls/ScrollofTranscendence.cs @@ -25,7 +25,7 @@ public partial class ScrollofTranscendence : SpecialScroll public override int Message => 1094933; public override string DefaultTitle => - $"Scroll of Transcendence ({Math.Floor(Value * 10) / 10:0.#} Skill):"; + $"Scroll of Transcendence ({Math.Floor(Value * 10) / 10:0.#} Skill):".Color(0xFFFFFF); public static ScrollofTranscendence CreateRandom(int min, int max) => new(Utility.RandomSkill(), Utility.RandomMinMax(min, max) / 10.0); diff --git a/Projects/UOContent/Items/Special/Special Scrolls/StatCapScroll.cs b/Projects/UOContent/Items/Special/Special Scrolls/StatCapScroll.cs index a47fb8ccb..f4e1a7d71 100644 --- a/Projects/UOContent/Items/Special/Special Scrolls/StatCapScroll.cs +++ b/Projects/UOContent/Items/Special/Special Scrolls/StatCapScroll.cs @@ -42,7 +42,7 @@ public partial class StatCapScroll : SpecialScroll } public override string DefaultTitle => - $"Power Scroll ({((int)Value - 225 >= 0 ? "+" : "")}{(int)Value - 225} Maximum Stats):"; + $"Power Scroll ({((int)Value - 225 >= 0 ? "+" : "")}{(int)Value - 225} Maximum Stats):".Color(0xFFFFFF); public override void AddNameProperty(IPropertyList list) { diff --git a/Projects/UOContent/Items/Talismans/BaseTalisman.cs b/Projects/UOContent/Items/Talismans/BaseTalisman.cs index 86f56d28d..6b1b55202 100644 --- a/Projects/UOContent/Items/Talismans/BaseTalisman.cs +++ b/Projects/UOContent/Items/Talismans/BaseTalisman.cs @@ -7,7 +7,6 @@ using Server.Spells.Fourth; using Server.Spells.Necromancy; using Server.Spells.Second; using Server.Targeting; -using Server.Utilities; namespace Server.Items; diff --git a/Projects/UOContent/Misc/Loot.cs b/Projects/UOContent/Misc/Loot.cs index aaa6eaa64..4c597586c 100644 --- a/Projects/UOContent/Misc/Loot.cs +++ b/Projects/UOContent/Misc/Loot.cs @@ -1,7 +1,6 @@ using System; using System.Runtime.CompilerServices; using Server.Items; -using Server.Utilities; namespace Server { diff --git a/Projects/UOContent/Misc/LootPack.cs b/Projects/UOContent/Misc/LootPack.cs index eeb3c0dc9..6f86f17d0 100644 --- a/Projects/UOContent/Misc/LootPack.cs +++ b/Projects/UOContent/Misc/LootPack.cs @@ -1,7 +1,6 @@ using System; using Server.Items; using Server.Mobiles; -using Server.Utilities; namespace Server { diff --git a/Projects/UOContent/Misc/MondainsLegacy.cs b/Projects/UOContent/Misc/MondainsLegacy.cs index 68a6a0e0e..2ec9523c6 100644 --- a/Projects/UOContent/Misc/MondainsLegacy.cs +++ b/Projects/UOContent/Misc/MondainsLegacy.cs @@ -1,7 +1,6 @@ using System; using Server.Items; using Server.Mobiles; -using Server.Utilities; namespace Server { diff --git a/Projects/UOContent/Misc/ShardPoller.cs b/Projects/UOContent/Misc/ShardPoller.cs index 04d6a8a21..3c12dc172 100644 --- a/Projects/UOContent/Misc/ShardPoller.cs +++ b/Projects/UOContent/Misc/ShardPoller.cs @@ -445,15 +445,15 @@ namespace Server.Misc title = "Shard Poll"; } - AddHtml(22, 22, 294, 20, Color(Center(title), LabelColor32)); + AddHtml(22, 22, 294, 20, title.Center(LabelColor32)); 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); } - 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(42, 90, 264, 1, 9157); @@ -485,7 +485,7 @@ namespace Server.Misc 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 += 5; @@ -494,7 +494,7 @@ namespace Server.Misc if (editing && !isViewingResults) { 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); @@ -510,10 +510,6 @@ namespace Server.Misc m_Polls.Enqueue(poller); } - public string Center(string text) => $"
{text}
"; - - public string Color(string text, int color) => $"{text}"; - public override void OnResponse(NetState sender, in RelayInfo info) { if (m_Polls?.Count > 0) diff --git a/Projects/UOContent/Mobiles/PlayerMobile.cs b/Projects/UOContent/Mobiles/PlayerMobile.cs index c417e7aa1..9c1fbb6b8 100644 --- a/Projects/UOContent/Mobiles/PlayerMobile.cs +++ b/Projects/UOContent/Mobiles/PlayerMobile.cs @@ -35,7 +35,6 @@ using Server.Spells.Seventh; using Server.Spells.Sixth; using Server.Spells.Spellweaving; using Server.Targeting; -using Server.Utilities; using BaseQuestGump = Server.Engines.MLQuests.Gumps.BaseQuestGump; using CalcMoves = Server.Movement.Movement; using QuestOfferGump = Server.Engines.MLQuests.Gumps.QuestOfferGump; diff --git a/Projects/UOContent/Mobiles/Special/Paragon.cs b/Projects/UOContent/Mobiles/Special/Paragon.cs index 67fd22436..825609e22 100644 --- a/Projects/UOContent/Mobiles/Special/Paragon.cs +++ b/Projects/UOContent/Mobiles/Special/Paragon.cs @@ -1,6 +1,5 @@ using System; using Server.Items; -using Server.Utilities; namespace Server.Mobiles; diff --git a/Projects/UOContent/Mobiles/Vendors/BeverageBuy.cs b/Projects/UOContent/Mobiles/Vendors/BeverageBuy.cs index f9bfb7ee0..dbbfcf1d9 100644 --- a/Projects/UOContent/Mobiles/Vendors/BeverageBuy.cs +++ b/Projects/UOContent/Mobiles/Vendors/BeverageBuy.cs @@ -1,6 +1,5 @@ using System; using Server.Items; -using Server.Utilities; namespace Server.Mobiles { diff --git a/Projects/UOContent/Mobiles/Vendors/GenericBuy.cs b/Projects/UOContent/Mobiles/Vendors/GenericBuy.cs index 7537ac39a..513aa9f15 100644 --- a/Projects/UOContent/Mobiles/Vendors/GenericBuy.cs +++ b/Projects/UOContent/Mobiles/Vendors/GenericBuy.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using Server.Items; -using Server.Utilities; namespace Server.Mobiles { diff --git a/Projects/UOContent/Mobiles/Vendors/NPC/AnimalTrainer.cs b/Projects/UOContent/Mobiles/Vendors/NPC/AnimalTrainer.cs index bf8b97819..5ac411aed 100644 --- a/Projects/UOContent/Mobiles/Vendors/NPC/AnimalTrainer.cs +++ b/Projects/UOContent/Mobiles/Vendors/NPC/AnimalTrainer.cs @@ -457,7 +457,7 @@ namespace Server.Mobiles } AddButton(15, 39 + i * 20, 10006, 10006, i + 1); - AddHtml(32, 35 + i * 20, 275, 18, $"{pet.Name}"); + AddHtml(32, 35 + i * 20, 275, 18, pet.Name.Color(0xC0C0EE)); } } diff --git a/Projects/UOContent/Mobiles/Vendors/NPC/CustomHairstylist.cs b/Projects/UOContent/Mobiles/Vendors/NPC/CustomHairstylist.cs index a2a194c20..3f67d07e5 100644 --- a/Projects/UOContent/Mobiles/Vendors/NPC/CustomHairstylist.cs +++ b/Projects/UOContent/Mobiles/Vendors/NPC/CustomHairstylist.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using Server.Gumps; using Server.Items; using Server.Network; -using Server.Utilities; namespace Server.Mobiles { diff --git a/Projects/UOContent/Multis/Houses/HousePlacementTool.cs b/Projects/UOContent/Multis/Houses/HousePlacementTool.cs index 8ff26147b..ed0a06862 100644 --- a/Projects/UOContent/Multis/Houses/HousePlacementTool.cs +++ b/Projects/UOContent/Multis/Houses/HousePlacementTool.cs @@ -6,7 +6,6 @@ using Server.Multis; using Server.Network; using Server.Regions; using Server.Targeting; -using Server.Utilities; namespace Server.Items { diff --git a/Projects/UOContent/Regions/GuardedRegion.cs b/Projects/UOContent/Regions/GuardedRegion.cs index 7ba2671c8..28050a515 100644 --- a/Projects/UOContent/Regions/GuardedRegion.cs +++ b/Projects/UOContent/Regions/GuardedRegion.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Text.Json.Serialization; using Server.Mobiles; -using Server.Utilities; namespace Server.Regions; diff --git a/Projects/UOContent/Spells/Base/SpellRegistry.cs b/Projects/UOContent/Spells/Base/SpellRegistry.cs index a56ae4b13..3d7847d27 100644 --- a/Projects/UOContent/Spells/Base/SpellRegistry.cs +++ b/Projects/UOContent/Spells/Base/SpellRegistry.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using Server.Utilities; namespace Server.Spells { diff --git a/Projects/UOContent/Spells/Fifth/SummonCreature.cs b/Projects/UOContent/Spells/Fifth/SummonCreature.cs index 6d01eefda..b3cd66352 100644 --- a/Projects/UOContent/Spells/Fifth/SummonCreature.cs +++ b/Projects/UOContent/Spells/Fifth/SummonCreature.cs @@ -1,6 +1,5 @@ using System; using Server.Mobiles; -using Server.Utilities; namespace Server.Spells.Fifth { diff --git a/Projects/UOContent/Spells/Necromancy/AnimateDeadSpell.cs b/Projects/UOContent/Spells/Necromancy/AnimateDeadSpell.cs index 3cc235177..9aedd7b25 100644 --- a/Projects/UOContent/Spells/Necromancy/AnimateDeadSpell.cs +++ b/Projects/UOContent/Spells/Necromancy/AnimateDeadSpell.cs @@ -4,7 +4,6 @@ using Server.Engines.Quests; using Server.Engines.Quests.Necro; using Server.Items; using Server.Mobiles; -using Server.Utilities; namespace Server.Spells.Necromancy { diff --git a/Projects/UOContent/Spells/Necromancy/SummonFamiliar.cs b/Projects/UOContent/Spells/Necromancy/SummonFamiliar.cs index d9f7d434e..a1744c691 100644 --- a/Projects/UOContent/Spells/Necromancy/SummonFamiliar.cs +++ b/Projects/UOContent/Spells/Necromancy/SummonFamiliar.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using Server.Gumps; using Server.Mobiles; using Server.Network; -using Server.Utilities; namespace Server.Spells.Necromancy { @@ -138,7 +137,7 @@ namespace Server.Spells.Necromancy 51 + i * 21, 150, 20, - $"{strName}" + strName.Color(enabled ? EnabledColor32 : DisabledColor32) ); } } diff --git a/Projects/UOContent/Spells/Spellweaving/ArcaneSummon.cs b/Projects/UOContent/Spells/Spellweaving/ArcaneSummon.cs index 675234594..bf6e9806a 100644 --- a/Projects/UOContent/Spells/Spellweaving/ArcaneSummon.cs +++ b/Projects/UOContent/Spells/Spellweaving/ArcaneSummon.cs @@ -1,6 +1,5 @@ using System; using Server.Mobiles; -using Server.Utilities; namespace Server.Spells.Spellweaving {