battlepoint show
This commit is contained in:
@@ -17,6 +17,22 @@ function gatherState() {
|
||||
const total_points = uw.Game?.player_points ?? 0;
|
||||
const world = uw.Game?.world_id || '';
|
||||
|
||||
let battle_points = { att: 0, def: 0, available: 0, used: 0 };
|
||||
try {
|
||||
const pk = uw.MM?.getModels?.()?.PlayerKillpoints;
|
||||
if (pk) {
|
||||
const m = pk[player_id] || Object.values(pk)[0];
|
||||
if (m && m.attributes) {
|
||||
battle_points = {
|
||||
att: m.attributes.att || 0,
|
||||
def: m.attributes.def || 0,
|
||||
available: m.attributes.available || 0,
|
||||
used: m.attributes.used || 0
|
||||
};
|
||||
}
|
||||
}
|
||||
} catch (e) { log(`Failed to extract battle_points: ${e}`); }
|
||||
|
||||
const townList = Object.values(towns).map(town => {
|
||||
const res = town.resources();
|
||||
const buildings = town.buildings()?.attributes ?? {};
|
||||
@@ -211,7 +227,7 @@ function gatherState() {
|
||||
}
|
||||
} catch (e) { log(`unit speed gather failed: ${e}`); }
|
||||
|
||||
return { player, player_id, alliance_id, total_points, world_id: world,
|
||||
return { player, player_id, alliance_id, total_points, battle_points, world_id: world,
|
||||
world_speed, unit_speeds, towns: townList };
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user