fixed event
This commit is contained in:
parent
47c1cffc7f
commit
5542efd62e
@ -57,7 +57,6 @@ function createSocket(store) {
|
|||||||
store.dispatch(actions.setGame(currentGame));
|
store.dispatch(actions.setGame(currentGame));
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handlers = {
|
const handlers = {
|
||||||
|
|||||||
@ -60,14 +60,20 @@ function registerEvents(store) {
|
|||||||
if (['Disable', 'TargetKo'].includes(r.event[0])) return cb();
|
if (['Disable', 'TargetKo'].includes(r.event[0])) return cb();
|
||||||
// Create sub events for combat animations
|
// Create sub events for combat animations
|
||||||
const sequence = getCombatSequence(r);
|
const sequence = getCombatSequence(r);
|
||||||
return eachSeries(sequence, (stage, sCb) => {
|
return eachSeries(sequence, (stages, sCb) => {
|
||||||
const { skip } = store.getState();
|
|
||||||
if (skip) return sCb('skip');
|
|
||||||
const stagedR = Object.create(r);
|
const stagedR = Object.create(r);
|
||||||
stagedR.stage = stage;
|
stagedR.sequence = sequence;
|
||||||
|
stagedR.stages = stages;
|
||||||
|
|
||||||
|
let timeout = 0;
|
||||||
|
if (stages.includes('START_SKILL') && stages.includes('END_SKILL')) {
|
||||||
|
timeout = TIMES.SOURCE_AND_TARGET_TOTAL_DURATION;
|
||||||
|
} else if (stages.includes('START_SKILL')) timeout = TIMES.SOURCE_DURATION_MS;
|
||||||
|
else if (stages.includes('END_SKILL')) timeout = TIMES.TARGET_DURATION_MS;
|
||||||
|
else if (stages.includes('POST_SKILL')) timeout = TIMES.POST_SKILL_DURATION_MS;
|
||||||
store.dispatch(actions.setResolution(stagedR));
|
store.dispatch(actions.setResolution(stagedR));
|
||||||
|
|
||||||
return setTimeout(sCb, TIMES[stage]);
|
return setTimeout(sCb, timeout);
|
||||||
}, err => {
|
}, err => {
|
||||||
if (err) console.error(err);
|
if (err) console.error(err);
|
||||||
// Finished this resolution
|
// Finished this resolution
|
||||||
@ -79,9 +85,7 @@ function registerEvents(store) {
|
|||||||
// stop skipping resolutions
|
// stop skipping resolutions
|
||||||
store.dispatch(actions.setSkip(false));
|
store.dispatch(actions.setSkip(false));
|
||||||
// update the game
|
// update the game
|
||||||
store.dispatch(actions.setGame(game));
|
store.dispatch(actions.setGame(currentGame));
|
||||||
// get the latest state and restart polling
|
|
||||||
ws.sendGameState(currentGame.id);
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user