mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-09-11 04:57:13 +00:00
c55642e3c2
Battle Resolution Fix Report The reported issue affected attacks involving more than 2,000 troops. The supplied error log identifies an invalid defender tribe value as the immediate cause of the crash, but does not establish why it occurred with that troop count. The invalid tribe produced unit names from u-9 to u0, causing undefined array key warnings followed by an invalid SQL query in modifyUnit(). The updated AutomationBattleResolution.php includes: Tribe validation before combat: Invalid attacker, defender, or reinforcement tribe data leaves the attack pending and logs the issue before evasion or combat changes occur. Earlier deleted-village handling: The existing troop return logic runs before resolving the deleted village’s owner, tribe, walls, or units. Defensive casualty checks: Invalid tribes cannot generate negative unit column names. Missing defender unit rows return a zero-loss structure without submitting an empty update. Reinforcement validation: Invalid player tribe data is no longer automatically treated as Nature. Only reinforcement rows explicitly originating from 0 use tribe 4. Consistent hero reporting: Reinforcement hero losses use the validated tribe. Code comments: Changes are documented in the file. Validation: The complete file passed a PHP 8.3 grammar check using a parser. All 33 original methods were retained; three methods were modified and three validation helpers were added.