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

View File

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