From 3ccea942cd5609a8067b4f6656c657f4cc316053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 2 Jul 2010 02:43:10 +0200 Subject: [PATCH] characters: add TNL. game: add 010d command. --- src/egs_game.erl | 16 ++++++++++++++-- src/psu_characters.erl | 4 +++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/egs_game.erl b/src/egs_game.erl index 4477540..084f441 100644 --- a/src/egs_game.erl +++ b/src/egs_game.erl @@ -265,7 +265,7 @@ counter_load(QuestID, ZoneID, MapID, EntryID) -> send_0c00(16#7fffffff), send_020e(QuestFile), send_0a05(), - % 010d + send_010d(User), send_0200(mission), send_020f(ZoneFile, 0, 16#ff), send_0205(0, 0, 0, 0), @@ -390,7 +390,7 @@ area_load(AreaType, IsStart, OldUser, User, QuestFile, ZoneFile, AreaName) -> send_0111(); true -> ignore end, - % 010d + send_010d(User), send_0200(AreaType), Layout = if IsStart =:= true -> crypto:rand_uniform(0, 4); true -> 0 @@ -981,6 +981,18 @@ header(Command) -> send(Packet) -> egs_proto:packet_send(get(socket), Packet). +%% @todo Figure out what this does compared to 0201(self). +%% @todo Figure out the unknown values. +%% @todo Probably don't pattern match the data like this... + +send_010d(User) -> + GID = get(gid), + CharGID = User#users.gid, + << _:640, CharBin/bits >> = psu_characters:character_user_to_binary(User#users{lid=0}), + send(<< 16#010d0300:32, 0:160, 16#00011300:32, GID:32/little-unsigned-integer, 0:64, + 1:32/little-unsigned-integer, 0:32, 16#00000300:32, 16#ffff0000:32, 0:32, CharGID:32/little-unsigned-integer, + 0:192, CharGID:32/little-unsigned-integer, 0:32, 16#ffffffff:32, CharBin/binary >>). + %% @todo Possibly related to 010d. Just send seemingly safe values. send_0111() -> diff --git a/src/psu_characters.erl b/src/psu_characters.erl index add8a86..aa3ae25 100644 --- a/src/psu_characters.erl +++ b/src/psu_characters.erl @@ -54,10 +54,12 @@ character_user_to_binary(User) -> CharBin = psu_characters:character_tuple_to_binary(Character), StatsBin = psu_characters:stats_tuple_to_binary(Stats), SEBin = psu_characters:se_list_to_binary(SE), + TNL = 1000000, << 16#00001200:32, CharGID:32/little-unsigned-integer, 0:64, CharLID:32/little-unsigned-integer, 0:32, QuestID:32/little-unsigned-integer, ZoneID:32/little-unsigned-integer, MapID:32/little-unsigned-integer, EntryID:32/little-unsigned-integer, 0:192, QuestID:32/little-unsigned-integer, ZoneID:32/little-unsigned-integer, MapID:32/little-unsigned-integer, EntryID:32/little-unsigned-integer, CharBin/binary, - 0:96, StatsBin/binary, 0:32, SEBin/binary, 0:64, StatsBin/binary, CurrentHP:32/little-unsigned-integer, MaxHP:32/little-unsigned-integer, 0:2304 >>. + TNL:32/little-unsigned-integer, 0:32, MaxHP:32/little-unsigned-integer, % not sure if this one is current or max + StatsBin/binary, 0:32, SEBin/binary, 0:64, StatsBin/binary, CurrentHP:32/little-unsigned-integer, MaxHP:32/little-unsigned-integer, 0:2304 >>. %% @doc Convert a class atom into a binary to be sent to clients.