fix: Moves the rest of the Incoming packets (#1338)
This commit is contained in:
parent
a8d8db8f59
commit
b46544d752
10 changed files with 71 additions and 25 deletions
|
|
@ -1,3 +1,18 @@
|
||||||
|
/*************************************************************************
|
||||||
|
* ModernUO *
|
||||||
|
* Copyright 2019-2023 - ModernUO Development Team *
|
||||||
|
* Email: hi@modernuo.com *
|
||||||
|
* File: Gump.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;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
@ -15,7 +30,20 @@ public partial class Gump
|
||||||
public static readonly byte[] NoDispose = StringToBuffer("{ nodispose }");
|
public static readonly byte[] NoDispose = StringToBuffer("{ nodispose }");
|
||||||
public static readonly byte[] NoResize = StringToBuffer("{ noresize }");
|
public static readonly byte[] NoResize = StringToBuffer("{ noresize }");
|
||||||
|
|
||||||
internal int m_TextEntries, m_Switches;
|
private int _switches;
|
||||||
|
private int _textEntries;
|
||||||
|
|
||||||
|
public int Switches
|
||||||
|
{
|
||||||
|
get => _switches;
|
||||||
|
set => _switches = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int TextEntries
|
||||||
|
{
|
||||||
|
get => _textEntries;
|
||||||
|
set => _textEntries = value;
|
||||||
|
}
|
||||||
|
|
||||||
public Gump(int x, int y)
|
public Gump(int x, int y)
|
||||||
{
|
{
|
||||||
|
|
@ -250,7 +278,7 @@ public partial class Gump
|
||||||
public void SendTo(NetState state)
|
public void SendTo(NetState state)
|
||||||
{
|
{
|
||||||
state.AddGump(this);
|
state.AddGump(this);
|
||||||
state.SendDisplayGump(this, out m_Switches, out m_TextEntries);
|
state.SendDisplayGump(this, out _switches, out _textEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] StringToBuffer(string str) => str.GetBytesAscii();
|
public static byte[] StringToBuffer(string str) => str.GetBytesAscii();
|
||||||
|
|
|
||||||
37
Projects/Server/MessageType.cs
Normal file
37
Projects/Server/MessageType.cs
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*************************************************************************
|
||||||
|
* ModernUO *
|
||||||
|
* Copyright 2019-2023 - ModernUO Development Team *
|
||||||
|
* Email: hi@modernuo.com *
|
||||||
|
* File: MessageType.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;
|
||||||
|
|
||||||
|
namespace Server;
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum MessageType
|
||||||
|
{
|
||||||
|
Regular = 0x00,
|
||||||
|
System = 0x01,
|
||||||
|
Emote = 0x02,
|
||||||
|
Label = 0x06,
|
||||||
|
Focus = 0x07,
|
||||||
|
Whisper = 0x08,
|
||||||
|
Yell = 0x09,
|
||||||
|
Spell = 0x0A,
|
||||||
|
|
||||||
|
Guild = 0x0D,
|
||||||
|
Alliance = 0x0E,
|
||||||
|
Command = 0x0F,
|
||||||
|
|
||||||
|
Encoded = 0xC0
|
||||||
|
}
|
||||||
|
|
@ -92,8 +92,8 @@ public static class IncomingItemPackets
|
||||||
|
|
||||||
if (item is BaseMulti multi && multi.AllowsRelativeDrop)
|
if (item is BaseMulti multi && multi.AllowsRelativeDrop)
|
||||||
{
|
{
|
||||||
loc.m_X += multi.X;
|
loc.X += multi.X;
|
||||||
loc.m_Y += multi.Y;
|
loc.Y += multi.Y;
|
||||||
from.Drop(loc);
|
from.Drop(loc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -17,25 +17,6 @@ using System;
|
||||||
|
|
||||||
namespace Server.Network;
|
namespace Server.Network;
|
||||||
|
|
||||||
[Flags]
|
|
||||||
public enum MessageType
|
|
||||||
{
|
|
||||||
Regular = 0x00,
|
|
||||||
System = 0x01,
|
|
||||||
Emote = 0x02,
|
|
||||||
Label = 0x06,
|
|
||||||
Focus = 0x07,
|
|
||||||
Whisper = 0x08,
|
|
||||||
Yell = 0x09,
|
|
||||||
Spell = 0x0A,
|
|
||||||
|
|
||||||
Guild = 0x0D,
|
|
||||||
Alliance = 0x0E,
|
|
||||||
Command = 0x0F,
|
|
||||||
|
|
||||||
Encoded = 0xC0
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class IncomingMessagePackets
|
public static class IncomingMessagePackets
|
||||||
{
|
{
|
||||||
private static readonly KeywordList m_KeywordList = new();
|
private static readonly KeywordList m_KeywordList = new();
|
||||||
|
|
@ -384,7 +384,7 @@ public static class IncomingPlayerPackets
|
||||||
|
|
||||||
var switchCount = reader.ReadInt32();
|
var switchCount = reader.ReadInt32();
|
||||||
|
|
||||||
if (switchCount < 0 || switchCount > gump.m_Switches)
|
if (switchCount < 0 || switchCount > gump.Switches)
|
||||||
{
|
{
|
||||||
state.LogInfo("Invalid gump response, disconnecting...");
|
state.LogInfo("Invalid gump response, disconnecting...");
|
||||||
var exception = new InvalidGumpResponseException($"Bad switch count {switchCount}");
|
var exception = new InvalidGumpResponseException($"Bad switch count {switchCount}");
|
||||||
|
|
@ -405,7 +405,7 @@ public static class IncomingPlayerPackets
|
||||||
|
|
||||||
var textCount = reader.ReadInt32();
|
var textCount = reader.ReadInt32();
|
||||||
|
|
||||||
if (textCount < 0 || textCount > gump.m_TextEntries)
|
if (textCount < 0 || textCount > gump.TextEntries)
|
||||||
{
|
{
|
||||||
state.LogInfo("Invalid gump response, disconnecting...");
|
state.LogInfo("Invalid gump response, disconnecting...");
|
||||||
var exception = new InvalidGumpResponseException($"Bad text entry count {textCount}");
|
var exception = new InvalidGumpResponseException($"Bad text entry count {textCount}");
|
||||||
Loading…
Add table
Add a link
Reference in a new issue