| summaryrefslogtreecommitdiff | 
diff options
Diffstat (limited to 'src/roster-editor')
| -rw-r--r-- | src/roster-editor/src/Struct/Model.elm | 108 | ||||
| -rw-r--r-- | src/roster-editor/src/Update/HandleServerReply.elm | 32 | 
2 files changed, 4 insertions, 136 deletions
| diff --git a/src/roster-editor/src/Struct/Model.elm b/src/roster-editor/src/Struct/Model.elm index 879e185..3e573f9 100644 --- a/src/roster-editor/src/Struct/Model.elm +++ b/src/roster-editor/src/Struct/Model.elm @@ -7,11 +7,6 @@ module Struct.Model exposing        update_character,        update_character_fun,        save_character, -      add_weapon, -      add_armor, -      add_portrait, -      add_glyph, -      add_glyph_board,        invalidate,        clear_error     ) @@ -52,31 +47,7 @@ type alias Type =        help_request : Struct.HelpRequest.Type,        characters : (Array.Array Struct.Character.Type),        unresolved_characters : (List Struct.Character.Unresolved), -      weapons : -         (Dict.Dict -            BattleCharacters.Struct.Weapon.Ref -            BattleCharacters.Struct.Weapon.Type -         ), -      armors : -         (Dict.Dict -            BattleCharacters.Struct.Armor.Ref -            BattleCharacters.Struct.Armor.Type -         ), -      glyphs : -         (Dict.Dict -            BattleCharacters.Struct.Glyph.Ref -            BattleCharacters.Struct.Glyph.Type -         ), -      glyph_boards : -         (Dict.Dict -            BattleCharacters.Struct.GlyphBoard.Ref -            BattleCharacters.Struct.GlyphBoard.Type -         ), -      portraits : -         (Dict.Dict -            BattleCharacters.Struct.Portrait.Ref -            BattleCharacters.Struct.Portrait.Type -         ), +      inventory : BattleCharacters.Struct.Inventory.Type,        error : (Maybe Struct.Error.Type),        battle_order : (Array.Array Int),        player_id : String, @@ -95,13 +66,7 @@ add_character_from_unresolved char_ref model =     let        char =           (Struct.Character.resolve -            (BattleCharacters.Struct.Equipment.resolve -               (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) -            ) +            (BattleCharacters.Struct.Equipment.resolve model.inventory)              char_ref           )     in @@ -118,14 +83,7 @@ has_loaded_data : Type -> Bool  has_loaded_data model =     (        ((Array.length model.characters) > 0) -      || -      ( -         (model.portraits /= (Dict.empty)) -         && (model.weapons /= (Dict.empty)) -         && (model.armors /= (Dict.empty)) -         && (model.glyph_boards /= (Dict.empty)) -         && (model.glyphs /= (Dict.empty)) -      ) +      || (BattleCharacters.Struct.Inventory.is_ready model.inventory)     )  -------------------------------------------------------------------------------- @@ -138,11 +96,7 @@ new flags =        help_request = Struct.HelpRequest.None,        characters = (Array.empty),        unresolved_characters = [], -      weapons = (Dict.empty), -      armors = (Dict.empty), -      glyphs = (Dict.empty), -      glyph_boards = (Dict.empty), -      portraits = (Dict.empty), +      inventory = (BattleCharacters.Struct.Inventory.new),        error = Nothing,        roster_id = "",        player_id = @@ -191,60 +145,6 @@ resolve_all_characters model =     else        model -add_weapon : BattleCharacters.Struct.Weapon.Type -> Type -> Type -add_weapon wp model = -   {model | -      weapons = -         (Dict.insert -            (BattleCharacters.Struct.Weapon.get_id wp) -            wp -            model.weapons -         ) -   } - -add_armor : BattleCharacters.Struct.Armor.Type -> Type -> Type -add_armor ar model = -   {model | -      armors = -         (Dict.insert -            (BattleCharacters.Struct.Armor.get_id ar) -            ar -            model.armors -         ) -   } - -add_portrait : BattleCharacters.Struct.Portrait.Type -> Type -> Type -add_portrait pt model = -   {model | -      portraits = -         (Dict.insert -            (BattleCharacters.Struct.Portrait.get_id pt) -            pt -            model.portraits -         ) -   } - -add_glyph : BattleCharacters.Struct.Glyph.Type -> Type -> Type -add_glyph gl model = -   {model | -      glyphs = -         (Dict.insert -            (BattleCharacters.Struct.Glyph.get_id gl) -            gl -            model.glyphs -         ) -   } - -add_glyph_board : BattleCharacters.Struct.GlyphBoard.Type -> Type -> Type -add_glyph_board glb model = -   {model | -      glyph_boards = -         (Dict.insert -            (BattleCharacters.Struct.GlyphBoard.get_id glb) -            glb -            model.glyph_boards -         ) -   }  update_character : Int -> Struct.Character.Type -> Type -> Type  update_character ix new_val model = diff --git a/src/roster-editor/src/Update/HandleServerReply.elm b/src/roster-editor/src/Update/HandleServerReply.elm index 5f1bc52..617b72a 100644 --- a/src/roster-editor/src/Update/HandleServerReply.elm +++ b/src/roster-editor/src/Update/HandleServerReply.elm @@ -38,38 +38,6 @@ import Struct.ServerReply  --------------------------------------------------------------------------------  -- LOCAL -----------------------------------------------------------------------  -------------------------------------------------------------------------------- -weapon_getter : ( -      Struct.Model.Type -> -      BattleCharacters.Struct.Weapon.Ref -> -      BattleCharacters.Struct.Weapon.Type -   ) -weapon_getter model ref = -   case (Dict.get ref model.weapons) of -      (Just w) -> w -      Nothing -> BattleCharacters.Struct.Weapon.none - -armor_getter : ( -      Struct.Model.Type -> -      BattleCharacters.Struct.Armor.Ref -> -      BattleCharacters.Struct.Armor.Type -   ) -armor_getter model ref = -   case (Dict.get ref model.armors) of -      (Just w) -> w -      Nothing -> BattleCharacters.Struct.Armor.none - -portrait_getter : ( -      Struct.Model.Type -> -      BattleCharacters.Struct.Portrait.Ref -> -      BattleCharacters.Struct.Portrait.Type -   ) -portrait_getter model ref = -   case (Dict.get ref model.portraits) of -      (Just w) -> w -      Nothing -> BattleCharacters.Struct.Portrait.default - ------------ -  disconnected : (        (Struct.Model.Type, (List (Cmd Struct.Event.Type))) ->        (Struct.Model.Type, (List (Cmd Struct.Event.Type))) | 


