psu_game: Don't recreate a party on each NPC invite.

This commit is contained in:
Loïc Hoguin 2010-08-27 02:18:39 +02:00
parent b7d3c1634f
commit 8db82f8260

View File

@ -772,7 +772,12 @@ event({npc_invite, NPCid}) ->
TmpNPCUser = psu_npc:user_init(NPCid, ((User#egs_user_model.character)#characters.mainlevel)#level.number), TmpNPCUser = psu_npc:user_init(NPCid, ((User#egs_user_model.character)#characters.mainlevel)#level.number),
%% Create and join party. %% Create and join party.
%% @todo Check if party already exists. %% @todo Check if party already exists.
{ok, PartyPid} = psu_party:start_link(GID), case User#egs_user_model.partypid of
undefined ->
{ok, PartyPid} = psu_party:start_link(GID);
PartyPid ->
ignore
end,
{ok, PartyPos} = psu_party:join(PartyPid, npc, TmpNPCUser#egs_user_model.id), {ok, PartyPos} = psu_party:join(PartyPid, npc, TmpNPCUser#egs_user_model.id),
NPCUser = TmpNPCUser#egs_user_model{lid=PartyPos, partypid=PartyPid}, NPCUser = TmpNPCUser#egs_user_model{lid=PartyPos, partypid=PartyPid},
egs_user_model:write(NPCUser), egs_user_model:write(NPCUser),