Skip to content

Commit

Permalink
Support for ULTRA_LINK_AMPs
Browse files Browse the repository at this point in the history
  • Loading branch information
fkloft committed Jun 23, 2015
1 parent bd13278 commit a7387e3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
8 changes: 6 additions & 2 deletions code/portal_detail_display.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,15 @@ window.getPortalMiscDetails = function(guid,d) {

// collect some random data that’s not worth to put in an own method
var linkInfo = getPortalLinks(guid);
var maxOutgoing = getMaxOutgoingLinks(d);
var linkCount = linkInfo.in.length + linkInfo.out.length;
var links = {incoming: linkInfo.in.length, outgoing: linkInfo.out.length};

function linkExpl(t) { return '<tt title="'+links.outgoing+' links out (8 max)\n'+links.incoming+' links in\n('+(links.outgoing+links.incoming)+' total)">'+t+'</tt>'; }
var linksText = [linkExpl('links'), linkExpl(links.outgoing+' out / '+links.incoming+' in')];
var title = 'at most ' + maxOutgoing + ' outgoing links\n' +
links.outgoing + ' links out\n' +
links.incoming + ' links in\n' +
'(' + (links.outgoing+links.incoming) + ' total)'
var linksText = ['links', links.outgoing+' out / '+links.incoming+' in', title];

var player = d.owner
? '<span class="nickname">' + d.owner + '</span>'
Expand Down
1 change: 1 addition & 0 deletions code/portal_detail_display_tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ window.getModDetails = function(d) {
else if (key === 'ATTACK_FREQUENCY') val = (val/1000) +'x'; // 2000 = 2x
else if (key === 'FORCE_AMPLIFIER') val = (val/1000) +'x'; // 2000 = 2x
else if (key === 'LINK_RANGE_MULTIPLIER') val = (val/1000) +'x'; // 2000 = 2x
else if (key === 'LINK_DEFENSE_BOOST') val = (val/1000) +'x'; // 1500 = 1.5x
else if (key === 'REMOVAL_STICKINESS' && val > 100) val = (val/10000)+'%'; // an educated guess
// else display unmodified. correct for shield mitigation and multihack - unknown for future/other mods

Expand Down
14 changes: 13 additions & 1 deletion code/portal_info.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ window.getPortalModsByType = function(d, type) {
TURRET: 'HIT_BONUS', // and/or ATTACK_FREQUENCY??
HEATSINK: 'HACK_SPEED',
MULTIHACK: 'BURNOUT_INSULATION',
LINK_AMPLIFIER: 'LINK_RANGE_MULTIPLIER'
LINK_AMPLIFIER: 'LINK_RANGE_MULTIPLIER',
ULTRA_LINK_AMP: 'OUTGOING_LINKS_BONUS', // and/or LINK_DEFENSE_BOOST??
};

var stat = typeToStat[type];
Expand Down Expand Up @@ -257,6 +258,17 @@ window.getPortalMitigationDetails = function(d,linkCount) {
return mitigation;
}

window.getMaxOutgoingLinks = function(d) {
var linkAmps = getPortalModsByType(d, 'ULTRA_LINK_AMP');

var links = 8;

linkAmps.forEach(function(mod, i) {
links += parseInt(mod.stats.OUTGOING_LINKS_BONUS);
});

return links;
};

window.getPortalHackDetails = function(d) {

Expand Down
5 changes: 3 additions & 2 deletions code/utils_misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,11 @@ window.uniqueArray = function(arr) {
window.genFourColumnTable = function(blocks) {
var t = $.map(blocks, function(detail, index) {
if(!detail) return '';
var title = detail[2] ? ' title="'+escapeHtmlSpecialChars(detail[2]) + '"' : '';
if(index % 2 === 0)
return '<tr><td>'+detail[1]+'</td><th>'+detail[0]+'</th>';
return '<tr><td'+title+'>'+detail[1]+'</td><th'+title+'>'+detail[0]+'</th>';
else
return ' <th>'+detail[0]+'</th><td>'+detail[1]+'</td></tr>';
return ' <th'+title+'>'+detail[0]+'</th><td'+title+'>'+detail[1]+'</td></tr>';
}).join('');
if(t.length % 2 === 1) t + '<td></td><td></td></tr>';
return t;
Expand Down

0 comments on commit a7387e3

Please sign in to comment.