diff --git a/GameEngine/Automation/AutomationAccountMaintenance.php b/GameEngine/Automation/AutomationAccountMaintenance.php
index 324483b3..341cd8f6 100644
--- a/GameEngine/Automation/AutomationAccountMaintenance.php
+++ b/GameEngine/Automation/AutomationAccountMaintenance.php
@@ -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);
}
}
diff --git a/GameEngine/Battle.php b/GameEngine/Battle.php
index e72b87b0..ca7a24e4 100644
--- a/GameEngine/Battle.php
+++ b/GameEngine/Battle.php
@@ -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;
}
diff --git a/GameEngine/Database/DatabaseStatisticsQueries.php b/GameEngine/Database/DatabaseStatisticsQueries.php
index f7ae31dc..429e8a2f 100644
--- a/GameEngine/Database/DatabaseStatisticsQueries.php
+++ b/GameEngine/Database/DatabaseStatisticsQueries.php
@@ -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);
}
diff --git a/GameEngine/Ranking.php b/GameEngine/Ranking.php
index fdad148f..8a005926 100755
--- a/GameEngine/Ranking.php
+++ b/GameEngine/Ranking.php
@@ -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);
}
diff --git a/winner.php b/winner.php
index 09879f6a..8b395129 100644
--- a/winner.php
+++ b/winner.php
@@ -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;
}
?>
@@ -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 on 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
- Together with the alliance "$winningalliancetag"; ?>", "$username"; ?>"
- 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 $username"; ?>
+ Together with the alliance "$winningalliancetag"; ?>", "$wwWinnerName"; ?>"
+ 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 $wwWinnerName"; ?>
who recieves the title "Winner of this era"!