EXPERIMENTAL: first try at catching up with latest stock intel changes
This commit is contained in:
parent
8b7769d0bf
commit
8d910a6f1e
@ -15,6 +15,8 @@ window.teamStringToId = function(teamStr) {
|
|||||||
var team = TEAM_NONE;
|
var team = TEAM_NONE;
|
||||||
if(teamStr === 'ENLIGHTENED') team = TEAM_ENL;
|
if(teamStr === 'ENLIGHTENED') team = TEAM_ENL;
|
||||||
if(teamStr === 'RESISTANCE') team = TEAM_RES;
|
if(teamStr === 'RESISTANCE') team = TEAM_RES;
|
||||||
|
if(teamStr === 'E') team = TEAM_ENL;
|
||||||
|
if(teamStr === 'R') team = TEAM_RES;
|
||||||
return team;
|
return team;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@ window.Render.prototype.startRenderPass = function(level,bounds) {
|
|||||||
this.resetLinkVisibility();
|
this.resetLinkVisibility();
|
||||||
|
|
||||||
this.rescalePortalMarkers();
|
this.rescalePortalMarkers();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.Render.prototype.clearPortalsBelowLevel = function(level) {
|
window.Render.prototype.clearPortalsBelowLevel = function(level) {
|
||||||
@ -87,8 +86,7 @@ window.Render.prototype.processGameEntities = function(entities) {
|
|||||||
|
|
||||||
for (var i in entities) {
|
for (var i in entities) {
|
||||||
var ent = entities[i];
|
var ent = entities[i];
|
||||||
|
if (ent[2][0] == 'r' && !(ent[0] in this.deletedGuid)) {
|
||||||
if (ent[2].type == 'region' && !(ent[0] in this.deletedGuid)) {
|
|
||||||
this.createFieldEntity(ent);
|
this.createFieldEntity(ent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,7 +94,7 @@ window.Render.prototype.processGameEntities = function(entities) {
|
|||||||
for (var i in entities) {
|
for (var i in entities) {
|
||||||
var ent = entities[i];
|
var ent = entities[i];
|
||||||
|
|
||||||
if (ent[2].type == 'edge' && !(ent[0] in this.deletedGuid)) {
|
if (ent[2][0] == 'e' && !(ent[0] in this.deletedGuid)) {
|
||||||
this.createLinkEntity(ent);
|
this.createLinkEntity(ent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,7 +102,7 @@ window.Render.prototype.processGameEntities = function(entities) {
|
|||||||
for (var i in entities) {
|
for (var i in entities) {
|
||||||
var ent = entities[i];
|
var ent = entities[i];
|
||||||
|
|
||||||
if (ent[2].type == 'portal' && !(ent[0] in this.deletedGuid)) {
|
if (ent[2][0] == 'p' && !(ent[0] in this.deletedGuid)) {
|
||||||
this.createPortalEntity(ent);
|
this.createPortalEntity(ent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -242,23 +240,36 @@ window.Render.prototype.createPortalEntity = function(ent) {
|
|||||||
this.deletePortalEntity(ent[0]);
|
this.deletePortalEntity(ent[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
var portalLevel = parseInt(ent[2].level);
|
var portalLevel = parseInt(ent[2][4]);
|
||||||
var team = teamStringToId(ent[2].team);
|
var team = teamStringToId(ent[2][1]);
|
||||||
// the data returns unclaimed portals as level 1 - but IITC wants them treated as level 0
|
// the data returns unclaimed portals as level 1 - but IITC wants them treated as level 0
|
||||||
if (team == TEAM_NONE) portalLevel = 0;
|
if (team == TEAM_NONE) portalLevel = 0;
|
||||||
|
|
||||||
var latlng = L.latLng(ent[2].latE6/1E6, ent[2].lngE6/1E6);
|
var latlng = L.latLng(ent[2][2]/1E6, ent[2][3]/1E6);
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
type: ent[2][0],
|
||||||
|
team: ent[2][1],
|
||||||
|
latE6: ent[2][2],
|
||||||
|
lngE6: ent[2][3],
|
||||||
|
level: ent[2][4],
|
||||||
|
health: ent[2][5],
|
||||||
|
resCount: ent[2][6],
|
||||||
|
image: ent[2][7],
|
||||||
|
title: ent[2][8],
|
||||||
|
ornaments: ent[2][9]
|
||||||
|
};
|
||||||
|
|
||||||
var dataOptions = {
|
var dataOptions = {
|
||||||
level: portalLevel,
|
level: portalLevel,
|
||||||
team: team,
|
team: team,
|
||||||
ent: ent, // LEGACY - TO BE REMOVED AT SOME POINT! use .guid, .timestamp and .details instead
|
ent: ent, // LEGACY - TO BE REMOVED AT SOME POINT! use .guid, .timestamp and .data instead
|
||||||
guid: ent[0],
|
guid: ent[0],
|
||||||
timestamp: ent[1],
|
timestamp: ent[1],
|
||||||
data: ent[2]
|
data: data
|
||||||
};
|
};
|
||||||
|
|
||||||
window.pushPortalGuidPositionCache(ent[0], ent[2].latE6, ent[2].lngE6);
|
window.pushPortalGuidPositionCache(ent[0], ent[2][3], ent[2][4]);
|
||||||
|
|
||||||
var marker = createMarker(latlng, dataOptions);
|
var marker = createMarker(latlng, dataOptions);
|
||||||
|
|
||||||
@ -314,11 +325,17 @@ window.Render.prototype.createFieldEntity = function(ent) {
|
|||||||
this.deleteFieldEntity(ent[0]); // option 2, for now
|
this.deleteFieldEntity(ent[0]); // option 2, for now
|
||||||
}
|
}
|
||||||
|
|
||||||
var team = teamStringToId(ent[2].team);
|
var data = {
|
||||||
|
type: ent[2][0],
|
||||||
|
team: ent[2][1],
|
||||||
|
points: ent[2][2].map(function(arr) { return {guid: arr[0], latE6: arr[1], lngE6: arr[2] }; })
|
||||||
|
};
|
||||||
|
|
||||||
|
var team = teamStringToId(ent[2][1]);
|
||||||
var latlngs = [
|
var latlngs = [
|
||||||
L.latLng(ent[2].points[0].latE6/1E6, ent[2].points[0].lngE6/1E6),
|
L.latLng(data.points[0].latE6/1E6, data.points[0].lngE6/1E6),
|
||||||
L.latLng(ent[2].points[1].latE6/1E6, ent[2].points[1].lngE6/1E6),
|
L.latLng(data.points[1].latE6/1E6, data.points[1].lngE6/1E6),
|
||||||
L.latLng(ent[2].points[2].latE6/1E6, ent[2].points[2].lngE6/1E6)
|
L.latLng(data.points[2].latE6/1E6, data.points[2].lngE6/1E6)
|
||||||
];
|
];
|
||||||
|
|
||||||
var poly = L.geodesicPolygon(latlngs, {
|
var poly = L.geodesicPolygon(latlngs, {
|
||||||
@ -328,9 +345,10 @@ window.Render.prototype.createFieldEntity = function(ent) {
|
|||||||
clickable: false,
|
clickable: false,
|
||||||
|
|
||||||
team: team,
|
team: team,
|
||||||
|
ent: ent, // LEGACY - TO BE REMOVED AT SOME POINT! use .guid, .timestamp and .data instead
|
||||||
guid: ent[0],
|
guid: ent[0],
|
||||||
timestamp: ent[1],
|
timestamp: ent[1],
|
||||||
data: ent[2],
|
data: data,
|
||||||
});
|
});
|
||||||
|
|
||||||
runHooks('fieldAdded',{field: poly});
|
runHooks('fieldAdded',{field: poly});
|
||||||
@ -358,10 +376,21 @@ window.Render.prototype.createLinkEntity = function(ent,faked) {
|
|||||||
this.deleteLinkEntity(ent[0]); // option 2 - for now
|
this.deleteLinkEntity(ent[0]); // option 2 - for now
|
||||||
}
|
}
|
||||||
|
|
||||||
var team = teamStringToId(ent[2].team);
|
var data = { // TODO add other properties and check correction direction
|
||||||
|
type: ent[2][0],
|
||||||
|
team: ent[2][1],
|
||||||
|
oGuid: ent[2][2],
|
||||||
|
oLatE6: ent[2][3],
|
||||||
|
oLngE6: ent[2][4],
|
||||||
|
dGuid: ent[2][5],
|
||||||
|
dLatE6: ent[2][6],
|
||||||
|
dLngE6: ent[2][7]
|
||||||
|
};
|
||||||
|
|
||||||
|
var team = teamStringToId(ent[2][1]);
|
||||||
var latlngs = [
|
var latlngs = [
|
||||||
L.latLng(ent[2].oLatE6/1E6, ent[2].oLngE6/1E6),
|
L.latLng(data.oLatE6/1E6, data.oLngE6/1E6),
|
||||||
L.latLng(ent[2].dLatE6/1E6, ent[2].dLngE6/1E6)
|
L.latLng(data.dLatE6/1E6, data.dLngE6/1E6)
|
||||||
];
|
];
|
||||||
var poly = L.geodesicPolyline(latlngs, {
|
var poly = L.geodesicPolyline(latlngs, {
|
||||||
color: COLORS[team],
|
color: COLORS[team],
|
||||||
@ -370,9 +399,10 @@ window.Render.prototype.createLinkEntity = function(ent,faked) {
|
|||||||
clickable: false,
|
clickable: false,
|
||||||
|
|
||||||
team: team,
|
team: team,
|
||||||
|
ent: ent, // LEGACY - TO BE REMOVED AT SOME POINT! use .guid, .timestamp and .data instead
|
||||||
guid: ent[0],
|
guid: ent[0],
|
||||||
timestamp: ent[1],
|
timestamp: ent[1],
|
||||||
data: ent[2]
|
data: data
|
||||||
});
|
});
|
||||||
|
|
||||||
runHooks('linkAdded', {link: poly});
|
runHooks('linkAdded', {link: poly});
|
||||||
|
@ -32,8 +32,43 @@ window.portalDetail.isFresh = function(guid) {
|
|||||||
var handleResponse = function(guid, data, success) {
|
var handleResponse = function(guid, data, success) {
|
||||||
delete requestQueue[guid];
|
delete requestQueue[guid];
|
||||||
|
|
||||||
|
function parseMod(arr) {
|
||||||
|
if(arr == null) { return null; }
|
||||||
|
return {
|
||||||
|
owner: arr[0],
|
||||||
|
name: arr[1],
|
||||||
|
rarity: arr[2],
|
||||||
|
stats: arr[3],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function parseResonator(arr) {
|
||||||
|
if(arr == null) { return null; }
|
||||||
|
return {
|
||||||
|
owner: arr[0],
|
||||||
|
level: arr[1],
|
||||||
|
energy: arr[2],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var dict = {
|
||||||
|
raw: data.result,
|
||||||
|
type: data.result[0],
|
||||||
|
team: data.result[1],
|
||||||
|
latE6: data.result[2],
|
||||||
|
lngE6: data.result[3],
|
||||||
|
level: data.result[4],
|
||||||
|
health: data.result[5],
|
||||||
|
resCount: data.result[6],
|
||||||
|
image: data.result[7],
|
||||||
|
title: data.result[8],
|
||||||
|
ornaments: data.result[9],
|
||||||
|
mods: data.result[10].map(parseMod),
|
||||||
|
resonators:data.result[11].map(parseResonator),
|
||||||
|
owner: data.result[12],
|
||||||
|
};
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
cache.store(guid,data);
|
cache.store(guid,dict);
|
||||||
|
|
||||||
//FIXME..? better way of handling sidebar refreshing...
|
//FIXME..? better way of handling sidebar refreshing...
|
||||||
|
|
||||||
@ -42,7 +77,7 @@ var handleResponse = function(guid, data, success) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.runHooks ('portalDetailLoaded', {guid:guid, success:success, details:data});
|
window.runHooks ('portalDetailLoaded', {guid:guid, success:success, details:data.result});
|
||||||
}
|
}
|
||||||
|
|
||||||
window.portalDetail.request = function(guid) {
|
window.portalDetail.request = function(guid) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user