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
This commit is contained in:
Kamron Batman 2021-01-06 01:17:34 -08:00 • committed by GitHub
parent 03bdff2293
commit dfe89024ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 407 additions and 161 deletions

View file

@ -225,6 +225,9 @@ namespace System.Buffers
Position += count;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void WriteAscii(char chr) => Write((byte)chr);
public void WriteString<T>(string value, Encoding encoding, int fixedLength = -1) where T : struct, IEquatable<T>
{
int sizeT = Unsafe.SizeOf<T>();

View file

@ -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 <http://www.gnu.org/licenses/>. *
*************************************************************************/
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); // " }"
}

View file

@ -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 <http://www.gnu.org/licenses/>. *
*************************************************************************/
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); // " }"
}

View file

@ -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 <http://www.gnu.org/licenses/>. *
*************************************************************************/
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); // " }"
}

View file

@ -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 <http://www.gnu.org/licenses/>. *
*************************************************************************/
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); // " }"

View file

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

View file

@ -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 <http://www.gnu.org/licenses/>. *
*************************************************************************/
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); // " }"
}

View file

@ -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 <http://www.gnu.org/licenses/>. *
*************************************************************************/
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); // " }"
}
}

View file

@ -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 <http://www.gnu.org/licenses/>. *
*************************************************************************/
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;
}

View file

@ -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 <http://www.gnu.org/licenses/>. *
*************************************************************************/
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)

View file

@ -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 <http://www.gnu.org/licenses/>. *
*************************************************************************/
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)

View file

@ -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 <http://www.gnu.org/licenses/>. *
*************************************************************************/
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); // " }"
}

View file

@ -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 <http://www.gnu.org/licenses/>. *
*************************************************************************/
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<string> 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());
}

View file

@ -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 <http://www.gnu.org/licenses/>. *
*************************************************************************/
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); // " }"
}

View file

@ -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 <http://www.gnu.org/licenses/>. *
*************************************************************************/
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); // " }"
}

View file

@ -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 <http://www.gnu.org/licenses/>. *
*************************************************************************/
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); // " }"
}

View file

@ -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); // " }"
}

View file

@ -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 <http://www.gnu.org/licenses/>. *
*************************************************************************/
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); // " }"
}

View file

@ -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 <http://www.gnu.org/licenses/>. *
*************************************************************************/
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); // " }"

View file

@ -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); // " }"
}

View file

@ -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 <http://www.gnu.org/licenses/>. *
*************************************************************************/
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); // " }"

View file

@ -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 <http://www.gnu.org/licenses/>. *
*************************************************************************/
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); // " }"

View file

@ -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); // " }"

View file

@ -14,7 +14,6 @@
*************************************************************************/
using System.Buffers;
using System.IO;
using System.Runtime.CompilerServices;
namespace Server.Network

View file

@ -15,7 +15,6 @@
using System;
using System.Buffers;
using System.IO;
using System.Runtime.CompilerServices;
namespace Server.Network

View file

@ -13,7 +13,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*************************************************************************/
using System;
using System.Buffers;
using Server.Targeting;

View file

@ -15,7 +15,6 @@
using System.Buffers;
using System.Collections.Generic;
using System.IO;
using Server.Items;
namespace Server.Network

View file

@ -2,7 +2,6 @@ using System;
using System.Buffers;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using Server.Network;
namespace Server