diff --git a/src/psu/psu_game.erl b/src/psu/psu_game.erl index 0d12dc0..870a76c 100644 --- a/src/psu/psu_game.erl +++ b/src/psu/psu_game.erl @@ -555,6 +555,12 @@ broadcast(Command, Orig) lists:foreach(fun(User) -> User#egs_user_model.pid ! {psu_broadcast, Packet} end, SpawnList) end. +%% @todo When changing lobby to the room, 0230 must also be sent. Same when going from room to lobby. +%% @todo Probably move area_load inside the event and make other events call this one when needed. +event({area_change, QuestID, ZoneID, MapID, EntryID}) -> + log("area change (~b,~b,~b,~b)", [QuestID, ZoneID, MapID, EntryID]), + area_load(QuestID, ZoneID, MapID, EntryID); + %% @todo A and B are unknown. %% Melee uses a format similar to: AAAA--BBCCCC----DDDDDDDDEE----FF with %% AAAA the attack sound effect, BB the range, CCCC and DDDDDDDD unknown but related to angular range or similar, EE number of targets and FF the model. @@ -737,15 +743,6 @@ handle(16#0404, Data) -> log("unknown command 0404: eventid ~b blockid ~b value ~b", [EventID, BlockID, Value]), send_1205(EventID, BlockID, Value); -%% @doc Map change handler. -%% Rooms are handled differently than normal lobbies. -%% @todo When changing lobby to the room, 0230 must also be sent. Same when going from room to lobby. -handle(16#0807, Data) -> - << QuestID:32/little-unsigned-integer, ZoneID:16/little-unsigned-integer, - MapID:16/little-unsigned-integer, EntryID:16/little-unsigned-integer, _/bits >> = Data, - log("map change (~b,~b,~b,~b)", [QuestID, ZoneID, MapID, EntryID]), - area_load(QuestID, ZoneID, MapID, EntryID); - %% @doc Mission counter handler. handle(16#0811, Data) -> << QuestID:32/little-unsigned-integer, ZoneID:16/little-unsigned-integer, diff --git a/src/psu/psu_proto.erl b/src/psu/psu_proto.erl index 04e079d..437b1d1 100644 --- a/src/psu/psu_proto.erl +++ b/src/psu/psu_proto.erl @@ -117,7 +117,7 @@ parse(Size, 16#0110, Channel, Data) -> end; parse(Size, 16#021d, Channel, Data) -> - << _LID:16/little, VarB:16/little, VarC:32/little, VarD:32/little, VarE:32/little, VarF:32/little, + << _LID:16/little, VarB:16/little, VarC:32/little, VarD:32/little, VarE:32/little, VarF:32/little, VarG:32/little, VarH:32/little, VarI:32/little, VarJ:32/little, _EntryID:32/little >> = Data, ?ASSERT_EQ(Size, 48), ?ASSERT_EQ(Channel, 2), @@ -133,7 +133,7 @@ parse(Size, 16#021d, Channel, Data) -> unicube_request; parse(Size, 16#021f, Channel, Data) -> - << _LID:16/little, VarB:16/little, VarC:32/little, VarD:32/little, VarE:32/little, VarF:32/little, + << _LID:16/little, VarB:16/little, VarC:32/little, VarD:32/little, VarE:32/little, VarF:32/little, VarG:32/little, VarH:32/little, VarI:32/little, VarJ:32/little, UniID:32/little, EntryID:32/little >> = Data, ?ASSERT_EQ(Size, 52), ?ASSERT_EQ(Channel, 2), @@ -152,6 +152,23 @@ parse(Size, 16#021f, Channel, Data) -> end, {unicube_select, Selection, EntryID}; +parse(Size, 16#0807, Channel, Data) -> + << _LID:16/little, VarA:16/little, VarB:32/little, VarC:32/little, VarD:32/little, VarE:32/little, VarF:32/little, VarG:32/little, VarH:32/little, VarI:32/little, + QuestID:32/little, ZoneID:16/little, MapID:16/little, EntryID:16/little, _AreaChangeNb:16/little, VarJ:32/little >> = Data, + ?ASSERT_EQ(Size, 60), + ?ASSERT_EQ(Channel, 2), + ?ASSERT_EQ(VarA, 0), + ?ASSERT_EQ(VarB, 0), + ?ASSERT_EQ(VarC, 0), + ?ASSERT_EQ(VarD, 0), + ?ASSERT_EQ(VarE, 0), + ?ASSERT_EQ(VarF, 0), + ?ASSERT_EQ(VarG, 0), + ?ASSERT_EQ(VarH, 0), + ?ASSERT_EQ(VarI, 0), + ?ASSERT_EQ(VarJ, 16#ffffffff), + {area_change, QuestID, ZoneID, MapID, EntryID}; + parse(Size, 16#0b05, _Channel, _Data) -> ?ASSERT_EQ(Size, 8), ignore;