diff --git a/src/psu/psu_game.erl b/src/psu/psu_game.erl index e059ec8..188a0e8 100644 --- a/src/psu/psu_game.erl +++ b/src/psu/psu_game.erl @@ -354,7 +354,7 @@ area_load(AreaType, IsStart, SetID, OldUser, User, QuestFile, ZoneFile, AreaName send_020f(ZoneFile, SetID, SeasonID); true -> ignore end, - send_0205(ZoneID, (User#egs_user_model.area)#psu_area.mapid, User#egs_user_model.entryid, IsSeasonal), + psu_proto:send_0205(User, IsSeasonal), send_100e(QuestID, ZoneID, (User#egs_user_model.area)#psu_area.mapid, AreaName, 16#ffffffff), if AreaType =:= mission -> send_0215(0), @@ -593,7 +593,7 @@ event({counter_enter, CounterID, FromZoneID, FromMapID, FromEntryID}) -> send_010d(User#egs_user_model{lid=0}), send_0200(mission), send_020f(ZoneFile, 0, 16#ff), - send_0205(0, 0, 0, 0), + psu_proto:send_0205(User, 0), send_100e(16#7fffffff, 0, 0, AreaName, CounterID), send_0215(0), send_0215(0), @@ -1171,12 +1171,6 @@ send_0204(PlayerGID, PlayerLID, Action) -> 16#00011300:32, GID:32/little-unsigned-integer, 0:64, PlayerGID:32/little-unsigned-integer, PlayerLID:32/little-unsigned-integer, Action:32/little-unsigned-integer >>). -%% @doc Send the map ID to be loaded by the client. -%% @todo Last two values are unknown. -send_0205(MapType, MapNumber, MapEntry, IsSeasonal) -> - send(<< 16#02050300:32, 0:288, 16#ffffffff:32, MapType:32/little-unsigned-integer, - MapNumber:32/little-unsigned-integer, MapEntry:32/little-unsigned-integer, 0:56, IsSeasonal >>). - %% @doc Indicate to the client that loading should finish. %% @todo Last value seems to be 2 most of the time. Never 0 though. Apparently counters have it at 4. send_0208() -> diff --git a/src/psu/psu_proto.erl b/src/psu/psu_proto.erl index 56de548..a809574 100644 --- a/src/psu/psu_proto.erl +++ b/src/psu/psu_proto.erl @@ -275,7 +275,7 @@ parse(_Size, 16#0304, Channel, Data) -> Modifiers = {chat_modifiers, ChatType, ChatCutIn, ChatCutInAngle, ChatMsgLength, ChatChannel, ChatCharacterType}, {chat, FromTypeID, FromGID, FromName, Modifiers, ChatMsg}; -%% @todo Probably safely ignored. Still, figure out VarJ. It's never 0 on official! +%% @todo Probably safely ignored. VarJ is apparently replied with the same value as sent by 0205, the one after EntryID. parse(Size, 16#0806, 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, VarJ:32/little >> = Data, @@ -290,7 +290,7 @@ parse(Size, 16#0806, Channel, Data) -> ?ASSERT_EQ(VarG, 0), ?ASSERT_EQ(VarH, 0), ?ASSERT_EQ(VarI, 0), - ?ASSERT_EQ(VarJ, 0), + ?ASSERT_EQ(VarJ, 1), ignore; parse(Size, 16#0807, Channel, Data) -> @@ -935,6 +935,19 @@ 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 Make the client load a new map. +%% @todo We set a value of 1 and not 0 after EntryID because this value is never found to be 0. +send_0205(DestUser, IsSeasonal) -> + #egs_user_model{socket=CSocket, id=GID, lid=LID, area=Area, entryid=EntryID} = DestUser, + #psu_area{zoneid=ZoneID, mapid=MapID} = Area, + packet_send(CSocket, << 16#02050300:32, LID:16/little, 0:144, 16#00011300:32, GID:32/little, 0:64, + 16#ffffffff:32, ZoneID:32/little, MapID:32/little, EntryID:32/little, 1:32/little, 0:24, IsSeasonal:8 >>). + +%% @todo Inventory related. Doesn't seem to do anything. +send_0a05(DestUser) -> + #egs_user_model{socket=CSocket, id=GID, lid=LID} = DestUser, + packet_send(CSocket, << 16#0a050300:32, LID:16/little, 0:144, 16#00011300:32, GID:32/little, 0:64 >>). + %% @doc Quest init. %% @todo When first entering a zone it seems LID should be set to ffff apparently. send_0c00(DestUser) -> @@ -946,11 +959,6 @@ send_0c00(DestUser) -> 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 Inventory related. Doesn't seem to do anything. -send_0a05(DestUser) -> - #egs_user_model{socket=CSocket, id=GID, lid=LID} = DestUser, - packet_send(CSocket, << 16#0a050300:32, LID:16/little, 0:144, 16#00011300:32, GID:32/little, 0:64 >>). -