Advertisement
sinkir

KittenGame, build with price multiplicator

Jul 12th, 2023 (edited)
1,048
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. document.sUpgrade = 'transcendenceUpgrades';
  3. var str = "\n"+game.mods.sophie.queueLabelsAndValues.find(o=>o[0]==document.sUpgrade)[1].join("\n")+"\n";
  4. "\ngame.mods.sophie.aListToBuy = [];"+"\n"+str.replaceAll("\n", "', 'priceMutiplicator':1 } );\ngame.mods.sophie.aListToBuy.push( { 'name':'").replace("', 'priceMutiplicator':1 } );\n",'').replace(/game.mods.sophie.aListToBuy.push\( \{ 'name':'$/g , '');
  5.  
  6.  
  7.  ^  code to print base of code, past it in console to list transcendenceUpgrades,
  8.     see game.mods.sophie.queueLabelsAndValues for other upgrades
  9.  
  10.     /!\ Before using, you need to load the code at https://pastebin.com/raw/cfN9KFAc /!\
  11.  
  12. */
  13. if(!game.mods || !game.mods.sophie)
  14. {
  15.     console.error("/!\\ Before using, you need to load the code at https://pastebin.com/raw/cfN9KFAc /!\\ ");
  16.    
  17. }
  18.  
  19.  
  20. // base of code generated by commented line 2 + 3 + 4 :
  21. game.mods.sophie.aListToBuy = [];
  22. game.mods.sophie.aListToBuy.push( { 'name':'blackObelisk',  'priceMutiplicator':10000 } );
  23. game.mods.sophie.aListToBuy.push( { 'name':'blackNexus',    'priceMutiplicator':10000 } );
  24. game.mods.sophie.aListToBuy.push( { 'name':'blackCore',     'priceMutiplicator':1000 } );
  25. game.mods.sophie.aListToBuy.push( { 'name':'singularity',   'priceMutiplicator':1000 } );
  26. game.mods.sophie.aListToBuy.push( { 'name':'blackLibrary',  'priceMutiplicator':10000 } );
  27. game.mods.sophie.aListToBuy.push( { 'name':'blackRadiance', 'priceMutiplicator':1000 } );
  28. game.mods.sophie.aListToBuy.push( { 'name':'blazar',        'priceMutiplicator':1000 } );
  29. //game.mods.sophie.aListToBuy.push( { 'name':'darkNova',        'priceMutiplicator':1 } );
  30. //game.mods.sophie.aListToBuy.push( { 'name':'mausoleum',   'priceMutiplicator':1 } );
  31. //game.mods.sophie.aListToBuy.push( { 'name':'holyGenocide',    'priceMutiplicator':1 } );
  32.  
  33. game.mods.sophie.sResName = "relic";
  34. buildRec();
  35.  
  36.  
  37. function buildRec()
  38. {
  39.     game.mods.sophie.sortedArray = fillPricesAndSort(game.mods.sophie.aListToBuy, game.mods.sophie.sResName);
  40.    
  41.     if(game.resPool.get(game.mods.sophie.sResName).value > game.mods.sophie.sortedArray[0].prices.find(o=>o.name == game.mods.sophie.sResName).val)
  42.     {
  43.         //console.log("Try to build "+game.mods.sophie.sortedArray[0].name);
  44.         var sRet = game.mods.sophie.smartBuild(game.mods.sophie.sortedArray[0].name);
  45.         console.log(sRet+" build "+game.mods.sophie.sortedArray[0].name);
  46.         game.render();
  47.         setTimeout(buildRec, 50);
  48.     }
  49.     else
  50.     {
  51.         console.log("transcendenceUpgrades end");
  52.     }
  53.    
  54. }
  55.  
  56.  
  57. function fillPricesAndSort(aArray)
  58. {
  59.     for(var i=0; i<aArray.length; i++)
  60.     {
  61.         var aTmpPrices = game.mods.sophie.smartGetPrices(aArray[i].name);
  62.         for (var j=0; j<aTmpPrices.length; j++)
  63.         {
  64.             aTmpPrices[j].val *= aArray[i].priceMutiplicator;
  65.         }  
  66.         aArray[i].prices = aTmpPrices;
  67.     }
  68.     aArray.sort((a,b)=> a.prices.find(o=>o.name == game.mods.sophie.sResName).val - b.prices.find(o=>o.name == game.mods.sophie.sResName).val);
  69.     return aArray;
  70. }
Tags: Kittensgame
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement