summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-10-15 18:06:57 +0200
committernsensfel <SpamShield0@noot-noot.org>2018-10-15 18:06:57 +0200
commitf9e2f066b8bcdf50288a4d128c576a1dc0607504 (patch)
tree99c19f6ff11c5699cfbf1a6291c8ea585e1ed589 /src/roster-editor
parent380729ff7a7f7030cc17f531d850917a5706e4f4 (diff)
Preparing to list items in the roster...
Diffstat (limited to 'src/roster-editor')
-rw-r--r--src/roster-editor/src/Comm/LoadArmors.elm31
-rw-r--r--src/roster-editor/src/Comm/LoadGlyphBoards.elm31
-rw-r--r--src/roster-editor/src/Comm/LoadGlyphs.elm31
-rw-r--r--src/roster-editor/src/Comm/LoadPortraits.elm31
-rw-r--r--src/roster-editor/src/Comm/LoadWeapons.elm31
-rw-r--r--src/roster-editor/src/Comm/Send.elm26
-rw-r--r--src/roster-editor/src/Constants/IO.elm.m415
-rw-r--r--src/roster-editor/src/ElmModule/Init.elm37
-rw-r--r--src/roster-editor/src/Struct/Model.elm10
-rw-r--r--src/roster-editor/src/Struct/Portrait.elm40
-rw-r--r--src/roster-editor/src/Update/HandleServerReply.elm3
-rw-r--r--src/roster-editor/src/Update/SelectCharacter.elm1
-rw-r--r--src/roster-editor/src/View/Character.elm3
-rw-r--r--src/roster-editor/src/View/CharacterCard.elm40
-rw-r--r--src/roster-editor/src/View/MainMenu.elm6
15 files changed, 312 insertions, 24 deletions
diff --git a/src/roster-editor/src/Comm/LoadArmors.elm b/src/roster-editor/src/Comm/LoadArmors.elm
new file mode 100644
index 0000000..2fe04c1
--- /dev/null
+++ b/src/roster-editor/src/Comm/LoadArmors.elm
@@ -0,0 +1,31 @@
+module Comm.LoadArmors exposing (try)
+
+-- Elm -------------------------------------------------------------------------
+
+-- Roster Editor ---------------------------------------------------------------
+import Comm.Send
+
+import Constants.IO
+
+import Struct.Event
+import Struct.Model
+
+--------------------------------------------------------------------------------
+-- TYPES ------------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+try : Struct.Model.Type -> (Maybe (Cmd Struct.Event.Type))
+try model =
+ (Just
+ (Comm.Send.empty_request
+ model
+ Constants.IO.armors_data_url
+ )
+ )
diff --git a/src/roster-editor/src/Comm/LoadGlyphBoards.elm b/src/roster-editor/src/Comm/LoadGlyphBoards.elm
new file mode 100644
index 0000000..1a74715
--- /dev/null
+++ b/src/roster-editor/src/Comm/LoadGlyphBoards.elm
@@ -0,0 +1,31 @@
+module Comm.LoadGlyphBoards exposing (try)
+
+-- Elm -------------------------------------------------------------------------
+
+-- Roster Editor ---------------------------------------------------------------
+import Comm.Send
+
+import Constants.IO
+
+import Struct.Event
+import Struct.Model
+
+--------------------------------------------------------------------------------
+-- TYPES ------------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+try : Struct.Model.Type -> (Maybe (Cmd Struct.Event.Type))
+try model =
+ (Just
+ (Comm.Send.empty_request
+ model
+ Constants.IO.glyph_boards_data_url
+ )
+ )
diff --git a/src/roster-editor/src/Comm/LoadGlyphs.elm b/src/roster-editor/src/Comm/LoadGlyphs.elm
new file mode 100644
index 0000000..c64602d
--- /dev/null
+++ b/src/roster-editor/src/Comm/LoadGlyphs.elm
@@ -0,0 +1,31 @@
+module Comm.LoadGlyphs exposing (try)
+
+-- Elm -------------------------------------------------------------------------
+
+-- Roster Editor ---------------------------------------------------------------
+import Comm.Send
+
+import Constants.IO
+
+import Struct.Event
+import Struct.Model
+
+--------------------------------------------------------------------------------
+-- TYPES ------------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+try : Struct.Model.Type -> (Maybe (Cmd Struct.Event.Type))
+try model =
+ (Just
+ (Comm.Send.empty_request
+ model
+ Constants.IO.glyphs_data_url
+ )
+ )
diff --git a/src/roster-editor/src/Comm/LoadPortraits.elm b/src/roster-editor/src/Comm/LoadPortraits.elm
new file mode 100644
index 0000000..554dff2
--- /dev/null
+++ b/src/roster-editor/src/Comm/LoadPortraits.elm
@@ -0,0 +1,31 @@
+module Comm.LoadPortraits exposing (try)
+
+-- Elm -------------------------------------------------------------------------
+
+-- Roster Editor ---------------------------------------------------------------
+import Comm.Send
+
+import Constants.IO
+
+import Struct.Event
+import Struct.Model
+
+--------------------------------------------------------------------------------
+-- TYPES ------------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+try : Struct.Model.Type -> (Maybe (Cmd Struct.Event.Type))
+try model =
+ (Just
+ (Comm.Send.empty_request
+ model
+ Constants.IO.portraits_data_url
+ )
+ )
diff --git a/src/roster-editor/src/Comm/LoadWeapons.elm b/src/roster-editor/src/Comm/LoadWeapons.elm
new file mode 100644
index 0000000..4a63f23
--- /dev/null
+++ b/src/roster-editor/src/Comm/LoadWeapons.elm
@@ -0,0 +1,31 @@
+module Comm.LoadWeapons exposing (try)
+
+-- Elm -------------------------------------------------------------------------
+
+-- Roster Editor ---------------------------------------------------------------
+import Comm.Send
+
+import Constants.IO
+
+import Struct.Event
+import Struct.Model
+
+--------------------------------------------------------------------------------
+-- TYPES ------------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+try : Struct.Model.Type -> (Maybe (Cmd Struct.Event.Type))
+try model =
+ (Just
+ (Comm.Send.empty_request
+ model
+ Constants.IO.weapons_data_url
+ )
+ )
diff --git a/src/roster-editor/src/Comm/Send.elm b/src/roster-editor/src/Comm/Send.elm
index 9031258..35368df 100644
--- a/src/roster-editor/src/Comm/Send.elm
+++ b/src/roster-editor/src/Comm/Send.elm
@@ -1,4 +1,4 @@
-module Comm.Send exposing (try_sending)
+module Comm.Send exposing (try_sending, empty_request)
-- Elm -------------------------------------------------------------------------
import Http
@@ -30,6 +30,16 @@ internal_decoder reply_type =
"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)
+
+ -- TODO
+ "add_glyph_board" -> (Json.Decode.succeed Struct.ServerReply.Okay)
+
"disconnected" -> (Json.Decode.succeed Struct.ServerReply.Disconnected)
"okay" -> (Json.Decode.succeed Struct.ServerReply.Okay)
@@ -71,3 +81,17 @@ try_sending model recipient try_encoding_fun =
)
Nothing -> Nothing
+
+empty_request : (
+ Struct.Model.Type ->
+ String ->
+ (Cmd Struct.Event.Type)
+ )
+empty_request model recipient =
+ (Http.send
+ Struct.Event.ServerReplied
+ (Http.get
+ recipient
+ (Json.Decode.list (decode))
+ )
+ )
diff --git a/src/roster-editor/src/Constants/IO.elm.m4 b/src/roster-editor/src/Constants/IO.elm.m4
index ae19a01..39a6951 100644
--- a/src/roster-editor/src/Constants/IO.elm.m4
+++ b/src/roster-editor/src/Constants/IO.elm.m4
@@ -8,3 +8,18 @@ roster_handler_url = (base_url ++ "/handler/roster")
roster_loading_handler : String
roster_loading_handler = (roster_handler_url ++ "/rst_load")
+
+armors_data_url : String
+armors_data_url = (base_url ++ "/asset/data/armors.json")
+
+weapons_data_url : String
+weapons_data_url = (base_url ++ "/asset/data/weapons.json")
+
+glyph_boards_data_url : String
+glyph_boards_data_url = (base_url ++ "/asset/data/glyph_boards.json")
+
+glyphs_data_url : String
+glyphs_data_url = (base_url ++ "/asset/data/glyphs.json")
+
+portraits_data_url : String
+portraits_data_url = (base_url ++ "/asset/data/portraits.json")
diff --git a/src/roster-editor/src/ElmModule/Init.elm b/src/roster-editor/src/ElmModule/Init.elm
index 51a9b1b..fb22c4d 100644
--- a/src/roster-editor/src/ElmModule/Init.elm
+++ b/src/roster-editor/src/ElmModule/Init.elm
@@ -2,8 +2,13 @@ module ElmModule.Init exposing (init)
-- Elm -------------------------------------------------------------------------
--- Map -------------------------------------------------------------------
+-- Roster Editor ---------------------------------------------------------------
import Comm.LoadRoster
+import Comm.LoadArmors
+import Comm.LoadWeapons
+import Comm.LoadPortraits
+import Comm.LoadGlyphs
+import Comm.LoadGlyphBoards
import Struct.Event
import Struct.Flags
@@ -21,8 +26,32 @@ init flags =
let model = (Struct.Model.new flags) in
(
model,
- (case (Comm.LoadRoster.try model) of
- (Just cmd) -> cmd
- Nothing -> Cmd.none
+ (Cmd.batch
+ [
+ (case (Comm.LoadArmors.try model) of
+ (Just cmd) -> cmd
+ Nothing -> Cmd.none
+ ),
+ (case (Comm.LoadWeapons.try model) of
+ (Just cmd) -> cmd
+ Nothing -> Cmd.none
+ ),
+ (case (Comm.LoadGlyphs.try model) of
+ (Just cmd) -> cmd
+ Nothing -> Cmd.none
+ ),
+ (case (Comm.LoadGlyphBoards.try model) of
+ (Just cmd) -> cmd
+ Nothing -> Cmd.none
+ ),
+ (case (Comm.LoadPortraits.try model) of
+ (Just cmd) -> cmd
+ Nothing -> Cmd.none
+ ),
+ (case (Comm.LoadRoster.try model) of
+ (Just cmd) -> cmd
+ Nothing -> Cmd.none
+ )
+ ]
)
)
diff --git a/src/roster-editor/src/Struct/Model.elm b/src/roster-editor/src/Struct/Model.elm
index f010875..4a5b5bf 100644
--- a/src/roster-editor/src/Struct/Model.elm
+++ b/src/roster-editor/src/Struct/Model.elm
@@ -23,9 +23,11 @@ import Struct.Flags
import Struct.Armor
import Struct.Character
import Struct.Error
+import Struct.Glyph
+import Struct.GlyphBoard
import Struct.HelpRequest
import Struct.Inventory
-import Struct.Omnimods
+import Struct.Portrait
import Struct.UI
import Struct.Weapon
@@ -41,6 +43,9 @@ type alias Type =
characters: (Array.Array Struct.Character.Type),
weapons: (Dict.Dict Struct.Weapon.Ref Struct.Weapon.Type),
armors: (Dict.Dict Struct.Armor.Ref Struct.Armor.Type),
+ glyphs: (Dict.Dict Struct.Glyph.Ref Struct.Glyph.Type),
+ glyph_boards: (Dict.Dict Struct.GlyphBoard.Ref Struct.GlyphBoard.Type),
+ portraits: (Dict.Dict Struct.Portrait.Ref Struct.Portrait.Type),
error: (Maybe Struct.Error.Type),
player_id: String,
roster_id: String,
@@ -65,6 +70,9 @@ new flags =
characters = (Array.empty),
weapons = (Dict.empty),
armors = (Dict.empty),
+ glyphs = (Dict.empty),
+ glyph_boards = (Dict.empty),
+ portraits = (Dict.empty),
error = Nothing,
roster_id = "",
player_id =
diff --git a/src/roster-editor/src/Struct/Portrait.elm b/src/roster-editor/src/Struct/Portrait.elm
new file mode 100644
index 0000000..809f732
--- /dev/null
+++ b/src/roster-editor/src/Struct/Portrait.elm
@@ -0,0 +1,40 @@
+module Struct.Portrait exposing
+ (
+ Type,
+ Ref,
+ none
+ )
+
+-- Elm -------------------------------------------------------------------------
+
+-- Roster Editor ---------------------------------------------------------------
+import Struct.Omnimods
+
+--------------------------------------------------------------------------------
+-- TYPES -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+type alias Type =
+ {
+ id : String,
+ name : String,
+ body_id : String,
+ icon_id : String
+ }
+
+type alias Ref = String
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+none : Type
+none =
+ {
+ id = "cat",
+ name = "Black Cat",
+ body_id = "mammal",
+ icon_id = "cat"
+ }
diff --git a/src/roster-editor/src/Update/HandleServerReply.elm b/src/roster-editor/src/Update/HandleServerReply.elm
index 2496089..dd60005 100644
--- a/src/roster-editor/src/Update/HandleServerReply.elm
+++ b/src/roster-editor/src/Update/HandleServerReply.elm
@@ -1,8 +1,6 @@
module Update.HandleServerReply exposing (apply_to)
-- Elm -------------------------------------------------------------------------
-import Array
-
import Dict
import Http
@@ -22,7 +20,6 @@ import Struct.Event
import Struct.Inventory
import Struct.Model
import Struct.ServerReply
-import Struct.UI
import Struct.Weapon
--------------------------------------------------------------------------------
diff --git a/src/roster-editor/src/Update/SelectCharacter.elm b/src/roster-editor/src/Update/SelectCharacter.elm
index 2e2235e..56db669 100644
--- a/src/roster-editor/src/Update/SelectCharacter.elm
+++ b/src/roster-editor/src/Update/SelectCharacter.elm
@@ -4,7 +4,6 @@ module Update.SelectCharacter exposing (apply_to)
import Array
-- Roster Editor ---------------------------------------------------------------
-import Struct.Character
import Struct.Error
import Struct.Event
import Struct.Model
diff --git a/src/roster-editor/src/View/Character.elm b/src/roster-editor/src/View/Character.elm
index aabc1ed..91f6424 100644
--- a/src/roster-editor/src/View/Character.elm
+++ b/src/roster-editor/src/View/Character.elm
@@ -9,12 +9,9 @@ import Html
import Html.Attributes
-- Roster Editor ---------------------------------------------------------------
-import Util.Html
-
import Struct.Armor
import Struct.Character
import Struct.Event
-import Struct.Model
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
diff --git a/src/roster-editor/src/View/CharacterCard.elm b/src/roster-editor/src/View/CharacterCard.elm
index 96968bc..432a8e3 100644
--- a/src/roster-editor/src/View/CharacterCard.elm
+++ b/src/roster-editor/src/View/CharacterCard.elm
@@ -11,18 +11,16 @@ import Html
import Html.Attributes
import Html.Events
--- Battle ----------------------------------------------------------------------
+-- Roster Editor ---------------------------------------------------------------
import Struct.Armor
import Struct.Character
import Struct.Event
-import Struct.HelpRequest
import Struct.Omnimods
import Struct.Statistics
+import Struct.UI
import Struct.Weapon
import Struct.WeaponSet
-import Util.Html
-
import View.Character
import View.Gauge
@@ -192,8 +190,12 @@ get_weapon_details : (
get_weapon_details omnimods damage_multiplier weapon =
(Html.div
[
- (Html.Attributes.class "character-card-weapon")
- ]
+ (Html.Attributes.class "character-card-weapon"),
+ (Html.Attributes.class "clickable"),
+ (Html.Events.onClick
+ (Struct.Event.TabSelected Struct.UI.WeaponSelectionTab)
+ )
+ ]
[
(get_weapon_field_header damage_multiplier weapon),
(Html.div
@@ -216,7 +218,11 @@ get_weapon_summary : (
get_weapon_summary damage_multiplier weapon =
(Html.div
[
- (Html.Attributes.class "character-card-weapon-summary")
+ (Html.Attributes.class "character-card-weapon-summary"),
+ (Html.Attributes.class "clickable"),
+ (Html.Events.onClick
+ (Struct.Event.TabSelected Struct.UI.WeaponSelectionTab)
+ )
]
[
(get_weapon_field_header damage_multiplier weapon)
@@ -231,7 +237,11 @@ get_armor_details : (
get_armor_details omnimods armor =
(Html.div
[
- (Html.Attributes.class "character-card-armor")
+ (Html.Attributes.class "character-card-armor"),
+ (Html.Attributes.class "clickable"),
+ (Html.Events.onClick
+ (Struct.Event.TabSelected Struct.UI.ArmorSelectionTab)
+ )
]
[
(Html.div
@@ -295,7 +305,11 @@ get_relevant_stats : (
get_relevant_stats stats =
(Html.div
[
- (Html.Attributes.class "character-card-stats")
+ (Html.Attributes.class "character-card-stats"),
+ (Html.Attributes.class "clickable"),
+ (Html.Events.onClick
+ (Struct.Event.TabSelected Struct.UI.GlyphManagementTab)
+ )
]
[
(stat_name "Dodge"),
@@ -378,7 +392,13 @@ get_full_html char =
[
(Html.div
[
- (Html.Attributes.class "info-card-picture")
+ (Html.Attributes.class "info-card-picture"),
+ (Html.Attributes.class "clickable"),
+ (Html.Events.onClick
+ (Struct.Event.TabSelected
+ Struct.UI.PortraitSelectionTab
+ )
+ )
]
[
(View.Character.get_portrait_html char)
diff --git a/src/roster-editor/src/View/MainMenu.elm b/src/roster-editor/src/View/MainMenu.elm
index 5dfa706..133ba83 100644
--- a/src/roster-editor/src/View/MainMenu.elm
+++ b/src/roster-editor/src/View/MainMenu.elm
@@ -22,7 +22,11 @@ get_main_menu_button_html =
get_characters_button_html : (Html.Html Struct.Event.Type)
get_characters_button_html =
(Html.button
- [ (Html.Events.onClick Struct.Event.GoToMainMenu) ]
+ [
+ (Html.Events.onClick
+ (Struct.Event.TabSelected Struct.UI.CharacterSelectionTab)
+ )
+ ]
[ (Html.text "Characters") ]
)