';`,
`{
var div = document.createElement('div');
div.id = 'row'+this.id;
div.classList.add('row');
str += '
';
}`, 0);
CCSE.ReplaceCodeIntoFunction('Game.Object', `str+='
';`,
`div.innerHTML = str;`, 1);
CCSE.ReplaceCodeIntoFunction('Game.Object', `l('rows').innerHTML=l('rows').innerHTML+str;`,
`l('rows').appendChild(div);`, 0);
// Game.DrawBuildings
// Runs every draw frame if we're not ascending
if(!Game.customDrawBuildings) Game.customDrawBuildings = [];
CCSE.SliceCodeIntoFunction('Game.DrawBuildings', -1, `
// Game.DrawBuildings injection point 0
for(var i in Game.customDrawBuildings) Game.customDrawBuildings[i]();
`);
// Game.modifyBuildingPrice
// Functions should return a value to multiply the price by
// Return 1 to have no effect
if(!Game.customModifyBuildingPrice) Game.customModifyBuildingPrice = [];
CCSE.ReplaceCodeIntoFunction('Game.modifyBuildingPrice', 'return', `
// Game.modifyBuildingPrice injection point 0
for(var i in Game.customModifyBuildingPrice) price *= Game.customModifyBuildingPrice[i](building, price);`, -1);
// Game.storeBulkButton
if(!Game.customStoreBulkButton) Game.customStoreBulkButton = [];
CCSE.SliceCodeIntoFunction('Game.storeBulkButton', -1, `
// Game.storeBulkButton injection point 0
for(var i in Game.customStoreBulkButton) Game.customStoreBulkButton[i]();
`);
// Game.BuildStore
if(!Game.customBuildStore) Game.customBuildStore = [];
CCSE.SliceCodeIntoFunction('Game.BuildStore', -1, `
// Game.BuildStore injection point 0
for(var i in Game.customBuildStore) Game.customBuildStore[i]();
`);
// Game.RefreshStore
if(!Game.customRefreshStore) Game.customRefreshStore = [];
CCSE.SliceCodeIntoFunction('Game.RefreshStore', -1, `
// Game.RefreshStore injection point 0
for(var i in Game.customRefreshStore) Game.customRefreshStore[i]();
`);
// Game.scriptLoaded
if(!Game.customScriptLoaded) Game.customScriptLoaded = [];
if(!Game.customMinigameOnLoad) Game.customMinigameOnLoad = {};
for(key in Game.Objects) if(!Game.customMinigameOnLoad[key]) Game.customMinigameOnLoad[key] = [];
CCSE.SliceCodeIntoFunction('Game.scriptLoaded', -1, `
// Game.scriptLoaded injection point 0
for(var i in Game.customScriptLoaded) Game.customScriptLoaded[i](who, script); // Who knows, maybe those arguments might be needed
for(var i in Game.customMinigameOnLoad[who.name]) Game.customMinigameOnLoad[who.name][i](who, script);
`);
// ----- Upgrades block ----- //
// Game.storeBuyAll
if(!Game.customStoreBuyAll) Game.customStoreBuyAll = [];
CCSE.SliceCodeIntoFunction('Game.storeBuyAll', -1, `
// Game.storeBuyAll injection point 0
for(var i in Game.customStoreBuyAll) Game.customStoreBuyAll[i]();
`);
// Game.CountsAsUpgradeOwned
// Return ret to have no effect
if(!Game.customCountsAsUpgradeOwned) Game.customCountsAsUpgradeOwned = [];
CCSE.SpliceCodeIntoFunction('Game.CountsAsUpgradeOwned', 2, 'var ret;');
CCSE.ReplaceCodeIntoFunction('Game.CountsAsUpgradeOwned', /return/g, 'ret =', 0);
CCSE.SliceCodeIntoFunction('Game.CountsAsUpgradeOwned', -1, `
// Game.CountsAsUpgradeOwned injection point 0
for(var i in Game.customCountsAsUpgradeOwned) ret = Game.customCountsAsUpgradeOwned[i](pool, ret);
return ret;
`);
// Game.Unlock
if(!Game.customUnlock) Game.customUnlock = [];
CCSE.SliceCodeIntoFunction('Game.Unlock', -1, `
// Game.Unlock injection point 0
for(var i in Game.customUnlock) Game.customUnlock[i](what);
`);
// Game.Lock
if(!Game.customLock) Game.customLock = [];
CCSE.SliceCodeIntoFunction('Game.Lock', -1, `
// Game.Lock injection point 0
for(var i in Game.customLock) Game.customLock[i](what);
`);
// Game.RebuildUpgrades
if(!Game.customRebuildUpgrades) Game.customRebuildUpgrades = [];
CCSE.SliceCodeIntoFunction('Game.RebuildUpgrades', -1, `
// Game.RebuildUpgrades injection point 0
for(var i in Game.customRebuildUpgrades) Game.customRebuildUpgrades[i]();
`);
// Game.GetTieredCpsMult
// Functions should return a value to multiply mult by (Return 1 to have no effect)
if(!Game.customGetTieredCpsMult) Game.customGetTieredCpsMult = [];
CCSE.ReplaceCodeIntoFunction('Game.GetTieredCpsMult', 'return', `
// Game.GetTieredCpsMult injection point 0
for(var i in Game.customGetTieredCpsMult) mult *= Game.customGetTieredCpsMult[i](me);`, -1);
// Game.UnlockTiered
if(!Game.customUnlockTiered) Game.customUnlockTiered = [];
CCSE.SliceCodeIntoFunction('Game.UnlockTiered', -1, `
// Game.UnlockTiered injection point 0
for(var i in Game.customUnlockTiered) Game.customUnlockTiered[i](me);
`);
// Game.SetResearch
if(!Game.customSetResearch) Game.customSetResearch = [];
CCSE.SliceCodeIntoFunction('Game.SetResearch', -1, `
// Game.SetResearch injection point 0
for(var i in Game.customSetResearch) Game.customSetResearch[i](what, time);
`);
// Game.DropEgg
// Functions should return a value to multiply failRate by (Return 1 to have no effect)
if(!Game.customDropEgg) Game.customDropEgg = [];
CCSE.SpliceCodeIntoFunction('Game.DropEgg', 2,
`// Game.DropEgg injection point 0
for(var i in Game.customDropEgg) failRate *= Game.customDropEgg[i]();`);
// Game.PermanentSlotIcon
// Functions should return an upgrade id. Return id for no effect.
if(!Game.customPermanentUpgradeId) Game.customPermanentUpgradeId = [];
Game.customPermanentUpgradeId.push(CCSE.GetPermanentUpgrade);
CCSE.SpliceCodeIntoFunction('Game.PermanentSlotIcon', 2,
`// Game.PermanentSlotIcon injection point 0
var id = Game.permanentUpgrades[slot];
for(var i in Game.customPermanentUpgradeId) id = Game.customPermanentUpgradeId[i](slot, id);`,
'Game.PermanentSlotIcon=' + Game.PermanentSlotIcon.toString().replaceAll('Game.permanentUpgrades[slot]','id'));
// Game.AssignPermanentSlot
CCSE.ReplaceCodeIntoFunction('Game.AssignPermanentSlot', 'if (!fail)',
'for (var ii in CCSE.config.permanentUpgrades) {if (CCSE.config.permanentUpgrades[ii]==me.name) fail=1;}', -1);
CCSE.ReplaceCodeIntoFunction('Game.AssignPermanentSlot', 'var upgrade=Game.permanentUpgrades[slot];',
'for(var i in Game.customPermanentUpgradeId) upgrade = Game.customPermanentUpgradeId[i](slot, upgrade);', 1);
CCSE.ReplaceCodeIntoFunction('Game.AssignPermanentSlot', 'Game.BuildAscendTree();',
'CCSE.RectifyPermanentUpgrades();Game.BuildAscendTree();', 0);
// Game.PutUpgradeInPermanentSlot
if(!Game.customPutUpgradeInPermanentSlot) Game.customPutUpgradeInPermanentSlot = [];
CCSE.SliceCodeIntoFunction('Game.PutUpgradeInPermanentSlot', -1, `
// Game.PutUpgradeInPermanentSlot injection point 0
for(var i in Game.customPutUpgradeInPermanentSlot) Game.customPutUpgradeInPermanentSlot[i](upgrade, slot);
`);
// Game.loseShimmeringVeil
if(!Game.customLoseShimmeringVeil) Game.customLoseShimmeringVeil = [];
CCSE.SliceCodeIntoFunction('Game.loseShimmeringVeil', -1, `
// Game.loseShimmeringVeil injection point 0
for(var i in Game.customLoseShimmeringVeil) Game.customLoseShimmeringVeil[i](context);
`);
// Game.listTinyOwnedUpgrades
if(!Game.customListTinyOwnedUpgrades) Game.customListTinyOwnedUpgrades = [];
CCSE.ReplaceCodeIntoFunction('Game.listTinyOwnedUpgrades', 'return', `
// Game.listTinyOwnedUpgrades injection point 0
for(var i in Game.customListTinyOwnedUpgrades) str = Game.customListTinyOwnedUpgrades[i](arr, str);`, -1);
// Game.TieredUpgrade
CCSE.ReplaceCodeIntoFunction('Game.TieredUpgrade', 'new Game.Upgrade', 'CCSE.NewUpgrade', 0);
// Game.SynergyUpgrade
CCSE.ReplaceCodeIntoFunction('Game.SynergyUpgrade', 'new Game.Upgrade', 'CCSE.NewUpgrade', 0);
// Game.GrandmaSynergy
CCSE.ReplaceCodeIntoFunction('Game.GrandmaSynergy', 'new Game.Upgrade', 'CCSE.NewUpgrade', 0);
// Game.NewUpgradeCookie
CCSE.ReplaceCodeIntoFunction('Game.NewUpgradeCookie', 'new Game.Upgrade', 'CCSE.NewUpgrade', 0, CCSE.Steam ?
`var strCookieProductionMultiplierPlus=loc("Cookie production multiplier
+%1%.",'[x]');
var getStrCookieProductionMultiplierPlus=function(x)
{return strCookieProductionMultiplierPlus.replace('[x]',x);}` : 0);
CCSE.ReplaceCodeIntoFunction('Game.NewUpgradeCookie', 'return upgrade;', 'Game.cookieUpgrades.push(upgrade);', -1, CCSE.Steam ?
`var strCookieProductionMultiplierPlus=loc("Cookie production multiplier
+%1%.",'[x]');
var getStrCookieProductionMultiplierPlus=function(x)
{return strCookieProductionMultiplierPlus.replace('[x]',x);}` : 0);
// Game.getVeilDefense
// Return 0 for no effect
if(!Game.customGetVeilDefense) Game.customGetVeilDefense = [];
CCSE.ReplaceCodeIntoFunction('Game.getVeilDefense', 'return', `
// Game.getVeilDefense injection point 0
for(var i in Game.customGetVeilDefense) n += Game.customGetVeilDefense[i](n);`, -1);
// Game.getVeilBoost
// Return 0 for no effect
if(!Game.customGetVeilBoost) Game.customGetVeilBoost = [];
CCSE.ReplaceCodeIntoFunction('Game.getVeilBoost', 'return', `
// Game.getVeilBoost injection point 0
for(var i in Game.customGetVeilBoost) n += Game.customGetVeilBoost[i](n);`, -1);
// ----- Seasons block ----- //
// Game.computeSeasons
CCSE.ReplaceCodeIntoFunction('Game.computeSeasons', `Game.Notify(Game.seasons[this.season].start+'
','',this.icon,4);`, `
// Game.computeSeasons injection point 0
for(var i in Game.customUpgrades[this.name].buyFunction) Game.customUpgrades[this.name].buyFunction[i](this);`, 1);
// Game.getSeasonDuration
// Just rewrote it instead of doing the eval replace thing
// Functions should return a multiplier to the season duration
// Return 1 to have no effect
if(!Game.customGetSeasonDuration) Game.customGetSeasonDuration = [];
Game.getSeasonDuration = function(){
var ret = Game.fps*60*60*24;
// Game.getSeasonDuration injection point 0
for(var i in Game.customGetSeasonDuration) ret *= Game.customGetSeasonDuration[i]();
return ret;
}
// ----- Achievements block ----- //
// Game.Win
if(!Game.customWin) Game.customWin = [];
CCSE.SliceCodeIntoFunction('Game.Win', -1, `
// Game.Win injection point 0
for(var i in Game.customWin) Game.customWin[i](what);
`);
// Game.TieredAchievement
CCSE.ReplaceCodeIntoFunction('Game.TieredAchievement', 'new Game.Achievement', 'CCSE.NewAchievement', 0);
// Game.ProductionAchievement
CCSE.ReplaceCodeIntoFunction('Game.ProductionAchievement', 'new Game.Achievement', 'CCSE.NewAchievement', 0);
// Game.BankAchievement
CCSE.ReplaceCodeIntoFunction('Game.BankAchievement', 'new Game.Achievement', 'CCSE.NewAchievement', 0);
// Game.CpsAchievement
CCSE.ReplaceCodeIntoFunction('Game.CpsAchievement', 'new Game.Achievement', 'CCSE.NewAchievement', 0);
// ----- Buffs block ----- //
// Game.gainBuff
if(!Game.customGainBuff) Game.customGainBuff = [];
CCSE.ReplaceCodeIntoFunction('Game.gainBuff', 'return', `
// Game.gainBuff injection point 0
for(var i in Game.customGainBuff) Game.customGainBuff[i](buff);`, -1);
// Game.updateBuffs
// executed every logic frame
if(!Game.customUpdateBuffs) Game.customUpdateBuffs = [];
CCSE.SliceCodeIntoFunction('Game.updateBuffs', -1, `
// Game.updateBuffs injection point 0
for(var i in Game.customUpdateBuffs) Game.customUpdateBuffs[i]();
`);
for(var i in Game.buffTypes){
var buff = Game.buffTypes[i];
if(buff.name == 'building buff'){
CCSE.ReplaceCodeIntoFunction('Game.buffTypes[' + i + '].func',
'icon:[obj.iconColumn,14],',
'icon:[obj.iconColumn,14,(obj.art.customIconsPic ? obj.art.customIconsPic : 0)],', 0);
}
else if(buff.name == 'building debuff'){
CCSE.ReplaceCodeIntoFunction('Game.buffTypes[' + i + '].func',
'icon:[obj.iconColumn,15],',
'icon:[obj.iconColumn,15,(obj.art.customIconsPic ? obj.art.customIconsPic : 0)],', 0);
}
}
// ----- GRANDMAPOCALYPSE block ----- //
// I need this because this gets used once and if I leave it out the game breaks
function inRect(x,y,rect)
{
//find out if the point x,y is in the rotated rectangle rect{w,h,r,o} (width,height,rotation in radians,y-origin) (needs to be normalized)
//I found this somewhere online I guess
var dx = x+Math.sin(-rect.r)*(-(rect.h/2-rect.o)),dy=y+Math.cos(-rect.r)*(-(rect.h/2-rect.o));
var h1 = Math.sqrt(dx*dx + dy*dy);
var currA = Math.atan2(dy,dx);
var newA = currA - rect.r;
var x2 = Math.cos(newA) * h1;
var y2 = Math.sin(newA) * h1;
if (x2 > -0.5 * rect.w && x2 < 0.5 * rect.w && y2 > -0.5 * rect.h && y2 < 0.5 * rect.h) return true;
return false;
}
// Game.UpdateGrandmapocalypse
// executed every logic frame
if(!Game.customUpdateGrandmapocalypse) Game.customUpdateGrandmapocalypse = [];
CCSE.SliceCodeIntoFunction('Game.UpdateGrandmapocalypse', -1, `
// Game.UpdateGrandmapocalypse injection point 0
for(var i in Game.customUpdateGrandmapocalypse) Game.customUpdateGrandmapocalypse[i]();
`);
// Game.getWrinklersMax
// Functions should return a value to add to n. Return 0 to have no effect
if(!Game.customGetWrinklersMax) Game.customGetWrinklersMax = [];
CCSE.ReplaceCodeIntoFunction('Game.getWrinklersMax', 'return', `
// Game.getWrinklersMax injection point 0
for(var i in Game.customGetWrinklersMax) n += Game.customGetWrinklersMax[i](n);`, -1);
// Game.SpawnWrinkler
if(!Game.customSpawnWrinkler) Game.customSpawnWrinkler = [];
CCSE.ReplaceCodeIntoFunction('Game.SpawnWrinkler', 'return me', `
// Game.SpawnWrinkler injection point 0
for(var i in Game.customSpawnWrinkler) Game.customSpawnWrinkler[i](me);`, -1);
// Game.UpdateWrinklers
// customWrinklerSpawnChance functions should return a multiplier to chance. (Return 1 to have no effect)
if(!Game.customUpdateWrinklers) Game.customUpdateWrinklers = [];
if(!Game.customWrinklerSpawnChance) Game.customWrinklerSpawnChance = [];
if(!Game.customWrinklerPop) Game.customWrinklerPop = [];
CCSE.ReplaceCodeIntoFunction('Game.UpdateWrinklers', 'if (Math.random()
)
// Pics are 96px by 96px
if(!Game.customToggleSpecialMenu) Game.customToggleSpecialMenu = [];
CCSE.ReplaceCodeIntoFunction('Game.ToggleSpecialMenu', "l('specialPopup').innerHTML=str;",
`// Game.ToggleSpecialMenu injection point 0
for(var i in Game.customToggleSpecialMenu) str = Game.customToggleSpecialMenu[i](str);`, -1);
// Game.DrawSpecial
// customDrawSpecialPic functions should alter the picframe object
// Pics are 96px by 96px
if(!Game.customDrawSpecial) Game.customDrawSpecial = [];
if(!Game.customDrawSpecialPic) Game.customDrawSpecialPic = [];
CCSE.ReplaceCodeIntoFunction('Game.DrawSpecial', "if (hovered || selected)",
`// Game.DrawSpecial injection point 0
var picframe = {pic:pic, frame:frame};
for(var j in Game.customDrawSpecialPic) Game.customDrawSpecialPic[j](picframe, Game.specialTabs[i]);
pic = picframe.pic; frame = picframe.frame;`, -1);
CCSE.SliceCodeIntoFunction('Game.DrawSpecial', -1, `
// Game.DrawSpecial injection point 1
for(var i in Game.customDrawSpecial) Game.customDrawSpecial[i]();
`);
// ----- Visual Effects block ----- //
// Game.DrawBackground
// Game.customDrawBackground functions get called in the same block that creates the cookie rain and seasonal backgrounds
// If you want a hook somewhere else, let me know
if(!Game.customDrawBackground) Game.customDrawBackground = [];
CCSE.ReplaceCodeIntoFunction('Game.DrawBackground', "Timer.track('left background');",
`// Game.DrawBackground injection point 0
for(var i in Game.customDrawBackground) Game.customDrawBackground[i]();`, -1);
// Setup for custom Milk Selector options
CCSE.ReplaceCodeIntoFunction('Game.DrawBackground', "if (Game.milkType!=0 && Game.ascensionMode!=1) pic=Game.AllMilks[Game.milkType].pic;",
'if (CCSE.config.milkType!="Automatic" && Game.ascensionMode!=1) pic=CCSE.GetSelectedMilk().milk.pic;', 0);
// Setup for custom Background Selector options
temp = Game.DrawBackground.toString();
temp = temp.replace("Game.bg+'.jpg'", 'Game.bg');
temp = temp.replace("Game.bgFade+'.jpg'", 'Game.bgFade');
temp = temp.replace("Game.BGsByChoice[Game.bgType]", 'choice');
temp = temp.replace("if (Game.bgType!=0 && Game.ascensionMode!=1)",
`Game.bg += '.jpg';
Game.bgFade += '.jpg';
if (Game.ascensionMode!=1)
{
let choice = CCSE.GetSelectedBackground();
if(choice.name != loc('Automatic'))`);
temp = temp.replace("Game.Background.fillPattern(Pic(Game.bg)",
`}
Game.Background.fillPattern(Pic(Game.bg)`);
eval('Game.DrawBackground = ' + temp);
for(var i in Game.BGsByChoice) Game.BGsByChoice[i].pic += '.jpg';
// ----- Debug block ----- //
// Game.OpenSesame
// Game.customOpenSesame functions should add HTML strings to the debug menu
if(!Game.customOpenSesame) Game.customOpenSesame = [];
CCSE.ReplaceCodeIntoFunction('Game.OpenSesame', "str+=' ';",
`// Game.OpenSesame injection point 0
for(var i in Game.customOpenSesame) str += Game.customOpenSesame[i]();`, -1);
// ----- YouCustomizer block ----- //
// Game.YouCustomizer.render
if(!Game.customYouCustomizerRender) Game.customYouCustomizerRender = [];
CCSE.SliceCodeIntoFunction('Game.YouCustomizer.render', -1, `
// Game.YouCustomizer.render injection point 0
for(var i in Game.customYouCustomizerRender) Game.customYouCustomizerRender[i]();
`);
// Game.YouCustomizer.getGeneValue
// Return retVal to have no effect
temp = Game.YouCustomizer.getGeneValue.toString();
temp = temp.replace('var gene=', 'var retVal;\r\nvar gene=');
temp = temp.replaceAll('return', 'retVal =');
eval('Game.YouCustomizer.getGeneValue = ' + temp);
if(!Game.customYouCustomizerGetGeneValue) Game.customYouCustomizerGetGeneValue = [];
CCSE.SliceCodeIntoFunction('Game.YouCustomizer.getGeneValue', -1, `
// Game.YouCustomizer.getGeneValue injection point 0
for(var i in Game.customYouCustomizerGetGeneValue) retVal = Game.customYouCustomizerGetGeneValue[i](id, retVal);
return retVal;
`);
// Game.YouCustomizer.offsetGene
if(!Game.customYouCustomizerOffsetGene) Game.customYouCustomizerOffsetGene = [];
CCSE.SliceCodeIntoFunction('Game.YouCustomizer.offsetGene', -1, `
// Game.YouCustomizer.offsetGene injection point 0
for(var i in Game.customYouCustomizerOffsetGene) Game.customYouCustomizerOffsetGene[i](gene,off);
`);
// Game.YouCustomizer.randomize
if(!Game.customYouCustomizerRandomize) Game.customYouCustomizerRandomize = [];
CCSE.ReplaceCodeIntoFunction('Game.YouCustomizer.randomize', "Game.YouCustomizer.render();",
`// Game.YouCustomizer.randomize injection point 0
for(var i in Game.customYouCustomizerRandomize) str = Game.customYouCustomizerRandomize[i]();`, -1);
// Game.YouCustomizer.renderPortrait
if(!Game.customYouCustomizerRenderPortrait) Game.customYouCustomizerRenderPortrait = [];
CCSE.SliceCodeIntoFunction('Game.YouCustomizer.renderPortrait', -1, `
// Game.YouCustomizer.renderPortrait injection point 0
for(var i in Game.customYouCustomizerRenderPortrait) Game.customYouCustomizerRenderPortrait[i]();
`);
// Game.YouCustomizer.prompt
if(!Game.customYouCustomizerPrompt) Game.customYouCustomizerPrompt = [];
if(!Game.customYouCustomizerMakeCustomizerSelector) Game.customYouCustomizerMakeCustomizerSelector = [];
temp = Game.YouCustomizer.prompt.toString();
temp = temp.replace('return', 'var retVal =');
temp = temp.replace('}', `
// Game.YouCustomizer.prompt injection point 0
for(var i in Game.customYouCustomizerMakeCustomizerSelector) retVal = Game.customYouCustomizerMakeCustomizerSelector[i](gene,text,retVal);
return retVal;
}`);
eval('Game.YouCustomizer.prompt = ' + temp);
CCSE.SliceCodeIntoFunction('Game.YouCustomizer.prompt', -1, `
// Game.YouCustomizer.prompt injection point 1
for(var i in Game.customYouCustomizerPrompt) Game.customYouCustomizerPrompt[i]();
`);
// ----- Gifting block ----- //
// Game.promptGiftRedeem
// Game.promptGiftSend
// Submit an issue to the GitHub page with where you want a hook
// Until that happens, these functions won't either
}
if(!CCSE.customReplaceShimmerType) CCSE.customReplaceShimmerType = [];
CCSE.ReplaceShimmerType = function(key){
var temp = '';
var pos = 0;
var proto;
var escKey = key.replace(/'/g, "\\'");
if(!Game.customShimmerTypes[key]) Game.customShimmerTypes[key] = {};
CCSE.Backup.customShimmerTypes[key] = {};
// Game.shimmerTypes[key].initFunc
// durationMult functions should return a value to multiply the duration by
if(!Game.customShimmerTypes[key].initFunc) Game.customShimmerTypes[key].initFunc = [];
if(!Game.customShimmerTypes[key].durationMult) Game.customShimmerTypes[key].durationMult = [];
Game.customShimmerTypes[key].initFunc.push(CCSE.customShimmerTypesAllinitFunc);
Game.customShimmerTypes[key].durationMult.push(CCSE.customShimmerTypesAlldurationMult);
CCSE.ReplaceCodeIntoFunction("Game.shimmerTypes['" + escKey + "'].initFunc", 'me.dur=dur;',
`// Game.shimmerTypes['` + escKey + `'].initFunc injection point 0
for(var i in Game.customShimmerTypes['` + escKey + `'].durationMult) dur *= Game.customShimmerTypes['` + escKey + `'].durationMult[i](me);`, -1);
CCSE.SliceCodeIntoFunction("Game.shimmerTypes['" + escKey + "'].initFunc", -1, `
// Game.shimmerTypes['` + escKey + `'].initFunc injection point 1
for(var i in Game.customShimmerTypes['` + escKey + `'].initFunc) Game.customShimmerTypes['` + escKey + `'].initFunc[i](me);
`);
//CCSE.ReplaceCodeIntoFunction("Game.shimmerTypes['" + escKey + "'].initFunc", 'Game.chimeType==1 && ', '', 0);
// Game.shimmerTypes[key].updateFunc
if(!Game.customShimmerTypes[key].updateFunc) Game.customShimmerTypes[key].updateFunc = [];
Game.customShimmerTypes[key].updateFunc.push(CCSE.customShimmerTypesAllupdateFunc);
CCSE.SliceCodeIntoFunction("Game.shimmerTypes['" + escKey + "'].updateFunc", -1, `
// Game.shimmerTypes['` + escKey + `'].updateFunc injection point 0
for(var i in Game.customShimmerTypes['` + escKey + `'].updateFunc) Game.customShimmerTypes['` + escKey + `'].updateFunc[i](me);
`);
// Game.shimmerTypes[key].popFunc
if(!Game.customShimmerTypes[key].popFunc) Game.customShimmerTypes[key].popFunc = [];
Game.customShimmerTypes[key].popFunc.push(CCSE.customShimmerTypesAllpopFunc);
CCSE.SliceCodeIntoFunction("Game.shimmerTypes['" + escKey + "'].popFunc", -1, `
// Game.shimmerTypes['` + escKey + `'].popFunc injection point 0
for(var i in Game.customShimmerTypes['` + escKey + `'].popFunc) Game.customShimmerTypes['` + escKey + `'].popFunc[i](me);
`);
// Game.shimmerTypes[key].spawnConditions
// Return ret to have no effect
if(!Game.customShimmerTypes[key].spawnConditions) Game.customShimmerTypes[key].spawnConditions = [];
Game.customShimmerTypes[key].spawnConditions.push(CCSE.customShimmerTypesAllspawnConditions);
CCSE.SpliceCodeIntoFunction("Game.shimmerTypes['" + escKey + "'].spawnConditions", 2, 'var ret;');
CCSE.ReplaceCodeIntoFunction("Game.shimmerTypes['" + escKey + "'].spawnConditions", /return/g, 'ret =', 0);
CCSE.SliceCodeIntoFunction("Game.shimmerTypes['" + escKey + "'].spawnConditions", -1, `
// Game.shimmerTypes['` + escKey + `'].spawnConditions injection point 0
for(var i in Game.customShimmerTypes['` + escKey + `'].spawnConditions) ret = Game.customShimmerTypes['` + escKey + `'].spawnConditions[i](ret);
return ret;
`);
// Game.shimmerTypes[key].getTimeMod
// Functions should return a multiplier to the shimmer's spawn time (higher takes longer to spawn)
// Return 1 to have no effect
if(!Game.customShimmerTypes[key].getTimeMod) Game.customShimmerTypes[key].getTimeMod = [];
Game.customShimmerTypes[key].getTimeMod.push(CCSE.customShimmerTypesAllgetTimeMod);
CCSE.ReplaceCodeIntoFunction("Game.shimmerTypes['" + escKey + "'].getTimeMod", 'return', `
// Game.shimmerTypes['` + escKey + `'].getTimeMod injection point 0
for(var i in Game.customShimmerTypes['` + escKey + `'].getTimeMod) m *= Game.customShimmerTypes['` + escKey + `'].getTimeMod[i](me);`, -1);
for(var i in CCSE.customReplaceShimmerType) CCSE.customReplaceShimmerType[i](key);
}
if(!CCSE.customReplaceBuilding) CCSE.customReplaceBuilding = [];
CCSE.ReplaceBuildingsStart = function(){
if(!Game.customBuildingsAll) Game.customBuildingsAll = {};
if(!Game.customBuildingsAll.switchMinigame) Game.customBuildingsAll.switchMinigame = [];
CCSE.customBuildingsAllswitchMinigame = function(obj, on){
for(var i in Game.customBuildingsAll.switchMinigame) Game.customBuildingsAll.switchMinigame[i](obj, on);
}
if(!Game.customBuildingsAll.getSellMultiplier) Game.customBuildingsAll.getSellMultiplier = [];
CCSE.customBuildingsAllgetSellMultiplier = function(obj, giveBack){
for(var i in Game.customBuildingsAll.getSellMultiplier) giveBack = Game.customBuildingsAll.getSellMultiplier[i](obj, giveBack);
return giveBack;
}
if(!Game.customBuildingsAll.buy) Game.customBuildingsAll.buy = [];
CCSE.customBuildingsAllbuy = function(obj, amount){
for(var i in Game.customBuildingsAll.buy) Game.customBuildingsAll.buy[i](obj, amount);
}
if(!Game.customBuildingsAll.sell) Game.customBuildingsAll.sell = [];
CCSE.customBuildingsAllsell = function(obj, amount, bypass){
for(var i in Game.customBuildingsAll.sell) Game.customBuildingsAll.sell[i](obj, amount, bypass);
}
if(!Game.customBuildingsAll.sacrifice) Game.customBuildingsAll.sacrifice = [];
CCSE.customBuildingsAllsacrifice = function(obj, amount){
for(var i in Game.customBuildingsAll.sacrifice) Game.customBuildingsAll.sacrifice[i](obj, amount);
}
if(!Game.customBuildingsAll.buyFree) Game.customBuildingsAll.buyFree = [];
CCSE.customBuildingsAllbuyFree = function(obj, amount){
for(var i in Game.customBuildingsAll.buyFree) Game.customBuildingsAll.buyFree[i](obj, amount);
}
if(!Game.customBuildingsAll.getFree) Game.customBuildingsAll.getFree = [];
CCSE.customBuildingsAllgetFree = function(obj, amount){
for(var i in Game.customBuildingsAll.getFree) Game.customBuildingsAll.getFree[i](obj, amount);
}
if(!Game.customBuildingsAll.getFreeRanks) Game.customBuildingsAll.getFreeRanks = [];
CCSE.customBuildingsAllgetFreeRanks = function(obj, amount){
for(var i in Game.customBuildingsAll.getFreeRanks) Game.customBuildingsAll.getFreeRanks[i](obj, amount);
}
if(!Game.customBuildingsAll.tooltip) Game.customBuildingsAll.tooltip = [];
CCSE.customBuildingsAlltooltip = function(obj, ret){
for(var i in Game.customBuildingsAll.tooltip) ret = Game.customBuildingsAll.tooltip[i](obj, ret);
return ret;
}
if(!Game.customBuildingsAll.levelTooltip) Game.customBuildingsAll.levelTooltip = [];
CCSE.customBuildingsAlllevelTooltip = function(obj, ret){
for(var i in Game.customBuildingsAll.levelTooltip) ret = Game.customBuildingsAll.levelTooltip[i](obj, ret);
return ret;
}
if(!Game.customBuildingsAll.refresh) Game.customBuildingsAll.refresh = [];
CCSE.customBuildingsAllrefresh = function(obj){
for(var i in Game.customBuildingsAll.refresh) Game.customBuildingsAll.refresh[i](obj);
}
if(!Game.customBuildingsAll.rebuild) Game.customBuildingsAll.rebuild = [];
CCSE.customBuildingsAllrebuild = function(obj){
for(var i in Game.customBuildingsAll.rebuild) Game.customBuildingsAll.rebuild[i](obj);
}
if(!Game.customBuildingsAll.mute) Game.customBuildingsAll.mute = [];
CCSE.customBuildingsAllmute = function(obj, val){
for(var i in Game.customBuildingsAll.mute) Game.customBuildingsAll.mute[i](obj, val);
}
if(!Game.customBuildingsAll.draw) Game.customBuildingsAll.draw = [];
CCSE.customBuildingsAlldraw = function(obj){
for(var i in Game.customBuildingsAll.draw) Game.customBuildingsAll.draw[i](obj);
}
if(!Game.customBuildingsAll.buyFunction) Game.customBuildingsAll.buyFunction = [];
CCSE.customBuildingsAllbuyFunction = function(obj){
for(var i in Game.customBuildingsAll.buyFunction) Game.customBuildingsAll.buyFunction[i](obj);
}
if(!Game.customBuildingsAll.cpsMult) Game.customBuildingsAll.cpsMult = [];
CCSE.customBuildingsAllcpsMult = function(obj){
var mult = 1;
for(var i in Game.customBuildingsAll.cpsMult) mult *= Game.customBuildingsAll.cpsMult[i](obj);
return mult;
}
if(!Game.customBuildings) Game.customBuildings = {};
CCSE.Backup.customBuildings = {};
CCSE.i = 0;
}
CCSE.ReplaceBuildings = function(){
var time = Date.now();
for(var i = CCSE.i; i < Game.ObjectsN; i++){
CCSE.ReplaceBuilding(Game.ObjectsById[i].name);
if(Date.now() > time + 500 / Game.fps) break;
}
CCSE.i = i + 1;
if(CCSE.i < Game.ObjectsN){
// Didn't do all of them. Wait for priority and go again
requestAnimationFrame(CCSE.ReplaceBuildings);
}else{
// Continue on
requestAnimationFrame(CCSE.playlist[CCSE.track++]);
}
}
CCSE.ReplaceBuildingsFinish = function(){
// ----- Individual Buildings block ----- //
var obj = Game.Objects['Cursor'];
// Cursor.cps
// cpsAdd Functions should return a value to add per non cursor building (Return 0 to have no effect)
if(!Game.customBuildings[obj.name].cpsAdd) Game.customBuildings[obj.name].cpsAdd = [];
if(!Game.customBuildings[obj.name].cpsMult) Game.customBuildings[obj.name].cpsMult = [];
CCSE.ReplaceCodeIntoFunction("Game.Objects['Cursor'].cps", 'var mult=1;', `
// Cursor.cps injection point 1
for(var i in Game.customBuildings['` + obj.name + `'].cpsAdd) add += Game.customBuildings['` + obj.name + `'].cpsAdd[i](me);`, -1);
obj = Game.Objects['Grandma'];
// Grandma.art.pic
// Functions should push an image name (sans the .png part) into list
if(!Game.customGrandmaPicture) Game.customGrandmaPicture = [];
CCSE.ReplaceCodeIntoFunction("Game.Objects['Grandma'].art.pic", 'return', `
// Grandma.art.pic injection point 0
for(var j in Game.customGrandmaPicture) Game.customGrandmaPicture[j](i, list);`, -1);
// Grandma.cps
// cpsAdd Functions should return a value to add before multiplying (Return 0 to have no effect)
if(!Game.customBuildings[obj.name].cpsAdd) Game.customBuildings[obj.name].cpsAdd = [];
if(!Game.customBuildings[obj.name].cpsMult) Game.customBuildings[obj.name].cpsMult = [];
CCSE.ReplaceCodeIntoFunction("Game.Objects['Grandma'].cps", 'return', `
// Grandma.cps injection point 1
for(var i in Game.customBuildings['` + obj.name + `'].cpsAdd) add += Game.customBuildings['` + obj.name + `'].cpsAdd[i](me);`, -1);
}
CCSE.ReplaceBuilding = function(key){
// A lot of Copy/Paste happened, hence why I did so many functions.
// Also, I may not have fully tested each one.
var temp = '';
var pos = 0;
var proto;
var escKey = key.replace(/'/g, "\\'");
var obj = Game.Objects[key];
if(!Game.customBuildings[key]) Game.customBuildings[key] = {};
CCSE.Backup.customBuildings[key] = {};
// this.switchMinigame
if(!Game.customBuildings[key].switchMinigame) Game.customBuildings[key].switchMinigame = [];
Game.customBuildings[key].switchMinigame.push(CCSE.customBuildingsAllswitchMinigame);
CCSE.SliceCodeIntoFunction("Game.Objects['" + escKey + "'].switchMinigame", -1, `
// Game.Objects['` + escKey + `'].switchMinigame injection point 0
for(var i in Game.customBuildings[this.name].switchMinigame) Game.customBuildings[this.name].switchMinigame[i](this, on);
`);
// this.getSellMultiplier
// Return ret to have no effect
if(!Game.customBuildings[key].getSellMultiplier) Game.customBuildings[key].getSellMultiplier = [];
Game.customBuildings[key].getSellMultiplier.push(CCSE.customBuildingsAllgetSellMultiplier);
CCSE.ReplaceCodeIntoFunction("Game.Objects['" + escKey + "'].getSellMultiplier", 'return', `
// Game.Objects['` + escKey + `'].getSellMultiplier injection point 0
for(var i in Game.customBuildings[this.name].getSellMultiplier) giveBack = Game.customBuildings[this.name].getSellMultiplier[i](this, giveBack);`, -1);
// this.buy
if(!Game.customBuildings[key].buy) Game.customBuildings[key].buy = [];
Game.customBuildings[key].buy.push(CCSE.customBuildingsAllbuy);
CCSE.SliceCodeIntoFunction("Game.Objects['" + escKey + "'].buy", -1, `
// Game.Objects['` + escKey + `'].buy injection point 0
for(var i in Game.customBuildings[this.name].buy) Game.customBuildings[this.name].buy[i](this, amount);
`);
// this.sell
if(!Game.customBuildings[key].sell) Game.customBuildings[key].sell = [];
Game.customBuildings[key].sell.push(CCSE.customBuildingsAllsell);
CCSE.SliceCodeIntoFunction("Game.Objects['" + escKey + "'].sell", -1, `
// Game.Objects['` + escKey + `'].sell injection point 0
for(var i in Game.customBuildings[this.name].sell) Game.customBuildings[this.name].sell[i](this, amount, bypass);
`);
// this.sacrifice
if(!Game.customBuildings[key].sacrifice) Game.customBuildings[key].sacrifice = [];
Game.customBuildings[key].sacrifice.push(CCSE.customBuildingsAllsacrifice);
CCSE.SliceCodeIntoFunction("Game.Objects['" + escKey + "'].sacrifice", -1, `
// Game.Objects['` + escKey + `'].sacrifice injection point 0
for(var i in Game.customBuildings[this.name].sacrifice) Game.customBuildings[this.name].sacrifice[i](this, amount);
`);
// this.buyFree
if(!Game.customBuildings[key].buyFree) Game.customBuildings[key].buyFree = [];
Game.customBuildings[key].buyFree.push(CCSE.customBuildingsAllbuyFree);
CCSE.SliceCodeIntoFunction("Game.Objects['" + escKey + "'].buyFree", -1, `
// Game.Objects['` + escKey + `'].buyFree injection point 0
for(var i in Game.customBuildings[this.name].buyFree) Game.customBuildings[this.name].buyFree[i](this, amount);
`, 'var price = Game.Objects["' + escKey + '"].basePrice');
// this.getFree
if(!Game.customBuildings[key].getFree) Game.customBuildings[key].getFree = [];
Game.customBuildings[key].getFree.push(CCSE.customBuildingsAllgetFree);
CCSE.SliceCodeIntoFunction("Game.Objects['" + escKey + "'].getFree", -1, `
// Game.Objects['` + escKey + `'].getFree injection point 0
for(var i in Game.customBuildings[this.name].getFree) Game.customBuildings[this.name].getFree[i](this, amount);
`);
// this.getFreeRanks
if(!Game.customBuildings[key].getFreeRanks) Game.customBuildings[key].getFreeRanks = [];
Game.customBuildings[key].getFreeRanks.push(CCSE.customBuildingsAllgetFreeRanks);
CCSE.SliceCodeIntoFunction("Game.Objects['" + escKey + "'].getFreeRanks", -1, `
// Game.Objects['` + escKey + `'].getFreeRanks injection point 0
for(var i in Game.customBuildings[this.name].getFreeRanks) Game.customBuildings[this.name].getFreeRanks[i](this, amount);
`);
// this.tooltip
// Return ret to have no effect
if(!Game.customBuildings[key].tooltip) Game.customBuildings[key].tooltip = [];
Game.customBuildings[key].tooltip.push(CCSE.customBuildingsAlltooltip);
CCSE.ReplaceCodeIntoFunction("Game.Objects['" + escKey + "'].tooltip", 'return', 'var ret =', 0);
CCSE.SliceCodeIntoFunction("Game.Objects['" + escKey + "'].tooltip", -1, `
// Game.Objects['` + escKey + `'].tooltip injection point 0
for(var i in Game.customBuildings[this.name].tooltip) ret = Game.customBuildings[this.name].tooltip[i](this, ret);
return ret;
`);
// this.levelTooltip
// Return ret to have no effect
if(!Game.customBuildings[key].levelTooltip) Game.customBuildings[key].levelTooltip = [];
Game.customBuildings[key].levelTooltip.push(CCSE.customBuildingsAlllevelTooltip);
CCSE.ReplaceCodeIntoFunction("Game.Objects['" + escKey + "'].levelTooltip", 'return', 'var ret =', 0);
CCSE.SliceCodeIntoFunction("Game.Objects['" + escKey + "'].levelTooltip", -1, `
// Game.Objects['` + escKey + `'].levelTooltip injection point 0
for(var i in Game.customBuildings[this.name].levelTooltip) ret = Game.customBuildings[this.name].levelTooltip[i](this, ret);
return ret;
`);
// this.levelUp
// Haha no. This is like four functions that return each other
// I'm not dealing with it unless I have to.
// this.refresh
if(!Game.customBuildings[key].refresh) Game.customBuildings[key].refresh = [];
Game.customBuildings[key].refresh.push(CCSE.customBuildingsAllrefresh);
CCSE.SliceCodeIntoFunction("Game.Objects['" + escKey + "'].refresh", -1, `
// Game.Objects['` + escKey + `'].refresh injection point 0
for(var i in Game.customBuildings[this.name].refresh) Game.customBuildings[this.name].refresh[i](this);
`);
// this.rebuild
if(!Game.customBuildings[key].rebuild) Game.customBuildings[key].rebuild = [];
Game.customBuildings[key].rebuild.push(CCSE.customBuildingsAllrebuild);
CCSE.SliceCodeIntoFunction("Game.Objects['" + escKey + "'].rebuild", -1, `
// Game.Objects['` + escKey + `'].rebuild injection point 0
for(var i in Game.customBuildings[this.name].rebuild) Game.customBuildings[this.name].rebuild[i](this);
`);
// this.mute
if(!Game.customBuildings[key].mute) Game.customBuildings[key].mute = [];
Game.customBuildings[key].mute.push(CCSE.customBuildingsAllmute);
CCSE.SliceCodeIntoFunction("Game.Objects['" + escKey + "'].mute", -1, `
// Game.Objects['` + escKey + `'].mute injection point 0
for(var i in Game.customBuildings[this.name].mute) Game.customBuildings[this.name].mute[i](this, val);
`);
// this.draw
if(!Game.customBuildings[key].draw) Game.customBuildings[key].draw = [];
Game.customBuildings[key].draw.push(CCSE.customBuildingsAlldraw);
if(key == 'Cursor'){ // Because cursors are special
Game.Objects[key].draw = function(){
// Game.Objects['Cursor'].draw injection point 0
for(var i in Game.customBuildings[this.name].draw) Game.customBuildings[this.name].draw[i](this);
}
}
else{
CCSE.SliceCodeIntoFunction("Game.Objects['" + escKey + "'].draw", -1, `
// Game.Objects['` + escKey + `'].draw injection point 0
for(var i in Game.customBuildings[this.name].draw) Game.customBuildings[this.name].draw[i](this);
`);
}
// this.buyFunction
if(!Game.customBuildings[key].buyFunction) Game.customBuildings[key].buyFunction = [];
Game.customBuildings[key].buyFunction.push(CCSE.customBuildingsAllbuyFunction);
CCSE.SliceCodeIntoFunction("Game.Objects['" + escKey + "'].buyFunction", -1, `
// Game.Objects['` + escKey + `'].buyFunction injection point 0
for(var i in Game.customBuildings[this.name].buyFunction) Game.customBuildings[this.name].buyFunction[i](this);
`);
// this.cps
// cpsMult Functions should return a value to multiply the price by (Return 1 to have no effect)
if(!Game.customBuildings[obj.name].cpsMult) Game.customBuildings[obj.name].cpsMult = [];
Game.customBuildings[key].cpsMult.push(CCSE.customBuildingsAllcpsMult);
CCSE.ReplaceCodeIntoFunction("Game.Objects['" + escKey + "'].cps", 'return', `
// Game.Objects['` + escKey + `'].cps injection point 0
for(var i in Game.customBuildings[this.name].cpsMult) mult *= Game.customBuildings[this.name].cpsMult[i](me);
`, -1);
for(var i in CCSE.customReplaceBuilding) CCSE.customReplaceBuilding[i](key, obj);
}
if(!CCSE.customReplaceUpgrade) CCSE.customReplaceUpgrade = [];
CCSE.ReplaceUpgradesStart = function(){
if(!Game.customUpgradesAll) Game.customUpgradesAll = {};
if(!Game.customUpgradesAll.getPrice) Game.customUpgradesAll.getPrice = [];
CCSE.customUpgradesAllgetPrice = function(me){
var ret = 1
for(var i in Game.customUpgradesAll.getPrice) ret *= Game.customUpgradesAll.getPrice[i](me);
return ret;
}
if(!Game.customUpgradesAll.click) Game.customUpgradesAll.click = [];
CCSE.customUpgradesAllclick = function(me, e){
for(var i in Game.customUpgradesAll.click) Game.customUpgradesAll.click[i](me, e);
}
if(!Game.customUpgradesAll.buy) Game.customUpgradesAll.buy = [];
CCSE.customUpgradesAllbuy = function(me, bypass, success){
for(var i in Game.customUpgradesAll.buy) Game.customUpgradesAll.buy[i](me, bypass, success);
}
if(!Game.customUpgradesAll.earn) Game.customUpgradesAll.earn = [];
CCSE.customUpgradesAllearn = function(me){
for(var i in Game.customUpgradesAll.earn) Game.customUpgradesAll.earn[i](me);
}
if(!Game.customUpgradesAll.unearn) Game.customUpgradesAll.unearn = [];
CCSE.customUpgradesAllunearn = function(me){
for(var i in Game.customUpgradesAll.unearn) Game.customUpgradesAll.unearn[i](me);
}
if(!Game.customUpgradesAll.unlock) Game.customUpgradesAll.unlock = [];
CCSE.customUpgradesAllunlock = function(me){
for(var i in Game.customUpgradesAll.unlock) Game.customUpgradesAll.unlock[i](me);
}
if(!Game.customUpgradesAll.lose) Game.customUpgradesAll.lose = [];
CCSE.customUpgradesAlllose = function(me){
for(var i in Game.customUpgradesAll.lose) Game.customUpgradesAll.lose[i](me);
}
if(!Game.customUpgradesAll.toggle) Game.customUpgradesAll.toggle = [];
CCSE.customUpgradesAlltoggle = function(me){
for(var i in Game.customUpgradesAll.toggle) Game.customUpgradesAll.toggle[i](me);
}
if(!Game.customUpgradesAll.buyFunction) Game.customUpgradesAll.buyFunction = [];
CCSE.customUpgradesAllbuyFunction = function(me){
for(var i in Game.customUpgradesAll.buyFunction) Game.customUpgradesAll.buyFunction[i](me);
}
if(!Game.customUpgradesAll.descFunc) Game.customUpgradesAll.descFunc = [];
CCSE.customUpgradesAlldescFunc = function(me, desc){
for(var i in Game.customUpgradesAll.descFunc) desc = Game.customUpgradesAll.descFunc[i](me, desc);
return desc;
}
if(!Game.customUpgrades) Game.customUpgrades = {};
CCSE.Backup.customUpgrades = {};
CCSE.i = 0;
}
CCSE.ReplaceUpgrades = function(){
var time = Date.now();
for(var i = CCSE.i; i < Game.UpgradesN; i++){
CCSE.ReplaceUpgrade(Game.UpgradesById[i].name);
if(Date.now() > time + 500 / Game.fps) break;
}
CCSE.i = i + 1;
if(CCSE.i < Game.UpgradesN){
// Didn't do all of them. Wait for priority and go again
requestAnimationFrame(CCSE.ReplaceUpgrades);
}else{
// Continue on
requestAnimationFrame(CCSE.playlist[CCSE.track++]);
}
}
CCSE.ReplaceUpgradesFinish = function(){
// this.getPrice
// Functions should return a value to multiply the price by (Return 1 to have no effect)
CCSE.ReplaceCodeIntoFunction("Game.Upgrade.prototype.getPrice", 'return Math', `
// Game.Upgrade.prototype.getPrice injection point 0
if(Game.customUpgrades[this.name]) for(var i in Game.customUpgrades[this.name].getPrice) price *= Game.customUpgrades[this.name].getPrice[i](this);`, -1);
// this.click
CCSE.SliceCodeIntoFunction("Game.Upgrade.prototype.click", -1, `
// Game.Upgrade.prototype.click injection point 0
if(Game.customUpgrades[this.name]) for(var i in Game.customUpgrades[this.name].click) Game.customUpgrades[this.name].click[i](this, e);
`);
// this.buy
CCSE.ReplaceCodeIntoFunction("Game.Upgrade.prototype.buy", 'return success', `
// Game.Upgrade.prototype.buy injection point 0
if(Game.customUpgrades[this.name]) for(var i in Game.customUpgrades[this.name].buy) Game.customUpgrades[this.name].buy[i](this, bypass, success);`, -1);
// this.earn
CCSE.SliceCodeIntoFunction("Game.Upgrade.prototype.earn", -1, `
// Game.Upgrade.prototype.earn injection point 0
if(Game.customUpgrades[this.name]) for(var i in Game.customUpgrades[this.name].earn) Game.customUpgrades[this.name].earn[i](this);
`);
// this.unearn
CCSE.SliceCodeIntoFunction("Game.Upgrade.prototype.unearn", -1, `
// Game.Upgrade.prototype.unearn injection point 0
if(Game.customUpgrades[this.name]) for(var i in Game.customUpgrades[this.name].unearn) Game.customUpgrades[this.name].unearn[i](this);
`);
// this.unlock
CCSE.SliceCodeIntoFunction("Game.Upgrade.prototype.unlock", -1, `
// Game.Upgrade.prototype.unlock injection point 0
if(Game.customUpgrades[this.name]) if(Game.customUpgrades[this.name]) for(var i in Game.customUpgrades[this.name].unlock) Game.customUpgrades[this.name].unlock[i](this);
`);
// this.lose
CCSE.SliceCodeIntoFunction("Game.Upgrade.prototype.lose", -1, `
// Game.Upgrade.prototype.lose injection point 0
if(Game.customUpgrades[this.name]) for(var i in Game.customUpgrades[this.name].lose) Game.customUpgrades[this.name].lose[i](this);
`);
// this.toggle
CCSE.SliceCodeIntoFunction("Game.Upgrade.prototype.toggle", -1, `
// Game.Upgrade.prototype.toggle injection point 0
if(Game.customUpgrades[this.name]) for(var i in Game.customUpgrades[this.name].toggle) Game.customUpgrades[this.name].toggle[i](this);
`);
// this.isVaulted
CCSE.SpliceCodeIntoFunction("Game.Upgrade.prototype.isVaulted", 2, `
// Game.Upgrade.prototype.isVaulted injection point 0
if (CCSE.config.vault.indexOf(this.name)!=-1) return true;
`);
// this.vault
CCSE.ReplaceCodeIntoFunction("Game.Upgrade.prototype.vault", 'Game.vault', `
if(this.CCSE) CCSE.config.vault.push(this.name);
else `, -1);
// this.unvault
CCSE.ReplaceCodeIntoFunction("Game.Upgrade.prototype.unvault", 'Game.vault', `
if(this.CCSE) CCSE.config.vault.splice(CCSE.config.vault.indexOf(this.name),1);
else `, -1);
// Golden cookie sound selector custom options
CCSE.ReplaceCodeIntoFunction("Game.Upgrades['Golden cookie sound selector'].olddescFunc", "this.choicesFunction()[Game.chimeType]", "CCSE.GetSelectedShimmerSound()", 0);
//CCSE.ReplaceCodeIntoFunction("Game.Upgrades['Golden cookie sound selector'].olddescFunc", "'+icon[2]+'", "'+choice.icon[2]+'", 0);
// Game.Upgrades['Golden cookie sound selector'].choicesFunction
if(!Game.customUpgrades['Golden cookie sound selector'].choicesFunction) Game.customUpgrades['Golden cookie sound selector'].choicesFunction = [];
CCSE.ReplaceCodeIntoFunction("Game.Upgrades['Golden cookie sound selector'].choicesFunction", "return choices;",
`// Game.customUpgrades['Golden cookie sound selector'].choicesFunction injection point 0
for(var i in Game.customUpgrades['Golden cookie sound selector'].choicesFunction) Game.customUpgrades['Golden cookie sound selector'].choicesFunction[i](choices);
CCSE.OverrideShimmerSoundSelector(choices);`, -1);
/*Game.customUpgrades['Golden cookie sound selector'].choicesFunction.push(function(choices){
choices[1].default = 'snd/chime.mp3';
choices[1].shimmerTypes = {golden:'snd/chime.mp3', reindeer:'snd/jingle.mp3'};
});*/
CCSE.ReplaceCodeIntoFunction("Game.Upgrades['Golden cookie sound selector'].choicesPick", "Game.chimeType=id;",
'CCSE.SetSelectedShimmerSound(id);', 0);
// Milk selector custom options
CCSE.ReplaceCodeIntoFunction("Game.Upgrades['Milk selector'].olddescFunc", "this.choicesFunction()[Game.milkType]", "CCSE.GetSelectedMilk()", 0);
// Game.Upgrades['Milk selector'].choicesFunction
if(!Game.customUpgrades['Milk selector'].choicesFunction) Game.customUpgrades['Milk selector'].choicesFunction = [];
CCSE.ReplaceCodeIntoFunction("Game.Upgrades['Milk selector'].choicesFunction", "return choices;",
`// Game.customUpgrades['Milk selector'].choicesFunction injection point 0
for(var i in Game.customUpgrades['Milk selector'].choicesFunction) Game.customUpgrades['Milk selector'].choicesFunction[i](choices);
CCSE.OverrideMilkSelector(choices);`, -1);
Game.customUpgrades['Milk selector'].choicesFunction.push(function(choices){
if(!CCSE.Steam) for(var i in choices) choices[i].milk = Game.AllMilks[i];
choices[0].milk = Game.Milk;
});
CCSE.ReplaceCodeIntoFunction("Game.Upgrades['Milk selector'].choicesPick", "Game.milkType=id;",
'CCSE.SetSelectedMilk(id);', 0);
// Background selector custom options
CCSE.ReplaceCodeIntoFunction("Game.Upgrades['Background selector'].olddescFunc", "this.choicesFunction()[Game.bgType]", "CCSE.GetSelectedBackground()", 0);
// Game.Upgrades['Background selector'].choicesFunction
if(!Game.customUpgrades['Background selector'].choicesFunction) Game.customUpgrades['Background selector'].choicesFunction = [];
CCSE.ReplaceCodeIntoFunction("Game.Upgrades['Background selector'].choicesFunction", "return choices;",
`// Game.customUpgrades['Background selector'].choicesFunction injection point 0
for(var i in Game.customUpgrades['Background selector'].choicesFunction) Game.customUpgrades['Background selector'].choicesFunction[i](choices);
CCSE.OverrideBackgroundSelector(choices);`, -1);
CCSE.ReplaceCodeIntoFunction("Game.Upgrades['Background selector'].choicesPick", "Game.bgType=id;",
'CCSE.SetSelectedBackground(id);', 0);
// Game.Upgrades['Jukebox'].choicesFunction
// Return str to have no effect
if(!Game.customUpgrades['Jukebox'].choicesFunction) Game.customUpgrades['Jukebox'].choicesFunction = [];
CCSE.ReplaceCodeIntoFunction("Game.Upgrades['Jukebox'].choicesFunction", "return",
`// Game.customUpgrades['Jukebox'].choicesFunction injection point 0
for(var i in Game.customUpgrades['Jukebox'].choicesFunction) str = Game.customUpgrades['Jukebox'].choicesFunction[i](str);`, -1);
// Permanent upgrades are tricky
var slots=['Permanent upgrade slot I','Permanent upgrade slot II','Permanent upgrade slot III','Permanent upgrade slot IV','Permanent upgrade slot V'];
for (var i=0;i