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