mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-21 18:47:14 +00:00
fix #372
This commit is contained in:
@@ -135,11 +135,37 @@ trait DatabaseHeroQueries {
|
|||||||
Function to Kill hero if not found
|
Function to Kill hero if not found
|
||||||
Made by: Shadow and brainiacX
|
Made by: Shadow and brainiacX
|
||||||
***************************/
|
***************************/
|
||||||
|
/**
|
||||||
|
* Marcheaza eroul ca mort.
|
||||||
|
*
|
||||||
|
* BUG REPARAT: se scria doar in tabela "hero". Coloana units.hero ramanea
|
||||||
|
* 1, deci eroul continua sa apara in sat, in dorf1 si in punctul de
|
||||||
|
* adunare, desi jocul il considera mort. Trebuie sters din AMBELE locuri.
|
||||||
|
*
|
||||||
|
* Stergem din units DOAR pentru satele jucatorului respectiv, ca sa nu
|
||||||
|
* atingem eroii altora aflati acolo ca intariri.
|
||||||
|
*/
|
||||||
function KillMyHero($id) {
|
function KillMyHero($id) {
|
||||||
list( $id ) = $this->escape_input( (int) $id );
|
list( $id ) = $this->escape_input( (int) $id );
|
||||||
|
|
||||||
$q = "UPDATE " . TB_PREFIX . "hero set dead = 1, intraining = 0, inrevive = 0, health = 0 where uid = " . $id . " AND dead = 0";
|
$q = "UPDATE " . TB_PREFIX . "hero set dead = 1, intraining = 0, inrevive = 0, health = 0 where uid = " . $id . " AND dead = 0";
|
||||||
return mysqli_query( $this->dblink, $q );
|
$ok = mysqli_query( $this->dblink, $q );
|
||||||
|
|
||||||
|
// scoatem eroul din satele jucatorului
|
||||||
|
$q2 = "UPDATE " . TB_PREFIX . "units u
|
||||||
|
JOIN " . TB_PREFIX . "vdata v ON v.wref = u.vref
|
||||||
|
SET u.hero = 0
|
||||||
|
WHERE v.owner = " . $id . " AND u.hero > 0";
|
||||||
|
mysqli_query( $this->dblink, $q2 );
|
||||||
|
|
||||||
|
// si din intaririle trimise altora
|
||||||
|
$q3 = "UPDATE " . TB_PREFIX . "enforcement e
|
||||||
|
JOIN " . TB_PREFIX . "vdata v ON v.wref = e.`from`
|
||||||
|
SET e.hero = 0
|
||||||
|
WHERE v.owner = " . $id . " AND e.hero > 0";
|
||||||
|
mysqli_query( $this->dblink, $q3 );
|
||||||
|
|
||||||
|
return $ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************
|
/***************************
|
||||||
@@ -256,6 +282,13 @@ trait DatabaseHeroQueries {
|
|||||||
hero.dead = 1, hero.health = 0, hero.wref = vdata.wref
|
hero.dead = 1, hero.health = 0, hero.wref = vdata.wref
|
||||||
WHERE
|
WHERE
|
||||||
hero.wref = $wref";
|
hero.wref = $wref";
|
||||||
return mysqli_query($this->dblink, $q);
|
$ok = mysqli_query($this->dblink, $q);
|
||||||
|
|
||||||
|
// Aceeasi problema ca la KillMyHero: fara asta, eroul ramanea vizibil in
|
||||||
|
// sat desi era marcat mort.
|
||||||
|
mysqli_query($this->dblink,
|
||||||
|
"UPDATE " . TB_PREFIX . "units SET hero = 0 WHERE vref = " . (int) $wref . " AND hero > 0");
|
||||||
|
|
||||||
|
return $ok;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -185,14 +185,20 @@ foreach ($heroes as $hero_datarow) {
|
|||||||
</table>
|
</table>
|
||||||
<?php
|
<?php
|
||||||
} elseif (!$reviving) {
|
} elseif (!$reviving) {
|
||||||
if (in_array($hero_datarow['unit'], [1, 11, 21, 51, 61, 71, 81])) {
|
/**
|
||||||
// basic unit of the tribe - available without research
|
* BUG REPARAT: invierea cerea ca unitatea EROULUI sa fie cercetata in
|
||||||
echo $renderReviveRow($hero_datarow, $name, $wood, $clay, $iron, $crop, $training_time, $id);
|
* satul CURENT.
|
||||||
} else {
|
*
|
||||||
if ($database->checkIfResearched($village->wid, 't' . $hero_datarow['unit']) != 0) {
|
* Eroul e insa antrenat o singura data, in satul lui de origine, si se
|
||||||
echo $renderReviveRow($hero_datarow, $name, $wood, $clay, $iron, $crop, $training_time, $id);
|
* poate muta oriunde. Daca murea intr-un sat care nu avea cercetata
|
||||||
}
|
* acea unitate, butonul de inviere pur si simplu nu aparea - eroul
|
||||||
}
|
* ramanea mort pentru totdeauna, desi satul avea Conacul.
|
||||||
|
*
|
||||||
|
* Cercetarea conteaza la ANTRENAREA unui erou nou, nu la invierea unuia
|
||||||
|
* existent: acela a fost deja platit si antrenat. Singura conditie e
|
||||||
|
* Conacul din satul unde se afla acum.
|
||||||
|
*/
|
||||||
|
echo $renderReviveRow($hero_datarow, $name, $wood, $clay, $iron, $crop, $training_time, $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['revive']) && $_GET['revive'] == 1 && isset($_GET['hid']) && $_GET['hid'] == $hero_datarow['heroid'] && $hero_datarow['inrevive'] == 0 && $hero_datarow['intraining'] == 0 && $hero_datarow['dead'] == 1) {
|
if (isset($_GET['revive']) && $_GET['revive'] == 1 && isset($_GET['hid']) && $_GET['hid'] == $hero_datarow['heroid'] && $hero_datarow['inrevive'] == 0 && $hero_datarow['intraining'] == 0 && $hero_datarow['dead'] == 1) {
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ AccessLogger::logRequest();
|
|||||||
|
|
||||||
<td><?php
|
<td><?php
|
||||||
|
|
||||||
$return = mysqli_query($link, "SELECT Count(*) as Total FROM " . TB_PREFIX . "users WHERE tribe IN(1, 2, 3)");
|
$return = mysqli_query($link, "SELECT Count(*) as Total FROM " . TB_PREFIX . "users WHERE tribe IN(1, 2, 3, 6, 7, 8, 9)");
|
||||||
echo ($users = !empty($return) ? mysqli_fetch_assoc($return)['Total'] : 0);
|
echo ($users = !empty($return) ? mysqli_fetch_assoc($return)['Total'] : 0);
|
||||||
?></td>
|
?></td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -146,7 +146,7 @@ AccessLogger::logRequest();
|
|||||||
|
|
||||||
<td><?php
|
<td><?php
|
||||||
|
|
||||||
$return = mysqli_query($link,"SELECT Count(*) as Total FROM " . TB_PREFIX . "users WHERE timestamp > ".(time() - (3600*24))." AND tribe IN(1, 2, 3)");
|
$return = mysqli_query($link,"SELECT Count(*) as Total FROM " . TB_PREFIX . "users WHERE timestamp > ".(time() - (3600*24))." AND tribe IN(1, 2, 3, 6, 7, 8, 9)");
|
||||||
echo !empty($return) ? mysqli_fetch_assoc($return)['Total'] : 0;
|
echo !empty($return) ? mysqli_fetch_assoc($return)['Total'] : 0;
|
||||||
|
|
||||||
?></td>
|
?></td>
|
||||||
@@ -161,7 +161,7 @@ AccessLogger::logRequest();
|
|||||||
|
|
||||||
<td><?php
|
<td><?php
|
||||||
|
|
||||||
$return = mysqli_query($link,"SELECT Count(*) as Total FROM " . TB_PREFIX . "users WHERE timestamp > ".(time() - (60*10))." AND tribe IN(1, 2, 3)");
|
$return = mysqli_query($link,"SELECT Count(*) as Total FROM " . TB_PREFIX . "users WHERE timestamp > ".(time() - (60*10))." AND tribe IN(1, 2, 3, 6, 7, 8, 9)");
|
||||||
echo ($online = !empty($return) ? mysqli_fetch_assoc($return)['Total'] : 0);
|
echo ($online = !empty($return) ? mysqli_fetch_assoc($return)['Total'] : 0);
|
||||||
|
|
||||||
?></td>
|
?></td>
|
||||||
|
|||||||
Reference in New Issue
Block a user