diff --git a/GameEngine/Battle.php b/GameEngine/Battle.php index ca7a24e4..e72b87b0 100644 --- a/GameEngine/Battle.php +++ b/GameEngine/Battle.php @@ -695,24 +695,6 @@ 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'])) { /** @@ -752,11 +734,6 @@ 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/Building.php b/GameEngine/Building.php index c6caa1ec..390b6856 100755 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -180,11 +180,24 @@ class Building { $wwBuildingProgress = $this->db->getBuildingByType($wid, 99); - if (!empty($wwBuildingProgress[0]['level'])) { - $queuedLevel = (int) $wwBuildingProgress[0]['level']; + /** + * BUG REPARAT: se citea doar PRIMUL job din coada ([0]). + * + * Maestrul constructor poate pune mai multe nivele deodata. Daca Minunea + * era la 48 si se comandau nivelele 49, 50 si 51, verificarea vedea doar + * primul job si credea ca nivelul cel mai mare e 49 - sub pragul de 50, + * deci accepta cu un singur plan. Nivelul 51 se construia fara al doilea + * plan al aliantei. + * + * Acum luam nivelul MAXIM din toata coada. + */ + if (!empty($wwBuildingProgress)) { + foreach ($wwBuildingProgress as $wwJob) { + $queuedLevel = isset($wwJob['level']) ? (int) $wwJob['level'] : 0; - if ($queuedLevel > $wwHighestLevelFound) { - $wwHighestLevelFound = $queuedLevel; + if ($queuedLevel > $wwHighestLevelFound) { + $wwHighestLevelFound = $queuedLevel; + } } } @@ -212,6 +225,9 @@ class Building { $gid = tipul cladirii (bid), $fieldId = slotul (f1..f40, f99) *****************************************/ + /** Sloturi rezervate in satul Minunii (vezi si Templates/dorf2.tpl). */ + const NATAR_RESERVED_SLOTS = array(25, 26, 29, 30, 33); + public function canProcess($gid, $fieldId) { // WW restriction early exit @@ -234,6 +250,19 @@ class Building { ($fieldId >= 19 && $gid > 4) ); + /** + * BUG REPARAT: satul Minunii are sloturi rezervate, pe care dorf2.tpl le + * ascunde. Ascunderea e insa doar vizuala: mergand pe un astfel de slot in + * alt sat si comutand apoi pe satul Minunii, cererea trecea si se putea + * construi acolo. + * + * Aceeasi lista ca in Templates/dorf2.tpl, verificata acum si pe server. + */ + if ((int) $this->vil->natar === 1 + && in_array((int) $fieldId, self::NATAR_RESERVED_SLOTS, true)) { + $isValidSlot = false; + } + // Validare building existent $isValidFieldType = ($currentFieldType == $gid || $currentFieldType == 0); diff --git a/Templates/Build/17_3.tpl b/Templates/Build/17_3.tpl index 7511b973..8b796ca7 100644 --- a/Templates/Build/17_3.tpl +++ b/Templates/Build/17_3.tpl @@ -148,7 +148,19 @@ $completed = isset($_GET['c']); $orig = floor($resData[$i][1]); ?> - +