Commit Graph

26 Commits

Author SHA1 Message Date
Ferywir dc971770e1 fix(market): harden NPC resource distribution against NaN [#211]
On some servers the NPC ("merchant") distribution screen could lock on
"Rest: NaN", hiding the trade button and making the NPC unusable. The "Rest"
value never returned to 0, so the player could not complete the trade.

Two layers of hardening:

* Client (Templates/Build/17_3.tpl):
  - add a safe npcDiv() helper (returns 0 on a 0 divisor or non-finite value)
    and route every division in portionOut() through it, so Infinity/NaN can no
    longer leak into the inputs;
  - in calculateRest(), coerce "Rest"/overall to a finite value (fall back to
    the total when org4 cannot be parsed) so the submit button can always
    reappear once the distribution is balanced;
  - coerce each resource, $totalRes, $maxstore and $maxcrop to a valid,
    non-negative integer before they reach the page/JS, so a resource computed
    as NaN/INF cannot poison org4/summe in the first place.

* Server (Market::tradeResource): clamp each requested amount to [0, maxstore]
  (crop to maxcrop) before persisting, so a forged or corrupted POST can no
  longer write out-of-range resources.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-13 21:38:46 +02: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
hdmaniak 8c3a2138cc Fix marketplace race condition 2026-03-26 10:42:24 +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
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
iopietro 79eb6a73d6 General fixes
+Removed almost all "BANNED" controls to template and .php UI files. The
control will be done only once and in the Session class
2018-06-11 02:22:22 +02:00
iopietro f7e05c9802 Optimizations
-Removed the "sort_type" 6 from the movement table, looted resources
will now be saved in the "sort_type" 4 returing attack.
This reduces a lot the spam in the tables "send" and "movement" of the
database
-Removed some useless methods in Database.php and Message.php
+Optimized report loading, own report will be loaded only once (and not
twice at random) and allied reports aren't loaded anymore
+Minor improovements and better indentation
2018-05-05 17:54:34 +02:00
iopietro a40accc101 Distance calculation optimization and bug fixing
-Removed a lot of redundant code and put into a function
+Fixed a bug that permitted to found a new village in already founded
village
+Fixed a bug that permitted to found in an oasis
+Fixed a bug that permitted to hack the time you need to found a new
village
+Fixed a bug that permitted to found a new village to an inexistent one
2018-04-29 00:49:24 +02:00
iopietro e9def19bd9 Fixed an exploit in the market
+Fixed an exploit that permitted to gain an infinite amount of resources
2018-04-21 17:53:59 +02:00
iopietro 1dcde6675e Fixed a bug in the market
+Fixed a bug that didn't allow to send resources to other players
2018-04-17 16:28:47 +02:00
iopietro e116511c73 Fixed a lot of bugs/security issues in the market
+Fixed a bug that permitted to send resourcers to himself
+Fixed a bug that permitted to send resources to invalid villages
+Fixed a bug that permitted to create offerings with 0 resources or
invalid resources type
+Fixed a bug that permitted to accept offerings of other allies
+Fixed a bug that permitted to accept offerings with a too high maxtime
+Fixed a bug that permitted to accept offering from the same village
+Fixed a bug that permitted to accept offering with too few merchants
+Fixed a bug that permitted to accept offerings without the requested
resources
+Fixed a bug that hid offerings with a valid maxtime
+Fixed some bugs relative to errors diplaying
+Added some error
+Some clean-up
2018-04-16 23:45:21 +02:00
Pietro 1657928d88 Fixed a bug while sorting 2018-03-31 16:07:32 +02:00
Martin Ambrus 1747a26c1e fix: cannot send traders to village determined by a village name 2017-11-19 23:37:38 +01:00
Martin Ambrus d0a882f136 fix: maxcrop & maxstore cannot be 0, nor it should be < lowest threshold 2017-11-16 21:49:22 +01:00
Martin Ambrus 33ab908744 Merge remote-tracking branch 'origin/master' 2017-11-15 20:21:23 +01:00
Martin Ambrus dab768f662 refactor: 1st round of database values caching 2017-11-15 16:01:00 +01:00
Shadow fbbe815e3f not fixed , dont receive error for sending resource 2017-11-14 13:41:30 +02:00
Shadow 3a7ff0dddc fix vacation mode for market 2017-11-14 13:15:36 +02:00
Martin Ambrus 53f54ce9e9 feat: Admins can be attacked, raided and traded with via config option 2017-10-22 20:28:03 +02:00
Martin Ambrus 7270a69a63 fix: all location headers need to have exit after them! 2017-10-22 13:00:54 +02:00
uroskn 1afde368d3 GameEngine and install folders have 777 already set by default 2016-07-02 21:39:28 +02:00
yi12345 98e94af807 finish hero_full.php 2013-06-16 10:38:34 +03:00