From 0520d8bb9a3bdf911d6db10a4bf75dc768418a16 Mon Sep 17 00:00:00 2001 From: Kevin Date: Sat, 2 Mar 2013 22:54:30 -0800 Subject: [PATCH 1/5] Fix neutral portals have broken random details --- code/portal_detail_display.js | 3 +-- code/portal_detail_display_tools.js | 2 +- code/portal_info.js | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/code/portal_detail_display.js b/code/portal_detail_display.js index 15dd160e..8e7a2a71 100644 --- a/code/portal_detail_display.js +++ b/code/portal_detail_display.js @@ -22,9 +22,8 @@ window.renderPortalDetails = function(guid) { var linksText = [linkExpl('links'), linkExpl(' ↳ ' + links.incoming+'  •  '+links.outgoing+' ↴')]; var player = d.captured && d.captured.capturingPlayerId - ? getPlayerName(d.captured.capturingPlayerId) + ? '' + getPlayerName(d.captured.capturingPlayerId) + '' : null; - player = ''+player+''; var playerText = player ? ['owner', player] : null; var time = d.captured diff --git a/code/portal_detail_display_tools.js b/code/portal_detail_display_tools.js index 9a50e1b7..1687f5d9 100644 --- a/code/portal_detail_display_tools.js +++ b/code/portal_detail_display_tools.js @@ -132,7 +132,7 @@ window.renderResonatorDetails = function(slot, level, nrg, dist, nick) { var meter = '' + fill + lbar + ''; } - nick = ''+nick+''; + nick = nick ? ''+nick+'' : null; return [meter, nick || '']; } diff --git a/code/portal_info.js b/code/portal_info.js index 2e2e2127..fdbc91c2 100644 --- a/code/portal_info.js +++ b/code/portal_info.js @@ -64,7 +64,7 @@ window.getAvgResoDist = function(d) { sum += parseInt(reso.distanceToPortal); resos++; }); - return sum/resos; + return resos ? sum/resos : 0; } window.getAttackApGain = function(d) { From e59fdc8296fe2b0cecf8cb88a28e8227b568c17b Mon Sep 17 00:00:00 2001 From: Xelio Date: Sun, 3 Mar 2013 22:42:51 +0800 Subject: [PATCH 2/5] Add guid to window.PLAYER and add constant MAX_RESO_PER_PLAYER --- code/boot.js | 1 + code/player_names.js | 11 +++++++++++ main.js | 1 + 3 files changed, 13 insertions(+) diff --git a/code/boot.js b/code/boot.js index 7e5882a2..6c97cb55 100644 --- a/code/boot.js +++ b/code/boot.js @@ -159,6 +159,7 @@ window.setupMap = function() { // included as inline script in the original site, the data is static // and cannot be updated. window.setupPlayerStat = function() { + PLAYER.guid = playerNameToGuid(PLAYER.nickname); var level; var ap = parseInt(PLAYER.ap); for(level = 0; level < MIN_AP_FOR_LEVEL.length; level++) { diff --git a/code/player_names.js b/code/player_names.js index 85362f2c..0d2557d5 100644 --- a/code/player_names.js +++ b/code/player_names.js @@ -17,6 +17,17 @@ window.getPlayerName = function(guid) { return '{'+guid.slice(0, 12)+'}'; } +window.playerNameToGuid = function(playerName){ + var guid = null; + $.each(Object.keys(localStorage), function(ind,key) { + if(playerName === localStorage[key]) { + guid = key; + return false; + } + }); + 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. diff --git a/main.js b/main.js index 7553fd48..d4328181 100644 --- a/main.js +++ b/main.js @@ -189,6 +189,7 @@ window.CAPTURE_PORTAL = 500; //AP for capturing a portal window.DEPLOY_RESONATOR = 125; //AP for deploying a resonator window.COMPLETION_BONUS = 250; //AP for deploying all resonators on portal window.MAX_PORTAL_LEVEL = 8; +window.MAX_RESO_PER_PLAYER = [0, 8, 4, 4, 4, 2, 2, 1, 1]; // OTHER MORE-OR-LESS CONSTANTS ////////////////////////////////////// window.TEAM_NONE = 0; From c6bc9c2e03f83537a543d5e80d61a60266b83e46 Mon Sep 17 00:00:00 2001 From: Xelio Date: Sun, 3 Mar 2013 23:59:44 +0800 Subject: [PATCH 3/5] Store player level at setupPlayerStat --- code/boot.js | 1 + 1 file changed, 1 insertion(+) diff --git a/code/boot.js b/code/boot.js index 6c97cb55..2204acd1 100644 --- a/code/boot.js +++ b/code/boot.js @@ -165,6 +165,7 @@ window.setupPlayerStat = function() { for(level = 0; level < MIN_AP_FOR_LEVEL.length; level++) { if(ap < MIN_AP_FOR_LEVEL[level]) break; } + PLAYER.level = level; var thisLvlAp = MIN_AP_FOR_LEVEL[level-1]; var nextLvlAp = MIN_AP_FOR_LEVEL[level] || ap; From ecbe0850cea6f34f324ce219ae3bd58431d3d93d Mon Sep 17 00:00:00 2001 From: Xelio Date: Mon, 4 Mar 2013 00:33:52 +0800 Subject: [PATCH 4/5] Add window.UPGRADE_ANOTHERS_RESONATOR --- main.js | 1 + 1 file changed, 1 insertion(+) diff --git a/main.js b/main.js index d4328181..ff11efb8 100644 --- a/main.js +++ b/main.js @@ -188,6 +188,7 @@ window.DESTROY_FIELD = 750; //AP for destroying field window.CAPTURE_PORTAL = 500; //AP for capturing a portal window.DEPLOY_RESONATOR = 125; //AP for deploying a resonator window.COMPLETION_BONUS = 250; //AP for deploying all resonators on portal +window.UPGRADE_ANOTHERS_RESONATOR = 65; //AP for upgrading another's resonator window.MAX_PORTAL_LEVEL = 8; window.MAX_RESO_PER_PLAYER = [0, 8, 4, 4, 4, 2, 2, 1, 1]; From 68a89da6a0d8c7abd6559b876d7204b9ed8222ba Mon Sep 17 00:00:00 2001 From: Kevin Date: Sun, 3 Mar 2013 19:42:23 -0800 Subject: [PATCH 5/5] Add Fragger to contribs --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 0aa40d4b..af865dc5 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ First of all, it’s very nice you want to help. There are several equally impor [boombuler](https://github.com/boombuler), [cmrn](https://github.com/cmrn), [epf](https://github.com/epf), +[Fragger](https://github.com/Fragger), [integ3r](https://github.com/integ3r), [j16sdiz](https://github.com/j16sdiz), [JasonMillward](https://github.com/JasonMillward),