starts cleaning up a bit
This commit is contained in:
27
src/Main.elm
27
src/Main.elm
@@ -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]
|
||||||
|
|||||||
3
tmux.sh
3
tmux.sh
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user