summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-06-06 16:42:42 +0200
committernsensfel <SpamShield0@noot-noot.org>2018-06-06 16:42:42 +0200
commit82081d45fd64294f4bc417085e06284f3487b32f (patch)
tree1da77dd39829f8bfdcbf200df6a12a0a53edf661 /src/battlemap/reply/add_char.erl
parentee9c2ac044cc77b80f30420c8f0788cad4281084 (diff)
...
Diffstat (limited to 'src/battlemap/reply/add_char.erl')
-rw-r--r--src/battlemap/reply/add_char.erl78
1 files changed, 0 insertions, 78 deletions
diff --git a/src/battlemap/reply/add_char.erl b/src/battlemap/reply/add_char.erl
deleted file mode 100644
index 86b1e9c..0000000
--- a/src/battlemap/reply/add_char.erl
+++ /dev/null
@@ -1,78 +0,0 @@
--module(add_char).
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--export([generate/3]).
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--spec attributes_as_json
- (
- attributes:type()
- ) ->
- {list({binary(), non_neg_integer()})}.
-attributes_as_json (Attributes) ->
- {
- [
- {<<"con">>, attributes:get_constitution(Attributes)},
- {<<"dex">>, attributes:get_dexterity(Attributes)},
- {<<"int">>, attributes:get_intelligence(Attributes)},
- {<<"min">>, attributes:get_mind(Attributes)},
- {<<"spe">>, attributes:get_speed(Attributes)},
- {<<"str">>, attributes:get_strength(Attributes)}
- ]
- }.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--spec generate
- (
- non_neg_integer(),
- character:type(),
- player:id()
- )
- -> {list(any())}.
-generate (IX, Character, PlayerID) ->
- IsAlive = character:get_is_alive(Character),
- Attributes = character:get_attributes(Character),
- {ActiveWeapon, SecondaryWeapon} = character:get_weapon_ids(Character),
- OwnerID = character:get_owner_id(Character),
- Location =
- case IsAlive of
- true -> character:get_location(Character);
- _ -> location:get_nowhere()
- end,
-
- {
- [
- {<<"msg">>, <<"add_char">>},
- {<<"ix">>, IX},
- {<<"nam">>, character:get_name(Character)},
- {<<"ico">>, character:get_icon(Character)},
- {<<"prt">>, character:get_portrait(Character)},
- {
- <<"hea">>,
- character:get_current_health(Character)
- },
- {<<"lc">>, location:encode(Location)},
- {<<"pla">>, OwnerID},
- {
- <<"ena">>,
- (
- character:get_is_active(Character)
- and
- (OwnerID == PlayerID)
- )
- },
- {<<"att">>, attributes_as_json(Attributes)},
- {<<"awp">>, ActiveWeapon},
- {<<"swp">>, SecondaryWeapon}
- ]
- }.