Update v0.5.2
Co-authored-by: Mohsen Taghavi <mohsenemx@users.noreply.github.com>archived
parent
c3d88d9088
commit
489e6c899a
104
game.js
104
game.js
|
@ -1,4 +1,4 @@
|
|||
const fx_version = '0.5.1'; // FX Client Version
|
||||
const fx_version = '0.5.2'; // FX Client Version
|
||||
const fx_update = 'Dec 25'; // FX Client Last Updated
|
||||
|
||||
const ter_version = '1.82.9'; // Territorial Version
|
||||
|
@ -18,6 +18,7 @@ var settings = {
|
|||
"fontName": "Trebuchet MS"
|
||||
};
|
||||
var settingsWindowOpen = false;
|
||||
var donationHistoryWindowOpen = false;
|
||||
var settingsManager = new (function() {
|
||||
this.save = function() {
|
||||
settings.fontName = document.getElementById("settings_fontname").value.trim();
|
||||
|
@ -44,6 +45,7 @@ function removeWins() {
|
|||
alert("Successfully reset wins");
|
||||
}
|
||||
}
|
||||
// yes, I know, this code is 🤮, I will fix it later
|
||||
function openSettingsWindow() {
|
||||
settingsWindowOpen = true;
|
||||
document.getElementById("settings_fontname").value = settings.fontName;
|
||||
|
@ -54,13 +56,56 @@ function closeSettingsWindow() {
|
|||
settingsWindowOpen = false;
|
||||
document.querySelector(".settings").style.display = "none";
|
||||
}
|
||||
document.getElementById("canvasA").addEventListener("mousedown", closeSettingsWindow);
|
||||
function openDonationHistoryWindow() {
|
||||
donationHistoryWindowOpen = true;
|
||||
document.querySelector("#donationhistory").style.display = "block";
|
||||
}
|
||||
function closeDonationHistoryWindow() {
|
||||
if (!donationHistoryWindowOpen) return;
|
||||
donationHistoryWindowOpen = false;
|
||||
document.querySelector("#donationhistory").style.display = "none";
|
||||
}
|
||||
function closeAllWindows() {
|
||||
if (settingsWindowOpen) closeSettingsWindow();
|
||||
if (donationHistoryWindowOpen) closeDonationHistoryWindow();
|
||||
}
|
||||
document.getElementById("canvasA").addEventListener("mousedown", closeAllWindows);
|
||||
//var tfxc = document.createElement('div');
|
||||
//tfxc.setAttribute('class', 'settingsd');
|
||||
var settingsGearIcon = document.createElement('img');
|
||||
settingsGearIcon.setAttribute('src', 'assets/geari_white.png');
|
||||
//gear.setAttribute('id', 'optionsimg');
|
||||
//tfxc.appendChild(gear);
|
||||
|
||||
var donationsTracker = new (function(){
|
||||
this.donationHistory = Array();
|
||||
// fill the array with empty arrays with length of 3
|
||||
for (var i = 0; i < 512; i++) this.donationHistory.push([]);
|
||||
// from inside of game:
|
||||
// (!gE[g].startsWith("[Bot] ") && donationsTracker.logDonation(g,k,x))
|
||||
this.logDonation = function(senderID, receiverID, amount) {
|
||||
this.donationHistory[receiverID].push([senderID,amount]);
|
||||
};
|
||||
this.getRecipientHistoryOf = function(playerID) {
|
||||
return this.donationHistory[playerID];
|
||||
};
|
||||
});
|
||||
// usage from inside: displayDonationsHistory(Y, gE);
|
||||
function displayDonationsHistory(playerID, playerNames) {
|
||||
var history = donationsTracker.getRecipientHistoryOf(playerID);
|
||||
console.log("History for " + playerNames[playerID] + ":");
|
||||
console.log(history);
|
||||
document.querySelector("#donationhistory h1").innerHTML = "Donation history for " + playerNames[playerID];
|
||||
var historyText = "";
|
||||
history.reverse();
|
||||
if (history.length > 0) history.forEach(function(historyItem, index) {
|
||||
historyText += (history.length - index) + ". Received " + historyItem[1] + " resources from " + playerNames[historyItem[0]] + "<br>";
|
||||
});
|
||||
else historyText = "Nothing to display";
|
||||
document.querySelector("#donationhistory p#donationhistory_text").innerHTML = historyText;
|
||||
openDonationHistoryWindow();
|
||||
}
|
||||
|
||||
var setVarByName;
|
||||
|
||||
|
||||
|
@ -2034,18 +2079,23 @@ var setVarByName;
|
|||
if (n)
|
||||
a5.cG();
|
||||
else {
|
||||
// draw order buttons
|
||||
var N = (A + J) / D;
|
||||
cH.imageSmoothingEnabled = !0;
|
||||
cH.setTransform(D, 0, 0, D, z, y);
|
||||
t[0] ? fY ? cH.drawImage(this.kx[3], 0, 0) : cH.drawImage(this.kx[0], 0, 0) : t[8] ? cH.drawImage(this.kv[0], 0, 0) : cH.drawImage(K[0], 0, 0);
|
||||
t[1] && cH.drawImage(this.kx[1], N, 0);
|
||||
// donation
|
||||
t[2] && cH.drawImage(this.kx[2], -N, 0);
|
||||
t[4] && cH.drawImage(this.kx[4], 0, N);
|
||||
// non-agression pact
|
||||
t[5] && cH.drawImage(this.kx[5], N, N);
|
||||
// point
|
||||
t[6] && cH.drawImage(this.kx[6], 0, -N);
|
||||
// target
|
||||
t[7] && cH.drawImage(this.kx[7], N, -N);
|
||||
cH.imageSmoothingEnabled = !1;
|
||||
cH.setTransform(1, 0, 0, 1, 0, 0)
|
||||
cH.setTransform(1, 0, 0, 1, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2461,16 +2511,15 @@ var setVarByName;
|
|||
;
|
||||
this.lN = function () {
|
||||
100 <= ax[aw] || A(80, "Your balance is too low!", 9, 0, cK, hq, -1, !1)
|
||||
}
|
||||
;
|
||||
};
|
||||
this.lM = function () {
|
||||
A(80, "Boosting is disallowed in the first minute!", 9, 0, cK, hq, -1, !1)
|
||||
}
|
||||
;
|
||||
};
|
||||
// Sending donation
|
||||
this.n1 = function (G, M) {
|
||||
2 !== fP[aw] && A(200, "You exported " + eL.gF(G) + " resource" + (1 === G ? "" : "s") + " to " + gE[M] + ".", 30, M, "rgb(190,255,190)", hq, -1, !0)
|
||||
}
|
||||
;
|
||||
};
|
||||
// Receiving donation
|
||||
this.n3 = function (G, M) {
|
||||
if (2 !== fP[aw]) {
|
||||
var Q = 2 === fP[M] || M >= cq;
|
||||
|
@ -2478,8 +2527,7 @@ var setVarByName;
|
|||
A(80 > R ? 80 : R, (Q ? "A bot" : gE[M]) + " supported you with " + eL.gF(G) + " resource" + (1 === G ? "" : "s") + ".", 31, M, gD, Q ? "rgba(205,205,205,0.9)" : "rgba(205,255,205,0.9)", -1, !0);
|
||||
B(31, q ? 4 : 6)
|
||||
}
|
||||
}
|
||||
;
|
||||
};
|
||||
this.iq = function (G) {
|
||||
var M, Q = c4.dU();
|
||||
for (M = 2; 0 <= M; M--)
|
||||
|
@ -2705,8 +2753,7 @@ var setVarByName;
|
|||
t.clearRect(0, 0, this.c1, this.c1);
|
||||
23 === k ? t.drawImage(hm.ky[2], 0, 0) : 36 === k ? t.drawImage(hm.ky[0], 0, 0) : 49 === k ? t.drawImage(hm.ky[1], 0, 0) : t.drawImage(x, this.c1 * g % (g === k ? this.na * this.c1 : 4E3), g === k ? as(g, this.na) * this.c1 : 0, this.c1, this.c1, 0, 0, this.c1, this.c1);
|
||||
this.l0[k] = l
|
||||
}
|
||||
;
|
||||
};
|
||||
this.nr = function () {
|
||||
this.l0[this.a6 - 5] = this.l0[26];
|
||||
this.l0[this.a6 - 4] = this.ns(this.a6 - 5, 2);
|
||||
|
@ -4389,8 +4436,8 @@ var setVarByName;
|
|||
return X !== T ? (X = T,
|
||||
g(),
|
||||
c4.c5 = !0) : !1
|
||||
}
|
||||
;
|
||||
};
|
||||
// mouseClick
|
||||
this.pO = function (S, O) {
|
||||
if (!ba)
|
||||
return !1;
|
||||
|
@ -4404,11 +4451,11 @@ var setVarByName;
|
|||
-1 !== T)) {
|
||||
var Y = ei[T + V];
|
||||
T === y - 1 && sD[aw] >= V + y - 1 && (Y = aw);
|
||||
0 !== fB[Y] && eR.gc(Y, 800, !1, 0)
|
||||
//0 !== fB[Y] && eR.gc(Y, 800, !1, 0)
|
||||
displayDonationsHistory(Y, gE);
|
||||
}
|
||||
return !0
|
||||
}
|
||||
;
|
||||
};
|
||||
this.pU = function (S, O, T) {
|
||||
return ba ? !1 : z(S, O) ? (S = n(O),
|
||||
S = sy(-1, S, y),
|
||||
|
@ -4421,8 +4468,7 @@ var setVarByName;
|
|||
g(),
|
||||
c4.c5 = !0),
|
||||
!0) : !1
|
||||
}
|
||||
;
|
||||
};
|
||||
this.cG = function () {
|
||||
cH.drawImage(A, m0, m0)
|
||||
}
|
||||
|
@ -4844,13 +4890,18 @@ var setVarByName;
|
|||
x -= x >= as(ax[g], 2) ? l : 0;
|
||||
var t = bU[k] * iz - ax[k];
|
||||
0 >= t || (x = x > t ? t : x,
|
||||
g === aw && (e5.n1(x, k),
|
||||
b0.b1[12] += l,
|
||||
b0.b1[16] += x),
|
||||
k === aw && (e5.n3(x, g),
|
||||
b0.b1[10] += x),
|
||||
// if the donating player is us, show a message and add to statistics
|
||||
g === aw && (e5.n1(x, k), b0.b1[12] += l, b0.b1[16] += x),
|
||||
// if the receiving player is us, show message and add to statistics
|
||||
k === aw && (e5.n3(x, g), b0.b1[10] += x),
|
||||
// remove points (+tax) from donating player
|
||||
ax[g] -= x + l,
|
||||
ax[k] += x)
|
||||
// add points to receiving player
|
||||
ax[k] += x,
|
||||
// track donations
|
||||
((!gE[g].startsWith("[Bot] ")) && donationsTracker.logDonation(g,k,x))
|
||||
//donationsTracker.logDonation(g,k,x)
|
||||
)
|
||||
}
|
||||
}
|
||||
function tl() {
|
||||
|
@ -7518,6 +7569,7 @@ var setVarByName;
|
|||
this.z7 = document.createElement("INPUT");
|
||||
this.z7.setAttribute("type", "file");
|
||||
this.z7.setAttribute("accept", ".gif,.jpg,.jpeg,.png,.json");
|
||||
this.z7.setAttribute("id", "inputfilebtn");
|
||||
this.z7.style.position = "absolute";
|
||||
this.z7.style.color = this.me(255, 255, 255);
|
||||
this.lq();
|
||||
|
|
25
index.html
25
index.html
|
@ -51,7 +51,7 @@
|
|||
</style>
|
||||
<!-- FX Client CSS -->
|
||||
<style>
|
||||
.settings {
|
||||
.window {
|
||||
position: fixed;
|
||||
background-color: rgba(0, 0, 0, 0.7);
|
||||
width: 90%;
|
||||
|
@ -72,7 +72,7 @@
|
|||
font-size: calc(14px + (0.6*(1vw+1vh+4)));
|
||||
transition: 0.2s;
|
||||
}
|
||||
.settings button, .settings input {
|
||||
.window button, .window input {
|
||||
background-color: rgba(0, 0, 0, 0.7);
|
||||
color: white;
|
||||
font-size: 20px;
|
||||
|
@ -96,26 +96,39 @@
|
|||
/*border: 1px solid white;*/
|
||||
border-radius: 8px;
|
||||
}
|
||||
.settings input:focus {
|
||||
.window input:focus {
|
||||
background-color: rgba(222, 222, 222, 0.36);
|
||||
/*border: 1px solid white;*/
|
||||
border-radius: 8px;
|
||||
}
|
||||
input#userna {
|
||||
transition: 0.2s
|
||||
}
|
||||
transition: 0.2s
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<!-- Styles for in-game stuff -->
|
||||
<style>
|
||||
.inputfilebtn {
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body onload="aiCommand746(0);">
|
||||
<canvas id="canvasA" width="128" height="128"></canvas>
|
||||
<div class="settings" style="display:none">
|
||||
<div class="window 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><hr>
|
||||
<button onclick="settingsManager.resetAll()">Reset Settings</button>
|
||||
<button onclick="settingsManager.save()">Save Settings</button>
|
||||
</div>
|
||||
<div class="window" id="donationhistory" style="display:none">
|
||||
<h1>Donation history for </h1>
|
||||
<p>Note: donations from bots are not shown here</p>
|
||||
<p id="donationhistory_text"></p>
|
||||
</div>
|
||||
<script src="game.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -12,6 +12,7 @@ FX Client is the first Territorial.io client, targeting better User Interface an
|
|||
8. Adds a text to display "Maximum Troops"
|
||||
9. Adds a win counter
|
||||
10. Adds a settings menu from which the game font can be changed
|
||||
11. Adds the ability to view the history of who donated to a player during the game
|
||||
|
||||
### Contact Us
|
||||
Our Website: https://fxclient.cf
|
||||
|
|
Loading…
Reference in New Issue