Skip to content

Instantly share code, notes, and snippets.

@carlank
Last active January 2, 2021 08:30
Show Gist options
  • Save carlank/3fbe54fa002c3c90d1bd9696337a871a to your computer and use it in GitHub Desktop.
Save carlank/3fbe54fa002c3c90d1bd9696337a871a to your computer and use it in GitHub Desktop.
QoL mods for Progress Knight
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