starts cleaning up a bit

This commit is contained in:
2019-11-05 15:22:14 +01:00
parent 52b66eed97
commit d56ca38dcb
2 changed files with 22 additions and 8 deletions

View File

@@ -13,6 +13,8 @@ import Json.Decode exposing (Decoder, field, list, string, int, succeed)
import Json.Encode as E
import Url.Parser as P exposing (Parser, (</>), oneOf, s)
import Set exposing (Set)
-- Main
main : Program () Model Msg
@@ -58,17 +60,28 @@ init flags url key =
Just r -> r
Nothing -> PlayerChest
in
( Model (State key route "" False Nothing Nothing) blankPlayer [] Nothing Nothing Nothing Nothing, fetchInitialData 0)
( Model
(State key route "" False Nothing Nothing)
blankPlayer
[]
Nothing
Nothing
Nothing
Nothing
, fetchInitialData 0)
fetchInitialData : Int -> Cmd Msg
fetchInitialData playerId =
Cmd.batch [ initPlayer playerId
, fetchShopInventory
, fetchGroupLoot
]
Cmd.batch
[ initPlayer playerId
, fetchShopInventory
, fetchGroupLoot
]
---
-- PLAYER
--
---
type alias Player =
{ id: Int
, name: String
@@ -77,7 +90,7 @@ type alias Player =
}
blankPlayer =
Player 0 "Loading" 0 (Wealth 0 0 0 0)
Player 0 "Loot-a-lot" 0 (Wealth 0 0 0 0)
initPlayer id =
Cmd.batch [fetchPlayer id, fetchLoot id, fetchClaims id]