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
23 changes: 11 additions & 12 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3829,9 +3829,6 @@ <h1>Artists</h1>
<img src="Pictures/Default/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/Default/SingularityCurrency1.png">
Expand Down Expand Up @@ -3885,10 +3882,10 @@ <h1>Artists</h1>
<img id="cookies4" alt="cookies4" label="cookies4" src="Pictures/Default/SingularityCookies4.png">
</div>
<div class="singularityUpgrade">
<img id="cookies5" alt="cookies5" label="cookies5" src="Pictures/Default/SingularityCookies5.png" style="cursor: pointer">
<img id="cookies5" alt="cookies5" label="cookies5" src="Pictures/Default/SingularityCookies5.png">
</div>
<div class="singularityUpgrade">
<img id="ascensions" alt="ascensions" label="ascensions" src="Pictures/Default/SingularityAscensions.png" style="cursor:pointer">
<img id="ascensions" alt="ascensions" label="ascensions" src="Pictures/Default/SingularityAscensions.png">
</div>
<div class="singularityUpgrade">
<img id="corruptionFourteen" alt="corruptionFourteen" label="corruptionFourteen" src="Pictures/Default/SingularityCorruption14.png">
Expand Down Expand Up @@ -4014,6 +4011,10 @@ <h1>Artists</h1>
<img id="blueberries" src="Pictures/Default/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 @@ -4047,9 +4048,7 @@ <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/Default/OcteractStarter.png' style="cursor: pointer">
Expand Down Expand Up @@ -4142,11 +4141,13 @@ <h1>Artists</h1>
<img id="octeractAmbrosiaLuck" src="Pictures/Default/OcteractAmbrosiaImprover.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 @@ -4174,8 +4175,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 @@ -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;
Expand All @@ -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;
}
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 @@ -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
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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());
Expand All @@ -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));

Expand All @@ -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));

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 === '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) {
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 @@ -1156,6 +1156,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
40 changes: 24 additions & 16 deletions src/Shop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -910,28 +910,36 @@ 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;
const merch = buyAmount.toLocaleString() + (shopItem.type === shopUpgradeTypes.UPGRADE ? ' level' : ' vial') + (buyAmount === 1 ? '' : 's');
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) {
Expand Down
Loading