fixt tutorial

This commit is contained in:
Mashy 2019-11-28 23:46:07 +10:00
parent 500584ab10
commit 84e3e776ca
2 changed files with 51 additions and 33 deletions

View File

@ -23,8 +23,8 @@ const addState = connect(
itemInfo,
} = state;
function clearTutorial() {
return ws.clearTutorial(instance.id);
function sendInstance() {
return ws.sendInstanceState(instance.id);
}
function sendVboxRefill() {
@ -58,7 +58,7 @@ const addState = connect(
itemInfo,
clearTutorial,
sendInstance,
sendItemUnequip,
sendVboxBuy,
sendVboxCombine,
@ -72,6 +72,10 @@ const addState = connect(
return dispatch(actions.setInfo(item));
}
function setTutorial(stage) {
return dispatch(actions.setTutorial(stage));
}
function dispatchVboxSelect(v, state) {
setVboxState(dispatch, v, state);
dispatch(actions.setItemUnequip([]));
@ -81,6 +85,7 @@ const addState = connect(
return {
dispatchVboxSelect,
setInfo,
setTutorial,
};
}
);
@ -106,14 +111,15 @@ class Vbox extends preact.Component {
// Static
itemInfo,
// Function Calls
clearTutorial,
dispatchVboxSelect,
sendItemUnequip,
sendInstance,
sendVboxBuy,
sendVboxCombine,
sendVboxRefill,
sendVboxRefund,
setInfo,
setTutorial,
} = args;
if (!player) return false;
@ -123,7 +129,10 @@ class Vbox extends preact.Component {
const setVboxSelected = v => dispatchVboxSelect(v, { itemInfo, itemUnequip, vbox });
const clearVboxSelected = () => setVboxSelected({ storeSelect: [], stashSelect: [] });
const vboxBuySelected = () => sendVboxBuy(storeSelect[0][0], storeSelect[0][1]);
const clearTutorial = () => {
setTutorial(null);
sendInstance();
};
function vboxHover(e, v) {
if (v) {
e.stopPropagation();

View File

@ -24,21 +24,26 @@ function tutorialVbox(player, store, tutorial) {
if (vbox.bits < 29) {
stage += 1;
} else {
vbox.store[0] = vbox.store[0].slice(0, 2);
vbox.store[1] = [];
vbox.store[2] = [];
vbox.stash.fill(null, 0, 3);
for (let i = 2; i < 6; i += 1) {
delete vbox.store.Colours[i];
}
vbox.store.Skills = {};
vbox.store.Specs = {};
delete vbox.stash[0];
delete vbox.stash[1];
delete vbox.stash[2];
}
}
if (stage === 2) {
if (!(vbox.stash.slice(0, 3).every(i => i === 'Attack') && vbox.stash.length >= 3)) {
if (!(vbox.stash[0] === 'Attack' && vbox.stash[1] === 'Attack' && vbox.stash[2] === 'Attack')) {
stage += 1;
} else {
vbox.store[0] = vbox.store[0].slice(0, 2);
vbox.store[1] = [];
vbox.store[2] = [];
vbox.stash.fill(null, 1, 3);
vbox.store.Colours = {};
vbox.store.Skills = {};
vbox.store.Specs = {};
delete vbox.stash[0];
delete vbox.stash[1];
}
}
@ -46,21 +51,24 @@ function tutorialVbox(player, store, tutorial) {
if (player.constructs[0].skills.length !== 0) {
stage += 1;
} else {
vbox.store[0] = vbox.store[0].slice(0, 2);
vbox.store[1] = [];
vbox.store[2] = [];
vbox.stash.fill(null, 0, 2);
vbox.store.Colours = {};
vbox.store.Skills = {};
vbox.store.Specs = {};
delete vbox.stash[0];
delete vbox.stash[1];
}
}
if (stage === 4) {
if (!vbox.store[2][0] || vbox.bits < 24) {
if (!vbox.store.Specs[0] || vbox.bits < 24) {
stage += 1;
} else {
vbox.store[0] = [];
vbox.store[1] = [];
vbox.store[2] = vbox.store[2].slice(0, 1);
vbox.stash.fill(null, 0, 2);
vbox.store.Colours = {};
vbox.store.Skills = {};
delete vbox.store.Specs[1];
delete vbox.store.Specs[2];
delete vbox.stash[0];
delete vbox.stash[1];
}
}
@ -68,10 +76,11 @@ function tutorialVbox(player, store, tutorial) {
if (player.constructs[0].specs.length !== 0) {
stage += 1;
} else {
vbox.store[0] = [];
vbox.store[1] = [];
vbox.store[2] = vbox.store[2].slice(0, 1);
vbox.stash.fill(null, 0, 2);
vbox.store.Colours = {};
vbox.store.Skills = {};
vbox.store.Specs = {};
delete vbox.stash[0];
delete vbox.stash[1];
}
}
@ -79,9 +88,9 @@ function tutorialVbox(player, store, tutorial) {
if (player.constructs.every(c => c.skills.length !== 0)) {
stage += 1;
} else {
vbox.store[0] = [];
vbox.store[1] = [];
vbox.store[2] = [];
vbox.store.Colours = {};
vbox.store.Skills = {};
vbox.store.Specs = {};
}
}
@ -89,9 +98,9 @@ function tutorialVbox(player, store, tutorial) {
if (vbox.bits < 25) {
stage += 1;
} else {
vbox.store[0] = [];
vbox.store[1] = [];
vbox.store[2] = [];
vbox.store.Colours = {};
vbox.store.Skills = {};
vbox.store.Specs = {};
}
}
store.dispatch(actions.setTutorial(stage));