summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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))