Commit Graph

3160 Commits

Author SHA1 Message Date
Ferywir 08bb464540 feat(preferences): apply "Large map" preference (extra window) [#198]
The `map` user preference ("Show the large map in an extra window") was
saved to users.map but never applied in-game. When enabled, the large-map
button on the map now opens karte2.php in a separate browser window
instead of the in-page iframe overlay (default behaviour kept when the
preference is off).

Also drop the "(not coded yet)" marker from the Large map section of the
preferences page and wire its title to the existing LARGE_MAP constant.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-11 18:41:04 +03:00
Ferywir 524b9e7edd fix(i18n): localize statistics page and troops Hero label [#197]
On a fresh install several strings were still hardcoded in English
(reported on the live server, RO locale):

- statistiken.php: the page <title>, the <h1> and the tab bar
  (Player / Alliances / Villages / Heroes / General) were literal English.
- Templates/Ranking/ranksearch.tpl: the "back | forward" pagination links.
- Templates/troops.tpl: the "Hero" troop-row label.

Wire them to language constants. Reuse existing ones
(STATISTICS, PLAYER, PLAYERS, VILLAGES, BACK, FORWARD, U0) and add three
new constants (ALLIANCES, HEROES, GENERAL) to en/fr/ro. WW is kept as-is
(universal acronym).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-11 18:37:22 +03:00
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
TravianZ Patcher eb64bba1e7 fix(quest): grant no-tasks shipment reward atomically [#129]
The "no tasks" quest mode delivers a Plus + gold shipment on claim
(case '91', and the final case '97'). The reward was granted with a
non-atomic read-modify-write:

    $gold = getUserField('gold'); $gold += 15; updateUserField('gold', $gold);

and the quest pointer / timer were advanced unconditionally. Under the
many concurrent ajax requests the game fires, a request that read gold/
plus before the claim and wrote the user row back after it would clobber
the freshly granted reward. The quest_time write (a literal value) still
survived, so the UI advanced to the next shipment countdown while the
player received neither Plus nor gold -- exactly the sporadic symptom in
the report.

Fix: gate the grant on an atomic conditional advance
(UPDATE ... SET quest = 91 WHERE quest = 90) and apply the reward with
in-place SQL increments (gold = gold + 15, plus = IF(plus > now, ...)),
matching the idiom already used in Templates/Plus/*.tpl. This makes the
claim idempotent (duplicate/concurrent requests grant nothing extra) and
immune to the lost-update race. Also fixes a latent case where an expired
Plus timestamp was extended in the past instead of reset to now.

Applied to both quest_core.tpl and quest_core25.tpl.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 18:32:01 +03:00
TravianZ Patcher c91ae5e486 feat(l10n): translate manual new-features pages (FR/RO)
Localize the 17 "new features" manual pages (Templates/Manual/1111-1126.tpl
and the 1331.tpl index, typ=11/13) so they render in the player's language
instead of hardcoded English.

- Replace hardcoded page titles, descriptions and nav tooltips with constants.
- The 1331 index reuses the per-page title constants and gains
  MANUAL_NF_ENABLED / MANUAL_NF_DISABLED for the on/off status labels.
- Add 33 constants each to GameEngine/Lang/{en,fr,ro}.php
  (2 status labels + 15 page titles + 16 descriptions).
- en.php uses tz_def() as the English fallback; fr/ro use define().
- Reuse existing constants where they already exist: VACATION_MODE (page 19),
  NEW_FEATURES, FORWARD, BACK, OVERVIEW.

it/zh fall back to English. RO strings pending native review.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 15:45:47 +03:00
Catalin Novgorodschi f2d26909f7 Merge pull request #194 from Ferywir/feat/manual-l10n-units 2026-06-10 15:27:30 +03:00
TravianZ Patcher 48dde68baa feat(l10n): translate manual unit pages (FR/RO)
Localize the 51 in-game manual unit detail pages (Templates/Manual/1*.tpl,
typ=1) so they render in the player's language instead of English, continuing
the manual l10n started in the building pages PR.

What changed:
- 51 unit pages (Romans/Teutons/Gauls/Nature/Natars) now use translation
  constants for every hardcoded string: tribe tags -> TRIBE1..5, the stat
  labels (attack value, defence vs infantry/cavalry, Velocity, fields/hour,
  Can carry, Duration of training), the unit descriptions, the NPC reference
  notes and the "forward" nav.
- 48 new constants added to en/fr/ro:
  * 7 shared stat labels (MANUAL_ATTACK_VALUE, MANUAL_DEF_INFANTRY,
    MANUAL_DEF_CAVALRY, MANUAL_VELOCITY, MANUAL_FIELDS_HOUR, MANUAL_CAN_CARRY,
    MANUAL_TRAINING_DURATION)
  * 2 NPC reference notes (MANUAL_NPC_NATARS, MANUAL_NPC_NATURE)
  * 1 templated Nature-animal blurb (MANUAL_UDESC_ANIMAL_EXP, used via
    printf with the animal name + xp value, so the 10 animal pages share it)
  * 38 unit descriptions (MANUAL_UDESC_*). Identical descriptions are shared:
    settlers (110/120/130) and rams (117/127) reuse one constant each.
- Reuses constants already present upstream and in the building pages branch:
  TRIBE1..5, LEVEL, FORWARD, CROP_CONSUMPTION, PREREQUISITES, UPKEEP, DURATION,
  RESOURCES, U1..U50.

English render is unchanged: the English constant values are the existing page
text extracted verbatim (whitespace-collapsed). it/zh are intentionally left to
fall back to English via the en.php fallback wired up earlier.

Scope note: this builds on the manual building-pages l10n branch (reuses
CROP_CONSUMPTION). The 17 "new features" pages (typ=11/13) are out of scope and
will be a follow-up PR. RO strings are functional but would benefit from a
native review.
2026-06-10 13:48:02 +02:00
Ferywir 71d4385fd3 Refactor(sendunitsComplete): extract applyCatapults() [#155] (#193) 2026-06-10 02:17:19 +03:00
Ferywir 66a07c6819 feat(l10n): translate manual building pages (FR/RO) (#192) 2026-06-09 19:00:08 +03:00
Ferywir e498563555 fix: blank in-game help + untranslated profile after l10n (#189) (#191) 2026-06-09 17:48:16 +03:00
Ferywir dad574be1a feat: reports for settling - new village founded & valley occupied (#178) (#190) 2026-06-09 16:47:29 +03:00
Ferywir 20804d9182 feat: IP ban support (#185) (#188) 2026-06-09 15:15:27 +03:00
Ferywir d30bef0a40 security: harden signup username validation + fix reflected XSS (#184) (#187) 2026-06-09 14:57:56 +03:00
Catalin Novgorodschi fabe77e3b8 Update delAli.php fiz 2026-06-09 11:06:32 +03:00
Ferywir 5d366284e6 l10n: full interface translation (FR/RO/IT/ZH) + EN fallback hardening (#186) 2026-06-09 10:28:59 +03:00
Catalin Novgorodschi 695a4352e8 Fix delAli.php blank page
Fix del ali blank page
2026-06-09 08:07:23 +03:00
Catalin Novgorodschi 00de16b2ec Code backend for delete user
Code backend for delete user
2026-06-09 08:05:40 +03:00
Catalin Novgorodschi 0e425f512f Fix deletion user
Fix deletion user code backend
2026-06-09 08:04:17 +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
novgorodschi catalin e6b010e73a Fix #179
Fix #179
2026-06-05 14:00:58 +03:00
novgorodschi catalin 524a352946 Fix forgot for editBuildings name
Fix forgot for editBuildings name
2026-06-05 13:10:59 +03:00
novgorodschi catalin 0d046e0333 fix admin colour
fix admin colour
2026-06-05 12:54:48 +03:00
novgorodschi catalin eeb1bea701 Fix admin panel colour log
Fix admin panel colour log
2026-06-05 12:51:34 +03:00
novgorodschi catalin e69d8457d8 Admin panel design changed
Admin panel design changed
2026-06-05 12:30:13 +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
Ferywir 95df9b9018 Fix HTTP 500 when queuing a 2nd Smithy/Armoury upgrade of the same unit (#173) 2026-06-04 19:51:37 +03:00
novgorodschi catalin 6e1899a21e Fix alliance capacity
Fix alliance capacity
2026-06-04 15:14:35 +03:00
novgorodschi catalin 2b6277af06 Another correction for language
Another correction for language
2026-06-04 14:14:17 +03:00
novgorodschi catalin e2dfefa0b7 Close tr
Close tr
2026-06-04 13:56:29 +03:00
novgorodschi catalin 4eecf575a1 Fix some lang problems
Fix some lang problems & added in admin panel
2026-06-04 13:54:15 +03:00
novgorodschi catalin 33b7261b4b Change some file
Change some file
2026-06-04 13:39:59 +03:00
novgorodschi catalin efbb2bc89a Fix lang server set
Fix lang server set
2026-06-04 13:19:10 +03:00
Catalin Novgorodschi 28ddc72c01 Merge pull request #175 from Ferywir/feat/per-user-language
Add per-user language selection (closes #166)
2026-06-04 13:15:24 +03:00
novgorodschi catalin 1a4014218c Fix something broken
Fix something broken
2026-06-04 12:35:53 +03:00
novgorodschi catalin 64285e3c7b Merge branch 'master' of https://github.com/Shadowss/TravianZ 2026-06-04 10:18:16 +03:00
novgorodschi catalin 208f4bc31c Update menu.tpl 2026-06-04 10:18:09 +03:00
Catalin Novgorodschi 9f5ff60840 Merge pull request #172 from Ferywir/fix/admin-system-message-404
Add missing handler for admin "Create System Message"
2026-06-04 10:10:36 +03:00
TravianZ Patcher 421915f774 Add per-user language selection (issue #166)
The profile already had a language selector (Templates/Profile/preference.tpl)
that saved the choice into users.lang and $_SESSION['lang'], but the saved
preference was never used to actually load the language: every page loads
include("Lang/".LANG.".php") with the server-wide LANG constant, so changing
the language in the profile had no visible effect.

This wires it up:

- Introduce SERVER_LANG (the server default) and make LANG the EFFECTIVE
  display language, resolved from the player's saved preference
  ($_SESSION['lang']) with a fallback to SERVER_LANG
  (install/data/constant_format.tpl).
  SECURITY: the value is sanitized to [a-z_] and the target Lang/<x>.php
  file must exist, otherwise we fall back to the server default. This
  prevents Local File Inclusion via include("Lang/".LANG.".php").

- Seed $_SESSION['lang'] from users.lang on login (GameEngine/Session.php,
  PopulateVar), so the chosen language applies right after logging in.

- Keep the SERVER default intact when an admin saves settings: the admin
  config regenerators and the "Server Settings"/config displays now use
  SERVER_LANG (the server default) instead of the per-user LANG, so an
  admin browsing in their own language can't accidentally overwrite the
  server default (6 Admin/Mods/edit*.php + editServerSet.tpl + config.tpl).

Note: existing installs must also add SERVER_LANG + the LANG resolution to
their generated GameEngine/config.php (and the Admin/Mods/constant_format.tpl
copy) since config is generated at install time.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 09:07:57 +02:00
novgorodschi catalin 11ce6e6052 Added Romanian Language
Added Romanian Language
2026-06-04 09:39:44 +03:00
TravianZ Patcher 903c4a3285 Add missing handler for admin "Create System Message"
The admin panel had a "Create System Message" page (admin.php?p=sysmessage
-> Admin/Templates/sysmessage.tpl) whose form posts to
GameEngine/Admin/Mods/sysmessage.php, but that backend file never existed,
so submitting returned a 404 (Not Found).

Add the handler implementing the prepare -> confirm -> execute flow used by
the template. On execute it displays a global system message to all players
using the existing mechanism (writes Templates/text.tpl from
text_format.tpl and sets users.ok = 1), same as the legacy sysmsg.php.
%TEKST% is escaped for the PHP double-quoted string context to avoid
breakage/injection.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 07:34:57 +02:00
Catalin Novgorodschi 950902f8e1 Merge pull request #171 from Ferywir/l10n/french-and-swiss-timezone
L10n/french and swiss timezone
2026-06-04 07:37:14 +03:00
Catalin Novgorodschi 5e6bb4f1ed Merge pull request #170 from Ferywir/fix/issue-169-install-and-admin-bugs
Fix install + admin bugs reported in issue #169
2026-06-04 07:35:51 +03:00
TravianZ Patcher 2f2f0f5a47 Add Swiss timezone (Europe/Zurich) to timezone selectors
The timezone lists are hardcoded. Add "Europe (Switzerland)" =
Europe/Zurich to:
- Admin/Templates/editServerSet.tpl (admin: edit server settings)
- install/templates/config.tpl (install wizard, index 14)
- install/index.php (install wizard tz index->name mapping, case 14)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 11:28:09 +02:00
TravianZ Patcher 46d63e737c Add French (fr) to the language selectors
The language dropdowns are hardcoded (they don't scan GameEngine/Lang/),
so the existing fr.php never appeared. Add a French option to:
- install/templates/config.tpl (install wizard)
- Admin/Templates/editServerSet.tpl (admin: edit server settings)
- Admin/Templates/config.tpl (admin: server config display)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 11:28:09 +02:00
TravianZ Patcher df003184c8 Add French (fr) translation by Ferywir
Replace GameEngine/Lang/fr.php with a complete, reviewed French
translation:
- Full coverage: all 1439 language keys present (matches en.php), none
  missing or extra.
- Valid PHP: all French apostrophes properly escaped, no unterminated
  strings.
- Months localized, quest tutorial numbering kept consistent with en.php.
- Fixed gender agreement on EMAIL_TAKEN ("Cet e-mail ... utilisé").

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 11:28:09 +02:00