Last active
January 2, 2021 08:30
-
-
Save carlank/3fbe54fa002c3c90d1bd9696337a871a to your computer and use it in GitHub Desktop.
QoL mods for Progress Knight
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const timeDisplay = document.createElement('div'); | |
const modUpdate = () => { | |
const losingMoney = getIncome() < getExpense(); | |
if(losingMoney){ | |
const daysUntilBankrupt = Math.floor(gameData.coins / getNet()); | |
const ageString = `Age ${daysToYears(gameData.days + daysUntilBankrupt)} Day ${(getDay() + daysUntilBankrupt)%365 + 1 }`; | |
timeDisplay.textContent = `${daysUntilBankrupt} days until bankruptcy\n(until ${ageString})`; | |
} else { | |
timeDisplay.textContent = ''; | |
} | |
}; | |
document.getElementById('netDisplay').parentElement.append(timeDisplay); | |
/* interval delay is based on the game's update interval */ | |
setInterval(modUpdate, 1000 / updateSpeed); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment