Fix some bugs

This commit is contained in:
novgorodschi catalin
2026-08-09 19:37:51 +03:00
parent 4f93cb52a2
commit 770fa9fd6b
3 changed files with 46 additions and 28 deletions
-23
View File
@@ -695,24 +695,6 @@ class Battle {
/****************************************************************** /******************************************************************
* HERO DAMAGE (ATTACKER) * 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'])) { if (!empty($units['Att_unit']['hero']) && !empty($atkhero['heroid'])) {
/** /**
@@ -752,11 +734,6 @@ class Battle {
$armyWipedOut $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) { if ($dead === 1) {
$result['casualties_attacker'][11] = 1; $result['casualties_attacker'][11] = 1;
} }
+33 -4
View File
@@ -180,11 +180,24 @@ class Building {
$wwBuildingProgress = $this->db->getBuildingByType($wid, 99); $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) { if ($queuedLevel > $wwHighestLevelFound) {
$wwHighestLevelFound = $queuedLevel; $wwHighestLevelFound = $queuedLevel;
}
} }
} }
@@ -212,6 +225,9 @@ class Building {
$gid = tipul cladirii (bid), $fieldId = slotul (f1..f40, f99) $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) { public function canProcess($gid, $fieldId) {
// WW restriction early exit // WW restriction early exit
@@ -234,6 +250,19 @@ class Building {
($fieldId >= 19 && $gid > 4) ($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 // Validare building existent
$isValidFieldType = $isValidFieldType =
($currentFieldType == $gid || $currentFieldType == 0); ($currentFieldType == $gid || $currentFieldType == 0);
+13 -1
View File
@@ -148,7 +148,19 @@ $completed = isset($_GET['c']);
$orig = floor($resData[$i][1]); $orig = floor($resData[$i][1]);
?> ?>
<td class="sel"> <td class="sel">
<input class="text" onkeyup="calculateRest();" name="m2[]" size="5" maxlength="7" value="<?php echo $val;?>" /> <input class="text" onkeyup="calculateRest();" name="m2[]" size="5" maxlength="<?php
/**
* BUG REPARAT: maxlength era fix 7, deci nu se putea
* scrie o suma de 8 cifre sau mai mult. Pe serverele
* rapide, depozitele trec usor de 10.000.000, asa ca
* schimbul devenea imposibil peste acel prag.
*
* Serverul limiteaza oricum la capacitatea depozitului
* (vezi Market::tradeResource), deci lungimea aici doar
* trebuie sa fie suficienta.
*/
echo max(7, strlen((string) (int) max($maxstore, $maxcrop)));
?>" value="<?php echo $val;?>" />
<input type="hidden" name="m1[]" value="<?php echo $orig;?>" /> <input type="hidden" name="m1[]" value="<?php echo $orig;?>" />
</td> </td>
<?php endfor;?> <?php endfor;?>