gh-pages
peshomir 2024-02-03 20:36:45 +00:00
parent eeb08caa11
commit abfe3c25ca
2 changed files with 2154 additions and 2153 deletions

View File

@ -1,5 +1,5 @@
const fx_version = '0.6.0.1'; // FX Client Version const fx_version = '0.6.0.2'; // FX Client Version
const fx_update = 'Feb 1'; // FX Client Last Updated const fx_update = 'Feb 3'; // FX Client Last Updated
if (localStorage.getItem("fx_winCount") == undefined || localStorage.getItem("fx_winCount") == null) { if (localStorage.getItem("fx_winCount") == undefined || localStorage.getItem("fx_winCount") == null) {
@ -97,9 +97,9 @@ var settingsGearIcon = document.createElement('img');
settingsGearIcon.setAttribute('src', 'geari_white.png'); settingsGearIcon.setAttribute('src', 'geari_white.png');
var donationsTracker = new (function(){ var donationsTracker = new (function(){
this.donationHistory = Array(); this.donationHistory = Array(512);
// fill the array with empty arrays with length of 3 // fill the array with empty arrays with length of 3
for (var i = 0; i < 512; i++) this.donationHistory.push([]); //for (var i = 0; i < 512; i++) this.donationHistory.push([]); // not needed as .reset is called on game start
// from inside of game: // from inside of game:
// ((!gE[g].startsWith("[Bot] ") || settings.showBotDonations) && donationsTracker.logDonation(g,k,x)) // ((!gE[g].startsWith("[Bot] ") || settings.showBotDonations) && donationsTracker.logDonation(g,k,x))
this.logDonation = function(senderID, receiverID, amount) { this.logDonation = function(senderID, receiverID, amount) {
@ -110,6 +110,7 @@ var donationsTracker = new (function(){
this.getRecipientHistoryOf = function(playerID) { this.getRecipientHistoryOf = function(playerID) {
return this.donationHistory[playerID]; return this.donationHistory[playerID];
}; };
this.reset = function() { for (var i = 0; i < 512; i++) this.donationHistory[i] = []; };
}); });
// usage from inside: displayDonationsHistory(Y, gE); // usage from inside: displayDonationsHistory(Y, gE);
function displayDonationsHistory(playerID, playerNames, isSingleplayer) { function displayDonationsHistory(playerID, playerNames, isSingleplayer) {
@ -129,7 +130,7 @@ function displayDonationsHistory(playerID, playerNames, isSingleplayer) {
} }
var utils = new (function() { var utils = new (function() {
this.getMaxTroops = function(playerTerritories, playerID) { return playerTerritories[playerID]*150; }; this.getMaxTroops = function(playerTerritories, playerID) { return (playerTerritories[playerID]*150).toString(); };
this.getDensity = function(playerBalances, playerTerritories, playerID) { this.getDensity = function(playerBalances, playerTerritories, playerID) {
return (Math.floor((playerBalances[playerID] / ((playerTerritories[playerID] === 0 ? 1 : playerTerritories[playerID]) * 150)) * 100) + "%"); return (Math.floor((playerBalances[playerID] / ((playerTerritories[playerID] === 0 ? 1 : playerTerritories[playerID]) * 150)) * 100) + "%");
}; };

4354
game.js

File diff suppressed because one or more lines are too long