Update 0.6.0.3

Make dictionary generation automatic;
Add colors to parts of the text in the donation history viewer;
Fix not being able to select text in the donation history window.
archived
peshomir 2024-02-06 19:29:40 +02:00
parent 404bb8547c
commit c8d452610a
3 changed files with 26 additions and 7 deletions

View File

@ -14,8 +14,20 @@ const replaceOne = (expression, replaceValue) => {
return result; return result;
} }
const dictionary = { __dictionaryVersion: '1.90.0 4 Feb 2024', playerId: 'bB', playerNames: 'hA', playerBalances: 'bC', playerTerritories: 'bj', gIsSingleplayer: 'fc', gIsTeamGame: 'cH' }; //const dictionary = { __dictionaryVersion: '1.90.0 4 Feb 2024', playerId: 'bB', playerNames: 'hA', playerBalances: 'bC', playerTerritories: 'bj', gIsSingleplayer: 'fc', gIsTeamGame: 'cH' };
if (!script.includes(`"${dictionary.__dictionaryVersion}"`)) throw new Error("Dictionary is outdated."); //if (!script.includes(`"${dictionary.__dictionaryVersion}"`)) throw new Error("Dictionary is outdated.");
let dictionary = {};
[/,\w+="Player: "\+(?<playerNames>\w+)\[\w+\],\w+=\(\w\+=" Balance: "\+\w+\.\w+\((?<playerBalances>\w+)\[\w+\]\)\)\+\(" Territory: "\+\w+\.\w+\((?<playerTerritories>\w+)\[\w+\]\)\)\+\(" Coords: "/g,
/{\w+===(?<playerId>\w+)\?\w+\(175," Message to "/g,
/=(?<gIsSingleplayer>\w+)\?"Players":"Bots"/g,
/,(?<gIsTeamGame>\w+)=\(\w+=\w+\)<7\|\|9===\w+,/g,
]
.forEach(expression => {
result = expression.exec(script);
if (result === null) throw new Error("no match for ") + expression;
if (expression.exec(script) !== null) throw new Error("more than one match for: ") + expression;
for (let [key, value] of Object.entries(result.groups)) dictionary[key] = value;
});
// Replace assets // Replace assets
const assets = require('./assets.js'); const assets = require('./assets.js');

View File

@ -1,5 +1,5 @@
const fx_version = '0.6.0.2'; // FX Client Version const fx_version = '0.6.0.3'; // FX Client Version
const fx_update = 'Feb 3'; // FX Client Last Updated const fx_update = 'Feb 6'; // 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) {
@ -121,8 +121,10 @@ function displayDonationsHistory(playerID, playerNames, isSingleplayer) {
var historyText = ""; var historyText = "";
history.reverse(); history.reverse();
if (history.length > 0) history.forEach(function(historyItem, index) { if (history.length > 0) history.forEach(function(historyItem, index) {
if (playerID === historyItem[1]) historyText += `${(history.length - index)}. Received ${historyItem[2]} resources from ${playerNames[historyItem[0]]}<br>`; historyText += `<span class="color-light-gray">${(history.length - index)}.</span> `;
else historyText += `${(history.length - index)}. Sent ${historyItem[2]} resources to ${playerNames[historyItem[1]]}<br>`; if (playerID === historyItem[1])
historyText += `Received <span class="color-green">${historyItem[2]}</span> resources from ${playerNames[historyItem[0]]}<br>`;
else historyText += `Sent <span class="color-red">${historyItem[2]}</span> resources to ${playerNames[historyItem[1]]}<br>`;
}); });
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;

View File

@ -54,7 +54,7 @@ h1 {
transition : 0.2s; transition : 0.2s;
} }
canvas { canvas, input, textarea {
transition: 0.2s; transition: 0.2s;
} }
@ -73,6 +73,11 @@ input#inputfilebtn {
transition: 0.2s transition: 0.2s
} }
.window#donationhistory { user-select: text; }
.color-red { color: #dc143c; }
.color-green { color: #32cd32; }
.color-light-gray { color: #aaaaaa; }
/* Checkbox */ /* Checkbox */
label.checkbox { label.checkbox {