Add Plus Statistics

Add Plus Statistics
This commit is contained in:
novgorodschi catalin
2026-07-28 08:48:19 +03:00
parent d4a83f3b7b
commit 7642151569
24 changed files with 844 additions and 9 deletions
+20
View File
@@ -168,6 +168,26 @@ define("ALLIANCE_BONUS_PCT_LARGE", 4);
// Gold cost to triple a donation.
define("ALLIANCE_BONUS_TRIPLE_GOLD", 3);
// ***** Graphical statistics (Travian Plus)
// The game periodically records each player's rank, population, villages, and
// army from the moment this feature is enabled. These snapshots are then used
// to generate the account progression graphs.
//
// Data is collected for ALL players, but the Statistics tab is visible ONLY to
// users with an active Plus account. Otherwise, players who purchase Plus would
// open the page and see an empty graph immediately after paying.
define("NEW_FUNCTIONS_PLUS_STATISTICS", %PLUSSTATS%);
// Number of hours between snapshots. On a fast server, a single day represents
// a significant amount of gameplay, so taking a snapshot every 6 hours provides
// a smooth graph without filling the database table too quickly.
define("PLUS_STATS_INTERVAL_HOURS", %PLUSSTATSHOURS%);
// Number of days to retain historical data. Set to 0 to keep all snapshots,
// allowing the complete account progression to be displayed. Even over the
// lifetime of an entire server, this only amounts to a few tens of thousands of records.
define("PLUS_STATS_KEEP_DAYS", %PLUSSTATSKEEP%);
// ***** Graphic Pack
//
// SERVER_GP is the pack every player sees by default (chosen at install or in
+11
View File
@@ -84,6 +84,17 @@ class Process {
// Bonusuri de alianta (port T4)
$findReplace["%ALLIANCEBONUSES%"] = (isset($_POST['alliance_bonuses']) && $_POST['alliance_bonuses'] === 'true') ? 'true' : 'false';
// Statistici grafice (Travian Plus)
$findReplace["%PLUSSTATS%"] = (isset($_POST['plus_statistics']) && $_POST['plus_statistics'] === 'false') ? 'false' : 'true';
$psHours = isset($_POST['plus_stats_hours']) ? (float) $_POST['plus_stats_hours'] : 6;
if ($psHours < 0.25 || $psHours > 168) { $psHours = 6; }
$findReplace["%PLUSSTATSHOURS%"] = $psHours;
$psKeep = isset($_POST['plus_stats_keep']) ? (int) $_POST['plus_stats_keep'] : 0;
if ($psKeep < 0 || $psKeep > 3650) { $psKeep = 0; }
$findReplace["%PLUSSTATSKEEP%"] = $psKeep;
$findReplace["%GP%"] = (isset($_POST['gpack']) && $_POST['gpack'] === 'true') ? 'true' : 'false';
$findReplace["%SSERVER%"] = $_POST['sserver'];
$findReplace["%SPORT%"] = $_POST['sport'];
+6
View File
@@ -312,6 +312,12 @@ foreach($mechs as $k => $l){
<div><label>Hero base regeneration (HP/day)</label><input class="input" name="hero_base_regen" id="hero_base_regen" value="10"></div>
<div><label>Silver received per 1 gold</label><input class="input" name="hero_silver_per_gold" id="hero_silver_per_gold" value="10"></div>
<div><label>Silver needed for 1 gold</label><input class="input" name="hero_silver_to_gold" id="hero_silver_to_gold" value="25"></div>
<div><label>Plus graphical statistics</label><select class="input" name="plus_statistics">
<option value="true" selected>Yes &ndash; record account history, graphs for Plus players</option>
<option value="false">No</option>
</select></div>
<div><label>Statistics snapshot interval (hours)</label><input class="input" type="text" name="plus_stats_hours" value="6"></div>
<div><label>Statistics history kept (days, 0 = forever)</label><input class="input" type="text" name="plus_stats_keep" value="0"></div>
<div><label>Alliance bonuses (T4)</label><select class="input" name="alliance_bonuses">
<option value="false" selected>No</option>
<option value="true">Yes</option>