2 bugs / farm and bandit

This commit is contained in:
2026-05-02 02:21:32 +03:00
parent 6157ae1034
commit d8ba139d07
3 changed files with 16 additions and 19 deletions

View File

@@ -62,13 +62,17 @@ async function autoBootcampLoop() {
const isFavor = reward.power_id?.includes('favor');
const stashable = reward.stashable;
if (isInstant && !isFavor) {
const useReward = () => {
uw.gpAjax.ajaxPost('frontend_bridge', 'execute', {
model_url: `PlayerAttackSpot/${player_id}`,
action_name: 'useReward',
arguments: {}
});
await botLog(player_id, world_id, 'bootcamp', 'Διεκδίκηση αμοιβής ληστών...');
botLog(player_id, world_id, 'bootcamp', `Reward used: ${reward.power_id}`);
};
if (isInstant && !isFavor) {
useReward();
} else if (stashable) {
uw.gpAjax.ajaxPost('frontend_bridge', 'execute', {
model_url: `PlayerAttackSpot/${player_id}`,
@@ -78,22 +82,10 @@ async function autoBootcampLoop() {
success: () => {
botLog(player_id, world_id, 'bootcamp', `Reward stashed: ${reward.power_id}`);
},
error: () => {
uw.gpAjax.ajaxPost('frontend_bridge', 'execute', {
model_url: `PlayerAttackSpot/${player_id}`,
action_name: 'useReward',
arguments: {}
});
botLog(player_id, world_id, 'bootcamp', 'Αποτυχία διεκδίκησης αμοιβής.');
}
error: useReward
});
} else {
uw.gpAjax.ajaxPost('frontend_bridge', 'execute', {
model_url: `PlayerAttackSpot/${player_id}`,
action_name: 'useReward',
arguments: {}
});
await botLog(player_id, world_id, 'bootcamp', `Reward used (fallback): ${reward.power_id}`);
useReward();
}
await sleep(randInt(3000, 7000));
return; // Wait for next cycle to attack

View File

@@ -185,7 +185,8 @@ async function autoFarmLoop() {
if (allFull) {
log('⚠️ Auto-farm: ALL warehouses are full (>95%) — skipping loot this cycle');
try {
await apiFetch(`${BASE_URL}/api/farm_status?player_id=${player_id}`, {
const world_id = uw.Game?.world_id || '';
await apiFetch(`${BASE_URL}/api/farm_status?player_id=${player_id}&world_id=${world_id}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ warehouse_full: true })
@@ -200,7 +201,8 @@ async function autoFarmLoop() {
await executeFarmLoot({ payload: { loot_option: farmSettings.loot_option } });
// Report success so dashboard shows last_farmed_at
try {
await apiFetch(`${BASE_URL}/api/farm_status?player_id=${player_id}`, {
const world_id = uw.Game?.world_id || '';
await apiFetch(`${BASE_URL}/api/farm_status?player_id=${player_id}&world_id=${world_id}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ warehouse_full: false })

View File

@@ -437,9 +437,12 @@ def upload_market_data():
@api.route('/api/farm_status', methods=['POST', 'GET'])
def farm_status():
player_id = request.args.get('player_id')
world_id = request.args.get('world_id')
if not player_id:
return jsonify({'error': 'no player_id'}), 400
kv_key = f'farm_status_{player_id}'
player_key = f"{player_id}_{world_id}" if world_id else player_id
kv_key = f'farm_status_{player_key}'
conn = get_db()
if request.method == 'POST':
data = request.get_json(silent=True) or {}