Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide max buy multi octeracts #416

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
8 changes: 6 additions & 2 deletions Synergism.css
Original file line number Diff line number Diff line change
Expand Up @@ -1929,7 +1929,9 @@ p#reincarnatehotkeys {
margin-top: 20px;
}

#shopButtons {
#shopButtons,
#octeractButtons,
#singUpgradeButtons {
display: flex;
justify-content: center;
flex-flow: wrap;
Expand All @@ -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;
Expand Down
28 changes: 14 additions & 14 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3784,9 +3784,6 @@ <h1>Artists</h1>
<img src="Pictures/GoldenQuark.png" width="32px" height="32px" loading="lazy">
<p id="goldenQuarkamount" alt="goldenQuarkamount" label="goldenQuarkamount">You have 0 Golden Quarks!</p>
</div>
<div id="goldenQuarksMultiBuyInfo">
<p id="goldenQuarkMultiBuyText">Buy multiple levels at once by holding <span class="orchidText">'SHIFT'</span> while clicking!</p>
</div>
<div class="boxColor" id="actualSingularityUpgradeContainer" alt="actualSingularityUpgradeContainer" label="actualSingularityUpgradeContainer">
<div class="singularityUpgrade">
<img id="goldenQuarks1" alt="goldenQuarks1" label="goldenQuarks1" src="Pictures/SingularityCurrency1.png">
Expand Down Expand Up @@ -3840,10 +3837,11 @@ <h1>Artists</h1>
<img id="cookies4" alt="cookies4" label="cookies4" src="Pictures/SingularityCookies4.png">
</div>
<div class="singularityUpgrade">
<img id="cookies5" alt="cookies5" label="cookies5" src="Pictures/SingularityCookies5.png" style="cursor: pointer">
<img id="cookies5" alt="cookies5" label="cookies5" src="Pictures/SingularityCookies5.png">
</div>
<div class="singularityUpgrade">
<img id="ascensions" alt="ascensions" label="ascensions" src="Pictures/SingularityAscensions.png" style="cursor:pointer"> </div>
<img id="ascensions" alt="ascensions" label="ascensions" src="Pictures/SingularityAscensions.png" style="cursor:pointer">
</div>
<div class="singularityUpgrade">
<img id="corruptionFourteen" alt="corruptionFourteen" label="corruptionFourteen" src="Pictures/SingularityCorruption14.png">
</div>
Expand Down Expand Up @@ -3968,6 +3966,10 @@ <h1>Artists</h1>
<img id="blueberries" src="Pictures/SingularityBlueBerry.png" style="cursor: pointer">
</div>
</div>
<div id="singUpgradeButtons" alt="singUpgradesButtons" label="singUpgradesButtons">
<button id="toggleHideSingUpgrade" alt="toggleHideSingUpgrade" label="toggleHideSingUpgrade" style="border: 2px solid white">Hide Maxed: OFF</button>
<button id="toggleBuyMaxSingUpgrade" alt="toggleBuyMaxSingUpgrade" label="toggleBuyMaxSingUpgrade" style="border: 2px solid white">Buy: 1</button>
</div>
</div>
<div id="singularityUpgradeShit" alt="singularityUpgradeShit" label="singularityUpgradeShit">
<p id="testingMultiline" alt="testingMultiline" label="testingMultiline"></p>
Expand Down Expand Up @@ -4001,12 +4003,10 @@ <h1>Artists</h1>
<p id="totalOcteractOfferingBonus" alt="totalOcteractOfferingBonus">Offerings <span id="octOfferingBonus" style="color: orange">+4%</span></p>
<p id="totalOcteractObtainiumBonus" alt="totalOcteractObtainiumBonus">Obtainium <span id="octObtainiumBonus" style="color: pink">+4%</span></p>
</div>
<div id="octeractsMultiBuyInfo">
<p id="octeractMultiBuyText">Buy multiple levels at once by holding <span class="orchidText">'SHIFT'</span> while clicking!</p>
</div>

<div class="boxColor" id="octeractUpgradeContainer" alt="octeractUpgradeContainer" label="octeractUpgradeContainer">
<div class="octeractUpgrade">
<img id="octeractStarter" src='Pictures/OcteractStarter.png' style="cursor: pointer">
<img id="octeractStarter" src='Pictures/OcteractStarter.png'>
</div>
<div class="octeractUpgrade">
<img id="octeractGain" src='Pictures/OcteractOcteracts.png' style="cursor: pointer">
Expand All @@ -4021,7 +4021,7 @@ <h1>Artists</h1>
<img id="octeractQuarkGain2" src="Pictures/OcteractQuarks2.png" style="cursor: pointer">
</div>
<div class="octeractUpgrade">
<img id="octeractCorruption" src="Pictures/OcteractCorruptions.png" style="cursor: pointer">
<img id="octeractCorruption" src="Pictures/OcteractCorruptions.png">
</div>
<div class="octeractUpgrade">
<img id="octeractGQCostReduce" src="Pictures/OcteractGoldenQuarkCost.png" style="cursor: pointer">
Expand Down Expand Up @@ -4093,11 +4093,13 @@ <h1>Artists</h1>
<img id="octeractOneMindImprover" src="Pictures/OcteractOneMindImprover.png" style="cursor: pointer">
</div>
</div>

<div id="octeractButtons" alt="octeractButtons" label="octeractButtons">
<button id="toggleHideOcteract" alt="toggleHideOcteract" label="toggleHideOcteract" style="border: 2px solid white">Hide Maxed: OFF</button>
<button id="toggleBuyMaxOcteract" alt="toggleBuyMaxOcteract" label="toggleBuyMaxOcteract" style="border: 2px solid white">Buy: 1</button>
</div>
<div id="octeractUpgradeValues" alt="octeractUpgradeValues" label="octeractUpgradeValues">
<p id="singularityOcteractsMultiline" alt="singularityOcteractsMultiline" label="singularityOcteractsMultiline"></p>
</div>

</div>
</div>

Expand Down Expand Up @@ -4125,8 +4127,6 @@ <h1>Artists</h1>
</div>
</div>
</div>


</div>
</body>
</html>
16 changes: 16 additions & 0 deletions src/CheckVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,14 @@ export const checkVariablesOnLoad = (data: PlayerSave) => {
player.shopConfirmationToggle = true;
}

if (data.octeractBuyMaxToggle === undefined) {
player.octeractBuyMaxToggle = false;
}

if (data.singUpgradeBuyMaxToggle === undefined) {
player.singUpgradeBuyMaxToggle = false;
}

if (data.wowOcteracts === undefined) {
player.wowOcteracts = 0;
player.octeractTimer = 0;
Expand All @@ -836,6 +844,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;
}
Expand Down
20 changes: 12 additions & 8 deletions src/EventListeners.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -585,7 +585,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
Expand All @@ -594,8 +594,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;
Expand All @@ -605,8 +604,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;
Expand All @@ -619,8 +617,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());
Expand All @@ -633,6 +630,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));

Expand All @@ -643,6 +644,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));

Expand Down
34 changes: 20 additions & 14 deletions src/Octeracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,31 @@ export class OcteractUpgrade extends DynamicUpgrade {
*/
public async buyLevel(event: MouseEvent): Promise<void> {
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 === false) {
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) {
Expand All @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions src/Reset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,10 @@ export const singularity = async (setSingNumber = -1): Promise<void> => {
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
Expand Down
Loading