summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/roster-editor')
-rw-r--r--src/roster-editor/Makefile2
-rw-r--r--src/roster-editor/elm-package.json19
-rw-r--r--src/roster-editor/elm.json29
-rw-r--r--src/roster-editor/src/Comm/JoinBattle.elm10
-rw-r--r--src/roster-editor/src/Comm/Send.elm32
-rw-r--r--src/roster-editor/src/Comm/UpdateRoster.elm16
-rw-r--r--src/roster-editor/src/Main.elm6
-rw-r--r--src/roster-editor/src/Struct/Armor.elm2
-rw-r--r--src/roster-editor/src/Struct/CharacterRecord.elm8
-rw-r--r--src/roster-editor/src/Struct/Event.elm8
-rw-r--r--src/roster-editor/src/Struct/Glyph.elm2
-rw-r--r--src/roster-editor/src/Struct/GlyphBoard.elm2
-rw-r--r--src/roster-editor/src/Struct/Inventory.elm2
-rw-r--r--src/roster-editor/src/Struct/Omnimods.elm4
-rw-r--r--src/roster-editor/src/Struct/Portrait.elm2
-rw-r--r--src/roster-editor/src/Struct/Weapon.elm2
-rw-r--r--src/roster-editor/src/Update/HandleServerReply.elm10
-rw-r--r--src/roster-editor/src/Update/SelectCharacter.elm2
-rw-r--r--src/roster-editor/src/View/ArmorSelection.elm2
-rw-r--r--src/roster-editor/src/View/Character.elm10
-rw-r--r--src/roster-editor/src/View/CharacterCard.elm22
-rw-r--r--src/roster-editor/src/View/CharacterIcon.elm51
-rw-r--r--src/roster-editor/src/View/Gauge.elm11
-rw-r--r--src/roster-editor/src/View/GlyphBoardSelection.elm2
-rw-r--r--src/roster-editor/src/View/GlyphManagement.elm4
-rw-r--r--src/roster-editor/src/View/GlyphSelection.elm2
-rw-r--r--src/roster-editor/src/View/SubMenu/Status/TileInfo.elm10
-rw-r--r--src/roster-editor/src/View/SubMenu/Timeline.elm95
-rw-r--r--src/roster-editor/src/View/SubMenu/Timeline/Attack.elm164
-rw-r--r--src/roster-editor/src/View/SubMenu/Timeline/Movement.elm62
-rw-r--r--src/roster-editor/src/View/SubMenu/Timeline/PlayerDefeat.elm38
-rw-r--r--src/roster-editor/src/View/SubMenu/Timeline/PlayerTurnStart.elm38
-rw-r--r--src/roster-editor/src/View/SubMenu/Timeline/PlayerVictory.elm38
-rw-r--r--src/roster-editor/src/View/SubMenu/Timeline/WeaponSwitch.elm58
-rw-r--r--src/roster-editor/src/View/WeaponSelection.elm16
-rw-r--r--src/roster-editor/www/index.html13
36 files changed, 175 insertions, 619 deletions
diff --git a/src/roster-editor/Makefile b/src/roster-editor/Makefile
index 3b58a08..737be75 100644
--- a/src/roster-editor/Makefile
+++ b/src/roster-editor/Makefile
@@ -5,7 +5,7 @@ SRC_DIR ?= src
WWW_DIR ?= www
WWW_SCRIPT_DIR ?= $(WWW_DIR)/script
-ELM_CC ?= elm-make --warn
+ELM_CC ?= elm make --optimize
MAIN_MODULE ?= $(SRC_DIR)/Main.elm
diff --git a/src/roster-editor/elm-package.json b/src/roster-editor/elm-package.json
deleted file mode 100644
index d62239e..0000000
--- a/src/roster-editor/elm-package.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "version": "1.0.0",
- "summary": "helpful summary of your project, less than 80 characters",
- "repository": "https://github.com/nsensfel/tacticians-client.git",
- "license": "Apache 2.0",
- "source-directories": [
- "src",
- "../shared/elm"
- ],
- "exposed-modules": [],
- "dependencies": {
- "NoRedInk/elm-decode-pipeline": "3.0.0 <= v < 4.0.0",
- "elm-lang/core": "5.1.1 <= v < 6.0.0",
- "elm-lang/dom": "1.1.1 <= v < 2.0.0",
- "elm-lang/html": "2.0.0 <= v < 3.0.0",
- "elm-lang/http": "1.0.0 <= v < 2.0.0"
- },
- "elm-version": "0.18.0 <= v < 0.19.0"
-}
diff --git a/src/roster-editor/elm.json b/src/roster-editor/elm.json
new file mode 100644
index 0000000..929038d
--- /dev/null
+++ b/src/roster-editor/elm.json
@@ -0,0 +1,29 @@
+{
+ "type": "application",
+ "source-directories": [
+ "src",
+ "../shared/elm"
+ ],
+ "elm-version": "0.19.0",
+ "dependencies": {
+ "direct": {
+ "NoRedInk/elm-json-decode-pipeline": "1.0.0",
+ "elm/browser": "1.0.1",
+ "elm/core": "1.0.2",
+ "elm/html": "1.0.0",
+ "elm/http": "2.0.0",
+ "elm/json": "1.1.2",
+ "elm/url": "1.0.0"
+ },
+ "indirect": {
+ "elm/bytes": "1.0.7",
+ "elm/file": "1.0.1",
+ "elm/time": "1.0.0",
+ "elm/virtual-dom": "1.0.2"
+ }
+ },
+ "test-dependencies": {
+ "direct": {},
+ "indirect": {}
+ }
+}
diff --git a/src/roster-editor/src/Comm/JoinBattle.elm b/src/roster-editor/src/Comm/JoinBattle.elm
index 582e269..42244c6 100644
--- a/src/roster-editor/src/Comm/JoinBattle.elm
+++ b/src/roster-editor/src/Comm/JoinBattle.elm
@@ -57,12 +57,10 @@ try_encoding model =
(
"r",
(Json.Encode.array
- (Array.map
- (Json.Encode.int)
- (Array.filter
- (\e -> (e /= -1))
- model.battle_order
- )
+ (Json.Encode.int)
+ (Array.filter
+ (\e -> (e /= -1))
+ model.battle_order
)
)
)
diff --git a/src/roster-editor/src/Comm/Send.elm b/src/roster-editor/src/Comm/Send.elm
index a80a6eb..a4cdf3b 100644
--- a/src/roster-editor/src/Comm/Send.elm
+++ b/src/roster-editor/src/Comm/Send.elm
@@ -69,13 +69,16 @@ try_sending model recipient try_encoding_fun =
case (try_encoding_fun model) of
(Just serial) ->
(Just
- (Http.send
- Struct.Event.ServerReplied
- (Http.post
- recipient
- (Http.jsonBody serial)
- (Json.Decode.list (decode))
- )
+ (Http.post
+ {
+ url = recipient,
+ body = (Http.jsonBody serial),
+ expect =
+ (Http.expectJson
+ Struct.Event.ServerReplied
+ (Json.Decode.list (decode))
+ )
+ }
)
)
@@ -87,10 +90,13 @@ empty_request : (
(Cmd Struct.Event.Type)
)
empty_request model recipient =
- (Http.send
- Struct.Event.ServerReplied
- (Http.get
- recipient
- (Json.Decode.list (decode))
- )
+ (Http.get
+ {
+ url = recipient,
+ expect =
+ (Http.expectJson
+ Struct.Event.ServerReplied
+ (Json.Decode.list (decode))
+ )
+ }
)
diff --git a/src/roster-editor/src/Comm/UpdateRoster.elm b/src/roster-editor/src/Comm/UpdateRoster.elm
index ff31ad0..f2d57fc 100644
--- a/src/roster-editor/src/Comm/UpdateRoster.elm
+++ b/src/roster-editor/src/Comm/UpdateRoster.elm
@@ -34,15 +34,13 @@ try_encoding model =
(
"rst",
(Json.Encode.list
- (List.map
- (
- (Struct.CharacterRecord.from_character)
- >> (Struct.CharacterRecord.encode)
- )
- (List.filter
- (Struct.Character.get_was_edited)
- (Array.toList model.characters)
- )
+ (
+ (Struct.CharacterRecord.from_character)
+ >> (Struct.CharacterRecord.encode)
+ )
+ (List.filter
+ (Struct.Character.get_was_edited)
+ (Array.toList model.characters)
)
)
)
diff --git a/src/roster-editor/src/Main.elm b/src/roster-editor/src/Main.elm
index 8140041..cd4554e 100644
--- a/src/roster-editor/src/Main.elm
+++ b/src/roster-editor/src/Main.elm
@@ -1,7 +1,7 @@
-- Elm ------------------------------------------------------------------------
-import Html
+import Browser
--- Map -------------------------------------------------------------------
+-- Roster Editor ---------------------------------------------------------------
import Struct.Model
import Struct.Event
import Struct.Flags
@@ -13,7 +13,7 @@ import ElmModule.Update
main : (Program Struct.Flags.Type Struct.Model.Type Struct.Event.Type)
main =
- (Html.programWithFlags
+ (Browser.element
{
init = ElmModule.Init.init,
view = ElmModule.View.view,
diff --git a/src/roster-editor/src/Struct/Armor.elm b/src/roster-editor/src/Struct/Armor.elm
index 6bae44f..06689f8 100644
--- a/src/roster-editor/src/Struct/Armor.elm
+++ b/src/roster-editor/src/Struct/Armor.elm
@@ -60,7 +60,7 @@ get_omnimods ar = ar.omnimods
decoder : (Json.Decode.Decoder Type)
decoder =
- (Json.Decode.Pipeline.decode
+ (Json.Decode.succeed
Type
|> (Json.Decode.Pipeline.required "id" Json.Decode.string)
|> (Json.Decode.Pipeline.required "nam" Json.Decode.string)
diff --git a/src/roster-editor/src/Struct/CharacterRecord.elm b/src/roster-editor/src/Struct/CharacterRecord.elm
index 62bfa93..de78f27 100644
--- a/src/roster-editor/src/Struct/CharacterRecord.elm
+++ b/src/roster-editor/src/Struct/CharacterRecord.elm
@@ -104,7 +104,7 @@ from_character char =
decoder : (Json.Decode.Decoder Type)
decoder =
- (Json.Decode.Pipeline.decode
+ (Json.Decode.succeed
Type
|> (Json.Decode.Pipeline.required "ix" Json.Decode.int)
|> (Json.Decode.Pipeline.required "nam" Json.Decode.string)
@@ -133,10 +133,8 @@ encode char =
(
"gls",
(Json.Encode.list
- (List.map
- (Json.Encode.string)
- char.glyph_ids
- )
+ (Json.Encode.string)
+ char.glyph_ids
)
)
]
diff --git a/src/roster-editor/src/Struct/Event.elm b/src/roster-editor/src/Struct/Event.elm
index 032a002..1dafdab 100644
--- a/src/roster-editor/src/Struct/Event.elm
+++ b/src/roster-editor/src/Struct/Event.elm
@@ -44,4 +44,10 @@ attempted act =
case act of
(Result.Ok _) -> None
(Result.Err msg) ->
- (Failed (Struct.Error.new Struct.Error.Failure (toString msg)))
+ (Failed
+ (Struct.Error.new
+ Struct.Error.Failure
+ -- TODO: find a way to get some relevant text here.
+ "(text representation not implemented)"
+ )
+ )
diff --git a/src/roster-editor/src/Struct/Glyph.elm b/src/roster-editor/src/Struct/Glyph.elm
index a5ff408..7445084 100644
--- a/src/roster-editor/src/Struct/Glyph.elm
+++ b/src/roster-editor/src/Struct/Glyph.elm
@@ -47,7 +47,7 @@ get_omnimods g = g.omnimods
decoder : (Json.Decode.Decoder Type)
decoder =
- (Json.Decode.Pipeline.decode
+ (Json.Decode.succeed
Type
|> (Json.Decode.Pipeline.required "id" Json.Decode.string)
|> (Json.Decode.Pipeline.required "nam" Json.Decode.string)
diff --git a/src/roster-editor/src/Struct/GlyphBoard.elm b/src/roster-editor/src/Struct/GlyphBoard.elm
index 9329061..6ee41a4 100644
--- a/src/roster-editor/src/Struct/GlyphBoard.elm
+++ b/src/roster-editor/src/Struct/GlyphBoard.elm
@@ -74,7 +74,7 @@ get_omnimods_with_glyphs glyphs board =
decoder : (Json.Decode.Decoder Type)
decoder =
- (Json.Decode.Pipeline.decode
+ (Json.Decode.succeed
Type
|> (Json.Decode.Pipeline.required "id" Json.Decode.string)
|> (Json.Decode.Pipeline.required "nam" Json.Decode.string)
diff --git a/src/roster-editor/src/Struct/Inventory.elm b/src/roster-editor/src/Struct/Inventory.elm
index 85e0d07..9d8de60 100644
--- a/src/roster-editor/src/Struct/Inventory.elm
+++ b/src/roster-editor/src/Struct/Inventory.elm
@@ -65,7 +65,7 @@ empty =
decoder : (Json.Decode.Decoder Type)
decoder =
-- TODO
- (Json.Decode.Pipeline.decode
+ (Json.Decode.succeed
Type
|> (Json.Decode.Pipeline.hardcoded (Set.empty))
|> (Json.Decode.Pipeline.hardcoded (Set.empty))
diff --git a/src/roster-editor/src/Struct/Omnimods.elm b/src/roster-editor/src/Struct/Omnimods.elm
index 4b43ec4..31f5939 100644
--- a/src/roster-editor/src/Struct/Omnimods.elm
+++ b/src/roster-editor/src/Struct/Omnimods.elm
@@ -54,7 +54,7 @@ generic_mods_decoder =
(Json.Decode.list
(Json.Decode.map
(\gm -> (gm.t, gm.v))
- (Json.Decode.Pipeline.decode
+ (Json.Decode.succeed
GenericMod
|> (Json.Decode.Pipeline.required "t" Json.Decode.string)
|> (Json.Decode.Pipeline.required "v" Json.Decode.int)
@@ -86,7 +86,7 @@ scale_dict_value modifier entry_name value =
--------------------------------------------------------------------------------
decoder : (Json.Decode.Decoder Type)
decoder =
- (Json.Decode.Pipeline.decode
+ (Json.Decode.succeed
Type
|> (Json.Decode.Pipeline.required "attm" generic_mods_decoder)
|> (Json.Decode.Pipeline.required "stam" generic_mods_decoder)
diff --git a/src/roster-editor/src/Struct/Portrait.elm b/src/roster-editor/src/Struct/Portrait.elm
index 400b64d..bcdf8ae 100644
--- a/src/roster-editor/src/Struct/Portrait.elm
+++ b/src/roster-editor/src/Struct/Portrait.elm
@@ -59,7 +59,7 @@ get_icon_id p = p.icon_id
decoder : (Json.Decode.Decoder Type)
decoder =
- (Json.Decode.Pipeline.decode
+ (Json.Decode.succeed
Type
|> (Json.Decode.Pipeline.required "id" Json.Decode.string)
|> (Json.Decode.Pipeline.required "nam" Json.Decode.string)
diff --git a/src/roster-editor/src/Struct/Weapon.elm b/src/roster-editor/src/Struct/Weapon.elm
index 3556533..5616720 100644
--- a/src/roster-editor/src/Struct/Weapon.elm
+++ b/src/roster-editor/src/Struct/Weapon.elm
@@ -85,7 +85,7 @@ decoder : (Json.Decode.Decoder Type)
decoder =
(Json.Decode.map
(\e -> {e | damage_sum = (Struct.Omnimods.get_damage_sum e.omnimods)})
- (Json.Decode.Pipeline.decode
+ (Json.Decode.succeed
Type
|> (Json.Decode.Pipeline.required "id" Json.Decode.string)
|> (Json.Decode.Pipeline.required "nam" Json.Decode.string)
diff --git a/src/roster-editor/src/Update/HandleServerReply.elm b/src/roster-editor/src/Update/HandleServerReply.elm
index abd2c0a..7392781 100644
--- a/src/roster-editor/src/Update/HandleServerReply.elm
+++ b/src/roster-editor/src/Update/HandleServerReply.elm
@@ -5,11 +5,14 @@ import Dict
import Http
+import Url
-- Shared ----------------------------------------------------------------------
import Action.Ports
import Struct.Flags
+import Util.Http
+
-- Roster Editor ---------------------------------------------------------------
import Constants.IO
@@ -70,7 +73,7 @@ disconnected current_state =
Constants.IO.base_url
++ "/login/?action=disconnect&goto="
++
- (Http.encodeUri
+ (Url.percentEncode
(
"/roster-editor/?"
++ (Struct.Flags.get_params_as_url model.flags)
@@ -197,7 +200,10 @@ apply_to model query_result =
(Result.Err error) ->
(
(Struct.Model.invalidate
- (Struct.Error.new Struct.Error.Networking (toString error))
+ (Struct.Error.new
+ Struct.Error.Networking
+ (Util.Http.error_to_string error)
+ )
model
),
Cmd.none
diff --git a/src/roster-editor/src/Update/SelectCharacter.elm b/src/roster-editor/src/Update/SelectCharacter.elm
index 56db669..e85dbdd 100644
--- a/src/roster-editor/src/Update/SelectCharacter.elm
+++ b/src/roster-editor/src/Update/SelectCharacter.elm
@@ -35,7 +35,7 @@ apply_to model target_char_ix =
Struct.Error.Programming
(
"Unknown character index selected \""
- ++ (toString target_char_ix)
+ ++ (String.fromInt target_char_ix)
++ "\"."
)
)
diff --git a/src/roster-editor/src/View/ArmorSelection.elm b/src/roster-editor/src/View/ArmorSelection.elm
index 8f8118e..5ea8c98 100644
--- a/src/roster-editor/src/View/ArmorSelection.elm
+++ b/src/roster-editor/src/View/ArmorSelection.elm
@@ -27,7 +27,7 @@ get_mod_html mod =
]
[
(Html.text
- (category ++ ": " ++ (toString value))
+ (category ++ ": " ++ (String.fromInt value))
)
]
)
diff --git a/src/roster-editor/src/View/Character.elm b/src/roster-editor/src/View/Character.elm
index 4a943c1..3f44a80 100644
--- a/src/roster-editor/src/View/Character.elm
+++ b/src/roster-editor/src/View/Character.elm
@@ -91,16 +91,18 @@ 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 ->
+ let battle_ix = (Struct.Character.get_battle_index char) in
+ if (battle_ix == -1)
+ then
+ (Util.Html.nothing)
+ else
(Html.div
[
(Html.Attributes.class "character-portrait-battle-index"),
(Html.Attributes.class "clickable")
]
[
- (Html.text (toString battle_ix))
+ (Html.text (String.fromInt battle_ix))
]
)
diff --git a/src/roster-editor/src/View/CharacterCard.elm b/src/roster-editor/src/View/CharacterCard.elm
index 7def8ae..4ced7d5 100644
--- a/src/roster-editor/src/View/CharacterCard.elm
+++ b/src/roster-editor/src/View/CharacterCard.elm
@@ -72,7 +72,7 @@ get_health_bar char =
)
in
(View.Gauge.get_html
- ("HP: " ++ (toString max))
+ ("HP: " ++ (String.fromInt max))
100.0
[(Html.Attributes.class "character-card-health")]
[]
@@ -104,7 +104,7 @@ get_movement_bar char =
(
"MP: "
++
- (toString
+ (String.fromInt
(Struct.Statistics.get_movement_points
(Struct.Character.get_statistics char)
)
@@ -142,7 +142,7 @@ get_weapon_field_header damage_multiplier weapon =
(
"~"
++
- (toString
+ (String.fromInt
(ceiling
(
(toFloat (Struct.Weapon.get_damage_sum weapon))
@@ -151,9 +151,15 @@ get_weapon_field_header damage_multiplier weapon =
)
)
++ " dmg @ ["
- ++ (toString (Struct.Weapon.get_defense_range weapon))
+ ++
+ (String.fromInt
+ (Struct.Weapon.get_defense_range weapon)
+ )
++ ", "
- ++ (toString (Struct.Weapon.get_attack_range weapon))
+ ++
+ (String.fromInt
+ (Struct.Weapon.get_attack_range weapon)
+ )
++ "]"
)
)
@@ -173,7 +179,7 @@ get_mod_html mod =
]
[
(Html.text
- (category ++ ": " ++ (toString value))
+ (category ++ ": " ++ (String.fromInt value))
)
]
)
@@ -192,7 +198,7 @@ get_multiplied_mod_html multiplier mod =
(
category
++ ": "
- ++ (toString (ceiling ((toFloat value) * multiplier)))
+ ++ (String.fromInt (ceiling ((toFloat value) * multiplier)))
)
)
]
@@ -322,7 +328,7 @@ stat_val val perc =
[
(Html.text
(
- (toString val)
+ (String.fromInt val)
++
(
if perc
diff --git a/src/roster-editor/src/View/CharacterIcon.elm b/src/roster-editor/src/View/CharacterIcon.elm
index 4470b4a..d7934d3 100644
--- a/src/roster-editor/src/View/CharacterIcon.elm
+++ b/src/roster-editor/src/View/CharacterIcon.elm
@@ -82,16 +82,20 @@ get_alliance_class model char =
get_position_style : (
Struct.Character.Type ->
- (Html.Attribute Struct.Event.Type)
+ (List (Html.Attribute Struct.Event.Type))
)
get_position_style char =
let char_loc = (Struct.Character.get_location char) in
- (Html.Attributes.style
- [
- ("top", ((toString (char_loc.y * Constants.UI.tile_size)) ++ "px")),
- ("left", ((toString (char_loc.x * Constants.UI.tile_size)) ++ "px"))
- ]
- )
+ [
+ (Html.Attributes.style
+ "top"
+ ((String.fromInt (char_loc.y * Constants.UI.tile_size)) ++ "px")
+ ),
+ (Html.Attributes.style
+ "left"
+ ((String.fromInt (char_loc.x * Constants.UI.tile_size)) ++ "px")
+ )
+ ]
get_focus_class : (
Struct.Model.Type ->
@@ -127,7 +131,7 @@ get_body_html char =
(Html.Attributes.class
(
"asset-character-team-body-"
- ++ (toString (Struct.Character.get_player_ix char))
+ ++ (String.fromInt (Struct.Character.get_player_ix char))
)
)
]
@@ -180,21 +184,24 @@ get_actual_html : (
)
get_actual_html model char =
(Html.div
- [
- (Html.Attributes.class "tiled"),
- (Html.Attributes.class "character-icon"),
- (get_animation_class model char),
- (get_activation_level_class char),
- (get_alliance_class model char),
- (get_position_style char),
- (get_focus_class model char),
- (Html.Attributes.class "clickable"),
- (Html.Events.onClick
- (Struct.Event.CharacterSelected
- (Struct.Character.get_index char)
+ (
+ [
+ (Html.Attributes.class "tiled"),
+ (Html.Attributes.class "character-icon"),
+ (get_animation_class model char),
+ (get_activation_level_class char),
+ (get_alliance_class model char),
+ (get_focus_class model char),
+ (Html.Attributes.class "clickable"),
+ (Html.Events.onClick
+ (Struct.Event.CharacterSelected
+ (Struct.Character.get_index char)
+ )
)
- )
- ]
+ ]
+ ++
+ (get_position_style char)
+ )
[
(get_body_html char),
(get_head_html char),
diff --git a/src/roster-editor/src/View/Gauge.elm b/src/roster-editor/src/View/Gauge.elm
index 2b9c4e0..09fc9c3 100644
--- a/src/roster-editor/src/View/Gauge.elm
+++ b/src/roster-editor/src/View/Gauge.elm
@@ -4,13 +4,13 @@ module View.Gauge exposing (get_html)
import Html
import Html.Attributes
--- Map -------------------------------------------------------------------
+-- Roster Editor ---------------------------------------------------------------
import Struct.Event
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_text_div: (
+get_text_div : (
String ->
List (Html.Attribute Struct.Event.Type) ->
(Html.Html Struct.Event.Type)
@@ -26,7 +26,7 @@ get_text_div text extra_txt_attr =
]
)
-get_bar_div: (
+get_bar_div : (
Float ->
List (Html.Attribute Struct.Event.Type) ->
(Html.Html Struct.Event.Type)
@@ -36,9 +36,8 @@ get_bar_div percent extra_bar_attr =
(
[
(Html.Attributes.style
- [
- ("width", ((toString percent) ++ "%"))
- ]
+ "width"
+ ((String.fromFloat percent) ++ "%")
),
(Html.Attributes.class
"gauge-bar"
diff --git a/src/roster-editor/src/View/GlyphBoardSelection.elm b/src/roster-editor/src/View/GlyphBoardSelection.elm
index 525ab8d..bec3492 100644
--- a/src/roster-editor/src/View/GlyphBoardSelection.elm
+++ b/src/roster-editor/src/View/GlyphBoardSelection.elm
@@ -27,7 +27,7 @@ get_mod_html mod =
]
[
(Html.text
- (category ++ ": " ++ (toString value))
+ (category ++ ": " ++ (String.fromInt value))
)
]
)
diff --git a/src/roster-editor/src/View/GlyphManagement.elm b/src/roster-editor/src/View/GlyphManagement.elm
index c779c7a..8665e09 100644
--- a/src/roster-editor/src/View/GlyphManagement.elm
+++ b/src/roster-editor/src/View/GlyphManagement.elm
@@ -29,7 +29,7 @@ get_mod_html mod =
]
[
(Html.text
- (category ++ ": " ++ (toString value))
+ (category ++ ": " ++ (String.fromInt value))
)
]
)
@@ -51,7 +51,7 @@ get_glyph_html modifier (index, glyph) =
(
(Struct.Glyph.get_name glyph)
++ " ("
- ++ (toString modifier)
+ ++ (String.fromInt modifier)
++ "%)"
)
),
diff --git a/src/roster-editor/src/View/GlyphSelection.elm b/src/roster-editor/src/View/GlyphSelection.elm
index 8631a0d..22a5ff6 100644
--- a/src/roster-editor/src/View/GlyphSelection.elm
+++ b/src/roster-editor/src/View/GlyphSelection.elm
@@ -27,7 +27,7 @@ get_mod_html mod =
]
[
(Html.text
- (category ++ ": " ++ (toString value))
+ (category ++ ": " ++ (String.fromInt value))
)
]
)
diff --git a/src/roster-editor/src/View/SubMenu/Status/TileInfo.elm b/src/roster-editor/src/View/SubMenu/Status/TileInfo.elm
index 1dbe8f6..bc382fc 100644
--- a/src/roster-editor/src/View/SubMenu/Status/TileInfo.elm
+++ b/src/roster-editor/src/View/SubMenu/Status/TileInfo.elm
@@ -32,7 +32,7 @@ get_icon tile =
(Html.Attributes.class
(
"tile-variant-"
- ++ (toString (Struct.Tile.get_local_variant_ix tile))
+ ++ (String.fromInt (Struct.Tile.get_local_variant_ix tile))
)
)
]
@@ -68,7 +68,7 @@ get_cost tile =
then
"Obstructed"
else
- ("Cost: " ++ (toString cost))
+ ("Cost: " ++ (String.fromInt cost))
in
(Html.div
[
@@ -94,9 +94,9 @@ get_location tile =
(Html.text
(
"{x: "
- ++ (toString tile_location.x)
+ ++ (String.fromInt tile_location.x)
++ "; y: "
- ++ (toString tile_location.y)
+ ++ (String.fromInt tile_location.y)
++ "}"
)
)
@@ -114,7 +114,7 @@ get_mod_html mod =
]
[
(Html.text
- (category ++ ": " ++ (toString value))
+ (category ++ ": " ++ (String.fromInt value))
)
]
)
diff --git a/src/roster-editor/src/View/SubMenu/Timeline.elm b/src/roster-editor/src/View/SubMenu/Timeline.elm
deleted file mode 100644
index a0978b5..0000000
--- a/src/roster-editor/src/View/SubMenu/Timeline.elm
+++ /dev/null
@@ -1,95 +0,0 @@
-module View.SubMenu.Timeline exposing (get_html)
-
--- Elm -------------------------------------------------------------------------
-import Array
-
-import Html
-import Html.Attributes
---import Html.Events
-import Html.Lazy
-
--- Map -------------------------------------------------------------------
-import Struct.Character
-import Struct.Event
-import Struct.TurnResult
-import Struct.Model
-
-import View.SubMenu.Timeline.Attack
-import View.SubMenu.Timeline.Movement
-import View.SubMenu.Timeline.WeaponSwitch
-import View.SubMenu.Timeline.PlayerVictory
-import View.SubMenu.Timeline.PlayerDefeat
-import View.SubMenu.Timeline.PlayerTurnStart
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_turn_result_html : (
- (Array.Array Struct.Character.Type) ->
- Int ->
- Struct.TurnResult.Type ->
- (Html.Html Struct.Event.Type)
- )
-get_turn_result_html characters player_ix turn_result =
- case turn_result of
- (Struct.TurnResult.Moved movement) ->
- (View.SubMenu.Timeline.Movement.get_html
- characters
- player_ix
- movement
- )
-
- (Struct.TurnResult.Attacked attack) ->
- (View.SubMenu.Timeline.Attack.get_html
- characters
- player_ix
- attack
- )
-
- (Struct.TurnResult.SwitchedWeapon weapon_switch) ->
- (View.SubMenu.Timeline.WeaponSwitch.get_html
- characters
- player_ix
- weapon_switch
- )
-
- (Struct.TurnResult.PlayerWon pvict) ->
- (View.SubMenu.Timeline.PlayerVictory.get_html pvict)
-
- (Struct.TurnResult.PlayerLost pdefeat) ->
- (View.SubMenu.Timeline.PlayerDefeat.get_html pdefeat)
-
- (Struct.TurnResult.PlayerTurnStarted pturns) ->
- (View.SubMenu.Timeline.PlayerTurnStart.get_html pturns)
-
-true_get_html : (
- (Array.Array Struct.Character.Type) ->
- Int ->
- (Array.Array Struct.TurnResult.Type) ->
- (Html.Html Struct.Event.Type)
- )
-true_get_html characters player_ix turn_results =
- (Html.div
- [
- (Html.Attributes.class "tabmenu-content"),
- (Html.Attributes.class "tabmenu-timeline-tab")
- ]
- (Array.toList
- (Array.map
- (get_turn_result_html characters player_ix)
- turn_results
- )
- )
- )
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
-get_html model =
- (Html.Lazy.lazy3
- (true_get_html)
- model.characters
- model.player_ix
- model.timeline
- )
diff --git a/src/roster-editor/src/View/SubMenu/Timeline/Attack.elm b/src/roster-editor/src/View/SubMenu/Timeline/Attack.elm
deleted file mode 100644
index 6ba8cd0..0000000
--- a/src/roster-editor/src/View/SubMenu/Timeline/Attack.elm
+++ /dev/null
@@ -1,164 +0,0 @@
-module View.SubMenu.Timeline.Attack exposing (get_html)
-
--- Elm -------------------------------------------------------------------------
-import Array
-
-import Html
-import Html.Attributes
---import Html.Events
-
--- Map -------------------------------------------------------------------
-import Struct.Attack
-import Struct.Event
-import Struct.TurnResult
-import Struct.Character
-
-import View.Character
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_title_html : (
- Struct.Character.Type ->
- Struct.Character.Type ->
- (Html.Html Struct.Event.Type)
- )
-get_title_html attacker defender =
- (Html.div
- [
- (Html.Attributes.class "timeline-attack-title")
- ]
- [
- (Html.text
- (
- (Struct.Character.get_name attacker)
- ++ " attacked "
- ++ (Struct.Character.get_name defender)
- ++ "!"
- )
- )
- ]
- )
-
-get_effect_text : Struct.Attack.Type -> String
-get_effect_text attack =
- (
- (
- case attack.precision of
- Struct.Attack.Hit -> " hit for "
- Struct.Attack.Graze -> " grazed for "
- Struct.Attack.Miss -> " missed."
- )
- ++
- (
- if (attack.precision == Struct.Attack.Miss)
- then
- ""
- else
- (
- ((toString attack.damage) ++ " damage")
- ++
- (
- if (attack.critical)
- then " (Critical Hit)."
- else "."
- )
- )
- )
- )
-
-get_attack_html : (
- Struct.Character.Type ->
- Struct.Character.Type ->
- Struct.Attack.Type ->
- (Html.Html Struct.Event.Type)
- )
-get_attack_html attacker defender attack =
- let
- attacker_name = (Struct.Character.get_name attacker)
- defender_name = (Struct.Character.get_name defender)
- in
- (Html.div
- []
- [
- (Html.text
- (
- case (attack.order, attack.parried) of
- (Struct.Attack.Counter, True) ->
- (
- defender_name
- ++ " attempted to strike back, but "
- ++ attacker_name
- ++ " parried, and "
- ++ (get_effect_text attack)
- )
-
- (Struct.Attack.Counter, _) ->
- (
- defender_name
- ++ " striked back, and "
- ++ (get_effect_text attack)
- )
-
- (_, True) ->
- (
- attacker_name
- ++ " attempted a hit, but "
- ++ defender_name
- ++ " parried, and "
- ++ (get_effect_text attack)
- )
-
- (_, _) ->
- (attacker_name ++ " " ++ (get_effect_text attack))
- )
- )
- ]
- )
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_html : (
- (Array.Array Struct.Character.Type) ->
- Int ->
- Struct.TurnResult.Attack ->
- (Html.Html Struct.Event.Type)
- )
-get_html characters player_ix attack =
- case
- (
- (Array.get attack.attacker_index characters),
- (Array.get attack.defender_index characters)
- )
- of
- ((Just atkchar), (Just defchar)) ->
- (Html.div
- [
- (Html.Attributes.class "timeline-element"),
- (Html.Attributes.class "timeline-attack")
- ]
- (
- [
- (View.Character.get_portrait_html player_ix atkchar),
- (View.Character.get_portrait_html player_ix defchar),
- (get_title_html atkchar defchar)
- ]
- ++
- (List.map
- (get_attack_html atkchar defchar)
- attack.sequence
- )
- )
- )
-
- _ ->
- (Html.div
- [
- (Html.Attributes.class "timeline-element"),
- (Html.Attributes.class "timeline-attack")
- ]
- [
- (Html.text "Error: Attack with unknown characters")
- ]
- )
diff --git a/src/roster-editor/src/View/SubMenu/Timeline/Movement.elm b/src/roster-editor/src/View/SubMenu/Timeline/Movement.elm
deleted file mode 100644
index e3be53d..0000000
--- a/src/roster-editor/src/View/SubMenu/Timeline/Movement.elm
+++ /dev/null
@@ -1,62 +0,0 @@
-module View.SubMenu.Timeline.Movement exposing (get_html)
-
--- Elm -------------------------------------------------------------------------
-import Array
-
-import Html
-import Html.Attributes
---import Html.Events
-
--- Map -------------------------------------------------------------------
-import Struct.Event
-import Struct.TurnResult
-import Struct.Character
-
-import View.Character
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_html : (
- (Array.Array Struct.Character.Type) ->
- Int ->
- Struct.TurnResult.Movement ->
- (Html.Html Struct.Event.Type)
- )
-get_html characters player_ix movement =
- case (Array.get movement.character_index characters) of
- (Just char) ->
- (Html.div
- [
- (Html.Attributes.class "timeline-element"),
- (Html.Attributes.class "timeline-movement")
- ]
- [
- (View.Character.get_portrait_html player_ix char),
- (Html.text
- (
- (Struct.Character.get_name char)
- ++ " moved to ("
- ++ (toString movement.destination.x)
- ++ ", "
- ++ (toString movement.destination.y)
- ++ ")."
- )
- )
- ]
- )
-
- _ ->
- (Html.div
- [
- (Html.Attributes.class "timeline-element"),
- (Html.Attributes.class "timeline-movement")
- ]
- [
- (Html.text "Error: Moving with unknown character")
- ]
- )
diff --git a/src/roster-editor/src/View/SubMenu/Timeline/PlayerDefeat.elm b/src/roster-editor/src/View/SubMenu/Timeline/PlayerDefeat.elm
deleted file mode 100644
index 1d91c9a..0000000
--- a/src/roster-editor/src/View/SubMenu/Timeline/PlayerDefeat.elm
+++ /dev/null
@@ -1,38 +0,0 @@
-module View.SubMenu.Timeline.PlayerDefeat exposing (get_html)
-
--- Elm -------------------------------------------------------------------------
-import Html
-import Html.Attributes
---import Html.Events
-
--- Map -------------------------------------------------------------------
-import Struct.Event
-import Struct.TurnResult
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_html : (
- Struct.TurnResult.PlayerDefeat ->
- (Html.Html Struct.Event.Type)
- )
-get_html pdefeat =
- (Html.div
- [
- (Html.Attributes.class "timeline-element"),
- (Html.Attributes.class "timeline-player-defeat")
- ]
- [
- (Html.text
- (
- "Player "
- ++ (toString pdefeat.player_index)
- ++ " has been eliminated."
- )
- )
- ]
- )
diff --git a/src/roster-editor/src/View/SubMenu/Timeline/PlayerTurnStart.elm b/src/roster-editor/src/View/SubMenu/Timeline/PlayerTurnStart.elm
deleted file mode 100644
index 233e03c..0000000
--- a/src/roster-editor/src/View/SubMenu/Timeline/PlayerTurnStart.elm
+++ /dev/null
@@ -1,38 +0,0 @@
-module View.SubMenu.Timeline.PlayerTurnStart exposing (get_html)
-
--- Elm -------------------------------------------------------------------------
-import Html
-import Html.Attributes
---import Html.Events
-
--- Map -------------------------------------------------------------------
-import Struct.Event
-import Struct.TurnResult
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_html : (
- Struct.TurnResult.PlayerTurnStart ->
- (Html.Html Struct.Event.Type)
- )
-get_html pturns =
- (Html.div
- [
- (Html.Attributes.class "timeline-element"),
- (Html.Attributes.class "timeline-turn-start")
- ]
- [
- (Html.text
- (
- "Player "
- ++ (toString pturns.player_index)
- ++ "'s turn has started."
- )
- )
- ]
- )
diff --git a/src/roster-editor/src/View/SubMenu/Timeline/PlayerVictory.elm b/src/roster-editor/src/View/SubMenu/Timeline/PlayerVictory.elm
deleted file mode 100644
index 9728f04..0000000
--- a/src/roster-editor/src/View/SubMenu/Timeline/PlayerVictory.elm
+++ /dev/null
@@ -1,38 +0,0 @@
-module View.SubMenu.Timeline.PlayerVictory exposing (get_html)
-
--- Elm -------------------------------------------------------------------------
-import Html
-import Html.Attributes
---import Html.Events
-
--- Map -------------------------------------------------------------------
-import Struct.Event
-import Struct.TurnResult
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_html : (
- Struct.TurnResult.PlayerVictory ->
- (Html.Html Struct.Event.Type)
- )
-get_html pvict =
- (Html.div
- [
- (Html.Attributes.class "timeline-element"),
- (Html.Attributes.class "timeline-player-victory")
- ]
- [
- (Html.text
- (
- "Player "
- ++ (toString pvict.player_index)
- ++ " has won the map."
- )
- )
- ]
- )
diff --git a/src/roster-editor/src/View/SubMenu/Timeline/WeaponSwitch.elm b/src/roster-editor/src/View/SubMenu/Timeline/WeaponSwitch.elm
deleted file mode 100644
index 2e874b0..0000000
--- a/src/roster-editor/src/View/SubMenu/Timeline/WeaponSwitch.elm
+++ /dev/null
@@ -1,58 +0,0 @@
-module View.SubMenu.Timeline.WeaponSwitch exposing (get_html)
-
--- Elm -------------------------------------------------------------------------
-import Array
-
-import Html
-import Html.Attributes
---import Html.Events
-
--- Map -------------------------------------------------------------------
-import Struct.Event
-import Struct.TurnResult
-import Struct.Character
-
-import View.Character
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_html : (
- (Array.Array Struct.Character.Type) ->
- Int ->
- Struct.TurnResult.WeaponSwitch ->
- (Html.Html Struct.Event.Type)
- )
-get_html characters player_ix weapon_switch =
- case (Array.get weapon_switch.character_index characters) of
- (Just char) ->
- (Html.div
- [
- (Html.Attributes.class "timeline-element"),
- (Html.Attributes.class "timeline-weapon-switch")
- ]
- [
- (View.Character.get_portrait_html player_ix char),
- (Html.text
- (
- (Struct.Character.get_name char)
- ++ " switched weapons."
- )
- )
- ]
- )
-
- _ ->
- (Html.div
- [
- (Html.Attributes.class "timeline-element"),
- (Html.Attributes.class "timeline-weapon-switch")
- ]
- [
- (Html.text "Error: Unknown character switched weapons")
- ]
- )
diff --git a/src/roster-editor/src/View/WeaponSelection.elm b/src/roster-editor/src/View/WeaponSelection.elm
index 04d7410..c3dd805 100644
--- a/src/roster-editor/src/View/WeaponSelection.elm
+++ b/src/roster-editor/src/View/WeaponSelection.elm
@@ -27,7 +27,7 @@ get_mod_html mod =
]
[
(Html.text
- (category ++ ": " ++ (toString value))
+ (category ++ ": " ++ (String.fromInt value))
)
]
)
@@ -66,11 +66,19 @@ get_weapon_html weapon =
(
"~"
++
- (toString (Struct.Weapon.get_damage_sum weapon))
+ (String.fromInt
+ (Struct.Weapon.get_damage_sum weapon)
+ )
++ " dmg @ ["
- ++ (toString (Struct.Weapon.get_defense_range weapon))
+ ++
+ (String.fromInt
+ (Struct.Weapon.get_defense_range weapon)
+ )
++ ", "
- ++ (toString (Struct.Weapon.get_attack_range weapon))
+ ++
+ (String.fromInt
+ (Struct.Weapon.get_attack_range weapon)
+ )
++ "]"
)
)
diff --git a/src/roster-editor/www/index.html b/src/roster-editor/www/index.html
index a2a6034..3ffd5af 100644
--- a/src/roster-editor/www/index.html
+++ b/src/roster-editor/www/index.html
@@ -8,6 +8,7 @@
<link rel="icon" type="image/x-icon" href="/favicon.ico">
</head>
<body>
+ <div id="elm-element"></div>
<script src="script/main.js"></script>
<script src="../global/script/session.js"></script>
<script src="../global/script/urlparams.js"></script>
@@ -16,12 +17,16 @@
tacticians_online.session.load();
tacticians_online.app =
- Elm.Main.fullscreen
+ Elm.Main.init
(
{
- user_id: tacticians_online.session.get_user_id(),
- token: tacticians_online.session.get_token(),
- url_params: tacticians_online.urlparams.get_parameters()
+ flags:
+ {
+ user_id: tacticians_online.session.get_user_id(),
+ token: tacticians_online.session.get_token(),
+ url_params: tacticians_online.urlparams.get_parameters()
+ },
+ node: document.getElementById("elm-element")
}
);