1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-26 02:01:41 +00:00
The-Modding-Tree/js/temp.js

154 lines
5.4 KiB
JavaScript
Raw Normal View History

2020-08-21 19:02:34 +00:00
function updateTemp() {
if (!tmp.challActive) {tmp.challActive = {}}
2020-10-03 19:45:47 +00:00
if (!tmp.challs) tmp.challs = {}
for (layer in layers) {
if(layers[layer].challs !== undefined){
tmp.challActive[layer] = {}
updateChallTemp(layer)
2020-09-01 00:39:33 +00:00
}
}
2020-10-03 19:45:47 +00:00
if (!tmp.upgrades) tmp.upgrades = {}
for (layer in layers) {
if(layers[layer].upgrades !== undefined){
updateUpgradeTemp(layer)
}
}
2020-09-01 00:39:33 +00:00
2020-10-03 19:45:47 +00:00
if (!tmp.milestones) tmp.milestones = {}
for (layer in layers) {
if(layers[layer].milestones !== undefined){
updateMilestoneTemp(layer)
}
}
2020-08-21 19:02:34 +00:00
if (!tmp.layerEffs) tmp.layerEffs = {}
for (layer in layers) if (layers[layer].effect) tmp.layerEffs[layer] = layers[layer].effect()
2020-08-21 19:02:34 +00:00
if (!tmp.layerReqs) tmp.layerReqs = {}
for (layer in layers) tmp.layerReqs[layer] = layers[layer].requires()
if (!tmp.buyables) tmp.buyables = {}
for (layer in layers) if (layers[layer].buyables) {
2020-10-03 19:45:47 +00:00
if(layers[layer].buyables !== undefined){
updateBuyableTemp(layer)
}
}
2020-08-21 19:02:34 +00:00
if (!tmp.gainMults) tmp.gainMults = {}
2020-09-13 02:38:32 +00:00
if (!tmp.gainExp) tmp.gainExp = {}
2020-08-21 19:02:34 +00:00
if (!tmp.resetGain) tmp.resetGain = {}
if (!tmp.nextAt) tmp.nextAt = {}
2020-08-22 01:16:23 +00:00
if (!tmp.layerAmt) tmp.layerAmt = {}
2020-10-03 19:45:47 +00:00
if (!tmp.layerColor) tmp.layerColor = {}
if (!tmp.layerShown) tmp.layerShown = {}
if (!tmp.effectDescription) tmp.effectDescription = {}
if (!tmp.style) tmp.style = {}
if (!tmp.notify) tmp.notify = {}
if (!tmp.nextAtDisp) tmp.nextAtDisp = {}
if (!tmp.prestigeButtonText) tmp.prestigeButtonText = {}
if (!tmp.canReset) tmp.canReset = {}
for (layer in layers) {
2020-10-03 19:45:47 +00:00
if (layers[layer].color) tmp.layerColor[layer] = layers[layer].color()
if (layers[layer].style) tmp.style[layer] = layers[layer].style()
tmp.layerShown[layer] = layers[layer].layerShown()
tmp.layerAmt[layer] = layers[layer].baseAmount()
tmp.gainMults[layer] = layers[layer].gainMult()
tmp.gainExp[layer] = layers[layer].gainExp()
tmp.resetGain[layer] = getResetGain(layer)
tmp.nextAt[layer] = getNextAt(layer)
tmp.notify[layer] = shouldNotify(layer)
tmp.nextAtDisp[layer] = getNextAt(layer, true)
2020-10-03 19:45:47 +00:00
if (layers[layer].effectDescription) tmp.effectDescription[layer] = layers[layer].effectDescription()
if (layers[layer].canReset) tmp.canReset[layer] = layers[layer].canReset()
if (layers[layer].prestigeButtonText) tmp.prestigeButtonText[layer] = layers[layer].prestigeButtonText()
2020-10-03 19:45:47 +00:00
2020-08-21 19:02:34 +00:00
}
2020-09-10 02:44:25 +00:00
2020-08-21 19:02:34 +00:00
tmp.pointGen = getPointGen()
2020-09-10 02:44:25 +00:00
for (layer in layers){
if (layers[layer].updateTemp) layers[layer].updateTemp()
2020-09-14 02:41:42 +00:00
}
}
function updateChallTemp(layer) {
if (player[layer] === undefined) return
2020-10-03 19:45:47 +00:00
if (!tmp.challs[layer]) tmp.challs[layer] = {}
2020-09-14 02:41:42 +00:00
let data = tmp.challActive[layer]
let data2 = layers[layer].challs
2020-09-14 02:41:42 +00:00
let customActive = data2.active !== undefined
for (let row = 1; row <= data2.rows; row++) {
for (let col = 1; col <= data2.cols; col++) {
let id = row * 10 + col
2020-10-03 19:45:47 +00:00
tmp.challs[layer][id] = {}
tmp.challs[layer][id].unl = data2[id].unl()
if(data2[id].name) tmp.challs[layer][id].name = data2[id].name()
if(data2[id].desc) tmp.challs[layer][id].desc = data2[id].desc()
if(data2[id].reward) tmp.challs[layer][id].reward = data2[id].reward()
if(data2[id].effect) tmp.challs[layer][id].effect = data2[id].effect()
if(data2[id].effectDisplay) tmp.challs[layer][id].effectDisplay = data2[id].effectDisplay(tmp.challs[layer][id].effect)
tmp.challs[layer][id].goal = data2[id].goal()
2020-09-14 02:41:42 +00:00
if (customActive ? data2.active(id) : player[layer].active == id) data[id] = 1
else delete data[id]
}
2020-09-13 02:38:32 +00:00
}
2020-10-03 19:45:47 +00:00
}
function updateUpgradeTemp(layer) {
2020-10-03 20:47:56 +00:00
if (layers[layer] === undefined) return
2020-10-03 19:45:47 +00:00
if (!tmp.upgrades[layer]) tmp.upgrades[layer] = {}
let data2 = layers[layer].upgrades
for (let row = 1; row <= data2.rows; row++) {
for (let col = 1; col <= data2.cols; col++) {
let id = row * 10 + col
tmp.upgrades[layer][id] = {}
tmp.upgrades[layer][id].unl = data2[id].unl()
if(data2[id].title) tmp.upgrades[layer][id].title = data2[id].title()
if(data2[id].effect) tmp.upgrades[layer][id].effect = data2[id].effect()
if(data2[id].effectDisplay) tmp.upgrades[layer][id].effectDisplay = data2[id].effectDisplay(tmp.upgrades[layer][id].effect)
if(data2[id].desc) tmp.upgrades[layer][id].desc = data2[id].desc()
tmp.upgrades[layer][id].cost = data2[id].cost()
}
}
}
function updateMilestoneTemp(layer) {
2020-10-03 20:47:56 +00:00
if (layers[layer] === undefined) return
2020-10-03 19:45:47 +00:00
if (!tmp.milestones[layer]) tmp.milestones[layer] = {}
let data2 = layers[layer].milestones
for (id in data2) {
tmp.milestones[layer][id] = {}
tmp.milestones[layer][id].done = data2[id].done()
if(data2[id].requirementDesc) tmp.milestones[layer][id].requirementDesc = data2[id].requirementDesc()
if(data2[id].effectDesc) tmp.milestones[layer][id].effectDesc = data2[id].effectDesc()
}
}
function updateBuyableTemp(layer) {
2020-10-03 20:47:56 +00:00
if (layers[layer] === undefined) return
2020-10-03 19:45:47 +00:00
if (!tmp.buyables[layer]) tmp.buyables[layer] = {}
let data2 = layers[layer].buyables
if(data2.respecText) tmp.buyables[layer].respecText = data2.respecText()
for (let row = 1; row <= data2.rows; row++) {
for (let col = 1; col <= data2.cols; col++) {
let id = row * 10 + col
let amt = player[layer].buyables[id]
tmp.buyables[layer][id] = {}
tmp.buyables[layer][id].unl = data2[id].unl()
if(data2[id].effect) tmp.buyables[layer][id].effect = data2[id].effect(amt)
tmp.buyables[layer][id].cost = data2[id].cost(amt)
tmp.buyables[layer][id].canAfford = data2[id].canAfford()
if(data2[id].title) tmp.buyables[layer][id].title = data2[id].title()
if(data2[id].display) tmp.buyables[layer][id].display = data2[id].display()
}
}
2020-08-21 19:02:34 +00:00
}