diff --git a/.gitignore b/.gitignore index 62c8935..db7c235 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.idea/ \ No newline at end of file +.idea/ +cookie-clicker.js \ No newline at end of file diff --git a/cookie-sower.js b/cookie-sower.js index e62c908..2c50d2c 100644 --- a/cookie-sower.js +++ b/cookie-sower.js @@ -1 +1,46 @@ -Game.Popup("Hello world!"); \ No newline at end of file +CS = {} + +CS.init = function(){ + CS.Garden = Game.Objects['Farm'].minigame; + CS.initializeTool(); + if(Game.prefs.popups){ + Game.Popup("Cookie sower loaded!"); + } + else{ + Game.Notify("Cookie sower loaded!", "Cookie sower for Cookie Clicker version "+Game.version, '', 1, 1); + } +} +CS.plantAll = function(){ + if(CS.Garden.seedSelected >= 0){ + var plantId = CS.Garden.seedSelected; + Game.Popup(CS.Garden.plantsById[plantId].name); + for(var x = 0;x<6;x++){ + for(var y = 0;y<6;y++){ + if(CS.Garden.isTileUnlocked(x,y) && CS.Garden.canPlant(CS.Garden.plantsById[plantId]) && (CS.Garden.plot[y][x][0] == 0)){ + CS.Garden.plot[y][x]=[plantId+1,0]; + Game.Spend(CS.Garden.getCost(CS.Garden.plantsById[plantId])); + } + } + } + l('gardenSeed-'+CS.Garden.seedSelected).classList.remove('on'); + CS.Garden.seedSelected = -1; + CS.Garden.toRebuild=true; + } +} +CS.initializeTool = function(){ + CS.Garden.tools['sower'] = { + name:'Quick sower', + icon: 2, + desc:'-', + descFunc:function(){ + return 'Instantly fill as many empty garden tiles as you can afford with the selected seed. Be careful when this tool! Some seeds are VERY expensive.
'; + }, + func:function(){ + CS.plantAll(); + } + } + CS.Garden.toolsById=[];var n=0;for (var i in CS.Garden.tools){CS.Garden.tools[i].id=n;CS.Garden.tools[i].key=i;CS.Garden.toolsById[n]=CS.Garden.tools[i];n++;} + CS.Garden.buildPanel(); +} + +CS.init(); \ No newline at end of file