summaryrefslogtreecommitdiff
blob: 0e9d0afccc36ab114ed5879e309dd22dd06680ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
-module(battlemap_character).
-export([encode_in_json/1]).

encode_in_json (
   {
      ID,
      Name,
      Icon,
      Portrait,
      {X, Y},
      Team,
      MovementPoints,
      AttackRange
   }
) ->
   jiffy:encode(
      {
         [
            {<<"id">>, ID},
            {<<"name">>, Name},
            {<<"icon">>, Icon},
            {<<"portrait">>, Portrait},
            {<<"loc_x">>, X},
            {<<"loc_y">>, Y},
            {<<"team">>, Team},
            {<<"mov_pts">>, MovementPoints},
            {<<"atk_rg">>, AttackRange}
         ]
      }
   ).