summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-05-16 18:10:37 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2017-05-16 18:10:37 +0200
commit91a1e1772204697de373b516494cd1a71057003d (patch)
treec5e6417870ed683ed8c2dc82bca6764881cf2a4c
parent0d915b6c7022934db964b34ec8500abba15fcfb1 (diff)
downloadshrinker-91a1e1772204697de373b516494cd1a71057003d.tar.gz
shrinker-91a1e1772204697de373b516494cd1a71057003d.zip
telemetry: finish mappings
-rw-r--r--worker.js47
1 files changed, 32 insertions, 15 deletions
diff --git a/worker.js b/worker.js
index 32f45cc..585ccd5 100644
--- a/worker.js
+++ b/worker.js
@@ -381,33 +381,50 @@ function flatten(obj) {
} });
// link participant <-> Telemetry actor/target
telemetry.data.forEach((t) => {
- // participant kills
- if (t.payload.Actor != undefined
- && [undefined, 1].indexOf(t.payload.IsHero) != -1
- && t.payload.Team != undefined)
+ // item actor
+ if (t.type == "UseItemAbility")
+ t.actor = participants.filter((p) =>
+ p.actor == t.payload.Actor
+ && p.team == t.payload.Team)[0];
+ // item target
+ if (t.type == "UseItemAbility")
+ t.actor = participants.filter((p) =>
+ p.actor == t.payload.TargetActor
+ && p.team != t.payload.Team)[0];
+ // ability actor
+ if (t.type == "UseAbility")
t.actor = participants.filter((p) =>
p.actor == t.payload.Actor
&& p.team == t.payload.Team)[0];
// ability targets
- if (t.payload.TargetActor != undefined
- && t.payload.Team != undefined)
+ if (t.type == "UseAbility")
t.target = participants.filter((p) =>
p.actor == t.payload.TargetActor
&& p.team != t.payload.Team)[0];
- // damage targets
- if (t.payload.Target != undefined
- && t.payload.TargetIsHero == 1
- && t.payload.Team != undefined)
+ // damage actor
+ if (t.type == "DealDamage"
+ && t.payload.IsHero == 1)
+ t.actor = participants.filter((p) =>
+ p.actor == t.payload.Actor
+ && p.team == t.payload.Team)[0];
+ // damage target
+ if (t.type == "DealDamage"
+ && t.payload.TargetIsHero == 1)
t.target = participants.filter((p) =>
p.actor == t.payload.Target
&& p.team != t.payload.Team)[0];
- // participant killed
- if (t.payload.Killed != undefined
- && t.payload.TargetIsHero == 1
- && t.payload.KilledTeam != undefined)
+ // kill actor
+ if (t.type == "KillActor"
+ && t.payload.IsHero == 1)
+ t.actor = participants.filter((p) =>
+ p.actor == t.payload.Actor
+ && p.team == t.payload.Team)[0];
+ // kill target
+ if (t.event == "KillActor"
+ && t.payload.TargetIsHero == 1)
t.killed = participants.filter((p) =>
p.actor == t.payload.Killed
- && p.team == t.payload.KilledTeam)[0];
+ && p.team != t.payload.Team)[0];
});
const participants_phase = participants.map((p) => {
return {