diff --git a/src/egs_game.erl b/src/egs_game.erl index ec55f52..3d721e2 100644 --- a/src/egs_game.erl +++ b/src/egs_game.erl @@ -281,7 +281,7 @@ event({counter_enter, CounterID, FromZoneID, FromMapID, FromEntryID}, State=#sta psu_game:send_1206(), psu_game:send_1207(), psu_game:send_1212(), - psu_proto:send_0201(User, User#egs_user_model{lid=0}), + psu_proto:send_0201(User#egs_user_model{lid=0}, State), psu_game:send_0a06(), case User#egs_user_model.partypid of undefined -> ignore; @@ -472,7 +472,7 @@ event({npc_force_invite, NPCid}, State=#state{gid=GID}) -> SentNPCCharacter = Character#characters{gid=NPCid, npcid=NPCid}, SentNPCUser = NPCUser#egs_user_model{character=SentNPCCharacter}, psu_proto:send_010d(SentNPCUser, State), - psu_proto:send_0201(User, SentNPCUser), + psu_proto:send_0201(SentNPCUser, State), psu_proto:send_0215(User, 0), psu_game:send_0a04(SentNPCUser#egs_user_model.id), psu_game:send_022c(0, 16#12), diff --git a/src/psu/psu_game.erl b/src/psu/psu_game.erl index 66f8899..39dfee1 100644 --- a/src/psu/psu_game.erl +++ b/src/psu/psu_game.erl @@ -200,7 +200,7 @@ area_load(AreaType, IsStart, SetID, OldUser, User, QuestFile, ZoneFile, AreaName send_1309(); true -> ignore end, - psu_proto:send_0201(User, User#egs_user_model{lid=0}), + psu_proto:send_0201(User#egs_user_model{lid=0}, State), if ZoneChange =:= true -> send_0a06(); true -> ignore @@ -230,7 +230,7 @@ npc_load(Leader, [{PartyPos, NPCGID}|NPCList]) -> %~ OldNPCUser#egs_user_model{lid=PartyPos, instancepid=undefined, areatype=AreaType, area={psu_area, 0, 0, 0}, entryid=0, pos={pos, 0.0, 0.0, 0.0, 0}} egs_user_model:write(NPCUser), psu_proto:send_010d(NPCUser, State), - psu_proto:send_0201(Leader, NPCUser), + psu_proto:send_0201(NPCUser, State), psu_proto:send_0215(Leader, 0), send_0a04(NPCUser#egs_user_model.id), send_1004(npc_mission, NPCUser, PartyPos), diff --git a/src/psu/psu_proto.erl b/src/psu/psu_proto.erl index 4c4ea1b..e33eac0 100644 --- a/src/psu/psu_proto.erl +++ b/src/psu/psu_proto.erl @@ -1179,8 +1179,8 @@ send_010d(CharUser, State) -> 0:192, CharGID:32/little-unsigned-integer, CharLID:32/little-unsigned-integer, 16#ffffffff:32, CharBin/binary >>). %% @doc Send character location, appearance and other information. -send_0201(DestUser, CharUser) -> - DestGID = DestUser#egs_user_model.id, +send_0201(CharUser, State) -> + DestGID = State#state.gid, [CharTypeID, GameVersion] = case (CharUser#egs_user_model.character)#characters.type of npc -> [16#00001d00, 255]; _ -> [16#00001200, 0] @@ -1189,7 +1189,7 @@ send_0201(DestUser, CharUser) -> CharBin = psu_characters:character_user_to_binary(CharUser), IsGM = 0, OnlineStatus = 0, - packet_send(DestUser#egs_user_model.socket, << 16#02010300:32, 0:32, CharTypeID:32, CharGID:32/little-unsigned-integer, + packet_send(State#state.socket, << 16#02010300:32, 0:32, CharTypeID:32, CharGID:32/little-unsigned-integer, 0:64, 16#00011300:32, DestGID:32/little-unsigned-integer, 0:64, CharBin/binary, IsGM:8, 0:8, OnlineStatus:8, GameVersion:8, 0:608 >>). %% @doc Hello command. Sent when a client connects to the game or login server.