scoreboard players add .lvl blt.vault_limit 1

execute if score .lvl blt.vault_limit matches 1 run scoreboard players operation .global blt.vault_limit = .lvl1 blt.vault_limit
execute if score .lvl blt.vault_limit matches 2 run scoreboard players operation .global blt.vault_limit = .lvl2 blt.vault_limit
execute if score .lvl blt.vault_limit matches 3 run scoreboard players operation .global blt.vault_limit = .lvl3 blt.vault_limit

execute if score .lvl blt.vault_limit matches 1 run function fjam:map/game/vault/limit_upgrade/cost {amt: 250, next_cost: "$500", current_limit: "$2000", next_limit: "$4000"}
execute if score .lvl blt.vault_limit matches 2 run function fjam:map/game/vault/limit_upgrade/cost {amt: 500, next_cost: "$1000", current_limit: "$4000", next_limit: "$5000"}
execute if score .lvl blt.vault_limit matches 3 run function fjam:map/game/vault/limit_upgrade/cost {amt: 1000, next_cost: "-", current_limit: "$5000", next_limit: "-"}

playsound minecraft:entity.player.levelup player @a ~ ~ ~ 2 2
particle minecraft:composter ~ ~1 ~ 1 1 1 0 100 force @a
particle minecraft:happy_villager ~ ~1 ~ 1 1 1 0 10 force @a

advancement grant @s only fjam:challenges/money/upgrade_limit
execute if score .lvl blt.vault_limit matches 3.. run advancement grant @a only fjam:challenges/money/max_limit