Update 0.5.3
Co-authored-by: Mohsen Taghavi <mohsenemx@users.noreply.github.com>archived
parent
725328bb9a
commit
d2a80a9d61
118
game.js
118
game.js
|
@ -1,8 +1,8 @@
|
||||||
const fx_version = '0.5.2'; // FX Client Version
|
const fx_version = '0.5.3'; // FX Client Version
|
||||||
const fx_update = 'Dec 25'; // FX Client Last Updated
|
const fx_update = 'Dec 26'; // FX Client Last Updated
|
||||||
|
|
||||||
const ter_version = '1.82.9'; // Territorial Version
|
const ter_version = '1.82.9'; // Territorial Version
|
||||||
const ter_update = 'December 2 2022'; // Territorial Last Updated
|
const ter_update = 'December 2 2022'; // Territorial Last Updated
|
||||||
|
|
||||||
|
|
||||||
var username_i0 = ''; // alternative username variable
|
var username_i0 = ''; // alternative username variable
|
||||||
|
@ -15,15 +15,15 @@ if (localStorage.getItem("win_count") == undefined || localStorage.getItem("win_
|
||||||
}
|
}
|
||||||
|
|
||||||
var settings = {
|
var settings = {
|
||||||
"fontName": "Trebuchet MS"
|
"fontName": "Trebuchet MS",
|
||||||
|
"showBotDonations": false
|
||||||
};
|
};
|
||||||
var settingsWindowOpen = false;
|
|
||||||
var donationHistoryWindowOpen = false;
|
|
||||||
var settingsManager = new (function() {
|
var settingsManager = new (function() {
|
||||||
this.save = function() {
|
this.save = function() {
|
||||||
settings.fontName = document.getElementById("settings_fontname").value.trim();
|
settings.fontName = document.getElementById("settings_fontname").value.trim();
|
||||||
|
settings.showBotDonations = document.getElementById("settings_donations_bots").checked;
|
||||||
this.applySettings();
|
this.applySettings();
|
||||||
closeSettingsWindow();
|
WindowManager.closeWindow("settings");
|
||||||
localStorage.setItem("settings", JSON.stringify(settings));
|
localStorage.setItem("settings", JSON.stringify(settings));
|
||||||
// should probably firgure out a way to do this without reloading
|
// should probably firgure out a way to do this without reloading
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
@ -45,31 +45,45 @@ function removeWins() {
|
||||||
alert("Successfully reset wins");
|
alert("Successfully reset wins");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// yes, I know, this code is 🤮, I will fix it later
|
var WindowManager = new (function() {
|
||||||
function openSettingsWindow() {
|
var windows = {};
|
||||||
settingsWindowOpen = true;
|
this.add = function(newWindow) {
|
||||||
document.getElementById("settings_fontname").value = settings.fontName;
|
windows[newWindow.name] = newWindow;
|
||||||
document.querySelector(".settings").style.display = "block";
|
windows[newWindow.name].isOpen = false;
|
||||||
}
|
};
|
||||||
function closeSettingsWindow() {
|
this.openWindow = function(windowName) {
|
||||||
if (!settingsWindowOpen) return;
|
if (windows[windowName].isOpen === true) return;
|
||||||
settingsWindowOpen = false;
|
if (windows[windowName].beforeOpen !== undefined) windows[windowName].beforeOpen();
|
||||||
document.querySelector(".settings").style.display = "none";
|
windows[windowName].isOpen = true;
|
||||||
}
|
windows[windowName].element.style.display = "block";
|
||||||
function openDonationHistoryWindow() {
|
};
|
||||||
donationHistoryWindowOpen = true;
|
this.closeWindow = function(windowName) {
|
||||||
document.querySelector("#donationhistory").style.display = "block";
|
if (windows[windowName].isOpen === false) return;
|
||||||
}
|
windows[windowName].isOpen = false;
|
||||||
function closeDonationHistoryWindow() {
|
windows[windowName].element.style.display = "none";
|
||||||
if (!donationHistoryWindowOpen) return;
|
};
|
||||||
donationHistoryWindowOpen = false;
|
this.closeAll = function() {
|
||||||
document.querySelector("#donationhistory").style.display = "none";
|
Object.values(windows).forEach(function(windowObj) {
|
||||||
}
|
WindowManager.closeWindow(windowObj.name);
|
||||||
function closeAllWindows() {
|
});
|
||||||
if (settingsWindowOpen) closeSettingsWindow();
|
};
|
||||||
if (donationHistoryWindowOpen) closeDonationHistoryWindow();
|
});
|
||||||
}
|
WindowManager.add({
|
||||||
document.getElementById("canvasA").addEventListener("mousedown", closeAllWindows);
|
name: "settings",
|
||||||
|
element: document.querySelector(".settings"),
|
||||||
|
beforeOpen: function() {
|
||||||
|
document.getElementById("settings_fontname").value = settings.fontName;
|
||||||
|
document.getElementById("settings_donations_bots").checked = settings.showBotDonations;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
WindowManager.add({
|
||||||
|
name: "donationHistory",
|
||||||
|
element: document.querySelector("#donationhistory"),
|
||||||
|
beforeOpen: function() {
|
||||||
|
document.getElementById("donationhistory_note").style.display = (settings.showBotDonations ? "none" : "block");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
document.getElementById("canvasA").addEventListener("mousedown", WindowManager.closeAll);
|
||||||
//var tfxc = document.createElement('div');
|
//var tfxc = document.createElement('div');
|
||||||
//tfxc.setAttribute('class', 'settingsd');
|
//tfxc.setAttribute('class', 'settingsd');
|
||||||
var settingsGearIcon = document.createElement('img');
|
var settingsGearIcon = document.createElement('img');
|
||||||
|
@ -82,7 +96,7 @@ var donationsTracker = new (function(){
|
||||||
// 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([]);
|
||||||
// from inside of game:
|
// from inside of game:
|
||||||
// (!gE[g].startsWith("[Bot] ") && 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) {
|
||||||
this.donationHistory[receiverID].push([senderID,amount]);
|
this.donationHistory[receiverID].push([senderID,amount]);
|
||||||
};
|
};
|
||||||
|
@ -103,7 +117,7 @@ function displayDonationsHistory(playerID, playerNames) {
|
||||||
});
|
});
|
||||||
else historyText = "Nothing to display";
|
else historyText = "Nothing to display";
|
||||||
document.querySelector("#donationhistory p#donationhistory_text").innerHTML = historyText;
|
document.querySelector("#donationhistory p#donationhistory_text").innerHTML = historyText;
|
||||||
openDonationHistoryWindow();
|
WindowManager.openWindow("donationHistory");
|
||||||
}
|
}
|
||||||
|
|
||||||
var setVarByName;
|
var setVarByName;
|
||||||
|
@ -1606,11 +1620,15 @@ var setVarByName;
|
||||||
(k = g === aw) ? e5.fh(g, 2) : e5.fh(1 - aw, 3);
|
(k = g === aw) ? e5.fh(g, 2) : e5.fh(1 - aw, 3);
|
||||||
ia.i2(g)
|
ia.i2(g)
|
||||||
} else
|
} else
|
||||||
|
// if the game is team game
|
||||||
dA ? (
|
dA ? (
|
||||||
g = eP.ib(), k = dW.dX[aw] === g,
|
g = eP.ib(), k = dW.dX[aw] === g,
|
||||||
9 === dr ? x = k ? ei[0] : 512 : (g = dW.ic(dW.id[g]), x = g[0], 512 !== x && e5.ie(g[1])),
|
9 === dr ? (x = (k ? ei[0] : 512))
|
||||||
|
: (g = dW.ic(dW.id[g]), x = g[0], 512 !== x && e5.ie(g[1])),
|
||||||
e5.ig(k)
|
e5.ig(k)
|
||||||
) : (x = ei[0], k = x === aw, e5.ih(x));
|
) : (
|
||||||
|
x = ei[0], k = (x === aw), e5.ih(x)
|
||||||
|
);
|
||||||
dt || ii.ij(ik(), x);
|
dt || ii.ij(ik(), x);
|
||||||
eS.show(k, !1);
|
eS.show(k, !1);
|
||||||
e5.iq(!0);
|
e5.iq(!0);
|
||||||
|
@ -2448,14 +2466,18 @@ var setVarByName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
// Zombie mode
|
// End of team game
|
||||||
this.ig = function (G) {
|
this.ig = function (G) {
|
||||||
var M = dW.id[eP.mp()];
|
var M = dW.id[eP.mp()];
|
||||||
G ? (9 === dr ? (G = "The Resistance defeated the virus.",
|
G ? (
|
||||||
c2.mq("The Resistance", 2, 1, 12)) : G = "Congratulations! Team " + dW.bo[M] + " has won the game!",
|
9 === dr ? (G = "The Resistance defeated the virus.", c2.mq("The Resistance", 2, 1, 12))
|
||||||
A(0, G, 40, 0, "rgb(10,220,10)", hq, -1, !1)) : (9 === dr ? (G = "Mankind lost the war against the virus.",
|
: G = "Congratulations! Team " + dW.bo[M] + " has won the game!",
|
||||||
c2.mq("The Virus", 2, 0, 16)) : G = "Our alliance has been defeated!",
|
A(0, G, 40, 0, "rgb(10,220,10)", hq, -1, !1)
|
||||||
A(0, G, 41, 0, "rgb(200,80,80)", hq, -1, !1));
|
) : (
|
||||||
|
9 === dr ? (G = "Mankind lost the war against the virus.", c2.mq("The Virus", 2, 0, 16))
|
||||||
|
: G = "Our alliance has been defeated!",
|
||||||
|
A(0, G, 41, 0, "rgb(200,80,80)", hq, -1, !1)
|
||||||
|
);
|
||||||
9 !== dr && c2.mq("Team " + dW.bo[M], 2, 1, 12);
|
9 !== dr && c2.mq("Team " + dW.bo[M], 2, 1, 12);
|
||||||
eR.gl(2700)
|
eR.gl(2700)
|
||||||
}
|
}
|
||||||
|
@ -4452,7 +4474,9 @@ var setVarByName;
|
||||||
var Y = ei[T + V];
|
var Y = ei[T + V];
|
||||||
T === y - 1 && sD[aw] >= V + y - 1 && (Y = aw);
|
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);
|
// if the game is a team game, display donation history, else trigger default click behaviour
|
||||||
|
if (dA) displayDonationsHistory(Y, gE);
|
||||||
|
else eR.gc(Y, 800, !1, 0);
|
||||||
}
|
}
|
||||||
return !0
|
return !0
|
||||||
};
|
};
|
||||||
|
@ -4899,7 +4923,7 @@ var setVarByName;
|
||||||
// add points to receiving player
|
// add points to receiving player
|
||||||
ax[k] += x,
|
ax[k] += x,
|
||||||
// track donations
|
// track donations
|
||||||
((!gE[g].startsWith("[Bot] ")) && donationsTracker.logDonation(g,k,x))
|
((!gE[g].startsWith("[Bot] ") || settings.showBotDonations) && donationsTracker.logDonation(g,k,x))
|
||||||
//donationsTracker.logDonation(g,k,x)
|
//donationsTracker.logDonation(g,k,x)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -9781,12 +9805,12 @@ var setVarByName;
|
||||||
nN.bp(ol, !1)) : 9 === z[B].id && (nN.bp(nO, !0),
|
nN.bp(ol, !1)) : 9 === z[B].id && (nN.bp(nO, !0),
|
||||||
nN.bp(nO, !1)), !0;
|
nN.bp(nO, !1)), !0;
|
||||||
//cH.drawImage(settingsGearIcon,A.f3-A.hw/2,A.f4,A.nI,A.nI);
|
//cH.drawImage(settingsGearIcon,A.f3-A.hw/2,A.f4,A.nI,A.nI);
|
||||||
if (y > (C.f3-C.hw/2) && y < ((C.f3-C.hw/2)+C.nI) && A > C.f4 && A < (C.f4 + C.nI)) openSettingsWindow();
|
if (y > (C.f3-C.hw/2) && y < ((C.f3-C.hw/2)+C.nI) && A > C.f4 && A < (C.f4 + C.nI)) WindowManager.openWindow("settings");
|
||||||
n = false;
|
n = false;
|
||||||
c4.c5 = true;
|
c4.c5 = true;
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if (y > (C.f3-C.hw/2) && y < ((C.f3-C.hw/2)+C.nI) && A > C.f4 && A < (C.f4 + C.nI)) openSettingsWindow();
|
if (y > (C.f3-C.hw/2) && y < ((C.f3-C.hw/2)+C.nI) && A > C.f4 && A < (C.f4 + C.nI)) WindowManager.openWindow("settings");
|
||||||
return k(y, A, C, 0) ? (n = true, c4.c5 = true) : false
|
return k(y, A, C, 0) ? (n = true, c4.c5 = true) : false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -11899,7 +11923,7 @@ var setVarByName;
|
||||||
|
|
||||||
if (localStorage.getItem("settings") !== null) {
|
if (localStorage.getItem("settings") !== null) {
|
||||||
settings = JSON.parse(localStorage.getItem("settings"));
|
settings = JSON.parse(localStorage.getItem("settings"));
|
||||||
settingsManager.applySettings();
|
|
||||||
}
|
}
|
||||||
|
settingsManager.applySettings();
|
||||||
|
|
||||||
console.log('Successfully loaded FX Client');
|
console.log('Successfully loaded FX Client');
|
||||||
|
|
23
index.html
23
index.html
|
@ -103,19 +103,19 @@
|
||||||
/*border: 1px solid white;*/
|
/*border: 1px solid white;*/
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
input#userna {
|
input#userna, input#inputfilebtn {
|
||||||
transition: 0.2s
|
transition: 0.2s
|
||||||
}
|
}
|
||||||
::-webkit-file-upload-button {
|
::-webkit-file-upload-button {
|
||||||
color: white;
|
color: white;
|
||||||
background-color: #120076;
|
background-color: #120076;
|
||||||
border: 2px solid #fff;
|
border: 2px solid #fff;
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
padding-top: 30px;
|
padding-top: 20px;
|
||||||
padding-bottom: 30px;
|
padding-bottom: 20px;
|
||||||
padding-left: 30px;
|
padding-left: 20px;
|
||||||
padding-right: 30px;
|
padding-right: 20px;
|
||||||
font-family: 'Trebuchet MS', 'Arial Narrow', Arial, sans-serif;
|
font-family: 'Trebuchet MS', 'Arial Narrow', Arial, sans-serif;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
@ -128,15 +128,20 @@
|
||||||
<div class="window settings" style="display:none">
|
<div class="window settings" style="display:none">
|
||||||
<h1>Settings</h1>
|
<h1>Settings</h1>
|
||||||
Font name: <input id="settings_fontname" placeholder="Enter font name" value="Arial"><br>
|
Font name: <input id="settings_fontname" placeholder="Enter font name" value="Arial"><br>
|
||||||
<br><button onclick="removeWins()">Reset Wins Counter</button><hr>
|
<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>
|
||||||
|
<hr>
|
||||||
<button onclick="settingsManager.resetAll()">Reset Settings</button>
|
<button onclick="settingsManager.resetAll()">Reset Settings</button>
|
||||||
<button onclick="settingsManager.save()">Save Settings</button>
|
<button onclick="settingsManager.save()">Save Settings</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="window" id="donationhistory" style="display:none">
|
<div class="window" id="donationhistory" style="display:none">
|
||||||
<h1>Donation history for </h1>
|
<h1>Donation history for </h1>
|
||||||
<p>Note: donations from bots are not shown here</p>
|
<p id="donationhistory_note">Note: donations from bots are not shown here</p>
|
||||||
<p id="donationhistory_text"></p>
|
<p id="donationhistory_text"></p>
|
||||||
</div>
|
</div>
|
||||||
<script src="game.js"></script>
|
<script src="game.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
<!-- This line of code is proudly useless -->
|
Loading…
Reference in New Issue