Merge branch 'develop' of ssh://mnml.gg:40022/~/mnml into develop

This commit is contained in:
ntr 2019-07-26 17:28:33 +10:00
commit d87bc44990
2 changed files with 11 additions and 19 deletions

View File

@ -1,4 +1,3 @@
const toast = require('izitoast');
const eachSeries = require('async/eachSeries'); const eachSeries = require('async/eachSeries');
const actions = require('./actions'); const actions = require('./actions');
@ -31,6 +30,8 @@ function registerEvents(store) {
} }
store.dispatch(actions.setConstructs(constructs)); store.dispatch(actions.setConstructs(constructs));
// Now that constructs have been set we can switch to list
setNav('list');
} }
function setInstanceList(list) { function setInstanceList(list) {
@ -158,7 +159,7 @@ function registerEvents(store) {
} }
function setInstance(v) { function setInstance(v) {
const { account, ws, instance } = store.getState(); const { account, instance } = store.getState();
if (v) { if (v) {
const player = v.players.find(p => p.id === account.id); const player = v.players.find(p => p.id === account.id);
store.dispatch(actions.setPlayer(player)); store.dispatch(actions.setPlayer(player));
@ -176,6 +177,11 @@ function registerEvents(store) {
return store.dispatch(actions.setItemInfo(v)); return store.dispatch(actions.setItemInfo(v));
} }
const team = JSON.parse(localStorage.getItem('team'));
if (team && team.every(t => t)) {
store.dispatch(actions.setTeam(team));
}
// events.on('SET_PLAYER', setInstance); // events.on('SET_PLAYER', setInstance);
// events.on('SEND_SKILL', function skillActive(gameId, constructId, targetConstructId, skill) { // events.on('SEND_SKILL', function skillActive(gameId, constructId, targetConstructId, skill) {
@ -190,14 +196,7 @@ function registerEvents(store) {
// return setConstructs(constructs); // return setConstructs(constructs);
// }); // });
const errMessages = { /* function errorPrompt(type) {
select_constructs: 'Select your constructs before battle using the numbered buttons next to the construct avatar',
complete_nodes: 'You need to complete the previously connected nodes first',
max_skills: 'Your construct can only learn a maximum of 4 skills',
};
function errorPrompt(type) {
const message = errMessages[type]; const message = errMessages[type];
const OK_BUTTON = '<button type="submit">OK</button>'; const OK_BUTTON = '<button type="submit">OK</button>';
toast.error({ toast.error({
@ -213,14 +212,8 @@ function registerEvents(store) {
], ],
message, message,
}); });
} } */
// setup / localstorage // setup / localstorage
const team = JSON.parse(localStorage.getItem('team'));
if (team && team.every(t => t)) {
setTeam(team);
setNav('list');
}
return { return {
clearCombiner, clearCombiner,
@ -228,7 +221,6 @@ function registerEvents(store) {
clearInfo, clearInfo,
clearInstance, clearInstance,
clearMtxActive, clearMtxActive,
errorPrompt,
setAccount, setAccount,
setAccountInstances, setAccountInstances,
setActiveItem, setActiveItem,

View File

@ -36,7 +36,7 @@ module.exports = {
itemInfo: createReducer({ combos: [], items: [] }, 'SET_ITEM_INFO'), itemInfo: createReducer({ combos: [], items: [] }, 'SET_ITEM_INFO'),
itemUnequip: createReducer([], 'SET_ITEM_UNEQUIP'), itemUnequip: createReducer([], 'SET_ITEM_UNEQUIP'),
mtxActive: createReducer(null, 'SET_MTX_ACTIVE'), mtxActive: createReducer(null, 'SET_MTX_ACTIVE'),
nav: createReducer('team', 'SET_NAV'), nav: createReducer(null, 'SET_NAV'),
showNav: createReducer(null, 'SET_SHOW_NAV'), showNav: createReducer(null, 'SET_SHOW_NAV'),
ping: createReducer(null, 'SET_PING'), ping: createReducer(null, 'SET_PING'),
player: createReducer(null, 'SET_PLAYER'), player: createReducer(null, 'SET_PLAYER'),