summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/reply')
-rw-r--r-- | src/reply/add_char.erl | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/reply/add_char.erl b/src/reply/add_char.erl index 99b1d25..c730c24 100644 --- a/src/reply/add_char.erl +++ b/src/reply/add_char.erl @@ -12,9 +12,21 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +attributes_as_json (Atts) -> + { + [ + {<<"con">>, attributes:get_constitution(Atts)}, + {<<"dex">>, attributes:get_dexterity(Atts)}, + {<<"int">>, attributes:get_intelligence(Atts)}, + {<<"min">>, attributes:get_mind(Atts)}, + {<<"spe">>, attributes:get_speed(Atts)}, + {<<"str">>, attributes:get_strength(Atts)} + ] + }. + encode (Char, CharInstance, IsEnabled) -> {X, Y} = character_instance:get_location(CharInstance), - Stats = character_instance:get_statistics(CharInstance), + Atts = character:get_attributes(Char), ActWeapon = character_instance:get_active_weapon(CharInstance, Char), {_MinRg, MaxRg} = weapon:get_ranges(ActWeapon), jiffy:encode @@ -29,10 +41,9 @@ encode (Char, CharInstance, IsEnabled) -> {<<"loc_x">>, X}, {<<"loc_y">>, Y}, {<<"team">>, character_instance:get_owner(CharInstance)}, - {<<"max_health">>, statistics:get_health(Stats)}, - {<<"mov_pts">>, statistics:get_movement_points(Stats)}, - {<<"atk_rg">>, MaxRg}, - {<<"enabled">>, IsEnabled} + {<<"enabled">>, IsEnabled}, + {<<"att">>, attributes_as_json(Atts)}, + {<<"atk_rg">>, MaxRg} ] } ). |