summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2018-01-24 13:06:30 +0100 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2018-01-24 13:06:30 +0100 |
commit | 99655bbe4ceefb48126d4c4f01950ac62d8bf050 (patch) | |
tree | f9fdb81dfc8d6250ba3b211fb5921507d276baed /src/reply | |
parent | bf751b384f9207226fc8b7ec662eac32d8bc81eb (diff) |
Now sends char attributes to client.
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} ] } ). |