convert server enum into anims keywords
This commit is contained in:
parent
e6e7713539
commit
d9563f8a9a
@ -8,7 +8,7 @@ function none() {
|
||||
};
|
||||
}
|
||||
|
||||
function getObjects(resolution, stages, game, account) {
|
||||
function getObjects(resolution, game, account) {
|
||||
if (!resolution) return none();
|
||||
if (!resolution.target) return none();
|
||||
|
||||
@ -53,7 +53,7 @@ function getObjects(resolution, stages, game, account) {
|
||||
};
|
||||
};
|
||||
|
||||
const skipSource = !stages.includes('START_SKILL')
|
||||
const skipSource = !resolution.stages.includes('START_SKILL')
|
||||
|| resolution.source.id === resolution.target.id;
|
||||
|
||||
const animSource = skipSource
|
||||
@ -118,10 +118,10 @@ function getFocusTargets(resolution, game) {
|
||||
return [target];
|
||||
}
|
||||
|
||||
function getText(resolution, sequence) {
|
||||
function getText(resolution) {
|
||||
const nullText = { text: null, constructId: null, life: null };
|
||||
if (!resolution) return nullText;
|
||||
if (!sequence.includes('POST_SKILL')) return nullText;
|
||||
if (!resolution.stages.includes('POST_SKILL')) return nullText;
|
||||
|
||||
function generatePostSkill() {
|
||||
const [type, event] = resolution.event;
|
||||
|
||||
@ -67,21 +67,22 @@ function registerEvents(store) {
|
||||
// stop fetching the game state til animations are done
|
||||
const newRes = game.resolved.slice(currentGame.resolved.length);
|
||||
return eachSeries(newRes, (r, cb) => {
|
||||
// convert server enum into anims keywords
|
||||
// todo make serersideonly
|
||||
const sequence = animations.getSequence(r);
|
||||
const timeout = animations.getTime(sequence);
|
||||
const anims = animations.getObjects(r, sequence, game, account);
|
||||
const text = animations.getText(r, sequence);
|
||||
const timeout = animations.getTime(r.stages);
|
||||
const anims = animations.getObjects(r, game, account);
|
||||
const text = animations.getText(r);
|
||||
store.dispatch(actions.setAnimFocus(animations.getFocusTargets(r, game)));
|
||||
if (anims.animSkill) store.dispatch(actions.setAnimSkill(anims.animSkill));
|
||||
|
||||
if (sequence.includes('START_SKILL') && anims.animSource) store.dispatch(actions.setAnimSource(anims.animSource));
|
||||
if (sequence.includes('END_SKILL') && anims.animTarget) {
|
||||
if (r.stages.includes('START_SKILL') && anims.animSource) {
|
||||
store.dispatch(actions.setAnimSource(anims.animSource));
|
||||
}
|
||||
|
||||
if (r.stages.includes('END_SKILL') && anims.animTarget) {
|
||||
store.dispatch(actions.setAnimTarget(anims.animTarget));
|
||||
if (animations.isCbAnim(anims.animSkill)) store.dispatch(actions.setAnimCb(cb));
|
||||
}
|
||||
if (sequence.includes('POST_SKILL') && text) {
|
||||
|
||||
if (r.stages.includes('POST_SKILL') && text) {
|
||||
// timeout to prevent text classes from being added too soon
|
||||
if (timeout === TIMES.POST_SKILL_DURATION_MS) {
|
||||
store.dispatch(actions.setAnimText(text));
|
||||
@ -92,13 +93,14 @@ function registerEvents(store) {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return setTimeout(() => {
|
||||
store.dispatch(actions.setAnimSkill(null));
|
||||
store.dispatch(actions.setAnimSource(null));
|
||||
store.dispatch(actions.setAnimTarget(null));
|
||||
store.dispatch(actions.setAnimText(null));
|
||||
store.dispatch(actions.setAnimFocus([]));
|
||||
if (sequence.includes('END_SKILL') && animations.isCbAnim(anims.animSkill)) return true;
|
||||
if (r.stages.includes('END_SKILL') && animations.isCbAnim(anims.animSkill)) return true;
|
||||
return cb();
|
||||
}, timeout);
|
||||
}, err => {
|
||||
|
||||
@ -408,13 +408,21 @@ pub struct EventConstruct {
|
||||
|
||||
#[derive(Debug,Clone,PartialEq,Serialize,Deserialize)]
|
||||
pub enum EventStages {
|
||||
#[serde(rename = "START_SKILL END_SKILL POST_SKILL")]
|
||||
AllStages, // Anim Anim Anim
|
||||
#[serde(rename = "START_SKILL END_SKILL")]
|
||||
StartEnd, // Anim Anim Skip
|
||||
#[serde(rename = "START_SKILL POST_SKILL")]
|
||||
StartPost, // Anim Skip Anim
|
||||
#[serde(rename = "START_SKILL")]
|
||||
StartOnly, // Anim Skip Skip
|
||||
#[serde(rename = "END_SKILL POST_SKILL")]
|
||||
EndPost, // Skip Anim Anim
|
||||
#[serde(rename = "END_SKILL")]
|
||||
EndOnly, // Skip Anim Skip
|
||||
#[serde(rename = "POST_SKILL")]
|
||||
PostOnly, // Skip Skip Anim
|
||||
#[serde(rename = "")]
|
||||
NoStages, // Skip Skip Skip
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user