Skip to content

Commit

Permalink
Fix GM Chat Flag
Browse files Browse the repository at this point in the history
  • Loading branch information
0blu authored and MaxtorCoder committed May 25, 2022
1 parent d94a041 commit 66e0458
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions HermesProxy/VersionChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,14 @@ public static uint ConvertSpellCastResult(uint result)
return (uint)Enum.Parse(typeof(SpellCastResultClassic), ((SpellCastResultVanilla)result).ToString());
}

public static ChatFlags ConvertChatFlags(byte rawOldChatFlags)
{
ChatFlags result = (ChatFlags) rawOldChatFlags;
if (RemovedInVersion(ClientVersionBuild.V2_0_1_6180) && result.HasFlag(ChatFlags.AFK) && result.HasFlag(ChatFlags.DND))
return ChatFlags.GM; // In vanilla AFK | DND == GM
return result;
}

public static QuestGiverStatusModern ConvertQuestGiverStatus(byte status)
{
if (AddedInVersion(ClientVersionBuild.V3_0_2_9056))
Expand Down
4 changes: 2 additions & 2 deletions HermesProxy/World/Client/PacketHandlers/ChatHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ void HandleServerChatMessageVanilla(WorldPacket packet)

uint textLength = packet.ReadUInt32();
string text = packet.ReadString(textLength);
ChatFlags chatFlags = (ChatFlags)packet.ReadUInt8();
ChatFlags chatFlags = LegacyVersion.ConvertChatFlags(packet.ReadUInt8());

string addonPrefix = "";
if (!ChatPkt.CheckAddonPrefix(GetSession().GameState.AddonPrefixes, ref language, ref text, ref addonPrefix))
Expand Down Expand Up @@ -310,7 +310,7 @@ void HandleServerChatMessageWotLK(WorldPacket packet)

uint textLength = packet.ReadUInt32();
string text = packet.ReadString(textLength);
ChatFlags chatFlags = (ChatFlags)packet.ReadUInt8();
ChatFlags chatFlags = LegacyVersion.ConvertChatFlags(packet.ReadUInt8());

if (LegacyVersion.InVersion(ClientVersionBuild.V2_0_1_6180, ClientVersionBuild.V3_0_2_9056) &&
packet.GetUniversalOpcode(false) == Opcode.SMSG_GM_MESSAGECHAT)
Expand Down
1 change: 1 addition & 0 deletions HermesProxy/World/Enums/PlayerDefines.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public enum RestState
Normal = 0x02,
};

[Flags]
public enum ChatFlags
{
None = 0x00,
Expand Down

0 comments on commit 66e0458

Please sign in to comment.