debug
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Grepolis Remote Control
|
// @name Grepolis Remote Control
|
||||||
// @namespace http://tampermonkey.net/
|
// @namespace http://tampermonkey.net/
|
||||||
// @version 1.3
|
// @version 1.4
|
||||||
// @description Polls grepo.haunter-pets.top for remote commands and executes them in-game
|
// @description Polls grepo.haunter-pets.top for remote commands and executes them in-game
|
||||||
// @author Dimitrios
|
// @author Dimitrios
|
||||||
// @match https://*.grepolis.com/game/*
|
// @match https://*.grepolis.com/game/*
|
||||||
@@ -74,6 +74,16 @@
|
|||||||
const total_points = uw.Game?.player_points ?? 0;
|
const total_points = uw.Game?.player_points ?? 0;
|
||||||
const world = uw.Game?.world_id || '';
|
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 townList = Object.values(towns).map(town => {
|
||||||
const res = town.resources();
|
const res = town.resources();
|
||||||
@@ -154,15 +164,27 @@
|
|||||||
try {
|
try {
|
||||||
const r = town.researches?.();
|
const r = town.researches?.();
|
||||||
if (r) researches = r.attributes ?? (typeof r === 'object' ? r : {});
|
if (r) researches = r.attributes ?? (typeof r === 'object' ? r : {});
|
||||||
} catch (e) {}
|
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 -----------------------------------------------
|
// ---- Extra town flags -----------------------------------------------
|
||||||
let has_premium = false;
|
let has_premium = false;
|
||||||
let bonuses = {};
|
let bonuses = {};
|
||||||
let wonder_points = 0;
|
let wonder_points = 0;
|
||||||
try { has_premium = town.hasPremium?.() || false; } catch (e) {}
|
try {
|
||||||
try { bonuses = town.getBonus?.() || {}; } catch (e) {}
|
const hp = town.hasPremium?.();
|
||||||
try { wonder_points = town.wonder_points || 0; } catch (e) {}
|
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}`); }
|
||||||
|
|
||||||
return {
|
return {
|
||||||
town_id: town.id,
|
town_id: town.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user