summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/roster-editor')
-rw-r--r--src/roster-editor/src/Comm/AddChar.elm9
-rw-r--r--src/roster-editor/src/Comm/Send.elm1
-rw-r--r--src/roster-editor/src/Struct/Event.elm4
-rw-r--r--src/roster-editor/src/Struct/Model.elm12
-rw-r--r--src/roster-editor/src/Struct/ServerReply.elm4
-rw-r--r--src/roster-editor/src/Update/HandleServerReply.elm2
-rw-r--r--src/roster-editor/src/Update/SetArmor.elm19
-rw-r--r--src/roster-editor/src/Update/SetName.elm15
-rw-r--r--src/roster-editor/src/Update/SetPortrait.elm18
-rw-r--r--src/roster-editor/src/Update/SetWeapon.elm40
-rw-r--r--src/roster-editor/src/Update/SwitchWeapons.elm7
-rw-r--r--src/roster-editor/src/View/Character.elm13
-rw-r--r--src/roster-editor/src/View/CharacterCard.elm24
-rw-r--r--src/roster-editor/src/View/GlyphManagement.elm2
-rw-r--r--src/roster-editor/src/View/WeaponSelection.elm5
15 files changed, 123 insertions, 52 deletions
diff --git a/src/roster-editor/src/Comm/AddChar.elm b/src/roster-editor/src/Comm/AddChar.elm
index 15eff83..bd4454c 100644
--- a/src/roster-editor/src/Comm/AddChar.elm
+++ b/src/roster-editor/src/Comm/AddChar.elm
@@ -4,7 +4,7 @@ module Comm.AddChar exposing (decode)
import Json.Decode
-- Local Module ----------------------------------------------------------------
-import Struct.CharacterRecord
+import Struct.Character
import Struct.ServerReply
--------------------------------------------------------------------------------
@@ -14,12 +14,11 @@ import Struct.ServerReply
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-
-internal_decoder : Struct.CharacterRecord.Type -> Struct.ServerReply.Type
-internal_decoder char= (Struct.ServerReply.AddCharacter char)
+internal_decoder : Struct.Character.Unresolved -> Struct.ServerReply.Type
+internal_decoder char = (Struct.ServerReply.AddCharacter char)
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
decode : (Json.Decode.Decoder Struct.ServerReply.Type)
-decode = (Json.Decode.map (internal_decoder) (Struct.CharacterRecord.decoder))
+decode = (Json.Decode.map (internal_decoder) (Struct.Character.decoder))
diff --git a/src/roster-editor/src/Comm/Send.elm b/src/roster-editor/src/Comm/Send.elm
index 23a03bc..3253f96 100644
--- a/src/roster-editor/src/Comm/Send.elm
+++ b/src/roster-editor/src/Comm/Send.elm
@@ -15,6 +15,7 @@ import BattleCharacters.Comm.AddWeapon
--- Local Module ---------------------------------------------------------------
import Comm.GoTo
+import Comm.AddChar
import Comm.SetInventory
import Struct.Event
diff --git a/src/roster-editor/src/Struct/Event.elm b/src/roster-editor/src/Struct/Event.elm
index 1dbae24..408f858 100644
--- a/src/roster-editor/src/Struct/Event.elm
+++ b/src/roster-editor/src/Struct/Event.elm
@@ -35,8 +35,8 @@ type Type =
| SetCharacterName String
| SelectedArmor BattleCharacters.Struct.Armor.Ref
- | SelectedGlyph Struct.Glyph.Ref
- | SelectedGlyphBoard Struct.GlyphBoard.Ref
+ | SelectedGlyph BattleCharacters.Struct.Glyph.Ref
+ | SelectedGlyphBoard BattleCharacters.Struct.GlyphBoard.Ref
| SelectedPortrait BattleCharacters.Struct.Portrait.Ref
| SelectedWeapon BattleCharacters.Struct.Weapon.Ref
diff --git a/src/roster-editor/src/Struct/Model.elm b/src/roster-editor/src/Struct/Model.elm
index 2ba403d..0c304c9 100644
--- a/src/roster-editor/src/Struct/Model.elm
+++ b/src/roster-editor/src/Struct/Model.elm
@@ -96,11 +96,11 @@ add_character_from_unresolved char_ref model =
char =
(Struct.Character.resolve
(BattleCharacters.Struct.Equipment.resolve
- (\e -> (Dict.get e model.weapons))
- (\e -> (Dict.get e model.armors))
- (\e -> (Dict.get e model.portraits))
- (\e -> (Dict.get e model.glyph_boards))
- (\e -> (Dict.get e model.glyphs))
+ (BattleCharacters.Struct.Weapon.find model.weapons)
+ (BattleCharacters.Struct.Armor.find model.armors)
+ (BattleCharacters.Struct.Portrait.find model.portraits)
+ (BattleCharacters.Struct.GlyphBoard.find model.glyph_boards)
+ (BattleCharacters.Struct.Glyph.find model.glyphs)
)
char_ref
)
@@ -108,7 +108,7 @@ add_character_from_unresolved char_ref model =
{model |
characters =
(Array.push
- (Struct.Character.get_index char)
+-- (Struct.Character.get_index char)
char
model.characters
)
diff --git a/src/roster-editor/src/Struct/ServerReply.elm b/src/roster-editor/src/Struct/ServerReply.elm
index 3d0ff79..8e643bf 100644
--- a/src/roster-editor/src/Struct/ServerReply.elm
+++ b/src/roster-editor/src/Struct/ServerReply.elm
@@ -21,8 +21,8 @@ type Type =
| GoTo String
| SetInventory Struct.Inventory.Type
| AddArmor BattleCharacters.Struct.Armor.Type
- | AddGlyph Struct.Glyph.Type
- | AddGlyphBoard Struct.GlyphBoard.Type
+ | AddGlyph BattleCharacters.Struct.Glyph.Type
+ | AddGlyphBoard BattleCharacters.Struct.GlyphBoard.Type
| AddPortrait BattleCharacters.Struct.Portrait.Type
| AddWeapon BattleCharacters.Struct.Weapon.Type
| AddCharacter Struct.Character.Unresolved
diff --git a/src/roster-editor/src/Update/HandleServerReply.elm b/src/roster-editor/src/Update/HandleServerReply.elm
index d3ac975..5f1bc52 100644
--- a/src/roster-editor/src/Update/HandleServerReply.elm
+++ b/src/roster-editor/src/Update/HandleServerReply.elm
@@ -211,7 +211,7 @@ apply_command command current_state =
Struct.ServerReply.Okay ->
let (model, cmds) = current_state in
(
- (Struct.Model.enable_character_records model),
+ (Struct.Model.resolve_all_characters model),
cmds
)
diff --git a/src/roster-editor/src/Update/SetArmor.elm b/src/roster-editor/src/Update/SetArmor.elm
index 5878be2..8adf9a0 100644
--- a/src/roster-editor/src/Update/SetArmor.elm
+++ b/src/roster-editor/src/Update/SetArmor.elm
@@ -5,6 +5,8 @@ import Dict
-- Battle Characters -----------------------------------------------------------
import BattleCharacters.Struct.Armor
+import BattleCharacters.Struct.Character
+import BattleCharacters.Struct.Equipment
-- Local Module ----------------------------------------------------------------
import Struct.Character
@@ -28,8 +30,23 @@ apply_to model ref =
(
case (model.edited_char, (Dict.get ref model.armors)) of
((Just char), (Just armor)) ->
+ let base_char = (Struct.Character.get_base_character char) in
{model |
- edited_char = (Just (Struct.Character.set_armor armor char))
+ edited_char =
+ (Just
+ (Struct.Character.set_base_character
+ (BattleCharacters.Struct.Character.set_equipment
+ (BattleCharacters.Struct.Equipment.set_armor
+ armor
+ (BattleCharacters.Struct.Character.get_equipment
+ base_char
+ )
+ )
+ base_char
+ )
+ char
+ )
+ )
}
_ -> model
diff --git a/src/roster-editor/src/Update/SetName.elm b/src/roster-editor/src/Update/SetName.elm
index 002af51..6250a73 100644
--- a/src/roster-editor/src/Update/SetName.elm
+++ b/src/roster-editor/src/Update/SetName.elm
@@ -1,5 +1,8 @@
module Update.SetName exposing (apply_to)
+-- Battle Characters -----------------------------------------------------------
+import BattleCharacters.Struct.Character
+
-- Local Module ----------------------------------------------------------------
import Struct.Character
import Struct.Event
@@ -24,7 +27,17 @@ apply_to model name =
(Just char) ->
{model |
edited_char =
- (Just (Struct.Character.set_name name char))
+ (Just
+ (Struct.Character.set_base_character
+ (BattleCharacters.Struct.Character.set_name
+ name
+ (Struct.Character.get_base_character
+ char
+ )
+ )
+ char
+ )
+ )
}
_ -> model
diff --git a/src/roster-editor/src/Update/SetPortrait.elm b/src/roster-editor/src/Update/SetPortrait.elm
index dc29c13..369d644 100644
--- a/src/roster-editor/src/Update/SetPortrait.elm
+++ b/src/roster-editor/src/Update/SetPortrait.elm
@@ -4,6 +4,8 @@ module Update.SetPortrait exposing (apply_to)
import Dict
-- Battle Characters -----------------------------------------------------------
+import BattleCharacters.Struct.Character
+import BattleCharacters.Struct.Equipment
import BattleCharacters.Struct.Portrait
-- Local Module ----------------------------------------------------------------
@@ -28,9 +30,23 @@ apply_to model ref =
(
case (model.edited_char, (Dict.get ref model.portraits)) of
((Just char), (Just portrait)) ->
+ let base_char = (Struct.Character.get_base_character char) in
{model |
edited_char =
- (Just (Struct.Character.set_portrait portrait char))
+ (Just
+ (Struct.Character.set_base_character
+ (BattleCharacters.Struct.Character.set_equipment
+ (BattleCharacters.Struct.Equipment.set_portrait
+ portrait
+ (BattleCharacters.Struct.Character.get_equipment
+ base_char
+ )
+ )
+ base_char
+ )
+ char
+ )
+ )
}
_ -> model
diff --git a/src/roster-editor/src/Update/SetWeapon.elm b/src/roster-editor/src/Update/SetWeapon.elm
index 1f796b0..da385a2 100644
--- a/src/roster-editor/src/Update/SetWeapon.elm
+++ b/src/roster-editor/src/Update/SetWeapon.elm
@@ -4,6 +4,8 @@ module Update.SetWeapon exposing (apply_to)
import Dict
-- Battle Characters -----------------------------------------------------------
+import BattleCharacters.Struct.Character
+import BattleCharacters.Struct.Equipment
import BattleCharacters.Struct.Weapon
-- Local Module ----------------------------------------------------------------
@@ -31,19 +33,35 @@ apply_to model ref =
((Just char), (Just weapon)) ->
{model |
edited_char =
+ let
+ base_char = (Struct.Character.get_base_character char)
+ in
(Just
- (
- if (Struct.Character.get_is_using_secondary char)
- then
- (Struct.Character.set_secondary_weapon
- weapon
- char
- )
- else
- (Struct.Character.set_primary_weapon
- weapon
- char
+ (Struct.Character.set_base_character
+ (BattleCharacters.Struct.Character.set_equipment
+ (
+ if
+ (BattleCharacters.Struct.Character.is_using_secondary
+ base_char
+ )
+ then
+ (BattleCharacters.Struct.Equipment.set_secondary_weapon
+ weapon
+ (BattleCharacters.Struct.Character.get_equipment
+ base_char
+ )
+ )
+ else
+ (BattleCharacters.Struct.Equipment.set_primary_weapon
+ weapon
+ (BattleCharacters.Struct.Character.get_equipment
+ base_char
+ )
+ )
)
+ base_char
+ )
+ char
)
)
}
diff --git a/src/roster-editor/src/Update/SwitchWeapons.elm b/src/roster-editor/src/Update/SwitchWeapons.elm
index 38f8b8f..40cc7ac 100644
--- a/src/roster-editor/src/Update/SwitchWeapons.elm
+++ b/src/roster-editor/src/Update/SwitchWeapons.elm
@@ -4,7 +4,7 @@ module Update.SwitchWeapons exposing (apply_to)
import Dict
-- Battle Characters -----------------------------------------------------------
-import BattleCharacters.Struct.Weapon
+import BattleCharacters.Struct.Character
-- Local Module ----------------------------------------------------------------
import Struct.Character
@@ -31,7 +31,10 @@ apply_to model =
{model |
edited_char =
(Just
- (Struct.Character.switch_weapons
+ (Struct.Character.set_base_character
+ (BattleCharacters.Struct.Character.switch_weapons
+ (Struct.Character.get_base_character char)
+ )
char
)
)
diff --git a/src/roster-editor/src/View/Character.elm b/src/roster-editor/src/View/Character.elm
index a19b448..1462b07 100644
--- a/src/roster-editor/src/View/Character.elm
+++ b/src/roster-editor/src/View/Character.elm
@@ -14,7 +14,8 @@ import Util.Html
-- Battle Characters -----------------------------------------------------------
import BattleCharacters.Struct.Armor
-import BattleCharacters.Struct.Portrait
+import BattleCharacters.Struct.Character
+import BattleCharacters.Struct.Equipment
import BattleCharacters.View.Portrait
@@ -46,7 +47,11 @@ get_icon_head_html char =
"asset-character-icon-"
++
(BattleCharacters.Struct.Armor.get_image_id
- (Struct.Character.get_armor char)
+ (BattleCharacters.Struct.Equipment.get_armor
+ (BattleCharacters.Struct.Character.get_equipment
+ (Struct.Character.get_base_character char)
+ )
+ )
)
)
)
@@ -99,7 +104,9 @@ get_portrait_html click_to_toggle char =
else
[(Html.Attributes.class "character-portrait-team-0")]
)
- char
+ (BattleCharacters.Struct.Character.get_equipment
+ (Struct.Character.get_base_character char)
+ )
),
(get_battle_index_html char)
]
diff --git a/src/roster-editor/src/View/CharacterCard.elm b/src/roster-editor/src/View/CharacterCard.elm
index d87a9b8..5b1187f 100644
--- a/src/roster-editor/src/View/CharacterCard.elm
+++ b/src/roster-editor/src/View/CharacterCard.elm
@@ -20,6 +20,8 @@ import Battle.View.Omnimods
-- Battle Characters -----------------------------------------------------------
import BattleCharacters.Struct.Armor
+import BattleCharacters.Struct.Character
+import BattleCharacters.Struct.Equipment
import BattleCharacters.Struct.Weapon
import BattleCharacters.Struct.GlyphBoard
@@ -35,11 +37,11 @@ import View.Gauge
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
get_name : (
- Struct.Character.Type ->
+ BattleCharacters.Struct.Character.Type ->
Bool ->
(Html.Html Struct.Event.Type)
)
-get_name char can_edit =
+get_name base_char can_edit =
if can_edit
then
(Html.input
@@ -48,7 +50,9 @@ get_name char can_edit =
(Html.Attributes.class "info-card-text-field"),
(Html.Attributes.class "character-card-name"),
(Html.Events.onInput Struct.Event.SetCharacterName),
- (Html.Attributes.value (Struct.Character.get_name char))
+ (Html.Attributes.value
+ (BattleCharacters.Struct.Character.get_name base_char)
+ )
]
[
]
@@ -61,11 +65,11 @@ get_name char can_edit =
(Html.Attributes.class "character-card-name")
]
[
- (Html.text (Struct.Character.get_name char))
+ (Html.text (BattleCharacters.Struct.Character.get_name base_char))
]
)
-get_health_bar : Battle.Struct.Statistic.Type -> (Html.Html Struct.Event.Type)
+get_health_bar : Battle.Struct.Statistics.Type -> (Html.Html Struct.Event.Type)
get_health_bar char_stats =
(View.Gauge.get_html
(
@@ -110,16 +114,6 @@ get_movement_bar char_stats =
[]
[]
)
-get_health_bar : Battle.Struct.Statistic.Type -> (Html.Html Struct.Event.Type)
-get_health_bar char_stats =
- let max = (Battle.Struct.Statistics.get_max_health char_stats) in
- (View.Gauge.get_html
- ("HP: " ++ (String.fromInt max))
- 100.0
- [(Html.Attributes.class "character-card-health")]
- []
- []
- )
get_weapon_field_header : (
Float ->
diff --git a/src/roster-editor/src/View/GlyphManagement.elm b/src/roster-editor/src/View/GlyphManagement.elm
index 11fd2fe..072dca3 100644
--- a/src/roster-editor/src/View/GlyphManagement.elm
+++ b/src/roster-editor/src/View/GlyphManagement.elm
@@ -42,7 +42,7 @@ get_mod_html mod =
get_glyph_html : (
Int ->
- (Int, Struct.Glyph.Type)
+ (Int, BattleCharacters.Struct.Glyph.Type)
-> (Html.Html Struct.Event.Type)
)
get_glyph_html modifier (index, glyph) =
diff --git a/src/roster-editor/src/View/WeaponSelection.elm b/src/roster-editor/src/View/WeaponSelection.elm
index 2f6f514..7844237 100644
--- a/src/roster-editor/src/View/WeaponSelection.elm
+++ b/src/roster-editor/src/View/WeaponSelection.elm
@@ -14,6 +14,7 @@ import Util.Html
import Battle.View.Omnimods
-- Battle Characters -----------------------------------------------------------
+import BattleCharacters.Struct.Character
import BattleCharacters.Struct.Weapon
-- Local Module ----------------------------------------------------------------
@@ -131,7 +132,9 @@ get_html model =
(Just char) ->
let
is_selecting_secondary =
- (Struct.Character.get_is_using_secondary char)
+ (BattleCharacters.Struct.Character.is_using_secondary
+ (Struct.Character.get_base_character char)
+ )
in
(Html.div
[