summaryrefslogtreecommitdiff |
diff options
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) |