add portal hack counts/cooldown time, and mitigation values, to the portal details panel

This commit is contained in:
Jon Atkins
2013-09-19 00:51:28 +01:00
parent a9c9d5ff41
commit 54997ac9bc
4 changed files with 89 additions and 5 deletions

View File

@ -146,7 +146,7 @@ window.getEnergyText = function(d) {
window.getAvgResoDistText = function(d) {
var avgDist = Math.round(10*getAvgResoDist(d))/10;
return ['reso dist', avgDist + ' m'];
return ['res dist', avgDist + ' m'];
}
window.getResonatorDetails = function(d) {
@ -226,8 +226,46 @@ window.getAttackApGainText = function(d) {
t += 'Enemy AP:\t' + breakdown.enemyAp + '\n';
t += ' Destroy AP:\t' + breakdown.destroyAp + '\n';
t += ' Capture AP:\t' + breakdown.captureAp + '\n';
return '<tt title="' + t + '">' + digits(text) + '</tt>';
return '<tt title="' + t + '">' + text + '</tt>';
}
return [tt('AP Gain'), tt(totalGain)];
return [tt('AP Gain'), tt(digits(totalGain))];
}
window.getHackDetailsText = function(d) {
var hackDetails = getPortalHackDetails(d);
var shortHackInfo = hackDetails.hacks+' @ '+formatInterval(hackDetails.cooldown);
function tt(text) {
var t = 'Hacks available every 4 hours\n';
t += 'Hack count:\t'+hackDetails.hacks+'\n';
t += 'Cooldown time:\t'+formatInterval(hackDetails.cooldown)+'\n';
t += 'Burnout time:\t'+formatInterval(hackDetails.burnout)+'\n';
return '<span title="'+t+'">'+text+'</span>';
}
return [tt('hacks'), tt(shortHackInfo)];
}
window.getMitigationText = function(d) {
var mitigationDetails = getPortalMitigationDetails(d);
var mitigationShort = mitigationDetails.total;
if (mitigationDetails.excess) mitigationShort += ' (+'+mitigationDetails.excess+')';
function tt(text) {
var t = 'Mitigation:\t'+mitigationDetails.total+'\n';
t += 'Shields:\t'+mitigationDetails.shields+'\n';
t += 'Links:\t'+mitigationDetails.links+'\n';
t += 'Excess:\t'+mitigationDetails.excess+'\n';
return '<span title="'+t+'">'+text+'</span>';
}
// 'mitigation' doesn't quite fit in the space.
return [tt('mitig…'), tt(mitigationShort)];
}