Some final fix

This commit is contained in:
novgorodschi catalin
2026-08-09 16:14:01 +03:00
parent 935d8939cd
commit 4f93cb52a2
5 changed files with 74 additions and 7 deletions
@@ -87,7 +87,10 @@ trait AutomationAccountMaintenance {
if(AUTO_DEL_INACTIVE) {
$time = time() - UN_ACT_TIME;
$q = "INSERT INTO ".TB_PREFIX."deleting SELECT id, UNIX_TIMESTAMP() FROM ".TB_PREFIX."users WHERE timestamp < $time AND tribe IN(1, 2, 3)";
// BUG REPARAT: lista era 1,2,3 - conturile inactive ale triburilor noi
// (huni, egipteni, spartani, vikingi) nu se stergeau niciodata si
// ramaneau pe harta la nesfarsit.
$q = "INSERT INTO ".TB_PREFIX."deleting SELECT id, UNIX_TIMESTAMP() FROM ".TB_PREFIX."users WHERE timestamp < $time AND tribe IN(1, 2, 3, 6, 7, 8, 9)";
$database->query($q);
}
}
+23
View File
@@ -695,6 +695,24 @@ class Battle {
/******************************************************************
* HERO DAMAGE (ATTACKER)
******************************************************************/
/**
* URMARIRE TEMPORARA - se poate sterge dupa ce gasim cauza.
*
* Scrie in error_log de ce (nu) moare eroul. Doar cand atacatorul chiar a
* trimis un erou, ca sa nu umple logul.
*/
if (!empty($Attacker['uhero'])) {
error_log(sprintf(
'[TravianZ][EROU] uid=%s heroid=%s health=%s | attUnits[hero]=%s | intra_in_bloc=%s | lossRatio=%s',
isset($AttackerID) ? $AttackerID : '?',
isset($atkhero['heroid']) ? $atkhero['heroid'] : 'NULL',
isset($atkhero['health']) ? $atkhero['health'] : 'NULL',
isset($units['Att_unit']['hero']) ? $units['Att_unit']['hero'] : 'NESETAT',
(!empty($units['Att_unit']['hero']) && !empty($atkhero['heroid'])) ? 'DA' : 'NU',
isset($result[1]) ? $result[1] : '?'
));
}
if (!empty($units['Att_unit']['hero']) && !empty($atkhero['heroid'])) {
/**
@@ -734,6 +752,11 @@ class Battle {
$armyWipedOut
);
error_log(sprintf(
'[TravianZ][EROU] trimise=%d pierdute=%d armata_nimicita=%s | applyHeroBattleDamage=%s',
$sentTotal, $deadTotal, $armyWipedOut ? 'DA' : 'nu', var_export($dead, true)
));
if ($dead === 1) {
$result['casualties_attacker'][11] = 1;
}
@@ -85,7 +85,15 @@ trait DatabaseStatisticsQueries {
// no need to cache this method
function getVRanking() {
$q = "SELECT v.wref,v.name,v.owner,v.pop FROM " . TB_PREFIX . "vdata AS v," . TB_PREFIX . "users AS u WHERE v.owner=u.id AND u.tribe IN(1,2,3".(SHOW_NATARS ? ',5' : '').") AND v.wref != '' AND u.access<" . (INCLUDE_ADMIN ? "10" : "8");
/**
* BUG REPARAT: lista de triburi era 1,2,3 (+5 pentru Natari), adica
* dinainte de adaugarea triburilor noi. Satele hunilor, egiptenilor,
* spartanilor si vikingilor (6-9) NU apareau deloc in clasament -
* jucatorii acelor triburi nu-si vedeau niciodata satele acolo.
*
* Aceeasi lista completa e folosita deja in winner.php.
*/
$q = "SELECT v.wref,v.name,v.owner,v.pop FROM " . TB_PREFIX . "vdata AS v," . TB_PREFIX . "users AS u WHERE v.owner=u.id AND u.tribe IN(1,2,3,6,7,8,9".(SHOW_NATARS ? ',5' : '').") AND v.wref != '' AND u.access<" . (INCLUDE_ADMIN ? "10" : "8");
$result = mysqli_query($this->dblink,$q);
return $this->mysqli_fetch_all($result);
}
+11 -1
View File
@@ -430,7 +430,17 @@
$value['user'] = $GLOBALS['db']->getUserField($value['owner'], "username", 0);
$holder[] = $value;
}
$holder = $multisort->sorte($holder, "x", true, 2, "y", true, 2, "pop", false, 2);
/**
* Clasamentul satelor se face dupa POPULATIE, nu dupa coordonate.
*
* Inainte se sorta "x" crescator, apoi "y", si abia la egalitate dupa
* populatie - adica practic dupa pozitia pe harta. Toate celelalte
* clasamente (jucatori, aliante, atac, aparare) sorteaza dupa valoare.
*
* Coordonatele raman ca departajare, ca ordinea sa fie stabila cand
* doua sate au aceeasi populatie.
*/
$holder = $multisort->sorte($holder, "pop", false, 2, "x", true, 2, "y", true, 2);
$this->finalizeRankArray($holder);
}
+27 -4
View File
@@ -160,16 +160,39 @@ if ($winner) {
$row = mysqli_fetch_assoc($result);
if ($row) {
/**
* BUG REPARAT: castigatorul se pastra in $username si $owner, dar mai
* jos se include Templates/menu.tpl, care face:
* $username = $session->username;
* Adica numele castigatorului era inlocuit cu al jucatorului CONECTAT.
* De aceea fiecare vedea propriul nume ca "Winner of this era".
*
* Folosim nume proprii, pe care nicio alta bucata de sablon nu le
* atinge. Alianta se afisa corect fiindca $winningalliancetag nu se
* ciocnea cu nimic.
*/
$vref = $row['vref'];
$winningvillagename = $row['village_name'];
$owner = $row['owner_id'];
$wwWinnerUid = (int) $row['owner_id'];
$wwWinnerName = $row['username'];
$owner = $wwWinnerUid;
$username = $row['username'];
$allianceid = $row['alliance_id'];
$winningalliance = $row['alliance_name'];
$winningalliancetag = $row['alliance_tag'];
$finishconstruction = $row['ww_lastupdate'];
} else {
$vref = 0;
// fara castigator: golim tot, ca sa nu se afiseze valori ramase din alt context
$vref = 0;
$winningvillagename = '';
$wwWinnerUid = 0;
$wwWinnerName = '';
$owner = 0;
$username = '';
$allianceid = 0;
$winningalliance = '';
$winningalliancetag = '';
$finishconstruction = 0;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -224,8 +247,8 @@ if ($winner) {
laboured on throught the wintery eve, every wary of the countless armies marching to destroy their work, knowing that they raced against time and the greatest
threat that had ever faced the free people. Their tireless struggles were rewarded at <b><?php echo date('H:i:s', $finishconstruction); ?></b> on <b><?php echo date('d. M. Y', $finishconstruction); ?></b> after a
nameless worker laid the dinal stone in what will forever known as the greatest and most magnificent creation in all of history since the fall of the Natars<br />
Together with the alliance "<?php echo "<a href=\"allianz.php?aid=$allianceid\">$winningalliancetag</a>"; ?>", "<?php echo "<a href=\"spieler.php?uid=$owner\">$username</a>"; ?>"
was the first to finish the Wonder of the World, using millions of resources whilst also protecting it with hundereds of thousands of brave defenders. It is therefore <b><?php echo "<a href=\"spieler.php?uid=$owner\">$username</a>"; ?></b>
Together with the alliance "<?php echo "<a href=\"allianz.php?aid=$allianceid\">$winningalliancetag</a>"; ?>", "<?php echo "<a href=\"spieler.php?uid=$wwWinnerUid\">$wwWinnerName</a>"; ?>"
was the first to finish the Wonder of the World, using millions of resources whilst also protecting it with hundereds of thousands of brave defenders. It is therefore <b><?php echo "<a href=\"spieler.php?uid=$wwWinnerUid\">$wwWinnerName</a>"; ?></b>
who recieves the title "Winner of this era"!<br />
<center><h3 style="color:#f39c12;">👑 Top Players</h3></center>
"<a href="spieler.php?uid=<?php echo $datas[0]['userid']; ?>" title="Total Villages: <?php echo $datas[0]['totalvillages']; echo "\n";?>Total Population: <?php echo $datas[0]['totalpop']; ?>"><?php echo $datas[0]['username']; ?></a>" was the ruler over the largest personal empire, followed closely by "<a href="spieler.php?uid=<?php echo $datas[1]['userid']; ?>" title="Total Villages: <?php echo $datas[1]['totalvillages']; echo "\n";?>Total Population: <?php echo $datas[1]['totalpop']; ?>"><?php echo $datas[1]['username']; ?></a>" and "<a href="spieler.php?uid=<?php echo $datas[2]['userid']; ?>" title="Total Villages: <?php echo $datas[2]['totalvillages']; echo "\n";?>Total Population: <?php echo $datas[2]['totalpop']; ?>"><?php echo $datas[2]['username']; ?></a>".<br />