| summaryrefslogtreecommitdiff | 
diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/asset/www/data/weapons.json.m4 | 1 | ||||
| -rw-r--r-- | src/roster-editor/src/Struct/Weapon.elm | 38 | ||||
| -rw-r--r-- | src/roster-editor/src/View/WeaponSelection.elm | 63 | 
3 files changed, 62 insertions, 40 deletions
| diff --git a/src/asset/www/data/weapons.json.m4 b/src/asset/www/data/weapons.json.m4 index 713c5f6..7daf71b 100644 --- a/src/asset/www/data/weapons.json.m4 +++ b/src/asset/www/data/weapons.json.m4 @@ -1,6 +1,7 @@  [  m4_include(__MAKEFILE_DATA_DIR/weapon/global.m4.conf)m4_dnl  m4_include(__MAKEFILE_DATA_DIR/weapon/basic.m4d)m4_dnl +m4_include(__MAKEFILE_DATA_DIR/weapon/secondary.m4d)m4_dnl     {        "msg": "okay"     } diff --git a/src/roster-editor/src/Struct/Weapon.elm b/src/roster-editor/src/Struct/Weapon.elm index 5616720..0ab0ec7 100644 --- a/src/roster-editor/src/Struct/Weapon.elm +++ b/src/roster-editor/src/Struct/Weapon.elm @@ -2,9 +2,9 @@ module Struct.Weapon exposing     (        Type,        Ref, -      new,        get_id,        get_name, +      get_is_primary,        get_attack_range,        get_defense_range,        get_omnimods, @@ -24,19 +24,11 @@ import Struct.Omnimods  --------------------------------------------------------------------------------  -- TYPES -----------------------------------------------------------------------  -------------------------------------------------------------------------------- -type alias PartiallyDecoded = -   { -      id : String, -      nam : String, -      rmi : Int, -      rma : Int, -      omni : String -   } -  type alias Type =     {        id : String,        name : String, +      is_primary : Bool,        def_range : Int,        atk_range : Int,        omnimods : Struct.Omnimods.Type, @@ -52,23 +44,15 @@ type alias Ref = String  --------------------------------------------------------------------------------  -- EXPORTED --------------------------------------------------------------------  -------------------------------------------------------------------------------- -new : String -> String -> Int -> Int -> Struct.Omnimods.Type -> Type -new id name range_min range_max omnimods = -   { -      id = id, -      name = name, -      def_range = range_min, -      atk_range = range_max, -      omnimods = omnimods, -      damage_sum = (Struct.Omnimods.get_damage_sum omnimods) -   } -  get_id : Type -> String  get_id wp = wp.id  get_name : Type -> String  get_name wp = wp.name +get_is_primary : Type -> Bool +get_is_primary wp = wp.is_primary +  get_attack_range : Type -> Int  get_attack_range wp = wp.atk_range @@ -89,6 +73,7 @@ decoder =           Type           |> (Json.Decode.Pipeline.required "id" Json.Decode.string)           |> (Json.Decode.Pipeline.required "nam" Json.Decode.string) +         |> (Json.Decode.Pipeline.required "pri" Json.Decode.bool)           |> (Json.Decode.Pipeline.required "rmi" Json.Decode.int)           |> (Json.Decode.Pipeline.required "rma" Json.Decode.int)           |> (Json.Decode.Pipeline.required "omni" Struct.Omnimods.decoder) @@ -97,7 +82,16 @@ decoder =     )  none : Type -none = (new "0" "None" 0 0 (Struct.Omnimods.none)) +none = +   { +      id = "", +      name = "None", +      is_primary = False, +      def_range = 0, +      atk_range = 0, +      omnimods = (Struct.Omnimods.none), +      damage_sum = 0 +   }  default : Type  default = (none) diff --git a/src/roster-editor/src/View/WeaponSelection.elm b/src/roster-editor/src/View/WeaponSelection.elm index 608568a..4408627 100644 --- a/src/roster-editor/src/View/WeaponSelection.elm +++ b/src/roster-editor/src/View/WeaponSelection.elm @@ -7,11 +7,15 @@ import Html  import Html.Attributes  import Html.Events +-- Shared ---------------------------------------------------------------------- +import Util.Html +  -- Roster Editor --------------------------------------------------------------- +import Struct.Character  import Struct.Event  import Struct.Model -import Struct.Weapon  import Struct.Omnimods +import Struct.Weapon  import View.Omnimods  -------------------------------------------------------------------------------- @@ -107,21 +111,44 @@ get_weapon_html weapon =  --------------------------------------------------------------------------------  get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)  get_html model = -   (Html.div -      [ -         (Html.Attributes.class "selection-window"), -         (Html.Attributes.class "weapon-selection") -      ] -      [ -         (Html.text "Weapon Selection"), -         (Html.div -            [ -               (Html.Attributes.class "selection-window-listing") -            ] -            (List.map -               (get_weapon_html) -               (Dict.values model.weapons) +   case model.edited_char of +      Nothing -> (Util.Html.nothing) +      (Just char) -> +         let +            is_selecting_secondary = +               (Struct.Character.get_is_using_secondary char) +         in +            (Html.div +               [ +                  (Html.Attributes.class "selection-window"), +                  (Html.Attributes.class "weapon-selection") +               ] +               [ +                  (Html.text +                     ( +                        if (is_selecting_secondary) +                        then "Secondary Weapon Selection" +                        else "Primary Weapon Selection" +                     ) +                  ), +                  (Html.div +                     [ +                        (Html.Attributes.class "selection-window-listing") +                     ] +                     (List.map +                        (get_weapon_html) +                        (List.filter +                           (\e -> +                              (not +                                 ( +                                    is_selecting_secondary +                                    && (Struct.Weapon.get_is_primary e) +                                 ) +                              ) +                           ) +                           (Dict.values model.weapons) +                        ) +                     ) +                  ) +               ]              ) -         ) -      ] -   ) | 


