diff --git a/src/egs_game.erl b/src/egs_game.erl index 69e79f2..395ca70 100644 --- a/src/egs_game.erl +++ b/src/egs_game.erl @@ -249,8 +249,8 @@ loop(CSocket, GID, Version) -> egs_proto:packet_send(CSocket, Send) end, ?MODULE:loop(CSocket, GID, Version); - {psu_chat, ChatGID, ChatName, ChatMessage} -> - egs_proto:send_chat(CSocket, Version, ChatGID, ChatName, ChatMessage), + {psu_chat, ChatGID, ChatName, ChatModifiers, ChatMessage} -> + egs_proto:send_chat(CSocket, Version, ChatGID, ChatName, ChatModifiers, ChatMessage), ?MODULE:loop(CSocket, GID, Version); {psu_player_spawn, SpawnPlayer} -> send_spawn(CSocket, GID, SpawnPlayer), @@ -324,7 +324,7 @@ handle(16#0302, _, GID, _, _) -> handle(16#0304, _, GID, Version, Packet) -> log(GID, "broadcast chat"), - [{gid, _}, {name, ChatName}, {message, ChatMessage}] = egs_proto:parse_chat(Version, Packet), + [{gid, _}, {name, ChatName}, {modifiers, ChatModifiers}, {message, ChatMessage}] = egs_proto:parse_chat(Version, Packet), case ChatName of missing -> case egs_db:users_select(GID) of @@ -336,7 +336,7 @@ handle(16#0304, _, GID, Version, Packet) -> _ -> ActualName = ChatName end, - lists:foreach(fun(User) -> User#users.pid ! {psu_chat, GID, ActualName, ChatMessage} end, egs_db:users_select_all()); + lists:foreach(fun(User) -> User#users.pid ! {psu_chat, GID, ActualName, ChatModifiers, ChatMessage} end, egs_db:users_select_all()); %% @doc Movements handler. Broadcast to all other players. diff --git a/src/egs_proto.erl b/src/egs_proto.erl index 33f2d2e..0499bc8 100644 --- a/src/egs_proto.erl +++ b/src/egs_proto.erl @@ -133,14 +133,14 @@ parse_character_select(Packet) -> %% @doc Parse a chat command. AOTI v2.000 version of the command. parse_chat(0, Packet) -> - << _:384, FromGID:32/unsigned-integer, _:128, Message/bits >> = Packet, - [{gid, FromGID}, {name, missing}, {message, Message}]; + << _:384, FromGID:32/unsigned-integer, Modifiers:128/bits, Message/bits >> = Packet, + [{gid, FromGID}, {name, missing}, {modifiers, Modifiers}, {message, Message}]; %% @doc Parse a chat command. AOTI since an unknown version of the game. parse_chat(_, Packet) -> - << _:384, FromGID:32/unsigned-integer, _:128, FromName:512/bits, Message/bits >> = Packet, - [{gid, FromGID}, {name, FromName}, {message, Message}]. + << _:384, FromGID:32/unsigned-integer, Modifiers:128/bits, FromName:512/bits, Message/bits >> = Packet, + [{gid, FromGID}, {name, FromName}, {modifiers, Modifiers}, {message, Message}]. %% @doc Parse the game server auth command. Used when first connecting to a game server. @@ -214,14 +214,14 @@ send_character_selected(CSocket, GID, Char, Options) -> %% @doc Send a chat command. AOTI v2.000 version of the command. -send_chat(CSocket, 0, FromGID, _, Message) -> - Packet = << 16#0304:16/unsigned-integer, 0:320, 16#1200:16/unsigned-integer, FromGID:32/little-unsigned-integer, 0:128, Message/bits >>, +send_chat(CSocket, 0, FromGID, _, Modifiers, Message) -> + Packet = << 16#0304:16/unsigned-integer, 0:320, 16#1200:16/unsigned-integer, FromGID:32/little-unsigned-integer, Modifiers:128/bits, Message/bits >>, packet_send(CSocket, Packet); %% @doc Send a chat command. AOTI since an unknown version of the game. -send_chat(CSocket, _, FromGID, FromName, Message) -> - Packet = << 16#0304:16, 0:320, 16#1200:16/unsigned-integer, FromGID:32/little-unsigned-integer, 0:128, FromName:512/bits, Message/bits >>, +send_chat(CSocket, _, FromGID, FromName, Modifiers, Message) -> + Packet = << 16#0304:16, 0:320, 16#1200:16/unsigned-integer, FromGID:32/little-unsigned-integer, Modifiers:128/bits, FromName:512/bits, Message/bits >>, packet_send(CSocket, Packet). %% @doc Send the character flags list.