2020-10-09 23:16:29 -04:00
|
|
|
var tmp = {}
|
2020-12-03 23:19:14 -05:00
|
|
|
var temp = tmp // Proxy for tmp
|
2021-01-25 14:44:54 -05:00
|
|
|
var funcs = {}
|
2020-10-27 17:41:35 -04:00
|
|
|
var NaNalert = false;
|
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",
|
2021-05-10 18:18:02 -04:00
|
|
|
"buy", "buyMax", "respec", "onPress", "onClick", "onHold", "masterButtonPress",
|
2021-04-30 22:08:25 -04:00
|
|
|
"sellOne", "sellAll", "pay", "actualCostFunction", "actualEffectFunction",
|
2021-05-02 22:39:38 -04:00
|
|
|
"effectDescription", "display", "fullDisplay", "effectDisplay", "rewardDisplay",
|
2021-05-09 18:39:12 -04:00
|
|
|
"tabFormat", "content",
|
2021-06-02 16:45:05 -04:00
|
|
|
"onComplete", "onPurchase", "onEnter", "onExit", "done",
|
2021-05-11 22:13:14 -04:00
|
|
|
"getUnlocked", "getStyle", "getCanClick", "getTitle", "getDisplay"
|
2020-10-09 23:16:29 -04:00
|
|
|
]
|
2020-10-07 16:41:45 -04:00
|
|
|
|
2020-10-17 00:21:59 -04:00
|
|
|
var noCall = doNotCallTheseFunctionsEveryTick
|
|
|
|
for (item in noCall) {
|
|
|
|
activeFunctions.push(noCall[item])
|
|
|
|
}
|
|
|
|
|
2020-11-30 21:58:42 -05:00
|
|
|
// Add the names of classes to traverse
|
|
|
|
var traversableClasses = []
|
|
|
|
|
2020-10-09 23:16:29 -04:00
|
|
|
function setupTemp() {
|
|
|
|
tmp = {}
|
2020-10-17 17:04:38 -04:00
|
|
|
tmp.pointGen = {}
|
2021-06-06 23:51:50 -04:00
|
|
|
tmp.backgroundStyle = {}
|
2020-10-17 17:04:38 -04:00
|
|
|
tmp.displayThings = []
|
2021-01-24 19:05:01 -05:00
|
|
|
tmp.scrolled = 0
|
2021-01-25 14:44:54 -05:00
|
|
|
funcs = {}
|
2021-01-24 19:05:01 -05:00
|
|
|
|
2021-01-25 14:44:54 -05:00
|
|
|
setupTempData(layers, tmp, funcs)
|
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].canReset = {}
|
2020-11-07 23:34:53 -05:00
|
|
|
tmp[layer].notify = {}
|
|
|
|
tmp[layer].prestigeNotify = {}
|
2020-12-16 21:20:00 -05:00
|
|
|
tmp[layer].computedNodeStyle = []
|
2021-04-30 22:08:25 -04:00
|
|
|
setupBuyables(layer)
|
2021-05-07 19:24:32 -04:00
|
|
|
tmp[layer].trueGlowColor = []
|
2020-10-08 23:13:15 -04:00
|
|
|
}
|
2021-05-06 15:45:03 -04:00
|
|
|
|
|
|
|
tmp.other = {
|
2021-05-10 20:19:29 -04:00
|
|
|
lastPoints: player.points || decimalZero,
|
|
|
|
oomps: decimalZero,
|
2021-05-17 21:51:36 -04:00
|
|
|
screenWidth: 0,
|
|
|
|
screenHeight: 0,
|
2021-05-06 15:45:03 -04:00
|
|
|
}
|
|
|
|
|
2021-05-10 18:27:37 -04:00
|
|
|
updateWidth()
|
2021-05-07 00:16:22 -04:00
|
|
|
|
2020-12-03 23:19:14 -05:00
|
|
|
temp = tmp
|
2020-10-07 17:00:02 -04:00
|
|
|
}
|
|
|
|
|
2021-06-14 01:37:12 -04:00
|
|
|
const boolNames = ["unlocked", "deactivated"]
|
|
|
|
|
2021-01-25 14:44:54 -05:00
|
|
|
function setupTempData(layerData, tmpData, funcsData) {
|
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-11 14:49:29 -04:00
|
|
|
else if (layerData[item] instanceof Decimal)
|
|
|
|
tmpData[item] = layerData[item]
|
2020-10-09 23:16:29 -04:00
|
|
|
else if (Array.isArray(layerData[item])) {
|
|
|
|
tmpData[item] = []
|
2021-01-25 14:44:54 -05:00
|
|
|
funcsData[item] = []
|
|
|
|
setupTempData(layerData[item], tmpData[item], funcsData[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] = {}
|
2021-01-25 14:44:54 -05:00
|
|
|
funcsData[item] = []
|
|
|
|
setupTempData(layerData[item], tmpData[item], funcsData[item])
|
2020-10-07 16:41:45 -04:00
|
|
|
}
|
2020-11-30 21:58:42 -05:00
|
|
|
else if ((!!layerData[item]) && (typeof layerData[item] === "object") && traversableClasses.includes(layerData[item].constructor.name)) {
|
|
|
|
tmpData[item] = new layerData[item].constructor()
|
2021-01-25 14:44:54 -05:00
|
|
|
funcsData[item] = new layerData[item].constructor()
|
2020-11-30 21:58:42 -05:00
|
|
|
}
|
2020-10-09 23:16:29 -04:00
|
|
|
else if (isFunction(layerData[item]) && !activeFunctions.includes(item)){
|
2021-01-25 14:44:54 -05:00
|
|
|
funcsData[item] = layerData[item]
|
2021-06-14 01:37:12 -04:00
|
|
|
if (boolNames.includes(item))
|
|
|
|
tmpData[item] = false
|
|
|
|
else
|
|
|
|
tmpData[item] = decimalOne // The safest thing to put probably?
|
2020-10-09 23:16:29 -04:00
|
|
|
} 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
|
|
|
}
|
|
|
|
|
2021-06-02 17:39:19 -04:00
|
|
|
|
2020-10-09 23:16:29 -04:00
|
|
|
function updateTemp() {
|
|
|
|
if (tmp === undefined)
|
|
|
|
setupTemp()
|
2020-10-07 17:13:16 -04:00
|
|
|
|
2021-01-25 14:44:54 -05:00
|
|
|
updateTempData(layers, tmp, funcs)
|
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].canReset = canReset(layer)
|
2021-05-07 19:24:32 -04:00
|
|
|
tmp[layer].trueGlowColor = tmp[layer].glowColor
|
2020-11-07 23:34:53 -05:00
|
|
|
tmp[layer].notify = shouldNotify(layer)
|
|
|
|
tmp[layer].prestigeNotify = prestigeNotify(layer)
|
2021-06-08 19:39:23 -04:00
|
|
|
if (tmp[layer].passiveGeneration === true) tmp[layer].passiveGeneration = 1 // new Decimal(true) = decimalZero
|
2021-06-02 17:39:19 -04:00
|
|
|
|
2020-10-07 17:13:16 -04:00
|
|
|
}
|
|
|
|
|
2020-10-09 23:16:29 -04:00
|
|
|
tmp.pointGen = getPointGen()
|
2021-06-06 23:51:50 -04:00
|
|
|
tmp.backgroundStyle = readData(backgroundStyle)
|
|
|
|
|
2020-10-17 17:04:38 -04:00
|
|
|
tmp.displayThings = []
|
|
|
|
for (thing in displayThings){
|
|
|
|
let text = displayThings[thing]
|
|
|
|
if (isFunction(text)) text = text()
|
|
|
|
tmp.displayThings.push(text)
|
|
|
|
}
|
2020-10-07 17:13:16 -04:00
|
|
|
}
|
|
|
|
|
2021-06-01 14:56:33 -04:00
|
|
|
function updateTempData(layerData, tmpData, funcsData, useThis) {
|
2021-01-25 14:44:54 -05:00
|
|
|
for (item in funcsData){
|
2020-10-09 23:16:29 -04:00
|
|
|
if (Array.isArray(layerData[item])) {
|
2021-05-19 12:30:02 -04:00
|
|
|
if (item !== "tabFormat" && item !== "content") // These are only updated when needed
|
2021-06-01 14:56:33 -04:00
|
|
|
updateTempData(layerData[item], tmpData[item], funcsData[item], useThis)
|
2020-10-03 15:45:47 -04:00
|
|
|
}
|
2020-11-30 21:58:42 -05:00
|
|
|
else if ((!!layerData[item]) && (layerData[item].constructor === Object) || (typeof layerData[item] === "object") && traversableClasses.includes(layerData[item].constructor.name)){
|
2021-06-01 14:56:33 -04:00
|
|
|
updateTempData(layerData[item], tmpData[item], funcsData[item], useThis)
|
2020-10-08 23:13:15 -04:00
|
|
|
}
|
2021-01-21 17:52:09 -05:00
|
|
|
else if (isFunction(layerData[item]) && !isFunction(tmpData[item])){
|
2021-06-01 14:56:33 -04:00
|
|
|
let value
|
|
|
|
|
|
|
|
if (useThis !== undefined) value = layerData[item].bind(useThis)()
|
|
|
|
else value = layerData[item]()
|
2021-05-07 09:47:25 -04:00
|
|
|
Vue.set(tmpData, item, value)
|
2020-10-09 23:16:29 -04:00
|
|
|
}
|
|
|
|
}
|
2020-10-10 21:52:27 -04:00
|
|
|
}
|
|
|
|
|
2020-10-12 23:08:19 -04:00
|
|
|
function updateChallengeTemp(layer)
|
2020-10-10 21:52:27 -04:00
|
|
|
{
|
2021-01-25 14:44:54 -05:00
|
|
|
updateTempData(layers[layer].challenges, tmp[layer].challenges, funcs[layer].challenges)
|
2020-12-03 23:19:14 -05:00
|
|
|
}
|
|
|
|
|
2020-10-10 21:52:27 -04:00
|
|
|
|
|
|
|
function updateBuyableTemp(layer)
|
|
|
|
{
|
2021-01-25 14:44:54 -05:00
|
|
|
updateTempData(layers[layer].buyables, tmp[layer].buyables, funcs[layer].buyables)
|
2020-10-11 16:16:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
function updateClickableTemp(layer)
|
|
|
|
{
|
2021-01-25 14:44:54 -05:00
|
|
|
updateTempData(layers[layer].clickables, tmp[layer].clickables, funcs[layer].clickables)
|
2020-10-12 18:28:12 -04:00
|
|
|
}
|
|
|
|
|
2021-04-30 22:08:25 -04:00
|
|
|
function setupBuyables(layer) {
|
|
|
|
for (id in layers[layer].buyables) {
|
2021-05-13 01:44:40 -04:00
|
|
|
if (isPlainObject(layers[layer].buyables[id])) {
|
2021-04-30 22:08:25 -04:00
|
|
|
let b = layers[layer].buyables[id]
|
|
|
|
b.actualCostFunction = b.cost
|
|
|
|
b.cost = function(x) {
|
2021-05-09 18:39:12 -04:00
|
|
|
x = (x === undefined ? player[this.layer].buyables[this.id] : x)
|
2021-04-30 22:08:25 -04:00
|
|
|
return layers[this.layer].buyables[this.id].actualCostFunction(x)
|
|
|
|
}
|
|
|
|
b.actualEffectFunction = b.effect
|
|
|
|
b.effect = function(x) {
|
2021-05-09 18:39:12 -04:00
|
|
|
x = (x === undefined ? player[this.layer].buyables[this.id] : x)
|
2021-04-30 22:08:25 -04:00
|
|
|
return layers[this.layer].buyables[this.id].actualEffectFunction(x)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-06-02 17:39:19 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
function checkDecimalNaN(x) {
|
|
|
|
return (x instanceof Decimal) && !x.eq(x)
|
2020-08-21 15:02:34 -04:00
|
|
|
}
|