summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2019-01-02 01:46:34 +0100
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2019-01-02 01:46:34 +0100
commit71c2f729208cecb039e2bd753a50b55c2788f2d0 (patch)
treea0905159ccb3cce53419dbe48457951245af9559 /src/bounty/bnt_grant_land.erl
parenta81ff643a823dde57ebd0ed5da8a91fb75d32267 (diff)
Bounties?
Somehow, Dialyzer does not see the type issues with src/bounty/bnt_join_battle.erl, but there are btl_character and rst_character mix-ups.
Diffstat (limited to 'src/bounty/bnt_grant_land.erl')
-rw-r--r--src/bounty/bnt_grant_land.erl58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/bounty/bnt_grant_land.erl b/src/bounty/bnt_grant_land.erl
new file mode 100644
index 0000000..1a8a62e
--- /dev/null
+++ b/src/bounty/bnt_grant_land.erl
@@ -0,0 +1,58 @@
+-module(bnt_grant_land).
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+-export([attempt/1]).
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+-spec attempt (ataxia_id:type()) -> map_map:type().
+attempt (OwnerID) ->
+ Map = map_map:default(OwnerID),
+
+ {ok, MapID} =
+ ataxia_client:add
+ (
+ map_db,
+ ataxia_security:allow_only(ataxia_security:any()),
+ ataxia_security:allow_only(ataxia_security:user_from_id(OwnerID)),
+ Map
+ ),
+
+ MapSummary = shr_map_summary:new(MapID, <<"Untitled Map">>),
+
+ PlayerUpdateQueryOp =
+ ataxic:update_value
+ (
+ ataxic:update_field
+ (
+ shr_player:get_map_summaries_field(),
+ ataxic:apply_function
+ (
+ lists,
+ append,
+ [ataxic:constant([MapSummary]), ataxic:current_value()]
+ )
+ )
+ ),
+
+ ok =
+ ataxia_client:update
+ (
+ player_db,
+ ataxia_security:admin(),
+ PlayerUpdateQueryOp,
+ OwnerID
+ ),
+
+ Map.