Review send_0c00 and move it to psu_proto.

This commit is contained in:
Loïc Hoguin 2010-08-29 18:31:23 +02:00
parent b77e04acf8
commit 9fc62c8130
2 changed files with 21 additions and 10 deletions

View File

@ -334,7 +334,7 @@ area_load(AreaType, IsStart, SetID, OldUser, User, QuestFile, ZoneFile, AreaName
true -> ignore true -> ignore
end, end,
% load new quest % load new quest
send_0c00(QuestID), psu_proto:send_0c00(User),
send_020e(QuestFile); send_020e(QuestFile);
true -> ignore true -> ignore
end, end,
@ -587,7 +587,7 @@ event({counter_enter, CounterID, FromZoneID, FromMapID, FromEntryID}) ->
{ok, UnspawnList} = egs_user_model:select({neighbors, OldUser}), {ok, UnspawnList} = egs_user_model:select({neighbors, OldUser}),
lists:foreach(fun(Other) -> Other#egs_user_model.pid ! {psu_player_unspawn, User} end, UnspawnList), lists:foreach(fun(Other) -> Other#egs_user_model.pid ! {psu_player_unspawn, User} end, UnspawnList),
%% load counter %% load counter
send_0c00(16#7fffffff), psu_proto:send_0c00(User),
send_020e(QuestFile), send_020e(QuestFile),
send_0a05(), send_0a05(),
send_010d(User#egs_user_model{lid=0}), send_010d(User#egs_user_model{lid=0}),
@ -1326,14 +1326,6 @@ send_0a11(ItemID, ItemDesc) ->
UCS2Desc = << << X:8, 0:8 >> || X <- ItemDesc >>, UCS2Desc = << << X:8, 0:8 >> || X <- ItemDesc >>,
send(<< (header(16#0a11))/binary, ItemID:32/unsigned-integer, Size:32/little-unsigned-integer, UCS2Desc/binary, 0:16 >>). send(<< (header(16#0a11))/binary, ItemID:32/unsigned-integer, Size:32/little-unsigned-integer, UCS2Desc/binary, 0:16 >>).
%% @doc Init quest.
send_0c00(QuestID) ->
send(<< (header(16#0c00))/binary, QuestID:32/little-unsigned-integer,
16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32,
16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32,
16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32,
16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32 >>).
%% @todo Figure out last 4 bytes! %% @todo Figure out last 4 bytes!
send_0c02() -> send_0c02() ->
send(<< (header(16#0c02))/binary, 0:32 >>). send(<< (header(16#0c02))/binary, 0:32 >>).

View File

@ -20,6 +20,8 @@
-module(psu_proto). -module(psu_proto).
-compile(export_all). -compile(export_all).
-include("include/records.hrl").
%~ %% @todo We probably want to use active connections everywhere instead of doing this. %~ %% @todo We probably want to use active connections everywhere instead of doing this.
%~ recv %% remove later? %~ recv %% remove later?
@ -933,6 +935,23 @@ parse_hits(Hits, Acc) ->
%~ << D1:32, D2:32, D3:32, D4:32, D5:32 >> = D, %~ << D1:32, D2:32, D3:32, D4:32, D5:32 >> = D,
parse_hits(Rest, [{hit, FromTargetID, ToTargetID, A, B}|Acc]). parse_hits(Rest, [{hit, FromTargetID, ToTargetID, A, B}|Acc]).
%% @doc Quest init.
%% @todo When first entering a zone it seems LID should be set to ffff apparently.
send_0c00(DestUser) ->
#egs_user_model{socket=CSocket, id=GID, lid=LID, area=Area} = DestUser,
QuestID = Area#psu_area.questid,
packet_send(CSocket, << 16#0c000300:32, LID:16/little, 0:144, 16#00011300:32, GID:32/little, 0:64, QuestID:32/little,
16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32,
16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32,
16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32,
16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32 >>).
%% @doc Prepare a packet. Return the real size and padding at the end. %% @doc Prepare a packet. Return the real size and padding at the end.
packet_prepare(Packet) -> packet_prepare(Packet) ->