buy-ion-engine.js 537 B

1234567891011121314151617181920
  1. states.push({
  2. id: "buy-ion-engine",
  3. button: "Buy Ion Engine (₩2000)",
  4. action: "Purchasing",
  5. show: () => !isFlagEnabled('ion-engine-purchased'),
  6. duration: 300,
  7. requires: () => {
  8. let enoughMoney = userData.money >= 2000;
  9. if (!enoughMoney) {
  10. errorMessage = "Not enough money to buy ion engine";
  11. return false;
  12. }
  13. let confirmPurchase = confirm(`Are you sure you want to purchase an ion engine for ₩2000?`);
  14. return confirmPurchase;
  15. },
  16. run: () => {
  17. userData.money -= 2000;
  18. setFlag('ion-engine-purchased');
  19. },
  20. });