diff --git a/Synergism.css b/Synergism.css index 6693b0aab..08ace1202 100644 --- a/Synergism.css +++ b/Synergism.css @@ -1929,7 +1929,9 @@ p#reincarnatehotkeys { margin-top: 20px; } -#shopButtons { +#shopButtons, +#octeractButtons, +#singUpgradeButtons { display: flex; justify-content: center; flex-flow: wrap; @@ -1938,7 +1940,9 @@ p#reincarnatehotkeys { margin-top: 5px; } -#shopButtons > button { +#shopButtons > button, +#octeractButtons > button, +#singUpgradeButtons > button { min-width: 150px; min-height: 40px; margin-bottom: 6px; diff --git a/index.html b/index.html index 2bdb40ba6..4d4e7a899 100644 --- a/index.html +++ b/index.html @@ -3829,9 +3829,6 @@

Artists

You have 0 Golden Quarks!

-
-

Buy multiple levels at once by holding 'SHIFT' while clicking!

-
goldenQuarks1 @@ -3885,10 +3882,10 @@

Artists

cookies4
- cookies5 + cookies5
- ascensions + ascensions
corruptionFourteen @@ -4014,6 +4011,10 @@

Artists

+
+ + +

@@ -4047,9 +4048,7 @@

Artists

Offerings +4%

Obtainium +4%

-
-

Buy multiple levels at once by holding 'SHIFT' while clicking!

-
+
@@ -4142,11 +4141,13 @@

Artists

- +
+ + +

- @@ -4174,8 +4175,6 @@

Artists

- - diff --git a/src/CheckVariables.ts b/src/CheckVariables.ts index 45a1e0442..ffef99a08 100644 --- a/src/CheckVariables.ts +++ b/src/CheckVariables.ts @@ -829,6 +829,14 @@ export const checkVariablesOnLoad = (data: PlayerSave) => { player.shopConfirmationToggle = true; } + if (data.octeractBuyMaxToggle === undefined) { + player.octeractBuyMaxToggle = 'ONE'; + } + + if (data.singUpgradeBuyMaxToggle === undefined) { + player.singUpgradeBuyMaxToggle = 'ONE'; + } + if (data.wowOcteracts === undefined) { player.wowOcteracts = 0; player.octeractTimer = 0; @@ -838,6 +846,14 @@ export const checkVariablesOnLoad = (data: PlayerSave) => { player.shopHideToggle = false; } + if (data.octeractHideToggle === undefined) { + player.octeractHideToggle = false; + } + + if (data.singUpgradeHideToggle === undefined) { + player.singUpgradeHideToggle = false; + } + if (data.researchBuyMaxToggle === undefined) { player.researchBuyMaxToggle = false; } diff --git a/src/EventListeners.ts b/src/EventListeners.ts index ecd963635..ab6587972 100644 --- a/src/EventListeners.ts +++ b/src/EventListeners.ts @@ -1,4 +1,4 @@ -import { toggleAscStatPerSecond, toggleTabs, toggleSubTab, toggleBuyAmount, toggleAutoTesseracts, toggleSettings, toggleautoreset, toggleautobuytesseract, toggleShops, toggleAutoSacrifice, toggleAutoBuyFragment, toggleautoenhance, toggleautofortify, updateRuneBlessingBuyAmount, toggleSaveOff, toggleChallenges, toggleAutoChallengesIgnore, toggleAutoChallengeRun, updateAutoChallenge, toggleResearchBuy, toggleAutoResearch, toggleAntMaxBuy, toggleAntAutoSacrifice, toggleMaxBuyCube, toggleautoopensCubes, toggleCorruptionLevel, toggleAutoAscend, toggleShopConfirmation, toggleAutoResearchMode, toggleBuyMaxShop, toggleHideShop, toggleHepteractAutoPercentage, autoCubeUpgradesToggle, autoPlatonicUpgradesToggle } from './Toggles' +import { toggleAscStatPerSecond, toggleTabs, toggleSubTab, toggleBuyAmount, toggleAutoTesseracts, toggleSettings, toggleautoreset, toggleautobuytesseract, toggleShops, toggleAutoSacrifice, toggleAutoBuyFragment, toggleautoenhance, toggleautofortify, updateRuneBlessingBuyAmount, toggleSaveOff, toggleChallenges, toggleAutoChallengesIgnore, toggleAutoChallengeRun, updateAutoChallenge, toggleResearchBuy, toggleAutoResearch, toggleAntMaxBuy, toggleAntAutoSacrifice, toggleMaxBuyCube, toggleautoopensCubes, toggleCorruptionLevel, toggleAutoAscend, toggleShopConfirmation, toggleAutoResearchMode, toggleBuyMaxShop, toggleBuyMaxOcteract, toggleBuyMaxSingUpgrade, toggleHideShop, toggleHideOcteract, toggleHideSingUpgrade, toggleHepteractAutoPercentage, autoCubeUpgradesToggle, autoPlatonicUpgradesToggle } from './Toggles' import { resetrepeat, updateAutoReset, updateTesseractAutoBuyAmount, updateAutoCubesOpens } from './Reset' import { player, resetCheck, saveSynergy } from './Synergism' import { boostAccelerator, buyAccelerator, buyMultiplier, buyProducer, buyCrystalUpgrades, buyParticleBuilding, buyTesseractBuilding, buyRuneBonusLevels, buyAllBlessings } from './Buy' @@ -586,7 +586,7 @@ TODO: Fix this entire tab it's utter shit // Part 1: The Settings /*Respec The Upgrades*/ DOMCacheGetOrSet('resetShopUpgrades').addEventListener('click', () => resetShopUpgrades()) /*Toggle Shop Confirmations*/ DOMCacheGetOrSet('toggleConfirmShop').addEventListener('click', () => toggleShopConfirmation()) - /*Toggle Shop Buy Max*/ DOMCacheGetOrSet('toggleBuyMaxShop').addEventListener('click', (event) => toggleBuyMaxShop(event)) + /*Toggle Shop Buy Max*/ DOMCacheGetOrSet('toggleBuyMaxShop').addEventListener('click', () => toggleBuyMaxShop()) /*Toggle Hide Permanent Maxed*/ DOMCacheGetOrSet('toggleHideShop').addEventListener('click', () => toggleHideShop()) // Part 2: Potions @@ -595,8 +595,7 @@ TODO: Fix this entire tab it's utter shit DOMCacheGetOrSet('offeringpotionowned').addEventListener('mouseover', () => shopDescriptions('offeringPotion')) DOMCacheGetOrSet('buyofferingpotion').addEventListener('mouseover', () => shopDescriptions('offeringPotion')) DOMCacheGetOrSet('useofferingpotion').addEventListener('mouseover', () => shopDescriptions('offeringPotion')) - DOMCacheGetOrSet('buyofferingpotion').addEventListener('click', () => buyShopUpgrades('offeringPotion')) - //DOMCacheGetOrSet('offeringPotions').addEventListener('click', () => buyShopUpgrades("offeringPotion")) //Allow clicking of image to buy also + DOMCacheGetOrSet('buyofferingpotion').addEventListener('click', (event) => buyShopUpgrades('offeringPotion', event)) DOMCacheGetOrSet('useofferingpotion').addEventListener('click', () => useConsumable('offeringPotion')) DOMCacheGetOrSet('toggle42').addEventListener('click', () => { player.autoPotionTimer = 0; @@ -606,8 +605,7 @@ TODO: Fix this entire tab it's utter shit DOMCacheGetOrSet('obtainiumpotionowned').addEventListener('mouseover', () => shopDescriptions('obtainiumPotion')) DOMCacheGetOrSet('buyobtainiumpotion').addEventListener('mouseover', () => shopDescriptions('obtainiumPotion')) DOMCacheGetOrSet('useobtainiumpotion').addEventListener('mouseover', () => shopDescriptions('obtainiumPotion')) - DOMCacheGetOrSet('buyobtainiumpotion').addEventListener('click', () => buyShopUpgrades('obtainiumPotion')) - //DOMCacheGetOrSet('obtainiumPotions').addEventListener('click', () => buyShopUpgrades("obtainiumPotion")) //Allow clicking of image to buy also + DOMCacheGetOrSet('buyobtainiumpotion').addEventListener('click', (event) => buyShopUpgrades('obtainiumPotion', event)) DOMCacheGetOrSet('useobtainiumpotion').addEventListener('click', () => useConsumable('obtainiumPotion')) DOMCacheGetOrSet('toggle43').addEventListener('click', () => { player.autoPotionTimerObtainium = 0; @@ -620,8 +618,7 @@ TODO: Fix this entire tab it's utter shit DOMCacheGetOrSet(`${key}`).addEventListener('mouseover', () => shopDescriptions(key)) DOMCacheGetOrSet(`${key}Level`).addEventListener('mouseover', () => shopDescriptions(key)) DOMCacheGetOrSet(`${key}Button`).addEventListener('mouseover', () => shopDescriptions(key)) - //DOMCacheGetOrSet(`${key}`).addEventListener('click', () => buyShopUpgrades(key)) //Allow clicking of image to buy also - DOMCacheGetOrSet(`${key}Button`).addEventListener('click', () => buyShopUpgrades(key)) + DOMCacheGetOrSet(`${key}Button`).addEventListener('click', (event) => buyShopUpgrades(key, event)) } } DOMCacheGetOrSet('buySingularityQuarksButton').addEventListener('click', () => buyGoldenQuarks()); @@ -634,6 +631,10 @@ TODO: Fix this entire tab it's utter shit DOMCacheGetOrSet(`${String(key)}`).addEventListener('mouseover', () => player.singularityUpgrades[`${String(key)}`].updateUpgradeHTML()) DOMCacheGetOrSet(`${String(key)}`).addEventListener('click', (event) => player.singularityUpgrades[`${String(key)}`].buyLevel(event)) } + + /*Toggle Hide Maxed*/ DOMCacheGetOrSet('toggleHideSingUpgrade').addEventListener('click', () => toggleHideSingUpgrade()) + /*Toggle Buy Max*/ DOMCacheGetOrSet('toggleBuyMaxSingUpgrade').addEventListener('click', () => toggleBuyMaxSingUpgrade()) + DOMCacheGetOrSet('actualSingularityUpgradeContainer').addEventListener('mouseover', () => shopMouseover(true)); DOMCacheGetOrSet('actualSingularityUpgradeContainer').addEventListener('mouseout', () => shopMouseover(false)); @@ -644,6 +645,9 @@ TODO: Fix this entire tab it's utter shit DOMCacheGetOrSet(`${String(key)}`).addEventListener('click', (event) => player.octeractUpgrades[`${String(key)}`].buyLevel(event)) } + /*Toggle Hide Maxed*/ DOMCacheGetOrSet('toggleHideOcteract').addEventListener('click', () => toggleHideOcteract()) + /*Toggle Buy Max*/ DOMCacheGetOrSet('toggleBuyMaxOcteract').addEventListener('click', () => toggleBuyMaxOcteract()) + DOMCacheGetOrSet('octeractUpgradeContainer').addEventListener('mouseover', () => shopMouseover(true)); DOMCacheGetOrSet('octeractUpgradeContainer').addEventListener('mouseout', () => shopMouseover(false)); diff --git a/src/Octeracts.ts b/src/Octeracts.ts index d31dafccf..6c8fd2d2e 100644 --- a/src/Octeracts.ts +++ b/src/Octeracts.ts @@ -40,25 +40,31 @@ export class OcteractUpgrade extends DynamicUpgrade { */ public async buyLevel(event: MouseEvent): Promise { let purchased = 0; - let maxPurchasable = 1; - let OCTBudget = player.wowOcteracts; + let maxPurchasable = 1000000; + let octBudget = player.wowOcteracts; - if (event.shiftKey) { - maxPurchasable = 1000000 - const buy = Number(await Prompt(`How many Octeracts would you like to spend? You have ${format(player.wowOcteracts, 0, true)} OCT. Type -1 to use max!`)) + if (!event.shiftKey && player.octeractBuyMaxToggle === 'ONE') { + maxPurchasable = 1; + } else { + let octToSpend = -1; - if (isNaN(buy) || !isFinite(buy) || !Number.isInteger(buy)) { // nan + Infinity checks - return Alert('Value must be a finite number!'); + // Shows a prompt to ask how many Octeracts to spend + if (event.shiftKey || player.octeractBuyMaxToggle === 'ANY') { + octToSpend = Number(await Prompt(`How many Octeracts would you like to spend? You have ${format(player.wowOcteracts, 0, true)} OCT. Type -1 to use max!`)) + + if (isNaN(octToSpend) || !isFinite(octToSpend) || !Number.isInteger(octToSpend)) { // nan + Infinity checks + return Alert('Value must be a finite number!'); + } } - if (buy === -1) { - OCTBudget = player.wowOcteracts - } else if (buy <= 0) { + if (octToSpend === -1) { + octBudget = player.wowOcteracts + } else if (octToSpend <= 0) { return Alert('Purchase cancelled!') } else { - OCTBudget = buy + octBudget = octToSpend; } - OCTBudget = Math.min(player.wowOcteracts, OCTBudget) + octBudget = Math.min(player.wowOcteracts, octBudget) } if (this.maxLevel > 0) { @@ -71,11 +77,11 @@ export class OcteractUpgrade extends DynamicUpgrade { while (maxPurchasable > 0) { const cost = this.getCostTNL(); - if (player.wowOcteracts < cost || OCTBudget < cost) { + if (player.wowOcteracts < cost || octBudget < cost) { break; } else { player.wowOcteracts -= cost; - OCTBudget -= cost; + octBudget -= cost; this.octeractsInvested += cost this.level += 1; purchased += 1; diff --git a/src/Reset.ts b/src/Reset.ts index c2ef50d9d..4044eb4cd 100644 --- a/src/Reset.ts +++ b/src/Reset.ts @@ -1156,6 +1156,10 @@ export const singularity = async (setSingNumber = -1): Promise => { hold.theme = player.theme hold.notation = player.notation hold.firstPlayed = player.firstPlayed + hold.octeractHideToggle = player.octeractHideToggle + hold.octeractBuyMaxToggle = player.octeractBuyMaxToggle + hold.singUpgradeHideToggle = player.singUpgradeHideToggle + hold.singUpgradeBuyMaxToggle = player.singUpgradeBuyMaxToggle hold.autoCubeUpgradesToggle = player.autoCubeUpgradesToggle hold.autoPlatonicUpgradesToggle = player.autoPlatonicUpgradesToggle hold.insideSingularityChallenge = player.insideSingularityChallenge diff --git a/src/Shop.ts b/src/Shop.ts index a702bdaed..be2515985 100644 --- a/src/Shop.ts +++ b/src/Shop.ts @@ -888,7 +888,7 @@ export const friendlyShopName = (input: ShopUpgradeNames) => { } -export const buyShopUpgrades = async (input: ShopUpgradeNames) => { +export const buyShopUpgrades = async (input: ShopUpgradeNames, event: MouseEvent) => { const shopItem = shopData[input]; if (player.shopUpgrades[input] >= shopItem.maxLevel) { @@ -910,20 +910,28 @@ export const buyShopUpgrades = async (input: ShopUpgradeNames) => { const maxBuyAmount = shopItem.maxLevel - player.shopUpgrades[input]; let buyAmount; let buyCost; - switch (player.shopBuyMaxToggle) { - case false: - buyAmount = 1; - buyCost = getShopCosts(input); - break; - case 'TEN': - buyData = calculateSummationNonLinear(player.shopUpgrades[input], shopItem.price, +player.worlds, shopItem.priceIncrease / shopItem.price, Math.min(10,maxBuyAmount)) - buyAmount = buyData.levelCanBuy - player.shopUpgrades[input]; - buyCost = buyData.cost; - break; - default: - buyData = calculateSummationNonLinear(player.shopUpgrades[input], shopItem.price, +player.worlds, shopItem.priceIncrease / shopItem.price, maxBuyAmount) - buyAmount = buyData.levelCanBuy - player.shopUpgrades[input]; - buyCost = buyData.cost; + if (event.shiftKey) { + // Buy ANY + buyData = calculateSummationNonLinear(player.shopUpgrades[input], shopItem.price, +player.worlds, shopItem.priceIncrease / shopItem.price, maxBuyAmount) + buyAmount = buyData.levelCanBuy - player.shopUpgrades[input]; + buyCost = buyData.cost; + } else { + switch (player.shopBuyMaxToggle) { + case false: + buyAmount = 1; + buyCost = getShopCosts(input); + break; + case 'TEN': + buyData = calculateSummationNonLinear(player.shopUpgrades[input], shopItem.price, +player.worlds, shopItem.priceIncrease / shopItem.price, Math.min(10,maxBuyAmount)) + buyAmount = buyData.levelCanBuy - player.shopUpgrades[input]; + buyCost = buyData.cost; + break; + default: + // Buy MAX + buyData = calculateSummationNonLinear(player.shopUpgrades[input], shopItem.price, +player.worlds, shopItem.priceIncrease / shopItem.price, maxBuyAmount) + buyAmount = buyData.levelCanBuy - player.shopUpgrades[input]; + buyCost = buyData.cost; + } } const singular = shopItem.maxLevel === 1; @@ -931,7 +939,7 @@ export const buyShopUpgrades = async (input: ShopUpgradeNames) => { const noRefunds = shopItem.refundable ? '' : '\n\n\u26A0\uFE0F !! No Refunds !! \u26A0\uFE0F'; const maxPots = shopItem.type === shopUpgradeTypes.CONSUMABLE ? '\n\nType -1 in Buy: ANY to buy equal amounts of both Potions.' : ''; - if (player.shopBuyMaxToggle === 'ANY' && !singular) { + if (!singular && (event.shiftKey || player.shopBuyMaxToggle === 'ANY')) { const buyInput = await Prompt(`You can afford to purchase up to ${merch} of ${friendlyShopName(input)} for ${buyCost.toLocaleString()} Quarks. How many would you like to buy?${maxPots + noRefunds}`); let buyAny; if (Number(buyInput) === -1 && shopItem.type === shopUpgradeTypes.CONSUMABLE) { diff --git a/src/Synergism.ts b/src/Synergism.ts index 8b59bb5fd..af42c74b5 100644 --- a/src/Synergism.ts +++ b/src/Synergism.ts @@ -818,6 +818,10 @@ export const player: Player = { dailyCodeUsed: false, hepteractAutoCraftPercentage: 50, octeractTimer: 0, + octeractHideToggle: false, + octeractBuyMaxToggle: 'ONE', + singUpgradeHideToggle: false, + singUpgradeBuyMaxToggle: 'ONE', insideSingularityChallenge: false, singularityChallenges: { @@ -1769,6 +1773,36 @@ const loadSynergy = async () => { } else { DOMCacheGetOrSet('toggleHideShop').textContent = 'Hide Maxed: OFF' } + switch (player.octeractBuyMaxToggle) { + case 'ONE': + DOMCacheGetOrSet('toggleBuyMaxOcteract').textContent = 'Buy: 1'; + break; + case 'MAX': + DOMCacheGetOrSet('toggleBuyMaxOcteract').textContent = 'Buy: MAX'; + break; + case 'ANY': + DOMCacheGetOrSet('toggleBuyMaxOcteract').textContent = 'Buy: ANY'; + } + if (player.octeractHideToggle) { + DOMCacheGetOrSet('toggleHideOcteract').textContent = 'Hide Maxed: ON' + } else { + DOMCacheGetOrSet('toggleHideOcteract').textContent = 'Hide Maxed: OFF' + } + switch (player.singUpgradeBuyMaxToggle) { + case 'ONE': + DOMCacheGetOrSet('toggleBuyMaxSingUpgrade').textContent = 'Buy: 1'; + break; + case 'MAX': + DOMCacheGetOrSet('toggleBuyMaxSingUpgrade').textContent = 'Buy: MAX'; + break; + case 'ANY': + DOMCacheGetOrSet('toggleBuyMaxSingUpgrade').textContent = 'Buy: ANY'; + } + if (player.singUpgradeHideToggle) { + DOMCacheGetOrSet('toggleHideSingUpgrade').textContent = 'Hide Maxed: ON' + } else { + DOMCacheGetOrSet('toggleHideSingUpgrade').textContent = 'Hide Maxed: OFF' + } if (player.researchBuyMaxToggle) { DOMCacheGetOrSet('toggleresearchbuy').textContent = 'Upgrade: MAX [if possible]' } else { diff --git a/src/Toggles.ts b/src/Toggles.ts index ba2f2e70e..84bcb7a34 100644 --- a/src/Toggles.ts +++ b/src/Toggles.ts @@ -1,7 +1,7 @@ import { revealStuff, hideStuff, updateChallengeDisplay, showCorruptionStatsLoadouts, changeTabColor, Prompt, Alert } from './UpdateHTML'; import { player, format, resetCheck } from './Synergism'; import { Globals as G } from './Variables'; -import { visualUpdateCubes, visualUpdateOcteracts } from './UpdateVisuals'; +import { visualUpdateCubes, visualUpdateOcteracts, visualUpdateSingularity } from './UpdateVisuals'; import { calculateRuneLevels } from './Calculate'; import { reset, resetrepeat } from './Reset'; import { autoResearchEnabled } from './Research'; @@ -738,25 +738,24 @@ export const toggleShopConfirmation = () => { player.shopConfirmationToggle = !player.shopConfirmationToggle; } -export const toggleBuyMaxShop = (event: MouseEvent) => { +export const toggleBuyMaxShop = () => { const el = DOMCacheGetOrSet('toggleBuyMaxShop') - if (event.shiftKey) { - el.textContent = 'Buy: ANY'; - player.shopBuyMaxToggle = 'ANY'; - return; - } - const suf = '
Shift-Click for Buy: Any'; + switch (player.shopBuyMaxToggle) { case false: - el.innerHTML = `Buy: 10${suf}`; + el.innerHTML = 'Buy: 10'; player.shopBuyMaxToggle = 'TEN'; break; case 'TEN': - el.innerHTML = `Buy: MAX${suf}`; + el.textContent = 'Buy: ANY'; + player.shopBuyMaxToggle = 'ANY'; + break; + case 'ANY': + el.innerHTML = 'Buy: MAX'; player.shopBuyMaxToggle = true; break; default: - el.innerHTML = `Buy: 1${suf}`; + el.innerHTML = 'Buy: 1'; player.shopBuyMaxToggle = false; } } @@ -770,6 +769,64 @@ export const toggleHideShop = () => { player.shopHideToggle = !player.shopHideToggle; } +export const toggleBuyMaxOcteract = () => { + const el = DOMCacheGetOrSet('toggleBuyMaxOcteract') + + switch (player.octeractBuyMaxToggle) { + case 'ONE': + el.innerHTML = 'Buy: ANY'; + player.octeractBuyMaxToggle = 'ANY'; + break; + case 'ANY': + el.innerHTML = 'Buy: MAX'; + player.octeractBuyMaxToggle = 'MAX'; + break; + case 'MAX': + default: + el.innerHTML = 'Buy: 1'; + player.octeractBuyMaxToggle = 'ONE'; + } +} + +export const toggleHideOcteract = () => { + const el = DOMCacheGetOrSet('toggleHideOcteract') + el.textContent = player.octeractHideToggle + ? 'Hide Maxed: OFF' + : 'Hide Maxed: ON'; + + player.octeractHideToggle = !player.octeractHideToggle; + visualUpdateOcteracts(); +} + +export const toggleBuyMaxSingUpgrade = () => { + const el = DOMCacheGetOrSet('toggleBuyMaxSingUpgrade') + + switch (player.singUpgradeBuyMaxToggle) { + case 'ONE': + el.innerHTML = 'Buy: ANY'; + player.singUpgradeBuyMaxToggle = 'ANY'; + break; + case 'ANY': + el.innerHTML = 'Buy: MAX'; + player.singUpgradeBuyMaxToggle = 'MAX'; + break; + case 'MAX': + default: + el.innerHTML = 'Buy: 1'; + player.singUpgradeBuyMaxToggle = 'ONE'; + } +} + +export const toggleHideSingUpgrade = () => { + const el = DOMCacheGetOrSet('toggleHideSingUpgrade') + el.textContent = player.singUpgradeHideToggle + ? 'Hide Maxed: OFF' + : 'Hide Maxed: ON'; + + player.singUpgradeHideToggle = !player.singUpgradeHideToggle; + visualUpdateSingularity(); +} + export const toggleAntMaxBuy = () => { const el = DOMCacheGetOrSet('toggleAntMax'); el.textContent = player.antMax diff --git a/src/UpdateVisuals.ts b/src/UpdateVisuals.ts index 8fe05450c..734fcd4fc 100644 --- a/src/UpdateVisuals.ts +++ b/src/UpdateVisuals.ts @@ -17,6 +17,7 @@ import type { IMultiBuy } from './Cubes'; import { calculateMaxTalismanLevel } from './Talismans'; import { getGoldenQuarkCost } from './singularity'; import { loadStatisticsUpdate } from './Statistics'; +import { octeractData } from './Octeracts'; export const visualUpdateBuildings = () => { if (G['currentTab'] !== 'buildings') { @@ -549,27 +550,38 @@ export const visualUpdateSingularity = () => { if (G['currentTab'] !== 'singularity') { return } - if (player.subtabNumber === 0) { + if (player.subtabNumber <= 1) { DOMCacheGetOrSet('goldenQuarkamount').textContent = 'You have ' + format(player.goldenQuarks, 0, true) + ' Golden Quarks!' const keys = Object.keys(player.singularityUpgrades) as (keyof Player['singularityUpgrades'])[]; - const val = G['shopEnhanceVision']; - + const enhanceVision = G['shopEnhanceVision']; for (const key of keys) { if (key === 'offeringAutomatic') { - continue + continue; } + + // Check item for Hide const singItem = player.singularityUpgrades[key]; + const elementToHide = DOMCacheGetOrSet(`${key.toString()}`).parentNode as HTMLElement; + const computedMaxLevel = singItem.computeMaxLevel(); + if (player.singUpgradeHideToggle && computedMaxLevel !== -1 && singItem.level >= computedMaxLevel) { + elementToHide.style.display = 'none'; + continue; + } else { + elementToHide.style.display = 'block'; + } + + // Check item for Enhanced vision const el = DOMCacheGetOrSet(`${String(key)}`); if (singItem.maxLevel !== -1 && singItem.level >= singItem.computeMaxLevel()) { - el.style.filter = val ? 'brightness(.9)' : 'none'; + el.style.filter = enhanceVision ? 'brightness(.9)' : 'none'; } else if (singItem.getCostTNL() > player.goldenQuarks || player.singularityCount < singItem.minimumSingularity) { - el.style.filter = val ? 'grayscale(.9) brightness(.8)' : 'none'; + el.style.filter = enhanceVision ? 'grayscale(.9) brightness(.8)' : 'none'; } else if (singItem.maxLevel === -1 || singItem.level < singItem.computeMaxLevel()) { if (singItem.freeLevels > singItem.level) { - el.style.filter = val ? 'blur(1px) invert(.9) saturate(200)' : 'none'; + el.style.filter = enhanceVision ? 'blur(1px) invert(.9) saturate(200)' : 'none'; } else { - el.style.filter = val ? 'invert(.9) brightness(1.1)' : 'none'; + el.style.filter = enhanceVision ? 'invert(.9) brightness(1.1)' : 'none'; } } } @@ -624,6 +636,19 @@ export const visualUpdateOcteracts = () => { DOMCacheGetOrSet('totalOcteractObtainiumBonus').style.display = cTOOOB >= 0.001 ? 'block' : 'none'; DOMCacheGetOrSet('octCubeBonus').textContent = `+${format(cTOCB, 3, true)}%` DOMCacheGetOrSet('octQuarkBonus').textContent = `+${format(cTOQB, 3, true)}%` + + const keys = Object.keys(player.octeractUpgrades) as (keyof Player['octeractUpgrades'])[]; + for (const key of keys) { + const octeractItem = octeractData[key]; + const elementToHide = DOMCacheGetOrSet(`${key.toString()}`).parentNode as HTMLElement; + if (player.octeractHideToggle && octeractItem.maxLevel !== -1 && player.octeractUpgrades[key].level >= octeractItem.maxLevel) { + elementToHide.style.display = 'none'; + continue; + } else { + elementToHide.style.display = 'block'; + } + } + DOMCacheGetOrSet('octOfferingBonus').textContent = `+${format(cTOOB, 3, true)}%` DOMCacheGetOrSet('octObtainiumBonus').textContent = `+${format(cTOOOB, 3, true)}%` } diff --git a/src/singularity.ts b/src/singularity.ts index d74ccaa10..21b0d0b67 100644 --- a/src/singularity.ts +++ b/src/singularity.ts @@ -135,15 +135,21 @@ export class SingularityUpgrade extends DynamicUpgrade { */ public async buyLevel(event: MouseEvent): Promise { let purchased = 0; - let maxPurchasable = 1 - let GQBudget = player.goldenQuarks + let maxPurchasable = 100000; + let GQBudget = player.goldenQuarks; - if (event.shiftKey) { - maxPurchasable = 100000 - const buy = Number(await Prompt(`How many Golden Quarks would you like to spend? You have ${format(player.goldenQuarks, 0, true)} GQ. Type -1 to use max!`)) + if (!event.shiftKey && player.singUpgradeBuyMaxToggle === 'ONE') { + maxPurchasable = 1; + } else { + let buy = -1; + + // Shows a prompt to ask how many GQ to spend + if (event.shiftKey || player.singUpgradeBuyMaxToggle === 'ANY') { + buy = Number(await Prompt(`How many Golden Quarks would you like to spend? You have ${format(player.goldenQuarks, 0, true)} GQ. Type -1 to use max!`)) - if (isNaN(buy) || !isFinite(buy) || !Number.isInteger(buy)) { // nan + Infinity checks - return Alert('Value must be a finite number!'); + if (isNaN(buy) || !isFinite(buy) || !Number.isInteger(buy)) { // nan + Infinity checks + return Alert('Value must be a finite number!'); + } } if (buy === -1) { diff --git a/src/types/Synergism.d.ts b/src/types/Synergism.d.ts index eb70bfe27..a12d5621b 100644 --- a/src/types/Synergism.d.ts +++ b/src/types/Synergism.d.ts @@ -593,12 +593,16 @@ export interface Player { octeractUpgrades: Record dailyCodeUsed: boolean hepteractAutoCraftPercentage: number + + octeractHideToggle: boolean + octeractBuyMaxToggle: 'ONE' | 'MAX' | 'ANY' + singUpgradeHideToggle: boolean + singUpgradeBuyMaxToggle: 'ONE' | 'MAX' | 'ANY' octeractTimer: number insideSingularityChallenge: boolean singularityChallenges: Record - } export interface GlobalVariables {