summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2018-10-09 19:34:02 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2018-10-09 19:34:02 +0200
commit169d7ff927917f2b0bf4cc6349a483f1031960fc (patch)
tree30b1a9624c5f0f0f7ca67ebccf19dde3a3cd19b7 /src/roster/struct
parent80cf57bc91d25a043ed8c1de557ebe1ccbe17022 (diff)
(Broken) glyphs lists, not arrays...
Diffstat (limited to 'src/roster/struct')
-rw-r--r--src/roster/struct/rst_character.erl31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/roster/struct/rst_character.erl b/src/roster/struct/rst_character.erl
index afe370d..2a159e4 100644
--- a/src/roster/struct/rst_character.erl
+++ b/src/roster/struct/rst_character.erl
@@ -11,7 +11,7 @@
portrait_id :: shr_portrait:id(),
weapon_ids :: {shr_weapon:id(), shr_weapon:id()},
armor_id :: shr_armor:id(),
- glyph_ids :: array:array(shr_glyph:id()),
+ glyph_ids :: list(shr_glyph:id()),
glyph_board_id :: shr_glyph_board:id()
}
).
@@ -53,7 +53,7 @@
(
[
decode/1,
- random/0
+ new/0
]
).
@@ -92,7 +92,7 @@ validate_armor (_Inventory, _Armor) ->
% TODO [SECURITY][LOW]: unimplemented
ok.
--spec validate_glyphs (shr_inventory:type(), array:array(shr_glyph:id())) -> ok.
+-spec validate_glyphs (shr_inventory:type(), list(shr_glyph:id())) -> ok.
validate_glyphs (_Inventory, _Glyphs) ->
% TODO [SECURITY][LOW]: unimplemented
ok.
@@ -104,7 +104,7 @@ validate_glyph_board (_Inventory, _GlyphBoard) ->
-spec validate_glyphs_on_board
(
- array:array(shr_glyph:id()),
+ list(shr_glyph:id()),
shr_glyph_board:id()
)
-> ok.
@@ -128,7 +128,7 @@ get_weapon_ids (Char) -> Char#character.weapon_ids.
-spec get_armor_id (type()) -> shr_armor:id().
get_armor_id (Char) -> Char#character.armor_id.
--spec get_glyph_ids (type()) -> array:array(shr_glyph:id()).
+-spec get_glyph_ids (type()) -> list(shr_glyph:id()).
get_glyph_ids (Char) -> Char#character.glyph_ids.
-spec get_glyph_board_id (type()) -> shr_glyph_board:id().
@@ -163,7 +163,7 @@ set_weapon_ids (WeaponIDs, Char) ->
weapon_ids = WeaponIDs
}.
--spec set_glyph_ids (array:array(shr_glyph:id()), type()) -> type().
+-spec set_glyph_ids (list(shr_glyph:id()), type()) -> type().
set_glyph_ids (GlyphIDs, Char) ->
Char#character
{
@@ -177,16 +177,17 @@ set_glyph_board_id (GlyphBoardID, Char) ->
glyph_board_id = GlyphBoardID
}.
--spec random () -> type().
-random () ->
+-spec new () -> type().
+new () ->
+ UnarmedID = shr_weapon:get_id(shr_weapon:none()),
#character
{
- name = <<"">>,
- portrait_id = <<"0">>,
- weapon_ids = {0, 0},
- armor_id = 0,
- glyph_ids = array:new(),
- glyph_board_id = <<"0">>
+ name = <<"Nameless">>,
+ portrait_id = shr_portrait:get_id(shr_portrait:default()),
+ weapon_ids = {UnarmedID, UnarmedID},
+ armor_id = shr_armor:get_id(shr_armor:none()),
+ glyph_ids = [],
+ glyph_board_id = shr_glyph_board:get_id(shr_glyph_board:none())
}.
-spec get_name_field () -> non_neg_integer().
@@ -218,7 +219,7 @@ decode (JSONReqMap) ->
portrait_id = Portrait,
weapon_ids = {ActiveWeapon, SecondaryWeapon},
armor_id = Armor,
- glyph_ids = array:from_list(GlyphsList),
+ glyph_ids = GlyphsList,
glyph_board_id = GlyphBoard
}.