favor update
This commit is contained in:
@@ -180,6 +180,20 @@ function gatherState() {
|
|||||||
has_premium = uw.GameDataPremium?.isAdvisorActivated?.('curator') || false;
|
has_premium = uw.GameDataPremium?.isAdvisorActivated?.('curator') || false;
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
|
// ---- Favor extraction -----------------------------------------------
|
||||||
|
let favor = 0;
|
||||||
|
let godName = null;
|
||||||
|
try {
|
||||||
|
godName = town.god?.() ?? null;
|
||||||
|
if (godName && uw.ITowns?.player_gods?.attributes) {
|
||||||
|
favor = uw.ITowns.player_gods.attributes[godName + '_favor'] || 0;
|
||||||
|
} else if (uw.$ && uw.Game?.townId === town.id) {
|
||||||
|
// UI fallback for the active town
|
||||||
|
const uiText = uw.$('.favor_amount').text();
|
||||||
|
if (uiText) favor = parseInt(uiText.replace(/[^\d]/g, ''), 10) || 0;
|
||||||
|
}
|
||||||
|
} catch (e) { log(`Failed to extract favor: ${e}`); }
|
||||||
|
|
||||||
return {
|
return {
|
||||||
town_id: town.id,
|
town_id: town.id,
|
||||||
town_name: town.name,
|
town_name: town.name,
|
||||||
@@ -190,8 +204,9 @@ function gatherState() {
|
|||||||
storage: storageCapacity,
|
storage: storageCapacity,
|
||||||
market_capacity: marketCapacity,
|
market_capacity: marketCapacity,
|
||||||
population: res.population,
|
population: res.population,
|
||||||
|
favor: favor,
|
||||||
points: town.getPoints?.() ?? 0,
|
points: town.getPoints?.() ?? 0,
|
||||||
god: town.god?.() ?? null,
|
god: godName,
|
||||||
buildings,
|
buildings,
|
||||||
units: unitsObj,
|
units: unitsObj,
|
||||||
buildingOrder: buildQueue,
|
buildingOrder: buildQueue,
|
||||||
|
|||||||
@@ -253,6 +253,7 @@ def get_towns():
|
|||||||
'storage': d.get('storage', 0),
|
'storage': d.get('storage', 0),
|
||||||
'market_capacity': d.get('market_capacity', 0),
|
'market_capacity': d.get('market_capacity', 0),
|
||||||
'population': d.get('population', 0),
|
'population': d.get('population', 0),
|
||||||
|
'favor': d.get('favor', 0),
|
||||||
},
|
},
|
||||||
'buildings': d.get('buildings', {}),
|
'buildings': d.get('buildings', {}),
|
||||||
'units': d.get('units', {}),
|
'units': d.get('units', {}),
|
||||||
|
|||||||
@@ -189,6 +189,7 @@ window.renderTownDetails = function() {
|
|||||||
<div>Παίκτης: <strong style="color:#aaa">${t.player}</strong>${t.has_premium ? ' <span style="color:#c8a44a" title="Premium">★</span>' : ''}</div>
|
<div>Παίκτης: <strong style="color:#aaa">${t.player}</strong>${t.has_premium ? ' <span style="color:#c8a44a" title="Premium">★</span>' : ''}</div>
|
||||||
${allianceHtml}
|
${allianceHtml}
|
||||||
${bpHtml}
|
${bpHtml}
|
||||||
|
${t.god ? `<div>Εύνοια: <strong style="color:#f1c40f">${t.resources?.favor || 0}</strong></div>` : ''}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
// ---- Researches ----
|
// ---- Researches ----
|
||||||
|
|||||||
Reference in New Issue
Block a user