From 484ea9dc0f5049a93ac7e39b6269fe41c304614f Mon Sep 17 00:00:00 2001 From: haunter Date: Mon, 20 Apr 2026 12:58:08 +0300 Subject: [PATCH] fix dashboard --- GrepolisRemoteControl.user.js | 30 ++++-------------------------- templates/dashboard.html | 4 +++- 2 files changed, 7 insertions(+), 27 deletions(-) diff --git a/GrepolisRemoteControl.user.js b/GrepolisRemoteControl.user.js index 0d072bf..0d52b8c 100644 --- a/GrepolisRemoteControl.user.js +++ b/GrepolisRemoteControl.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Grepolis Remote Control // @namespace http://tampermonkey.net/ -// @version 1.4 +// @version 1.5 // @description Polls grepo.haunter-pets.top for remote commands and executes them in-game // @author Dimitrios // @match https://*.grepolis.com/game/* @@ -74,17 +74,6 @@ const total_points = uw.Game?.player_points ?? 0; const world = uw.Game?.world_id || ''; - // ---- Debug: Game-level fields (logged once on first push) --------------- - if (!gatherState._debugDone) { - gatherState._debugDone = true; - console.group('[GRC Debug] Game-level fields'); - console.log('player_id :', uw.Game?.player_id, '→', player_id ?? '❌ MISSING'); - console.log('alliance_id :', uw.Game?.alliance_id, '→', alliance_id ?? '❌ MISSING'); - console.log('player_points:', uw.Game?.player_points, '→', total_points || '❌ ZERO/MISSING'); - console.log('world_id :', uw.Game?.world_id, '→', world || '❌ MISSING'); - console.groupEnd(); - } - const townList = Object.values(towns).map(town => { const res = town.resources(); const buildings = town.buildings()?.attributes ?? {}; @@ -164,7 +153,6 @@ try { const r = town.researches?.(); if (r) researches = r.attributes ?? (typeof r === 'object' ? r : {}); - if (!Object.keys(researches).length) log(`[Debug] researches empty for town ${town.name} — raw: ${JSON.stringify(r)}`); } catch (e) { log(`[Debug] town.researches() failed: ${e}`); } // ---- Extra town flags ----------------------------------------------- @@ -172,19 +160,9 @@ let bonuses = {}; let wonder_points = 0; try { - const hp = town.hasPremium?.(); - has_premium = hp || false; - if (hp === undefined || hp === null) log(`[Debug] town.hasPremium() = ${hp} (missing or undefined) for ${town.name}`); - } catch (e) { log(`[Debug] town.hasPremium() threw: ${e}`); } - try { - const gb = town.getBonus?.(); - bonuses = gb || {}; - if (!gb || !Object.keys(gb).length) log(`[Debug] town.getBonus() = ${JSON.stringify(gb)} (empty/missing) for ${town.name}`); - } catch (e) { log(`[Debug] town.getBonus() threw: ${e}`); } - try { - wonder_points = town.wonder_points || 0; - if (!town.wonder_points) log(`[Debug] town.wonder_points = ${town.wonder_points} (zero/missing) for ${town.name}`); - } catch (e) { log(`[Debug] town.wonder_points threw: ${e}`); } + // Proper premium check for Admin/Curator + has_premium = uw.GameDataPremium?.isAdvisorActivated?.('curator') || false; + } catch (e) { } return { town_id: town.id, diff --git a/templates/dashboard.html b/templates/dashboard.html index 619edbd..c31c923 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -549,7 +549,9 @@ function renderTownDetails() { // ---- Researches ---- const researchObj = t.researches || {}; - const researchEntries = Object.entries(researchObj).filter(([, v]) => v === true || v === 1 || Number(v) > 0); + const researchEntries = Object.entries(researchObj).filter(([k, v]) => + k !== 'id' && k !== 'town_id' && (v === true || v === 1 || Number(v) > 0) + ); let resHtml = ''; if (researchEntries.length) { resHtml = researchEntries.map(([k]) =>