Skip to content

Commit

Permalink
add bribe code (#587)
Browse files Browse the repository at this point in the history
  • Loading branch information
KhafraDev authored Apr 1, 2024
1 parent 8deb074 commit 661e8fd
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 12 deletions.
18 changes: 9 additions & 9 deletions src/Hepteracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,17 +223,17 @@ export class HepteractCraft {
player.wowAbyssals = 0
}

for (const item in this.OTHER_CONVERSIONS) {
if (typeof player[item as keyof Player] === 'number') {
;(player[item as keyof Player] as number) -= amountToCraft * craftCostMulti
* this.OTHER_CONVERSIONS[item as keyof Player]!
for (const item of (Object.keys(this.OTHER_CONVERSIONS) as (keyof Player)[])) {
if (typeof player[item] === 'number') {
;(player[item] as number) -= amountToCraft * craftCostMulti
* this.OTHER_CONVERSIONS[item]!
}

if ((player[item as keyof Player] as number) < 0) {
;(player[item as keyof Player] as number) = 0
} else if (player[item as keyof Player] instanceof Cube) {
;(player[item as keyof Player] as Cube).sub(
amountToCraft * craftCostMulti * this.OTHER_CONVERSIONS[item as keyof Player]!
if ((player[item] as number) < 0) {
;(player[item] as number) = 0
} else if (player[item] instanceof Cube) {
;(player[item] as Cube).sub(
amountToCraft * craftCostMulti * this.OTHER_CONVERSIONS[item]!
)
} else if (item === 'worlds') {
player.worlds.sub(amountToCraft * this.OTHER_CONVERSIONS[item]!)
Expand Down
17 changes: 17 additions & 0 deletions src/ImportExport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,23 @@ export const promocodes = async (input: string | null, amount?: number) => {
el.textContent = i18next.t('importexport.promocodes.khafra', {
x: player.worlds.applyBonus(quarks)
})
} else if (input === 'alonso bribe' && !player.codes.get(47)) {
const craft = player.hepteractCrafts.quark

if (!craft.UNLOCKED) {
return Alert(i18next.t('importexport.promocodes.bribe.notUnlocked'))
}

const cap = craft.computeActualCap()

if (cap <= craft.BAL + 1) {
return Alert(i18next.t('importexport.promocodes.bribe.overCapacity'))
}

player.codes.set(47, true)
craft.BAL++

return Alert(i18next.t('importexport.promocodes.bribe.thanks'))
} else if (input.toLowerCase() === 'daily' && !player.dailyCodeUsed) {
player.dailyCodeUsed = true
let rewardMessage = i18next.t('importexport.promocodes.daily.message')
Expand Down
2 changes: 1 addition & 1 deletion src/Synergism.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ export const player: Player = {
subtabNumber: 0,

// create a Map with keys defaulting to false
codes: new Map(Array.from({ length: 46 }, (_, i) => [i + 1, false])),
codes: new Map(Array.from({ length: 47 }, (_, i) => [i + 1, false])),

loaded1009: true,
loaded1009hotfix1: true,
Expand Down
7 changes: 6 additions & 1 deletion translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3413,7 +3413,12 @@
"moreThan1": "You will gain {{x}} Octeracts (when they come out) every second, assuming you have them unlocked!",
"one": "You will gain an Octeract (when they come out) every {{x}} seconds, assuming you have them unlocked!"
},
"invalid": "Your code is either invalid or already used. Try again!"
"invalid": "Your code is either invalid or already used. Try again!",
"bribe": {
"notUnlocked": "Hmmm... you aren't ready yet.",
"overCapacity": "You can't hold more!",
"thanks": "Thank Alonso (in Discord) for the bribe."
}
}
},
"toggles": {
Expand Down
7 changes: 6 additions & 1 deletion translations/source.json
Original file line number Diff line number Diff line change
Expand Up @@ -3385,7 +3385,12 @@
"moreThan1": "You will gain {{x}} Octeracts (when they come out) every second, assuming you have them unlocked!",
"one": "You will gain an Octeract (when they come out) every {{x}} seconds, assuming you have them unlocked!"
},
"invalid": "Your code is either invalid or already used. Try again!"
"invalid": "Your code is either invalid or already used. Try again!",
"bribe": {
"notUnlocked": "Hmmm... you aren't ready yet.",
"overCapacity": "You can't hold more!",
"thanks": "Thank Alonso (in Discord) for the bribe."
}
}
},
"toggles": {
Expand Down

0 comments on commit 661e8fd

Please sign in to comment.