Update 0.5.3.2

archived
peshomir 2022-12-27 20:22:27 +02:00
parent 44a5cae971
commit d68bebb8d0
4 changed files with 192 additions and 95 deletions

View File

@ -1,4 +0,0 @@
.settingsd {
padding: 5px;
z-index: 100;
}

32
game.js
View File

@ -1,11 +1,10 @@
const fx_version = '0.5.3.1'; // FX Client Version
const fx_update = 'Dec 26'; // FX Client Last Updated
const fx_version = '0.5.3.2'; // FX Client Version
const fx_update = 'Dec 27'; // FX Client Last Updated
const ter_version = '1.82.9'; // Territorial Version
const ter_update = 'December 2 2022'; // Territorial Last Updated
var username_i0 = '[FX] Default'; // alternative username variable
if (localStorage.getItem("win_count") == undefined || localStorage.getItem("win_count") == null) {
var wins_counter = 0;
console.log('Couldn\'t find a saved win data. creating one...');
@ -16,12 +15,14 @@ if (localStorage.getItem("win_count") == undefined || localStorage.getItem("win_
var settings = {
"fontName": "Trebuchet MS",
"showBotDonations": false
"showBotDonations": false,
"hideAllLinks": false,
};
var settingsManager = new (function() {
this.save = function() {
settings.fontName = document.getElementById("settings_fontname").value.trim();
settings.showBotDonations = document.getElementById("settings_donations_bots").checked;
settings.hideAllLinks = document.getElementById("settings_hidealllinks").checked;
this.applySettings();
WindowManager.closeWindow("settings");
localStorage.setItem("settings", JSON.stringify(settings));
@ -55,7 +56,7 @@ var WindowManager = new (function() {
if (windows[windowName].isOpen === true) return;
if (windows[windowName].beforeOpen !== undefined) windows[windowName].beforeOpen();
windows[windowName].isOpen = true;
windows[windowName].element.style.display = "block";
windows[windowName].element.style.display = null;
};
this.closeWindow = function(windowName) {
if (windows[windowName].isOpen === false) return;
@ -74,6 +75,7 @@ WindowManager.add({
beforeOpen: function() {
document.getElementById("settings_fontname").value = settings.fontName;
document.getElementById("settings_donations_bots").checked = settings.showBotDonations;
document.getElementById("settings_hidealllinks").checked = settings.hideAllLinks;
}
});
WindowManager.add({
@ -120,6 +122,14 @@ function displayDonationsHistory(playerID, playerNames) {
WindowManager.openWindow("donationHistory");
}
var utils = new (function() {
this.getMaxTroops = function(playerTerritories, playerID) { return playerTerritories[playerID]*150; };
this.getDensity = function(playerBalances, playerTerritories, playerID) {
return (Math.floor((playerBalances[playerID] / ((playerTerritories[playerID] === 0 ? 1 : playerTerritories[playerID]) * 150)) * 100) + "%");
};
});
var setVarByName;
@ -134,12 +144,10 @@ var setVarByName;
var g = e.loadString(20);
"" === g && (g = "[FX] " + "Android User " + Math.floor(1E3 * Math.random()),
e.saveString(20, g))
username_i0 = g;
} else
5 <= d ? (g = e.loadString(0),
"" === g && (g = "[FX] " + "Player " + Math.floor(1E3 * Math.random()),
e.saveString(0, g))) : g = f.g(0);
username_i0 = g;
return g
}
function h() {
@ -2422,7 +2430,6 @@ var setVarByName;
}
;
this.fh = function (G, M) {
// console.log('Username = ' + username_i0);
0 === M ? (b0.b1[G < cq ? 4 : 3]++, c2.cQ(G, 0), A(q ? 100 : 160, "You conquered " + gE[G] + ".", 0, G, "rgb(10,220,10)", hq, -1, !1)) :
1 === M ? (F(50, b8), c2.cQ(G, 1), A(360, "You were conquered by " + gE[G] + ".", 0, G, "rgb(255,40,40)", hq, -1, !0), eR.gc(G, 2700, !0, 0)) :
2 === M ? (c2.cQ(G, 2), A(0, "Congratulations! You won the game.", 0, G, "rgb(10,255,255)", hq, -1, !0), // i don't think this is the right part for win counter
@ -4533,7 +4540,7 @@ var setVarByName;
5 === P ? e7.n9(L[P] / 100, 2) :
P === 6 ? eL.gF(L[P]) :
P === 7 ? e7.s8(L[7]) :
P === 8 ? Math.floor(bU[aw] * 150) : (Math.floor((ax[aw] / ((bU[aw] === 0 ? 1 : bU[aw]) * 150)) * 100) + "%") // max amount of troops / current amount of troops
P === 8 ? utils.getMaxTroops(bU, aw) : utils.getDensity(ax, bU, aw) // max amount of troops / current amount of troops
}
function x(P) {
@ -6134,7 +6141,6 @@ var setVarByName;
k[t].input.readOnly = 3 === t;
k[t].input.addEventListener("input", function () {
0 === t && jX.vv()
username_i0 = document.getElementById('userna').value;
})
}
var k, x, l;
@ -9621,6 +9627,8 @@ var setVarByName;
function ke() {
function g() {
vd.uc[2] = vd.uc[3] = vd.uc[4] = !jm.a3t;
if (settings.hideAllLinks && (jm.a3t)) vd.uc[0] = vd.uc[1] = false;
else vd.uc[0] = vd.uc[1] = true;
var y = jm.a10 ? 1 : 0
, A = jm.a3t ? 1 : 0
, B = jm.a0L ? 1 : 0;
@ -9771,7 +9779,9 @@ var setVarByName;
z[2].mx = this.a10 ? 130 : 0;
z[3].mx = this.a3t ? 130 : 0;
!b && 5 > d && (z[4].mx = this.a0L ? 130 : 0);
this.a3t && (vd.uc[2] = vd.uc[3] = vd.uc[4] = !1)
this.a3t && (vd.uc[2] = vd.uc[3] = vd.uc[4] = false);
this.a3t && settings.hideAllLinks && (vd.uc[0] = vd.uc[1] = false);
(!settings.hideAllLinks) && (vd.uc[0] = vd.uc[1] = true);
};
// mouseDown
this.c7 = function (y, A) {

View File

@ -31,7 +31,8 @@
<meta itemprop="description" content="Modified Version of Territorial.io - FX Client">
<meta itemprop="image" content="https://fxclient.cf/logo.png">
<link rel="stylesheet" href="assets/astyle.css">
<!-- FX Client CSS -->
<link rel="stylesheet" href="main.css">
<!-- Game CSS -->
<style>
html,
@ -49,91 +50,32 @@
user-select: none;
}
</style>
<!-- FX Client CSS -->
<style>
.window {
position: fixed;
background-color: rgba(0, 0, 0, 0.7);
width: 90%;
top: 0;
color: white;
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
margin: auto;
margin-top: 20px;
right: 0;
left: 0;
padding: 15px;
box-sizing: border-box;
border-color: white;
border-style: solid;
border-width: 2px;
border-width: calc(0.2*(1vw+1vh+4));
font-size: 20px;
font-size: calc(14px + (0.6*(1vw+1vh+4)));
max-height: 90%;
overflow: auto;
transition: 0.2s;
}
.window button, .window input {
background-color: rgba(0, 0, 0, 0.7);
color: white;
font-size: 20px;
font-size: calc(10px + (0.6*(1vw+1vh+4)));
padding: calc(7px + 1vw - 1.7vh);
transition: 0.2s;
border: 1px solid #fff;
border-radius: 5px;
}
h1 {
font-weight: normal;
margin-block-start: 0.5em;
margin-block-end: 0.5em;
transition: 0.2s;
}
canvas {
transition: 0.2s;
}
button:hover {
background-color: rgba(222, 222, 222, 0.52);
border-radius: 8px;
}
.window input:focus {
background-color: rgba(222, 222, 222, 0.36);
border-radius: 8px;
}
input#userna, input#inputfilebtn {
transition: 0.2s
}
::-webkit-file-upload-button {
color: white;
background-color: #120076;
border: 2px solid #fff;
top: 0;
bottom: 0;
padding-top: 20px;
padding-bottom: 20px;
padding-left: 20px;
padding-right: 20px;
font-family: 'Trebuchet MS', 'Arial Narrow', Arial, sans-serif;
text-align: center;
}
</style>
</head>
<body onload="aiCommand746(0);">
<canvas id="canvasA" width="128" height="128"></canvas>
<div class="window settings" style="display:none">
<div class="window flex settings" style="display:none">
<h1>Settings</h1>
Font name: <input id="settings_fontname" placeholder="Enter font name" value="Arial"><br>
<br><button onclick="removeWins()">Reset Wins Counter</button><br>
<br><input type="checkbox" id="settings_donations_bots">
<label for="settings_donations_bots">Display donations from bots (applies to multiplayer bots only)</label><br>
<div class="scrollable">
<label title="Name of the font to be used for rendering. For example: Arial, Georgia, sans-serif, serif, Comic Sans MS, ...">
Font name: <input id="settings_fontname" placeholder="Enter font name" value="Arial"></label><br>
<br><button onclick="removeWins()">Reset Wins Counter</button><br><br>
<label for="settings_donations_bots" class="checkbox">
Display donations from bots (applies to multiplayer bots only)
<input type="checkbox" id="settings_donations_bots"><span class="checkmark"></span>
</label><br>
<label for="settings_hidealllinks" class="checkbox">
Hide Links option also hides app store links
<input type="checkbox" id="settings_hidealllinks"><span class="checkmark"></span>
</label>
</div>
<hr>
<button onclick="settingsManager.resetAll()">Reset Settings</button>
<button onclick="settingsManager.save()">Save Settings</button>
<footer>
<button onclick="settingsManager.resetAll()">Reset Settings</button>
<button onclick="settingsManager.save()">Save Settings</button>
</footer>
</div>
<div class="window" id="donationhistory" style="display:none">
<div class="window scrollable" id="donationhistory" style="display:none">
<h1>Donation history for </h1>
<p id="donationhistory_note">Note: donations from bots are not shown here</p>
<p id="donationhistory_text"></p>

149
main.css 100644
View File

@ -0,0 +1,149 @@
.scrollable {
overflow-y: auto;
}
.window {
position : fixed;
background-color: rgba(0, 0, 0, 0.7);
width : 90%;
top : 0;
color : white;
font-family : 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
margin : auto;
margin-top : 20px;
right : 0;
left : 0;
padding : 15px;
box-sizing : border-box;
border-color : white;
border-style : solid;
border-width : 2px;
border-width : calc(0.15 * (1vw + 1vh));
font-size : 20px;
font-size : calc(14px + ((0.4 * (0.8vw + 1vh)) + 0.15rem));
max-height : 90%;
transition : 0.2s;
z-index : 10;
}
.window.flex {
display : flex;
flex-direction: column;
}
hr {
width: 100%;
}
.window button,
.window input {
background-color: rgba(0, 0, 0, 0.7);
color : white;
font-size : 20px;
font-size : 0.9em;
padding : 0.4rem;
transition : 0.2s;
border : 1px solid #fff;
border-radius : 5px;
}
h1 {
font-weight : normal;
margin-block-start: 0.5em;
margin-block-end : 0.5em;
transition : 0.2s;
}
canvas {
transition: 0.2s;
}
button:hover {
background-color: rgba(222, 222, 222, 0.52);
border-radius : 8px;
}
.window input:focus {
background-color: rgba(222, 222, 222, 0.36);
border-radius : 8px;
}
input#userna,
input#inputfilebtn {
transition: 0.2s
}
/* Checkbox */
label.checkbox {
display : block;
position : relative;
padding-left : 35px;
/*margin-bottom: 12px;*/
cursor : pointer;
}
label.checkbox input {
position: absolute;
opacity : 0;
cursor : pointer;
height : 0;
width : 0;
}
.checkmark {
position : absolute;
top : 0;
left : 0;
height : 25px;
width : 25px;
/*background-color: #eee;*/
background-color : rgb(255 255 255 / 70%);
}
label.checkbox:hover .checkmark {
background-color: #ccc;
}
label.checkbox input:checked~.checkmark {
/*background-color: #2196F3;*/
background-color: rgba(0, 255, 0, 0.5);
}
.checkmark::after {
content : "";
position: absolute;
display : none;
}
label.checkbox input:checked~.checkmark:after {
display: block;
}
label.checkbox .checkmark:after {
left : 9px;
top : 5px;
width : 5px;
height : 10px;
border : solid white;
border-width : 0 3px 3px 0;
-webkit-transform: rotate(45deg);
-ms-transform : rotate(45deg);
transform : rotate(45deg);
}
/* Custom Map Button */
::-webkit-file-upload-button {
color : white;
background-color: #120076;
border : 2px solid #fff;
top : 0;
bottom : 0;
padding-top : 20px;
padding-bottom : 20px;
padding-left : 20px;
padding-right : 20px;
font-family : 'Trebuchet MS', 'Arial Narrow', Arial, sans-serif;
text-align : center;
}