update code to support extra level-related parameters supplied in the PLAYER object, negating the need for lists of XM and AP values per level
This commit is contained in:
parent
f0134d45f1
commit
395502dcef
22
code/boot.js
22
code/boot.js
@ -373,20 +373,20 @@ window.setMapBaseLayer = function() {
|
||||
// included as inline script in the original site, the data is static
|
||||
// and cannot be updated.
|
||||
window.setupPlayerStat = function() {
|
||||
var level;
|
||||
var ap = parseInt(PLAYER.ap);
|
||||
for(level = 0; level < MIN_AP_FOR_LEVEL.length; level++) {
|
||||
if(ap < MIN_AP_FOR_LEVEL[level]) break;
|
||||
}
|
||||
PLAYER.level = level;
|
||||
// stock site updated to supply the actual player level, AP requirements and XM capacity values
|
||||
var level = PLAYER.verified_level;
|
||||
PLAYER.level = level; //for historical reasons IITC expects PLAYER.level to contain the current player level
|
||||
|
||||
var thisLvlAp = MIN_AP_FOR_LEVEL[level-1];
|
||||
var nextLvlAp = MIN_AP_FOR_LEVEL[level] || ap;
|
||||
var ap = parseInt(PLAYER.ap);
|
||||
var thisLvlAp = parseInt(PLAYER.min_ap_for_current_level);
|
||||
var nextLvlAp = parseInt(PLAYER.min_ap_for_next_level);
|
||||
|
||||
if (nextLvlAp) {
|
||||
var lvlUpAp = digits(nextLvlAp-ap);
|
||||
var lvlApProg = Math.round((ap-thisLvlAp)/(nextLvlAp-thisLvlAp)*100);
|
||||
} // else zero nextLvlAp - so at maximum level(?)
|
||||
|
||||
|
||||
var xmMax = MAX_XM_PER_LEVEL[level];
|
||||
var xmMax = parseInt(PLAYER.xm_capacity);
|
||||
var xmRatio = Math.round(PLAYER.energy/xmMax*100);
|
||||
|
||||
var cls = PLAYER.team === 'RESISTANCE' ? 'res' : 'enl';
|
||||
@ -395,7 +395,7 @@ window.setupPlayerStat = function() {
|
||||
var t = 'Level:\t' + level + '\n'
|
||||
+ 'XM:\t' + PLAYER.energy + ' / ' + xmMax + '\n'
|
||||
+ 'AP:\t' + digits(ap) + '\n'
|
||||
+ (level < 8 ? 'level up in:\t' + lvlUpAp + ' AP' : 'Congrats! (neeeeerd)')
|
||||
+ (nextLvlAp > 0 ? 'level up in:\t' + lvlUpAp + ' AP' : 'Maximul level reached(!)')
|
||||
+ '\n\Invites:\t'+PLAYER.available_invites
|
||||
+ '\n\nNote: your player stats can only be updated by a full reload (F5)';
|
||||
|
||||
|
2
main.js
2
main.js
@ -180,8 +180,6 @@ window.NOMINATIM = 'http://nominatim.openstreetmap.org/search?format=json&limit=
|
||||
// INGRESS CONSTANTS /////////////////////////////////////////////////
|
||||
// http://decodeingress.me/2012/11/18/ingress-portal-levels-and-link-range/
|
||||
window.RESO_NRG = [0, 1000, 1500, 2000, 2500, 3000, 4000, 5000, 6000];
|
||||
window.MAX_XM_PER_LEVEL = [0, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000];
|
||||
window.MIN_AP_FOR_LEVEL = [0, 2500, 20000, 70000, 150000, 300000, 600000, 1200000];
|
||||
window.HACK_RANGE = 40; // in meters, max. distance from portal to be able to access it
|
||||
window.OCTANTS = ['E', 'NE', 'N', 'NW', 'W', 'SW', 'S', 'SE'];
|
||||
window.OCTANTS_ARROW = ['→', '↗', '↑', '↖', '←', '↙', '↓', '↘'];
|
||||
|
Loading…
x
Reference in New Issue
Block a user