Skip to content

Commit

Permalink
Fix: Plugin/Command-Handler was not working because of packet parsing (
Browse files Browse the repository at this point in the history
  • Loading branch information
SDClowen authored Mar 20, 2023
1 parent 37048d2 commit 9373a29
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 0 additions & 8 deletions Library/RSBot.Core/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,7 @@ public static void ShowNotification(string message)
return;

var chatPacket = new Packet(0x3026);

chatPacket.WriteByte(ChatType.Notice);

if (Game.ClientType > GameClientType.Vietnam)
chatPacket.WriteByte(0); // has linking

if (Game.ClientType >= GameClientType.Chinese)
chatPacket.WriteByte(0);

chatPacket.WriteConditonalString(message);

PacketManager.SendPacket(chatPacket, PacketDestination.Client);
Expand Down
10 changes: 9 additions & 1 deletion Plugins/RSBot.CommandCenter/Network/Hook/ChatRequestHook.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using RSBot.CommandCenter.Components;
using RSBot.Core;
using RSBot.Core.Components;
using RSBot.Core.Extensions;
using RSBot.Core.Network;
Expand All @@ -18,10 +19,17 @@ public Packet ReplacePacket(Packet packet)
return packet;

var type = (ChatType)packet.ReadByte();

if (type == ChatType.Private)
return packet;

packet.ReadByte(); // chatIndex

if (Game.ClientType > GameClientType.Vietnam)
packet.ReadByte(); // has linking

if (Game.ClientType >= GameClientType.Chinese)
packet.ReadByte();

var message = packet.ReadConditonalString();
if (!message.StartsWith("\\"))
return packet;
Expand Down

0 comments on commit 9373a29

Please sign in to comment.