Commit Graph

351 Commits

Author SHA1 Message Date
Ferywir 33da9fdad5 refactor(sendunitsComplete): extract handlePrisoners() and buildCombatReport() [#155]
Phase C of the sendunitsComplete() refactor (issue #155).

- handlePrisoners(): extracts the ~100-line block that releases troops
  trapped in the defender's traps during a conquest attack (type 3),
  sends them home with 25% casualties, repairs destroyed traps, and
  returns the HTML fragment for the battle-report trap line.

- buildCombatReport(): extracts the assembly of the $data2 (main report)
  and $data_fail (all-attacker-dead fallback) CSV strings, including the
  "village destroyed" annotation in $info_cat and the final appending of
  $info_trap / $info_troop / $info_hero.

Pure behaviour-preserving extractions — no logic change.
Validated by deterministic A/B harness (infantry, evasion, conquest).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 17:28:54 +03:00
Ferywir 71d4385fd3 Refactor(sendunitsComplete): extract applyCatapults() [#155] (#193) 2026-06-10 02:17:19 +03:00
Ferywir dad574be1a feat: reports for settling - new village founded & valley occupied (#178) (#190) 2026-06-09 16:47:29 +03:00
Ferywir a787929604 Refactor(sendunitsComplete): wire up buildScoutReport(), drop duplicate [#155] (#183)
The #182 merge resolution left buildScoutReport() defined but never called,
while the original inline scout-report block was kept at the call site — so
the method was dead code and the scout-report logic was duplicated.

This wires it up: the inline block in the `if (!empty($scout))` branch is
replaced by a single `$info_spy = $this->buildScoutReport(...)` call. The
method already exists and its body is identical to the removed inline block,
so behaviour is unchanged — this just removes the duplication and makes the
extraction actually take effect. Brace balance even (634/634).

Co-authored-by: TravianZ Patcher <patcher@localhost>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 06:45:51 +03:00
Ferywir 0b563849bf Fix fatal parse error in Automation.php (broken #180/#181 merge) [#155] (#182)
The merge of #180 (applyBounty) and #181 (buildScoutReport) — both of which
inserted a new private method just before sendunitsComplete() — dropped the
closing brace of buildScoutReport(). As a result applyBounty() was declared
INSIDE buildScoutReport(), producing:

  PHP Parse error: syntax error, unexpected token "private"
  in GameEngine/Automation.php

This crashes Automation.php entirely (HTTP 500), so the whole game automation
stops: troop movements never resolve, buildings never finish, etc.

Fix: restore the missing `}` closing buildScoutReport() before the applyBounty()
docblock. Brace balance is now even again (634/634). One-character structural
fix, no logic change.

Co-authored-by: TravianZ Patcher <patcher@localhost>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Catalin Novgorodschi <cata7007@gmail.com>
2026-06-07 19:23:56 +03:00
Catalin Novgorodschi fd19a6a875 Update Automation.php
Revert last commit
2026-06-07 18:13:46 +03:00
Ferywir 4beb386dfc Refactor(sendunitsComplete): extract buildScoutReport() [#155] (#181)
Phase B — pure behaviour-preserving extraction (issue #155).

buildScoutReport(): extracts the scout-report (info_spy) HTML assembly
(~25 lines) into a helper returning the info_spy string. Handles both
spy modes: resources (spy=1) and defence/buildings (spy=2). The block's
body is moved verbatim (multi-line strings with their exact embedded
whitespace preserved). The reassigned $walllevel/$residencelevel/
$palacelevel were local to this block and never read downstream. No
logic change.

Co-authored-by: TravianZ Patcher <patcher@localhost>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Catalin Novgorodschi <cata7007@gmail.com>
2026-06-07 16:48:55 +03:00
Ferywir 004f101c23 Refactor(sendunitsComplete): extract applyBounty() [#155] (#180) 2026-06-07 16:34:49 +03:00
Ferywir d55f6cad9e Refactor(sendunitsComplete): extract handleEvasion() and handleConquest() [#155] (#177) 2026-06-05 07:00:32 +03:00
Ferywir f89877210f Refactor/sendunitscomplete extract (#176) 2026-06-04 20:51:29 +03:00
novgorodschi catalin 05bfde9063 Remove some unused code and some fix
Remove some unused code and some fix
2026-05-21 13:12:21 +03:00
novgorodschi catalin 3f32e21333 Fix bug in General Stats
Fix bug in General Stats - now troops appear !
2026-05-20 07:47:02 +03:00
novgorodschi catalin 55e6dd60b5 Refactor + BugFix
1. Fix a bug in Admin Panel that you can edit by yourself your rank, now you cannot edit your rank anymore.

2. Now Alliance Leader can edit his own Position

3. Fix negative value on Demolition Building, now in database at lvl is appear new level not -1

4. Refactor Ajax map, now all is alligned (Ajax folder and Map folder)

5. Fix bug from Palace (when change capital now Automation recount population automaticaly on old capital and new capital)
2026-05-18 09:18:35 +03:00
Catalin Novgorodschi 3804498ad9 Incremental Refactor Automation & Database (cache)
Incremental Refactor Automation (starvation split in more methods) & Database (cache & checkAllianceEmbassiesStatus refactor), Fix a bug in Alliance.php (now you cannot kick alliance leader)
2026-05-14 15:05:32 +03:00
Catalin Novgorodschi a3cf00c0f9 Incremental Refactor Market/Message/Profile
Incremental Refactor Market/Message/Profile
2026-05-13 12:20:10 +03:00
Emerson Freitas a7bdac8392 fix: harden troop processing race conditions (#98) (#138) 2026-03-17 20:13:14 +02:00
levi a0ef06a35f chore: harden php8 compatibility, optimize installer/croppers, and refresh docs/admin ux 2026-03-14 16:50:27 -03:00
hdmaniak2 89e170abe8 Fix WW build task cancelled after Natar attack with 0 damage 2026-02-24 16:26:07 +01:00
Catalin Novgorodschi 260896570e Revert "vulnerability fixed and cleanup and refactor"
This reverts commit 2a44e76414.
2026-02-11 15:22:16 +02:00
Catalin Novgorodschi 2a44e76414 vulnerability fixed and cleanup and refactor 2026-02-11 15:11:43 +02:00
Catalin Novgorodschi 59c1114b1c Change some text on license TravianZ 2025-02-11 11:22:22 +02:00
Hubert Walczak f560ddf7be Fix for infinite refreshing 2023-07-09 12:03:15 +02:00
Shadow 4c68d8dd39 Update to version 8.3.5
Many Fixes
2022-02-18 13:56:17 +02:00
Shadow 4c116aefea update 2019-05-06 09:18:20 +03:00
Vladyslav e3c2a28d71 Minor bug fixes
WW villages cannot be destroyed. Thank @iopietro for your help.
2018-08-28 01:42:35 +03:00
iopietro f032523e1c Generale fixes
+Fixed a bug that didn't return reinforcements in counquered oasis, if
it was released by the owner, or from the admin panel
+Changed the catapults and rams formulas (still not completed at 100%),
thanks to Kirilloid!
+Changed the Natars' capital default coordinates
2018-07-28 15:07:52 +02:00
iopietro b9a442b423 General fixes
+Fixed a bug that would have killed all troops by starvation, if added
through the admin panel
2018-07-25 17:17:52 +02:00
iopietro 84b00790a6 General fixes
+Fixed a bug that showed "The village has been destroyed" two times, if
an artifact was conquered from Natars (or from a 0 popped village) and
there were catapults in the attack
2018-07-25 02:43:29 +02:00
iopietro 77136a9784 Artifacts update and optimizations
+Added the "Artifacts" section in the Admin Panel, which contains two
options: return a deleted artifact to the Natars and create new
Artifacts, assigned to a specified player
+Return to Natars coded, in the village section of the Admin Panel
+Moved a lot of functions and costants from Automation.php to the "new"
class Artifacts.php
+Optimized a lot the whole Natars creation process, decreased the number
of query of about 600
+Optimized a lot the function which deletes a player's account, it's now
executed almost instantly, even with players with a lot of villages
+Redesigned the map spawn system, using a more Travian-like village
distribution
+Fixed a bug that did show a broken village in the artifact chronology,
if that village was destroyed
+Reduced the amount of redundant code (about 230 lines) for
27_1.tpl/27_2.tpl and 27_3.tpl
+Fixed a bug that permitted to build the Great Granary and the Great
Warehouse in the whole account, with only a village effect artifact
+Fixed a bug in the Admin Panel map that didn't permit to show village
informations, if that village contained single quotes in its name
2018-07-24 03:04:25 +02:00
Vladyslav b13879e619 General fixes
+Changed the issuance of medals. Thanks @iopietro
2018-07-01 00:39:17 +03:00
Vladyslav 963471825a General fixes
+Redesigned set of buildings during the appearance of the WW village

NOTE: To use this change, you must recreate all the WW villages
2018-06-27 15:25:50 +03:00
iopietro c574a71b3a General fixes
+Fixed a bug that didn't delete artifacts when a player deleted his
account
+Added "(artifact)" if a village has an artifact in the village overview
+Added the artifact section in the multihunter panel (return to natars
doesn't work yet)

NOTE: To play this version of the game, you have to run this query first
(where "s1_" is the prefix of your server):

ALTER TABLE `s1_artefacts` ADD `del` TINYINT(1) NULL DEFAULT '0' AFTER
`lastupdate`;
ALTER TABLE `testtravian`.`s1_artefacts` ADD INDEX
`active-owner-conquered-del` (`active`, `owner`, `conquered`, `del`);
2018-06-21 14:43:47 +02:00
iopietro 8861a578e4 General fixes
+Fixed a bug that didn't update the starvation correctly, when
starvation data was updated (for example: troops in training, attacks
completed, etc.)
2018-06-17 01:48:40 +02:00
iopietro d96259afd8 General fixes
+You can no longer build WW if your and your alliance building plans
aren't active yet
+You can no longer remove the WW from the village if you remove it from
the building queue
+Spies from every tribe will now consume crop correctly, when returning
from a scouting attacks
+Spies from every tribe will now be displayed correctly, in the "Troops"
tab of dorf3.php, when returning from a scouting attack
+Building levels will now not be downgraded by 1 level, when conquering
a Natars' village
+Natars' villages with an artifact inside, will now be deleted if the
artifact is conquered (even if the pop isn't 0)
2018-06-09 03:03:01 +02:00
iopietro a8d6b9c357 General fixes
+Fixed a bug that didn't permit to change the name or the Tag of the
alliance individually
+Fixed a bug that didn't count the population growth sometimes
+Fixed a bug that didn't halve the population consumption in WW villages
2018-06-08 19:15:39 +02:00
iopietro b717c0cdf4 General fixes
+Fixed a bug that didn't permit to show to the defender "None of your
soldiers returned." under certain circumnstances
+Fixed a bug that showed a wrong report icon if the defender had 0
defences and all attacker's units were trapped/killed during the battle
+Fixed a bug that counted a wrong percentage bonus for the horse
drinking trough
2018-06-01 16:24:36 +02:00
iopietro b12f4d4497 General fixes
+Fixed a bug that didn't permit to see a defender hero in a spy report
+Fixed a bug that only permitted to revive the last hero on the hero
list
2018-05-31 15:23:48 +02:00
iopietro 11c3d44168 general fixes
+Fixed a bug that didn't permit to counquer an artifact in certain
circumstances with the new automation system
2018-05-25 17:45:05 +02:00
iopietro 8605996533 Fixed some Automation bug
+Fixed the (in)famous "doubling troops bug", this has been the oldest
bug I can remember, it lasted 7 years!!!
+Reworked the whole lock system, it's more maintanable and easy to read
now
+Removed some useless class fields, reworked some methods that depended
on them
2018-05-24 01:28:56 +02:00
iopietro fca22ac98b General fixes
+Fixed a bug that didn't permit to attack with catapults with the new
automation system
+Fixed a warning that could have been displayed in certain cases
2018-05-23 17:36:16 +02:00
iopietro f41666cabc New automation
+Separated Automation.php from the UI and users classes

NOTE: This is only a test, it'll not absolutely be as it is in this commit in the final version.
2018-05-22 23:37:28 +02:00
iopietro edeee02333 Some clean-up 2018-05-22 22:43:01 +02:00
iopietro f0b9f32826 General fixes
+Moved "isWinner()" method from Automation.php to Session.php, it's now
triggered when activating plus function or entering in
plus1.php/build.php
+General clean-up and better indentation
+The tournament square bonus is now displayed correctly
2018-05-22 00:33:09 +02:00
iopietro 628894f478 General fixes
+WWs aren't affected anymore by stronger building artifacts
+Walls damaging/destruction (wall bonus reduction) during a battle, is
now counted
+Added a button for normal acess users, for editing/sticking, etc. their
own topics (instead of directly display the topic "admin menu")
+Fixed some possible warnings
2018-05-21 16:45:54 +02:00
Vladyslav a956abee13 Change the date display
The date display was changed from 'm/d/Y' to 'd.m.Y'
2018-05-19 20:52:33 +03:00
iopietro 0322a0ae49 General fixes
+Fixed a bug that permitted to see troops movement with a 0 level rally
point
+Fixed a bug that permitted to send attacks, enforcements, etc. with a 0
level rally point
+Fixed a bug that counted the moral bonus for attacks against WW
villages
+Fixed a bug that didn't permit to finish all buildings/researches, etc.
without a plus account
+Recoded part of Natars timer for being more generic
+Natars/Artifacts spawn, WW villages spawn, WW building plans spawn are
now based on the start date of the server and not on the installation
date
+Better indentation of some code
2018-05-18 15:46:15 +02:00
iopietro 6909ba4e58 Fixed a medals bug
+First medals will now be given on the next Sunday (at 12 PM) from the
start of the server
2018-05-16 18:44:06 +02:00
iopietro 95cc6180a9 Fixed a catapult bug
+Fixed a bug that didn't recount building time for in waiting loop
buildings
+Fixed a bug that didn't remove a building from the waiting loop, if the
previous was destroyed by catapults
2018-05-15 20:20:38 +02:00
iopietro f92e4d3bb8 General fixes
+Increased the number of "Slight artifact of the fool" from 5 to 10
2018-05-13 22:55:38 +02:00
iopietro 26431b6cea General fixes
+Fixed a bug that didn't halved the catapults force when two buildings
were selected
2018-05-13 16:10:49 +02:00