From 9805f1db85c0db13bff43986a6018217d8e67f49 Mon Sep 17 00:00:00 2001 From: nsensfel Date: Tue, 16 Oct 2018 18:10:35 +0200 Subject: Rough listing of portraits/weapons/armors. --- src/roster-editor/src/Comm/AddArmor.elm | 2 +- src/roster-editor/src/Comm/AddChar.elm | 2 +- src/roster-editor/src/Comm/AddGlyph.elm | 24 ++++++ src/roster-editor/src/Comm/AddGlyphBoard.elm | 24 ++++++ src/roster-editor/src/Comm/AddPortrait.elm | 24 ++++++ src/roster-editor/src/Comm/AddWeapon.elm | 2 +- src/roster-editor/src/Comm/Send.elm | 19 +++-- src/roster-editor/src/Struct/Glyph.elm | 29 +++++++- src/roster-editor/src/Struct/GlyphBoard.elm | 30 +++++++- src/roster-editor/src/Struct/Model.elm | 36 +++++++++ src/roster-editor/src/Struct/Omnimods.elm | 10 +++ src/roster-editor/src/Struct/Portrait.elm | 32 +++++++- src/roster-editor/src/Struct/ServerReply.elm | 6 ++ src/roster-editor/src/Update/HandleServerReply.elm | 39 ++++++++++ src/roster-editor/src/View/ArmorSelection.elm | 58 ++++++++++++++- src/roster-editor/src/View/PortraitSelection.elm | 76 ++++++++++++++++++- src/roster-editor/src/View/WeaponSelection.elm | 85 +++++++++++++++++++++- 17 files changed, 474 insertions(+), 24 deletions(-) create mode 100644 src/roster-editor/src/Comm/AddGlyph.elm create mode 100644 src/roster-editor/src/Comm/AddGlyphBoard.elm create mode 100644 src/roster-editor/src/Comm/AddPortrait.elm (limited to 'src/roster-editor') diff --git a/src/roster-editor/src/Comm/AddArmor.elm b/src/roster-editor/src/Comm/AddArmor.elm index 480b823..c93a709 100644 --- a/src/roster-editor/src/Comm/AddArmor.elm +++ b/src/roster-editor/src/Comm/AddArmor.elm @@ -3,7 +3,7 @@ module Comm.AddArmor exposing (decode) -- Elm ------------------------------------------------------------------------- import Json.Decode --- Map ------------------------------------------------------------------- +-- Roster Editor --------------------------------------------------------------- import Struct.Armor import Struct.ServerReply diff --git a/src/roster-editor/src/Comm/AddChar.elm b/src/roster-editor/src/Comm/AddChar.elm index 32227a8..e2b580a 100644 --- a/src/roster-editor/src/Comm/AddChar.elm +++ b/src/roster-editor/src/Comm/AddChar.elm @@ -3,7 +3,7 @@ module Comm.AddChar exposing (decode) -- Elm ------------------------------------------------------------------------- import Json.Decode --- Map ------------------------------------------------------------------- +-- Roster Editor --------------------------------------------------------------- import Struct.Character import Struct.ServerReply diff --git a/src/roster-editor/src/Comm/AddGlyph.elm b/src/roster-editor/src/Comm/AddGlyph.elm new file mode 100644 index 0000000..a07c0d6 --- /dev/null +++ b/src/roster-editor/src/Comm/AddGlyph.elm @@ -0,0 +1,24 @@ +module Comm.AddGlyph exposing (decode) + +-- Elm ------------------------------------------------------------------------- +import Json.Decode + +-- Roster Editor --------------------------------------------------------------- +import Struct.Glyph +import Struct.ServerReply + +-------------------------------------------------------------------------------- +-- TYPES ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- +internal_decoder : Struct.Glyph.Type -> Struct.ServerReply.Type +internal_decoder gl = (Struct.ServerReply.AddGlyph gl) + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +decode : (Json.Decode.Decoder Struct.ServerReply.Type) +decode = (Json.Decode.map (internal_decoder) (Struct.Glyph.decoder)) diff --git a/src/roster-editor/src/Comm/AddGlyphBoard.elm b/src/roster-editor/src/Comm/AddGlyphBoard.elm new file mode 100644 index 0000000..bee381f --- /dev/null +++ b/src/roster-editor/src/Comm/AddGlyphBoard.elm @@ -0,0 +1,24 @@ +module Comm.AddGlyphBoard exposing (decode) + +-- Elm ------------------------------------------------------------------------- +import Json.Decode + +-- Roster Editor --------------------------------------------------------------- +import Struct.GlyphBoard +import Struct.ServerReply + +-------------------------------------------------------------------------------- +-- TYPES ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- +internal_decoder : Struct.GlyphBoard.Type -> Struct.ServerReply.Type +internal_decoder glb = (Struct.ServerReply.AddGlyphBoard glb) + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +decode : (Json.Decode.Decoder Struct.ServerReply.Type) +decode = (Json.Decode.map (internal_decoder) (Struct.GlyphBoard.decoder)) diff --git a/src/roster-editor/src/Comm/AddPortrait.elm b/src/roster-editor/src/Comm/AddPortrait.elm new file mode 100644 index 0000000..8eb731c --- /dev/null +++ b/src/roster-editor/src/Comm/AddPortrait.elm @@ -0,0 +1,24 @@ +module Comm.AddPortrait exposing (decode) + +-- Elm ------------------------------------------------------------------------- +import Json.Decode + +-- Roster Editor --------------------------------------------------------------- +import Struct.Portrait +import Struct.ServerReply + +-------------------------------------------------------------------------------- +-- TYPES ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- +internal_decoder : Struct.Portrait.Type -> Struct.ServerReply.Type +internal_decoder pt = (Struct.ServerReply.AddPortrait pt) + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +decode : (Json.Decode.Decoder Struct.ServerReply.Type) +decode = (Json.Decode.map (internal_decoder) (Struct.Portrait.decoder)) diff --git a/src/roster-editor/src/Comm/AddWeapon.elm b/src/roster-editor/src/Comm/AddWeapon.elm index 7061dea..4342f52 100644 --- a/src/roster-editor/src/Comm/AddWeapon.elm +++ b/src/roster-editor/src/Comm/AddWeapon.elm @@ -3,7 +3,7 @@ module Comm.AddWeapon exposing (decode) -- Elm ------------------------------------------------------------------------- import Json.Decode --- Map ------------------------------------------------------------------- +-- Roster Editor --------------------------------------------------------------- import Struct.Weapon import Struct.ServerReply diff --git a/src/roster-editor/src/Comm/Send.elm b/src/roster-editor/src/Comm/Send.elm index 35368df..a80a6eb 100644 --- a/src/roster-editor/src/Comm/Send.elm +++ b/src/roster-editor/src/Comm/Send.elm @@ -9,6 +9,9 @@ import Json.Encode --- Roster Editor -------------------------------------------------------------- import Comm.AddArmor import Comm.AddChar +import Comm.AddGlyph +import Comm.AddGlyphBoard +import Comm.AddPortrait import Comm.AddWeapon import Comm.SetInventory @@ -27,18 +30,14 @@ internal_decoder : String -> (Json.Decode.Decoder Struct.ServerReply.Type) internal_decoder reply_type = case reply_type of "set_inventory" -> (Comm.SetInventory.decode) - "add_armor" -> (Comm.AddArmor.decode) - "add_char" -> (Comm.AddChar.decode) - "add_weapon" -> (Comm.AddWeapon.decode) - - -- TODO - "add_portrait" -> (Json.Decode.succeed Struct.ServerReply.Okay) - -- TODO - "add_glyph" -> (Json.Decode.succeed Struct.ServerReply.Okay) + "add_char" -> (Comm.AddChar.decode) - -- TODO - "add_glyph_board" -> (Json.Decode.succeed Struct.ServerReply.Okay) + "add_armor" -> (Comm.AddArmor.decode) + "add_weapon" -> (Comm.AddWeapon.decode) + "add_portrait" -> (Comm.AddPortrait.decode) + "add_glyph" -> (Comm.AddGlyph.decode) + "add_glyph_board" -> (Comm.AddGlyphBoard.decode) "disconnected" -> (Json.Decode.succeed Struct.ServerReply.Disconnected) "okay" -> (Json.Decode.succeed Struct.ServerReply.Okay) diff --git a/src/roster-editor/src/Struct/Glyph.elm b/src/roster-editor/src/Struct/Glyph.elm index c9ad608..cd8329b 100644 --- a/src/roster-editor/src/Struct/Glyph.elm +++ b/src/roster-editor/src/Struct/Glyph.elm @@ -1,10 +1,16 @@ module Struct.Glyph exposing ( Type, - Ref + Ref, + get_name, + get_id, + get_omnimods, + decoder ) -- Elm ------------------------------------------------------------------------- +import Json.Decode +import Json.Decode.Pipeline -- Roster Editor --------------------------------------------------------------- import Struct.Omnimods @@ -14,12 +20,12 @@ import Struct.Omnimods -------------------------------------------------------------------------------- type alias Type = { - id : Int, + id : String, name : String, omnimods : Struct.Omnimods.Type } -type alias Ref = Int +type alias Ref = String -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- @@ -28,3 +34,20 @@ type alias Ref = Int -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- +get_id : Type -> String +get_id g = g.id + +get_name : Type -> String +get_name g = g.name + +get_omnimods : Type -> Struct.Omnimods.Type +get_omnimods g = g.omnimods + +decoder : (Json.Decode.Decoder Type) +decoder = + (Json.Decode.Pipeline.decode + Type + |> (Json.Decode.Pipeline.required "id" Json.Decode.string) + |> (Json.Decode.Pipeline.required "nam" Json.Decode.string) + |> (Json.Decode.Pipeline.required "omni" Struct.Omnimods.decoder) + ) diff --git a/src/roster-editor/src/Struct/GlyphBoard.elm b/src/roster-editor/src/Struct/GlyphBoard.elm index 43cf2da..94e53da 100644 --- a/src/roster-editor/src/Struct/GlyphBoard.elm +++ b/src/roster-editor/src/Struct/GlyphBoard.elm @@ -2,10 +2,16 @@ module Struct.GlyphBoard exposing ( Type, Ref, + get_name, + get_id, + get_omnimods, + decoder, none ) -- Elm ------------------------------------------------------------------------- +import Json.Decode +import Json.Decode.Pipeline -- Roster Editor --------------------------------------------------------------- import Struct.Omnimods @@ -15,12 +21,12 @@ import Struct.Omnimods -------------------------------------------------------------------------------- type alias Type = { - id : Int, + id : String, name : String, omnimods : Struct.Omnimods.Type } -type alias Ref = Int +type alias Ref = String -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- @@ -29,10 +35,28 @@ type alias Ref = Int -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- +get_id : Type -> String +get_id g = g.id + +get_name : Type -> String +get_name g = g.name + +get_omnimods : Type -> Struct.Omnimods.Type +get_omnimods g = g.omnimods + +decoder : (Json.Decode.Decoder Type) +decoder = + (Json.Decode.Pipeline.decode + Type + |> (Json.Decode.Pipeline.required "id" Json.Decode.string) + |> (Json.Decode.Pipeline.required "nam" Json.Decode.string) + |> (Json.Decode.Pipeline.required "omni" Struct.Omnimods.decoder) + ) + none : Type none = { - id = 0, + id = "", name = "None", omnimods = (Struct.Omnimods.none) } diff --git a/src/roster-editor/src/Struct/Model.elm b/src/roster-editor/src/Struct/Model.elm index 4a5b5bf..65bce6e 100644 --- a/src/roster-editor/src/Struct/Model.elm +++ b/src/roster-editor/src/Struct/Model.elm @@ -7,6 +7,9 @@ module Struct.Model exposing update_character_fun, add_weapon, add_armor, + add_portrait, + add_glyph, + add_glyph_board, invalidate, clear_error ) @@ -119,6 +122,39 @@ add_armor ar model = ) } +add_portrait : Struct.Portrait.Type -> Type -> Type +add_portrait pt model = + {model | + portraits = + (Dict.insert + (Struct.Portrait.get_id pt) + pt + model.portraits + ) + } + +add_glyph : Struct.Glyph.Type -> Type -> Type +add_glyph gl model = + {model | + glyphs = + (Dict.insert + (Struct.Glyph.get_id gl) + gl + model.glyphs + ) + } + +add_glyph_board : Struct.GlyphBoard.Type -> Type -> Type +add_glyph_board glb model = + {model | + glyph_boards = + (Dict.insert + (Struct.GlyphBoard.get_id glb) + glb + model.glyph_boards + ) + } + update_character : Int -> Struct.Character.Type -> Type -> Type update_character ix new_val model = {model | diff --git a/src/roster-editor/src/Struct/Omnimods.elm b/src/roster-editor/src/Struct/Omnimods.elm index db91ab1..31ad1ed 100644 --- a/src/roster-editor/src/Struct/Omnimods.elm +++ b/src/roster-editor/src/Struct/Omnimods.elm @@ -12,6 +12,7 @@ module Struct.Omnimods exposing get_statistics_mods, get_attack_mods, get_defense_mods, + get_all_mods, decoder ) @@ -188,3 +189,12 @@ get_attack_mods omnimods = (Dict.toList omnimods.attack) get_defense_mods : Type -> (List (String, Int)) get_defense_mods omnimods = (Dict.toList omnimods.defense) + +get_all_mods : Type -> (List (String, Int)) +get_all_mods omnimods = + ( + (get_attributes_mods omnimods) + ++ (get_statistics_mods omnimods) + ++ (get_attack_mods omnimods) + ++ (get_defense_mods omnimods) + ) diff --git a/src/roster-editor/src/Struct/Portrait.elm b/src/roster-editor/src/Struct/Portrait.elm index 809f732..125a416 100644 --- a/src/roster-editor/src/Struct/Portrait.elm +++ b/src/roster-editor/src/Struct/Portrait.elm @@ -2,13 +2,19 @@ module Struct.Portrait exposing ( Type, Ref, - none + none, + get_id, + get_name, + get_body_id, + get_icon_id, + decoder ) -- Elm ------------------------------------------------------------------------- +import Json.Decode +import Json.Decode.Pipeline -- Roster Editor --------------------------------------------------------------- -import Struct.Omnimods -------------------------------------------------------------------------------- -- TYPES ----------------------------------------------------------------------- @@ -38,3 +44,25 @@ none = body_id = "mammal", icon_id = "cat" } + +get_id : Type -> String +get_id p = p.id + +get_name : Type -> String +get_name p = p.name + +get_body_id : Type -> String +get_body_id p = p.body_id + +get_icon_id : Type -> String +get_icon_id p = p.icon_id + +decoder : (Json.Decode.Decoder Type) +decoder = + (Json.Decode.Pipeline.decode + Type + |> (Json.Decode.Pipeline.required "id" Json.Decode.string) + |> (Json.Decode.Pipeline.required "nam" Json.Decode.string) + |> (Json.Decode.Pipeline.required "bid" Json.Decode.string) + |> (Json.Decode.Pipeline.required "iid" Json.Decode.string) + ) diff --git a/src/roster-editor/src/Struct/ServerReply.elm b/src/roster-editor/src/Struct/ServerReply.elm index dddbc23..5b66b63 100644 --- a/src/roster-editor/src/Struct/ServerReply.elm +++ b/src/roster-editor/src/Struct/ServerReply.elm @@ -5,7 +5,10 @@ module Struct.ServerReply exposing (Type(..)) -- Roster Editor --------------------------------------------------------------- import Struct.Armor import Struct.Character +import Struct.Glyph +import Struct.GlyphBoard import Struct.Inventory +import Struct.Portrait import Struct.Weapon -------------------------------------------------------------------------------- @@ -17,6 +20,9 @@ type Type = | Disconnected | SetInventory Struct.Inventory.Type | AddArmor Struct.Armor.Type + | AddGlyph Struct.Glyph.Type + | AddGlyphBoard Struct.GlyphBoard.Type + | AddPortrait Struct.Portrait.Type | AddWeapon Struct.Weapon.Type | AddCharacter (Struct.Character.Type, Int, Int, Int) diff --git a/src/roster-editor/src/Update/HandleServerReply.elm b/src/roster-editor/src/Update/HandleServerReply.elm index dd60005..22a2aa0 100644 --- a/src/roster-editor/src/Update/HandleServerReply.elm +++ b/src/roster-editor/src/Update/HandleServerReply.elm @@ -17,8 +17,11 @@ import Struct.Armor import Struct.Character import Struct.Error import Struct.Event +import Struct.Glyph +import Struct.GlyphBoard import Struct.Inventory import Struct.Model +import Struct.Portrait import Struct.ServerReply import Struct.Weapon @@ -77,6 +80,33 @@ add_armor ar current_state = let (model, cmds) = current_state in ((Struct.Model.add_armor ar model), cmds) +add_portrait : ( + Struct.Portrait.Type -> + (Struct.Model.Type, (List (Cmd Struct.Event.Type))) -> + (Struct.Model.Type, (List (Cmd Struct.Event.Type))) + ) +add_portrait pt current_state = + let (model, cmds) = current_state in + ((Struct.Model.add_portrait pt model), cmds) + +add_glyph : ( + Struct.Glyph.Type -> + (Struct.Model.Type, (List (Cmd Struct.Event.Type))) -> + (Struct.Model.Type, (List (Cmd Struct.Event.Type))) + ) +add_glyph gl current_state = + let (model, cmds) = current_state in + ((Struct.Model.add_glyph gl model), cmds) + +add_glyph_board : ( + Struct.GlyphBoard.Type -> + (Struct.Model.Type, (List (Cmd Struct.Event.Type))) -> + (Struct.Model.Type, (List (Cmd Struct.Event.Type))) + ) +add_glyph_board glb current_state = + let (model, cmds) = current_state in + ((Struct.Model.add_glyph_board glb model), cmds) + add_weapon : ( Struct.Weapon.Type -> (Struct.Model.Type, (List (Cmd Struct.Event.Type))) -> @@ -131,6 +161,15 @@ apply_command command current_state = (Struct.ServerReply.AddArmor ar) -> (add_armor ar current_state) + (Struct.ServerReply.AddPortrait pt) -> + (add_portrait pt current_state) + + (Struct.ServerReply.AddGlyph gl) -> + (add_glyph gl current_state) + + (Struct.ServerReply.AddGlyphBoard glb) -> + (add_glyph_board glb current_state) + (Struct.ServerReply.AddCharacter char) -> (add_character char current_state) diff --git a/src/roster-editor/src/View/ArmorSelection.elm b/src/roster-editor/src/View/ArmorSelection.elm index db5ebb7..2e53375 100644 --- a/src/roster-editor/src/View/ArmorSelection.elm +++ b/src/roster-editor/src/View/ArmorSelection.elm @@ -1,16 +1,66 @@ module View.ArmorSelection exposing (get_html) -- Elm ------------------------------------------------------------------------- +import Dict + import Html import Html.Attributes -- Roster Editor --------------------------------------------------------------- +import Struct.Armor import Struct.Event import Struct.Model +import Struct.Omnimods -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- +get_mod_html : (String, Int) -> (Html.Html Struct.Event.Type) +get_mod_html mod = + let + (category, value) = mod + in + (Html.div + [ + (Html.Attributes.class "info-card-mod") + ] + [ + (Html.text + (category ++ ": " ++ (toString value)) + ) + ] + ) + +get_armor_html : ( + Struct.Armor.Type -> + (Html.Html Struct.Event.Type) + ) +get_armor_html armor = + (Html.div + [ + (Html.Attributes.class "character-card-armor"), + (Html.Attributes.class "clickable") + ] + [ + (Html.div + [ + (Html.Attributes.class "character-card-armor-name") + ] + [ + (Html.text (Struct.Armor.get_name armor)) + ] + ), + (Html.div + [ + (Html.Attributes.class "info-card-omnimods-listing") + ] + (List.map + (get_mod_html) + (Struct.Omnimods.get_all_mods (Struct.Armor.get_omnimods armor)) + ) + ) + ] + ) -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- @@ -23,6 +73,12 @@ get_html model = (Html.Attributes.class "armor-selection") ] [ - (Html.text "Armor Selection") + (Html.text "Armor Selection"), + (Html.div + [ + (Html.Attributes.class "selection-window-listing") + ] + (List.map (get_armor_html) (Dict.values model.armors)) + ) ] ) diff --git a/src/roster-editor/src/View/PortraitSelection.elm b/src/roster-editor/src/View/PortraitSelection.elm index f94197b..a6c20ed 100644 --- a/src/roster-editor/src/View/PortraitSelection.elm +++ b/src/roster-editor/src/View/PortraitSelection.elm @@ -1,16 +1,81 @@ module View.PortraitSelection exposing (get_html) -- Elm ------------------------------------------------------------------------- +import Dict + import Html import Html.Attributes +import List + -- Roster Editor --------------------------------------------------------------- import Struct.Event +import Struct.Portrait import Struct.Model -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- +get_portrait_html : Struct.Portrait.Type -> (Html.Html Struct.Event.Type) +get_portrait_html pt = + (Html.div + [ + (Html.Attributes.class "character-portrait-and-icon"), + (Html.Attributes.class "clickable") + ] + [ + (Html.div + [ + (Html.Attributes.class "character-portrait"), + (Html.Attributes.class "character-portrait-team-0") + ] + [ + (Html.div + [ + (Html.Attributes.class "character-portrait-body"), + (Html.Attributes.class + ( + "asset-character-portrait-" + ++ (Struct.Portrait.get_id pt) + ) + ) + ] + [ + ] + ) + ] + ), + (Html.div + [ + (Html.Attributes.class "tiled"), + (Html.Attributes.class "character-icon") + ] + [ + (Html.div + [ + (Html.Attributes.class "character-icon-body"), + (Html.Attributes.class "asset-character-team-body-0") + ] + [ + ] + ), + (Html.div + [ + (Html.Attributes.class "character-icon-head"), + (Html.Attributes.class + ( + "asset-character-icon-" + ++ (Struct.Portrait.get_icon_id pt) + ) + ) + ] + [ + ] + ) + ] + ) + ] + ) -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- @@ -23,6 +88,15 @@ get_html model = (Html.Attributes.class "portrait-selection") ] [ - (Html.text "Portrait Selection") + (Html.text "Portrait Selection"), + (Html.div + [ + (Html.Attributes.class "selection-window-listing") + ] + (List.map + (get_portrait_html) + (Dict.values model.portraits) + ) + ) ] ) diff --git a/src/roster-editor/src/View/WeaponSelection.elm b/src/roster-editor/src/View/WeaponSelection.elm index 8c79e3e..0bbe897 100644 --- a/src/roster-editor/src/View/WeaponSelection.elm +++ b/src/roster-editor/src/View/WeaponSelection.elm @@ -1,16 +1,90 @@ module View.WeaponSelection exposing (get_html) -- Elm ------------------------------------------------------------------------- +import Dict + import Html import Html.Attributes -- Roster Editor --------------------------------------------------------------- import Struct.Event import Struct.Model +import Struct.Weapon +import Struct.Omnimods -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- +get_mod_html : (String, Int) -> (Html.Html Struct.Event.Type) +get_mod_html mod = + let + (category, value) = mod + in + (Html.div + [ + (Html.Attributes.class "info-card-mod") + ] + [ + (Html.text + (category ++ ": " ++ (toString value)) + ) + ] + ) + +get_weapon_html : ( + Struct.Weapon.Type -> + (Html.Html Struct.Event.Type) + ) +get_weapon_html weapon = + (Html.div + [ + (Html.Attributes.class "character-card-weapon"), + (Html.Attributes.class "clickable") + ] + [ + (Html.div + [ + (Html.Attributes.class "character-card-header") + ] + [ + (Html.div + [ + ] + [ + (Html.text (Struct.Weapon.get_name weapon)) + ] + ), + (Html.div + [ + ] + [ + (Html.text + ( + "~" + ++ + (toString (Struct.Weapon.get_damage_sum weapon)) + ++ " dmg @ [" + ++ (toString (Struct.Weapon.get_defense_range weapon)) + ++ ", " + ++ (toString (Struct.Weapon.get_attack_range weapon)) + ++ "]" + ) + ) + ] + ) + ] + ), + (Html.div + [ + (Html.Attributes.class "info-card-omnimods-listing") + ] + (List.map + (get_mod_html) + (Struct.Omnimods.get_all_mods (Struct.Weapon.get_omnimods weapon)) + ) + ) + ] + ) -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- @@ -23,6 +97,15 @@ get_html model = (Html.Attributes.class "weapon-selection") ] [ - (Html.text "Weapon Selection") + (Html.text "Weapon Selection"), + (Html.div + [ + (Html.Attributes.class "selection-window-listing") + ] + (List.map + (get_weapon_html) + (Dict.values model.weapons) + ) + ) ] ) -- cgit v1.2.3-70-g09d2