diff --git a/core/view/HtmlActionCards.php b/core/view/HtmlActionCards.php
index d9ac981..0c12743 100644
--- a/core/view/HtmlActionCards.php
+++ b/core/view/HtmlActionCards.php
@@ -47,7 +47,7 @@ function card_building() {
function card_dig() {
return '
-
La zone peut ĂȘtre fouillĂ©e.
diff --git a/core/view/HtmlPage.php b/core/view/HtmlPage.php
index e021f6f..733f836 100644
--- a/core/view/HtmlPage.php
+++ b/core/view/HtmlPage.php
@@ -11,7 +11,7 @@ class HtmlPage
// Increment those variables when you modify the CSS or JS files. This ensures
// that the users' browsers reload the up-to-date files, instead of using
// the obsolete ones stored in their cache.
- private $css_js_version = 56.1;
+ private $css_js_version = 56.2;
/**
* Sets HTTP headers to secure the website
diff --git a/public/resources/js/actionBlocks.func.js b/public/resources/js/actionBlocks.func.js
index a6b40ce..310f79e 100644
--- a/public/resources/js/actionBlocks.func.js
+++ b/public/resources/js/actionBlocks.func.js
@@ -24,9 +24,10 @@ async function updateBlockAction(blockAlias) {
}
else if(blockAlias === "dig") {
- let mapId = document.querySelector("#mapId").innerHTML,
- myZone = document.querySelector("#me").parentNode.dataset;
- updateBlockActionDig(mapId, myZone.coordx, myZone.coordy);
+ let mapId = Number(document.querySelector("#mapId").innerHTML),
+ coordX = Number(document.querySelector("#citizenCoordX").innerHTML),
+ coordY = Number(document.querySelector("#citizenCoordY").innerHTML);
+ updateBlockActionDig(mapId, coordX, coordY);
}
}
@@ -291,15 +292,16 @@ async function updateBlockActionDig(mapId, coordX, coordY) {
let block = document.querySelector("#items_ground .items_list");
// Update the data only one time per zone
- if(block.dataset.coordx !== coordX || block.dataset.coordy !== coordY
- || block.innerHTML.length === 0) {
-
+ if(Number(block.dataset.coordx) !== coordX
+ || Number(block.dataset.coordy) !== coordY
+ || block.innerHTML.length === 0
+ ) {
// Clear the obsolete items list from the previous zone
block.innerHTML = "";
// Get the items in the zone by calling the Azimutant's API
- _myZone = await getMyZoneOnce(mapId, coordX, coordY);
+ _myZone = await getMyZoneOnce(mapId, coordX, coordY);
// Set the digging button to grey if the player can't dig
- updateDigButtons(_myZone.user_specific.is_visited_today);
+ updateDigButtons(await _myZone.user_specific.is_visited_today);
if(_myZone.items.length === 0) {
// Show the default text if no items on the ground
diff --git a/public/resources/js/mapInit.func.js b/public/resources/js/mapInit.func.js
index ed5962d..2c13729 100644
--- a/public/resources/js/mapInit.func.js
+++ b/public/resources/js/mapInit.func.js
@@ -355,10 +355,16 @@ function switchToActionView() {
}
// Activate the "Move" tab action
- setTimeout(() => {
+ setTimeout(async () => {
document.querySelector("#round_move").classList.add("active");
toggleActionBlock('move');
updateBlockAction('move');
+ // Hide the card for digging if the zone is not diggable
+ let mapId = Number(document.querySelector("#mapId").innerHTML),
+ coordX = Number(document.querySelector("#citizenCoordX").innerHTML),
+ coordY = Number(document.querySelector("#citizenCoordY").innerHTML);
+ _myZone = await getMyZoneOnce(mapId, coordX, coordY);
+ updateDigButtons(_myZone.user_specific.is_visited_today);
}, 1000);
// Hide some elements of the GUI to make the interface look lighter
diff --git a/public/resources/js/misc.func.js b/public/resources/js/misc.func.js
index ceec765..97c709c 100644
--- a/public/resources/js/misc.func.js
+++ b/public/resources/js/misc.func.js
@@ -354,7 +354,7 @@ function animateCss(cssSelector, effectName) {
* @param {int} newCoordY
* @returns {undefined}
*/
-function updateMeAfterMoving(newCoordX, newCoordY) {
+async function updateMeAfterMoving(newCoordX, newCoordY) {
// Delete the informations about the previous zone (obsolete)
_myZone = null;
@@ -380,6 +380,7 @@ function updateMeAfterMoving(newCoordX, newCoordY) {
updateEnterBuildingButton(myZone.dataset.citytypeid, myZone.dataset.controlpointscitizens, myZone.dataset.zombies);
updateMoveCost(parseInt(myZone.dataset.zombies));
updateCardCitizensInZone(myZone.dataset.citizens);
+ updateBlockAction('dig');
setTimeout(()=>{ centerMapOnMe(10) }, 1000);
}
@@ -457,7 +458,7 @@ async function killZombies(apiAction) {
let myZone = document.querySelector("#me").parentNode;
let oldNbrZombies = myZone.dataset.zombies,
newNbrZombies = Math.max(0, oldNbrZombies - json.datas.nbr_zombies_removed);
- let mapId = document.querySelector("#gameData #mapId").innerHTML;
+ let mapId = Number(document.querySelector("#gameData #mapId").innerHTML);
// Update the action blocks (round buttons next to the map)
updateBlockActionZombies(newNbrZombies);