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

View File

@@ -2,6 +2,7 @@
tmux new-session -d -s elm tmux new-session -d -s elm
tmux split-window -v "elm reactor --port 8080" tmux split-window -v "elm reactor --port 8080"
tmux split-window -h -c $HOME/Projets/rust/lootalot "cargo run" tmux split-window -v -c $HOME/Projets/rust/lootalot "cargo run"
tmux select-pane -U
tmux select-pane -U tmux select-pane -U
tmux attach-session -t elm tmux attach-session -t elm