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/temp.js

89 lines
2 KiB
JavaScript
Raw Normal View History

var tmp = {}
2020-10-07 22:41:03 +00:00
// Tmp will not call these
var activeFunctions = [
"startData", "onPrestige", "doReset", "update", "automate",
"buy", "buyMax", "respec", "onComplete", "onPurchase", "onPress"
]
2020-10-07 20:41:45 +00:00
function setupTemp() {
tmp = {}
setupTempData(layers, tmp)
2020-09-10 02:44:25 +00:00
for (layer in layers){
tmp[layer].resetGain = {}
tmp[layer].nextAt = {}
tmp[layer].nextAtDisp = {}
tmp[layer].notify = {}
tmp[layer].canReset = {}
tmp[layer].prestigeButtonText = {}
2020-10-09 03:13:15 +00:00
}
}
function setupTempData(layerData, tmpData) {
tmp.pointGen = {}
for (item in layerData){
if (layerData[item] == null) {
tmpData[item] = null
2020-09-14 02:41:42 +00:00
}
else if (Array.isArray(layerData[item])) {
tmpData[item] = []
setupTempData(layerData[item], tmpData[item])
2020-10-03 19:45:47 +00:00
}
else if ((!!layerData[item]) && (layerData[item].constructor === Object)) {
tmpData[item] = {}
setupTempData(layerData[item], tmpData[item])
2020-10-07 20:41:45 +00:00
}
else if (isFunction(layerData[item]) && !activeFunctions.includes(item)){
tmpData[item] = {}
} else {
tmpData[item] = layerData[item]
}
}
}
function updateTemp() {
if (tmp === undefined)
setupTemp()
updateTempData(layers, tmp)
for (layer in layers){
tmp[layer].resetGain = getResetGain(layer)
tmp[layer].nextAt = getNextAt(layer)
tmp[layer].nextAtDisp = getNextAt(layer, true)
tmp[layer].notify = shouldNotify(layer)
tmp[layer].canReset = canReset(layer)
tmp[layer].prestigeButtonText = prestigeButtonText(layer)
}
tmp.pointGen = getPointGen()
}
function updateTempData(layerData, tmpData) {
for (item in layerData){
if (Array.isArray(layerData[item])) {
updateTempData(layerData[item], tmpData[item])
2020-10-03 19:45:47 +00:00
}
else if ((!!layerData[item]) && (layerData[item].constructor === Object)) {
updateTempData(layerData[item], tmpData[item])
2020-10-09 03:13:15 +00:00
}
else if (isFunction(layerData[item]) && !activeFunctions.includes(item)){
tmpData[item] = layerData[item]()
}
}
}
function updateChallTemp(layer)
{
updateTempData(layers[layer].challs, tmp[layer].challs)
}
function updateBuyableTemp(layer)
{
updateTempData(layers[layer].buyables, tmp[layer].buyables)
2020-08-21 19:02:34 +00:00
}