artifacts (jarvis shards, etc) - add a list of relevant portals, with basic details
(i'll leave it up to someone else if they want further details/formatting) a few more accessor functions for artifact data
This commit is contained in:
parent
6d24279106
commit
3e12534456
@ -23,6 +23,9 @@ window.artifact.setup = function() {
|
|||||||
|
|
||||||
artifact._layer = new L.LayerGroup();
|
artifact._layer = new L.LayerGroup();
|
||||||
addLayerGroup ('Artifacts (Jarvis shards)', artifact._layer, true);
|
addLayerGroup ('Artifacts (Jarvis shards)', artifact._layer, true);
|
||||||
|
|
||||||
|
$('#toolbox').append(' <a onclick="window.artifact.showArtifactList()" title="Show artifact portal list (jarvis shards and targets)">Artifacts</a>');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.artifact.requestData = function() {
|
window.artifact.requestData = function() {
|
||||||
@ -69,6 +72,8 @@ window.artifact.processData = function(data) {
|
|||||||
console.warn('Note: unknown artifactId '+artData.artifactId+' - guessing how to handle it');
|
console.warn('Note: unknown artifactId '+artData.artifactId+' - guessing how to handle it');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
artifact.artifactTypes[artData.artifactId] = artData.artifactId;
|
||||||
|
|
||||||
if (artData.fragmentInfos) {
|
if (artData.fragmentInfos) {
|
||||||
artifact.processFragmentInfos (artData.artifactId, artData.fragmentInfos);
|
artifact.processFragmentInfos (artData.artifactId, artData.fragmentInfos);
|
||||||
}
|
}
|
||||||
@ -90,6 +95,7 @@ window.artifact.processData = function(data) {
|
|||||||
window.artifact.clearData = function() {
|
window.artifact.clearData = function() {
|
||||||
|
|
||||||
artifact.portalInfo = {};
|
artifact.portalInfo = {};
|
||||||
|
artifact.artifactTypes = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
window.artifact.processFragmentInfos = function (id, fragments) {
|
window.artifact.processFragmentInfos = function (id, fragments) {
|
||||||
@ -121,6 +127,13 @@ window.artifact.processTargetInfos = function (id, targets) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.artifact.getArtifactTypes = function() {
|
||||||
|
return Object.keys(artifact.artifactTypes);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.artifact.isArtifact = function(type) {
|
||||||
|
return type in artifact.artifactTypes;
|
||||||
|
}
|
||||||
|
|
||||||
// used to render portals that would otherwise be below the visible level
|
// used to render portals that would otherwise be below the visible level
|
||||||
window.artifact.getArtifactEntities = function() {
|
window.artifact.getArtifactEntities = function() {
|
||||||
@ -136,6 +149,10 @@ window.artifact.getArtifactEntities = function() {
|
|||||||
return entities;
|
return entities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.artifact.getInterestingPortals = function() {
|
||||||
|
return Object.keys(artifact.portalInfo);
|
||||||
|
}
|
||||||
|
|
||||||
// quick test for portal being relevant to artifacts - of any type
|
// quick test for portal being relevant to artifacts - of any type
|
||||||
window.artifact.isInterestingPortal = function(guid) {
|
window.artifact.isInterestingPortal = function(guid) {
|
||||||
return guid in artifact.portalInfo;
|
return guid in artifact.portalInfo;
|
||||||
@ -186,3 +203,47 @@ window.artifact.updateLayer = function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
window.artifact.showArtifactList = function() {
|
||||||
|
|
||||||
|
|
||||||
|
var html = '<div><b>Artifact portals</b></div>';
|
||||||
|
|
||||||
|
var types = { 'jarvis': 'Jarvis Shards' };
|
||||||
|
|
||||||
|
$.each(types, function(type, name) {
|
||||||
|
|
||||||
|
html += '<hr><div><b>'+types[type]+'</b></div>';
|
||||||
|
|
||||||
|
html += '<table><tr><th>Portal</th><th>Details</th></tr>';
|
||||||
|
|
||||||
|
$.each(artifact.portalInfo, function(guid, data) {
|
||||||
|
if (type in data) {
|
||||||
|
// this portal has data for this artifact type - add it to the table
|
||||||
|
|
||||||
|
var onclick = 'zoomToAndShowPortal(\''+guid+'\',['+data._entityData.locationE6.latE6/1E6+','+data._entityData.locationE6.lngE6/1E6+'])';
|
||||||
|
html += '<tr><td><a onclick="'+onclick+'" title="'+escapeHtmlSpecialChars(data._entityData.portalV2.descriptiveText.ADDRESS||'')+'">'+escapeHtmlSpecialChars(data._entityData.portalV2.descriptiveText.TITLE)+'</a></td>';
|
||||||
|
|
||||||
|
html += '<td>';
|
||||||
|
|
||||||
|
if (data[type].target) {
|
||||||
|
html += '<span class="'+TEAM_TO_CSS[data[type].target]+'">'+(data[type].target==TEAM_RES?'Resistance':'Enlightened')+' target</span> ';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data[type].fragments) {
|
||||||
|
html += '<span class="fragments">Shard: #'+data[type].fragments.join(', #')+'</span> ';
|
||||||
|
}
|
||||||
|
|
||||||
|
html += '</td></tr>';
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
html += '</table>';
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dialog({title: 'Artefacts', html: html, width: 400});
|
||||||
|
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user