Create the user at character selection rather than login.
This commit is contained in:
parent
b728731830
commit
2de4359c32
@ -66,7 +66,6 @@ event({char_select_create, Slot, CharBin}, #state{gid=GID}) ->
|
||||
|
||||
%% @doc Load the selected character into the game's default universe.
|
||||
event({char_select_enter, Slot, _BackToPreviousField}, State=#state{gid=GID}) ->
|
||||
{ok, User} = egs_users:read(GID),
|
||||
Folder = egs_accounts:get_folder(GID),
|
||||
[{status, 1}, {char, CharBin}, {options, OptionsBin}] = data_load(Folder, Slot),
|
||||
<< Name:512/bits, RaceBin:8, GenderBin:8, ClassBin:8, AppearanceBin:776/bits, _/bits >> = CharBin,
|
||||
@ -78,8 +77,8 @@ event({char_select_enter, Slot, _BackToPreviousField}, State=#state{gid=GID}) ->
|
||||
Character = #characters{slot=Slot, name=Name, race=Race, gender=Gender, class=Class, appearance=Appearance, options=Options}, % TODO: temporary set the slot here, won't be needed later
|
||||
UniID = egs_universes:defaultid(),
|
||||
egs_universes:enter(UniID),
|
||||
User2 = User#users{uni=UniID, character=Character, area={1100000, 0, 4}, entryid=0},
|
||||
egs_users:write(User2),
|
||||
User = #users{gid=GID, pid=self(), uni=UniID, character=Character, area={1100000, 0, 4}, entryid=0},
|
||||
egs_users:write(User),
|
||||
egs_users:item_add(GID, 16#11010000, #psu_special_item_variables{}),
|
||||
egs_users:item_add(GID, 16#11020000, #psu_special_item_variables{}),
|
||||
egs_users:item_add(GID, 16#11020100, #psu_special_item_variables{}),
|
||||
@ -87,9 +86,9 @@ event({char_select_enter, Slot, _BackToPreviousField}, State=#state{gid=GID}) ->
|
||||
egs_users:item_add(GID, 16#01010900, #psu_striking_weapon_item_variables{current_pp=99, max_pp=100, element=#psu_element{type=1, percent=50}}),
|
||||
egs_users:item_add(GID, 16#01010a00, #psu_striking_weapon_item_variables{current_pp=99, max_pp=100, element=#psu_element{type=2, percent=50}}),
|
||||
egs_users:item_add(GID, 16#01010b00, #psu_striking_weapon_item_variables{current_pp=99, max_pp=100, element=#psu_element{type=3, percent=50}}),
|
||||
{ok, User3} = egs_users:read(GID),
|
||||
{ok, User2} = egs_users:read(GID),
|
||||
State2 = State#state{slot=Slot},
|
||||
psu_game:char_load(User3, State2),
|
||||
psu_game:char_load(User2, State2),
|
||||
{ok, egs_game, State2}.
|
||||
|
||||
%% Internal.
|
||||
|
@ -66,7 +66,6 @@ event(system_game_server_request, State=#state{socket=Socket}) ->
|
||||
%% @todo Remove the put calls when all the send_xxxx are moved out of psu_game and into psu_proto.
|
||||
event({system_key_auth_request, AuthGID, AuthKey}, State=#state{socket=Socket}) ->
|
||||
egs_accounts:key_auth(AuthGID, AuthKey),
|
||||
egs_users:write(#users{gid=AuthGID, pid=self()}),
|
||||
put(socket, Socket),
|
||||
put(gid, AuthGID),
|
||||
State2 = State#state{gid=AuthGID},
|
||||
|
Loading…
Reference in New Issue
Block a user