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

Auto hept ratios #281

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2549,6 +2549,7 @@
<button id="chronosHepteractCraftMax" alt="chronosHepteractCraftMax" label="chronosHepteractCraftMax">Max</button>
<button id="chronosHepteractCap" alt="chronosHepteractCap" label="chronosHepteractCap">Expand</button>
<button class="singularity" id="chronosHepteractAuto" alt="chronosHepteractAuto" label="chronosHepteractAuto">Auto ON</button>
<button id="chronosHepteractAutoRatio" alt="chronosHepteractAutoRatio" label="chronosHepteractAutoRatio" style="border: 2px solid green">Ratio</button>
<div class="meter">
<span class="progressText" id="chronosProgressBarText" alt="chronosProgressBarText" label="chronosProgressBarText">/</span>
<span style="width: 25%" class="progressBar" id="chronosProgressBar" alt="chronosProgressBar" label="chronosProgressBar"></span>
Expand All @@ -2560,6 +2561,7 @@
<button id="hyperrealismHepteractCraftMax" alt="hyperrealismHepteractCraftMax" label="hyperrealismHepteractCraftMax">Max</button>
<button id="hyperrealismHepteractCap" alt="hyperrealismHepteractCap" label="hyperrealismHepteractCap">Expand</button>
<button class="singularity" id="hyperrealismHepteractAuto" alt="hyperrealismHepteractAuto" label="hyperrealismHepteractAuto">Auto ON</button>
<button id="hyperrealismHepteractAutoRatio" alt="hyperrealismHepteractAutoRatio" label="hyperrealismHepteractAutoRatio" style="border: 2px solid green">Ratio</button>
<div class="meter">
<span class="progressText" id="hyperrealismProgressBarText" alt="hyperrealismProgressBarText" label="hyperrealismProgressBarText">/</span>
<span class="progressBar" id="hyperrealismProgressBar" alt="hyperrealismProgressBar" label="hyperrealismProgressBar"></span>
Expand All @@ -2571,6 +2573,7 @@
<button id="quarkHepteractCraftMax" alt="quarkHepteractCraftMax" label="quarkHepteractCraftMax">Max</button>
<button id="quarkHepteractCap" alt="quarkHepteractCap" label="quarkHepteractCap">Expand</button>
<button class="singularity" id="quarkHepteractAuto" alt="quarkHepteractAuto" label="quarkHepteractAuto">Auto ON</button>
<button id="quarkHepteractAutoRatio" alt="quarkHepteractAutoRatio" label="quarkHepteractAutoRatio" style="border: 2px solid green">Ratio</button>
<div class="meter">
<span class="progressText" id="quarkProgressBarText" alt="quarkProgressBarText" label="quarkProgressBarText">/</span>
<span style="width: 25%" class="progressBar" id="quarkProgressBar" alt="quarkProgressBar" label="quarkProgressBar"></span>
Expand All @@ -2582,6 +2585,7 @@
<button id="challengeHepteractCraftMax" alt="challengeHepteractCraftMax" label="challengeHepteractCraftMax">Max</button>
<button id="challengeHepteractCap" alt="challengeHepteractCap" label="challengeHepteractCap">Expand</button>
<button class="singularity" id="challengeHepteractAuto" alt="challengeHepteractAuto" label="challengeHepteractAuto">Auto ON</button>
<button id="challengeHepteractAutoRatio" alt="challengeHepteractAutoRatio" label="challengeHepteractAutoRatio" style="border: 2px solid green">Ratio</button>
<div class="meter">
<span class="progressText" id="challengeProgressBarText" alt="challengeProgressBarText" label="challengeProgressBarText">/</span>
<span style="width: 25%" class="progressBar" id="challengeProgressBar" alt="challengeProgressBar" label="challengeProgressBar"></span>
Expand All @@ -2593,6 +2597,7 @@
<button id="abyssHepteractCraftMax" alt="abyssHepteractCraftMax" label="abyssHepteractCraftMax">Max</button>
<button id="abyssHepteractCap" alt="abyssHepteractCap" label="abyssHepteractCap">Expand</button>
<button class="singularity" id="abyssHepteractAuto" alt="abyssHepteractAuto" label="abyssHepteractAuto">Auto ON</button>
<button id="abyssHepteractAutoRatio" alt="abyssHepteractAutoRatio" label="abyssHepteractAutoRatio" style="border: 2px solid green">Ratio</button>
<div class="meter">
<span class="progressText" id="abyssProgressBarText" alt="abyssProgressBarText" label="abyssProgressBarText">/</span>
<span style="width: 25%" class="progressBar" id="abyssProgressBar" alt="abyssProgressBar" label="abyssProgressBar"></span>
Expand All @@ -2604,6 +2609,7 @@
<button id="acceleratorHepteractCraftMax" alt="acceleratorHepteractCraftMax" label="acceleratorHepteractCraftMax">Max</button>
<button id="acceleratorHepteractCap" alt="acceleratorHepteractCap" label="acceleratorHepteractCap">Expand</button>
<button class="singularity" id="acceleratorHepteractAuto" alt="acceleratorHepteractAuto" label="acceleratorHepteractAuto">Auto ON</button>
<button id="acceleratorHepteractAutoRatio" alt="acceleratorHepteractAutoRatio" label="acceleratorHepteractAutoRatio" style="border: 2px solid green">Ratio</button>
<div class="meter">
<span class="progressText" id="acceleratorProgressBarText" alt="acceleratorProgressBarText" label="acceleratorProgressBarText">/</span>
<span style="width: 25%" class="progressBar" id="acceleratorProgressBar" alt="acceleratorProgressBar" label="acceleratorProgressBar"></span>
Expand All @@ -2615,6 +2621,7 @@
<button id="acceleratorBoostHepteractCraftMax" alt="acceleratorBoostHepteractCraftMax" label="acceleratorBoostHepteractCraftMax">Max</button>
<button id="acceleratorBoostHepteractCap" alt="acceleratorBoostHepteractCap" label="acceleratorBoostHepteractCap">Expand</button>
<button class="singularity" id="acceleratorBoostHepteractAuto" alt="acceleratorBoostHepteractAuto" label="acceleratorBoostHepteractAuto">Auto ON</button>
<button id="acceleratorBoostHepteractAutoRatio" alt="acceleratorBoostHepteractAutoRatio" label="acceleratorBoostHepteractAutoRatio" style="border: 2px solid green">Ratio</button>
<div class="meter">
<span class="progressText" id="acceleratorBoostProgressBarText" alt="acceleratorBoostProgressBarText" label="acceleratorBoostProgressBarText">/</span>
<span style="width: 25%" class="progressBar" id="acceleratorBoostProgressBar" alt="acceleratorBoostProgressBar" label="acceleratorBoostProgressBar"></span>
Expand All @@ -2626,6 +2633,7 @@
<button id="multiplierHepteractCraftMax" alt="multiplierHepteractCraftMax" label="multiplierHepteractCraftMax">Max</button>
<button id="multiplierHepteractCap" alt="multiplierHepteractCap" label="multiplierHepteractCap">Expand</button>
<button class="singularity" id="multiplierHepteractAuto" alt="multiplierHepteractAuto" label="multiplierHepteractAuto">Auto ON</button>
<button id="multiplierHepteractAutoRatio" alt="multiplierHepteractAutoRatio" label="multiplierHepteractAutoRatio" style="border: 2px solid green">Ratio</button>
<div class="meter">
<span class="progressText" id="multiplierProgressBarText" alt="multiplierProgressBarText" label="multiplierProgressBarText">/</span>
<span style="width: 25%" class="progressBar" id="multiplierProgressBar" alt="multiplierProgressBar" label="multiplierProgressBar"></span>
Expand Down Expand Up @@ -2660,6 +2668,8 @@
<span class="heptGridInventoryValue" style="color:orange;" id="heptGridPowderWarps" alt="heptGridPowderWarps" label="heptGridPowderWarps">1</span>
</span>
</div>
<div class="singularity"><!--Blank Grid Tile-->Auto Setting ----- Ratio: <span id="autoHepteractRatios" style="color: lightgoldenrodyellow;"></span>
</div>
</div>

<div id="hepteractCraftTexts" alt="hepteractCraftTexts" label="hepteractCraftTexts">
Expand Down
12 changes: 11 additions & 1 deletion 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, toggleCorruptionLevel, toggleAutoAscend, toggleShopConfirmation, toggleAutoResearchMode, toggleBuyMaxShop, toggleHideShop, toggleHepteractAutoPercentage } 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, toggleCorruptionLevel, toggleAutoAscend, toggleShopConfirmation, toggleAutoResearchMode, toggleBuyMaxShop, toggleHideShop, toggleHepteractAutoPercentage, updateAutoChronosRatio, updateAutoHyperrealismRatio, updateAutoQuarkRatio, updateAutoChallengeRatio, updateAutoAbyssRatio, updateAutoAcceleratorRatio, updateAutoAcceleratorBoostRatio, updateAutoMultiplierRatio } from './Toggles'
import { resetrepeat, updateAutoReset, updateTesseractAutoBuyAmount } from './Reset'
import { player, resetCheck, saveSynergy } from './Synergism'
import { boostAccelerator, buyAccelerator, buyMultiplier, buyProducer, buyCrystalUpgrades, buyParticleBuilding, buyTesseractBuilding, buyUpgrades, buyRuneBonusLevels, buyAllBlessings } from './Buy'
Expand Down Expand Up @@ -545,6 +545,16 @@ export const generateEventHandlers = () => {

DOMCacheGetOrSet('hepteractAutoPercentageButton').addEventListener('click', () => toggleHepteractAutoPercentage())

// Auto hept Ratios inputs
DOMCacheGetOrSet('chronosHepteractAutoRatio').addEventListener('click', () => updateAutoChronosRatio())
DOMCacheGetOrSet('hyperrealismHepteractAutoRatio').addEventListener('click', () => updateAutoHyperrealismRatio())
DOMCacheGetOrSet('quarkHepteractAutoRatio').addEventListener('click', () => updateAutoQuarkRatio())
DOMCacheGetOrSet('challengeHepteractAutoRatio').addEventListener('click', () => updateAutoChallengeRatio())
DOMCacheGetOrSet('abyssHepteractAutoRatio').addEventListener('click', () => updateAutoAbyssRatio())
DOMCacheGetOrSet('acceleratorHepteractAutoRatio').addEventListener('click', () => updateAutoAcceleratorRatio())
DOMCacheGetOrSet('acceleratorBoostHepteractAutoRatio').addEventListener('click', () => updateAutoAcceleratorBoostRatio())
DOMCacheGetOrSet('multiplierHepteractAutoRatio').addEventListener('click', () => updateAutoMultiplierRatio())

// CORRUPTION TAB
//Part 0: Subtabs
DOMCacheGetOrSet('corrStatsBtn').addEventListener('click', () => toggleSubTab(9, 0))
Expand Down
32 changes: 27 additions & 5 deletions src/Hepteracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,18 +259,18 @@ export class HepteractCraft {
toggleAutomatic(newValue?: boolean): Promise<void> | HepteractCraft {
const HTML = DOMCacheGetOrSet(`${this.HTML_STRING}HepteractAuto`);

// When newValue is empty, current value is toggled
this.AUTO = newValue ?? !this.AUTO;

HTML.textContent = `Auto ${this.AUTO ? 'ON' : 'OFF'}`;
HTML.style.border = `2px solid ${this.AUTO ? 'green' : 'red'}`;
DOMCacheGetOrSet(`${this.HTML_STRING}HepteractCraft`).style.display = this.AUTO ? 'none' : 'block'
DOMCacheGetOrSet(`${this.HTML_STRING}HepteractAutoRatio`).style.display = this.AUTO ? 'block' : 'none'

return this;
}

autoCraft(heptAmount: number): HepteractCraft {
const expandMultiplier = 2;

// Calculate the largest craft amount possible, with an upper limit being craftAmount
const hepteractLimitCraft = Math.floor((heptAmount / this.HEPTERACT_CONVERSION) * 1 / (1 - this.DISCOUNT));

Expand All @@ -282,11 +282,33 @@ export class HepteractCraft {
itemLimits.push(Math.floor((player[item as keyof Player] as number) / this.OTHER_CONVERSIONS[item as keyof Player]!) * 1 / (1 - this.DISCOUNT))
}
}

// Get the largest ratio from hepts
let largestRatio = player.hepteractAutoCraftRatios.chronos
for (const item of Object.entries(player.hepteractAutoCraftRatios)){
if (largestRatio < item[1]){
largestRatio = item[1];
}
}
// Get the smallest of the array we created [If Empty, this will be infinite]
const smallestItemLimit = Math.min(...itemLimits);

let amountToCraft = Math.min(smallestItemLimit, hepteractLimitCraft);
let amountToCraft;
if (this.HTML_STRING === 'chronos'){
amountToCraft = Math.min(smallestItemLimit, hepteractLimitCraft) * (player.hepteractAutoCraftRatios.chronos / largestRatio);
} else if (this.HTML_STRING === 'hyperreal'){
amountToCraft = Math.min(smallestItemLimit, hepteractLimitCraft) * (player.hepteractAutoCraftRatios.hyperreal / largestRatio);
} else if (this.HTML_STRING === 'quark'){
amountToCraft = Math.min(smallestItemLimit, hepteractLimitCraft) * (player.hepteractAutoCraftRatios.quark / largestRatio);
} else if (this.HTML_STRING === 'challenge'){
amountToCraft = Math.min(smallestItemLimit, hepteractLimitCraft) * (player.hepteractAutoCraftRatios.challenge / largestRatio);
} else if (this.HTML_STRING === 'abyss'){
amountToCraft = Math.min(smallestItemLimit, hepteractLimitCraft) * (player.hepteractAutoCraftRatios.abyss / largestRatio);
} else if (this.HTML_STRING === 'accelerator'){
amountToCraft = Math.min(smallestItemLimit, hepteractLimitCraft) * (player.hepteractAutoCraftRatios.accelerator / largestRatio);
} else if (this.HTML_STRING === 'acceleratorBoost'){
amountToCraft = Math.min(smallestItemLimit, hepteractLimitCraft) * (player.hepteractAutoCraftRatios.acceleratorBoost / largestRatio);
} else {
amountToCraft = Math.min(smallestItemLimit, hepteractLimitCraft) * (player.hepteractAutoCraftRatios.multiplier / largestRatio);
}
let amountCrafted = 0
if (amountToCraft >= this.CAP - this.BAL) {
this.BAL = this.CAP
Expand Down
2 changes: 2 additions & 0 deletions src/Reset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,8 @@ export const singularity = async (): Promise<void> => {
toggleSubTab(9, 0); // set 'corruption main'
toggleSubTab(-1, 0); // set 'statistics main'

hold.hepteractAutoCraftPercentage = player.hepteractAutoCraftPercentage
hold.hepteractAutoCraftRatios = player.hepteractAutoCraftRatios
hold.singularityCount = player.singularityCount;
hold.goldenQuarks = player.goldenQuarks;
hold.shopUpgrades = player.shopUpgrades;
Expand Down
16 changes: 15 additions & 1 deletion src/Synergism.ts
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,17 @@ export const player: Player = {
singQuarkHepteract3: new SingularityUpgrade(singularityData['singQuarkHepteract3'])
},
dailyCodeUsed: false,
hepteractAutoCraftPercentage: 50
hepteractAutoCraftPercentage: 50,
hepteractAutoCraftRatios: {
chronos: 1,
hyperrealism: 1,
quark: 1,
challenge: 1,
abyss: 1,
accelerator: 1,
acceleratorBoost: 1,
multiplier: 1
}
}

export const blankSave = Object.assign({}, player, {
Expand Down Expand Up @@ -1613,6 +1623,10 @@ const loadSynergy = async () => {

DOMCacheGetOrSet('autoHepteractPercentage').textContent = `${player.hepteractAutoCraftPercentage}`

DOMCacheGetOrSet('autoHepteractRatios').textContent = `${player.hepteractAutoCraftRatios.chronos}` + `${player.hepteractAutoCraftRatios.hyperrealism}`
+ `${player.hepteractAutoCraftRatios.quark}` + `${player.hepteractAutoCraftRatios.challenge}` + `${player.hepteractAutoCraftRatios.abyss}`
+ `${player.hepteractAutoCraftRatios.accelerator}` + `${player.hepteractAutoCraftRatios.acceleratorBoost}` + `${player.hepteractAutoCraftRatios.multiplier}`

toggleTalismanBuy(player.buyTalismanShardPercent);
updateTalismanInventory();
calculateObtainium();
Expand Down