summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/shared/struct/inventory/shr_equipment.erl')
-rw-r--r-- | src/shared/struct/inventory/shr_equipment.erl | 201 |
1 files changed, 198 insertions, 3 deletions
diff --git a/src/shared/struct/inventory/shr_equipment.erl b/src/shared/struct/inventory/shr_equipment.erl index f5eba8f..e505d91 100644 --- a/src/shared/struct/inventory/shr_equipment.erl +++ b/src/shared/struct/inventory/shr_equipment.erl @@ -56,6 +56,13 @@ set_glyph_board/2, set_glyphs/2, + ataxia_set_primary_weapon/2, + ataxia_set_secondary_weapon/2, + ataxia_set_armor/2, + ataxia_set_portrait/2, + ataxia_set_glyph_board/2, + ataxia_set_glyphs/2, + get_primary_weapon_id/1, get_secondary_weapon_id/1, get_armor_id/1, @@ -68,16 +75,30 @@ set_armor_id/2, set_portrait_id/2, set_glyph_board_id/2, - set_glyph_ids/2 + set_glyph_ids/2, + + ataxia_set_primary_weapon_id/2, + ataxia_set_secondary_weapon_id/2, + ataxia_set_armor_id/2, + ataxia_set_portrait_id/2, + ataxia_set_glyph_board_id/2, + ataxia_set_glyph_ids/2 ] ). -%%%% Accessors +%%%% -export ( [ default/0, - default_unresolved/0 + default_unresolved/0, + + get_primary_weapon_field/0, + get_secondary_weapon_field/0, + get_armor_field/0, + get_portrait_field/0, + get_glyph_board_field/0, + get_glyphs_field/0 ] ). @@ -144,6 +165,19 @@ set_primary_weapon (V, Eq) when is_record(Eq, shr_eq) -> set_primary_weapon (V, Eq) when is_record(Eq, shr_eq_ref) -> Eq#shr_eq_ref{ primary = shr_weapon:get_id(V) }. +-spec ataxia_set_primary_weapon + (shr_weapon:type(), type()) -> {type(), ataxic:basic()}; + (shr_weapon:type(), unresolved()) -> {unresolved(), ataxic:basic()}. +ataxia_set_primary_weapon (V, Eq) -> + { + set_primary_weapon(V, Eq), + ataxic:update_field + ( + get_primary_weapon_field(), + ataxic:constant(shr_weapon:get_id(V)) + ) + }. + -spec set_secondary_weapon (shr_weapon:type(), type()) -> type(); (shr_weapon:type(), unresolved()) -> unresolved(). @@ -152,6 +186,19 @@ set_secondary_weapon (V, Eq) when is_record(Eq, shr_eq) -> set_secondary_weapon (V, Eq) when is_record(Eq, shr_eq_ref) -> Eq#shr_eq_ref{ secondary = shr_weapon:get_id(V) }. +-spec ataxia_set_secondary_weapon + (shr_weapon:type(), type()) -> {type(), ataxic:basic()}; + (shr_weapon:type(), unresolved()) -> {unresolved(), ataxic:basic()}. +ataxia_set_secondary_weapon (V, Eq) -> + { + set_secondary_weapon(V, Eq), + ataxic:update_field + ( + get_secondary_weapon_field(), + ataxic:constant(shr_weapon:get_id(V)) + ) + }. + -spec set_armor (shr_armor:type(), type()) -> type(); (shr_armor:type(), unresolved()) -> unresolved(). @@ -160,6 +207,19 @@ set_armor (V, Eq) when is_record(Eq, shr_eq) -> set_armor (V, Eq) when is_record(Eq, shr_eq_ref) -> Eq#shr_eq_ref{ armor = shr_armor:get_id(V) }. +-spec ataxia_set_armor + (shr_armor:type(), type()) -> {type(), ataxic:basic()}; + (shr_armor:type(), unresolved()) -> {unresolved(), ataxic:basic()}. +ataxia_set_armor (V, Eq) -> + { + set_armor(V, Eq), + ataxic:update_field + ( + get_armor_field(), + ataxic:constant(shr_armor:get_id(V)) + ) + }. + -spec set_portrait (shr_portrait:type(), type()) -> type(); (shr_portrait:type(), unresolved()) -> unresolved(). @@ -168,6 +228,19 @@ set_portrait (V, Eq) when is_record(Eq, shr_eq) -> set_portrait (V, Eq) when is_record(Eq, shr_eq_ref) -> Eq#shr_eq_ref{ portrait = shr_portrait:get_id(V) }. +-spec ataxia_set_portrait + (shr_portrait:type(), type()) -> {type(), ataxic:basic()}; + (shr_portrait:type(), unresolved()) -> {unresolved(), ataxic:basic()}. +ataxia_set_portrait (V, Eq) -> + { + set_portrait(V, Eq), + ataxic:update_field + ( + get_portrait_field(), + ataxic:constant(shr_portrait:get_id(V)) + ) + }. + -spec set_glyph_board (shr_glyph_board:type(), type()) -> type(); (shr_glyph_board:type(), unresolved()) -> unresolved(). @@ -176,6 +249,19 @@ set_glyph_board (V, Eq) when is_record(Eq, shr_eq) -> set_glyph_board (V, Eq) when is_record(Eq, shr_eq_ref) -> Eq#shr_eq_ref{ glyph_board = shr_glyph_board:get_id(V) }. +-spec ataxia_set_glyph_board + (shr_glyph_board:type(), type()) -> {type(), ataxic:basic()}; + (shr_glyph_board:type(), unresolved()) -> {unresolved(), ataxic:basic()}. +ataxia_set_glyph_board (V, Eq) -> + { + set_glyph_board(V, Eq), + ataxic:update_field + ( + get_glyph_board_field(), + ataxic:constant(shr_glyph_board:get_id(V)) + ) + }. + -spec set_glyphs (list(shr_glyph:type()), type()) -> type(); (list(shr_glyph:type()), unresolved()) -> unresolved(). @@ -184,6 +270,19 @@ set_glyphs (V, Eq) when is_record(Eq, shr_eq) -> set_glyphs (V, Eq) when is_record(Eq, shr_eq_ref) -> Eq#shr_eq_ref{ glyphs = lists:map(fun shr_glyph:get_id/1, V) }. +-spec ataxia_set_glyphs + (shr_glyph:type(), type()) -> {type(), ataxic:basic()}; + (shr_glyph:type(), unresolved()) -> {unresolved(), ataxic:basic()}. +ataxia_set_glyphs (V, Eq) -> + { + set_glyphs(V, Eq), + ataxic:update_field + ( + get_glyphs_field(), + ataxic:constant(shr_glyph:get_id(V)) + ) + }. + -spec set_primary_weapon_id (shr_weapon:id(), type()) -> type(); (shr_weapon:id(), unresolved()) -> unresolved(). @@ -192,6 +291,19 @@ set_primary_weapon_id (V, Eq) when is_record(Eq, shr_eq_ref) -> set_primary_weapon_id (V, Eq) when is_record(Eq, shr_eq) -> Eq#shr_eq{ primary = shr_weapon:from_id(V) }. +-spec ataxia_set_primary_weapon_id + (shr_weapon:id(), type()) -> {type(), ataxic:basic()}; + (shr_weapon:id(), unresolved()) -> {unresolved(), ataxic:basic()}. +ataxia_set_primary_weapon_id (V, Eq) -> + { + set_primary_weapon_id(V, Eq), + ataxic:update_field + ( + get_primary_weapon_field(), + ataxic:constant(V) + ) + }. + -spec set_secondary_weapon_id (shr_weapon:id(), type()) -> type(); (shr_weapon:id(), unresolved()) -> unresolved(). @@ -200,6 +312,19 @@ set_secondary_weapon_id (V, Eq) when is_record(Eq, shr_eq_ref) -> set_secondary_weapon_id (V, Eq) when is_record(Eq, shr_eq) -> Eq#shr_eq{ secondary = shr_weapon:from_id(V) }. +-spec ataxia_set_secondary_weapon_id + (shr_weapon:id(), type()) -> {type(), ataxic:basic()}; + (shr_weapon:id(), unresolved()) -> {unresolved(), ataxic:basic()}. +ataxia_set_secondary_weapon_id (V, Eq) -> + { + set_secondary_weapon_id(V, Eq), + ataxic:update_field + ( + get_secondary_weapon_field(), + ataxic:constant(V) + ) + }. + -spec set_armor_id (shr_armor:id(), type()) -> type(); (shr_armor:id(), unresolved()) -> unresolved(). @@ -208,6 +333,19 @@ set_armor_id (V, Eq) when is_record(Eq, shr_eq_ref) -> set_armor_id (V, Eq) when is_record(Eq, shr_eq) -> Eq#shr_eq{ armor = shr_armor:from_id(V) }. +-spec ataxia_set_armor_id + (shr_armor:id(), type()) -> {type(), ataxic:basic()}; + (shr_armor:id(), unresolved()) -> {unresolved(), ataxic:basic()}. +ataxia_set_armor_id (V, Eq) -> + { + set_armor_id(V, Eq), + ataxic:update_field + ( + get_armor_field(), + ataxic:constant(V) + ) + }. + -spec set_portrait_id (shr_portrait:id(), type()) -> type(); (shr_portrait:id(), unresolved()) -> unresolved(). @@ -216,6 +354,19 @@ set_portrait_id (V, Eq) when is_record(Eq, shr_eq_ref) -> set_portrait_id (V, Eq) when is_record(Eq, shr_eq) -> Eq#shr_eq{ portrait = shr_portrait:from_id(V) }. +-spec ataxia_set_portrait_id + (shr_portrait:id(), type()) -> {type(), ataxic:basic()}; + (shr_portrait:id(), unresolved()) -> {unresolved(), ataxic:basic()}. +ataxia_set_portrait_id (V, Eq) -> + { + set_portrait_id(V, Eq), + ataxic:update_field + ( + get_portrait_field(), + ataxic:constant(V) + ) + }. + -spec set_glyph_board_id (shr_glyph_board:id(), type()) -> type(); (shr_glyph_board:id(), unresolved()) -> unresolved(). @@ -224,6 +375,19 @@ set_glyph_board_id (V, Eq) when is_record(Eq, shr_eq_ref) -> set_glyph_board_id (V, Eq) when is_record(Eq, shr_eq) -> Eq#shr_eq{ glyph_board = shr_glyph_board:from_id(V) }. +-spec ataxia_set_glyph_board_id + (shr_glyph_board:id(), type()) -> {type(), ataxic:basic()}; + (shr_glyph_board:id(), unresolved()) -> {unresolved(), ataxic:basic()}. +ataxia_set_glyph_board_id (V, Eq) -> + { + set_glyph_board_id(V, Eq), + ataxic:update_field + ( + get_glyph_board_field(), + ataxic:constant(V) + ) + }. + -spec set_glyph_ids (list(shr_glyph:id()), type()) -> type(); (list(shr_glyph:id()), unresolved()) -> unresolved(). @@ -232,6 +396,19 @@ set_glyph_ids (V, Eq) when is_record(Eq, shr_eq_ref) -> set_glyph_ids (V, Eq) when is_record(Eq, shr_eq) -> Eq#shr_eq{ glyphs = lists:map(fun shr_glyph:from_id/1, V) }. +-spec ataxia_set_glyph_ids + (shr_glyph:id(), type()) -> {type(), ataxic:basic()}; + (shr_glyph:id(), unresolved()) -> {unresolved(), ataxic:basic()}. +ataxia_set_glyph_ids (V, Eq) -> + { + set_glyph_ids(V, Eq), + ataxic:update_field + ( + get_glyphs_field(), + ataxic:constant(V) + ) + }. + -spec default () -> type(). default () -> #shr_eq @@ -255,3 +432,21 @@ default_unresolved () -> glyph_board = shr_glyph_board:default_id(), glyphs = [] }. + +-spec get_primary_weapon_field () -> non_neg_integer(). +get_primary_weapon_field () -> #shr_eq_ref.primary. + +-spec get_secondary_weapon_field () -> non_neg_integer(). +get_secondary_weapon_field () -> #shr_eq_ref.secondary. + +-spec get_armor_field () -> non_neg_integer(). +get_armor_field () -> #shr_eq_ref.armor. + +-spec get_portrait_field () -> non_neg_integer(). +get_portrait_field () -> #shr_eq_ref.portrait. + +-spec get_glyph_board_field () -> non_neg_integer(). +get_glyph_board_field () -> #shr_eq_ref.glyph_board. + +-spec get_glyphs_field () -> non_neg_integer(). +get_glyphs_field () -> #shr_eq_ref.glyphs. |