summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-12-05 19:00:55 +0100
committernsensfel <SpamShield0@noot-noot.org>2018-12-05 19:00:55 +0100
commit31cef45c4b972c1b2b393b4a7decf95c52bc54e6 (patch)
tree9cb1a84593bf7858f7e092c5290f6ba6eb494bd6
parent2e12b4991208af99f590ded22a0c47989daa9312 (diff)
...
-rw-r--r--src/roster-editor/src/ElmModule/Update.elm7
-rw-r--r--src/roster-editor/src/Struct/Character.elm10
-rw-r--r--src/roster-editor/src/Struct/Event.elm1
-rw-r--r--src/roster-editor/src/Struct/Model.elm13
-rw-r--r--src/roster-editor/src/View/Character.elm18
5 files changed, 49 insertions, 0 deletions
diff --git a/src/roster-editor/src/ElmModule/Update.elm b/src/roster-editor/src/ElmModule/Update.elm
index b448b1f..88d059d 100644
--- a/src/roster-editor/src/ElmModule/Update.elm
+++ b/src/roster-editor/src/ElmModule/Update.elm
@@ -52,6 +52,13 @@ update event model =
char_id
)
+ (Struct.Event.ToggleCharacterBattleIndex char_id) ->
+ (new_model, Cmd.none)
+ -- (Update.ToggleCharacterBattleIndex.apply_to
+ -- (Struct.Model.save_character new_model)
+ -- char_id
+ -- )
+
(Struct.Event.TabSelected tab) ->
(Update.SelectTab.apply_to
(
diff --git a/src/roster-editor/src/Struct/Character.elm b/src/roster-editor/src/Struct/Character.elm
index 2778b6d..958aa58 100644
--- a/src/roster-editor/src/Struct/Character.elm
+++ b/src/roster-editor/src/Struct/Character.elm
@@ -3,6 +3,8 @@ module Struct.Character exposing
Type,
new,
get_index,
+ get_battle_index,
+ set_battle_index,
get_name,
set_name,
get_portrait,
@@ -42,6 +44,7 @@ import Struct.WeaponSet
type alias Type =
{
ix : Int,
+ battle_ix : Int,
name : String,
portrait : Struct.Portrait.Type,
attributes : Struct.Attributes.Type,
@@ -109,6 +112,7 @@ new index name m_portrait m_main_wp m_sec_wp m_armor m_board m_glyphs =
(refresh_omnimods
{
ix = index,
+ battle_ix = -1,
name = name,
portrait =
(
@@ -162,6 +166,12 @@ new index name m_portrait m_main_wp m_sec_wp m_armor m_board m_glyphs =
get_index : Type -> Int
get_index c = c.ix
+get_battle_index : Type -> Int
+get_battle_index c = c.battle_ix
+
+set_battle_index : Int -> Type -> Type
+set_battle_index battle_ix c = {c | battle_ix = battle_ix}
+
get_name : Type -> String
get_name c = c.name
diff --git a/src/roster-editor/src/Struct/Event.elm b/src/roster-editor/src/Struct/Event.elm
index 146e264..cfafbdd 100644
--- a/src/roster-editor/src/Struct/Event.elm
+++ b/src/roster-editor/src/Struct/Event.elm
@@ -20,6 +20,7 @@ import Struct.Weapon
type Type =
None
| CharacterSelected Int
+ | ToggleCharacterBattleIndex Int
| Failed Struct.Error.Type
| GoToMainMenu
| RequestedHelp Struct.HelpRequest.Type
diff --git a/src/roster-editor/src/Struct/Model.elm b/src/roster-editor/src/Struct/Model.elm
index 0f49d2f..b205004 100644
--- a/src/roster-editor/src/Struct/Model.elm
+++ b/src/roster-editor/src/Struct/Model.elm
@@ -56,6 +56,7 @@ type alias 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),
+ used_indices: (Array.Array Bool),
player_id: String,
roster_id: String,
edited_char: (Maybe Struct.Character.Type),
@@ -142,6 +143,18 @@ new flags =
then "0"
else flags.user_id
),
+ used_indices =
+ (Array.repeat
+ (
+ case (Struct.Flags.maybe_get_param "s" flags) of
+ Nothing -> 0
+ (Just "s") -> 8
+ (Just "m") -> 16
+ (Just "l") -> 24
+ (Just _) -> 0
+ )
+ False
+ ),
session_token = flags.token,
edited_char = Nothing,
inventory = (Struct.Inventory.empty),
diff --git a/src/roster-editor/src/View/Character.elm b/src/roster-editor/src/View/Character.elm
index 93c71ad..dd5649a 100644
--- a/src/roster-editor/src/View/Character.elm
+++ b/src/roster-editor/src/View/Character.elm
@@ -9,6 +9,8 @@ import Html
import Html.Attributes
-- Roster Editor ---------------------------------------------------------------
+import Util.Html
+
import Struct.Armor
import Struct.Character
import Struct.Event
@@ -86,6 +88,21 @@ get_portrait_armor_html char =
]
)
+get_battle_index_html : Struct.Character.Type -> (Html.Html Struct.Event.Type)
+get_battle_index_html char =
+ case (Struct.Character.get_battle_index char) of
+ -1 -> (Util.Html.nothing)
+ battle_ix ->
+ (Html.div
+ [
+ (Html.Attributes.class "character-portrait-battle-index"),
+ (Html.Attributes.class "clickable")
+ ]
+ [
+ (Html.text (toString battle_ix))
+ ]
+ )
+
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
@@ -97,6 +114,7 @@ get_portrait_html char =
(Html.Attributes.class "character-portrait-team-0")
]
[
+ (get_battle_index_html char),
(get_portrait_body_html char),
(get_portrait_armor_html char)
]