From dfe89024cac5a7173aa7f85713a2c45eeb39feb9 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Wed, 6 Jan 2021 01:17:34 -0800 Subject: [PATCH] Makes gump code a little more readable (#390) - [X] Adds a WriteAscii for individual characters - [X] Updates gump code to use it so it is a little more readable --- Projects/Server/Buffers/SpanWriter.cs | 3 + Projects/Server/Gumps/GumpAlphaRegion.cs | 24 ++++-- Projects/Server/Gumps/GumpBackground.cs | 26 ++++-- Projects/Server/Gumps/GumpButton.cs | 30 +++++-- Projects/Server/Gumps/GumpCheck.cs | 30 +++++-- Projects/Server/Gumps/GumpECHandleInput.cs | 1 - Projects/Server/Gumps/GumpGroup.cs | 18 ++++- Projects/Server/Gumps/GumpHtml.cs | 34 +++++--- Projects/Server/Gumps/GumpHtmlLocalized.cs | 80 +++++++++++-------- Projects/Server/Gumps/GumpImage.cs | 22 ++++- Projects/Server/Gumps/GumpImageTileButton.cs | 38 ++++++--- Projects/Server/Gumps/GumpImageTiled.cs | 26 ++++-- Projects/Server/Gumps/GumpItem.cs | 24 ++++-- Projects/Server/Gumps/GumpItemProperty.cs | 18 ++++- Projects/Server/Gumps/GumpLabel.cs | 24 ++++-- Projects/Server/Gumps/GumpLabelCropped.cs | 28 +++++-- Projects/Server/Gumps/GumpMasterGump.cs | 3 +- Projects/Server/Gumps/GumpPage.cs | 18 ++++- Projects/Server/Gumps/GumpRadio.cs | 30 +++++-- Projects/Server/Gumps/GumpSpriteImage.cs | 15 ++-- Projects/Server/Gumps/GumpTextEntry.cs | 30 +++++-- Projects/Server/Gumps/GumpTextEntryLimited.cs | 32 +++++--- Projects/Server/Gumps/GumpTooltip.cs | 9 +-- .../Packets/OutgoingMovementPackets.cs | 1 - .../Network/Packets/OutgoingPlayerPackets.cs | 1 - .../Network/Packets/OutgoingTargetPackets.cs | 1 - .../Packets/OutgoingVendorBuyPackets.cs | 1 - Projects/Server/ObjectPropertyList.cs | 1 - 28 files changed, 407 insertions(+), 161 deletions(-) diff --git a/Projects/Server/Buffers/SpanWriter.cs b/Projects/Server/Buffers/SpanWriter.cs index 2baa4294f..73740af99 100644 --- a/Projects/Server/Buffers/SpanWriter.cs +++ b/Projects/Server/Buffers/SpanWriter.cs @@ -225,6 +225,9 @@ namespace System.Buffers Position += count; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void WriteAscii(char chr) => Write((byte)chr); + public void WriteString(string value, Encoding encoding, int fixedLength = -1) where T : struct, IEquatable { int sizeT = Unsafe.SizeOf(); diff --git a/Projects/Server/Gumps/GumpAlphaRegion.cs b/Projects/Server/Gumps/GumpAlphaRegion.cs index 557b45e40..f58acfcb7 100644 --- a/Projects/Server/Gumps/GumpAlphaRegion.cs +++ b/Projects/Server/Gumps/GumpAlphaRegion.cs @@ -1,6 +1,20 @@ +/************************************************************************* + * ModernUO * + * Copyright (C) 2019-2021 - ModernUO Development Team * + * Email: hi@modernuo.com * + * File: GumpAlphaRegion.cs * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *************************************************************************/ + using System.Buffers; using Server.Collections; -using Server.Network; namespace Server.Gumps { @@ -30,13 +44,13 @@ namespace Server.Gumps { writer.Write((ushort)0x7B20); // "{ " writer.Write(LayoutName); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(X.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Y.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Width.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Height.ToString()); writer.Write((ushort)0x207D); // " }" } diff --git a/Projects/Server/Gumps/GumpBackground.cs b/Projects/Server/Gumps/GumpBackground.cs index 35c857a8f..7232a43f2 100644 --- a/Projects/Server/Gumps/GumpBackground.cs +++ b/Projects/Server/Gumps/GumpBackground.cs @@ -1,6 +1,20 @@ +/************************************************************************* + * ModernUO * + * Copyright (C) 2019-2021 - ModernUO Development Team * + * Email: hi@modernuo.com * + * File: GumpBackground.cs * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *************************************************************************/ + using System.Buffers; using Server.Collections; -using Server.Network; namespace Server.Gumps { @@ -33,15 +47,15 @@ namespace Server.Gumps { writer.Write((ushort)0x7B20); // "{ " writer.Write(LayoutName); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(X.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Y.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(GumpID.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Width.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Height.ToString()); writer.Write((ushort)0x207D); // " }" } diff --git a/Projects/Server/Gumps/GumpButton.cs b/Projects/Server/Gumps/GumpButton.cs index 0cbbd00ac..b87991762 100644 --- a/Projects/Server/Gumps/GumpButton.cs +++ b/Projects/Server/Gumps/GumpButton.cs @@ -1,6 +1,20 @@ +/************************************************************************* + * ModernUO * + * Copyright (C) 2019-2021 - ModernUO Development Team * + * Email: hi@modernuo.com * + * File: GumpButton.cs * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *************************************************************************/ + using System.Buffers; using Server.Collections; -using Server.Network; namespace Server.Gumps { @@ -49,19 +63,19 @@ namespace Server.Gumps { writer.Write((ushort)0x7B20); // "{ " writer.Write(LayoutName); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(X.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Y.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(NormalID.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(PressedID.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(((int)Type).ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Param.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(ButtonID.ToString()); writer.Write((ushort)0x207D); // " }" } diff --git a/Projects/Server/Gumps/GumpCheck.cs b/Projects/Server/Gumps/GumpCheck.cs index 9f490dd1c..21b5e0d71 100644 --- a/Projects/Server/Gumps/GumpCheck.cs +++ b/Projects/Server/Gumps/GumpCheck.cs @@ -1,6 +1,20 @@ +/************************************************************************* + * ModernUO * + * Copyright (C) 2019-2021 - ModernUO Development Team * + * Email: hi@modernuo.com * + * File: GumpCheck.cs * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *************************************************************************/ + using System.Buffers; using Server.Collections; -using Server.Network; namespace Server.Gumps { @@ -37,17 +51,17 @@ namespace Server.Gumps { writer.Write((ushort)0x7B20); // "{ " writer.Write(LayoutName); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(X.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Y.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(InactiveID.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(ActiveID.ToString()); - writer.Write((byte)0x20); // ' ' - writer.Write((byte)(InitialState ? 0x31 : 0x30)); // 1 or 0 - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); + writer.WriteAscii(InitialState ? '1' : '0'); + writer.WriteAscii(' '); writer.WriteAscii(SwitchID.ToString()); writer.Write((ushort)0x207D); // " }" diff --git a/Projects/Server/Gumps/GumpECHandleInput.cs b/Projects/Server/Gumps/GumpECHandleInput.cs index f8122e41c..3c3f36ea2 100644 --- a/Projects/Server/Gumps/GumpECHandleInput.cs +++ b/Projects/Server/Gumps/GumpECHandleInput.cs @@ -15,7 +15,6 @@ using System.Buffers; using Server.Collections; -using Server.Network; namespace Server.Gumps { diff --git a/Projects/Server/Gumps/GumpGroup.cs b/Projects/Server/Gumps/GumpGroup.cs index cb7c6da4a..e9d75f3f0 100644 --- a/Projects/Server/Gumps/GumpGroup.cs +++ b/Projects/Server/Gumps/GumpGroup.cs @@ -1,6 +1,20 @@ +/************************************************************************* + * ModernUO * + * Copyright (C) 2019-2021 - ModernUO Development Team * + * Email: hi@modernuo.com * + * File: GumpGroup.cs * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *************************************************************************/ + using System.Buffers; using Server.Collections; -using Server.Network; namespace Server.Gumps { @@ -17,7 +31,7 @@ namespace Server.Gumps { writer.Write((ushort)0x7B20); // "{ " writer.Write(LayoutName); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Group.ToString()); writer.Write((ushort)0x207D); // " }" } diff --git a/Projects/Server/Gumps/GumpHtml.cs b/Projects/Server/Gumps/GumpHtml.cs index e065c23d1..aa38bff9b 100644 --- a/Projects/Server/Gumps/GumpHtml.cs +++ b/Projects/Server/Gumps/GumpHtml.cs @@ -1,6 +1,20 @@ +/************************************************************************* + * ModernUO * + * Copyright (C) 2019-2021 - ModernUO Development Team * + * Email: hi@modernuo.com * + * File: GumpHtml.cs * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *************************************************************************/ + using System.Buffers; using Server.Collections; -using Server.Network; namespace Server.Gumps { @@ -40,20 +54,20 @@ namespace Server.Gumps { writer.Write((ushort)0x7B20); // "{ " writer.Write(LayoutName); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(X.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Y.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Width.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Height.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(strings.GetOrAdd(Text).ToString()); - writer.Write((byte)0x20); // ' ' - writer.Write((byte)(Background ? 0x31 : 0x30)); // 1 or 0 - writer.Write((byte)0x20); // ' ' - writer.Write((byte)(Scrollbar ? 0x31 : 0x30)); // 1 or 0 + writer.WriteAscii(' '); + writer.WriteAscii(Background ? '1' : '0'); + writer.WriteAscii(' '); + writer.WriteAscii(Scrollbar ? '1' : '0'); writer.Write((ushort)0x207D); // " }" } } diff --git a/Projects/Server/Gumps/GumpHtmlLocalized.cs b/Projects/Server/Gumps/GumpHtmlLocalized.cs index 902bd0186..39fe020b4 100644 --- a/Projects/Server/Gumps/GumpHtmlLocalized.cs +++ b/Projects/Server/Gumps/GumpHtmlLocalized.cs @@ -1,6 +1,20 @@ +/************************************************************************* + * ModernUO * + * Copyright (C) 2019-2021 - ModernUO Development Team * + * Email: hi@modernuo.com * + * File: GumpHtmlLocalized.cs * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *************************************************************************/ + using System.Buffers; using Server.Collections; -using Server.Network; namespace Server.Gumps { @@ -110,41 +124,41 @@ namespace Server.Gumps case GumpHtmlLocalizedType.Plain: { writer.Write(LayoutNamePlain); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(X.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Y.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Width.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Height.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Number.ToString()); - writer.Write((byte)0x20); // ' ' - writer.Write((byte)(Background ? 0x31 : 0x30)); // 1 or 0 - writer.Write((byte)0x20); // ' ' - writer.Write((byte)(Scrollbar ? 0x31 : 0x30)); // 1 or 0 + writer.WriteAscii(' '); + writer.WriteAscii(Background ? '1' : '0'); + writer.WriteAscii(' '); + writer.WriteAscii(Scrollbar ? '1' : '0'); break; } case GumpHtmlLocalizedType.Color: { writer.Write(LayoutNameColor); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(X.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Y.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Width.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Height.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Number.ToString()); - writer.Write((byte)0x20); // ' ' - writer.Write((byte)(Background ? 0x31 : 0x30)); // 1 or 0 - writer.Write((byte)0x20); // ' ' - writer.Write((byte)(Scrollbar ? 0x31 : 0x30)); // 1 or 0 - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); + writer.WriteAscii(Background ? '1' : '0'); + writer.WriteAscii(' '); + writer.WriteAscii(Scrollbar ? '1' : '0'); + writer.WriteAscii(' '); writer.WriteAscii(Color.ToString()); break; @@ -152,26 +166,26 @@ namespace Server.Gumps case GumpHtmlLocalizedType.Args: { writer.Write(LayoutNameArgs); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(X.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Y.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Width.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Height.ToString()); - writer.Write((byte)0x20); // ' ' - writer.Write((byte)(Background ? 0x31 : 0x30)); // 1 or 0 - writer.Write((byte)0x20); // ' ' - writer.Write((byte)(Scrollbar ? 0x31 : 0x30)); // 1 or 0 - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); + writer.WriteAscii(Background ? '1' : '0'); + writer.WriteAscii(' '); + writer.WriteAscii(Scrollbar ? '1' : '0'); + writer.WriteAscii(' '); writer.WriteAscii(Color.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Number.ToString()); - writer.Write((byte)0x20); // ' ' - writer.Write((byte)0x40); // '@' + writer.WriteAscii(' '); + writer.WriteAscii('@'); writer.WriteAscii(Args ?? ""); - writer.Write((byte)0x40); // '@' + writer.WriteAscii('@'); break; } diff --git a/Projects/Server/Gumps/GumpImage.cs b/Projects/Server/Gumps/GumpImage.cs index dd9b804a1..6122fecff 100644 --- a/Projects/Server/Gumps/GumpImage.cs +++ b/Projects/Server/Gumps/GumpImage.cs @@ -1,6 +1,20 @@ +/************************************************************************* + * ModernUO * + * Copyright (C) 2019-2021 - ModernUO Development Team * + * Email: hi@modernuo.com * + * File: GumpImage.cs * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *************************************************************************/ + using System.Buffers; using Server.Collections; -using Server.Network; namespace Server.Gumps { @@ -36,11 +50,11 @@ namespace Server.Gumps { writer.Write((ushort)0x7B20); // "{ " writer.Write(LayoutName); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(X.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Y.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(GumpID.ToString()); if (Hue != 0) diff --git a/Projects/Server/Gumps/GumpImageTileButton.cs b/Projects/Server/Gumps/GumpImageTileButton.cs index 51ed6119d..383a42649 100644 --- a/Projects/Server/Gumps/GumpImageTileButton.cs +++ b/Projects/Server/Gumps/GumpImageTileButton.cs @@ -1,6 +1,20 @@ +/************************************************************************* + * ModernUO * + * Copyright (C) 2019-2021 - ModernUO Development Team * + * Email: hi@modernuo.com * + * File: GumpImageTileButton.cs * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *************************************************************************/ + using System.Buffers; using Server.Collections; -using Server.Network; namespace Server.Gumps { @@ -66,27 +80,27 @@ namespace Server.Gumps { writer.Write((ushort)0x7B20); // "{ " writer.Write(LayoutName); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(X.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Y.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(NormalID.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(PressedID.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(((int)Type).ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Param.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(ButtonID.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(ItemID.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Hue.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Width.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Height.ToString()); if (LocalizedTooltip > 0) diff --git a/Projects/Server/Gumps/GumpImageTiled.cs b/Projects/Server/Gumps/GumpImageTiled.cs index 3e4b7e3e4..30c0c7800 100644 --- a/Projects/Server/Gumps/GumpImageTiled.cs +++ b/Projects/Server/Gumps/GumpImageTiled.cs @@ -1,6 +1,20 @@ +/************************************************************************* + * ModernUO * + * Copyright (C) 2019-2021 - ModernUO Development Team * + * Email: hi@modernuo.com * + * File: GumpImageTiled.cs * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *************************************************************************/ + using System.Buffers; using Server.Collections; -using Server.Network; namespace Server.Gumps { @@ -32,15 +46,15 @@ namespace Server.Gumps { writer.Write((ushort)0x7B20); // "{ " writer.Write(LayoutName); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(X.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Y.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Width.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Height.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(GumpID.ToString()); writer.Write((ushort)0x207D); // " }" } diff --git a/Projects/Server/Gumps/GumpItem.cs b/Projects/Server/Gumps/GumpItem.cs index 18cd3e59a..ff3389b27 100644 --- a/Projects/Server/Gumps/GumpItem.cs +++ b/Projects/Server/Gumps/GumpItem.cs @@ -1,6 +1,20 @@ +/************************************************************************* + * ModernUO * + * Copyright (C) 2019-2021 - ModernUO Development Team * + * Email: hi@modernuo.com * + * File: GumpItem.cs * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *************************************************************************/ + using System.Buffers; using Server.Collections; -using Server.Network; namespace Server.Gumps { @@ -31,16 +45,16 @@ namespace Server.Gumps public override void AppendTo(ref SpanWriter writer, OrderedHashSet strings, ref int entries, ref int switches) { writer.Write(Hue == 0 ? LayoutName : LayoutNameHue); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(X.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Y.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(ItemID.ToString()); if (Hue != 0) { - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Hue.ToString()); } diff --git a/Projects/Server/Gumps/GumpItemProperty.cs b/Projects/Server/Gumps/GumpItemProperty.cs index fc030a23a..1d97d0992 100644 --- a/Projects/Server/Gumps/GumpItemProperty.cs +++ b/Projects/Server/Gumps/GumpItemProperty.cs @@ -1,6 +1,20 @@ +/************************************************************************* + * ModernUO * + * Copyright (C) 2019-2021 - ModernUO Development Team * + * Email: hi@modernuo.com * + * File: GumpItemProperty.cs * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *************************************************************************/ + using System.Buffers; using Server.Collections; -using Server.Network; namespace Server.Gumps { @@ -18,7 +32,7 @@ namespace Server.Gumps { writer.Write((ushort)0x7B20); // "{ " writer.Write(LayoutName); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Serial.ToString()); writer.Write((ushort)0x207D); // " }" } diff --git a/Projects/Server/Gumps/GumpLabel.cs b/Projects/Server/Gumps/GumpLabel.cs index c4c9b3396..95ec04503 100644 --- a/Projects/Server/Gumps/GumpLabel.cs +++ b/Projects/Server/Gumps/GumpLabel.cs @@ -1,6 +1,20 @@ +/************************************************************************* + * ModernUO * + * Copyright (C) 2019-2021 - ModernUO Development Team * + * Email: hi@modernuo.com * + * File: GumpLabel.cs * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *************************************************************************/ + using System.Buffers; using Server.Collections; -using Server.Network; namespace Server.Gumps { @@ -29,13 +43,13 @@ namespace Server.Gumps { writer.Write((ushort)0x7B20); // "{ " writer.Write(LayoutName); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(X.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Y.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Hue.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(strings.GetOrAdd(Text).ToString()); writer.Write((ushort)0x207D); // " }" } diff --git a/Projects/Server/Gumps/GumpLabelCropped.cs b/Projects/Server/Gumps/GumpLabelCropped.cs index 233dc59dd..f31a1a6a1 100644 --- a/Projects/Server/Gumps/GumpLabelCropped.cs +++ b/Projects/Server/Gumps/GumpLabelCropped.cs @@ -1,6 +1,20 @@ +/************************************************************************* + * ModernUO * + * Copyright (C) 2019-2021 - ModernUO Development Team * + * Email: hi@modernuo.com * + * File: GumpLabelCropped.cs * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *************************************************************************/ + using System.Buffers; using Server.Collections; -using Server.Network; namespace Server.Gumps { @@ -37,17 +51,17 @@ namespace Server.Gumps { writer.Write((ushort)0x7B20); // "{ " writer.Write(LayoutName); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(X.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Y.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Width.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Height.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Hue.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(strings.GetOrAdd(Text).ToString()); writer.Write((ushort)0x207D); // " }" } diff --git a/Projects/Server/Gumps/GumpMasterGump.cs b/Projects/Server/Gumps/GumpMasterGump.cs index fae0148b9..035b1ec9b 100644 --- a/Projects/Server/Gumps/GumpMasterGump.cs +++ b/Projects/Server/Gumps/GumpMasterGump.cs @@ -15,7 +15,6 @@ using System.Buffers; using Server.Collections; -using Server.Network; namespace Server.Gumps { @@ -33,7 +32,7 @@ namespace Server.Gumps { writer.Write((ushort)0x7B20); // "{ " writer.Write(LayoutName); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(GumpID.ToString()); writer.Write((ushort)0x207D); // " }" } diff --git a/Projects/Server/Gumps/GumpPage.cs b/Projects/Server/Gumps/GumpPage.cs index c48fa7c97..16aa448d7 100644 --- a/Projects/Server/Gumps/GumpPage.cs +++ b/Projects/Server/Gumps/GumpPage.cs @@ -1,6 +1,20 @@ +/************************************************************************* + * ModernUO * + * Copyright (C) 2019-2021 - ModernUO Development Team * + * Email: hi@modernuo.com * + * File: GumpPage.cs * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *************************************************************************/ + using System.Buffers; using Server.Collections; -using Server.Network; namespace Server.Gumps { @@ -17,7 +31,7 @@ namespace Server.Gumps { writer.Write((ushort)0x7B20); // "{ " writer.Write(LayoutName); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Page.ToString()); writer.Write((ushort)0x207D); // " }" } diff --git a/Projects/Server/Gumps/GumpRadio.cs b/Projects/Server/Gumps/GumpRadio.cs index eb5e4e51a..ff7d6d32c 100644 --- a/Projects/Server/Gumps/GumpRadio.cs +++ b/Projects/Server/Gumps/GumpRadio.cs @@ -1,6 +1,20 @@ +/************************************************************************* + * ModernUO * + * Copyright (C) 2019-2021 - ModernUO Development Team * + * Email: hi@modernuo.com * + * File: GumpRadio.cs * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *************************************************************************/ + using System.Buffers; using Server.Collections; -using Server.Network; namespace Server.Gumps { @@ -37,17 +51,17 @@ namespace Server.Gumps { writer.Write((ushort)0x7B20); // "{ " writer.Write(LayoutName); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(X.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Y.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(InactiveID.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(ActiveID.ToString()); - writer.Write((byte)0x20); // ' ' - writer.Write((byte)(InitialState ? 0x31 : 0x30)); // 1 or 0 - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); + writer.WriteAscii(InitialState ? '1' : '0'); + writer.WriteAscii(' '); writer.WriteAscii(SwitchID.ToString()); writer.Write((ushort)0x207D); // " }" diff --git a/Projects/Server/Gumps/GumpSpriteImage.cs b/Projects/Server/Gumps/GumpSpriteImage.cs index 12acb5adc..59c8e8492 100644 --- a/Projects/Server/Gumps/GumpSpriteImage.cs +++ b/Projects/Server/Gumps/GumpSpriteImage.cs @@ -15,7 +15,6 @@ using System.Buffers; using Server.Collections; -using Server.Network; namespace Server.Gumps { @@ -54,19 +53,19 @@ namespace Server.Gumps { writer.Write((ushort)0x7B20); // "{ " writer.Write(LayoutName); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(X.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Y.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(GumpID.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Width.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Height.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(SX.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(SY.ToString()); writer.Write((ushort)0x207D); // " }" } diff --git a/Projects/Server/Gumps/GumpTextEntry.cs b/Projects/Server/Gumps/GumpTextEntry.cs index 9b5671aad..43740cc1c 100644 --- a/Projects/Server/Gumps/GumpTextEntry.cs +++ b/Projects/Server/Gumps/GumpTextEntry.cs @@ -1,6 +1,20 @@ +/************************************************************************* + * ModernUO * + * Copyright (C) 2019-2021 - ModernUO Development Team * + * Email: hi@modernuo.com * + * File: GumpTextEntry.cs * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *************************************************************************/ + using System.Buffers; using Server.Collections; -using Server.Network; namespace Server.Gumps { @@ -40,19 +54,19 @@ namespace Server.Gumps { writer.Write((ushort)0x7B20); // "{ " writer.Write(LayoutName); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(X.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Y.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Width.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Height.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Hue.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(EntryID.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(strings.GetOrAdd(InitialText).ToString()); writer.Write((ushort)0x207D); // " }" diff --git a/Projects/Server/Gumps/GumpTextEntryLimited.cs b/Projects/Server/Gumps/GumpTextEntryLimited.cs index 8e887ce0f..906582b59 100644 --- a/Projects/Server/Gumps/GumpTextEntryLimited.cs +++ b/Projects/Server/Gumps/GumpTextEntryLimited.cs @@ -1,6 +1,20 @@ +/************************************************************************* + * ModernUO * + * Copyright (C) 2019-2021 - ModernUO Development Team * + * Email: hi@modernuo.com * + * File: GumpTextEntryLimited.cs * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *************************************************************************/ + using System.Buffers; using Server.Collections; -using Server.Network; namespace Server.Gumps { @@ -45,21 +59,21 @@ namespace Server.Gumps { writer.Write((ushort)0x7B20); // "{ " writer.Write(LayoutName); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(X.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Y.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Width.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Height.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Hue.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(EntryID.ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(strings.GetOrAdd(InitialText).ToString()); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Size.ToString()); writer.Write((ushort)0x207D); // " }" diff --git a/Projects/Server/Gumps/GumpTooltip.cs b/Projects/Server/Gumps/GumpTooltip.cs index 66ff5fb19..6898e2b78 100644 --- a/Projects/Server/Gumps/GumpTooltip.cs +++ b/Projects/Server/Gumps/GumpTooltip.cs @@ -15,7 +15,6 @@ using System.Buffers; using Server.Collections; -using Server.Network; namespace Server.Gumps { @@ -40,15 +39,15 @@ namespace Server.Gumps { writer.Write((ushort)0x7B20); // "{ " writer.Write(LayoutName); - writer.Write((byte)0x20); // ' ' + writer.WriteAscii(' '); writer.WriteAscii(Number.ToString()); if (!string.IsNullOrEmpty(Args)) { - writer.Write((byte)0x20); // ' ' - writer.Write((byte)0x40); // '@' + writer.WriteAscii(' '); + writer.WriteAscii('@'); writer.WriteAscii(Args); - writer.Write((byte)0x40); // '@' + writer.WriteAscii('@'); } writer.Write((ushort)0x207D); // " }" diff --git a/Projects/Server/Network/Packets/OutgoingMovementPackets.cs b/Projects/Server/Network/Packets/OutgoingMovementPackets.cs index 65ee87e7b..78ee3c892 100644 --- a/Projects/Server/Network/Packets/OutgoingMovementPackets.cs +++ b/Projects/Server/Network/Packets/OutgoingMovementPackets.cs @@ -14,7 +14,6 @@ *************************************************************************/ using System.Buffers; -using System.IO; using System.Runtime.CompilerServices; namespace Server.Network diff --git a/Projects/Server/Network/Packets/OutgoingPlayerPackets.cs b/Projects/Server/Network/Packets/OutgoingPlayerPackets.cs index 56e25e555..f6f0b4b1c 100644 --- a/Projects/Server/Network/Packets/OutgoingPlayerPackets.cs +++ b/Projects/Server/Network/Packets/OutgoingPlayerPackets.cs @@ -15,7 +15,6 @@ using System; using System.Buffers; -using System.IO; using System.Runtime.CompilerServices; namespace Server.Network diff --git a/Projects/Server/Network/Packets/OutgoingTargetPackets.cs b/Projects/Server/Network/Packets/OutgoingTargetPackets.cs index f44f0c2fd..04b3a7e08 100644 --- a/Projects/Server/Network/Packets/OutgoingTargetPackets.cs +++ b/Projects/Server/Network/Packets/OutgoingTargetPackets.cs @@ -13,7 +13,6 @@ * along with this program. If not, see . * *************************************************************************/ -using System; using System.Buffers; using Server.Targeting; diff --git a/Projects/Server/Network/Packets/OutgoingVendorBuyPackets.cs b/Projects/Server/Network/Packets/OutgoingVendorBuyPackets.cs index 39c413156..6abcdc3b0 100644 --- a/Projects/Server/Network/Packets/OutgoingVendorBuyPackets.cs +++ b/Projects/Server/Network/Packets/OutgoingVendorBuyPackets.cs @@ -15,7 +15,6 @@ using System.Buffers; using System.Collections.Generic; -using System.IO; using Server.Items; namespace Server.Network diff --git a/Projects/Server/ObjectPropertyList.cs b/Projects/Server/ObjectPropertyList.cs index 1b741563e..55d7d4aeb 100644 --- a/Projects/Server/ObjectPropertyList.cs +++ b/Projects/Server/ObjectPropertyList.cs @@ -2,7 +2,6 @@ using System; using System.Buffers; using System.IO; using System.Runtime.CompilerServices; -using System.Text; using Server.Network; namespace Server