summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2019-03-22 19:02:58 +0100 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2019-03-22 19:02:58 +0100 |
commit | caf0e9497229abb56a7428e60b19ee3d05fa7e9c (patch) | |
tree | 21272443e733fb9396947f969e01cfe85e6481bd /src/shared/battle-characters/BattleCharacters/Struct/Glyph.elm | |
parent | 397e54affd6d434ea5d055f34cbac637867cde0a (diff) |
[Broken] More factoring in progress...
Diffstat (limited to 'src/shared/battle-characters/BattleCharacters/Struct/Glyph.elm')
-rw-r--r-- | src/shared/battle-characters/BattleCharacters/Struct/Glyph.elm | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/shared/battle-characters/BattleCharacters/Struct/Glyph.elm b/src/shared/battle-characters/BattleCharacters/Struct/Glyph.elm new file mode 100644 index 0000000..c277b20 --- /dev/null +++ b/src/shared/battle-characters/BattleCharacters/Struct/Glyph.elm @@ -0,0 +1,66 @@ +module BattleCharacters.Struct.Glyph exposing + ( + Type, + Ref, + get_name, + get_id, + get_omnimods, + none, + default, + decoder + ) + +-- Elm ------------------------------------------------------------------------- +import Json.Decode +import Json.Decode.Pipeline + +-- Battle ---------------------------------------------------------------------- +import Battle.Struct.Omnimods + +-------------------------------------------------------------------------------- +-- TYPES ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- +type alias Type = + { + id : String, + name : String, + omnimods : Battle.Struct.Omnimods.Type + } + +type alias Ref = String + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_id : Type -> String +get_id g = g.id + +get_name : Type -> String +get_name g = g.name + +get_omnimods : Type -> Battle.Struct.Omnimods.Type +get_omnimods g = g.omnimods + +decoder : (Json.Decode.Decoder Type) +decoder = + (Json.Decode.succeed + Type + |> (Json.Decode.Pipeline.required "id" Json.Decode.string) + |> (Json.Decode.Pipeline.required "nam" Json.Decode.string) + |> (Json.Decode.Pipeline.required "omni" Battle.Struct.Omnimods.decoder) + ) + +none : Type +none = + { + id = "0", + name = "Empty", + omnimods = (Battle.Struct.Omnimods.none) + } + +default : Type +default = (none) |