new reduced map data: first pass at loading the new format

This commit is contained in:
Jon Atkins 2013-11-30 04:15:17 +00:00
parent 20b4a10347
commit b9c8e9c6c5
8 changed files with 61 additions and 351 deletions

View File

@ -171,7 +171,7 @@ window.artifact.updateLayer = function() {
artifact._layer.clearLayers(); artifact._layer.clearLayers();
$.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.latE6/1E6, data._entityData.lngE6/1E6]);
// jarvis shard icon // jarvis shard icon
var iconUrl = undefined; var iconUrl = undefined;
@ -235,7 +235,7 @@ window.artifact.showArtifactList = function() {
var sortVal = 0; var sortVal = 0;
var onclick = 'zoomToAndShowPortal(\''+guid+'\',['+data._entityData.locationE6.latE6/1E6+','+data._entityData.locationE6.lngE6/1E6+'])'; var onclick = 'zoomToAndShowPortal(\''+guid+'\',['+data._entityData.latE6/1E6+','+data._entityData.lngE6/1E6+'])';
var row = '<tr><td class="portal"><a onclick="'+onclick+'" title="'+escapeHtmlSpecialChars(data._entityData.portalV2.descriptiveText.ADDRESS||'')+'">'+escapeHtmlSpecialChars(data._entityData.portalV2.descriptiveText.TITLE)+'</a></td>'; var row = '<tr><td class="portal"><a onclick="'+onclick+'" title="'+escapeHtmlSpecialChars(data._entityData.portalV2.descriptiveText.ADDRESS||'')+'">'+escapeHtmlSpecialChars(data._entityData.portalV2.descriptiveText.TITLE)+'</a></td>';
row += '<td class="info">'; row += '<td class="info">';

View File

@ -127,7 +127,7 @@ window.chat.requestFaction = function(getOlderMsgs, isRetry) {
var d = chat.genPostData(true, chat._faction, getOlderMsgs); var d = chat.genPostData(true, chat._faction, getOlderMsgs);
var r = window.postAjax( var r = window.postAjax(
'getPaginatedPlextsV2', 'getPaginatedPlexts',
d, d,
function(data, textStatus, jqXHR) { chat.handleFaction(data, getOlderMsgs); }, function(data, textStatus, jqXHR) { chat.handleFaction(data, getOlderMsgs); },
isRetry isRetry
@ -178,7 +178,7 @@ window.chat.requestPublic = function(getOlderMsgs, isRetry) {
var d = chat.genPostData(false, chat._public, getOlderMsgs); var d = chat.genPostData(false, chat._public, getOlderMsgs);
var r = window.postAjax( var r = window.postAjax(
'getPaginatedPlextsV2', 'getPaginatedPlexts',
d, d,
function(data, textStatus, jqXHR) { chat.handlePublic(data, getOlderMsgs); }, function(data, textStatus, jqXHR) { chat.handlePublic(data, getOlderMsgs); },
isRetry isRetry

View File

@ -8,8 +8,14 @@
// given the entity detail data, returns the team the entity belongs // given the entity detail data, returns the team the entity belongs
// to. Uses TEAM_* enum values. // to. Uses TEAM_* enum values.
window.getTeam = function(details) { window.getTeam = function(details) {
return teamStringToId(details.controllingTeam.team);
}
window.teamStringToId = function(teamStr) {
var team = TEAM_NONE; var team = TEAM_NONE;
if(details.controllingTeam.team === 'ALIENS' || details.controllingTeam.team === 'ENLIGHTENED') team = TEAM_ENL; if(teamStr === 'ENLIGHTENED') team = TEAM_ENL;
if(details.controllingTeam.team === 'RESISTANCE') team = TEAM_RES; if(teamStr === 'RESISTANCE') team = TEAM_RES;
return team; return team;
} }

View File

@ -104,7 +104,6 @@ window.Render.prototype.processDeletedGameEntityGuids = function(deleted) {
} }
window.Render.prototype.processGameEntities = function(entities) { window.Render.prototype.processGameEntities = function(entities) {
var portalGuids = [];
for (var i in entities) { for (var i in entities) {
var ent = entities[i]; var ent = entities[i];
@ -112,14 +111,9 @@ window.Render.prototype.processGameEntities = function(entities) {
// don't create entities in the 'deleted' list // don't create entities in the 'deleted' list
if (!(ent[0] in this.deletedGuid)) { if (!(ent[0] in this.deletedGuid)) {
this.createEntity(ent); this.createEntity(ent);
if ('portalV2' in ent[2]) portalGuids.push(ent[0]);
} }
} }
// now reconstruct links 'optimised' out of the data from the portal link data
for (var i in portalGuids) {
this.createLinksFromPortalData(portalGuids[i]);
}
} }
@ -130,6 +124,7 @@ window.Render.prototype.endRenderPass = function() {
// check to see if there are any entities we haven't seen. if so, delete them // check to see if there are any 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 // special case for selected portal - it's kept even if not seen
// artifact (e.g. jarvis shard) portals are also kept - but they're always 'seen'
if (!(guid in this.seenPortalsGuid) && guid !== selectedPortal) { if (!(guid in this.seenPortalsGuid) && guid !== selectedPortal) {
this.deletePortalEntity(guid); this.deletePortalEntity(guid);
} }
@ -214,22 +209,6 @@ window.Render.prototype.deleteFieldEntity = function(guid) {
var f = window.fields[guid]; var f = window.fields[guid];
var fd = f.options.details; var fd = f.options.details;
var deletePortalLinkedField = function(pguid) {
if (pguid in window.portals) {
var pd = window.portals[pguid].options.details;
if (pd.portalV2.linkedFields) {
var i = pd.portalV2.linkedFields.indexOf(guid);
if (i >= 0) {
pd.portalV2.linkedFields.splice(i,1);
}
}
}
}
deletePortalLinkedField (fd.capturedRegion.vertexA.guid);
deletePortalLinkedField (fd.capturedRegion.vertexB.guid);
deletePortalLinkedField (fd.capturedRegion.vertexC.guid);
fieldsFactionLayers[f.options.team].removeLayer(f); fieldsFactionLayers[f.options.team].removeLayer(f);
delete window.fields[guid]; delete window.fields[guid];
} }
@ -244,23 +223,30 @@ window.Render.prototype.createEntity = function(ent) {
// logic on detecting entity type based on the stock site javascript. // logic on detecting entity type based on the stock site javascript.
if ("portalV2" in ent[2]) { switch (ent[2].type) {
this.createPortalEntity(ent); case 'portal':
} else if ("capturedRegion" in ent[2]) { this.createPortalEntity(ent);
this.createFieldEntity(ent); break;
} else if ("edge" in ent[2]) {
this.createLinkEntity(ent);
} else {
console.warn("Unknown entity found: "+JSON.stringify(ent));
}
case 'edge':
this.createLinkEntity(ent);
break;
case 'region':
this.createFieldEntity(ent);
break;
default:
console.warn('unknown entity found: '+JSON.stringify(ent));
break;
}
} }
window.Render.prototype.createPortalEntity = function(ent) { window.Render.prototype.createPortalEntity = function(ent) {
this.seenPortalsGuid[ent[0]] = true; // flag we've seen it this.seenPortalsGuid[ent[0]] = true; // flag we've seen it
var previousDetails = undefined; var previousData = undefined;
// check if entity already exists // check if entity already exists
if (ent[0] in window.portals) { if (ent[0] in window.portals) {
@ -275,21 +261,15 @@ window.Render.prototype.createPortalEntity = function(ent) {
// remember the old details, for the callback // remember the old details, for the callback
previousDetails = p.options.details; previousData = p.options.data;
this.deletePortalEntity(ent[0]); this.deletePortalEntity(ent[0]);
} }
var portalLevel = getPortalLevel(ent[2]); var portalLevel = parseInt(ent[2].level);
var team = getTeam(ent[2]); var team = teamStringToId(ent[2].team);
var latlng = L.latLng(ent[2].locationE6.latE6/1E6, ent[2].locationE6.lngE6/1E6); var latlng = L.latLng(ent[2].latE6/1E6, ent[2].lngE6/1E6);
//TODO: move marker creation, style setting, etc into a separate class
//(as it's called from elsewhere - e.g. selecting/deselecting portals)
//ALSO: change API for highlighters - make them return the updated style rather than directly calling setStyle on the portal marker
//(can this be done in a backwardly-compatible way??)
var dataOptions = { var dataOptions = {
level: portalLevel, level: portalLevel,
@ -297,32 +277,16 @@ window.Render.prototype.createPortalEntity = function(ent) {
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 .details instead
guid: ent[0], guid: ent[0],
timestamp: ent[1], timestamp: ent[1],
details: ent[2] data: { summary: ent[2] },
}; };
// Javascript uses references for objects. For now, at least, we need to modify the data within
// the options.details.portalV2 (to add in linkedFields). To avoid tainting the original data (which may be cached)
// we'll shallow-copy these items
dataOptions.details = $.extend({}, dataOptions.details);
dataOptions.details.portalV2 = $.extend({}, dataOptions.details.portalV2);
// create a linkedFields entry and add it to details - various bits of code assumes it will exist
for (var fguid in window.fields) {
var fd = window.fields[fguid].options.details;
if ( fd.capturedRegion.vertexA.guid == ent[0] || fd.capturedRegion.vertexB.guid == ent[0] || fd.capturedRegion.vertexC.guid == ent[0]) {
if (!dataOptions.details.portalV2.linkedFields) dataOptions.details.portalV2.linkedFields = [];
dataOptions.details.portalV2.linkedFields.push(fguid);
}
}
var marker = createMarker(latlng, dataOptions); var marker = createMarker(latlng, dataOptions);
marker.on('click', function() { window.renderPortalDetails(ent[0]); }); marker.on('click', function() { window.renderPortalDetails(ent[0]); });
marker.on('dblclick', function() { window.renderPortalDetails(ent[0]); window.map.setView(latlng, 17); }); marker.on('dblclick', function() { window.renderPortalDetails(ent[0]); window.map.setView(latlng, 17); });
window.runHooks('portalAdded', {portal: marker, previousDetails: previousDetails}); window.runHooks('portalAdded', {portal: marker, previousData: previousData});
window.portals[ent[0]] = marker; window.portals[ent[0]] = marker;
@ -370,12 +334,11 @@ window.Render.prototype.createFieldEntity = function(ent) {
this.deleteFieldEntity(ent[0]); // option 2, for now this.deleteFieldEntity(ent[0]); // option 2, for now
} }
var team = getTeam(ent[2]); var team = teamStringToId(ent[2].team);
var reg = ent[2].capturedRegion;
var latlngs = [ var latlngs = [
L.latLng(reg.vertexA.location.latE6/1E6, reg.vertexA.location.lngE6/1E6), L.latLng(ent[2].points[0].latE6/1E6, ent[2].points[0].lngE6/1E6),
L.latLng(reg.vertexB.location.latE6/1E6, reg.vertexB.location.lngE6/1E6), L.latLng(ent[2].points[1].latE6/1E6, ent[2].points[1].lngE6/1E6),
L.latLng(reg.vertexC.location.latE6/1E6, reg.vertexC.location.lngE6/1E6) L.latLng(ent[2].points[2].latE6/1E6, ent[2].points[2].lngE6/1E6)
]; ];
var poly = L.geodesicPolygon(latlngs, { var poly = L.geodesicPolygon(latlngs, {
@ -387,27 +350,9 @@ window.Render.prototype.createFieldEntity = function(ent) {
team: team, team: team,
guid: ent[0], guid: ent[0],
timestamp: ent[1], timestamp: ent[1],
details: ent[2],
// LEGACY FIELDS: these duplicate data available via .details, as IITC previously stored it in data and vertices
data: ent[2], data: ent[2],
vertices: ent[2].capturedRegion
}); });
// now fill in any references portals linkedFields data
var addPortalLinkedField = function(pguid) {
if (pguid in window.portals) {
var pd = window.portals[pguid].options.details;
if (!pd.portalV2.linkedFields) pd.portalV2.linkedFields = [];
if (pd.portalV2.linkedFields.indexOf(pguid) <0 ) {
pd.portalV2.linkedFields.push (ent[0]);
}
}
}
addPortalLinkedField(ent[2].capturedRegion.vertexA.guid);
addPortalLinkedField(ent[2].capturedRegion.vertexB.guid);
addPortalLinkedField(ent[2].capturedRegion.vertexC.guid);
runHooks('fieldAdded',{field: poly}); runHooks('fieldAdded',{field: poly});
window.fields[ent[0]] = poly; window.fields[ent[0]] = poly;
@ -433,11 +378,10 @@ 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 = getTeam(ent[2]); var team = teamStringToId(ent[2].team);
var edge = ent[2].edge;
var latlngs = [ var latlngs = [
L.latLng(edge.originPortalLocation.latE6/1E6, edge.originPortalLocation.lngE6/1E6), L.latLng(ent[2].oLatE6/1E6, ent[2].oLngE6/1E6),
L.latLng(edge.destinationPortalLocation.latE6/1E6, edge.destinationPortalLocation.lngE6/1E6) L.latLng(ent[2].dLatE6/1E6, ent[2].dLngE6/1E6)
]; ];
var poly = L.geodesicPolyline(latlngs, { var poly = L.geodesicPolyline(latlngs, {
color: COLORS[team], color: COLORS[team],
@ -448,8 +392,6 @@ window.Render.prototype.createLinkEntity = function(ent,faked) {
team: team, team: team,
guid: ent[0], guid: ent[0],
timestamp: ent[1], timestamp: ent[1],
details: ent[2],
// LEGACY FIELDS: these duplicate data available via .details, as IITC previously stored it in data and vertices
data: ent[2] data: ent[2]
}); });
@ -465,56 +407,6 @@ window.Render.prototype.createLinkEntity = function(ent,faked) {
} }
window.Render.prototype.createLinksFromPortalData = function(portalGuid) {
var sourcePortal = portals[portalGuid];
for (var sourceLinkIndex in sourcePortal.options.details.portalV2.linkedEdges||[]) {
var sourcePortalLinkInfo = sourcePortal.options.details.portalV2.linkedEdges[sourceLinkIndex];
// portals often contain details for edges that don't exist. so only consider faking an edge if this
// is the origin portal
if (sourcePortalLinkInfo.isOrigin) {
// ... and the other porta has matching link information.
if (sourcePortalLinkInfo.otherPortalGuid in portals) {
var targetPortal = portals[sourcePortalLinkInfo.otherPortalGuid];
for (var targetLinkIndex in targetPortal.options.details.portalV2.linkedEdges||[]) {
var targetPortalLinkInfo = targetPortal.options.details.portalV2.linkedEdges[targetLinkIndex];
if (targetPortalLinkInfo.edgeGuid == sourcePortalLinkInfo.edgeGuid) {
// yes - edge in both portals. create it
var fakeEnt = [
sourcePortalLinkInfo.edgeGuid,
0, // mtime for entity data - unknown when faking it, so zero will be the oldest possible
{
controllingTeam: sourcePortal.options.details.controllingTeam,
edge: {
originPortalGuid: portalGuid,
originPortalLocation: sourcePortal.options.details.locationE6,
destinationPortalGuid: sourcePortalLinkInfo.otherPortalGuid,
destinationPortalLocation: targetPortal.options.details.locationE6
}
}
];
this.createLinkEntity(fakeEnt,true);
}
}
}
}
}
}
window.Render.prototype.updateEntityVisibility = function() { window.Render.prototype.updateEntityVisibility = function() {
if (this.entityVisibilityZoom === undefined || this.entityVisibilityZoom != map.getZoom()) { if (this.entityVisibilityZoom === undefined || this.entityVisibilityZoom != map.getZoom()) {

View File

@ -391,7 +391,7 @@ window.MapDataRequest.prototype.sendTileRequest = function(tiles) {
var savedThis = this; var savedThis = this;
// NOTE: don't add the request with window.request.add, as we don't want the abort handling to apply to map data any more // NOTE: don't add the request with window.request.add, as we don't want the abort handling to apply to map data any more
window.postAjax('getThinnedEntitiesV4', data, window.postAjax('getThinnedEntities', data,
function(data, textStatus, jqXHR) { savedThis.handleResponse (data, tiles, true); }, // request successful callback function(data, textStatus, jqXHR) { savedThis.handleResponse (data, tiles, true); }, // request successful callback
function() { savedThis.handleResponse (undefined, tiles, false); } // request failed callback function() { savedThis.handleResponse (undefined, tiles, false); } // request failed callback
); );

View File

@ -14,145 +14,16 @@
var requestParameterMunges = [ var requestParameterMunges = [
// obsolete munge sets (they don't have some of the new parameters) deleted // obsolete munge sets (they don't have some of the new parameters) deleted
// set 7 - 2013-11-06
{
'dashboard.getArtifactInfo': 'artifacts', // GET_ARTIFACT_INFO: new (and not obfuscated?!)
'dashboard.getGameScore': 'yol4dxx5ufqolhk2', // GET_GAME_SCORE
'dashboard.getPaginatedPlextsV2': '7b83j2z81rtk6101', // GET_PAGINATED_PLEXTS
'dashboard.getThinnedEntitiesV4': '46su4lrisoq28gxh', // GET_THINNED_ENTITIES
'dashboard.getPlayersByGuids': 'wsc5puahrymtf1qh', // LOOKUP_PLAYERS
'dashboard.redeemReward': 'oo0n7pw2m0xufpzx', // REDEEM_REWARD
'dashboard.sendInviteEmail': 'bo1bp74rz8kbdjkb', // SEND_INVITE_EMAIL
'dashboard.sendPlext': 'q0f8o4v9t8pt91yv', // SEND_PLEXT
// common parameters
method: 'imo60cdzkemxduub',
version: '54lh4o0q7nz7dao9', //guessed parameter name - only seen munged
version_parameter: '370c0b4e160ed26c8c4ce40f10f546545730e1ef', // passed as the value to the above parameter
// GET_THINNED_ENTITIES
quadKeys: 'iqy8e2d3zpne0cmh', //guessed parameter name - only seen munged
// GET_PAGINATED_PLEXTS
desiredNumItems: 'chwe3yko3xy0qlk3',
minLatE6: 'f31z3x27ua8i05cf',
minLngE6: 't0rmob7f42c0w04r',
maxLatE6: 'ebwfvri5io9q0tvu',
maxLngE6: 'lfqzvpj92dp8uxo6',
minTimestampMs: '23a6djyyieeaeduu',
maxTimestampMs: 'zhjtsm2gw7w3b7mx',
chatTab: 'tak64gipm3hhqpnh', //guessed parameter name - only seen munged
ascendingTimestampOrder: 'v5rzzxtg5rmry3dx',
// SEND_PLEXT
message: 'onptntn3szan21lj',
latE6: '1jq9lgu3hjajrt7s',
lngE6: 'plbubiopnavbxxh6',
// chatTab: 'tak64gipm3hhqpnh', //guessed parameter name - only seen munged
// LOOKUP_PLAYERS
guids: '919p2cfpdo2wz03n',
// SEND_INVITE_EMAIL
inviteeEmailAddress: 'thpbnoyjx0antwm5',
},
// set 8 - 2013-11-07
{
'dashboard.getArtifactInfo': 'artifacts', // GET_ARTIFACT_INFO: new (and not obfuscated?!)
'dashboard.getGameScore': 'lls4clhel87apzpa', // GET_GAME_SCORE
'dashboard.getPaginatedPlextsV2': 'r6n2xgcd8wjsm4og', // GET_PAGINATED_PLEXTS
'dashboard.getThinnedEntitiesV4': '1ybigzcf2sifu34b', // GET_THINNED_ENTITIES
'dashboard.getPlayersByGuids': 'uig0xeb6trclqd2l', // LOOKUP_PLAYERS
'dashboard.redeemReward': '7dd7x64cc2lbutoq', // REDEEM_REWARD
'dashboard.sendInviteEmail': 'd8p6dvwilsr460u3', // SEND_INVITE_EMAIL
'dashboard.sendPlext': 'repg2orpg7htkoto', // SEND_PLEXT
// common parameters
method: '97aes4vnlvyhoxik',
version: 'an8mglz21qabq3wq', //guessed parameter name - only seen munged
version_parameter: 'b92c9d055fcdf715887b173c706e7a2c267e32c5', // passed as the value to the above parameter
// GET_THINNED_ENTITIES
quadKeys: 'mhjknavysslwfhk6', //guessed parameter name - only seen munged
// GET_PAGINATED_PLEXTS
desiredNumItems: 'l61g8u397alq3j1x',
minLatE6: 'wwsvpboc5bxd1s9q',
minLngE6: '48l4x7ngfsz47z3u',
maxLatE6: 'p3m1qg81uqldizu6',
maxLngE6: 'h4kv1eef878vfyk3',
minTimestampMs: 'uj1vcy9ufws24v2c',
maxTimestampMs: '8pt1x5nd9hk5vakv',
chatTab: 'zy1yc1rfczashshu', //guessed parameter name - only seen munged
ascendingTimestampOrder: 'duyuskmky68nl2ci',
// SEND_PLEXT
message: 'xktwjguq0nohzioa',
latE6: 'm4crflfaibmg9mdf',
lngE6: 'h6jfungrw5ii830r',
// chatTab: 'zy1yc1rfczashshu', //guessed parameter name - only seen munged
// LOOKUP_PLAYERS
guids: '3u9h9cpfh2yiy4fk',
// SEND_INVITE_EMAIL
inviteeEmailAddress: 'jpg3y4ax7t0w356j',
},
// set 9 - 2013-11-1
{
'dashboard.getArtifactInfo': 'artifacts', // GET_ARTIFACT_INFO: new (and not obfuscated?!)
'dashboard.getGameScore': '9w8phj2dccvns3t9', // GET_GAME_SCORE
'dashboard.getPaginatedPlextsV2': '3b1nc3ub0sd1704x', // GET_PAGINATED_PLEXTS
'dashboard.getThinnedEntitiesV4': '2xa55qj41qrhfhas', // GET_THINNED_ENTITIES
'dashboard.getPlayersByGuids': '734hxjh89d53clqq', // LOOKUP_PLAYERS
'dashboard.redeemReward': 'k3hwg41wf112gjjh', // REDEEM_REWARD
'dashboard.sendInviteEmail': 'uwizjeb18xmcesa0', // SEND_INVITE_EMAIL
'dashboard.sendPlext': '5au1m1hut1gyvnix', // SEND_PLEXT
// common parameters
method: '3sld77nsm0tjmkvi',
version: 'xz7q6r3aja5ttvoo', //guessed parameter name - only seen munged
version_parameter: 'b121024077de2a0dc6b34119e4440785c9ea5e64', // passed as the value to the above parameter
// GET_THINNED_ENTITIES
quadKeys: '0o6bkrbwevwn6bg1', //guessed parameter name - only seen munged
// GET_PAGINATED_PLEXTS
desiredNumItems: '3fketl1tv01q7vxu',
minLatE6: '5i6jhgbv3aq3c4qz',
minLngE6: 'pe2io3r932qysg4u',
maxLatE6: 'plzyuy89bnlb3pth',
maxLngE6: 'q0qq1ooc7sxpynth',
minTimestampMs: 'nc282s8hdklv21mw',
maxTimestampMs: 'ezrljj0l71gpelpu',
chatTab: 'efaznrayv5n3jxs0', //guessed parameter name - only seen munged
ascendingTimestampOrder: 'fcmlcb8ya0oa1clk',
// SEND_PLEXT
message: 'jg4ms2i14rgzi02n',
latE6: 'nkf3evzpkxkq8l2q',
lngE6: '7xoz0xl8se4d1j53',
// chatTab: 'efaznrayv5n3jxs0', //guessed parameter name - only seen munged
// LOOKUP_PLAYERS
guids: 'm4dcrdltldigfo94',
// SEND_INVITE_EMAIL
inviteeEmailAddress: 'rye9be4um2t1z5ts',
},
// set 10 - 2013-11-27 // set 10 - 2013-11-27
{ {
'dashboard.getArtifactInfo': 'artifacts', 'dashboard.getArtifactInfo': 'artifacts', // GET_ARTIFACT_INFO
'dashboard.getGameScore': '4oid643d9zc168hs', 'dashboard.getGameScore': '4oid643d9zc168hs', // GET_GAME_SCORE
'dashboard.getPaginatedPlextsV2': 's1msyywq51ntudpe', 'dashboard.getPaginatedPlexts': 's1msyywq51ntudpe', // GET_PAGINATED_PLEXTS
'dashboard.getThinnedEntitiesV4': '4467ff9bgxxe4csa', 'dashboard.getThinnedEntities': '4467ff9bgxxe4csa', // GET_THINNED_ENTITIES
'dashboard.getPortalDetails': 'c00thnhf1yp3z6mn', // GET_PORTAL_DETAILS
'dashboard.redeemReward': '66l9ivg39ygfqqjm', 'dashboard.redeemReward': '66l9ivg39ygfqqjm', // REDEEM_REWARD
'dashboard.sendInviteEmail': 'cgb7hi5hglv0xx8k', 'dashboard.sendInviteEmail': 'cgb7hi5hglv0xx8k', // SEND_INVITE_EMAIL
'dashboard.sendPlext': 'etn9xq7brd6947kq', 'dashboard.sendPlext': 'etn9xq7brd6947kq', // SEND_PLEXT
// common parameters // common parameters
method: 'yyngyttbmmbuvdpa', method: 'yyngyttbmmbuvdpa',
@ -179,8 +50,8 @@ var requestParameterMunges = [
lngE6: '3dlxsqrjj2vcmhbc', lngE6: '3dlxsqrjj2vcmhbc',
// chatTab: 'efaznrayv5n3jxs0', //guessed parameter name - only seen munged // chatTab: 'efaznrayv5n3jxs0', //guessed parameter name - only seen munged
// LOOKUP_PLAYERS // GET_PORTAL_DETAILS
guids: '', guid: 'seg6ohxgnqf9xu9w',
// SEND_INVITE_EMAIL // SEND_INVITE_EMAIL
inviteeEmailAddress: '8exta9k7y8huhqmc', inviteeEmailAddress: '8exta9k7y8huhqmc',
@ -203,9 +74,9 @@ function extractMungeFromStock() {
// these are easy - directly available in variables // these are easy - directly available in variables
foundMunges['dashboard.getArtifactInfo'] = nemesis.dashboard.requests.MethodName.GET_ARTIFACT_INFO; foundMunges['dashboard.getArtifactInfo'] = nemesis.dashboard.requests.MethodName.GET_ARTIFACT_INFO;
foundMunges['dashboard.getGameScore'] = nemesis.dashboard.requests.MethodName.GET_GAME_SCORE; foundMunges['dashboard.getGameScore'] = nemesis.dashboard.requests.MethodName.GET_GAME_SCORE;
foundMunges['dashboard.getPaginatedPlextsV2'] = nemesis.dashboard.requests.MethodName.GET_PAGINATED_PLEXTS; foundMunges['dashboard.getPaginatedPlexts'] = nemesis.dashboard.requests.MethodName.GET_PAGINATED_PLEXTS;
foundMunges['dashboard.getThinnedEntitiesV4'] = nemesis.dashboard.requests.MethodName.GET_THINNED_ENTITIES; foundMunges['dashboard.getThinnedEntities'] = nemesis.dashboard.requests.MethodName.GET_THINNED_ENTITIES;
foundMunges['dashboard.getPlayersByGuids'] = nemesis.dashboard.requests.MethodName.LOOKUP_PLAYERS; foundMunges['dashboard.getPortalDetails'] = nemesis.dashboard.requests.MethodName.GET_PORTAL_DETAILS;
foundMunges['dashboard.redeemReward'] = nemesis.dashboard.requests.MethodName.REDEEM_REWARD; foundMunges['dashboard.redeemReward'] = nemesis.dashboard.requests.MethodName.REDEEM_REWARD;
foundMunges['dashboard.sendInviteEmail'] = nemesis.dashboard.requests.MethodName.SEND_INVITE_EMAIL; foundMunges['dashboard.sendInviteEmail'] = nemesis.dashboard.requests.MethodName.SEND_INVITE_EMAIL;
foundMunges['dashboard.sendPlext'] = nemesis.dashboard.requests.MethodName.SEND_PLEXT; foundMunges['dashboard.sendPlext'] = nemesis.dashboard.requests.MethodName.SEND_PLEXT;
@ -261,11 +132,11 @@ function extractMungeFromStock() {
var chatTab = result[7] || result[8]; var chatTab = result[7] || result[8];
if (chatTab != foundMunges.chatTab) throw 'Error: inconsistent munge parsing for chatTab'; if (chatTab != foundMunges.chatTab) throw 'Error: inconsistent munge parsing for chatTab';
// LOOKUP_PLAYERS // GET_PORTAL_DETAILS
var reg = new RegExp('LOOKUP_PLAYERS, {'+mungeRegExpLit+'a}'); var reg = new RegExp('GET_PORTAL_DETAILS, {'+mungeRegExpLit+'a}');
var result = reg.exec(nemesis.dashboard.network.DataFetcher.prototype.lookupPlayersByGuids.toString()); var result = reg.exec(nemesis.dashboard.network.DataFetcher.prototype.getPortalDetails.toString());
foundMunges.guids = result[1] || result[2]; foundMunges.guid = result[1] || result[2];
// SEND_INVITE_EMAIL // SEND_INVITE_EMAIL
var reg = new RegExp('SEND_INVITE_EMAIL, {'+mungeRegExpLit+'b}'); var reg = new RegExp('SEND_INVITE_EMAIL, {'+mungeRegExpLit+'b}');

View File

@ -57,62 +57,6 @@ window.playerNameToGuid = function(playerName) {
return guid; return guid;
} }
// resolves all player GUIDs that have been added to the list. Reruns
// renderPortalDetails when finished, so that then-unresolved names
// get replaced by their correct versions.
window.resolvePlayerNames = function() {
if(window.playersToResolve.length === 0) return;
//limit per request. stock site is never more than 13 (8 res, 4 mods, owner)
//testing shows 15 works and 20 fails
var MAX_RESOLVE_PLAYERS_PER_REQUEST = 15;
var MAX_RESOLVE_REQUESTS = 8;
if (window.playersToResolve.length > MAX_RESOLVE_PLAYERS_PER_REQUEST*MAX_RESOLVE_REQUESTS) {
console.log('Warning: player name resolve queue had '+window.playersToResolve.length+' entries. Limiting to the first '+MAX_RESOLVE_PLAYERS_PER_REQUEST*MAX_RESOLVE_REQUESTS+' to prevent excessive requests');
window.playersToResolve = playersToResolve.slice(0,MAX_RESOLVE_PLAYERS_PER_REQUEST*MAX_RESOLVE_REQUESTS);
}
var p = window.playersToResolve.slice(0,MAX_RESOLVE_PLAYERS_PER_REQUEST);
window.playersToResolve = playersToResolve.slice(MAX_RESOLVE_PLAYERS_PER_REQUEST);
var d = {guids: p};
window.playersInResolving = window.playersInResolving.concat(p);
postAjax('getPlayersByGuids', d, function(dat) {
var resolvedName = {};
if(dat.result) {
$.each(dat.result, function(ind, player) {
window.setPlayerName(player.guid, player.nickname);
resolvedName[player.guid] = player.nickname;
// remove from array
window.playersInResolving.splice(window.playersInResolving.indexOf(player.guid), 1);
});
} else {
//no 'result' - a successful http request, but the returned result was an error of some kind
console.warn('getplayers problem - no result in response: '+dat);
//likely to be some kind of 'bad request' (e.g. too many names at once, or otherwise badly formatted data.
//therefore, not a good idea to automatically retry by adding back to the playersToResolve list
}
// Run hook 'playerNameResolved' with the resolved player names
window.runHooks('playerNameResolved', {names: resolvedName});
//TODO: have an event triggered for this instead of hard-coded single function call
if(window.selectedPortal)
window.renderPortalDetails(window.selectedPortal);
//if more to do, run again
if(window.playersToResolve.length>0) resolvePlayerNames();
},
function() {
// append failed resolves to the list again
console.warn('resolving player guids failed: ' + p.join(', '));
window.playersToResolve.concat(p);
});
}
window.setPlayerName = function(guid, nick, uncertain) { window.setPlayerName = function(guid, nick, uncertain) {
// the 'uncertain' flag is set when we're scrolling back through chat. it's possible in this case // the 'uncertain' flag is set when we're scrolling back through chat. it's possible in this case

View File

@ -147,9 +147,6 @@ window.renderPortalDetails = function(guid) {
+ '</div>' + '</div>'
); );
// try to resolve names that were required for above functions, but
// weren't available yet.
resolvePlayerNames();
runHooks('portalDetailsUpdated', {portalDetails: d}); runHooks('portalDetailsUpdated', {portalDetails: d});
} }