Commit 6f4dbe11 authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix(hud): the purse counts up to the balance after achievement coins

Achievement coins were paid by the check after the HUD had already pulled
the player, so the purse showed the old balance until the next refresh.
Co-Authored-By: 's avatarClaude Opus 5.5 <noreply@anthropic.com>
parent 5c00e8d4
...@@ -224,6 +224,12 @@ function afterGame() { ...@@ -224,6 +224,12 @@ function afterGame() {
const all = await net.get('achievements.php'); const all = await net.get('achievements.php');
const list = (all?.achievements || []).filter(a => ids.includes(a.id)); const list = (all?.achievements || []).filter(a => ids.includes(a.id));
list.forEach((a, i) => setTimeout(() => announceAchievement(a), 900 + i * 2600)); list.forEach((a, i) => setTimeout(() => announceAchievement(a), 900 + i * 2600));
// The check just paid the achievements' coins: pull the purse again so it
// counts up to the real balance as the banner drops.
if (list.some(a => a.coins_reward)) {
const paid = await net.get('profile.php');
if (paid && !paid.error) setTimeout(() => store.set('player', { ...store.get('player'), ...paid }), 900);
}
} catch (e) {} } catch (e) {}
}, 1800); }, 1800);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment