2020-10-09 23:16:29 -04:00
|
|
|
var tmp = {}
|
2020-10-07 18:41:03 -04:00
|
|
|
|
2020-10-09 23:16:29 -04:00
|
|
|
// Tmp will not call these
|
|
|
|
var activeFunctions = [
|
|
|
|
"startData", "onPrestige", "doReset", "update", "automate",
|
|
|
|
"buy", "buyMax", "respec", "onComplete", "onPurchase", "onPress"
|
|
|
|
]
|
2020-10-07 16:41:45 -04:00
|
|
|
|
2020-10-09 23:16:29 -04:00
|
|
|
function setupTemp() {
|
|
|
|
tmp = {}
|
|
|
|
setupTempData(layers, tmp)
|
2020-09-09 22:44:25 -04:00
|
|
|
|
2020-09-24 11:54:41 -04:00
|
|
|
for (layer in layers){
|
2020-10-09 23:16:29 -04:00
|
|
|
tmp[layer].resetGain = {}
|
|
|
|
tmp[layer].nextAt = {}
|
|
|
|
tmp[layer].nextAtDisp = {}
|
|
|
|
tmp[layer].notify = {}
|
|
|
|
tmp[layer].canReset = {}
|
|
|
|
tmp[layer].prestigeButtonText = {}
|
2020-10-08 23:13:15 -04:00
|
|
|
}
|
2020-10-07 17:00:02 -04:00
|
|
|
}
|
|
|
|
|
2020-10-09 23:16:29 -04:00
|
|
|
function setupTempData(layerData, tmpData) {
|
|
|
|
tmp.pointGen = {}
|
2020-10-07 17:00:02 -04:00
|
|
|
|
2020-10-07 17:13:16 -04:00
|
|
|
|
2020-10-09 23:16:29 -04:00
|
|
|
for (item in layerData){
|
|
|
|
if (layerData[item] == null) {
|
|
|
|
tmpData[item] = null
|
2020-09-13 22:41:42 -04:00
|
|
|
}
|
2020-10-09 23:16:29 -04:00
|
|
|
else if (Array.isArray(layerData[item])) {
|
|
|
|
tmpData[item] = []
|
|
|
|
setupTempData(layerData[item], tmpData[item])
|
2020-10-03 15:45:47 -04:00
|
|
|
}
|
2020-10-09 23:16:29 -04:00
|
|
|
else if ((!!layerData[item]) && (layerData[item].constructor === Object)) {
|
|
|
|
tmpData[item] = {}
|
|
|
|
setupTempData(layerData[item], tmpData[item])
|
2020-10-07 16:41:45 -04:00
|
|
|
}
|
2020-10-09 23:16:29 -04:00
|
|
|
else if (isFunction(layerData[item]) && !activeFunctions.includes(item)){
|
|
|
|
tmpData[item] = {}
|
|
|
|
} else {
|
|
|
|
tmpData[item] = layerData[item]
|
2020-10-07 17:13:16 -04:00
|
|
|
}
|
2020-10-09 23:16:29 -04:00
|
|
|
}
|
2020-10-07 17:13:16 -04:00
|
|
|
}
|
|
|
|
|
2020-10-09 23:16:29 -04:00
|
|
|
function updateTemp() {
|
|
|
|
if (tmp === undefined)
|
|
|
|
setupTemp()
|
2020-10-07 17:13:16 -04:00
|
|
|
|
2020-10-09 23:16:29 -04:00
|
|
|
updateTempData(layers, tmp)
|
2020-10-07 17:13:16 -04:00
|
|
|
|
2020-10-09 23:16:29 -04:00
|
|
|
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)
|
2020-10-07 17:13:16 -04:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-10-09 23:16:29 -04:00
|
|
|
tmp.pointGen = getPointGen()
|
2020-10-07 17:13:16 -04:00
|
|
|
}
|
|
|
|
|
2020-10-09 23:16:29 -04:00
|
|
|
function updateTempData(layerData, tmpData) {
|
2020-10-07 17:13:16 -04:00
|
|
|
|
2020-10-09 23:16:29 -04:00
|
|
|
for (item in layerData){
|
|
|
|
if (Array.isArray(layerData[item])) {
|
|
|
|
updateTempData(layerData[item], tmpData[item])
|
2020-10-03 15:45:47 -04:00
|
|
|
}
|
2020-10-09 23:16:29 -04:00
|
|
|
else if ((!!layerData[item]) && (layerData[item].constructor === Object)) {
|
|
|
|
updateTempData(layerData[item], tmpData[item])
|
2020-10-08 23:13:15 -04:00
|
|
|
}
|
2020-10-09 23:16:29 -04:00
|
|
|
else if (isFunction(layerData[item]) && !activeFunctions.includes(item)){
|
|
|
|
tmpData[item] = layerData[item]()
|
|
|
|
}
|
|
|
|
}
|
2020-08-21 15:02:34 -04:00
|
|
|
}
|