fix: Removes support for v4 Client and old gump packet. (#1739)
### Summary * Removes old gump packet support * Removes support for v4 clients * Removes `Unpack` flag and assumes it is always true. * Removes StringToBuffer since this is built into .NET now. > [!Note] > View the file changes with white space off: https://github.com/modernuo/ModernUO/pull/1739/files?diff=split&w=1
This commit is contained in:
parent
98d31bc707
commit
9cd84ba3d6
14 changed files with 1015 additions and 1191 deletions
|
|
@ -2,477 +2,464 @@ using System.Collections.Generic;
|
||||||
using Server.Gumps;
|
using Server.Gumps;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Tests.Network
|
namespace Server.Tests.Network;
|
||||||
|
|
||||||
|
public static class GumpUtilities
|
||||||
{
|
{
|
||||||
public static class GumpUtilities
|
public static Packet Compile(this Gump g, NetState ns = null)
|
||||||
{
|
{
|
||||||
private static readonly byte[] m_BeginLayout = Gump.StringToBuffer("{ ");
|
IGumpWriter disp = new DisplayGumpPacked(g);
|
||||||
private static readonly byte[] m_EndLayout = Gump.StringToBuffer(" }");
|
|
||||||
|
|
||||||
public static Packet Compile(this Gump g, NetState ns = null)
|
if (!g.Draggable)
|
||||||
{
|
{
|
||||||
IGumpWriter disp;
|
disp.AppendLayout("{ nomove }"u8);
|
||||||
|
|
||||||
if (ns?.Unpack == true)
|
|
||||||
{
|
|
||||||
disp = new DisplayGumpPacked(g);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
disp = new DisplayGumpFast(g);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!g.Draggable)
|
|
||||||
{
|
|
||||||
disp.AppendLayout(Gump.NoMove);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!g.Closable)
|
|
||||||
{
|
|
||||||
disp.AppendLayout(Gump.NoClose);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!g.Disposable)
|
|
||||||
{
|
|
||||||
disp.AppendLayout(Gump.NoDispose);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!g.Resizable)
|
|
||||||
{
|
|
||||||
disp.AppendLayout(Gump.NoResize);
|
|
||||||
}
|
|
||||||
|
|
||||||
var count = g.Entries.Count;
|
|
||||||
var strings = new List<string>();
|
|
||||||
|
|
||||||
for (var i = 0; i < count; ++i)
|
|
||||||
{
|
|
||||||
var e = g.Entries[i];
|
|
||||||
|
|
||||||
disp.AppendLayout(m_BeginLayout);
|
|
||||||
e.AppendToByType(disp, strings);
|
|
||||||
disp.AppendLayout(m_EndLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
disp.WriteStrings(strings);
|
|
||||||
|
|
||||||
disp.Flush();
|
|
||||||
|
|
||||||
return (Packet)disp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int Intern(this List<string> strings, string value)
|
if (!g.Closable)
|
||||||
{
|
{
|
||||||
var indexOf = strings.IndexOf(value);
|
disp.AppendLayout("{ noclose }"u8);
|
||||||
|
|
||||||
if (indexOf >= 0)
|
|
||||||
{
|
|
||||||
return indexOf;
|
|
||||||
}
|
|
||||||
|
|
||||||
strings.Add(value);
|
|
||||||
return strings.Count - 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AppendToByType(this GumpEntry e, IGumpWriter disp, List<string> strings)
|
if (!g.Disposable)
|
||||||
{
|
{
|
||||||
switch (e)
|
disp.AppendLayout("{ nodispose }"u8);
|
||||||
{
|
|
||||||
case GumpAlphaRegion g:
|
|
||||||
{
|
|
||||||
g.AppendTo(disp, strings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GumpBackground g:
|
|
||||||
{
|
|
||||||
g.AppendTo(disp, strings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GumpButton g:
|
|
||||||
{
|
|
||||||
g.AppendTo(disp, strings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GumpCheck g:
|
|
||||||
{
|
|
||||||
g.AppendTo(disp, strings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GumpGroup g:
|
|
||||||
{
|
|
||||||
g.AppendTo(disp, strings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GumpECHandleInput g:
|
|
||||||
{
|
|
||||||
g.AppendTo(disp, strings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GumpHtml g:
|
|
||||||
{
|
|
||||||
g.AppendTo(disp, strings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GumpHtmlLocalized g:
|
|
||||||
{
|
|
||||||
g.AppendTo(disp, strings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GumpImage g:
|
|
||||||
{
|
|
||||||
g.AppendTo(disp, strings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GumpImageTileButton g:
|
|
||||||
{
|
|
||||||
g.AppendTo(disp, strings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GumpImageTiled g:
|
|
||||||
{
|
|
||||||
g.AppendTo(disp, strings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GumpItem g:
|
|
||||||
{
|
|
||||||
g.AppendTo(disp, strings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GumpItemProperty g:
|
|
||||||
{
|
|
||||||
g.AppendTo(disp, strings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GumpLabel g:
|
|
||||||
{
|
|
||||||
g.AppendTo(disp, strings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GumpLabelCropped g:
|
|
||||||
{
|
|
||||||
g.AppendTo(disp, strings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GumpMasterGump g:
|
|
||||||
{
|
|
||||||
g.AppendTo(disp, strings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GumpPage g:
|
|
||||||
{
|
|
||||||
g.AppendTo(disp, strings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GumpRadio g:
|
|
||||||
{
|
|
||||||
g.AppendTo(disp, strings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GumpSpriteImage g:
|
|
||||||
{
|
|
||||||
g.AppendTo(disp, strings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GumpTextEntry g:
|
|
||||||
{
|
|
||||||
g.AppendTo(disp, strings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GumpTextEntryLimited g:
|
|
||||||
{
|
|
||||||
g.AppendTo(disp, strings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GumpTooltip g:
|
|
||||||
{
|
|
||||||
g.AppendTo(disp, strings);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AppendTo(this GumpAlphaRegion g, IGumpWriter disp, List<string> strings)
|
if (!g.Resizable)
|
||||||
{
|
{
|
||||||
disp.AppendLayout(Gump.StringToBuffer("checkertrans"));
|
disp.AppendLayout("{ noresize }"u8);
|
||||||
disp.AppendLayout(g.X);
|
|
||||||
disp.AppendLayout(g.Y);
|
|
||||||
disp.AppendLayout(g.Width);
|
|
||||||
disp.AppendLayout(g.Height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AppendTo(this GumpBackground g, IGumpWriter disp, List<string> strings)
|
var count = g.Entries.Count;
|
||||||
|
var strings = new List<string>();
|
||||||
|
|
||||||
|
for (var i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
disp.AppendLayout(Gump.StringToBuffer("resizepic"));
|
var e = g.Entries[i];
|
||||||
disp.AppendLayout(g.X);
|
|
||||||
disp.AppendLayout(g.Y);
|
disp.AppendLayout("{ "u8);
|
||||||
disp.AppendLayout(g.GumpID);
|
e.AppendToByType(disp, strings);
|
||||||
disp.AppendLayout(g.Width);
|
disp.AppendLayout(" }"u8);
|
||||||
disp.AppendLayout(g.Height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AppendTo(this GumpButton g, IGumpWriter disp, List<string> strings)
|
disp.WriteStrings(strings);
|
||||||
|
|
||||||
|
disp.Flush();
|
||||||
|
|
||||||
|
return (Packet)disp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int Intern(this List<string> strings, string value)
|
||||||
|
{
|
||||||
|
var indexOf = strings.IndexOf(value);
|
||||||
|
|
||||||
|
if (indexOf >= 0)
|
||||||
{
|
{
|
||||||
disp.AppendLayout(Gump.StringToBuffer("button"));
|
return indexOf;
|
||||||
disp.AppendLayout(g.X);
|
|
||||||
disp.AppendLayout(g.Y);
|
|
||||||
disp.AppendLayout(g.NormalID);
|
|
||||||
disp.AppendLayout(g.PressedID);
|
|
||||||
disp.AppendLayout((int)g.Type);
|
|
||||||
disp.AppendLayout(g.Param);
|
|
||||||
disp.AppendLayout(g.ButtonID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AppendTo(this GumpCheck g, IGumpWriter disp, List<string> strings)
|
strings.Add(value);
|
||||||
{
|
return strings.Count - 1;
|
||||||
disp.AppendLayout(Gump.StringToBuffer("checkbox"));
|
}
|
||||||
disp.AppendLayout(g.X);
|
|
||||||
disp.AppendLayout(g.Y);
|
|
||||||
disp.AppendLayout(g.InactiveID);
|
|
||||||
disp.AppendLayout(g.ActiveID);
|
|
||||||
disp.AppendLayout(g.InitialState);
|
|
||||||
disp.AppendLayout(g.SwitchID);
|
|
||||||
|
|
||||||
disp.Switches++;
|
public static void AppendToByType(this GumpEntry e, IGumpWriter disp, List<string> strings)
|
||||||
|
{
|
||||||
|
switch (e)
|
||||||
|
{
|
||||||
|
case GumpAlphaRegion g:
|
||||||
|
{
|
||||||
|
g.AppendTo(disp, strings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GumpBackground g:
|
||||||
|
{
|
||||||
|
g.AppendTo(disp, strings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GumpButton g:
|
||||||
|
{
|
||||||
|
g.AppendTo(disp, strings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GumpCheck g:
|
||||||
|
{
|
||||||
|
g.AppendTo(disp, strings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GumpGroup g:
|
||||||
|
{
|
||||||
|
g.AppendTo(disp, strings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GumpECHandleInput g:
|
||||||
|
{
|
||||||
|
g.AppendTo(disp, strings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GumpHtml g:
|
||||||
|
{
|
||||||
|
g.AppendTo(disp, strings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GumpHtmlLocalized g:
|
||||||
|
{
|
||||||
|
g.AppendTo(disp, strings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GumpImage g:
|
||||||
|
{
|
||||||
|
g.AppendTo(disp, strings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GumpImageTileButton g:
|
||||||
|
{
|
||||||
|
g.AppendTo(disp, strings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GumpImageTiled g:
|
||||||
|
{
|
||||||
|
g.AppendTo(disp, strings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GumpItem g:
|
||||||
|
{
|
||||||
|
g.AppendTo(disp, strings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GumpItemProperty g:
|
||||||
|
{
|
||||||
|
g.AppendTo(disp, strings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GumpLabel g:
|
||||||
|
{
|
||||||
|
g.AppendTo(disp, strings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GumpLabelCropped g:
|
||||||
|
{
|
||||||
|
g.AppendTo(disp, strings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GumpMasterGump g:
|
||||||
|
{
|
||||||
|
g.AppendTo(disp, strings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GumpPage g:
|
||||||
|
{
|
||||||
|
g.AppendTo(disp, strings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GumpRadio g:
|
||||||
|
{
|
||||||
|
g.AppendTo(disp, strings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GumpSpriteImage g:
|
||||||
|
{
|
||||||
|
g.AppendTo(disp, strings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GumpTextEntry g:
|
||||||
|
{
|
||||||
|
g.AppendTo(disp, strings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GumpTextEntryLimited g:
|
||||||
|
{
|
||||||
|
g.AppendTo(disp, strings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GumpTooltip g:
|
||||||
|
{
|
||||||
|
g.AppendTo(disp, strings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AppendTo(this GumpAlphaRegion g, IGumpWriter disp, List<string> strings)
|
||||||
|
{
|
||||||
|
disp.AppendLayout("checkertrans"u8);
|
||||||
|
disp.AppendLayout(g.X);
|
||||||
|
disp.AppendLayout(g.Y);
|
||||||
|
disp.AppendLayout(g.Width);
|
||||||
|
disp.AppendLayout(g.Height);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AppendTo(this GumpBackground g, IGumpWriter disp, List<string> strings)
|
||||||
|
{
|
||||||
|
disp.AppendLayout("resizepic"u8);
|
||||||
|
disp.AppendLayout(g.X);
|
||||||
|
disp.AppendLayout(g.Y);
|
||||||
|
disp.AppendLayout(g.GumpID);
|
||||||
|
disp.AppendLayout(g.Width);
|
||||||
|
disp.AppendLayout(g.Height);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AppendTo(this GumpButton g, IGumpWriter disp, List<string> strings)
|
||||||
|
{
|
||||||
|
disp.AppendLayout("button"u8);
|
||||||
|
disp.AppendLayout(g.X);
|
||||||
|
disp.AppendLayout(g.Y);
|
||||||
|
disp.AppendLayout(g.NormalID);
|
||||||
|
disp.AppendLayout(g.PressedID);
|
||||||
|
disp.AppendLayout((int)g.Type);
|
||||||
|
disp.AppendLayout(g.Param);
|
||||||
|
disp.AppendLayout(g.ButtonID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AppendTo(this GumpCheck g, IGumpWriter disp, List<string> strings)
|
||||||
|
{
|
||||||
|
disp.AppendLayout("checkbox"u8);
|
||||||
|
disp.AppendLayout(g.X);
|
||||||
|
disp.AppendLayout(g.Y);
|
||||||
|
disp.AppendLayout(g.InactiveID);
|
||||||
|
disp.AppendLayout(g.ActiveID);
|
||||||
|
disp.AppendLayout(g.InitialState);
|
||||||
|
disp.AppendLayout(g.SwitchID);
|
||||||
|
|
||||||
|
disp.Switches++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AppendTo(this GumpGroup g, IGumpWriter disp, List<string> strings)
|
||||||
|
{
|
||||||
|
disp.AppendLayout("group"u8);
|
||||||
|
disp.AppendLayout(g.Group);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AppendTo(this GumpECHandleInput g, IGumpWriter disp, List<string> strings)
|
||||||
|
{
|
||||||
|
disp.AppendLayout("echandleinput"u8);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AppendTo(this GumpHtml g, IGumpWriter disp, List<string> strings)
|
||||||
|
{
|
||||||
|
disp.AppendLayout("htmlgump"u8);
|
||||||
|
disp.AppendLayout(g.X);
|
||||||
|
disp.AppendLayout(g.Y);
|
||||||
|
disp.AppendLayout(g.Width);
|
||||||
|
disp.AppendLayout(g.Height);
|
||||||
|
disp.AppendLayout(strings.Intern(g.Text));
|
||||||
|
disp.AppendLayout(g.Background);
|
||||||
|
disp.AppendLayout(g.Scrollbar);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AppendTo(this GumpHtmlLocalized g, IGumpWriter disp, List<string> strings)
|
||||||
|
{
|
||||||
|
switch (g.Type)
|
||||||
|
{
|
||||||
|
case GumpHtmlLocalizedType.Plain:
|
||||||
|
{
|
||||||
|
disp.AppendLayout("xmfhtmlgump"u8);
|
||||||
|
|
||||||
|
disp.AppendLayout(g.X);
|
||||||
|
disp.AppendLayout(g.Y);
|
||||||
|
disp.AppendLayout(g.Width);
|
||||||
|
disp.AppendLayout(g.Height);
|
||||||
|
disp.AppendLayout(g.Number);
|
||||||
|
disp.AppendLayout(g.Background);
|
||||||
|
disp.AppendLayout(g.Scrollbar);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case GumpHtmlLocalizedType.Color:
|
||||||
|
{
|
||||||
|
disp.AppendLayout("xmfhtmlgumpcolor"u8);
|
||||||
|
|
||||||
|
disp.AppendLayout(g.X);
|
||||||
|
disp.AppendLayout(g.Y);
|
||||||
|
disp.AppendLayout(g.Width);
|
||||||
|
disp.AppendLayout(g.Height);
|
||||||
|
disp.AppendLayout(g.Number);
|
||||||
|
disp.AppendLayout(g.Background);
|
||||||
|
disp.AppendLayout(g.Scrollbar);
|
||||||
|
disp.AppendLayout(g.Color);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case GumpHtmlLocalizedType.Args:
|
||||||
|
{
|
||||||
|
disp.AppendLayout("xmfhtmltok"u8);
|
||||||
|
|
||||||
|
disp.AppendLayout(g.X);
|
||||||
|
disp.AppendLayout(g.Y);
|
||||||
|
disp.AppendLayout(g.Width);
|
||||||
|
disp.AppendLayout(g.Height);
|
||||||
|
disp.AppendLayout(g.Background);
|
||||||
|
disp.AppendLayout(g.Scrollbar);
|
||||||
|
disp.AppendLayout(g.Color);
|
||||||
|
disp.AppendLayout(g.Number);
|
||||||
|
disp.AppendLayout(g.Args);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AppendTo(this GumpImage g, IGumpWriter disp, List<string> strings)
|
||||||
|
{
|
||||||
|
disp.AppendLayout("gumppic"u8);
|
||||||
|
disp.AppendLayout(g.X);
|
||||||
|
disp.AppendLayout(g.Y);
|
||||||
|
disp.AppendLayout(g.GumpID);
|
||||||
|
|
||||||
|
if (g.Hue != 0)
|
||||||
|
{
|
||||||
|
disp.AppendLayoutNS(" hue=");
|
||||||
|
disp.AppendLayoutNS(g.Hue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AppendTo(this GumpGroup g, IGumpWriter disp, List<string> strings)
|
if (!string.IsNullOrEmpty(g.Class))
|
||||||
{
|
{
|
||||||
disp.AppendLayout(Gump.StringToBuffer("group"));
|
disp.AppendLayoutNS(" class=");
|
||||||
disp.AppendLayout(g.Group);
|
disp.AppendLayout(g.Class);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void AppendTo(this GumpECHandleInput g, IGumpWriter disp, List<string> strings)
|
public static void AppendTo(this GumpImageTileButton g, IGumpWriter disp, List<string> strings)
|
||||||
|
{
|
||||||
|
disp.AppendLayout("buttontileart"u8);
|
||||||
|
disp.AppendLayout(g.X);
|
||||||
|
disp.AppendLayout(g.Y);
|
||||||
|
disp.AppendLayout(g.NormalID);
|
||||||
|
disp.AppendLayout(g.PressedID);
|
||||||
|
disp.AppendLayout((int)g.Type);
|
||||||
|
disp.AppendLayout(g.Param);
|
||||||
|
disp.AppendLayout(g.ButtonID);
|
||||||
|
|
||||||
|
disp.AppendLayout(g.ItemID);
|
||||||
|
disp.AppendLayout(g.Hue);
|
||||||
|
disp.AppendLayout(g.Width);
|
||||||
|
disp.AppendLayout(g.Height);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AppendTo(this GumpImageTiled g, IGumpWriter disp, List<string> strings)
|
||||||
|
{
|
||||||
|
disp.AppendLayout("gumppictiled"u8);
|
||||||
|
disp.AppendLayout(g.X);
|
||||||
|
disp.AppendLayout(g.Y);
|
||||||
|
disp.AppendLayout(g.Width);
|
||||||
|
disp.AppendLayout(g.Height);
|
||||||
|
disp.AppendLayout(g.GumpID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AppendTo(this GumpItem g, IGumpWriter disp, List<string> strings)
|
||||||
|
{
|
||||||
|
disp.AppendLayout(g.Hue == 0 ? "tilepic"u8 : "tilepichue"u8);
|
||||||
|
disp.AppendLayout(g.X);
|
||||||
|
disp.AppendLayout(g.Y);
|
||||||
|
disp.AppendLayout(g.ItemID);
|
||||||
|
|
||||||
|
if (g.Hue != 0)
|
||||||
{
|
{
|
||||||
disp.AppendLayout(Gump.StringToBuffer("echandleinput"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AppendTo(this GumpHtml g, IGumpWriter disp, List<string> strings)
|
|
||||||
{
|
|
||||||
disp.AppendLayout(Gump.StringToBuffer("htmlgump"));
|
|
||||||
disp.AppendLayout(g.X);
|
|
||||||
disp.AppendLayout(g.Y);
|
|
||||||
disp.AppendLayout(g.Width);
|
|
||||||
disp.AppendLayout(g.Height);
|
|
||||||
disp.AppendLayout(strings.Intern(g.Text));
|
|
||||||
disp.AppendLayout(g.Background);
|
|
||||||
disp.AppendLayout(g.Scrollbar);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AppendTo(this GumpHtmlLocalized g, IGumpWriter disp, List<string> strings)
|
|
||||||
{
|
|
||||||
switch (g.Type)
|
|
||||||
{
|
|
||||||
case GumpHtmlLocalizedType.Plain:
|
|
||||||
{
|
|
||||||
disp.AppendLayout(Gump.StringToBuffer("xmfhtmlgump"));
|
|
||||||
|
|
||||||
disp.AppendLayout(g.X);
|
|
||||||
disp.AppendLayout(g.Y);
|
|
||||||
disp.AppendLayout(g.Width);
|
|
||||||
disp.AppendLayout(g.Height);
|
|
||||||
disp.AppendLayout(g.Number);
|
|
||||||
disp.AppendLayout(g.Background);
|
|
||||||
disp.AppendLayout(g.Scrollbar);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case GumpHtmlLocalizedType.Color:
|
|
||||||
{
|
|
||||||
disp.AppendLayout(Gump.StringToBuffer("xmfhtmlgumpcolor"));
|
|
||||||
|
|
||||||
disp.AppendLayout(g.X);
|
|
||||||
disp.AppendLayout(g.Y);
|
|
||||||
disp.AppendLayout(g.Width);
|
|
||||||
disp.AppendLayout(g.Height);
|
|
||||||
disp.AppendLayout(g.Number);
|
|
||||||
disp.AppendLayout(g.Background);
|
|
||||||
disp.AppendLayout(g.Scrollbar);
|
|
||||||
disp.AppendLayout(g.Color);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case GumpHtmlLocalizedType.Args:
|
|
||||||
{
|
|
||||||
disp.AppendLayout(Gump.StringToBuffer("xmfhtmltok"));
|
|
||||||
|
|
||||||
disp.AppendLayout(g.X);
|
|
||||||
disp.AppendLayout(g.Y);
|
|
||||||
disp.AppendLayout(g.Width);
|
|
||||||
disp.AppendLayout(g.Height);
|
|
||||||
disp.AppendLayout(g.Background);
|
|
||||||
disp.AppendLayout(g.Scrollbar);
|
|
||||||
disp.AppendLayout(g.Color);
|
|
||||||
disp.AppendLayout(g.Number);
|
|
||||||
disp.AppendLayout(g.Args);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AppendTo(this GumpImage g, IGumpWriter disp, List<string> strings)
|
|
||||||
{
|
|
||||||
disp.AppendLayout(Gump.StringToBuffer("gumppic"));
|
|
||||||
disp.AppendLayout(g.X);
|
|
||||||
disp.AppendLayout(g.Y);
|
|
||||||
disp.AppendLayout(g.GumpID);
|
|
||||||
|
|
||||||
if (g.Hue != 0)
|
|
||||||
{
|
|
||||||
disp.AppendLayoutNS(" hue=");
|
|
||||||
disp.AppendLayoutNS(g.Hue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(g.Class))
|
|
||||||
{
|
|
||||||
disp.AppendLayoutNS(" class=");
|
|
||||||
disp.AppendLayout(Gump.StringToBuffer(g.Class));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AppendTo(this GumpImageTileButton g, IGumpWriter disp, List<string> strings)
|
|
||||||
{
|
|
||||||
disp.AppendLayout(Gump.StringToBuffer("buttontileart"));
|
|
||||||
disp.AppendLayout(g.X);
|
|
||||||
disp.AppendLayout(g.Y);
|
|
||||||
disp.AppendLayout(g.NormalID);
|
|
||||||
disp.AppendLayout(g.PressedID);
|
|
||||||
disp.AppendLayout((int)g.Type);
|
|
||||||
disp.AppendLayout(g.Param);
|
|
||||||
disp.AppendLayout(g.ButtonID);
|
|
||||||
|
|
||||||
disp.AppendLayout(g.ItemID);
|
|
||||||
disp.AppendLayout(g.Hue);
|
disp.AppendLayout(g.Hue);
|
||||||
disp.AppendLayout(g.Width);
|
|
||||||
disp.AppendLayout(g.Height);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void AppendTo(this GumpImageTiled g, IGumpWriter disp, List<string> strings)
|
public static void AppendTo(this GumpItemProperty g, IGumpWriter disp, List<string> strings)
|
||||||
|
{
|
||||||
|
disp.AppendLayout("itemproperty"u8);
|
||||||
|
disp.AppendLayout(g.Serial);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AppendTo(this GumpLabel g, IGumpWriter disp, List<string> strings)
|
||||||
|
{
|
||||||
|
disp.AppendLayout("text"u8);
|
||||||
|
disp.AppendLayout(g.X);
|
||||||
|
disp.AppendLayout(g.Y);
|
||||||
|
disp.AppendLayout(g.Hue);
|
||||||
|
disp.AppendLayout(strings.Intern(g.Text));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AppendTo(this GumpLabelCropped g, IGumpWriter disp, List<string> strings)
|
||||||
|
{
|
||||||
|
disp.AppendLayout("croppedtext"u8);
|
||||||
|
disp.AppendLayout(g.X);
|
||||||
|
disp.AppendLayout(g.Y);
|
||||||
|
disp.AppendLayout(g.Width);
|
||||||
|
disp.AppendLayout(g.Height);
|
||||||
|
disp.AppendLayout(g.Hue);
|
||||||
|
disp.AppendLayout(strings.Intern(g.Text));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AppendTo(this GumpMasterGump g, IGumpWriter disp, List<string> strings)
|
||||||
|
{
|
||||||
|
disp.AppendLayout("mastergump"u8);
|
||||||
|
disp.AppendLayout(g.GumpID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AppendTo(this GumpPage g, IGumpWriter disp, List<string> strings)
|
||||||
|
{
|
||||||
|
disp.AppendLayout("page"u8);
|
||||||
|
disp.AppendLayout(g.Page);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AppendTo(this GumpRadio g, IGumpWriter disp, List<string> strings)
|
||||||
|
{
|
||||||
|
disp.AppendLayout("radio"u8);
|
||||||
|
disp.AppendLayout(g.X);
|
||||||
|
disp.AppendLayout(g.Y);
|
||||||
|
disp.AppendLayout(g.InactiveID);
|
||||||
|
disp.AppendLayout(g.ActiveID);
|
||||||
|
disp.AppendLayout(g.InitialState);
|
||||||
|
disp.AppendLayout(g.SwitchID);
|
||||||
|
|
||||||
|
disp.Switches++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AppendTo(this GumpSpriteImage g, IGumpWriter disp, List<string> strings)
|
||||||
|
{
|
||||||
|
disp.AppendLayout("picinpic"u8);
|
||||||
|
disp.AppendLayout(g.X);
|
||||||
|
disp.AppendLayout(g.Y);
|
||||||
|
disp.AppendLayout(g.GumpID);
|
||||||
|
disp.AppendLayout(g.Width);
|
||||||
|
disp.AppendLayout(g.Height);
|
||||||
|
disp.AppendLayout(g.SX);
|
||||||
|
disp.AppendLayout(g.SY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AppendTo(this GumpTextEntry g, IGumpWriter disp, List<string> strings)
|
||||||
|
{
|
||||||
|
disp.AppendLayout("textentry"u8);
|
||||||
|
disp.AppendLayout(g.X);
|
||||||
|
disp.AppendLayout(g.Y);
|
||||||
|
disp.AppendLayout(g.Width);
|
||||||
|
disp.AppendLayout(g.Height);
|
||||||
|
disp.AppendLayout(g.Hue);
|
||||||
|
disp.AppendLayout(g.EntryID);
|
||||||
|
disp.AppendLayout(strings.Intern(g.InitialText));
|
||||||
|
|
||||||
|
disp.TextEntries++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AppendTo(this GumpTextEntryLimited g, IGumpWriter disp, List<string> strings)
|
||||||
|
{
|
||||||
|
disp.AppendLayout("textentrylimited"u8);
|
||||||
|
disp.AppendLayout(g.X);
|
||||||
|
disp.AppendLayout(g.Y);
|
||||||
|
disp.AppendLayout(g.Width);
|
||||||
|
disp.AppendLayout(g.Height);
|
||||||
|
disp.AppendLayout(g.Hue);
|
||||||
|
disp.AppendLayout(g.EntryID);
|
||||||
|
disp.AppendLayout(strings.Intern(g.InitialText));
|
||||||
|
disp.AppendLayout(g.Size);
|
||||||
|
|
||||||
|
disp.TextEntries++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AppendTo(this GumpTooltip g, IGumpWriter disp, List<string> strings)
|
||||||
|
{
|
||||||
|
disp.AppendLayout("tooltip"u8);
|
||||||
|
disp.AppendLayout(g.Number);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(g.Args))
|
||||||
{
|
{
|
||||||
disp.AppendLayout(Gump.StringToBuffer("gumppictiled"));
|
disp.AppendLayout(g.Args);
|
||||||
disp.AppendLayout(g.X);
|
|
||||||
disp.AppendLayout(g.Y);
|
|
||||||
disp.AppendLayout(g.Width);
|
|
||||||
disp.AppendLayout(g.Height);
|
|
||||||
disp.AppendLayout(g.GumpID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AppendTo(this GumpItem g, IGumpWriter disp, List<string> strings)
|
|
||||||
{
|
|
||||||
disp.AppendLayout(Gump.StringToBuffer(g.Hue == 0 ? "tilepic" : "tilepichue"));
|
|
||||||
disp.AppendLayout(g.X);
|
|
||||||
disp.AppendLayout(g.Y);
|
|
||||||
disp.AppendLayout(g.ItemID);
|
|
||||||
|
|
||||||
if (g.Hue != 0)
|
|
||||||
{
|
|
||||||
disp.AppendLayout(g.Hue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AppendTo(this GumpItemProperty g, IGumpWriter disp, List<string> strings)
|
|
||||||
{
|
|
||||||
disp.AppendLayout(Gump.StringToBuffer("itemproperty"));
|
|
||||||
disp.AppendLayout(g.Serial);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AppendTo(this GumpLabel g, IGumpWriter disp, List<string> strings)
|
|
||||||
{
|
|
||||||
disp.AppendLayout(Gump.StringToBuffer("text"));
|
|
||||||
disp.AppendLayout(g.X);
|
|
||||||
disp.AppendLayout(g.Y);
|
|
||||||
disp.AppendLayout(g.Hue);
|
|
||||||
disp.AppendLayout(strings.Intern(g.Text));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AppendTo(this GumpLabelCropped g, IGumpWriter disp, List<string> strings)
|
|
||||||
{
|
|
||||||
disp.AppendLayout(Gump.StringToBuffer("croppedtext"));
|
|
||||||
disp.AppendLayout(g.X);
|
|
||||||
disp.AppendLayout(g.Y);
|
|
||||||
disp.AppendLayout(g.Width);
|
|
||||||
disp.AppendLayout(g.Height);
|
|
||||||
disp.AppendLayout(g.Hue);
|
|
||||||
disp.AppendLayout(strings.Intern(g.Text));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AppendTo(this GumpMasterGump g, IGumpWriter disp, List<string> strings)
|
|
||||||
{
|
|
||||||
disp.AppendLayout(Gump.StringToBuffer("mastergump"));
|
|
||||||
disp.AppendLayout(g.GumpID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AppendTo(this GumpPage g, IGumpWriter disp, List<string> strings)
|
|
||||||
{
|
|
||||||
disp.AppendLayout(Gump.StringToBuffer("page"));
|
|
||||||
disp.AppendLayout(g.Page);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AppendTo(this GumpRadio g, IGumpWriter disp, List<string> strings)
|
|
||||||
{
|
|
||||||
disp.AppendLayout(Gump.StringToBuffer("radio"));
|
|
||||||
disp.AppendLayout(g.X);
|
|
||||||
disp.AppendLayout(g.Y);
|
|
||||||
disp.AppendLayout(g.InactiveID);
|
|
||||||
disp.AppendLayout(g.ActiveID);
|
|
||||||
disp.AppendLayout(g.InitialState);
|
|
||||||
disp.AppendLayout(g.SwitchID);
|
|
||||||
|
|
||||||
disp.Switches++;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AppendTo(this GumpSpriteImage g, IGumpWriter disp, List<string> strings)
|
|
||||||
{
|
|
||||||
disp.AppendLayout(Gump.StringToBuffer("picinpic"));
|
|
||||||
disp.AppendLayout(g.X);
|
|
||||||
disp.AppendLayout(g.Y);
|
|
||||||
disp.AppendLayout(g.GumpID);
|
|
||||||
disp.AppendLayout(g.Width);
|
|
||||||
disp.AppendLayout(g.Height);
|
|
||||||
disp.AppendLayout(g.SX);
|
|
||||||
disp.AppendLayout(g.SY);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AppendTo(this GumpTextEntry g, IGumpWriter disp, List<string> strings)
|
|
||||||
{
|
|
||||||
disp.AppendLayout(Gump.StringToBuffer("textentry"));
|
|
||||||
disp.AppendLayout(g.X);
|
|
||||||
disp.AppendLayout(g.Y);
|
|
||||||
disp.AppendLayout(g.Width);
|
|
||||||
disp.AppendLayout(g.Height);
|
|
||||||
disp.AppendLayout(g.Hue);
|
|
||||||
disp.AppendLayout(g.EntryID);
|
|
||||||
disp.AppendLayout(strings.Intern(g.InitialText));
|
|
||||||
|
|
||||||
disp.TextEntries++;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AppendTo(this GumpTextEntryLimited g, IGumpWriter disp, List<string> strings)
|
|
||||||
{
|
|
||||||
disp.AppendLayout(Gump.StringToBuffer("textentrylimited"));
|
|
||||||
disp.AppendLayout(g.X);
|
|
||||||
disp.AppendLayout(g.Y);
|
|
||||||
disp.AppendLayout(g.Width);
|
|
||||||
disp.AppendLayout(g.Height);
|
|
||||||
disp.AppendLayout(g.Hue);
|
|
||||||
disp.AppendLayout(g.EntryID);
|
|
||||||
disp.AppendLayout(strings.Intern(g.InitialText));
|
|
||||||
disp.AppendLayout(g.Size);
|
|
||||||
|
|
||||||
disp.TextEntries++;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AppendTo(this GumpTooltip g, IGumpWriter disp, List<string> strings)
|
|
||||||
{
|
|
||||||
disp.AppendLayout(Gump.StringToBuffer("tooltip"));
|
|
||||||
disp.AppendLayout(g.Number);
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(g.Args))
|
|
||||||
{
|
|
||||||
disp.AppendLayout(g.Args);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,14 @@ namespace Server.Network
|
||||||
UnderlyingStream.Write(buffer, offset, size);
|
UnderlyingStream.Write(buffer, offset, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes a sequence of bytes to the underlying stream
|
||||||
|
/// </summary>
|
||||||
|
public void Write(ReadOnlySpan<byte> buffer)
|
||||||
|
{
|
||||||
|
UnderlyingStream.Write(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes a fixed-length ASCII-encoded string value to the underlying stream. To fit (size), the string content is either
|
/// Writes a fixed-length ASCII-encoded string value to the underlying stream. To fit (size), the string content is either
|
||||||
/// truncated or padded with null characters.
|
/// truncated or padded with null characters.
|
||||||
|
|
|
||||||
|
|
@ -2,122 +2,115 @@ using Server.Gumps;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Server.Tests.Network
|
namespace Server.Tests.Network;
|
||||||
|
|
||||||
|
public class GumpPacketTests : IClassFixture<ServerFixture>
|
||||||
{
|
{
|
||||||
public class GumpPacketTests : IClassFixture<ServerFixture>
|
[Theory]
|
||||||
|
[InlineData(100, 10)]
|
||||||
|
public void TestCloseGump(int typeId, int buttonId)
|
||||||
{
|
{
|
||||||
[Theory]
|
var expected = new CloseGump(typeId, buttonId).Compile();
|
||||||
[InlineData(100, 10)]
|
|
||||||
public void TestCloseGump(int typeId, int buttonId)
|
|
||||||
{
|
|
||||||
var expected = new CloseGump(typeId, buttonId).Compile();
|
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
ns.SendCloseGump(typeId, buttonId);
|
ns.SendCloseGump(typeId, buttonId);
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void TestDisplaySignGump()
|
|
||||||
{
|
|
||||||
Serial gumpSerial = (Serial)0x1000;
|
|
||||||
const int gumpId = 100;
|
|
||||||
const string unknownString = "This is an unknown string";
|
|
||||||
const string caption = "This is a caption";
|
|
||||||
|
|
||||||
var expected = new DisplaySignGump(gumpSerial, gumpId, unknownString, caption).Compile();
|
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
|
||||||
ns.SendDisplaySignGump(gumpSerial, gumpId, unknownString, caption);
|
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
|
||||||
AssertThat.Equal(result, expected);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData(ProtocolChanges.None)]
|
|
||||||
[InlineData(ProtocolChanges.Unpack)]
|
|
||||||
public void TestGumpPacketNameChange(ProtocolChanges changes)
|
|
||||||
{
|
|
||||||
var gump = new NameChangeDeedGump();
|
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
|
||||||
ns.ProtocolChanges = changes;
|
|
||||||
|
|
||||||
var expected = gump.Compile(ns).Compile();
|
|
||||||
|
|
||||||
ns.SendDisplayGump(gump, out _, out _);
|
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
|
||||||
AssertThat.Equal(result, expected);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData(ProtocolChanges.None)]
|
|
||||||
[InlineData(ProtocolChanges.Unpack)]
|
|
||||||
public void TestGumpPacketAdmin(ProtocolChanges changes)
|
|
||||||
{
|
|
||||||
var m = new Mobile((Serial)0x1);
|
|
||||||
m.DefaultMobileInit();
|
|
||||||
m.RawName = "Test Mobile";
|
|
||||||
m.AccessLevel = AccessLevel.Administrator;
|
|
||||||
|
|
||||||
var gump = new AdminGump(m, AdminGumpPage.Clients);
|
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
|
||||||
ns.ProtocolChanges = changes;
|
|
||||||
|
|
||||||
var expected = gump.Compile(ns).Compile();
|
|
||||||
|
|
||||||
ns.SendDisplayGump(gump, out _, out _);
|
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
|
||||||
AssertThat.Equal(result, expected);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NameChangeDeedGump : Gump
|
[Fact]
|
||||||
|
public void TestDisplaySignGump()
|
||||||
{
|
{
|
||||||
public NameChangeDeedGump() : base(50, 50)
|
Serial gumpSerial = (Serial)0x1000;
|
||||||
{
|
const int gumpId = 100;
|
||||||
Closable = false;
|
const string unknownString = "This is an unknown string";
|
||||||
Draggable = false;
|
const string caption = "This is a caption";
|
||||||
Resizable = false;
|
|
||||||
|
|
||||||
AddPage(0);
|
var expected = new DisplaySignGump(gumpSerial, gumpId, unknownString, caption).Compile();
|
||||||
|
|
||||||
AddBlackAlpha(10, 120, 250, 85);
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
AddHtml(10, 125, 250, 20, Color(Center("Name Change Deed"), 0xFFFFFF));
|
ns.SendDisplaySignGump(gumpSerial, gumpId, unknownString, caption);
|
||||||
|
|
||||||
AddLabel(73, 15, 1152, "");
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
AddLabel(20, 150, 0x480, "New Name:");
|
AssertThat.Equal(result, expected);
|
||||||
AddTextField(100, 150, 150, 20, 0);
|
}
|
||||||
|
|
||||||
AddButtonLabeled(75, 180, 1, "Submit");
|
[Fact]
|
||||||
}
|
public void TestGumpPacketNameChange()
|
||||||
|
{
|
||||||
|
var gump = new NameChangeDeedGump();
|
||||||
|
|
||||||
public void AddBlackAlpha(int x, int y, int width, int height)
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
{
|
|
||||||
AddImageTiled(x, y, width, height, 2624);
|
|
||||||
AddAlphaRegion(x, y, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddTextField(int x, int y, int width, int height, int index)
|
var expected = gump.Compile(ns).Compile();
|
||||||
{
|
|
||||||
AddBackground(x - 2, y - 2, width + 4, height + 4, 0x2486);
|
|
||||||
AddTextEntry(x + 2, y + 2, width - 4, height - 4, 0, index, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string Center(string text) => $"<CENTER>{text}</CENTER>";
|
ns.SendDisplayGump(gump, out _, out _);
|
||||||
|
|
||||||
public static string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
|
AssertThat.Equal(result, expected);
|
||||||
|
}
|
||||||
|
|
||||||
public void AddButtonLabeled(int x, int y, int buttonID, string text)
|
[Fact]
|
||||||
{
|
public void TestGumpPacketAdmin()
|
||||||
AddButton(x, y - 1, 4005, 4007, buttonID);
|
{
|
||||||
AddHtml(x + 35, y, 240, 20, Color(text, 0xFFFFFF));
|
var m = new Mobile((Serial)0x1);
|
||||||
}
|
m.DefaultMobileInit();
|
||||||
|
m.RawName = "Test Mobile";
|
||||||
|
m.AccessLevel = AccessLevel.Administrator;
|
||||||
|
|
||||||
|
var gump = new AdminGump(m, AdminGumpPage.Clients);
|
||||||
|
|
||||||
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
|
||||||
|
var expected = gump.Compile(ns).Compile();
|
||||||
|
|
||||||
|
ns.SendDisplayGump(gump, out _, out _);
|
||||||
|
|
||||||
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
|
AssertThat.Equal(result, expected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class NameChangeDeedGump : Gump
|
||||||
|
{
|
||||||
|
public NameChangeDeedGump() : base(50, 50)
|
||||||
|
{
|
||||||
|
Closable = false;
|
||||||
|
Draggable = false;
|
||||||
|
Resizable = false;
|
||||||
|
|
||||||
|
AddPage(0);
|
||||||
|
|
||||||
|
AddBlackAlpha(10, 120, 250, 85);
|
||||||
|
AddHtml(10, 125, 250, 20, Color(Center("Name Change Deed"), 0xFFFFFF));
|
||||||
|
|
||||||
|
AddLabel(73, 15, 1152, "");
|
||||||
|
AddLabel(20, 150, 0x480, "New Name:");
|
||||||
|
AddTextField(100, 150, 150, 20, 0);
|
||||||
|
|
||||||
|
AddButtonLabeled(75, 180, 1, "Submit");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddBlackAlpha(int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
AddImageTiled(x, y, width, height, 2624);
|
||||||
|
AddAlphaRegion(x, y, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddTextField(int x, int y, int width, int height, int index)
|
||||||
|
{
|
||||||
|
AddBackground(x - 2, y - 2, width + 4, height + 4, 0x2486);
|
||||||
|
AddTextEntry(x + 2, y + 2, width - 4, height - 4, 0, index, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string Center(string text) => $"<CENTER>{text}</CENTER>";
|
||||||
|
|
||||||
|
public static string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
|
||||||
|
|
||||||
|
public void AddButtonLabeled(int x, int y, int buttonID, string text)
|
||||||
|
{
|
||||||
|
AddButton(x, y - 1, 4005, 4007, buttonID);
|
||||||
|
AddHtml(x + 35, y, 240, 20, Color(text, 0xFFFFFF));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
using System;
|
||||||
using System.Buffers;
|
using System.Buffers;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Server.Gumps;
|
using Server.Gumps;
|
||||||
|
|
@ -20,7 +20,7 @@ namespace Server.Tests
|
||||||
void AppendLayoutNS(int val);
|
void AppendLayoutNS(int val);
|
||||||
void AppendLayout(string text);
|
void AppendLayout(string text);
|
||||||
void AppendLayoutNS(string text);
|
void AppendLayoutNS(string text);
|
||||||
void AppendLayout(byte[] buffer);
|
void AppendLayout(ReadOnlySpan<byte> buffer);
|
||||||
void WriteStrings(List<string> strings);
|
void WriteStrings(List<string> strings);
|
||||||
void Flush();
|
void Flush();
|
||||||
}
|
}
|
||||||
|
|
@ -39,12 +39,6 @@ namespace Server.Tests
|
||||||
|
|
||||||
public sealed class DisplayGumpPacked : Packet, IGumpWriter
|
public sealed class DisplayGumpPacked : Packet, IGumpWriter
|
||||||
{
|
{
|
||||||
private static readonly byte[] m_True = Gump.StringToBuffer(" 1");
|
|
||||||
private static readonly byte[] m_False = Gump.StringToBuffer(" 0");
|
|
||||||
|
|
||||||
private static readonly byte[] m_BeginTextSeparator = Gump.StringToBuffer(" @");
|
|
||||||
private static readonly byte[] m_EndTextSeparator = Gump.StringToBuffer("@");
|
|
||||||
|
|
||||||
private static readonly byte[] m_Buffer = new byte[48];
|
private static readonly byte[] m_Buffer = new byte[48];
|
||||||
|
|
||||||
private readonly Gump m_Gump;
|
private readonly Gump m_Gump;
|
||||||
|
|
@ -71,7 +65,7 @@ namespace Server.Tests
|
||||||
|
|
||||||
public void AppendLayout(bool val)
|
public void AppendLayout(bool val)
|
||||||
{
|
{
|
||||||
AppendLayout(val ? m_True : m_False);
|
AppendLayout(val ? " 1"u8 : " 0"u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AppendLayout(int val)
|
public void AppendLayout(int val)
|
||||||
|
|
@ -107,16 +101,16 @@ namespace Server.Tests
|
||||||
|
|
||||||
public void AppendLayout(string text)
|
public void AppendLayout(string text)
|
||||||
{
|
{
|
||||||
AppendLayout(m_BeginTextSeparator);
|
AppendLayout(" @"u8);
|
||||||
|
|
||||||
m_Layout.WriteAsciiFixed(text, text.Length);
|
m_Layout.WriteAsciiFixed(text, text.Length);
|
||||||
|
|
||||||
AppendLayout(m_EndTextSeparator);
|
AppendLayout("@"u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AppendLayout(byte[] buffer)
|
public void AppendLayout(ReadOnlySpan<byte> buffer)
|
||||||
{
|
{
|
||||||
m_Layout.Write(buffer, 0, buffer.Length);
|
m_Layout.Write(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WriteStrings(List<string> strings)
|
public void WriteStrings(List<string> strings)
|
||||||
|
|
@ -184,117 +178,6 @@ namespace Server.Tests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class DisplayGumpFast : Packet, IGumpWriter
|
|
||||||
{
|
|
||||||
private static readonly byte[] m_True = Gump.StringToBuffer(" 1");
|
|
||||||
private static readonly byte[] m_False = Gump.StringToBuffer(" 0");
|
|
||||||
|
|
||||||
private static readonly byte[] m_BeginTextSeparator = Gump.StringToBuffer(" @");
|
|
||||||
private static readonly byte[] m_EndTextSeparator = Gump.StringToBuffer("@");
|
|
||||||
|
|
||||||
private readonly byte[] m_Buffer = new byte[48];
|
|
||||||
private int m_LayoutLength;
|
|
||||||
|
|
||||||
public DisplayGumpFast(Gump g) : base(0xB0)
|
|
||||||
{
|
|
||||||
m_Buffer[0] = (byte)' ';
|
|
||||||
|
|
||||||
EnsureCapacity(4096);
|
|
||||||
|
|
||||||
Stream.Write(g.Serial);
|
|
||||||
Stream.Write(g.TypeID);
|
|
||||||
Stream.Write(g.X);
|
|
||||||
Stream.Write(g.Y);
|
|
||||||
Stream.Write((ushort)0xFFFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int TextEntries { get; set; }
|
|
||||||
|
|
||||||
public int Switches { get; set; }
|
|
||||||
|
|
||||||
public void AppendLayout(bool val)
|
|
||||||
{
|
|
||||||
AppendLayout(val ? m_True : m_False);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AppendLayout(int val)
|
|
||||||
{
|
|
||||||
var toString = val.ToString();
|
|
||||||
var bytes = Encoding.ASCII.GetBytes(toString, 0, toString.Length, m_Buffer, 1) + 1;
|
|
||||||
|
|
||||||
Stream.Write(m_Buffer, 0, bytes);
|
|
||||||
m_LayoutLength += bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AppendLayout(uint val)
|
|
||||||
{
|
|
||||||
var toString = val.ToString();
|
|
||||||
var bytes = Encoding.ASCII.GetBytes(toString, 0, toString.Length, m_Buffer, 1) + 1;
|
|
||||||
|
|
||||||
Stream.Write(m_Buffer, 0, bytes);
|
|
||||||
m_LayoutLength += bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AppendLayout(Serial serial) => AppendLayout(serial.Value);
|
|
||||||
|
|
||||||
public void AppendLayoutNS(int val)
|
|
||||||
{
|
|
||||||
var toString = val.ToString();
|
|
||||||
var bytes = Encoding.ASCII.GetBytes(toString, 0, toString.Length, m_Buffer, 1);
|
|
||||||
|
|
||||||
Stream.Write(m_Buffer, 1, bytes);
|
|
||||||
m_LayoutLength += bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AppendLayoutNS(string text)
|
|
||||||
{
|
|
||||||
var length = text.Length;
|
|
||||||
Stream.WriteAsciiFixed(text, length);
|
|
||||||
m_LayoutLength += length;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AppendLayout(string text)
|
|
||||||
{
|
|
||||||
AppendLayout(m_BeginTextSeparator);
|
|
||||||
|
|
||||||
var length = text.Length;
|
|
||||||
Stream.WriteAsciiFixed(text, length);
|
|
||||||
m_LayoutLength += length;
|
|
||||||
|
|
||||||
AppendLayout(m_EndTextSeparator);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AppendLayout(byte[] buffer)
|
|
||||||
{
|
|
||||||
var length = buffer.Length;
|
|
||||||
Stream.Write(buffer, 0, length);
|
|
||||||
m_LayoutLength += length;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void WriteStrings(List<string> text)
|
|
||||||
{
|
|
||||||
Stream.Seek(19, SeekOrigin.Begin);
|
|
||||||
Stream.Write((ushort)m_LayoutLength);
|
|
||||||
Stream.Seek(0, SeekOrigin.End);
|
|
||||||
|
|
||||||
Stream.Write((ushort)text.Count);
|
|
||||||
|
|
||||||
for (var i = 0; i < text.Count; ++i)
|
|
||||||
{
|
|
||||||
var v = text[i] ?? "";
|
|
||||||
|
|
||||||
int length = (ushort)v.Length;
|
|
||||||
|
|
||||||
Stream.Write((ushort)length);
|
|
||||||
Stream.WriteBigUniFixed(v, length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Flush()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class DisplaySignGump : Packet
|
public sealed class DisplaySignGump : Packet
|
||||||
{
|
{
|
||||||
public DisplaySignGump(Serial serial, int gumpID, string unknown, string caption) : base(0x8B)
|
public DisplaySignGump(Serial serial, int gumpID, string unknown, string caption) : base(0x8B)
|
||||||
|
|
|
||||||
|
|
@ -1,505 +1,502 @@
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Server.Tests.Network
|
namespace Server.Tests.Network;
|
||||||
|
|
||||||
|
[Collection("Sequential Tests")]
|
||||||
|
public class MobilePacketTests : IClassFixture<ServerFixture>
|
||||||
{
|
{
|
||||||
[Collection("Sequential Tests")]
|
[Fact]
|
||||||
public class MobilePacketTests : IClassFixture<ServerFixture>
|
public void TestDeathAnimation()
|
||||||
{
|
{
|
||||||
[Fact]
|
Serial killed = (Serial)0x1;
|
||||||
public void TestDeathAnimation()
|
Serial corpse = (Serial)0x1000;
|
||||||
|
|
||||||
|
var expected = new DeathAnimation(killed, corpse).Compile();
|
||||||
|
|
||||||
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
ns.SendDeathAnimation(killed, corpse);
|
||||||
|
|
||||||
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
|
AssertThat.Equal(result, expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestBondStatus()
|
||||||
|
{
|
||||||
|
Serial petSerial = (Serial)0x1;
|
||||||
|
const bool bonded = true;
|
||||||
|
|
||||||
|
var expected = new BondedStatus(petSerial, bonded).Compile();
|
||||||
|
|
||||||
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
ns.SendBondedStatus(petSerial, bonded);
|
||||||
|
|
||||||
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
|
AssertThat.Equal(result, expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(ProtocolChanges.StygianAbyss)]
|
||||||
|
[InlineData(ProtocolChanges.None)]
|
||||||
|
public void TestMobileMoving(ProtocolChanges protocolChanges)
|
||||||
|
{
|
||||||
|
var m = new Mobile((Serial)0x1);
|
||||||
|
m.DefaultMobileInit();
|
||||||
|
|
||||||
|
var noto = 10;
|
||||||
|
|
||||||
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
ns.ProtocolChanges = protocolChanges;
|
||||||
|
var expected = new MobileMoving(m, noto, ns.StygianAbyss).Compile();
|
||||||
|
|
||||||
|
ns.SendMobileMoving(m, noto);
|
||||||
|
|
||||||
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
|
AssertThat.Equal(result, expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(null)]
|
||||||
|
[InlineData("Kamron")]
|
||||||
|
[InlineData("Some Really Long Mobile Name That Gets Cut off")]
|
||||||
|
public void TestMobileName(string name)
|
||||||
|
{
|
||||||
|
var m = new Mobile((Serial)0x1) { Name = name };
|
||||||
|
m.DefaultMobileInit();
|
||||||
|
|
||||||
|
var expected = new MobileName(m).Compile();
|
||||||
|
|
||||||
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
ns.SendMobileName(m);
|
||||||
|
|
||||||
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
|
AssertThat.Equal(result, expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(200, 5, 1, false, false, 5)]
|
||||||
|
[InlineData(10, 100, 25, true, false, 0)]
|
||||||
|
public void TestMobileAnimation(int action, int frameCount, int repeatCount, bool reverse, bool repeat, byte delay)
|
||||||
|
{
|
||||||
|
Serial mobile = (Serial)0x1;
|
||||||
|
|
||||||
|
var expected = new MobileAnimation(
|
||||||
|
mobile,
|
||||||
|
action,
|
||||||
|
frameCount,
|
||||||
|
repeatCount,
|
||||||
|
!reverse,
|
||||||
|
repeat,
|
||||||
|
delay
|
||||||
|
).Compile();
|
||||||
|
|
||||||
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
ns.SendMobileAnimation(
|
||||||
|
mobile,
|
||||||
|
action,
|
||||||
|
frameCount,
|
||||||
|
repeatCount,
|
||||||
|
!reverse,
|
||||||
|
repeat,
|
||||||
|
delay
|
||||||
|
);
|
||||||
|
|
||||||
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
|
AssertThat.Equal(result, expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(200, 5, 5)]
|
||||||
|
[InlineData(10, 100, 20)]
|
||||||
|
public void TestNewMobileAnimation(int action, int frameCount, byte delay)
|
||||||
|
{
|
||||||
|
Serial mobile = (Serial)0x1;
|
||||||
|
|
||||||
|
var expected = new NewMobileAnimation(
|
||||||
|
mobile,
|
||||||
|
action,
|
||||||
|
frameCount,
|
||||||
|
delay
|
||||||
|
).Compile();
|
||||||
|
|
||||||
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
ns.SendNewMobileAnimation(
|
||||||
|
mobile,
|
||||||
|
action,
|
||||||
|
frameCount,
|
||||||
|
delay
|
||||||
|
);
|
||||||
|
|
||||||
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
|
AssertThat.Equal(result, expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("None")]
|
||||||
|
[InlineData("Lesser")]
|
||||||
|
[InlineData("Lethal")]
|
||||||
|
public void TestHealthbarPoison(string pName)
|
||||||
|
{
|
||||||
|
var p = Poison.GetPoison(pName);
|
||||||
|
var m = new Mobile((Serial)0x1);
|
||||||
|
m.DefaultMobileInit();
|
||||||
|
m.Poison = p;
|
||||||
|
|
||||||
|
var expected = new HealthbarPoison(m).Compile();
|
||||||
|
|
||||||
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
ns.SendMobileHealthbar(m, Healthbar.Poison);
|
||||||
|
|
||||||
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
|
AssertThat.Equal(result, expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(false, false)]
|
||||||
|
[InlineData(true, false)]
|
||||||
|
[InlineData(false, true)]
|
||||||
|
[InlineData(true, true)]
|
||||||
|
public void TestYellowBar(bool isBlessed, bool isYellowHealth)
|
||||||
|
{
|
||||||
|
var m = new Mobile((Serial)0x1);
|
||||||
|
m.DefaultMobileInit();
|
||||||
|
m.Blessed = isBlessed;
|
||||||
|
m.YellowHealthbar = isYellowHealth;
|
||||||
|
|
||||||
|
var expected = new HealthbarYellow(m).Compile();
|
||||||
|
|
||||||
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
ns.SendMobileHealthbar(m, Healthbar.Yellow);
|
||||||
|
|
||||||
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
|
AssertThat.Equal(result, expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(true)]
|
||||||
|
[InlineData(false)]
|
||||||
|
public void TestMobileStatusCompact(bool canBeRenamed)
|
||||||
|
{
|
||||||
|
var m = new Mobile((Serial)0x1) { Name = "Random Mobile 1" };
|
||||||
|
m.DefaultMobileInit();
|
||||||
|
m.Str = 50;
|
||||||
|
m.Hits = 100;
|
||||||
|
m.Int = 75;
|
||||||
|
m.Mana = 100;
|
||||||
|
m.Dex = 25;
|
||||||
|
m.Stam = 100;
|
||||||
|
|
||||||
|
var expected = new MobileStatusCompact(canBeRenamed, m).Compile();
|
||||||
|
|
||||||
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
ns.SendMobileStatusCompact(m, canBeRenamed);
|
||||||
|
|
||||||
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
|
AssertThat.Equal(result, expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(ProtocolChanges.Version70610)]
|
||||||
|
[InlineData(ProtocolChanges.Version502b)]
|
||||||
|
public void TestMobileStatus(ProtocolChanges changes)
|
||||||
|
{
|
||||||
|
var beholder = new Mobile((Serial)0x1) { Name = "Random Mobile 1" };
|
||||||
|
beholder.DefaultMobileInit();
|
||||||
|
beholder.Str = 50;
|
||||||
|
beholder.Hits = 100;
|
||||||
|
beholder.Int = 75;
|
||||||
|
beholder.Mana = 100;
|
||||||
|
beholder.Dex = 25;
|
||||||
|
beholder.Stam = 100;
|
||||||
|
|
||||||
|
var beheld = new Mobile((Serial)0x2) { Name = "Random Mobile 2" };
|
||||||
|
beheld.DefaultMobileInit();
|
||||||
|
beheld.Str = 50;
|
||||||
|
beheld.Hits = 100;
|
||||||
|
beheld.Int = 75;
|
||||||
|
beheld.Mana = 100;
|
||||||
|
beheld.Dex = 25;
|
||||||
|
beheld.Stam = 100;
|
||||||
|
|
||||||
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
ns.ProtocolChanges = changes;
|
||||||
|
|
||||||
|
var expected = new MobileStatus(beholder, beheld, ns).Compile();
|
||||||
|
ns.SendMobileStatus(beholder, beheld);
|
||||||
|
|
||||||
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
|
AssertThat.Equal(result, expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(ProtocolChanges.Version70610, "7.0.61.0", ClientFlags.TerMur, Expansion.HS, 6)]
|
||||||
|
[InlineData(ProtocolChanges.Version502b, "5.0.2b", ClientFlags.Malas, Expansion.ML, 5)]
|
||||||
|
public void TestMobileStatusExtendedSelf(
|
||||||
|
ProtocolChanges changes,
|
||||||
|
string version,
|
||||||
|
ClientFlags clientFlags,
|
||||||
|
Expansion expansion,
|
||||||
|
int mobileStatusVersion
|
||||||
|
)
|
||||||
|
{
|
||||||
|
var expansionInfo = ExpansionInfo.CoreExpansion;
|
||||||
|
var oldExpansion = Core.Expansion;
|
||||||
|
var oldVersion = expansionInfo.MobileStatusVersion;
|
||||||
|
Core.Expansion = expansion;
|
||||||
|
ExpansionInfo.CoreExpansion.MobileStatusVersion = mobileStatusVersion;
|
||||||
|
|
||||||
|
var m = new Mobile((Serial)0x1) { Name = "Random Mobile 1" };
|
||||||
|
m.DefaultMobileInit();
|
||||||
|
m.Str = 50;
|
||||||
|
m.Hits = 100;
|
||||||
|
m.Int = 75;
|
||||||
|
m.Mana = 100;
|
||||||
|
m.Dex = 25;
|
||||||
|
m.Stam = 100;
|
||||||
|
|
||||||
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
ns.ProtocolChanges = changes;
|
||||||
|
ns.Version = new ClientVersion(version);
|
||||||
|
ns.Flags = clientFlags;
|
||||||
|
|
||||||
|
var expected = new MobileStatusExtended(m, ns).Compile();
|
||||||
|
ns.SendMobileStatus(m, m);
|
||||||
|
|
||||||
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
|
AssertThat.Equal(result, expected);
|
||||||
|
Core.Expansion = oldExpansion;
|
||||||
|
expansionInfo.MobileStatusVersion = oldVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(ProtocolChanges.None, 0)]
|
||||||
|
[InlineData(ProtocolChanges.StygianAbyss, 100)]
|
||||||
|
public void TestMobileUpdate(ProtocolChanges changes, int solidHueOverride)
|
||||||
|
{
|
||||||
|
var m = new Mobile((Serial)0x1);
|
||||||
|
m.DefaultMobileInit();
|
||||||
|
m.SolidHueOverride = solidHueOverride;
|
||||||
|
|
||||||
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
ns.ProtocolChanges = changes;
|
||||||
|
|
||||||
|
var expected = new MobileUpdate(m, ns.StygianAbyss).Compile();
|
||||||
|
ns.SendMobileUpdate(m);
|
||||||
|
|
||||||
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
|
AssertThat.Equal(result, expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(ProtocolChanges.Version70331, 0, 0, 0, 0)]
|
||||||
|
[InlineData(ProtocolChanges.Version70331, 10, 1024, 0, 0)]
|
||||||
|
[InlineData(ProtocolChanges.Version70331, 10, 1024, 11, 2048)]
|
||||||
|
[InlineData(ProtocolChanges.Version6000, 0, 0, 0, 0)]
|
||||||
|
[InlineData(ProtocolChanges.Version6000, 10, 1024, 0, 0)]
|
||||||
|
[InlineData(ProtocolChanges.Version6000, 10, 1024, 11, 2048)]
|
||||||
|
[InlineData(ProtocolChanges.Version7000, 0, 0, 0, 0)]
|
||||||
|
[InlineData(ProtocolChanges.Version7000, 10, 1024, 0, 0)]
|
||||||
|
[InlineData(ProtocolChanges.Version7000, 10, 1024, 11, 2048)]
|
||||||
|
public void TestMobileIncoming(
|
||||||
|
ProtocolChanges changes, int hairItemId, int hairHue, int facialHairItemId, int facialHairHue
|
||||||
|
)
|
||||||
|
{
|
||||||
|
var beholder = new Mobile((Serial)0x1)
|
||||||
{
|
{
|
||||||
Serial killed = (Serial)0x1;
|
Name = "Random Mobile 1"
|
||||||
Serial corpse = (Serial)0x1000;
|
};
|
||||||
|
beholder.DefaultMobileInit();
|
||||||
|
|
||||||
var expected = new DeathAnimation(killed, corpse).Compile();
|
var beheld = new Mobile((Serial)0x2)
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
|
||||||
ns.SendDeathAnimation(killed, corpse);
|
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
|
||||||
AssertThat.Equal(result, expected);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void TestBondStatus()
|
|
||||||
{
|
{
|
||||||
Serial petSerial = (Serial)0x1;
|
Name = "Random Mobile 2"
|
||||||
const bool bonded = true;
|
};
|
||||||
|
beheld.DefaultMobileInit();
|
||||||
var expected = new BondedStatus(petSerial, bonded).Compile();
|
beheld.AddItem(
|
||||||
|
new Item((Serial)0x1000)
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
|
||||||
ns.SendBondedStatus(petSerial, bonded);
|
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
|
||||||
AssertThat.Equal(result, expected);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData(ProtocolChanges.StygianAbyss)]
|
|
||||||
[InlineData(ProtocolChanges.None)]
|
|
||||||
public void TestMobileMoving(ProtocolChanges protocolChanges)
|
|
||||||
{
|
|
||||||
var m = new Mobile((Serial)0x1);
|
|
||||||
m.DefaultMobileInit();
|
|
||||||
|
|
||||||
var noto = 10;
|
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
|
||||||
ns.ProtocolChanges = protocolChanges;
|
|
||||||
var expected = new MobileMoving(m, noto, ns.StygianAbyss).Compile();
|
|
||||||
|
|
||||||
ns.SendMobileMoving(m, noto);
|
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
|
||||||
AssertThat.Equal(result, expected);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData(null)]
|
|
||||||
[InlineData("Kamron")]
|
|
||||||
[InlineData("Some Really Long Mobile Name That Gets Cut off")]
|
|
||||||
public void TestMobileName(string name)
|
|
||||||
{
|
|
||||||
var m = new Mobile((Serial)0x1) { Name = name };
|
|
||||||
m.DefaultMobileInit();
|
|
||||||
|
|
||||||
var expected = new MobileName(m).Compile();
|
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
|
||||||
ns.SendMobileName(m);
|
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
|
||||||
AssertThat.Equal(result, expected);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData(200, 5, 1, false, false, 5)]
|
|
||||||
[InlineData(10, 100, 25, true, false, 0)]
|
|
||||||
public void TestMobileAnimation(int action, int frameCount, int repeatCount, bool reverse, bool repeat, byte delay)
|
|
||||||
{
|
|
||||||
Serial mobile = (Serial)0x1;
|
|
||||||
|
|
||||||
var expected = new MobileAnimation(
|
|
||||||
mobile,
|
|
||||||
action,
|
|
||||||
frameCount,
|
|
||||||
repeatCount,
|
|
||||||
!reverse,
|
|
||||||
repeat,
|
|
||||||
delay
|
|
||||||
).Compile();
|
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
|
||||||
ns.SendMobileAnimation(
|
|
||||||
mobile,
|
|
||||||
action,
|
|
||||||
frameCount,
|
|
||||||
repeatCount,
|
|
||||||
!reverse,
|
|
||||||
repeat,
|
|
||||||
delay
|
|
||||||
);
|
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
|
||||||
AssertThat.Equal(result, expected);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData(200, 5, 5)]
|
|
||||||
[InlineData(10, 100, 20)]
|
|
||||||
public void TestNewMobileAnimation(int action, int frameCount, byte delay)
|
|
||||||
{
|
|
||||||
Serial mobile = (Serial)0x1;
|
|
||||||
|
|
||||||
var expected = new NewMobileAnimation(
|
|
||||||
mobile,
|
|
||||||
action,
|
|
||||||
frameCount,
|
|
||||||
delay
|
|
||||||
).Compile();
|
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
|
||||||
ns.SendNewMobileAnimation(
|
|
||||||
mobile,
|
|
||||||
action,
|
|
||||||
frameCount,
|
|
||||||
delay
|
|
||||||
);
|
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
|
||||||
AssertThat.Equal(result, expected);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData("None")]
|
|
||||||
[InlineData("Lesser")]
|
|
||||||
[InlineData("Lethal")]
|
|
||||||
public void TestHealthbarPoison(string pName)
|
|
||||||
{
|
|
||||||
var p = Poison.GetPoison(pName);
|
|
||||||
var m = new Mobile((Serial)0x1);
|
|
||||||
m.DefaultMobileInit();
|
|
||||||
m.Poison = p;
|
|
||||||
|
|
||||||
var expected = new HealthbarPoison(m).Compile();
|
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
|
||||||
ns.SendMobileHealthbar(m, Healthbar.Poison);
|
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
|
||||||
AssertThat.Equal(result, expected);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData(false, false)]
|
|
||||||
[InlineData(true, false)]
|
|
||||||
[InlineData(false, true)]
|
|
||||||
[InlineData(true, true)]
|
|
||||||
public void TestYellowBar(bool isBlessed, bool isYellowHealth)
|
|
||||||
{
|
|
||||||
var m = new Mobile((Serial)0x1);
|
|
||||||
m.DefaultMobileInit();
|
|
||||||
m.Blessed = isBlessed;
|
|
||||||
m.YellowHealthbar = isYellowHealth;
|
|
||||||
|
|
||||||
var expected = new HealthbarYellow(m).Compile();
|
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
|
||||||
ns.SendMobileHealthbar(m, Healthbar.Yellow);
|
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
|
||||||
AssertThat.Equal(result, expected);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData(true)]
|
|
||||||
[InlineData(false)]
|
|
||||||
public void TestMobileStatusCompact(bool canBeRenamed)
|
|
||||||
{
|
|
||||||
var m = new Mobile((Serial)0x1) { Name = "Random Mobile 1" };
|
|
||||||
m.DefaultMobileInit();
|
|
||||||
m.Str = 50;
|
|
||||||
m.Hits = 100;
|
|
||||||
m.Int = 75;
|
|
||||||
m.Mana = 100;
|
|
||||||
m.Dex = 25;
|
|
||||||
m.Stam = 100;
|
|
||||||
|
|
||||||
var expected = new MobileStatusCompact(canBeRenamed, m).Compile();
|
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
|
||||||
ns.SendMobileStatusCompact(m, canBeRenamed);
|
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
|
||||||
AssertThat.Equal(result, expected);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData(ProtocolChanges.Version70610)]
|
|
||||||
[InlineData(ProtocolChanges.Version400a)]
|
|
||||||
[InlineData(ProtocolChanges.Version502b)]
|
|
||||||
public void TestMobileStatus(ProtocolChanges changes)
|
|
||||||
{
|
|
||||||
var beholder = new Mobile((Serial)0x1) { Name = "Random Mobile 1" };
|
|
||||||
beholder.DefaultMobileInit();
|
|
||||||
beholder.Str = 50;
|
|
||||||
beholder.Hits = 100;
|
|
||||||
beholder.Int = 75;
|
|
||||||
beholder.Mana = 100;
|
|
||||||
beholder.Dex = 25;
|
|
||||||
beholder.Stam = 100;
|
|
||||||
|
|
||||||
var beheld = new Mobile((Serial)0x2) { Name = "Random Mobile 2" };
|
|
||||||
beheld.DefaultMobileInit();
|
|
||||||
beheld.Str = 50;
|
|
||||||
beheld.Hits = 100;
|
|
||||||
beheld.Int = 75;
|
|
||||||
beheld.Mana = 100;
|
|
||||||
beheld.Dex = 25;
|
|
||||||
beheld.Stam = 100;
|
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
|
||||||
ns.ProtocolChanges = changes;
|
|
||||||
|
|
||||||
var expected = new MobileStatus(beholder, beheld, ns).Compile();
|
|
||||||
ns.SendMobileStatus(beholder, beheld);
|
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
|
||||||
AssertThat.Equal(result, expected);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData(ProtocolChanges.Version70610, "7.0.61.0", ClientFlags.TerMur, Expansion.HS, 6)]
|
|
||||||
[InlineData(ProtocolChanges.Version400a, "4.0.0a", ClientFlags.Malas, Expansion.AOS, 4)]
|
|
||||||
[InlineData(ProtocolChanges.Version502b, "5.0.2b", ClientFlags.Malas, Expansion.ML, 5)]
|
|
||||||
public void TestMobileStatusExtendedSelf(
|
|
||||||
ProtocolChanges changes,
|
|
||||||
string version,
|
|
||||||
ClientFlags clientFlags,
|
|
||||||
Expansion expansion,
|
|
||||||
int mobileStatusVersion
|
|
||||||
)
|
|
||||||
{
|
|
||||||
var expansionInfo = ExpansionInfo.CoreExpansion;
|
|
||||||
var oldExpansion = Core.Expansion;
|
|
||||||
var oldVersion = expansionInfo.MobileStatusVersion;
|
|
||||||
Core.Expansion = expansion;
|
|
||||||
ExpansionInfo.CoreExpansion.MobileStatusVersion = mobileStatusVersion;
|
|
||||||
|
|
||||||
var m = new Mobile((Serial)0x1) { Name = "Random Mobile 1" };
|
|
||||||
m.DefaultMobileInit();
|
|
||||||
m.Str = 50;
|
|
||||||
m.Hits = 100;
|
|
||||||
m.Int = 75;
|
|
||||||
m.Mana = 100;
|
|
||||||
m.Dex = 25;
|
|
||||||
m.Stam = 100;
|
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
|
||||||
ns.ProtocolChanges = changes;
|
|
||||||
ns.Version = new ClientVersion(version);
|
|
||||||
ns.Flags = clientFlags;
|
|
||||||
|
|
||||||
var expected = new MobileStatusExtended(m, ns).Compile();
|
|
||||||
ns.SendMobileStatus(m, m);
|
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
|
||||||
AssertThat.Equal(result, expected);
|
|
||||||
Core.Expansion = oldExpansion;
|
|
||||||
expansionInfo.MobileStatusVersion = oldVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData(ProtocolChanges.None, 0)]
|
|
||||||
[InlineData(ProtocolChanges.StygianAbyss, 100)]
|
|
||||||
public void TestMobileUpdate(ProtocolChanges changes, int solidHueOverride)
|
|
||||||
{
|
|
||||||
var m = new Mobile((Serial)0x1);
|
|
||||||
m.DefaultMobileInit();
|
|
||||||
m.SolidHueOverride = solidHueOverride;
|
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
|
||||||
ns.ProtocolChanges = changes;
|
|
||||||
|
|
||||||
var expected = new MobileUpdate(m, ns.StygianAbyss).Compile();
|
|
||||||
ns.SendMobileUpdate(m);
|
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
|
||||||
AssertThat.Equal(result, expected);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData(ProtocolChanges.Version70331, 0, 0, 0, 0)]
|
|
||||||
[InlineData(ProtocolChanges.Version70331, 10, 1024, 0, 0)]
|
|
||||||
[InlineData(ProtocolChanges.Version70331, 10, 1024, 11, 2048)]
|
|
||||||
[InlineData(ProtocolChanges.Version6000, 0, 0, 0, 0)]
|
|
||||||
[InlineData(ProtocolChanges.Version6000, 10, 1024, 0, 0)]
|
|
||||||
[InlineData(ProtocolChanges.Version6000, 10, 1024, 11, 2048)]
|
|
||||||
[InlineData(ProtocolChanges.Version7000, 0, 0, 0, 0)]
|
|
||||||
[InlineData(ProtocolChanges.Version7000, 10, 1024, 0, 0)]
|
|
||||||
[InlineData(ProtocolChanges.Version7000, 10, 1024, 11, 2048)]
|
|
||||||
public void TestMobileIncoming(
|
|
||||||
ProtocolChanges changes, int hairItemId, int hairHue, int facialHairItemId, int facialHairHue
|
|
||||||
)
|
|
||||||
{
|
|
||||||
var beholder = new Mobile((Serial)0x1)
|
|
||||||
{
|
{
|
||||||
Name = "Random Mobile 1"
|
Layer = Layer.OneHanded
|
||||||
};
|
}
|
||||||
beholder.DefaultMobileInit();
|
);
|
||||||
|
|
||||||
var beheld = new Mobile((Serial)0x2)
|
// Test Dupe
|
||||||
|
beheld.AddItem(
|
||||||
|
new Item((Serial)0x1001)
|
||||||
{
|
{
|
||||||
Name = "Random Mobile 2"
|
Layer = Layer.OneHanded
|
||||||
};
|
}
|
||||||
beheld.DefaultMobileInit();
|
);
|
||||||
beheld.AddItem(
|
|
||||||
new Item((Serial)0x1000)
|
|
||||||
{
|
|
||||||
Layer = Layer.OneHanded
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// Test Dupe
|
beheld.HairItemID = hairItemId;
|
||||||
beheld.AddItem(
|
beheld.HairHue = hairHue;
|
||||||
new Item((Serial)0x1001)
|
beheld.FacialHairItemID = facialHairItemId;
|
||||||
{
|
beheld.FacialHairHue = facialHairHue;
|
||||||
Layer = Layer.OneHanded
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
beheld.HairItemID = hairItemId;
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
beheld.HairHue = hairHue;
|
ns.ProtocolChanges = changes;
|
||||||
beheld.FacialHairItemID = facialHairItemId;
|
|
||||||
beheld.FacialHairHue = facialHairHue;
|
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
var expected = new MobileIncoming(ns, beholder, beheld).Compile();
|
||||||
ns.ProtocolChanges = changes;
|
ns.SendMobileIncoming(beholder, beheld);
|
||||||
|
|
||||||
var expected = new MobileIncoming(ns, beholder, beheld).Compile();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
ns.SendMobileIncoming(beholder, beheld);
|
AssertThat.Equal(result, expected);
|
||||||
|
}
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
[Fact]
|
||||||
AssertThat.Equal(result, expected);
|
public void TestMobileHits()
|
||||||
}
|
{
|
||||||
|
var m = new Mobile((Serial)0x1);
|
||||||
|
m.DefaultMobileInit();
|
||||||
|
m.Str = 100;
|
||||||
|
m.Hits = 100;
|
||||||
|
|
||||||
[Fact]
|
var expected = new MobileHits(m).Compile();
|
||||||
public void TestMobileHits()
|
|
||||||
{
|
|
||||||
var m = new Mobile((Serial)0x1);
|
|
||||||
m.DefaultMobileInit();
|
|
||||||
m.Str = 100;
|
|
||||||
m.Hits = 100;
|
|
||||||
|
|
||||||
var expected = new MobileHits(m).Compile();
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
ns.SendMobileHits(m);
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
ns.SendMobileHits(m);
|
AssertThat.Equal(result, expected);
|
||||||
|
}
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
[Fact]
|
||||||
AssertThat.Equal(result, expected);
|
public void TestMobileHitsN()
|
||||||
}
|
{
|
||||||
|
var m = new Mobile((Serial)0x1);
|
||||||
|
m.DefaultMobileInit();
|
||||||
|
m.Str = 100;
|
||||||
|
m.Hits = 100;
|
||||||
|
|
||||||
[Fact]
|
var expected = new MobileHitsN(m).Compile();
|
||||||
public void TestMobileHitsN()
|
|
||||||
{
|
|
||||||
var m = new Mobile((Serial)0x1);
|
|
||||||
m.DefaultMobileInit();
|
|
||||||
m.Str = 100;
|
|
||||||
m.Hits = 100;
|
|
||||||
|
|
||||||
var expected = new MobileHitsN(m).Compile();
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
ns.SendMobileHits(m, true);
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
ns.SendMobileHits(m, true);
|
AssertThat.Equal(result, expected);
|
||||||
|
}
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
[Fact]
|
||||||
AssertThat.Equal(result, expected);
|
public void TestMobileMana()
|
||||||
}
|
{
|
||||||
|
var m = new Mobile((Serial)0x1);
|
||||||
|
m.DefaultMobileInit();
|
||||||
|
m.Int = 75;
|
||||||
|
m.Mana = 100;
|
||||||
|
|
||||||
[Fact]
|
var expected = new MobileMana(m).Compile();
|
||||||
public void TestMobileMana()
|
|
||||||
{
|
|
||||||
var m = new Mobile((Serial)0x1);
|
|
||||||
m.DefaultMobileInit();
|
|
||||||
m.Int = 75;
|
|
||||||
m.Mana = 100;
|
|
||||||
|
|
||||||
var expected = new MobileMana(m).Compile();
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
ns.SendMobileMana(m);
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
ns.SendMobileMana(m);
|
AssertThat.Equal(result, expected);
|
||||||
|
}
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
[Fact]
|
||||||
AssertThat.Equal(result, expected);
|
public void TestMobileManaN()
|
||||||
}
|
{
|
||||||
|
var m = new Mobile((Serial)0x1);
|
||||||
|
m.DefaultMobileInit();
|
||||||
|
m.Int = 75;
|
||||||
|
m.Mana = 100;
|
||||||
|
|
||||||
[Fact]
|
var expected = new MobileManaN(m).Compile();
|
||||||
public void TestMobileManaN()
|
|
||||||
{
|
|
||||||
var m = new Mobile((Serial)0x1);
|
|
||||||
m.DefaultMobileInit();
|
|
||||||
m.Int = 75;
|
|
||||||
m.Mana = 100;
|
|
||||||
|
|
||||||
var expected = new MobileManaN(m).Compile();
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
ns.SendMobileMana(m, true);
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
ns.SendMobileMana(m, true);
|
AssertThat.Equal(result, expected);
|
||||||
|
}
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
[Fact]
|
||||||
AssertThat.Equal(result, expected);
|
public void TestMobileStam()
|
||||||
}
|
{
|
||||||
|
var m = new Mobile((Serial)0x1);
|
||||||
|
m.DefaultMobileInit();
|
||||||
|
m.Dex = 75;
|
||||||
|
m.Stam = 100;
|
||||||
|
|
||||||
[Fact]
|
var expected = new MobileStam(m).Compile();
|
||||||
public void TestMobileStam()
|
|
||||||
{
|
|
||||||
var m = new Mobile((Serial)0x1);
|
|
||||||
m.DefaultMobileInit();
|
|
||||||
m.Dex = 75;
|
|
||||||
m.Stam = 100;
|
|
||||||
|
|
||||||
var expected = new MobileStam(m).Compile();
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
ns.SendMobileStam(m);
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
ns.SendMobileStam(m);
|
AssertThat.Equal(result, expected);
|
||||||
|
}
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
[Fact]
|
||||||
AssertThat.Equal(result, expected);
|
public void TestMobileStamN()
|
||||||
}
|
{
|
||||||
|
var m = new Mobile((Serial)0x1);
|
||||||
|
m.DefaultMobileInit();
|
||||||
|
m.Dex = 75;
|
||||||
|
m.Stam = 100;
|
||||||
|
|
||||||
[Fact]
|
var expected = new MobileStamN(m).Compile();
|
||||||
public void TestMobileStamN()
|
|
||||||
{
|
|
||||||
var m = new Mobile((Serial)0x1);
|
|
||||||
m.DefaultMobileInit();
|
|
||||||
m.Dex = 75;
|
|
||||||
m.Stam = 100;
|
|
||||||
|
|
||||||
var expected = new MobileStamN(m).Compile();
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
ns.SendMobileStam(m, true);
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
ns.SendMobileStam(m, true);
|
AssertThat.Equal(result, expected);
|
||||||
|
}
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
[Fact]
|
||||||
AssertThat.Equal(result, expected);
|
public void TestMobileAttributes()
|
||||||
}
|
{
|
||||||
|
var m = new Mobile((Serial)0x1);
|
||||||
|
m.DefaultMobileInit();
|
||||||
|
m.Str = 50;
|
||||||
|
m.Hits = 100;
|
||||||
|
m.Int = 75;
|
||||||
|
m.Mana = 100;
|
||||||
|
m.Dex = 25;
|
||||||
|
m.Stam = 100;
|
||||||
|
|
||||||
[Fact]
|
var expected = new MobileAttributes(m).Compile();
|
||||||
public void TestMobileAttributes()
|
|
||||||
{
|
|
||||||
var m = new Mobile((Serial)0x1);
|
|
||||||
m.DefaultMobileInit();
|
|
||||||
m.Str = 50;
|
|
||||||
m.Hits = 100;
|
|
||||||
m.Int = 75;
|
|
||||||
m.Mana = 100;
|
|
||||||
m.Dex = 25;
|
|
||||||
m.Stam = 100;
|
|
||||||
|
|
||||||
var expected = new MobileAttributes(m).Compile();
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
ns.SendMobileAttributes(m);
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
ns.SendMobileAttributes(m);
|
AssertThat.Equal(result, expected);
|
||||||
|
}
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
[Fact]
|
||||||
AssertThat.Equal(result, expected);
|
public void TestMobileAttributesN()
|
||||||
}
|
{
|
||||||
|
var m = new Mobile((Serial)0x1);
|
||||||
|
m.DefaultMobileInit();
|
||||||
|
m.Str = 50;
|
||||||
|
m.Hits = 100;
|
||||||
|
m.Int = 75;
|
||||||
|
m.Mana = 100;
|
||||||
|
m.Dex = 25;
|
||||||
|
m.Stam = 100;
|
||||||
|
|
||||||
[Fact]
|
var expected = new MobileAttributesN(m).Compile();
|
||||||
public void TestMobileAttributesN()
|
|
||||||
{
|
|
||||||
var m = new Mobile((Serial)0x1);
|
|
||||||
m.DefaultMobileInit();
|
|
||||||
m.Str = 50;
|
|
||||||
m.Hits = 100;
|
|
||||||
m.Int = 75;
|
|
||||||
m.Mana = 100;
|
|
||||||
m.Dex = 25;
|
|
||||||
m.Stam = 100;
|
|
||||||
|
|
||||||
var expected = new MobileAttributesN(m).Compile();
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
ns.SendMobileAttributes(m, true);
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
ns.SendMobileAttributes(m, true);
|
AssertThat.Equal(result, expected);
|
||||||
|
}
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
[Fact]
|
||||||
AssertThat.Equal(result, expected);
|
public void TestRemoveEntity()
|
||||||
}
|
{
|
||||||
|
Serial e = (Serial)0x1000;
|
||||||
|
var expected = new RemoveEntity(e).Compile();
|
||||||
|
|
||||||
[Fact]
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
public void TestRemoveEntity()
|
ns.SendRemoveEntity(e);
|
||||||
{
|
|
||||||
Serial e = (Serial)0x1000;
|
|
||||||
var expected = new RemoveEntity(e).Compile();
|
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
ns.SendRemoveEntity(e);
|
AssertThat.Equal(result, expected);
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
|
||||||
AssertThat.Equal(result, expected);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -282,10 +282,7 @@ public class ClientVersion : IComparable<ClientVersion>, IComparer<ClientVersion
|
||||||
var v when v >= Version6017 => ProtocolChanges.Version6017,
|
var v when v >= Version6017 => ProtocolChanges.Version6017,
|
||||||
var v when v >= Version6000 => ProtocolChanges.Version6000,
|
var v when v >= Version6000 => ProtocolChanges.Version6000,
|
||||||
var v when v >= Version502b => ProtocolChanges.Version502b,
|
var v when v >= Version502b => ProtocolChanges.Version502b,
|
||||||
var v when v >= Version500a => ProtocolChanges.Version500a,
|
_ => ProtocolChanges.Version500a, // We do not support versions lower than 5.0.0a
|
||||||
var v when v >= Version407a => ProtocolChanges.Version407a,
|
|
||||||
var v when v >= Version400a => ProtocolChanges.Version400a,
|
|
||||||
_ => ProtocolChanges.None
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
using Server.Text;
|
|
||||||
using Server.Utilities;
|
using Server.Utilities;
|
||||||
|
|
||||||
namespace Server.Gumps;
|
namespace Server.Gumps;
|
||||||
|
|
@ -25,10 +24,6 @@ public partial class Gump
|
||||||
{
|
{
|
||||||
private static Serial _nextSerial = (Serial)1;
|
private static Serial _nextSerial = (Serial)1;
|
||||||
|
|
||||||
public static readonly byte[] NoMove = StringToBuffer("{ nomove }");
|
|
||||||
public static readonly byte[] NoClose = StringToBuffer("{ noclose }");
|
|
||||||
public static readonly byte[] NoDispose = StringToBuffer("{ nodispose }");
|
|
||||||
public static readonly byte[] NoResize = StringToBuffer("{ noresize }");
|
|
||||||
|
|
||||||
private int _switches;
|
private int _switches;
|
||||||
private int _textEntries;
|
private int _textEntries;
|
||||||
|
|
@ -289,8 +284,6 @@ public partial class Gump
|
||||||
state.SendDisplayGump(this, out _switches, out _textEntries);
|
state.SendDisplayGump(this, out _switches, out _textEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] StringToBuffer(string str) => str.GetBytesAscii();
|
|
||||||
|
|
||||||
public virtual void OnResponse(NetState sender, in RelayInfo info)
|
public virtual void OnResponse(NetState sender, in RelayInfo info)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,8 @@ namespace Server.Gumps;
|
||||||
|
|
||||||
public class GumpECHandleInput : GumpEntry
|
public class GumpECHandleInput : GumpEntry
|
||||||
{
|
{
|
||||||
private static byte[] _layout = Gump.StringToBuffer("{ echandleinput }");
|
|
||||||
|
|
||||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||||
{
|
{
|
||||||
writer.Write(_layout);
|
writer.Write("{ echandleinput }"u8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,6 @@ namespace Server.Gumps;
|
||||||
|
|
||||||
public class GumpGroup : GumpEntry
|
public class GumpGroup : GumpEntry
|
||||||
{
|
{
|
||||||
private static byte[] _group1 = Gump.StringToBuffer("{ group 1 }");
|
|
||||||
|
|
||||||
public GumpGroup(int group) => Group = group;
|
public GumpGroup(int group) => Group = group;
|
||||||
|
|
||||||
public int Group { get; set; }
|
public int Group { get; set; }
|
||||||
|
|
@ -30,7 +28,7 @@ public class GumpGroup : GumpEntry
|
||||||
{
|
{
|
||||||
if (Group == 1)
|
if (Group == 1)
|
||||||
{
|
{
|
||||||
writer.Write(_group1);
|
writer.Write("{ group 1 }"u8);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,6 @@ namespace Server.Gumps;
|
||||||
|
|
||||||
public class GumpPage : GumpEntry
|
public class GumpPage : GumpEntry
|
||||||
{
|
{
|
||||||
private static byte[] _page0 = Gump.StringToBuffer("{ page 0 }");
|
|
||||||
|
|
||||||
public GumpPage(int page) => Page = page;
|
public GumpPage(int page) => Page = page;
|
||||||
|
|
||||||
public int Page { get; set; }
|
public int Page { get; set; }
|
||||||
|
|
@ -30,7 +28,7 @@ public class GumpPage : GumpEntry
|
||||||
{
|
{
|
||||||
if (Page == 0)
|
if (Page == 0)
|
||||||
{
|
{
|
||||||
writer.Write(_page0);
|
writer.Write("{ page 0 }"u8);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ public partial class NetState
|
||||||
|
|
||||||
public bool NewSpellbook => HasProtocolChanges(ProtocolChanges.NewSpellbook);
|
public bool NewSpellbook => HasProtocolChanges(ProtocolChanges.NewSpellbook);
|
||||||
public bool DamagePacket => HasProtocolChanges(ProtocolChanges.DamagePacket);
|
public bool DamagePacket => HasProtocolChanges(ProtocolChanges.DamagePacket);
|
||||||
public bool Unpack => HasProtocolChanges(ProtocolChanges.Unpack);
|
|
||||||
public bool BuffIcon => HasProtocolChanges(ProtocolChanges.BuffIcon);
|
public bool BuffIcon => HasProtocolChanges(ProtocolChanges.BuffIcon);
|
||||||
public bool NewHaven => HasProtocolChanges(ProtocolChanges.NewHaven);
|
public bool NewHaven => HasProtocolChanges(ProtocolChanges.NewHaven);
|
||||||
public bool ContainerGridLines => HasProtocolChanges(ProtocolChanges.ContainerGridLines);
|
public bool ContainerGridLines => HasProtocolChanges(ProtocolChanges.ContainerGridLines);
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ public enum ProtocolChanges
|
||||||
None = 0x00000000,
|
None = 0x00000000,
|
||||||
NewSpellbook = 0x00000001,
|
NewSpellbook = 0x00000001,
|
||||||
DamagePacket = 0x00000002,
|
DamagePacket = 0x00000002,
|
||||||
Unpack = 0x00000004,
|
// Unpack = 0x00000004,
|
||||||
BuffIcon = 0x00000008,
|
BuffIcon = 0x00000008,
|
||||||
NewHaven = 0x00000010,
|
NewHaven = 0x00000010,
|
||||||
ContainerGridLines = 0x00000020,
|
ContainerGridLines = 0x00000020,
|
||||||
|
|
@ -38,9 +38,7 @@ public enum ProtocolChanges
|
||||||
UltimaStore = 0x00004000,
|
UltimaStore = 0x00004000,
|
||||||
EndlessJourney = 0x00008000,
|
EndlessJourney = 0x00008000,
|
||||||
|
|
||||||
Version400a = NewSpellbook,
|
Version500a = NewSpellbook | DamagePacket /* | Unpack*/,
|
||||||
Version407a = Version400a | DamagePacket,
|
|
||||||
Version500a = Version407a | Unpack,
|
|
||||||
Version502b = Version500a | BuffIcon,
|
Version502b = Version500a | BuffIcon,
|
||||||
Version6000 = Version502b | NewHaven,
|
Version6000 = Version502b | NewHaven,
|
||||||
Version6017 = Version6000 | ContainerGridLines,
|
Version6017 = Version6000 | ContainerGridLines,
|
||||||
|
|
|
||||||
|
|
@ -105,28 +105,26 @@ public static class OutgoingGumpPackets
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var packed = ns.Unpack;
|
|
||||||
|
|
||||||
var layoutWriter = new SpanWriter(_layoutBuffer);
|
var layoutWriter = new SpanWriter(_layoutBuffer);
|
||||||
|
|
||||||
if (!gump.Draggable)
|
if (!gump.Draggable)
|
||||||
{
|
{
|
||||||
layoutWriter.Write(Gump.NoMove);
|
layoutWriter.Write("{ nomove }"u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gump.Closable)
|
if (!gump.Closable)
|
||||||
{
|
{
|
||||||
layoutWriter.Write(Gump.NoClose);
|
layoutWriter.Write("{ noclose }"u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gump.Disposable)
|
if (!gump.Disposable)
|
||||||
{
|
{
|
||||||
layoutWriter.Write(Gump.NoDispose);
|
layoutWriter.Write("{ nodispose }"u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gump.Resizable)
|
if (!gump.Resizable)
|
||||||
{
|
{
|
||||||
layoutWriter.Write(Gump.NoResize);
|
layoutWriter.Write("{ noresize }"u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var entry in gump.Entries)
|
foreach (var entry in gump.Entries)
|
||||||
|
|
@ -143,20 +141,12 @@ public static class OutgoingGumpPackets
|
||||||
stringsWriter.WriteBigUni(s);
|
stringsWriter.WriteBigUni(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
int maxLength;
|
var worstLayoutLength = Zlib.MaxPackSize(layoutWriter.BytesWritten);
|
||||||
if (packed)
|
var worstStringsLength = Zlib.MaxPackSize(stringsWriter.BytesWritten);
|
||||||
{
|
var maxLength = 40 + worstLayoutLength + worstStringsLength;
|
||||||
var worstLayoutLength = Zlib.MaxPackSize(layoutWriter.BytesWritten);
|
|
||||||
var worstStringsLength = Zlib.MaxPackSize(stringsWriter.BytesWritten);
|
|
||||||
maxLength = 40 + worstLayoutLength + worstStringsLength;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
maxLength = 23 + layoutWriter.BytesWritten + stringsWriter.BytesWritten;
|
|
||||||
}
|
|
||||||
|
|
||||||
var writer = new SpanWriter(maxLength);
|
var writer = new SpanWriter(maxLength);
|
||||||
writer.Write((byte)(packed ? 0xDD : 0xB0)); // Packet ID
|
writer.Write((byte)0xDD); // Packet ID
|
||||||
writer.Seek(2, SeekOrigin.Current);
|
writer.Seek(2, SeekOrigin.Current);
|
||||||
|
|
||||||
writer.Write(gump.Serial);
|
writer.Write(gump.Serial);
|
||||||
|
|
@ -164,22 +154,11 @@ public static class OutgoingGumpPackets
|
||||||
writer.Write(gump.X);
|
writer.Write(gump.X);
|
||||||
writer.Write(gump.Y);
|
writer.Write(gump.Y);
|
||||||
|
|
||||||
if (packed)
|
layoutWriter.Write((byte)0); // Layout text terminator
|
||||||
{
|
WritePacked(layoutWriter.Span, ref writer);
|
||||||
layoutWriter.Write((byte)0); // Layout text terminator
|
|
||||||
WritePacked(layoutWriter.Span, ref writer);
|
|
||||||
|
|
||||||
writer.Write(_stringsList.Count);
|
writer.Write(_stringsList.Count);
|
||||||
WritePacked(stringsWriter.Span, ref writer);
|
WritePacked(stringsWriter.Span, ref writer);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
writer.Write((ushort)layoutWriter.BytesWritten);
|
|
||||||
writer.Write(layoutWriter.Span);
|
|
||||||
|
|
||||||
writer.Write((ushort)_stringsList.Count);
|
|
||||||
writer.Write(stringsWriter.Span);
|
|
||||||
}
|
|
||||||
|
|
||||||
writer.WritePacketLength();
|
writer.WritePacketLength();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,28 +5,24 @@ using Server.Tests;
|
||||||
using Server.Tests.Network;
|
using Server.Tests.Network;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace UOContent.Tests
|
namespace UOContent.Tests;
|
||||||
|
|
||||||
|
public class TrackingGumpTests : IClassFixture<ServerFixture>
|
||||||
{
|
{
|
||||||
public class TrackingGumpTests : IClassFixture<ServerFixture>
|
[Fact]
|
||||||
|
// Regression test used to identify an issue with AddItem compilation of the packet
|
||||||
|
public void TestTrackingGump()
|
||||||
{
|
{
|
||||||
[Theory]
|
var pm = new PlayerMobile();
|
||||||
[InlineData(ProtocolChanges.None)]
|
pm.Skills.Tracking.BaseFixedPoint = 1000;
|
||||||
[InlineData(ProtocolChanges.Unpack)]
|
var g = new TrackWhatGump(pm);
|
||||||
// Regression test used to identify an issue with AddItem compilation of the packet
|
|
||||||
public void TestTrackingGump(ProtocolChanges changes)
|
|
||||||
{
|
|
||||||
var pm = new PlayerMobile();
|
|
||||||
pm.Skills.Tracking.BaseFixedPoint = 1000;
|
|
||||||
var g = new TrackWhatGump(pm);
|
|
||||||
|
|
||||||
var ns = PacketTestUtilities.CreateTestNetState();
|
var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
ns.ProtocolChanges = changes;
|
|
||||||
|
|
||||||
var expected = g.Compile(ns).Compile();
|
var expected = g.Compile(ns).Compile();
|
||||||
ns.SendDisplayGump(g, out var switches, out var entries);
|
ns.SendDisplayGump(g, out var switches, out var entries);
|
||||||
|
|
||||||
var result = ns.SendPipe.Reader.AvailableToRead();
|
var result = ns.SendPipe.Reader.AvailableToRead();
|
||||||
AssertThat.Equal(result, expected);
|
AssertThat.Equal(result, expected);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue