summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2021-05-01 18:18:54 +0200
committerAki <please@ignore.pl>2021-05-01 18:18:54 +0200
commitd269d19cd425d37234bd24fb4611c951ec772cd1 (patch)
tree9368fbffbde450e12ee37076fff06ab072552837
parent8736fd5ebf0d02bad24bd53260eb97e48d27fc13 (diff)
downloadderelict-prototype-d269d19cd425d37234bd24fb4611c951ec772cd1.zip
derelict-prototype-d269d19cd425d37234bd24fb4611c951ec772cd1.tar.gz
derelict-prototype-d269d19cd425d37234bd24fb4611c951ec772cd1.tar.bz2
Fixed frontend to work with new model
-rw-r--r--derelict.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/derelict.js b/derelict.js
index f1227c1..53358d6 100644
--- a/derelict.js
+++ b/derelict.js
@@ -73,7 +73,8 @@ class Wreck {
const iconElement = document.importNode(icon, true)
const labelElement = document.createElement('div')
const object2d = new CSS2DObject(this.domElement)
- const team = killmail.team > 1 ? "teamA" : "teamB"
+ const ownerId = "alliance_id" in killmail.victim ? killmail.victim.alliance_id : killmail.victim.corporation_id
+ const team = killmail.teams.findIndex(team => undefined !== team.find(id => id == ownerId)) == 0 ? "teamA" : "teamB"
const shipTypeId = killmail.victim.ship_type_id
fetch(`${ESI}/universe/types/${shipTypeId}/`, {cache: "force-cache"})
@@ -229,8 +230,8 @@ function init() {
const url = km => `${ESI}/killmails/${km.id}/${km.hash}/?datasource=tranquility`
const retrieve = km => fetch(url(km))
.then(response => response.json())
- .then(data => { data.team = km.team; return data })
- return Promise.all(killmails.map(retrieve))
+ .then(data => { data.teams = killmails.teams; return data })
+ return Promise.all(killmails.killmails.map(retrieve))
})
.then(killmails => {
icon.then(icon => processKillmails({skybox, renderer, renderer2d, container}, killmails, icon))