artifacts:

- like the selected portal, are not removed when off screen/below min level
- shard/target details shown on portal details for jarvis shards
This commit is contained in:
Jon Atkins 2013-11-08 06:09:24 +00:00
parent 15537e4e95
commit a595c2f11d
3 changed files with 35 additions and 10 deletions

View File

@ -136,16 +136,19 @@ window.artifact.getArtifactEntities = function() {
return entities; return entities;
} }
// quick test for portal being relevant to artifacts - of any type
window.artifact.isInterestingPortal = function(guid) {
return guid in artifact.portalInfo;
}
// get the artifact data for a specified artifact id (e.g. 'jarvis'), if it exists - otherwise returns something 'false'y
window.artifact.getPortalData = function(guid,artifactId) {
return artifact.portalInfo[guid] && artifact.portalInfo[guid][artifactId];
}
window.artifact.updateLayer = function() { window.artifact.updateLayer = function() {
artifact._layer.clearLayers(); artifact._layer.clearLayers();
// TODO: icons
// //commondatastorage.googleapis.com/ingress.com/img/map_icons/marker_images/jarvis_shard.png
// //commondatastorage.googleapis.com/ingress.com/img/map_icons/marker_images/jarvis_shard_target_0.png
// (replace '0' with count of shards at the target portal)
$.each(artifact.portalInfo, function(guid,data) { $.each(artifact.portalInfo, function(guid,data) {
var latlng = L.latLng ([data._entityData.locationE6.latE6/1E6, data._entityData.locationE6.lngE6/1E6]); var latlng = L.latLng ([data._entityData.locationE6.latE6/1E6, data._entityData.locationE6.lngE6/1E6]);

View File

@ -33,7 +33,8 @@ window.Render.prototype.clearPortalsBelowLevel = function(level) {
var count = 0; var count = 0;
for (var guid in window.portals) { for (var guid in window.portals) {
var p = portals[guid]; var p = portals[guid];
if (parseInt(p.options.level) < level && guid !== selectedPortal) { // clear portals below specified level - unless it's the selected portal, or it's relevant to artifacts
if (parseInt(p.options.level) < level && guid !== selectedPortal && !artifact.isInterestingPortal(guid)) {
this.deletePortalEntity(guid); this.deletePortalEntity(guid);
count++; count++;
} }
@ -46,7 +47,7 @@ window.Render.prototype.clearEntitiesOutsideBounds = function(bounds) {
for (var guid in window.portals) { for (var guid in window.portals) {
var p = portals[guid]; var p = portals[guid];
if (!bounds.contains (p.getLatLng()) && guid !== selectedPortal) { if (!bounds.contains (p.getLatLng()) && guid !== selectedPortal && !artifact.isInterestingPortal(guid)) {
this.deletePortalEntity(guid); this.deletePortalEntity(guid);
pcount++; pcount++;
} }
@ -128,6 +129,7 @@ window.Render.prototype.endRenderPass = function() {
// check to see if there's eny entities we haven't seen. if so, delete them // check to see if there's eny entities we haven't seen. if so, delete them
for (var guid in window.portals) { for (var guid in window.portals) {
// special case for selected portal - it's kept even if not seen
if (!(guid in this.seenPortalsGuid) && guid !== selectedPortal) { if (!(guid in this.seenPortalsGuid) && guid !== selectedPortal) {
this.deletePortalEntity(guid); this.deletePortalEntity(guid);
} }
@ -544,7 +546,7 @@ window.Render.prototype.resetPortalClusters = function() {
var guid = c[i]; var guid = c[i];
var p = window.portals[guid]; var p = window.portals[guid];
var layerGroup = portalsFactionLayers[parseInt(p.options.level)][p.options.team]; var layerGroup = portalsFactionLayers[parseInt(p.options.level)][p.options.team];
if (i<this.CLUSTER_PORTAL_LIMIT || p.options.guid == selectedPortal) { if (i<this.CLUSTER_PORTAL_LIMIT || p.options.guid == selectedPortal || artifact.isInterestingPortal(p.options.guid)) {
if (!layerGroup.hasLayer(p)) { if (!layerGroup.hasLayer(p)) {
layerGroup.addLayer(p); layerGroup.addLayer(p);
} }
@ -570,7 +572,7 @@ window.Render.prototype.addPortalToMapLayer = function(portal) {
// now, at this point, we could match the above re-clustr code - sorting, and adding/removing as necessary // now, at this point, we could match the above re-clustr code - sorting, and adding/removing as necessary
// however, it won't make a lot of visible difference compared to just pushing to the end of the list, then // however, it won't make a lot of visible difference compared to just pushing to the end of the list, then
// adding to the visible layer if the list is below the limit // adding to the visible layer if the list is below the limit
if (this.portalClusters[cid].length < this.CLUSTER_PORTAL_LIMIT || portal.options.guid == selectedPortal) { if (this.portalClusters[cid].length < this.CLUSTER_PORTAL_LIMIT || portal.options.guid == selectedPortal || artifact.isInterestingPortal(portal.options.guid)) {
portalsFactionLayers[parseInt(portal.options.level)][portal.options.team].addLayer(portal); portalsFactionLayers[parseInt(portal.options.level)][portal.options.team].addLayer(portal);
} }
} }

View File

@ -46,6 +46,26 @@ window.renderPortalDetails = function(guid) {
linkedFields, getAttackApGainText(d), linkedFields, getAttackApGainText(d),
getHackDetailsText(d), getMitigationText(d) getHackDetailsText(d), getMitigationText(d)
]; ];
// artifact details
//niantic hard-code the fact it's just jarvis shards/targets - so until more examples exist, we'll do the same
//(at some future point we can iterate through all the artifact types and add rows as needed)
var jarvisArtifact = artifact.getPortalData (guid, 'jarvis');
if (jarvisArtifact) {
// the genFourColumnTable function below doesn't handle cases where one column is null and the other isn't - so default to *someting* in both columns
var target = ['',''], shards = ['shards','(none)'];
if (jarvisArtifact.target) {
target = ['target', '<span class="'+TEAM_TO_CSS[jarvisArtifact.target]+'">'+(jarvisArtifact.target==TEAM_RES?'Resistance':'Enlightened')+'</span>'];
}
if (jarvisArtifact.fragments) {
shards = [jarvisArtifact.fragments.length>1?'shards':'shard', '#'+jarvisArtifact.fragments.join(', #')];
}
randDetails.push (target, shards);
}
randDetails = '<table id="randdetails">' + genFourColumnTable(randDetails) + '</table>'; randDetails = '<table id="randdetails">' + genFourColumnTable(randDetails) + '</table>';
var resoDetails = '<table id="resodetails">' + getResonatorDetails(d) + '</table>'; var resoDetails = '<table id="resodetails">' + getResonatorDetails(d) + '</table>';