event structure clean up
This commit is contained in:
@@ -2,15 +2,14 @@ const actions = require('./actions');
|
||||
const { TIMES } = require('./constants');
|
||||
|
||||
function setAnimations(r, store, account) {
|
||||
const { cast, focus, event, delay } = r;
|
||||
const { source, target, player, skill } = cast;
|
||||
const { skill, focus, event: [type, variant] } = r;
|
||||
|
||||
store.dispatch(actions.setAnimFocus(r.focus));
|
||||
store.dispatch(actions.setAnimFocus(focus));
|
||||
|
||||
if (r.event[0] === 'Cast') {
|
||||
if (type === 'Cast') {
|
||||
store.dispatch(actions.setAnimText(null));
|
||||
|
||||
const { construct, direction: [x, y] } = r.event[1];
|
||||
const { construct, player, direction: [x, y] } = variant;
|
||||
const animY = y && player === account.id ? -1 : y;
|
||||
const animSource = {
|
||||
animation: 'sourceCast',
|
||||
@@ -22,10 +21,10 @@ function setAnimations(r, store, account) {
|
||||
return setTimeout(() => store.dispatch(actions.setAnimSource(null)), TIMES.SOURCE_DURATION_MS);
|
||||
}
|
||||
|
||||
if (r.event[0].includes('Hit')) {
|
||||
if (type.includes('Hit')) {
|
||||
store.dispatch(actions.setAnimText(null));
|
||||
|
||||
const { construct, direction: [x, y] } = r.event[1];
|
||||
const { construct, player, direction: [x, y] } = variant;
|
||||
const animY = y && player === account.id ? -1 : y;
|
||||
const isPlayer = player === account.id;
|
||||
const animTarget = {
|
||||
|
||||
@@ -31,7 +31,7 @@ class AnimText extends preact.Component {
|
||||
const { construct, animText, itemInfo } = this.props;
|
||||
if (animText && animText.event[1].construct === construct.id) {
|
||||
const itemSourceDescription = () => {
|
||||
const itemSource = itemInfo.combos.filter(c => c.item === removeTier(animText.cast.skill));
|
||||
const itemSource = itemInfo.combos.filter(c => c.item === removeTier(animText.skill));
|
||||
const itemSourceInfo = itemSource.length
|
||||
? `${itemSource[0].components[0]} ${itemSource[0].components[1]} ${itemSource[0].components[2]}`
|
||||
: false;
|
||||
@@ -82,7 +82,7 @@ class AnimText extends preact.Component {
|
||||
|
||||
return (
|
||||
<div class="combat-text">
|
||||
<h2><span>{animText.cast.skill}</span></h2>
|
||||
<h2><span>{animText.skill}</span></h2>
|
||||
<span>{itemSourceDescription()}</span>
|
||||
{generateAnimText()}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user