Merge pull request #577 from DanielNoord/hotfix/dev

Fix missing upgrades display on dev branch
This commit is contained in:
Daniël van Noord authored and GitHub committed 2021-02-18 21:34:07 +01:00
commit cfb7659c1f
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -1 +1 @@
const CM={Backup:{},Cache:{},Config:{},ConfigData:{},Data:{},Disp:{},Footer:{},Main:{},Options:{},Sim:{},VersionMajor:"2.031",VersionMinor:"3"};CM.Cache.InitCache=function(){CM.Cache.CacheDragonAuras();CM.Cache.CacheWrinklers();CM.Cache.CacheStats();CM.Cache.RemakeChain();CM.Cache.CacheMissingUpgrades()};CM.Cache.CacheDragonAuras=function(){CM.Cache.dragonAura=Game.dragonAura;CM.Cache.dragonAura2=Game.dragonAura2};CM.Cache.CacheWrinklers=function(){CM.Cache.WrinklersTotal=0;CM.Cache.WrinklersNormal=0;CM.Cache.WrinklersFattest=[0,null];for(let i;i<Game.wrinklers.length;i++){var sucked=Game.wrinklers[i].sucked;var toSuck=1.1;if(Game.Has("Sacrilegious corruption"))toSuck*=1.05;if(Game.wrinklers[i].type==1)toSuck*=3;sucked*=toSuck;if(Game.Has("Wrinklerspawn"))sucked*=1.05;if(CM.Sim.Objects.Temple.minigameLoaded){var godLvl=CM.Sim.hasGod("scorn");if(godLvl==1)sucked*=1.15;else if(godLvl==2)sucked*=1.1;else if(godLvl==3)sucked*=1.05}CM.Cache.WrinklersTotal+=sucked;if(Game.wrinklers[i].type==0){CM.Cache.WrinklersNormal+=sucked;if(sucked>CM.Cache.WrinklersFattest[0])CM.Cache.WrinklersFattest=[sucked,i]}}};CM.Cache.CacheStats=function(){CM.Cache.Lucky=CM.Cache.NoGoldSwitchCookiesPS*900/.15;CM.Cache.Lucky*=CM.Cache.DragonsFortuneMultAdjustment;let cpsBuffMult=CM.Sim.getCPSBuffMult();if(cpsBuffMult>0)CM.Cache.Lucky/=cpsBuffMult;else CM.Cache.Lucky=0;CM.Cache.LuckyReward=CM.Cache.GoldenCookiesMult*(CM.Cache.Lucky*.15)+13;CM.Cache.LuckyWrathReward=CM.Cache.WrathCookiesMult*(CM.Cache.Lucky*.15)+13;CM.Cache.LuckyFrenzy=CM.Cache.Lucky*7;CM.Cache.LuckyRewardFrenzy=CM.Cache.GoldenCookiesMult*(CM.Cache.LuckyFrenzy*.15)+13;CM.Cache.LuckyWrathRewardFrenzy=CM.Cache.WrathCookiesMult*(CM.Cache.LuckyFrenzy*.15)+13;CM.Cache.Conjure=CM.Cache.Lucky*2;CM.Cache.ConjureReward=CM.Cache.Conjure*.15;CM.Cache.Edifice=0;let max=0;let n=0;for(let i of Object.keys(Game.Objects)){if(Game.Objects[i].amount>max)max=Game.Objects[i].amount;if(Game.Objects[i].amount>0)n++}for(let i of Object.keys(Game.Objects)){if((Game.Objects[i].amount<max||n==1)&&Game.Objects[i].amount<400&&Game.Objects[i].price*2>CM.Cache.Edifice){CM.Cache.Edifice=Game.Objects[i].price*2;CM.Cache.EdificeBuilding=i}}};CM.Cache.MaxChainMoni=function(digit,maxPayout,mult){var chain=1+Math.max(0,Math.ceil(Math.log(Game.cookies)/Math.LN10)-10);var moni=Math.max(digit,Math.min(Math.floor(1/9*Math.pow(10,chain)*digit*mult),maxPayout));var nextMoni=Math.max(digit,Math.min(Math.floor(1/9*Math.pow(10,chain+1)*digit*mult),maxPayout));while(nextMoni<maxPayout){chain++;moni=Math.max(digit,Math.min(Math.floor(1/9*Math.pow(10,chain)*digit*mult),maxPayout));nextMoni=Math.max(digit,Math.min(Math.floor(1/9*Math.pow(10,chain+1)*digit*mult),maxPayout))}return[moni,nextMoni]};CM.Cache.RemakeChain=function(){let maxPayout=CM.Cache.NoGoldSwitchCookiesPS*60*60*6*CM.Cache.DragonsFortuneMultAdjustment;let cpsBuffMult=CM.Sim.getCPSBuffMult();if(cpsBuffMult>0)maxPayout/=cpsBuffMult;else maxPayout=0;CM.Cache.ChainReward=CM.Cache.MaxChainMoni(7,maxPayout,CM.Cache.GoldenCookiesMult);CM.Cache.ChainRequired=CM.Cache.ChainReward[0]*2;CM.Cache.ChainRequiredNext=CM.Cache.ChainReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainWrathReward=CM.Cache.MaxChainMoni(6,maxPayout,CM.Cache.WrathCookiesMult);CM.Cache.ChainWrathRequired=CM.Cache.ChainWrathReward[0]*2;CM.Cache.ChainWrathRequiredNext=CM.Cache.ChainWrathReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainFrenzyReward=CM.Cache.MaxChainMoni(7,maxPayout*7,CM.Cache.GoldenCookiesMult);CM.Cache.ChainFrenzyRequired=CM.Cache.ChainFrenzyReward[0]*2;CM.Cache.ChainFrenzyRequiredNext=CM.Cache.ChainFrenzyReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainFrenzyWrathReward=CM.Cache.MaxChainMoni(6,maxPayout*7,CM.Cache.WrathCookiesMult);CM.Cache.ChainFrenzyWrathRequired=CM.Cache.ChainFrenzyReward[0]*2;CM.Cache.ChainFrenzyWrathRequiredNext=CM.Cache.ChainFrenzyReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment};CM.Cache.CacheMissingUpgrades=function(){CM.Cache.MissingUpgrades="";CM.Cache.MissingUpgradesCookies="";CM.Cache.MissingUpgradesPrestige="";var list=[];for(let i of Object.keys(Game.Upgrades)){list.push(Game.Upgrades[i])}var sortMap=function(a,b){if(a.order>b.order)return 1;else if(a.order<b.order)return-1;else return 0};list.sort(sortMap);for(let i of Object.keys(list)){var me=list[i];if(me.bought==0){var str="";str+=CM.Disp.crateMissing(me);if(me.pool=="prestige")CM.Cache.MissingUpgradesPrestige+=str;else if(me.pool=="cookie")CM.Cache.MissingUpgradesCookies+=str;else if(me.pool!="toggle"&&me.pool!="unused"&&me.pool!="debug")CM.Cache.MissingUpgrades+=str}}};class CMAvgQueue{constructor(maxLength){this.maxLength=maxLength;this.queue=[]}addLatest(newValue){if(this.queue.push(newValue)>this.maxLength){this.queue.shift()}}calcAverage(timePeriod){if(timePeriod>this.maxLength)timePeriod=this.maxLength;if(timePeriod>this.queue.length)timePeriod=this.queue.length;var ret=0;for(let i=this.queue.length-1;i>=0&&i>this.queuLine truncated
const CM={Backup:{},Cache:{},Config:{},ConfigData:{},Data:{},Disp:{},Footer:{},Main:{},Options:{},Sim:{},VersionMajor:"2.031",VersionMinor:"3"};CM.Cache.InitCache=function(){CM.Cache.CacheDragonAuras();CM.Cache.CacheWrinklers();CM.Cache.CacheStats();CM.Cache.RemakeChain();CM.Cache.CacheMissingUpgrades()};CM.Cache.CacheDragonAuras=function(){CM.Cache.dragonAura=Game.dragonAura;CM.Cache.dragonAura2=Game.dragonAura2};CM.Cache.CacheWrinklers=function(){CM.Cache.WrinklersTotal=0;CM.Cache.WrinklersNormal=0;CM.Cache.WrinklersFattest=[0,null];for(let i;i<Game.wrinklers.length;i++){var sucked=Game.wrinklers[i].sucked;var toSuck=1.1;if(Game.Has("Sacrilegious corruption"))toSuck*=1.05;if(Game.wrinklers[i].type==1)toSuck*=3;sucked*=toSuck;if(Game.Has("Wrinklerspawn"))sucked*=1.05;if(CM.Sim.Objects.Temple.minigameLoaded){var godLvl=CM.Sim.hasGod("scorn");if(godLvl==1)sucked*=1.15;else if(godLvl==2)sucked*=1.1;else if(godLvl==3)sucked*=1.05}CM.Cache.WrinklersTotal+=sucked;if(Game.wrinklers[i].type==0){CM.Cache.WrinklersNormal+=sucked;if(sucked>CM.Cache.WrinklersFattest[0])CM.Cache.WrinklersFattest=[sucked,i]}}};CM.Cache.CacheStats=function(){CM.Cache.Lucky=CM.Cache.NoGoldSwitchCookiesPS*900/.15;CM.Cache.Lucky*=CM.Cache.DragonsFortuneMultAdjustment;let cpsBuffMult=CM.Sim.getCPSBuffMult();if(cpsBuffMult>0)CM.Cache.Lucky/=cpsBuffMult;else CM.Cache.Lucky=0;CM.Cache.LuckyReward=CM.Cache.GoldenCookiesMult*(CM.Cache.Lucky*.15)+13;CM.Cache.LuckyWrathReward=CM.Cache.WrathCookiesMult*(CM.Cache.Lucky*.15)+13;CM.Cache.LuckyFrenzy=CM.Cache.Lucky*7;CM.Cache.LuckyRewardFrenzy=CM.Cache.GoldenCookiesMult*(CM.Cache.LuckyFrenzy*.15)+13;CM.Cache.LuckyWrathRewardFrenzy=CM.Cache.WrathCookiesMult*(CM.Cache.LuckyFrenzy*.15)+13;CM.Cache.Conjure=CM.Cache.Lucky*2;CM.Cache.ConjureReward=CM.Cache.Conjure*.15;CM.Cache.Edifice=0;let max=0;let n=0;for(let i of Object.keys(Game.Objects)){if(Game.Objects[i].amount>max)max=Game.Objects[i].amount;if(Game.Objects[i].amount>0)n++}for(let i of Object.keys(Game.Objects)){if((Game.Objects[i].amount<max||n==1)&&Game.Objects[i].amount<400&&Game.Objects[i].price*2>CM.Cache.Edifice){CM.Cache.Edifice=Game.Objects[i].price*2;CM.Cache.EdificeBuilding=i}}};CM.Cache.MaxChainMoni=function(digit,maxPayout,mult){var chain=1+Math.max(0,Math.ceil(Math.log(Game.cookies)/Math.LN10)-10);var moni=Math.max(digit,Math.min(Math.floor(1/9*Math.pow(10,chain)*digit*mult),maxPayout));var nextMoni=Math.max(digit,Math.min(Math.floor(1/9*Math.pow(10,chain+1)*digit*mult),maxPayout));while(nextMoni<maxPayout){chain++;moni=Math.max(digit,Math.min(Math.floor(1/9*Math.pow(10,chain)*digit*mult),maxPayout));nextMoni=Math.max(digit,Math.min(Math.floor(1/9*Math.pow(10,chain+1)*digit*mult),maxPayout))}return[moni,nextMoni]};CM.Cache.RemakeChain=function(){let maxPayout=CM.Cache.NoGoldSwitchCookiesPS*60*60*6*CM.Cache.DragonsFortuneMultAdjustment;let cpsBuffMult=CM.Sim.getCPSBuffMult();if(cpsBuffMult>0)maxPayout/=cpsBuffMult;else maxPayout=0;CM.Cache.ChainReward=CM.Cache.MaxChainMoni(7,maxPayout,CM.Cache.GoldenCookiesMult);CM.Cache.ChainRequired=CM.Cache.ChainReward[0]*2;CM.Cache.ChainRequiredNext=CM.Cache.ChainReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainWrathReward=CM.Cache.MaxChainMoni(6,maxPayout,CM.Cache.WrathCookiesMult);CM.Cache.ChainWrathRequired=CM.Cache.ChainWrathReward[0]*2;CM.Cache.ChainWrathRequiredNext=CM.Cache.ChainWrathReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainFrenzyReward=CM.Cache.MaxChainMoni(7,maxPayout*7,CM.Cache.GoldenCookiesMult);CM.Cache.ChainFrenzyRequired=CM.Cache.ChainFrenzyReward[0]*2;CM.Cache.ChainFrenzyRequiredNext=CM.Cache.ChainFrenzyReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainFrenzyWrathReward=CM.Cache.MaxChainMoni(6,maxPayout*7,CM.Cache.WrathCookiesMult);CM.Cache.ChainFrenzyWrathRequired=CM.Cache.ChainFrenzyReward[0]*2;CM.Cache.ChainFrenzyWrathRequiredNext=CM.Cache.ChainFrenzyReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment};CM.Cache.CacheMissingUpgrades=function(){CM.Cache.MissingUpgrades="";CM.Cache.MissingUpgradesCookies="";CM.Cache.MissingUpgradesPrestige="";var list=[];for(let i of Object.keys(Game.Upgrades)){list.push(Game.Upgrades[i])}var sortMap=function(a,b){if(a.order>b.order)return 1;else if(a.order<b.order)return-1;else return 0};list.sort(sortMap);for(let i of Object.keys(list)){var me=list[i];if(me.bought==0){var str="";str+=CM.Disp.crateMissing(me);if(me.pool=="prestige")CM.Cache.MissingUpgradesPrestige+=str;else if(me.pool=="cookie")CM.Cache.MissingUpgradesCookies+=str;else if(me.pool!="toggle"&&me.pool!="unused"&&me.pool!="debug")CM.Cache.MissingUpgrades+=str}}};class CMAvgQueue{constructor(maxLength){this.maxLength=maxLength;this.queue=[]}addLatest(newValue){if(this.queue.push(newValue)>this.maxLength){this.queue.shift()}}calcAverage(timePeriod){if(timePeriod>this.maxLength)timePeriod=this.maxLength;if(timePeriod>this.queue.length)timePeriod=this.queue.length;var ret=0;for(let i=this.queue.length-1;i>=0&&i>this.queuLine truncated
+1 -1
View File
@@ -2775,7 +2775,7 @@ CM.Disp.AddMissingUpgrades = function() {
let titlefrag = document.createElement('div');
titlefrag.innerHTML = '<b>Missing normal upgrades:</b> '+ normalUpgradesMissing + '/' + (Game.UpgradesByPool[""].length + Game.UpgradesByPool.tech.length) + ' (' + Math.floor((normalUpgradesMissing / ( Game.UpgradesByPool[""].length + Game.UpgradesByPool.tech.length)) * 100) + '%)';
title.appendChild(titlefrag);
menuSection.insertBefore(title, l('menu').children[6].childNodes[3]);
menuSection.insertBefore(title, menuSection.childNodes[3]);
let upgrades = document.createElement('div');
upgrades.className = "listing crateBox";
upgrades.innerHTML = CM.Cache.MissingUpgrades;