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);
}