Update IPAS plugin to use all features of 1.1.0
This commit is contained in:
parent
28c124b020
commit
c63dfa6a91
@ -44,21 +44,64 @@ window.plugin.ipasLink.getHash = function (d) {
|
|||||||
|
|
||||||
hashParts = [];
|
hashParts = [];
|
||||||
$.each(d.portalV2.linkedModArray, function (ind, mod) {
|
$.each(d.portalV2.linkedModArray, function (ind, mod) {
|
||||||
//shields only, so far...
|
// s - shields
|
||||||
var s = "0";
|
// h - heat sink
|
||||||
if (mod) {
|
// i - intentionally left in
|
||||||
if (mod.type === "RES_SHIELD") {
|
// t - turret
|
||||||
s = mod.rarity.charAt(0).toLowerCase();
|
//
|
||||||
}
|
// f - force amp
|
||||||
}
|
// m - multi-hack
|
||||||
hashParts.push(s);
|
// l - link-amp
|
||||||
});
|
//
|
||||||
var shields = hashParts.join(",");
|
var modCodes = {
|
||||||
return resos + "|" + shields;
|
"RES_SHIELD": "s",
|
||||||
|
"HEATSINK": "h",
|
||||||
|
"TURRET": "t",
|
||||||
|
"FORCE_AMP": "f",
|
||||||
|
"MULTIHACK": "m",
|
||||||
|
"LINK_AMPLIFIER": "l"
|
||||||
}
|
}
|
||||||
|
|
||||||
var setup = function () {
|
var mc = "0";
|
||||||
window.plugin.ipasLink.setupCallback();
|
if (mod) {
|
||||||
|
if (mod.type in modCodes) {
|
||||||
|
mc = modCodes[mod.type] + mod.rarity.charAt(0).toLowerCase();
|
||||||
|
|
||||||
|
//special for shields to distinguish old/new mitigation
|
||||||
|
if (mod.type == "RES_SHIELD") {
|
||||||
|
mc += mod.stats.MITIGATION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hashParts.push(mc);
|
||||||
|
});
|
||||||
|
var shields = hashParts.join(",");
|
||||||
|
|
||||||
|
var linkParts = [];
|
||||||
|
var edges = d.portalV2.linkedEdges;
|
||||||
|
|
||||||
|
var portalL = new L.LatLng(d.locationE6.latE6 / 1E6, d.locationE6.lngE6 / 1E6)
|
||||||
|
$.each(edges, function (ind, edge) {
|
||||||
|
//calc distance in m here
|
||||||
|
var distance = 1; //default to 1m, so a low level portal would support it
|
||||||
|
|
||||||
|
//Try to find other portals details
|
||||||
|
var guid = edge.otherPortalGuid
|
||||||
|
if (window.portals[guid] !== undefined) {
|
||||||
|
//get other portals details as o
|
||||||
|
var o = window.portals[guid].options.details;
|
||||||
|
var otherPortalL = new L.LatLng(o.locationE6.latE6 / 1E6, o.locationE6.lngE6 / 1E6);
|
||||||
|
var distance = Math.round(portalL.distanceTo(otherPortalL));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(edge.isOrigin)) {
|
||||||
|
distance = distance * -1;
|
||||||
|
}
|
||||||
|
linkParts.push(distance);
|
||||||
|
});
|
||||||
|
var links = linkParts.join(",");
|
||||||
|
|
||||||
|
return resos + "/" + shields + "/" + links; //changed with IPAS 1.1 to / instead of |
|
||||||
}
|
}
|
||||||
|
|
||||||
var setup = function () {
|
var setup = function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user