summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2018-09-04 18:38:21 +0200 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2018-09-04 18:38:21 +0200 |
commit | 324416df92a5192be02e9a1285a623c37c01ef77 (patch) | |
tree | 640d345040c12cc72de76c3c092bad9c74c88d46 /src/login | |
parent | 08a3d1e624d9fc935c81cb7c2d07d7daacfbbba9 (diff) |
Updates the "random" player generation.
Diffstat (limited to 'src/login')
-rw-r--r-- | src/login/lgn_shim.erl | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/src/login/lgn_shim.erl b/src/login/lgn_shim.erl index 53d95ee..5231a31 100644 --- a/src/login/lgn_shim.erl +++ b/src/login/lgn_shim.erl @@ -12,6 +12,35 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-spec add_ref_to_event + ( + binary(), + binary(), + boolean(), + shr_player:type() + ) + -> shr_player:type(). +add_ref_to_event (BattleID, EventName, IsPlayersTurn, Player) -> + Event = + shr_battle_summary:new(BattleID, EventName, <<"Never">>, IsPlayersTurn), + + Result = shr_player:set_event_summaries(array:from_list([Event]), Player), + + Result. + +-spec add_ref_to_map + ( + binary(), + binary(), + shr_player:type() + ) + -> shr_player:type(). +add_ref_to_map (MapID, EventName, Player) -> + MapRef = shr_map_summary:new(MapID, EventName), + + Result = shr_player:set_map_summaries(array:from_list([MapRef]), Player), + + Result. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -27,4 +56,22 @@ generate_random_player (ID, Username, Password, Email) -> Result = shr_player:new(ID, Username, Password, Email), - Result. + S0Result = + case ID of + <<"0">> -> + S0 = add_ref_to_event(<<"0">>, <<"Test Battle">>, true, Result), + S1 = shr_player:set_roster_id(<<"0">>, S0), + S2 = add_ref_to_map(<<"0">>, <<"Test Map 0">>, S1), + S2; + + <<"1">> -> + S0 = add_ref_to_event(<<"0">>, <<"Test Battle">>, false, Result), + S1 = shr_player:set_roster_id(<<"1">>, S0), + S2 = add_ref_to_map(<<"1">>, <<"Test Map 1">>, S1), + + S2; + + _ -> Result + end, + + S0Result. |