proto: Remove parse_chat.
This commit is contained in:
parent
8aa3a9f2e0
commit
2dc9d30660
@ -573,23 +573,19 @@ handle(16#0302, _, GID, _, _) ->
|
|||||||
%% @todo Only broadcast to people in the same map.
|
%% @todo Only broadcast to people in the same map.
|
||||||
|
|
||||||
handle(16#0304, _, GID, Version, Orig) ->
|
handle(16#0304, _, GID, Version, Orig) ->
|
||||||
[{gid, _}, {name, ChatName}, {modifiers, ChatModifiers}, {message, ChatMessage}] = egs_proto:parse_chat(Version, Orig),
|
case Version of
|
||||||
case ChatName of
|
0 -> % AOTI v2.000
|
||||||
missing ->
|
<< _:416, Modifiers:128/bits, Message/bits >> = Orig,
|
||||||
case egs_db:users_select(GID) of
|
User = egs_db:users_select(GID),
|
||||||
error ->
|
Name = User#users.charname;
|
||||||
ActualName = ChatName;
|
_ -> % Above
|
||||||
User ->
|
<< _:416, Modifiers:128/bits, Name:512/bits, Message/bits >> = Orig
|
||||||
ActualName = User#users.charname
|
|
||||||
end;
|
|
||||||
_ ->
|
|
||||||
ActualName = ChatName
|
|
||||||
end,
|
end,
|
||||||
[LogName|_] = re:split(ActualName, "\\0\\0", [{return, binary}]),
|
[LogName|_] = re:split(Name, "\\0\\0", [{return, binary}]),
|
||||||
[TmpMessage|_] = re:split(ChatMessage, "\\0\\0", [{return, binary}]),
|
[TmpMessage|_] = re:split(Message, "\\0\\0", [{return, binary}]),
|
||||||
LogMessage = re:replace(TmpMessage, "\\n", " ", [global, {return, binary}]),
|
LogMessage = re:replace(TmpMessage, "\\n", " ", [global, {return, binary}]),
|
||||||
log(GID, "chat from ~s: ~s", [[re:replace(LogName, "\\0", "", [global, {return, binary}])], [re:replace(LogMessage, "\\0", "", [global, {return, binary}])]]),
|
log(GID, "chat from ~s: ~s", [[re:replace(LogName, "\\0", "", [global, {return, binary}])], [re:replace(LogMessage, "\\0", "", [global, {return, binary}])]]),
|
||||||
lists:foreach(fun(User) -> User#users.pid ! {psu_chat, GID, ActualName, ChatModifiers, ChatMessage} end, egs_db:users_select_all());
|
lists:foreach(fun(User) -> User#users.pid ! {psu_chat, GID, Name, Modifiers, Message} end, egs_db:users_select_all());
|
||||||
|
|
||||||
%% @todo Handle this packet. Ignore for now.
|
%% @todo Handle this packet. Ignore for now.
|
||||||
|
|
||||||
|
@ -119,18 +119,6 @@ packet_split(Packet, Result) ->
|
|||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% @doc Parse a chat command. AOTI v2.000 version of the command.
|
|
||||||
|
|
||||||
parse_chat(0, Packet) ->
|
|
||||||
<< _: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, Modifiers:128/bits, FromName:512/bits, Message/bits >> = Packet,
|
|
||||||
[{gid, FromGID}, {name, FromName}, {modifiers, Modifiers}, {message, Message}].
|
|
||||||
|
|
||||||
%% @doc Center the camera on the player, if possible.
|
%% @doc Center the camera on the player, if possible.
|
||||||
%% @todo Probably.
|
%% @todo Probably.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user