summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/special')
-rw-r--r-- | src/special/spe_map.erl | 52 | ||||
-rw-r--r-- | src/special/spe_player.erl | 4 |
2 files changed, 54 insertions, 2 deletions
diff --git a/src/special/spe_map.erl b/src/special/spe_map.erl new file mode 100644 index 0000000..f12b0aa --- /dev/null +++ b/src/special/spe_map.erl @@ -0,0 +1,52 @@ +-module(spe_map). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-export([generate/1]). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-spec generate (binary()) -> map_map:type(). +generate (OwnerID) -> + Map = map_map:default(OwnerID), + + {ok, MapID} = + shr_database:insert + ( + map_db, + any, + [{user, OwnerID}], + Map + ), + + MapSummary = shr_map_summary:new(<<"Untitled Map">>, MapID), + + PlayerUpdateQueryOps = + [ + %% FIXME: shr_db_query:add_to_field handles lists, + %% shr_player:get_map_summaries_field() points to an array. + shr_db_query:add_to_field + ( + shr_player:get_map_summaries_field(), + [MapSummary], + false + ) + ], + + ok = + shr_database:commit + ( + shr_db_query:new(player_db, OwnerID, admin, PlayerUpdateQueryOps) + ), + + Map. diff --git a/src/special/spe_player.erl b/src/special/spe_player.erl index 6f0eebc..a74f53a 100644 --- a/src/special/spe_player.erl +++ b/src/special/spe_player.erl @@ -52,7 +52,7 @@ generate_inventory (PlayerID) -> shr_database:insert ( inventory_db, - [{user, PlayerID}], + any, [{user, PlayerID}], Inventory ), @@ -66,7 +66,7 @@ generate_roster (PlayerID) -> shr_database:insert ( roster_db, - [{user, PlayerID}], + any, [{user, PlayerID}], Roster ), |