diff --git a/src/psu/psu_game.erl b/src/psu/psu_game.erl index a664118..c4f2915 100644 --- a/src/psu/psu_game.erl +++ b/src/psu/psu_game.erl @@ -334,7 +334,7 @@ area_load(AreaType, IsStart, SetID, OldUser, User, QuestFile, ZoneFile, AreaName true -> ignore end, % load new quest - send_0c00(QuestID), + psu_proto:send_0c00(User), send_020e(QuestFile); true -> ignore end, @@ -587,7 +587,7 @@ event({counter_enter, CounterID, FromZoneID, FromMapID, FromEntryID}) -> {ok, UnspawnList} = egs_user_model:select({neighbors, OldUser}), lists:foreach(fun(Other) -> Other#egs_user_model.pid ! {psu_player_unspawn, User} end, UnspawnList), %% load counter - send_0c00(16#7fffffff), + psu_proto:send_0c00(User), send_020e(QuestFile), send_0a05(), send_010d(User#egs_user_model{lid=0}), @@ -1326,14 +1326,6 @@ send_0a11(ItemID, 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 >>). -%% @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! send_0c02() -> send(<< (header(16#0c02))/binary, 0:32 >>). diff --git a/src/psu/psu_proto.erl b/src/psu/psu_proto.erl index 389b89a..8cc63bf 100644 --- a/src/psu/psu_proto.erl +++ b/src/psu/psu_proto.erl @@ -20,6 +20,8 @@ -module(psu_proto). -compile(export_all). +-include("include/records.hrl"). + %~ %% @todo We probably want to use active connections everywhere instead of doing this. %~ recv %% remove later? @@ -933,6 +935,23 @@ parse_hits(Hits, Acc) -> %~ << D1:32, D2:32, D3:32, D4:32, D5:32 >> = D, 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. packet_prepare(Packet) ->