Fix Bucket of Water & Wall View

Fix Bucket of Water & Wall View
This commit is contained in:
novgorodschi catalin
2026-07-30 09:04:34 +03:00
parent ec65da48f4
commit a9977edc5c
7 changed files with 144 additions and 50 deletions
+54 -17
View File
@@ -689,26 +689,63 @@ class HeroItems
return self::USE_OK;
}
/* ---- Bucket of Water: instant free revive of the dead hero ---- */
if (isset($bonus[HB_BUCKET])) {
$stmt = $this->db->prepare(
"UPDATE " . TB_PREFIX . "hero
SET dead = 0, health = 100, inrevive = 0, lastupdate = ?
WHERE uid = ? AND dead = 1 LIMIT 1"
);
$now = time();
$stmt->bind_param('ii', $now, $uid);
$stmt->execute();
$revived = $stmt->affected_rows > 0;
$stmt->close();
/* ---- Bucket of Water: instant free revive of the dead hero ---- */
if (isset($bonus[HB_BUCKET])) {
// Luăm rândul eroului mort (avem nevoie de heroid + wref)
$stmt = $this->db->prepare(
"SELECT heroid, wref FROM " . TB_PREFIX . "hero
WHERE uid = ? AND dead = 1 LIMIT 1"
);
$stmt->bind_param('i', $uid);
$stmt->execute();
$stmt->bind_result($heroid, $wref);
$found = $stmt->fetch();
$stmt->close();
if (!$revived) {
return self::USE_INVALID; // no dead hero to revive
}
$this->removeItem($uid, $rowId, 1); // one bucket per revive
return self::USE_OK;
if (!$found) {
return self::USE_INVALID; // no dead hero to revive
}
$heroid = (int) $heroid;
$wref = (int) $wref;
$now = time();
$this->db->begin_transaction();
try {
// 1. Marchează eroul ca viu
$stmt = $this->db->prepare(
"UPDATE " . TB_PREFIX . "hero
SET dead = 0, health = 100, inrevive = 0, lastupdate = ?
WHERE heroid = ? AND dead = 1 LIMIT 1"
);
$stmt->bind_param('ii', $now, $heroid);
$stmt->execute();
$revived = $stmt->affected_rows > 0;
$stmt->close();
if (!$revived) {
$this->db->rollback();
return self::USE_INVALID;
}
// 2. Pune eroul înapoi în sat (units.hero = 1)
$stmt = $this->db->prepare(
"UPDATE " . TB_PREFIX . "units SET hero = 1 WHERE vref = ? LIMIT 1"
);
$stmt->bind_param('i', $wref);
$stmt->execute();
$stmt->close();
$this->db->commit();
} catch (Throwable $e) {
$this->db->rollback();
return self::USE_INVALID;
}
$this->removeItem($uid, $rowId, 1); // one bucket per revive
return self::USE_OK;
}
/* ---- Book of Wisdom: reset attribute points ---- */
if (isset($bonus[HB_RESET])) {
$hero = $this->getLivingHeroRow($uid);
+12 -11
View File
@@ -1,15 +1,16 @@
<h2><?php echo CITYWALL ?></h2>
<table class="new_building" cellpadding="1" cellspacing="1">
<tbody><tr>
<td class="desc"><?php echo CITYWALL_DESC ?></td>
<td rowspan="3" class="bimg">
</td>
</tr>
<tr>
<?php
<table class="new_building" cellpadding="1" cellspacing="1">
<tbody><tr>
<td class="desc"><?php echo CITYWALL_DESC ?></td>
<td rowspan="3" class="bimg">
<a href="#" onClick="return Popup(31,4);">
<img class="building g31" src="img/x.gif" alt="<?php echo CITYWALL; ?>" title="<?php echo CITYWALL; ?>" /></a>
</td>
</tr>
<tr>
<?php
$_GET['bid'] = 31;
include("availupgrade.tpl");
?>
</tr>
</table>
</tr></tbody>
</table>
+12 -11
View File
@@ -1,15 +1,16 @@
<h2><?php echo EARTHWALL ?></h2>
<table class="new_building" cellpadding="1" cellspacing="1">
<tbody><tr>
<td class="desc"><?php echo EARTHWALL_DESC ?></td>
<td rowspan="3" class="bimg">
</td>
</tr>
<tr>
<?php
<table class="new_building" cellpadding="1" cellspacing="1">
<tbody><tr>
<td class="desc"><?php echo EARTHWALL_DESC ?></td>
<td rowspan="3" class="bimg">
<a href="#" onClick="return Popup(32,4);">
<img class="building g32" src="img/x.gif" alt="<?php echo EARTHWALL; ?>" title="<?php echo EARTHWALL; ?>" /></a>
</td>
</tr>
<tr>
<?php
$_GET['bid'] = 32;
include("availupgrade.tpl");
?>
</tr>
</table>
</tr></tbody>
</table>
+12 -11
View File
@@ -1,15 +1,16 @@
<h2><?php echo PALISADE ?></h2>
<table class="new_building" cellpadding="1" cellspacing="1">
<tbody><tr>
<td class="desc"><?php echo PALISADE_DESC ?></td>
<td rowspan="3" class="bimg">
</td>
</tr>
<tr>
<?php
<table class="new_building" cellpadding="1" cellspacing="1">
<tbody><tr>
<td class="desc"><?php echo PALISADE_DESC ?></td>
<td rowspan="3" class="bimg">
<a href="#" onClick="return Popup(33,4);">
<img class="building g33" src="img/x.gif" alt="<?php echo PALISADE; ?>" title="<?php echo PALISADE; ?>" /></a>
</td>
</tr>
<tr>
<?php
$_GET['bid'] = 33;
include("availupgrade.tpl");
?>
</tr>
</table>
</tr></tbody>
</table>
+18
View File
@@ -0,0 +1,18 @@
<h2><?php echo CITYWALL ?></h2>
<table class="new_building" cellpadding="1" cellspacing="1">
<tbody><tr>
<td class="desc"><?php echo CITYWALL_DESC ?></td>
<td rowspan="3" class="bimg">
<a href="#" onClick="return Popup(31,4);">
<img class="building g31" src="img/x.gif" alt="<?php echo CITYWALL ?>" title="<?php echo CITYWALL ?>" /></a>
</td>
</tr>
<tr>
<td class="requ"><?php echo PREREQUISITES ?></td>
</tr>
<tr>
<td>
<?php echo TRIBE1; ?>
</td>
</tr></tbody>
</table>
+18
View File
@@ -0,0 +1,18 @@
<h2><?php echo EARTHWALL ?></h2>
<table class="new_building" cellpadding="1" cellspacing="1">
<tbody><tr>
<td class="desc"><?php echo EARTHWALL_DESC ?></td>
<td rowspan="3" class="bimg">
<a href="#" onClick="return Popup(32,4);">
<img class="building g32" src="img/x.gif" alt="<?php echo EARTHWALL ?>" title="<?php echo EARTHWALL ?>" /></a>
</td>
</tr>
<tr>
<td class="requ"><?php echo PREREQUISITES ?></td>
</tr>
<tr>
<td>
<?php echo TRIBE2; ?>
</td>
</tr></tbody>
</table>
+18
View File
@@ -0,0 +1,18 @@
<h2><?php echo PALISADE ?></h2>
<table class="new_building" cellpadding="1" cellspacing="1">
<tbody><tr>
<td class="desc"><?php echo PALISADE_DESC ?></td>
<td rowspan="3" class="bimg">
<a href="#" onClick="return Popup(33,4);">
<img class="building g33" src="img/x.gif" alt="<?php echo PALISADE ?>" title="<?php echo PALISADE ?>" /></a>
</td>
</tr>
<tr>
<td class="requ"><?php echo PREREQUISITES ?></td>
</tr>
<tr>
<td>
<?php echo TRIBE3; ?>
</td>
</tr></tbody>
</table>