mirror of
https://github.com/tiennm99/WPlace-AutoBOT.git
synced 2026-10-11 03:13:01 +00:00
update max charges after buying to account
This commit is contained in:
1 parent
401b554a38
commit
2cc7e280be
1 file changed
+15
@@ -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");
|
||||
|
||||
Reference in new issue
Block a user