summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2017-11-20 17:25:37 +0100
committernsensfel <SpamShield0@noot-noot.org>2017-11-20 17:25:37 +0100
commitb984be19b36226b02cb2d58d8597d2cff4be1eaf (patch)
tree96493a00a29ec934297acf073ee431bf6174f1e8 /www/handler/battlemap/load_state.yaws
parentc3c8f24ebde2370d8314b1f0e571a26fbcff9450 (diff)
Trying to get character turns to register.
Diffstat (limited to 'www/handler/battlemap/load_state.yaws')
-rw-r--r--www/handler/battlemap/load_state.yaws8
1 files changed, 7 insertions, 1 deletions
diff --git a/www/handler/battlemap/load_state.yaws b/www/handler/battlemap/load_state.yaws
index b5a7fc7..d68c6a4 100644
--- a/www/handler/battlemap/load_state.yaws
+++ b/www/handler/battlemap/load_state.yaws
@@ -1,5 +1,5 @@
<erl>
--record(input, {player_id, battlemap_id, instance_id}).
+-record(input, {session_token, player_id, battlemap_id, instance_id}).
-include("/tmp/timed_cache_data.hrl").
@@ -7,6 +7,7 @@ parse_input (Req) ->
JSONReqMap = jiffy:decode(Req, [return_maps]),
#input
{
+ session_token = maps:get(<<"session_token">>, JSONReqMap),
player_id = maps:get(<<"player_id">>, JSONReqMap),
battlemap_id = maps:get(<<"battlemap_id">>, JSONReqMap),
instance_id = maps:get(<<"instance_id">>, JSONReqMap)
@@ -65,7 +66,9 @@ generate_reply (Battlemap, _BattlemapInstance, Characters) ->
).
handle (Req) ->
+ %%%% Parse
Input = parse_input(Req),
+ %%%% Fetch
Battlemap = timed_cache:fetch(battlemap_db, Input#input.battlemap_id),
BattlemapInstance =
timed_cache:fetch
@@ -85,6 +88,9 @@ handle (Req) ->
end,
dict:to_list(BattlemapInstance#battlemap_instance.chars)
),
+ %%%% Calc
+ %%%% Commit
+ %%%% Reply
generate_reply(Battlemap, BattlemapInstance, Characters).
out(A) ->