1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-22 08:31:33 +00:00
The-Modding-Tree/js/technical/displays.js

51 lines
2.4 KiB
JavaScript
Raw Normal View History

2021-05-03 02:39:38 +00:00
function prestigeButtonText(layer) {
if (layers[layer].prestigeButtonText !== undefined)
return run(layers[layer].prestigeButtonText(), layers[layer])
if (tmp[layer].type == "normal")
return `${player[layer].points.lt(1e3) ? (tmp[layer].resetDescription !== undefined ? tmp[layer].resetDescription : "Reset for ") : ""}+<b>${formatWhole(tmp[layer].resetGain)}</b> ${tmp[layer].resource} ${tmp[layer].resetGain.lt(100) && player[layer].points.lt(1e3) ? `<br><br>Next at ${(tmp[layer].roundUpCost ? formatWhole(tmp[layer].nextAt) : format(tmp[layer].nextAt))} ${tmp[layer].baseResource}` : ""}`
if (tmp[layer].type == "static")
return `${tmp[layer].resetDescription !== undefined ? tmp[layer].resetDescription : "Reset for "}+<b>${formatWhole(tmp[layer].resetGain)}</b> ${tmp[layer].resource}<br><br>${player[layer].points.lt(30) ? (tmp[layer].baseAmount.gte(tmp[layer].nextAt) && (tmp[layer].canBuyMax !== undefined) && tmp[layer].canBuyMax ? "Next:" : "Req:") : ""} ${formatWhole(tmp[layer].baseAmount)} / ${(tmp[layer].roundUpCost ? formatWhole(tmp[layer].nextAtDisp) : format(tmp[layer].nextAtDisp))} ${tmp[layer].baseResource}
`
if (tmp[layer].type == "none")
return ""
return "You need prestige button text"
}
function constructNodeStyle(layer){
let style = []
if ((tmp[layer].isLayer && layerunlocked(layer)) || (!tmp[layer].isLayer && tmp[layer].canClick))
style.push({'background-color': tmp[layer].color})
if (tmp[layer].image !== undefined)
style.push({'background-image': 'url("' + tmp[layer].image + '")'})
2021-05-06 20:00:47 +00:00
if(tmp[layer].glowColor !== undefined && tmp[layer].notify && player[layer].unlocked)
style.push({'box-shadow': 'var(--hqProperty2a), 0 0 20px ' + tmp[layer].glowColor})
2021-05-03 02:39:38 +00:00
style.push(tmp[layer].nodeStyle)
return style
}
function challengeStyle(layer, id) {
if (player[layer].activeChallenge == id && canCompleteChallenge(layer, id)) return "canComplete"
else if (hasChallenge(layer, id)) return "done"
return "locked"
}
function challengeButtonText(layer, id) {
return (player[layer].activeChallenge==(id)?(canCompleteChallenge(layer, id)?"Finish":"Exit Early"):(hasChallenge(layer, id)?"Completed":"Start"))
}
function achievementStyle(layer, id){
ach = tmp[layer].achievements[id]
let style = []
if (ach.image){
style.push({'background-image': 'url("' + ach.image + '")'})
}
if (!ach.unlocked) style.push({'visibility': 'hidden'})
style.push(ach.style)
return style
}