From ff267cf05ec5633e2d83ecd6558db15802dcbd55 Mon Sep 17 00:00:00 2001 From: haunter Date: Tue, 19 Aug 2025 13:00:43 +0000 Subject: [PATCH] Update town.js --- town.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/town.js b/town.js index 6c295e6..92aa606 100644 --- a/town.js +++ b/town.js @@ -1,8 +1,8 @@ // ==UserScript== -// @name Grepolis Town Stats Extended Clean (with Sea, Buildings, Researches, Points, Gods) +// @name Grepolis Town Stats Extended Clean (with Alliance & World) // @namespace http://tampermonkey.net/ -// @version 1.8 -// @description Sends town stats with coords, sea, full building orders, researches, points, and gods +// @version 1.9 +// @description Sends town stats with coords, sea, full building orders, researches, points, gods, alliance_id, world_id // @author Dimitrios + GPT // @match https://*.grepolis.com/game/* // @grant unsafeWindow @@ -14,7 +14,7 @@ const uw = unsafeWindow || window; let paused = false; - console.log("🚀 Town Stats Extended Clean (with Sea, Buildings, Researches, Points, Gods) loaded"); + console.log("🚀 Town Stats Extended Clean (with Alliance & World) loaded"); // ----------------------------- // Toolbar pause/resume button @@ -68,6 +68,8 @@ const player = uw.Game?.player_name || "unknown"; const player_id = uw.Game?.player_id || "unknown"; const total_points = uw.Game?.player_points || 0; + const alliance_id = uw.Game?.alliance_id || null; + const world_id = uw.Game?.world_id || null; const townStats = Object.values(towns).map(town => { const res = town.resources(); @@ -108,13 +110,13 @@ researches = town.researches(); } - // Village points — use fixed getPoints + // Village points let points = 0; if (typeof town.getPoints === 'function') { points = town.getPoints(); } - // God — keep original logic + // God let god = null; if (typeof town.god === 'function') { god = town.god(); @@ -140,7 +142,7 @@ }; }); - return { player, player_id, total_points, towns: townStats }; + return { player, player_id, alliance_id, world_id, total_points, towns: townStats }; } // -----------------------------