2020-10-10 03:16:29 +00:00
|
|
|
var tmp = {}
|
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",
|
2020-10-17 19:50:30 +00:00
|
|
|
"buy", "buyMax", "respec", "onComplete", "onPurchase", "onPress", "onClick", "masterButtonPress",
|
|
|
|
"sellOne", "sellAll",
|
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-10-10 03:16:29 +00:00
|
|
|
function setupTemp() {
|
|
|
|
tmp = {}
|
|
|
|
setupTempData(layers, tmp)
|
2020-09-10 02:44:25 +00:00
|
|
|
|
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].notify = {}
|
|
|
|
tmp[layer].canReset = {}
|
|
|
|
tmp[layer].prestigeButtonText = {}
|
2020-10-12 22:28:12 +00:00
|
|
|
setupBarStyles(layer)
|
2020-10-09 03:13:15 +00:00
|
|
|
}
|
2020-10-07 21:00:02 +00:00
|
|
|
}
|
|
|
|
|
2020-10-10 03:16:29 +00:00
|
|
|
function setupTempData(layerData, tmpData) {
|
|
|
|
tmp.pointGen = {}
|
2020-10-07 21:00:02 +00:00
|
|
|
|
2020-10-07 21:13:16 +00:00
|
|
|
|
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] = []
|
|
|
|
setupTempData(layerData[item], tmpData[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] = {}
|
|
|
|
setupTempData(layerData[item], tmpData[item])
|
2020-10-07 20:41:45 +00:00
|
|
|
}
|
2020-10-10 03:16:29 +00:00
|
|
|
else if (isFunction(layerData[item]) && !activeFunctions.includes(item)){
|
2020-10-11 18:49:29 +00:00
|
|
|
tmpData[item] = new Decimal(1) // 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
|
|
|
}
|
|
|
|
|
2020-10-10 03:16:29 +00:00
|
|
|
function updateTemp() {
|
|
|
|
if (tmp === undefined)
|
|
|
|
setupTemp()
|
2020-10-07 21:13:16 +00:00
|
|
|
|
2020-10-10 03:16:29 +00:00
|
|
|
updateTempData(layers, tmp)
|
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].notify = shouldNotify(layer)
|
|
|
|
tmp[layer].canReset = canReset(layer)
|
|
|
|
tmp[layer].prestigeButtonText = prestigeButtonText(layer)
|
2020-10-12 22:28:12 +00:00
|
|
|
constructBarStyles(layer)
|
2020-10-07 21:13:16 +00:00
|
|
|
}
|
|
|
|
|
2020-10-10 03:16:29 +00:00
|
|
|
tmp.pointGen = getPointGen()
|
2020-10-07 21:13:16 +00:00
|
|
|
}
|
|
|
|
|
2020-10-10 03:16:29 +00:00
|
|
|
function updateTempData(layerData, tmpData) {
|
2020-10-11 18:49:29 +00:00
|
|
|
|
2020-10-10 03:16:29 +00:00
|
|
|
for (item in layerData){
|
|
|
|
if (Array.isArray(layerData[item])) {
|
|
|
|
updateTempData(layerData[item], tmpData[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)) {
|
|
|
|
updateTempData(layerData[item], tmpData[item])
|
2020-10-09 03:13:15 +00:00
|
|
|
}
|
2020-10-10 03:16:29 +00:00
|
|
|
else if (isFunction(layerData[item]) && !activeFunctions.includes(item)){
|
2020-10-11 18:49:29 +00:00
|
|
|
Vue.set(tmpData, item, layerData[item]())
|
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
|
|
|
{
|
2020-10-13 03:08:19 +00:00
|
|
|
updateTempData(layers[layer].challenges, tmp[layer].challenges)
|
2020-10-11 01:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function updateBuyableTemp(layer)
|
|
|
|
{
|
|
|
|
updateTempData(layers[layer].buyables, tmp[layer].buyables)
|
2020-10-11 20:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function updateClickableTemp(layer)
|
|
|
|
{
|
|
|
|
updateTempData(layers[layer].clickables, tmp[layer].clickables)
|
2020-10-12 22:28:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var DIR_MARGINS = ["margin-bottom", "margin-top", "margin-right", "margin-left"]
|
|
|
|
|
|
|
|
function constructBarStyles(layer){
|
|
|
|
if (layers[layer].bars === undefined)
|
|
|
|
return
|
|
|
|
for (id in layers[layer].bars){
|
|
|
|
if (id !== "layer") {
|
|
|
|
let bar = tmp[layer].bars[id]
|
|
|
|
if (bar.progress instanceof Decimal)
|
|
|
|
bar.progress = bar.progress.toNumber()
|
2020-10-16 22:45:44 +00:00
|
|
|
bar.progress = (1 -Math.min(Math.max(bar.progress, 0), 1)) * 100
|
2020-10-13 03:28:02 +00:00
|
|
|
|
2020-10-12 22:28:12 +00:00
|
|
|
bar.dims = {'width': bar.width + "px", 'height': bar.height + "px"}
|
|
|
|
let dir = bar.direction
|
2020-10-16 22:45:44 +00:00
|
|
|
bar.fillDims = {'width': (bar.width + 0.5) + "px", 'height': (bar.height + 0.5) + "px"}
|
2020-10-12 22:28:12 +00:00
|
|
|
if (dir !== undefined)
|
|
|
|
{
|
2020-10-16 22:45:44 +00:00
|
|
|
bar.fillDims['clip-path'] = 'inset(0% 50% 0% 0%)'
|
|
|
|
if(dir == UP){
|
|
|
|
bar.fillDims['clip-path'] = 'inset(' + bar.progress + '% 0% 0% 0%)'
|
|
|
|
}
|
|
|
|
else if(dir == DOWN){
|
|
|
|
bar.fillDims['clip-path'] = 'inset(0% 0% ' + bar.progress + '% 0%)'
|
|
|
|
}
|
|
|
|
else if(dir == RIGHT){
|
|
|
|
bar.fillDims['clip-path'] = 'inset(0% ' + bar.progress + '% 0% 0%)'
|
|
|
|
}
|
|
|
|
else if(dir == LEFT){
|
|
|
|
bar.fillDims['clip-path'] = 'inset(0% 0% 0% ' + bar.progress + '%)'
|
|
|
|
}
|
|
|
|
|
2020-10-12 22:28:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function setupBarStyles(layer){
|
|
|
|
if (layers[layer].bars === undefined)
|
|
|
|
return
|
|
|
|
for (id in layers[layer].bars){
|
|
|
|
let bar = tmp[layer].bars[id]
|
|
|
|
bar.dims = {}
|
|
|
|
let dir = bar.direction
|
|
|
|
bar.fillDims = {}
|
|
|
|
}
|
2020-08-21 19:02:34 +00:00
|
|
|
}
|