From 2cc7e280be88313b3021cea382550304e0722986 Mon Sep 17 00:00:00 2001 From: JustEngineer Date: Thu, 16 Oct 2025 16:29:17 +0300 Subject: [PATCH] update max charges after buying to account --- Extension/scripts/Auto-Image.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Extension/scripts/Auto-Image.js b/Extension/scripts/Auto-Image.js index 9ba46a5..796d2ad 100644 --- a/Extension/scripts/Auto-Image.js +++ b/Extension/scripts/Auto-Image.js @@ -10413,6 +10413,21 @@ localStorage.removeItem("lp"); // POST request completed if (res.ok) { console.log("Successfully bought", amounts * chargeMultiplier, type.replace('_', ' '), "."); + // Update AccountManager to reflect new limits/charges after successful purchase + try { + const acc = (typeof accountManager !== 'undefined' && accountManager?.getCurrentAccount) ? accountManager.getCurrentAccount() : null; + if (acc) { + if (type === "max_charges") { + const newMax = Math.floor((typeof acc.Max === 'number' ? acc.Max : 0) + (amounts * chargeMultiplier)); + accountManager.updateAccountData({ Max: newMax }); + } else if (type === "paint_charges") { + const newCharges = Math.floor((typeof acc.Charges === 'number' ? acc.Charges : 0) + (amounts * chargeMultiplier)); + accountManager.updateAccountData({ Charges: newCharges }); + } + } + } catch (e) { + console.warn('⚠️ Failed to update account manager after purchase', e); + } return 2; } else { console.log("Failed to buy charges");