diff --git a/src/psu/psu_game.erl b/src/psu/psu_game.erl index a84ff7b..28d2855 100644 --- a/src/psu/psu_game.erl +++ b/src/psu/psu_game.erl @@ -564,6 +564,12 @@ event({counter_enter, CounterID, FromZoneID, FromMapID, FromEntryID}) -> send_0208(), send_0236(); +%% @doc Leave mission counter handler. +event(counter_leave) -> + {ok, User} = egs_user_model:read(get(gid)), + PrevArea = User#egs_user_model.prev_area, + area_load(PrevArea#psu_area.questid, PrevArea#psu_area.zoneid, PrevArea#psu_area.mapid, User#egs_user_model.prev_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. @@ -746,12 +752,6 @@ handle(16#0404, Data) -> log("unknown command 0404: eventid ~b blockid ~b value ~b", [EventID, BlockID, Value]), send_1205(EventID, BlockID, Value); -%% @doc Leave mission counter handler. Lobby values depend on which counter was entered. -handle(16#0812, _) -> - {ok, User} = egs_user_model:read(get(gid)), - PrevArea = User#egs_user_model.prev_area, - area_load(PrevArea#psu_area.questid, PrevArea#psu_area.zoneid, PrevArea#psu_area.mapid, User#egs_user_model.prev_entryid); - %% @doc NPC invite. %% @todo Also happening a 1506 -> 1507? Only on first selection from menu. %% @todo Apparently Unknown is always ffffffff. diff --git a/src/psu/psu_proto.erl b/src/psu/psu_proto.erl index 828781c..1a29ad1 100644 --- a/src/psu/psu_proto.erl +++ b/src/psu/psu_proto.erl @@ -187,6 +187,21 @@ parse(Size, 16#0811, Channel, Data) -> ?ASSERT_EQ(VarK, 16#ffffffff), {counter_enter, CounterID, FromZoneID, FromMapID, FromEntryID}; +parse(Size, 16#0812, 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 >> = Data, + ?ASSERT_EQ(Size, 44), + ?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), + counter_leave; + parse(Size, 16#0b05, _Channel, _Data) -> ?ASSERT_EQ(Size, 8), ignore;