Update v0.6.1.6; Add a settings option to change the display style of the density value

archived
peshomir 2024-02-28 09:20:56 +02:00
parent 1714a60568
commit 73bcf533f8
2 changed files with 13 additions and 5 deletions

View File

@ -1,5 +1,5 @@
const fx_version = '0.6.1.5'; // FX Client Version
const fx_update = 'Feb 25'; // FX Client Last Updated
const fx_version = '0.6.1.6'; // FX Client Version
const fx_update = 'Feb 28'; // FX Client Last Updated
if (localStorage.getItem("fx_winCount") == undefined || localStorage.getItem("fx_winCount") == null) {
var wins_counter = 0;
@ -88,15 +88,17 @@ var settings = {
"useFullscreenMode": false,
"hideAllLinks": false,
"realisticNames": false,
"densityDisplayStyle": "percentage",
//"customMapFileBtn": true
"customBackgroundUrl": "",
"attackPercentageKeybinds": [],
};
let makeMainMenuTransparent = false;
var settingsManager = new (function() {
var inputFields = {
var inputFields = { // (includes select menus)
fontName: document.getElementById("settings_fontname"),
customBackgroundUrl: document.getElementById("settings_custombackgroundurl")
customBackgroundUrl: document.getElementById("settings_custombackgroundurl"),
densityDisplayStyle: document.getElementById("settings_densityDisplayStyle")
};
var checkboxFields = {
//showBotDonations: document.getElementById("settings_donations_bots"),
@ -251,7 +253,8 @@ function displayDonationsHistory(playerID, playerNames, isSingleplayer) {
var utils = new (function() {
this.getMaxTroops = function(playerTerritories, playerID) { return (playerTerritories[playerID]*150).toString(); };
this.getDensity = function(playerBalances, playerTerritories, playerID) {
return (Math.floor((playerBalances[playerID] / ((playerTerritories[playerID] === 0 ? 1 : playerTerritories[playerID]) * 150)) * 100) + "%");
if (settings.densityDisplayStyle === "percentage") return (Math.floor((playerBalances[playerID] / ((playerTerritories[playerID] === 0 ? 1 : playerTerritories[playerID]) * 150)) * 100) + "%");
else return (playerBalances[playerID] / (playerTerritories[playerID] === 0 ? 1 : playerTerritories[playerID])).toFixed(0);
};
});

View File

@ -83,6 +83,11 @@
Realistic Bot Names
<input type="checkbox" id="settings_realisticnames"><span class="checkmark"></span>
</label><br>
<label title="Controls how the territorial density value should be rendered">
Density value display style: <select id="settings_densityDisplayStyle">
<option value="percentage">Percentage</option>
<option value="absoluteQuotient">Value from 0 to 150 (BetterTT style)</option>
</select></label><br><br>
<label title="A custom image to be shown in the main menu background instead of the currently selected map.">
Custom main menu background: <input id="settings_custombackgroundurl" placeholder="Enter an image URL here"></label>
<!--<input type="file" id="customBackgroundFileInput" style="display:none;">