From 3e12534456ef9a90fe9f87075f0a34ef2c028c26 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Sun, 10 Nov 2013 04:04:08 +0000 Subject: [PATCH] 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 --- code/artifact.js | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/code/artifact.js b/code/artifact.js index 341d2a42..e8ece489 100644 --- a/code/artifact.js +++ b/code/artifact.js @@ -23,6 +23,9 @@ window.artifact.setup = function() { artifact._layer = new L.LayerGroup(); addLayerGroup ('Artifacts (Jarvis shards)', artifact._layer, true); + + $('#toolbox').append(' Artifacts'); + } 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'); } + artifact.artifactTypes[artData.artifactId] = artData.artifactId; + if (artData.fragmentInfos) { artifact.processFragmentInfos (artData.artifactId, artData.fragmentInfos); } @@ -90,6 +95,7 @@ window.artifact.processData = function(data) { window.artifact.clearData = function() { artifact.portalInfo = {}; + artifact.artifactTypes = {}; } 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 window.artifact.getArtifactEntities = function() { @@ -136,6 +149,10 @@ window.artifact.getArtifactEntities = function() { return entities; } +window.artifact.getInterestingPortals = function() { + return Object.keys(artifact.portalInfo); +} + // quick test for portal being relevant to artifacts - of any type window.artifact.isInterestingPortal = function(guid) { return guid in artifact.portalInfo; @@ -186,3 +203,47 @@ window.artifact.updateLayer = function() { }); } + + +window.artifact.showArtifactList = function() { + + + var html = '
Artifact portals
'; + + var types = { 'jarvis': 'Jarvis Shards' }; + + $.each(types, function(type, name) { + + html += '
'+types[type]+'
'; + + html += ''; + + $.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 += ''; + + html += ''; + + } + }); + + html += '
PortalDetails
'+escapeHtmlSpecialChars(data._entityData.portalV2.descriptiveText.TITLE)+''; + + if (data[type].target) { + html += ''+(data[type].target==TEAM_RES?'Resistance':'Enlightened')+' target '; + } + + if (data[type].fragments) { + html += 'Shard: #'+data[type].fragments.join(', #')+' '; + } + + html += '
'; + }); + + + dialog({title: 'Artefacts', html: html, width: 400}); + +}