exploring...

This commit is contained in:
2019-11-02 00:16:44 +01:00
parent 4ea22c2d49
commit 1a23eb4c31
2 changed files with 243 additions and 147 deletions

242
main.js
View File

@@ -5297,10 +5297,14 @@ var $elm$core$Task$perform = F2(
A2($elm$core$Task$map, toMessage, task)));
});
var $elm$browser$Browser$application = _Browser_application;
var $author$project$Main$GroupLoot = {$: 'GroupLoot'};
var $author$project$Main$Model = F6(
function (key, route, player, loot, groupLoot, error) {
return {error: error, groupLoot: groupLoot, key: key, loot: loot, player: player, route: route};
var $author$project$Main$Model = F5(
function (state, player, loot, groupLoot, merchantItems) {
return {groupLoot: groupLoot, loot: loot, merchantItems: merchantItems, player: player, state: state};
});
var $author$project$Main$PlayerChest = {$: 'PlayerChest'};
var $author$project$Main$State = F4(
function (navKey, route, error, menuOpen) {
return {error: error, menuOpen: menuOpen, navKey: navKey, route: route};
});
var $author$project$Main$Player = F4(
function (id, name, debt, wealth) {
@@ -5314,7 +5318,7 @@ var $author$project$Main$blankPlayer = A4(
$author$project$Main$Player,
0,
'Loading',
100,
0,
A4($author$project$Main$Wealth, 0, 0, 0, 0));
var $elm$core$Platform$Cmd$batch = _Platform_batch;
var $author$project$Main$GotLoot = function (a) {
@@ -6291,9 +6295,9 @@ var $elm$url$Url$Parser$parse = F2(
url.fragment,
$elm$core$Basics$identity)));
});
var $author$project$Main$GroupLoot = {$: 'GroupLoot'};
var $author$project$Main$Merchant = {$: 'Merchant'};
var $author$project$Main$NewLoot = {$: 'NewLoot'};
var $author$project$Main$PlayerChest = {$: 'PlayerChest'};
var $elm$url$Url$Parser$Parser = function (a) {
return {$: 'Parser', a: a};
};
@@ -6391,11 +6395,11 @@ var $elm$url$Url$Parser$top = $elm$url$Url$Parser$Parser(
var $author$project$Main$routeParser = $elm$url$Url$Parser$oneOf(
_List_fromArray(
[
A2($elm$url$Url$Parser$map, $author$project$Main$GroupLoot, $elm$url$Url$Parser$top),
A2(
$elm$url$Url$Parser$map,
$author$project$Main$PlayerChest,
$author$project$Main$GroupLoot,
$elm$url$Url$Parser$s('coffre')),
A2($elm$url$Url$Parser$map, $author$project$Main$PlayerChest, $elm$url$Url$Parser$top),
A2(
$elm$url$Url$Parser$map,
$author$project$Main$Merchant,
@@ -6413,11 +6417,17 @@ var $author$project$Main$init = F3(
var r = _v0.a;
return r;
} else {
return $author$project$Main$GroupLoot;
return $author$project$Main$PlayerChest;
}
}();
return _Utils_Tuple2(
A6($author$project$Main$Model, key, route, $author$project$Main$blankPlayer, $elm$core$Maybe$Nothing, $elm$core$Maybe$Nothing, ''),
A5(
$author$project$Main$Model,
A4($author$project$Main$State, key, route, '', false),
$author$project$Main$blankPlayer,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing),
$author$project$Main$initPlayer(0));
});
var $elm$core$Platform$Sub$batch = _Platform_batch;
@@ -6434,6 +6444,17 @@ var $author$project$Main$printError = function (error) {
}
};
var $elm$browser$Browser$Navigation$pushUrl = _Browser_pushUrl;
var $author$project$Main$setError = F2(
function (error, model) {
var state = model.state;
return _Utils_update(
model,
{
state: _Utils_update(
state,
{error: error})
});
});
var $elm$url$Url$addPort = F2(
function (maybePort, starter) {
if (maybePort.$ === 'Nothing') {
@@ -6489,14 +6510,12 @@ var $author$project$Main$update = F2(
model,
A2(
$elm$browser$Browser$Navigation$pushUrl,
model.key,
model.state.navKey,
$elm$url$Url$toString(url)));
} else {
var href = urlRequest.a;
return _Utils_Tuple2(
_Utils_update(
model,
{error: 'Invalid request \'' + (href + '\'')}),
A2($author$project$Main$setError, 'Invalid request \'' + (href + '\''), model),
$elm$core$Platform$Cmd$none);
}
case 'UrlChanged':
@@ -6505,9 +6524,16 @@ var $author$project$Main$update = F2(
if (route.$ === 'Just') {
var page = route.a;
return _Utils_Tuple2(
_Utils_update(
model,
{route: page}),
function () {
var state = model.state;
return _Utils_update(
model,
{
state: _Utils_update(
state,
{route: page})
});
}(),
function () {
if (page.$ === 'GroupLoot') {
return $elm$core$Platform$Cmd$none;
@@ -6518,9 +6544,7 @@ var $author$project$Main$update = F2(
}());
} else {
return _Utils_Tuple2(
_Utils_update(
model,
{error: 'Invalid route'}),
A2($author$project$Main$setError, 'Invalid route', model),
$elm$core$Platform$Cmd$none);
}
case 'PlayerChanged':
@@ -6542,11 +6566,10 @@ var $author$project$Main$update = F2(
} else {
var error = result.a;
return _Utils_Tuple2(
_Utils_update(
model,
{
error: 'Fetching player... ' + $author$project$Main$printError(error)
}),
A2(
$author$project$Main$setError,
'Fetching player... ' + $author$project$Main$printError(error),
model),
$elm$core$Platform$Cmd$none);
}
default:
@@ -6563,15 +6586,15 @@ var $author$project$Main$update = F2(
} else {
var error = result.a;
return _Utils_Tuple2(
_Utils_update(
model,
{
error: 'Fetching loot... ' + $author$project$Main$printError(error)
}),
A2(
$author$project$Main$setError,
'Fetching loot... ' + $author$project$Main$printError(error),
model),
$elm$core$Platform$Cmd$none);
}
}
});
var $elm$html$Html$article = _VirtualDom_node('article');
var $elm$json$Json$Encode$string = _Json_wrap;
var $elm$html$Html$Attributes$stringProperty = F2(
function (key, string) {
@@ -6581,6 +6604,7 @@ var $elm$html$Html$Attributes$stringProperty = F2(
$elm$json$Json$Encode$string(string));
});
var $elm$html$Html$Attributes$class = $elm$html$Html$Attributes$stringProperty('className');
var $elm$html$Html$hr = _VirtualDom_node('hr');
var $elm$html$Html$p = _VirtualDom_node('p');
var $elm$html$Html$section = _VirtualDom_node('section');
var $elm$virtual_dom$VirtualDom$text = _VirtualDom_text;
@@ -6678,7 +6702,7 @@ var $author$project$Main$viewDebugSection = function (model) {
]),
_List_fromArray(
[
$elm$html$Html$text(model.error)
$elm$html$Html$text(model.state.error)
])),
A2(
$elm$html$Html$p,
@@ -6689,7 +6713,7 @@ var $author$project$Main$viewDebugSection = function (model) {
_List_fromArray(
[
$elm$html$Html$text(
'Route : ' + $elm$core$Debug$toString(model.route))
'Route : ' + $elm$core$Debug$toString(model.state.route))
]))
]));
};
@@ -6728,10 +6752,11 @@ var $author$project$Main$viewHeaderBar = function (model) {
_List_fromArray(
[
A2(
$elm$html$Html$p,
$elm$html$Html$a,
_List_fromArray(
[
$elm$html$Html$Attributes$class('navbar-item')
$elm$html$Html$Attributes$class('navbar-item'),
$elm$html$Html$Attributes$href('/')
]),
_List_fromArray(
[
@@ -6804,7 +6829,7 @@ var $author$project$Main$viewHeaderBar = function (model) {
]),
_List_fromArray(
[
$elm$html$Html$text('Mon coffre')
$elm$html$Html$text('Coffre de groupe')
]))
]))
]))
@@ -6886,21 +6911,59 @@ var $author$project$Main$showWealth = function (wealth) {
A2($author$project$Main$showWealthField, 'cp', wealth.cp)
]);
};
var $author$project$Main$viewPlayerWealth = function (player) {
var $elm$html$Html$button = _VirtualDom_node('button');
var $author$project$Main$actionButton = function (t) {
return A2(
$elm$html$Html$section,
$elm$html$Html$button,
_List_fromArray(
[
$elm$html$Html$Attributes$class('level')
$elm$html$Html$Attributes$class('button')
]),
_Utils_ap(
_List_fromArray(
[
$elm$html$Html$text(t)
]));
};
var $author$project$Main$viewPlayerAction = F2(
function (player, route) {
switch (route.$) {
case 'PlayerChest':
return _List_fromArray(
[
$author$project$Main$actionButton('Vendre')
]);
case 'GroupLoot':
return _List_fromArray(
[
$author$project$Main$actionButton('Demander')
]);
case 'Merchant':
return _List_fromArray(
[
$author$project$Main$actionButton('Acheter')
]);
default:
return _List_fromArray(
[
$author$project$Main$actionButton('Valider')
]);
}
});
var $author$project$Main$viewPlayerBar = F2(
function (player, route) {
return A2(
$elm$html$Html$section,
_List_fromArray(
[
$elm$html$Html$Attributes$class('level is-mobile box')
]),
_List_fromArray(
[
A2(
$elm$html$Html$div,
_List_fromArray(
[
$elm$html$Html$Attributes$class('level-left box')
$elm$html$Html$Attributes$class('level-left')
]),
_Utils_ap(
_List_fromArray(
@@ -6914,16 +6977,6 @@ var $author$project$Main$viewPlayerWealth = function (player) {
_List_fromArray(
[
A2(
$elm$html$Html$p,
_List_fromArray(
[
$elm$html$Html$Attributes$class('is-size-3')
]),
_List_fromArray(
[
$elm$html$Html$text('Argent')
])),
A2(
$elm$html$Html$span,
_List_fromArray(
[
@@ -6941,55 +6994,63 @@ var $author$project$Main$viewPlayerWealth = function (player) {
]))
]))
]),
$author$project$Main$showWealth(player.wealth)))
]),
(player.debt > 0) ? _List_fromArray(
[
_Utils_ap(
$author$project$Main$showWealth(player.wealth),
(player.debt > 0) ? _List_fromArray(
[
A2(
$elm$html$Html$div,
_List_fromArray(
[
$elm$html$Html$Attributes$class('level-item')
]),
_List_fromArray(
[
A2(
$elm$html$Html$p,
_List_fromArray(
[
$elm$html$Html$Attributes$class('heading is-size-4 has-text-danger')
]),
_List_fromArray(
[
$elm$html$Html$text(
'Dette : ' + ($elm$core$String$fromInt(player.debt) + 'po'))
]))
]))
]) : _List_Nil))),
A2(
$elm$html$Html$div,
_List_fromArray(
[
$elm$html$Html$Attributes$class('level-right')
]),
_List_fromArray(
[
A2(
$elm$html$Html$div,
_List_fromArray(
[
$elm$html$Html$Attributes$class('level-item')
]),
_List_fromArray(
[
A2(
$elm$html$Html$p,
_List_fromArray(
[
$elm$html$Html$Attributes$class('heading is-size-4 has-text-danger')
]),
_List_fromArray(
[
$elm$html$Html$text(
'Dette : ' + ($elm$core$String$fromInt(player.debt) + 'po'))
]))
]))
]))
]) : _List_Nil));
};
A2($author$project$Main$viewPlayerAction, player, route))
]));
});
var $elm$core$Maybe$withDefault = F2(
function (_default, maybe) {
if (maybe.$ === 'Just') {
var value = maybe.a;
return value;
} else {
return _default;
}
});
var $author$project$Main$view = function (model) {
return {
body: _List_fromArray(
[
$author$project$Main$viewHeaderBar(model),
$author$project$Main$viewPlayerWealth(model.player),
A2($author$project$Main$viewPlayerBar, model.player, model.state.route),
A2(
$elm$html$Html$section,
$elm$html$Html$article,
_List_fromArray(
[
$elm$html$Html$Attributes$class('container')
$elm$html$Html$Attributes$class('section container')
]),
function () {
var _v0 = model.route;
var _v0 = model.state.route;
switch (_v0.$) {
case 'PlayerChest':
return _List_fromArray(
@@ -7002,15 +7063,7 @@ var $author$project$Main$view = function (model) {
$elm$html$Html$text('Mon Coffre')
])),
$author$project$Main$viewLoot(
function () {
var _v1 = model.loot;
if (_v1.$ === 'Just') {
var i = _v1.a;
return i;
} else {
return _List_Nil;
}
}())
A2($elm$core$Maybe$withDefault, _List_Nil, model.loot))
]);
case 'GroupLoot':
return _List_fromArray(
@@ -7021,7 +7074,9 @@ var $author$project$Main$view = function (model) {
_List_fromArray(
[
$elm$html$Html$text('Coffre de groupe')
]))
])),
$author$project$Main$viewLoot(
A2($elm$core$Maybe$withDefault, _List_Nil, model.groupLoot))
]);
case 'Merchant':
return _List_fromArray(
@@ -7047,6 +7102,7 @@ var $author$project$Main$view = function (model) {
]);
}
}()),
A2($elm$html$Html$hr, _List_Nil, _List_Nil),
A2(
$elm$html$Html$section,
_List_fromArray(