Add hero header & Auction image tribe

This commit is contained in:
novgorodschi catalin
2026-08-10 16:20:36 +03:00
parent 1ecbba0e26
commit 853d4dcecb
16 changed files with 1066 additions and 5 deletions
+89
View File
@@ -515,6 +515,95 @@ class HeroItems
return self::$awayCache[$uid] = $reason;
}
/** @var array cache per request: uid => detaliile deplasarii */
private static $locationCache = array();
/**
* Acelasi motiv ca heroAwayReason(), plus DESTINATIA si TIMPUL RAMAS.
*
* Intoarce mereu un array:
* 'reason' => '' | 'nohero' | 'adventure' | 'attack' | 'reinforcement'
* 'target' => wref-ul catre care se indreapta (0 daca nu se stie)
* 'endtime' => timestamp-ul sosirii (0 = nu e in miscare, ex. intarire
* deja ajunsa, care sta pe loc pana e retrasa)
* 'sort' => sort_type-ul miscarii (3 = dus, 4 = intoarcere), 0 daca nu e cazul
*
* Costul: query-ul de detalii se face DOAR daca eroul chiar e plecat, deci
* cazul obisnuit (erou acasa) ramane exact cat era inainte - un query.
*/
public function heroLocation($uid)
{
$uid = (int) $uid;
if (isset(self::$locationCache[$uid])) {
return self::$locationCache[$uid];
}
$info = array('reason' => $this->heroAwayReason($uid), 'target' => 0, 'endtime' => 0, 'sort' => 0);
if ($info['reason'] === '' || $info['reason'] === 'nohero') {
return self::$locationCache[$uid] = $info;
}
$p = TB_PREFIX;
$q = '';
if ($info['reason'] === 'adventure') {
// LEFT JOIN, nu INNER: daca randul de miscare a fost deja procesat,
// vrem macar destinatia, nu sa pierdem tot randul.
$q = "SELECT a.wref AS target, IFNULL(m.endtime, 0) AS endtime, IFNULL(m.sort_type, 0) AS sort_type
FROM {$p}hero_adventure a
LEFT JOIN {$p}movement m ON m.moveid = a.moveid
WHERE a.uid = ? AND a.status = 1
LIMIT 1";
} elseif ($info['reason'] === 'attack') {
// La dus (sort_type 3) satul jucatorului e `from`, la intoarcere
// (4) e `to`; IF() alege coloana corecta pentru verificarea
// proprietarului. Destinatia afisata e mereu `to`.
$q = "SELECT m.`to` AS target, m.endtime, m.sort_type
FROM {$p}movement m
INNER JOIN {$p}attacks a ON a.id = m.ref
INNER JOIN {$p}vdata v ON v.wref = IF(m.sort_type = 4, m.`to`, m.`from`)
WHERE v.owner = ? AND m.proc = 0 AND m.sort_type IN (3, 4) AND a.t11 > 0
ORDER BY m.endtime ASC
LIMIT 1";
} else {
// Intarirea a ajuns deja: nu exista miscare, deci nici timp ramas.
$q = "SELECT e.vref AS target, 0 AS endtime, 0 AS sort_type
FROM {$p}enforcement e
INNER JOIN {$p}vdata v ON v.wref = e.`from`
WHERE v.owner = ? AND e.hero > 0
LIMIT 1";
}
$stmt = $this->db->prepare($q);
if (!$stmt) {
// instalarile vechi pot sa nu aiba toate tabelele - motivul ramane
// valid, doar detaliile lipsesc
return self::$locationCache[$uid] = $info;
}
$stmt->bind_param('i', $uid);
$stmt->execute();
$stmt->bind_result($target, $endtime, $sortType);
if ($stmt->fetch()) {
$info['target'] = (int) $target;
$info['endtime'] = (int) $endtime;
$info['sort'] = (int) $sortType;
}
$stmt->close();
return self::$locationCache[$uid] = $info;
}
public function equipItem($uid, $rowId)
{
global $database;
+9
View File
@@ -4366,3 +4366,12 @@ tz_def('ALLYBONUS_MSG_OVERMAX', 'This is the final level: you can donate at most
//////////////////////////////////////////////////////////////////////////////////////////////////////
tz_def('ADM_PROTECTED_PLAYERS', 'Protected players');
tz_def('ADM_PROTECTED_PLAYERS_TIP', 'Comma-separated player names that cannot be attacked or raided by anyone. Reinforcements are still allowed. Leave empty to disable.');
//////////////////////////////////////////////////////////////////////////////////////////////////////
// COMPONENTA HERO DIN BARA DE SUS
//////////////////////////////////////////////////////////////////////////////////////////////////////
tz_def('HERO_HEADER_AT_HOME', 'Hero at home');
tz_def('HERO_HEADER_DEAD', 'Hero is dead');
tz_def('HERO_HEADER_TRAINING', 'Hero in training');
tz_def('HERO_HEADER_NOHERO', 'No hero yet');
tz_def('TZ_HEALTH', 'Health');
+9
View File
@@ -4309,3 +4309,12 @@ tz_def('ALLYBONUS_MSG_OVERMAX', 'Ceci est le dernier niveau : vous pouvez donner
//////////////////////////////////////////////////////////////////////////////////////////////////////
tz_def('ADM_PROTECTED_PLAYERS', 'Joueurs proteges');
tz_def('ADM_PROTECTED_PLAYERS_TIP', 'Noms de joueurs separes par des virgules qui ne peuvent etre ni attaques ni pilles. Les renforts restent autorises. Laisser vide pour desactiver.');
//////////////////////////////////////////////////////////////////////////////////////////////////////
// COMPONENTA HERO DIN BARA DE SUS
//////////////////////////////////////////////////////////////////////////////////////////////////////
tz_def('HERO_HEADER_AT_HOME', 'Le heros est chez lui');
tz_def('HERO_HEADER_DEAD', 'Le heros est mort');
tz_def('HERO_HEADER_TRAINING', 'Heros en formation');
tz_def('HERO_HEADER_NOHERO', 'Pas encore de heros');
tz_def('TZ_HEALTH', 'Sante');
+9
View File
@@ -4106,3 +4106,12 @@ tz_def('ALLYBONUS_MSG_OVERMAX', 'Acesta e ultimul nivel: poti dona cel mult %s r
//////////////////////////////////////////////////////////////////////////////////////////////////////
tz_def('ADM_PROTECTED_PLAYERS', 'Jucatori protejati');
tz_def('ADM_PROTECTED_PLAYERS_TIP', 'Nume de jucatori separate prin virgula, care nu pot fi atacati sau jefuiti de nimeni. Intaririle raman permise. Lasa gol ca sa dezactivezi.');
//////////////////////////////////////////////////////////////////////////////////////////////////////
// COMPONENTA HERO DIN BARA DE SUS
//////////////////////////////////////////////////////////////////////////////////////////////////////
tz_def('HERO_HEADER_AT_HOME', 'Eroul este acasa');
tz_def('HERO_HEADER_DEAD', 'Eroul este mort');
tz_def('HERO_HEADER_TRAINING', 'Eroul este in antrenament');
tz_def('HERO_HEADER_NOHERO', 'Inca nu ai erou');
tz_def('TZ_HEALTH', 'Sanatate');