· 7 years ago · Oct 13, 2018, 12:20 PM
1#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
2; #Warn ; Enable warnings to assist with detecting common errors.
3SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
4SetWorkingDir, %A_ScriptDir% ; Ensures a consistent starting directory.
5savename := A_workingdir . "\backgroundpowersave.ini"
6DetectHiddenWindows, on
7#singleinstance force
8#MaxHotkeysPerInterval 500
9OnExit("savegame_onclick")
10;Version. I change this value with new versions. Some features on savefiles of older versions may not be compatible so I try to make something that fixes that
11Currentversion := 130
12if(!FileExist(savename)){
13 ;if there is no savefile. One will be made and filled with some values as to not freak out the check below that checks if values got corrupted (just in case)
14 FileAppend,[values]`n[treasures]`n[garden]`n[options], %savename%
15 iniwrite, 0, %savename%, values, power
16 iniwrite, 0, %savename%, values, treasurekeys
17 iniwrite, 0, %savename%, values, treasurechests
18 iniwrite, 0, %savename%, values, treasureradarbought
19 iniwrite, 0, %savename%, values, gardentiles
20 iniwrite, 0, %savename%, values, freezertiles
21 iniwrite, 0, %savename%, garden, almanacunlocked
22 iniwrite, currentversion, %savename%, values, version
23}
24;read all the values from the savefile
25IniRead, Power, %savename%, Values, Power
26IniRead, upgrades, %savename%, Upgrades, upgrades
27IniRead, gardentiles, %savename%, Values, gardentiles
28IniRead, freezertiles, %savename%, Values, freezertiles
29iniread, stats, %savename%, values, stats
30IniRead, treasurekeys, %savename%, Values, treasurekeys
31IniRead, treasurechests, %savename%, Values, treasurechests
32iniread, version, %savename%, Values, version
33IniRead, treasures, %savename%, Treasures, treasures
34IniRead, treasureradarbought, %savename%, Values, treasureradarbought
35IniRead, plantknowledge, %savename%, garden, plantknowledge
36IniRead, almanacunlocked, %savename%, garden, almanacunlocked
37iniread, optionchecks, %savename%, options, optionchecks
38if(VersionCompare("1.1.30.00", A_ahkversion) == 1 && currentversion <> version){
39 msgbox % "your autohotkey version may be outdated. This may end up causing an error Consider updating it."
40}
41;just to be sure I added a couple failsaves in case something goes wrong with the values
42checkvalues := ["power", "treasurekeys", "treasurechests", "treasureradarbought", "gardentiles", "freezertiles"]
43loop, % checkvalues.MaxIndex(){
44 somevalue := checkvalues[A_index]
45 if %somevalue% is not number
46 {
47 msgbox % "something went wrong. " . checkvalues[A_index] . " is not a number. The value contained the following: " . arraytostring(%somevalue%) . "`nif there's nothing here that means the values are empty. Sadly this means " . checkvalues[A_index] . " has been reset to 0. Please report this problem to the game maker. found on reddit by the name /u/pimhazeveld"
48 %somevalue% := 0
49 }
50}
51;these V are all the upgrades available in the shop. They have an abillity, description, cost, and increase in price.
52;clickpower, movepower and treasurepower should sound obvious. Ones with 'percent' after them boost the power gain by a procentual amount instead.
53;price is the base price of the upgrade, priceincrease increases the price by a set amount after every purchase and priceincreasepercent increases the price by a set % after every upgrade, formula should be price := price + (priceincrease * purchased) * ((priceincreasepercent / 100)^purchased) + 1
54;repeated means the amount of times the upgrade can be purchased
55clickingpower := {clickpower: 1, descr: "You can only gain power by clicking once every 2 seconds", name: "Clicking power", price: 5, priceincrease: 4, priceincreasepercent: 10, repeated: 100}
56clickingpower2 := {clickpower: 2, clickpowerpercent: 1, descr: "A more powerful way to click. Also gives a procentual buff", name: "Clicking power 2", price: 250, priceincrease: 30, priceincreasepercent: 15, repeated: 100, unlockcondition:[{name:"clickingpower", array:"purchased", amount:15, requirement:">="}]}
57mouseengine := {movepower: 4, movespeed: 1, descr: "Every 10 seconds you gain power based on how much the mouse was moved.", name: "Mouse engine", price: 20, priceincrease: 20, priceincreasepercent: 8, repeated: 100, unlockcondition:[{name:"clickingpower", array:"purchased", amount:3, requirement:">="}]}
58keyboardmotor := {keyboardkeypower:1, descr:"Every second, gain power when pressing a letter on the keyboard", name:"Keyboard motor", price:50, priceincrease:25, priceincreasepercent:10, repeated: 100, unlockcondition:[{name:"mouseengine", array:"purchased", amount:5, requirement:">="}, {name:"clickingpower", array:"purchased", amount:5, requirement:">="}]}
59keyboardmotor2 := {keyboardkeypower:3, keyboardkeypowerpercent:1, descr:"Everything needs a second level nowadays.", name:"Keyboard motor 2", price:500, priceincrease:100, priceincreasepercent:12, repeated: 100, unlockcondition:[{name:"keyboardmotor", array:"purchased", amount:15, requirement:">="}]}
60gamersfuel := {descr:"Doubles keyboard power gain when pressing one of the WASD keys", name:"Gamers fuel", repeated:1, price:7500, unlockcondition:[{name:"keyboardmotor", array:"purchased", amount:10, requirement:">="}]}
61mouseengine2 := {movepower: 8, movespeed: 1, movepowerpercent: 1, descr: "A more powerful mouse engine. Also gives a procentual buff.", name: "Mouse engine 2", price: 600, priceincrease: 200, priceincreasepercent: 15, repeated: 100, unlockcondition:[{name:"mouseengine", array:"purchased", amount:15, requirement:">="}]}
62mousemastery := {descr:"Moving the mouse now also grants power for clicking", name:"Mouse mastery", price:35000, repeated:1, unlockcondition:[{name:"clickingpower2", array:"purchased", amount:5, requirement:">="}, {name:"mouseengine2", array:"purchased", amount:5, requirement:">="}]}
63mouseengine3 := {descr: "Grants a lot of extra power for mouse movements based on how much the mouse was moved", name: "Mouse engine 3", price: 1000000000, unlockcondition:[{name:"mouseengine2", array:"purchased", amount:50, requirement:">="}]}
64;this one ^ is neat but slightly too powerful so it isn't included in all upgrades right now. However if you want to add it to the game. All you have to do is add its name (mouseengine3) to the allupgrades array below
65knowledgepower := {movepowerpercent: 5, clickpowerpercent: 5, keyboardkeypowerpercent: 5, harvestpowerpercent:5, descr: "This knowledge is getting to your head. Great!", name: "Knowledge is power", price: 500000, repeated:10, priceincreasepercent:95, unlockcondition:[{name:"plantknowledge", array:"knowledge", amount:100, requirement:">="}]}
66knowledgepower2 := {descr:"Making power with your mind", name:"Knowledge is power too", knowledgepower:0.02, price:1234567, repeated:1, unlockcondition:[{name:"plantknowledge", array:"knowledge", amount:500, requirement:">="}, {name:"knowledgepower", array:"purchased", amount:1}]}
67garden := {plantchance: 1, descr: "The first level of this upgrade also unlocks the garden in the options menu.`n", name: "Garden", price: 1000, repeated: 100, priceincreasepercent: 10, unlockcondition:[{name:"clickingpower", array:"purchased", amount:12, requirement:">="}]}
68garden2 := {harvestpowerpercent:1, descr: "Spices up your garden by increasing power gained", name: "Garden 2", price:3000, repeated: 100, priceincrease:100, priceincreasepercent:12, unlockcondition:[{name:"power", amount:10000, requirement:">="}, {name:"garden", array:"purchased", requirement:">=", amount:15}]}
69hiddentreasure := {descr: "Occasionally assigns a random point on the screen as a treasure point.`n Mouse over them to gain 25 times the power of a normal mouse movement and sometimes a chest", name: "Hidden treasures", repeated: 1, price: 6250, unlockcondition:[{name:"mouseengine", array:"purchased", amount:15, requirement:">="}, {name:"keyboardmotor", array:"purchased", amount:10, requirement:">="}]}
70goldenkeys := {descr: "Occasionally turns a random keyboard letter key into an golden key.`nPressing it gives 25 times the power of a normal keyboard key and sometimes a treasure key.", name: "Golden keys", repeated:1, price: 6250, unlockcondition:[{name:"keyboardmotor", array:"purchased", amount:15, requirement:">="}, {name:"mouseengine", array:"purchased", amount:10, requirement:">="}]}
71
72allupgrades := ["clickingpower", "mouseengine", "keyboardmotor", "garden", "clickingpower2", "mouseengine2", "keyboardmotor2", "garden2", "mousemastery", "gamersfuel", "hiddentreasure", "goldenkeys", "knowledgepower", "knowledgepower2"]
73
74;all plants available in the game are listed here except one which is created by "evolution"
75dusttree := {rarity: 100, knowledge: 4, descr: "Contains power. Mostly dust but some power", name:"dust tree", symbol:"Dt", background:"#888888", textcolor:"#000000", harvest:{harvestpower:90}, global:{clickpower:2}}
76barkwood := {rarity: 100, knowledge: 15, descr: "A small but dense tree. Its bark makes for a great power source but sadly this plant has barely any of it", name:"barkwood", symbol:"Bw", background:"#55AA88", textcolor:"#000000", harvest:{harvestpower:200}, passive:{harvestpowerpercent:400}, global:{harvestpowerpercent:1}}
77titantree := {rarity: 100, knowledge: 30, descr:"A tall tree with tons of bark. Its almost impossible to harvest most of the possible power from it but its influence stands tall", name:"titantree", symbol:"TT", background:"#55AA88", textcolor:"#555555", harvest:{harvestpower:1900}, global:{harvestpowerpercent:10}}
78tickflower := {rarity: 100, knowledge: 5, descr: "A relatively normal flower. It smells like progress", name:"tick flower", symbol:"Tf", background:"#AADD88", textcolor:"#DD4444", global:{clickpowerpercent:2}}
79pumpkin := {rarity:100, knowledge: 50, descr:"Spooky", name:"pumpkin", symbol:"P", background:"#FF7700", textcolor:"#00AA00", harvest:{harvestpower:5000, chest:1}}
80goldleaf := {rarity:100, knowledge: 50, descr:"A plant known for its great wealth and secrets.", name:"gold leaf", symbol:"Gl", background:"#55AA88", textcolor:"#FFCC55", harvest:{harvestpower:7777, goldenkey:1, knowledge:1}}
81lockbloom := {rarity:100, knowledge:50, descr:"A neat plant that occasionally takes on the shape of the current golden key", name:"lockbloom", symbol:"Lb", background:"#DDDD00", harvest:{harvestpower:3000}}
82yellowberry := {rarity: 100, knowledge: 7, descr: "Yellow berries don't do anything special but are great at creating new and exciting plants",name: "yellowberry", symbol:"Yb", background:"#55AA88", textcolor:"#FFFF00"}
83bluestalk := {rarity: 100, knowledge: 15, descr: "An uncommon plant containing a high density of power", name:"blue stalk", symbol:"Bs", background:"#AA9900", textcolor:"#3333FF", harvest:{harvestpower:1200}, global:{clickpower:6}}
84fruittree := {rarity: 100, knowledge: 8, descr: "Useful for when you're hungry. Or just want to fruit up your clicks.", name:"fruit tree", symbol:"Ft", background:"#55AA88", textcolor:"#FF4422", harvest:{harvestpower:270}, passive:{clickpower:2}, global:{clickpowerpercent:4}}
85yellowbulb := {rarity: 100, knowledge: 8, descr: "A rather large bulb shrowded in green leaves, ready to explode with power.", name: "yellow bulb", symbol:"YB", background:"#55AA55", textcolor:"#FFFF00", harvest:{harvestpower:350}}
86bluebulb := {rarity: 100, knowledge:24, descr: "This plant contains a dense pocket of power. Useful for sure", name: "blue bulb", symbol:"Bb", background:"#9999FF", textcolor:"#3333FF", harvest:{harvestpower:5000}}
87crystalbulb := {rarity: 100, knowledge:24, descr: "A giant berry made of pure crystallized power.", name: "crystal bulb", symbol:"Cb", background:"#225522", textcolor:"#9999FF", harvest:{harvestpower:25000}}
88partythyme :={rarity: 100, knowledge: 28, descr: "Happy birthda.... Wait what do you mean its not your birthday? Or is it?", name:"party thyme", symbol:"Pt", background:"#55AA88", textcolor:"#FF8888", harvest:{harvestpower:8000}, global:{clickpower:10, movepower:25, keyboardkeypower:15}}
89yellowstalk := {rarity: 100, knowledge: 12, descr: "Does a bit of everything", name: "yellow stalk", symbol:"Ys", textcolor:"#FFFF00", background:"#55AA88", harvest:{harvestpower:800}, global:{clickpower:2, movepower:6, movespeed:1, movepowerpercent:1, clickpowerpercent:1}}
90dimbloom := {rarity: 100, knowledge: 20, descr: "The mist seems to have disappeared leaving behind a purely black flower. Eldritch powers lie within. What happens if you continue breeding?", name:"dimbloom", symbol:"D", background:"#555555", textcolor:"#000000", harvest:{harvestpower:900}, global:{clickpowerpercent:7}}
91greenstalk := fusearrays([{descr: "This outcome should not be a surprise", name:"green stalk", symbol:"Gs", background:"#55AA88", textcolor:"#00FF00"}, yellowstalk, bluestalk])
92greenstalk["rarity"] := 100
93weaversivy := {rarity:100, knowledge:35, descr:"A moderately toxic plant affecting the life around it.", name:"Weavers Ivy", symbol:"Wi", background:"#22AAAA", auras:{passive:{toxic:1}}}
94;popoppy := {rarity:100, knowledge:17, descr:"Pop!", name:"Popoppy", symbol:"Pp", background:"#55AA88", textcolor:"#FF6666", harvest:{harvestseeds:1}}
95;agrose := {rarity: 100, knowledge:40, descr: "Violent red flower that blasts rather harmless seeds that are mostly helpful.", name:"agrose", symbol:"Ar", background:"#FF6666", harvest:{harvestseeds:6}}
96;these two are currently unused due to them possibly causing bugs because they delay the harvest animation meaning you could move or inspect them during the harvest which screws stuff up.
97sapleaf := {rarity: 100, knowledge:35, descr: "A rich energetic sap oozes from this plant to the neighboring tiles", name:"sapleaf", symbol:"Sl", background:"#DD8844", textcolor:"#111111", auras:{global:{clickpower:1}, passive:{harvestpower:3, harvestpowerpercent:5, movepowerpercent:1}}, tileauras:{passive:{harvestpowerpercent:5}}}
98shockweaver := {rarity: 100, knowledge:35, descr: "An plant with electric current running through it. It ""helps"" perform better mouse movement", name:"shockweaver", symbol:"Sw", background:"#DD9900", textcolor:"#7766FF", global:{movespeed:2, movepower:5}, auras:{passive:{movepowerpercent:5}}, tileauras:{global:{movepower:3}, passive:{movepowerpercent:5}}}
99rootwraith := {rarity: 100, knowledge:40, descr: "This tree looks rather hollow and cursed. But a good kind of cursed", name:"rootwraith", symbol:"Rw", background:"#997700", textcolor:"#880088", harvest:{harvestpower:1900}, passive:{harvestpowerpercent:50}, auras:{passive:{harvestpower:15, harvestpowerpercent:7}}, tileauras:{passive:{harvestpower:10}, global:{harvestpowerpercent:1}}}
100knowleaf := {rarity: 100, knowledge:6, descr: "A plant that knows a lot about plants", name:"knowleaf", symbol:"kl", background:"#55AA88", textcolor:"#FFAAFF", harvest:{harvestpower:2, knowledge:2}}
101knowleafier := {rarity:100, knowledge:16, descr:"Now we're talking knowledge", name:"knowleafier", symbol:"Kl", background:"#55AA88", textcolor:"#FF55AA", harvest:{harvestpower:5, knowledge:5}}
102knowleafiest := {rarity:100, knowledge:36, descr:"Its bursting with knowledge. You're probably not gonna fit anything else in it", name:"knowleafiest", symbol:"KL", background:"#55AA88", textcolor:"#FF0000", harvest:{harvestpower:10, knowledge:10}}
103smartstalk := {rarity:100, knowledge:66, descr:"Luckily knowleaf plants arent the only ones capable of storing knowledge", name:"smartstalk", symbol:"Ss", background:"#55AA88", textcolor:"#5555FF", harvest:{knowledge:25}}
104brainmoss := {rarity:100, knowledge:166, descr:"The ultimate solution to your lack of knowledge (not a personal insult). You should probably stop here before your plants gain sentience", name:"brainmoss", symbol:"Bm", background:"#FFAAFF", textcolor:"#AA00AA", harvest:{knowledge:40}, auras:{passive:{knowledgepercent:100}}, tileauras:{global:{knowledgepercent:4}}}
105grimpetal := {rarity: 100, knowledge:16, descr: "A dark mist shrouds this flower making it kinda hard to see", name:"grimpetal", symbol:"Gp", background:"#000000", textcolor:"#FFFFFF", global:{clickpower:10}, auras:{passive:{clickpowerpercent:10}}}
106gripvine := {rarity: 100, knowledge:24, descr: "A vine that gets a good grip on things", name: "gripvine", symbol:"Gv", background:"#665500", textcolor:"#22FF44", global:{movepower:25, movespeed:1}}
107clickvine := {rarity: 100, knowledge:40, descr: "A very potent vine infused with clicking power", name:"clickvine", symbol:"Cv", background:"#665500", textcolor:"#22FF44", harvest:{harvestpower:800}, auras:{passive:{clickpowerpercent:5}}, tileauras:{passive:{clickpowerpercent:5}}}
108evolution := {rarity: 100, knowledge:100, descr: "A weird plant composed of a combination of darkness, potency and combination.", name: "evolution", symbol:"Ev", background:"#000000", textcolor:"#AA00AA", harvest:{harvestpower:6666}, fusion:{strength:1, amount:2, name:"amalgam plant", background:"#666666", symbol:"X", descr:"Turns out fusing plants doesn't combine the appeal of them."}}
109;The plants value contains an array of all plants that can appear naturally in the garden
110
111plants := [dusttree, tickflower]
112
113allplants := {dusttree:dusttree, barkwood:barkwood, titantree:titantree, tickflower:tickflower, pumpkin:pumpkin, goldleaf:goldleaf, lockbloom:lockbloom, yellowberry:yellowberry, bluestalk:bluestalk, bluebulb:bluebulb, crystalbulb:crystalbulb, fruittree:fruittree, yellowbulb:yellowbulb, partythyme:partythyme, yellowstalk:yellowstalk, dimbloom:dimbloom, greenstalk:greenstalk
114, weaversivy:weaversivy, sapleaf:sapleaf, shockweaver:shockweaver, rootwraith:rootwraith, knowleaf:knowleaf, knowleafier:knowleafier, knowleafiest:knowleafiest, smartstalk:smartstalk, brainmoss:brainmoss, grimpetal:grimpetal, gripvine:gripvine, clickvine:clickvine, evolution:evolution}
115
116plantcombos := [{pardners:["dusttree", "tickflower"], result:"fruittree", rarity:25}, {pardners:["tickflower"], result:"yellowberry", rarity:80}, {pardners:["yellowbulb", "grimpetal"], result:"yellowstalk", rarity:25}
117 , {pardners:["dusttree", "yellowberry"], result:"yellowbulb", rarity:45}, {pardners:["yellowstalk", "bluestalk"], result:"greenstalk", rarity:35}, {pardners:["greenstalk", "dimbloom"], result:"gripvine", rarity:40}
118 , {pardners:["fruittree", "gripvine", "grimpetal"], result:"clickvine", rarity:35}, {pardners:["tickflower", "tickflower", "yellowberry"], result:"grimpetal", rarity:50}, {pardners:["grimpetal", "tickflower", "tickflower"], result:"dimbloom", rarity:35}
119 , {pardners:["yellowbulb", "dimbloom"], result:"bluestalk", rarity:50}, {pardners:["greenstalk", "dimbloom", "clickvine"], result:"evolution", rarity:15}, {pardners:["dusttree", "yellowberry"], result:"knowleaf", rarity:100}
120 , {pardners:["dusttree", "fruittree"], result:"barkwood", rarity:40}, {pardners:["dusttree", "dusttree", "dusttree", "dusttree", "dusttree", "dusttree", "dusttree"], result:"titantree", rarity:4}, {pardners:["barkwood", "barkwood", "dusttree"], result:"titantree", rarity:30}
121 , {pardners:["tickflower", "yellowbulb", "dimbloom", "fruittree"], result:"sapleaf", rarity:45}, {pardners:["knowleaf", "dimbloom", "yellowbulb", "bluestalk"], result:"shockweaver", rarity:35}
122 , {pardners:["dusttree", "dusttree", "barkwood", "fruittree", "titantree", "titantree"], result:"rootwraith", rarity:75}, {pardners:["fruittree", "fruittree", "yellowbulb", "rootwraith", "evolution"], result:"pumpkin", rarity:25}
123 , {pardners:["knowleaf", "dimbloom", "rootwraith", "sapleaf", "evolution"], result:"goldleaf", rarity:25}, {pardners:["knowleaf", "evolution", "fruittree", "yellowbulb"], result:"partythyme", rarity:75}
124 , {pardners:["knowleaf", "knowleaf", "knowleaf"], result:"knowleafier", rarity:25}, {pardners:["knowleaf", "yellowbulb", "tickflower"], result:"knowleafier", rarity:50}, {pardners:["knowleafier"], result:"knowleaf", rarity:25}]
125;here are all the combos in the game. When the listed plants are next to an empty tile. The plant in the result object can appear there.
126;The statement ended up being too long so I had to end it and step over to pushing additional entries individually
127plantcombos.push({pardners:["titantree", "yellowbulb", "bluestalk"], result:"bluebulb", rarity:30})
128plantcombos.push({pardners:["bluebulb", "shockweaver", "evolution"], result:"crystalbulb", rarity:10})
129plantcombos.push({pardners:["yellowberry", "flower"], result:"knowleaf", rarity:100})
130plantcombos.push({pardners:["knowleafier", "knowleafier", "knowleafier"], result:"knowleafiest", rarity:25})
131plantcombos.push({pardners:["knowleafier", "dimbloom", "grimpetal", "flower"], result:"knowleafiest", rarity:100})
132plantcombos.push({pardners:["knowleafiest"], result:"knowleafier", rarity:25})
133plantcombos.push({pardners:["knowleaf", "knowleafier", "knowleafiest", "evolution"], result:"smartstalk", rarity:100})
134plantcombos.push({pardners:["evolution", "knowleafiest", "smartstalk", "shockweaver"], result:"brainmoss", rarity:16})
135plantcombos.push({pardners:["shockweaver", "yellowberry", "flower"], result:"weaversivy", rarity:50})
136plantcombos.push({pardners:["goldleaf", "dimbloom"], result:"lockbloom", rarity:100})
137
138;garden height and size are listed here (different sizes could occur in the future)
139gardenmaxX := 10
140gardenmaxY := 10
141
142upgrades := stringtoarray(upgrades)
143if (!IsObject(upgrades) || upgrades.Count() == 0 ||upgrades.Count() == ""){
144 upgrades := {}
145}
146for a, b in allupgrades
147{
148 if(!isnum(upgrades[b]["purchased"])){
149 upgrades[b] := {purchased:0, unlocked:"locked"}
150 if(b == "clickingpower"){
151 upgrades[b]["purchased"] := 1
152 }
153 fusearrays([%b%, upgrades[b]])
154 }
155 for c, d in upgrades[b]{
156 %b%[c] := d
157 }
158}
159
160plantknowledge := stringtoarray(plantknowledge)
161if (!IsObject(plantknowledge) || plantknowledge.Count() == 0 ||plantknowledge.Count() == ""){
162 plantknowledge := {}
163}
164if(!plantknowledge["knowledge"]){
165 plantknowledge["knowledge"] := 0
166}
167for a, b in allplants{
168 if(!plantknowledge[a]){
169 plantknowledge[a] := {}
170 }
171 if(!plantknowledge[a]["current"]){
172 plantknowledge[a]["current"] := 0
173 }
174 if(!plantknowledge[a]["cap"]){
175 plantknowledge[a]["cap"] := b["Knowledge"]
176 }
177 if(!plantknowledge[a]["seen"]){
178 plantknowledge[a]["seen"] := 0
179 }
180}
181;here are all the treasures in the game. Their rarity and their name.
182treasurestats := {amulets:{rarity:100, name:"amulet"}, rings:{rarity:100, name:"ring"}, grails:{rarity:100, name:"grail"}, goldbars:{rarity:100, name:"gold bar"}, goldcoins:{rarity:100, name: "gold coin"}, pearls:{rarity:100, name:"pearl"}, emeralds:{rarity:100, name:"emerald"}}
183treasures := stringtoarray(treasures)
184if (!IsObject(treasures) || treasures.Count() == 0 ||treasures.Count() == ""){
185 treasures := {}
186}
187for a, b in treasurestats
188{
189 if(!treasures[a]){
190 treasures[a] := 0
191 }
192}
193
194stats := stringtoarray(stats)
195if (!IsObject(stats) || stats.Count() == 0 ||stats.Count() == ""){
196 stats := {}
197}
198;these are all the buttons in the options menu. Optionchecks stores whether they are selected or not.
199alloptions := {showmaxedshopupgrades:"Show maxed shop upgrades"
200 , disablemenusnapping:"Disable putting the main menu to another location when it is moved off screen. (does not work on the top of the screen)"
201 , autoclickprevention:"Prevent clicking rewards gained when clicking really fast (in case autoclickers are used and you dont want them to affect the game)"}
202optionchecks := stringtoarray(optionchecks)
203if (!IsObject(optionchecks) || optionchecks.Count() == 0 ||optionchecks.Count() == ""){
204 optionchecks := {}
205}
206optioncheckvalue := {}
207for a, b in alloptions
208{
209 if(optionchecks[a] == 1){
210 optioncheckvalue[a] := 1
211 }
212 else{
213 optioncheckvalue[a] := 0
214 }
215}
216optionchecks := optioncheckvalue
217
218;assign all garden tiles with their values
219loop, % gardenMaxX * gardenMaxY{
220 CX := mod(A_index, gardenMaxX)
221 CY := ceil(A_index / gardenMaxY)
222 if(CX == 0){
223 CX := gardenMaxX
224 }
225 ;check if the buttons contain plants and if you have enough garden tiles to make them visible. Tiles you dont have are invisible. Tiles you dont have but with a plant are disabled.
226 nextto := [ CX - 1 . "A" . CY - 1, CX . "A" . CY - 1, CX + 1 . "A" . CY - 1, CX - 1 . "A" . CY, CX + 1 . "A" . CY, CX - 1 . "A" . CY + 1, CX . "A" . CY + 1, CX + 1 . "A" . CY + 1]
227 ;this part reads the savedata for the garden and imports and plants in their correct locations.
228 freezertile%CX%A%CY% := {nextto:nextto, temp:{}, permanent:{}, location:[CX, CY, "freezer", A_index]}
229 iniread, savedtile, %savename%, garden, freezertile%CX%A%CY%
230 if(savedtile <> "ERROR"){
231 gardenvalue := objfullyclone(stringtoarray(savedtile))
232 freezertile%CX%A%CY%["plant"] := gardenvalue["plant"]
233 }
234 tile%CX%A%CY% := {nextto:nextto, temp:{}, permanent:{}, location:[CX, CY, "garden", A_index]}
235 iniread, savedtile, %savename%, garden, tile%CX%A%CY%
236 if(savedtile <> "ERROR"){
237 gardenvalue := objfullyclone(stringtoarray(savedtile))
238 tile%CX%A%CY%["permanent"] := gardenvalue["permanent"]
239 tile%CX%A%CY%["plant"] := gardenvalue["plant"]
240 }
241 ;this is an average tile string looks like remove the ; symbol from all text below this to see what happens and get some info out of it. (I hope)
242 ;tile4A5 := {plant: ;if there's a plant here V. This object contains its stats
243 ;{rarity: 100, descr: "An ordinary tree", name: "tree", harvest:{harvestpower:25}, global:{clickpower:1}}
244 ;, nextto: ;here V are all the tiles that the current tile is next to. Does not go below 1 but can go above the current amount of tiles in case new ones get added
245 ;[3A4, 4A4, 5A4, 3A5, 5A5, 3A6, 4A6, 5A6]
246 ;, location: ; This contains the location of the tile itself
247 ;[4, 5, garden, 54]
248 ;, temp: ;here V come temporary effects from plants that buff nearby tiles
249 ;{passive:{clickpowerpercent: 10}}
250 ;, permanent: ;here V come the permanent buffs to a tile which are slowly affected by certain other plants
251 ;{passive:{movepowerpercent: 20, clickpowerpercent: 10}}}
252 ;msgbox % arraytostring(tile4A5["nextto"]) ;returns the tiles the current tile is next to
253 ;msgbox % tile4A5["nextto"][1] ;returns the first tile that the current tile is next to. Tiles that do not exist like tiles below 0 should be ignored.
254 ;msgbox % arraytostring(tile4A5) returns everything from garden tile 3-2
255}
256
257clickwaitvalue := 2000
258autoclickwaitvalue := 125
259movewaitvalue := 10000
260timercheckvalue := 100
261treasurewaitvalue := 60000
262keyboardkeywaitvalue := 1000
263goldenkeywaitvalue := 60000
264autosavewaitvalue := 300000
265clickwait := A_tickcount + clickwaitvalue
266autoclickwait := A_tickcount + autoclickwaitvalue
267movewait := A_tickcount + movewaitvalue
268timercheck := A_tickcount + timercheckvalue
269treasurewait := A_tickcount + treasurewaitvalue
270keyboardkeywait := A_tickcount + keyboardkeywaitvalue
271goldenkeywait := A_tickcount + goldenkeywaitvalue
272autosavewait := A_tickcount + autosavewaitvalue
273logs := {}
274tooltips := []
275
276starttime := A_tickcount
277coordmode, mouse, screen
278coordmode, tooltip, screen
279
280;dev functions
281instantmouseclicks := "false" ;disables the waiting time before claiming power by clicking
282instantmousemovement := "false" ;disables the waiting time before claiming power by moving the mouse. Even when not moving at all
283silentmovementlogs := "100" ;removes the "moving the mouse gave (AMOUNT) power" logs. Set this to a number to reduce the amount of logs put in (250 sets it to 1/4th of the original rate)
284maxgardenplantchance := "false" ;grants a 100% chance of a plant appearing on a tile when moving the mouse
285maxgardenpermbuffs := "false" ;Makes garden plants with permanent effects apply their max possible effect immediately
286silentplants := "false" ;same deal as silent movement logs but for when a garden plant appears in the garden instead. Some special plants still bypass this
287ignoreplantrarity := "false" ;plant rarity no longer makes it appear less
288noplants := "false" ;moving the mouse doesn't cause plants to appear anymore
289limitlessfusions := "false" ;causes plants with the fusion abillity to ignore plant weakness allowing them to fuse as many already fused plants together as you want.
290devbuttonenabled := "false" ;enables the dev button which has varying effects based on what I want to test right now
291F11reset := "false" ;reloads the game when pressing F11
292
293loop, 26{
294 ;binds all letter keys to a hotkey
295 Hotkey, % "~" . Chr(A_index+96) . " up", keyboardletters
296}
297
298guiwidth := A_screenwidth / 1.5
299guiheight := A_screenheight / 1.5
300gui Backgroundpower:default
301gui, add, edit, h0 w0
302gui, font, s10
303gui +Border -Caption +lastfound
304gui, color, EBAE02
305WinSet, TransColor, EBAE02
306winsettitle, Background Power
307selectedfeature := "nothing"
308updatemain()
309updategardeneffects()
310if(version <> "ERROR" && 130 > version){
311 ;in v 1.30, hidden keys have been renamed to golden keys so this part turns all the hidden keys levels into golden key levels. Furthermore the power gained from hidden treasures has been changed to 25x the power of moving the mouse with 1 max level
312 almanacunlocked := 0
313 if(upgrades["hiddenkeys"]["purchased"] >= 1){
314 if(!upgrades["goldenkeys"]){
315 upgrades["goldenkeys"] := {}
316 }
317 upgrades["goldenkeys"]["purchased"] := 1
318 upgrades.delete("hiddenkeys")
319 }
320 if(hiddentreasure["purchased"] > 1){
321 hiddentreasure["purchased"] := 1
322 }
323 IniRead, plantcomboknowledge, %savename%, garden, plantcomboknowledge
324 ;the plant combo part system has been overhauled and turned into the almanac rendering the old system useless. Anyone gets 2 free knowledge points per unlocked recipe. They still need to unlock the almanac though
325 plantcomboknowledge := stringtoarray(plantcomboknowledge)
326 loop, % plantcomboknowledge.maxIndex(){
327 if(plantcomboknowledge[A_index] == 1){
328 plantknowledge["knowledge"] += 2
329 }
330 }
331 IniDelete, %savename%, garden, plantcomboknowledge
332}
333;not sure what this V part does but it makes moving the gui with the mouse possible so it stays
334OnMessage(0x0201, "WM_LBUTTONDOWN")
335WM_LBUTTONDOWN()
336{
337 If (A_Gui){
338 PostMessage, 0xA1, 2
339 }
340}
341timervalue := 25
342SetTimer, globaltimer, %timervalue%
343gui, show, autosize
344return
345
346~LButton::
347;this triggers whenever the left mouse button is clicked.
348removetooltip("shopdescription")
349removetooltip("gardendescription")
350if(A_tickcount > clickwait && !(autoclickwait > A_tickcount && optionchecks["autoclickprevention"] == 1) || instantmouseclicks == "true"){
351 ;autoclickprevention is an option that you can turn on (default off) which prevents power gain from clicking too fast
352 ;in case people really want to play my game but also really feel like autoclickers are cheating
353 clickwait := A_tickcount + clickwaitvalue
354 somemousevalue := calculateclickvalue()
355 changepower(somemousevalue)
356 if(!stats["clicks"]){
357 stats["clicks"] := 0
358 }
359 stats["clicks"] += 1
360}
361autoclickwait := A_tickcount + autoclickwaitvalue
362return
363
364keyboardletters:
365;when a keyboard key is released. This part triggers.
366;I made it trigger on release instead of pressing because you could trigger this multiple times by holding.
367if(A_tickcount > keyboardkeywait && keyboardmotor["purchased"] >= 1){
368 somekeyboardvalue := calculatekeyboardkeyvalue(A_thishotkey)
369 keyboardkeywait := A_tickcount + keyboardkeywaitvalue
370 changepower(somekeyboardvalue)
371 if(!stats["keyboardletterspressed"]){
372 stats["keyboardletterspressed"] := 0
373 }
374 stats["keyboardletterspressed"] += 1
375 ;pressing keys can sometimes create hidden treasures and rarely spawns a golden key
376 random, keyboardrngesus, 1, 100
377 if(keyboardrngesus > 95 && hiddentreasure["purchased"] >= 1){
378 treasureavailable := randompointonscreen()
379 }
380 random, keyboardrngesus, 1, 100
381 if(keyboardrngesus > 98 && goldenkeys["purchased"] >= 1){
382 keyavailable := randomletter()
383 }
384}
385if(A_thishotkey == "~" . keyavailable . " up"){
386 ;if the hidden key is pressed. Do this
387 somekeyboardvalue := calculatekeyboardkeyvalue(A_thishotkey) * 25
388 goldenkeywait := A_tickcount + goldenkeywaitvalue
389 addlog("collecting the golden key (" . keyavailable . ") gave " . somekeyboardvalue . " power", "power")
390 addlog("collecting the golden key (" . keyavailable . ") gave " . somekeyboardvalue . " power", "treasure")
391 keyavailable := ""
392 changepower(somekeyboardvalue)
393 somekeyboardvalue := getkeys()
394 if(!stats["goldenkeyspressed"]){
395 stats["goldenkeyspressed"] := 0
396 }
397 stats["goldenkeyspressed"] += 1
398 if(somekeyboardvalue >= 1){
399 ;when a treasure key is obtained. Do this
400 treasurekeys += somekeyboardvalue
401 chesttext := "collecting a golden key gave " . somekeyboardvalue . " treasure Key"
402 if(somekeyboardvalue >= 2){
403 chesttext .= "s"
404 }
405 addlog(chesttext, "treasure")
406 if(!stats["goldenkeysfound"]){
407 stats["goldenkeysfound"] := 0
408 }
409 stats["goldenkeysfound"] += somekeyboardvalue
410 }
411 updatemain()
412}
413return
414
415globaltimer:
416if(A_tickcount > timercheck){
417 ;update the power on the menu
418 timercheck := A_tickcount + timercheckvalue
419 power := round(power)
420 shownpower := % toscientific(power, 3)
421 mainshowpower.InnerHtml := "Power: " . shownpower
422 ;fixwindowpos moves the window if its offscreen
423 if(optionchecks["disablemenusnapping"] == 0){
424 fixwindowpos("Background Power")
425 }
426}
427if(A_tickcount > autosavewait){
428 ;save the game
429 savegame_onclick()
430}
431;get where the mouse is currently at on screen
432Coordmode, Mouse, Screen
433MouseGetPos, MouseX, MouseY
434
435;this part handles moving the mouse dot in the radar on the hidden treasure gui
436if(selectedfeature == "treasure" && treasureradarbought == 1){
437 treasureradardot.style.left := (MouseX / (A_screenwidth / 100)) . "%"
438 treasureradardot.style.top := (MouseY / (A_screenheight / 100)) . "%"
439 if(treasureavailable && 100 >= abs(treasureavailable[1] - MouseX) && 100 >= abs(treasureavailable[2] - MouseY)){
440 treasureradardot.innerhtml := "O"
441 }
442 else if(treasureavailable && 200 >= abs(treasureavailable[1] - MouseX) && 200 >= abs(treasureavailable[2] - MouseY)){
443 treasureradardot.innerhtml := "0"
444 }
445 else if(treasureavailable && 400 >= abs(treasureavailable[1] - MouseX) && 400 >= abs(treasureavailable[2] - MouseY)){
446 treasureradardot.innerhtml := "o"
447 }
448 else{
449 treasureradardot.innerhtml := "."
450 }
451}
452if(treasureavailable && 30 >= abs(treasureavailable[1] - MouseX) && 30 >= abs(treasureavailable[2] - MouseY)){
453 ;check if the mouse is near a hidden treasure and if so. Collect it
454 treasurewait := A_tickcount + treasurewaitvalue
455 somevalue := calculatemovevalue() * 25
456 changepower(somevalue)
457 addlog("collecting a hidden treasure gave " . somevalue . " power", "power")
458 addlog("collecting a hidden treasure gave " . somevalue . " power", "treasure")
459 if(!stats["hiddentreasuresfound"]){
460 stats["hiddentreasuresfound"] := 0
461 }
462 somevalue := getchests()
463 treasurechests += somevalue
464 stats["hiddentreasuresfound"] += 1
465 if(somevalue >= 1){
466 ;check if a treasure chest has been obtained
467 if(!stats["treasurechestsfound"]){
468 stats["treasurechestsfound"] := 0
469 }
470 stats["treasurechestsfound"] += somevalue
471 chesttext := "collecting a hidden treasure gave " . somevalue . " chest"
472 if(somevalue >= 2){
473 chesttext .= "s"
474 }
475 addlog(chesttext, "treasure")
476 }
477 treasureavailable := ""
478 updatemain()
479}
480moveX := (MouseX - MouseStartX)
481moveY := (MouseY - MouseStartY)
482;subract the place where the mouse was last with where the mouse is now.
483MouseStartX := MouseX
484MouseStartY := MouseY
485;the current place is stored for the next time.
486;moving the mouse increases this V value. When it reaches a certain treshhold and after enough time passes. Power is gained for moving the mouse.
487movetrack += round((abs(moveX) + abs(moveY)) * calculatemovespeed())
488if((movetrack >= 15000 && A_tickcount >= movewait) || instantmousemovement == "true"){
489 ;movement is more effective the more the mouse was moved
490 moveeffectiveness := min(1 + (movetrack / 300000), 2)
491 somevalue := floor(calculatemovevalue() * moveeffectiveness)
492 if(mouseengine3["purchased"] >= 1){
493 somevalue += movetrack
494 }
495 movetrack = 0
496 changepower(somevalue)
497 random, globalrngesus, 1, 1000
498 if(silentmovementlogs == "false" || silentmovementlogs >= globalrngesus){
499 addlog("moving the mouse gave " . somevalue . " power", "power")
500 }
501 if(globalrngesus > 900){
502 keyavailable := randomletter()
503 }
504 random, globalrngesus, 1, 1000
505 if(globalrngesus > 975 && hiddentreasure["purchased"] >= 1){
506 treasureavailable := randompointonscreen()
507 }
508 if(!stats["mousemoves"]){
509 stats["mousemoves"] := 0
510 }
511 stats["mousemoves"] += 1
512 movewait := A_tickcount + movewaitvalue
513 ;calculate the chance of garden plants appearing. Its 3% by default + up to 3 from upgrades + up to 3 if the mouse was moved a lot.
514 plantchance := 3
515 gardenplantchance := 0
516 for globalentry, globalcontent in upgrades{
517 if(%globalentry%["plantchance"]){
518 gardenplantchance += %globalentry%["plantchance"] * globalcontent["purchased"]
519 }
520 }
521 plantchance += (gardenplantchance * plantchance / 100) + ((moveeffectiveness - 1) * plantchance)
522 if(noplants == "false"){
523 creategardenplant(plantchance)
524 }
525 ;gardentick handles permanent effects for now. I plan on eventually adding a plant growth feature that uses this
526 gardentick()
527}
528;this part here handles the tooltips added by addtooltip() and puts them below eachother and next to your mouse on every call.
529totaltooltips := ""
530loop, % tooltips.MaxIndex(){
531 if(0 >= tooltips[A_index]["timer"]){
532 tooltips.remove(A_index)
533 }
534 totaltooltips .= tooltips[A_index]["content"] . "`n"
535 tooltips[A_index]["timer"] -= timervalue / 100
536}
537;This function makes tooltips smoother and prevents flickering
538ToolTipFM(totaltooltips, 5)
539return
540
541updatemain(){
542 global
543 critical, on
544 gui, backgroundpower:default
545 guicontrolget, mainguiexist, hwnd, maindoc
546 if(!mainguiexist){
547 ;create the main menu used for displaying all features
548 mainmenuhighW := guiwidth * 0.1
549 mainmenuhighH := guiheight
550 Gui, Add, ActiveX, x0 y0 w%mainmenuhighW% h%mainmenuhighH% vmaindoc, HtmlFile
551 guicontrolget, maindoc, pos
552 mainmenuhighX := maindocW
553 Gui, Add, ActiveX, x%mainmenuhighX% y0 w%mainmenuhighW% h%mainmenuhighH% vmaindoc2, HtmlFile
554 mainhtmlpart1 := "<!DOCTYPE html><html><head><style type=text/css> html {overflow:hidden; width:100%; height: 100%; font-family: 'Verdana'; font-size:12px;} body {background:#666666; width:100%; height: 100%;} table {left:0px; top:0px; width:100%; border-style: none; position:absolute;} [disable=disabled]{background: #666666 !important;}"
555 mainhtmlpart1 .= ".power{width:100%; height: 30px; color: #000000;}"
556 mainhtmlpart1 .= ".shop{width:100%; height: 30px; background: #AAAAAA; color: #000000;}"
557 mainhtmlpart1 .= ".garden{width:100%; height: 30px; background: #AAAAAA; color: #000000;}"
558 mainhtmlpart1 .= ".hiddentreasure{width:100%; height: 30px; left:0px; background: #AAAAAA; color: #000000;}"
559 mainhtmlpart1 .= ".logs{width:100%; height: 30px; left:0px; background: #AAAAAA; color: #000000;}"
560 mainhtmlpart1 .= ".stats{width:100%; height: 30px; left:0px; background: #AAAAAA; color: #000000;}"
561 mainhtmlpart1 .= ".options{width:100%; height: 30px; left:0px; background: #AAAAAA; color: #000000;}"
562 mainhtmlpart1 .= ".help{width:100%; height: 30px; left:0px; background: #AAAAAA; color: #000000;}"
563 mainhtmlpart1 .= ".devbutton{width:100%; height: 30px; left:0px; background: #000000; color: #DDDDDD;}"
564 mainhtmlpart1 .= ".save{width:100%; height: 30px; left:0px; background: #AAAAAA; color: #000000;}"
565 mainhtmlpart1 .= ".exit{width:100%; height: 30px; left:0px; background: #222222; color: #FFFFFF;}"
566 mainhtmlpart2 := "</style></head><body><table id='mainmenutable'>"
567 mainhtmlpart2 .= "<tr><td><p class='power' id='showpower'>Power: " . power . "</button></td></tr>"
568 mainhtmlpart2 .= "<tr><td><button class='shop' id='shop' mode='shop'>Shop</button></td></tr>"
569 mainhtmlpart2 .= "<tr id='gardentable' style=""display:none;""><td><button class='garden' id='garden' mode='garden' style=""display:none;"">Garden</button></td></tr>"
570 mainhtmlpart2 .= "<tr id='treasuretable' style=""display:none;""><td><button class='hiddentreasure' id='treasure' mode='treasure' style=""display:none;"">Hidden treasures</button></td></tr>"
571 mainhtmlpart2 .= "<tr><td><button class='logs' id='logs' mode='logs'>Logs</button></td></tr>"
572 mainhtmlpart2 .= "<tr><td><button class='stats' id='stats' mode='stats'>Stats</button></td></tr>"
573 mainhtmlpart2 .= "<tr><td><button class='options' id='options' mode='options'>Options</button></td></tr>"
574 mainhtmlpart2 .= "<tr><td><button class='help' id='help' mode='help'>Help</button></td></tr>"
575 mainhtmlpart2 .= "<tr><td><button class='save' id='save'>Save</button></td></tr>"
576 mainhtmlpart2 .= "<tr id='devtable' style=""display:none;""><td><button class='devbutton' id='devbutton' style=""display:none;"">Devbutton</button></td></tr>"
577 mainhtmlpart2 .= "<tr><td><button class='exit' id='exit'>Exit</button></td></tr>"
578 mainhtmlpart2 .= "</table></body></html>"
579 mainhtml := mainhtmlpart1 . mainhtmlpart2
580 maindoc.open()
581 maindoc.write(mainhtml)
582 maindoc.close()
583
584 mainshowpower := maindoc.getElementById("showpower")
585 mainshopbutton := maindoc.getElementById("shop")
586 maingardenbutton := maindoc.getElementById("garden")
587 maingardentable := maindoc.getElementById("gardentable")
588 maintreasurebutton := maindoc.getElementById("treasure")
589 maintreasuretable := maindoc.getElementById("treasuretable")
590 mainlogsbutton := maindoc.getElementById("logs")
591 mainstatsbutton := maindoc.getElementById("stats")
592 mainoptionsbutton := maindoc.getElementById("options")
593 mainhelpbutton := maindoc.getElementById("help")
594 mainsavebutton := maindoc.getElementById("save")
595 maindevbutton := maindoc.getElementById("devbutton")
596 maindevtable := maindoc.getElementById("devtable")
597 mainexitbutton := maindoc.getElementById("exit")
598 ComObjConnect(mainshopbutton, "selectfeature_")
599 ComObjConnect(maingardenbutton, "selectfeature_")
600 ComObjConnect(maintreasurebutton, "selectfeature_")
601 ComObjConnect(mainlogsbutton, "selectfeature_")
602 ComObjConnect(mainstatsbutton, "selectfeature_")
603 ComObjConnect(mainoptionsbutton, "selectfeature_")
604 ComObjConnect(mainhelpbutton, "selectfeature_")
605 ComObjConnect(mainsavebutton, "savegame_")
606 ComObjConnect(maindevbutton, "devbutton_")
607 ComObjConnect(mainexitbutton, "exit_")
608 }
609 if(devbuttonenabled == "true"){
610 maindevbutton.style.display := "block"
611 maindevtable.style.display := "block"
612 }
613 if(maintreasurebutton.style.display == "none" && hiddentreasure["purchased"] >= 1){
614 maintreasurebutton.style.display := "block"
615 maintreasuretable.style.display := "block"
616 }
617 else if(0 >= hiddentreasure["purchased"]){
618 maintreasurebutton.style.display := "none"
619 maintreasuretable.style.display := "none"
620 }
621 if(maingardenbutton.style.display == "none" && garden["purchased"] >= 1){
622 maingardenbutton.style.display := "block"
623 maingardentable.style.display := "block"
624 }
625 else if(0 >= garden["purchased"]){
626 maingardenbutton.style.display := "none"
627 maingardentable.style.display := "none"
628 }
629 if(selectedfeature){
630 mainbuttoncheck := maindoc.getElementById(selectedfeature)
631 mainbuttoncheck.disable := "disabled"
632 mainbuttoncheck.value := mainbuttoncheck.value
633 }
634 guicontrolget, mainguiexist, hwnd, featuredoc
635 if(!mainguiexist){
636 guicontrolget, maindoc, pos
637 guicontrolget, maindoc2, pos
638 mainmenuhighW := guiwidth - maindocW - maindoc2W
639 mainmenuhighH := guiheight
640 mainmenuhighX := maindocW + maindoc2W
641 Gui, Add, ActiveX, w%mainmenuhighW% h%mainmenuhighH% x%mainmenuhighX% y0 vfeaturedoc, HTMLFile
642 }
643 ;pressing a button on the sidebar changes the selectedfeature value. The displayed info changes depending on the currently pressed button
644 if(selectedfeature == "nothing"){
645 if(!storedselectedfeature <> selectedfeature){
646 storedselectedfeature := selectedfeature
647 htmlpart1 := "<!DOCTYPE html><html><head><style type=text/css> html {overflow:hidden; border-style: none; height: 100%;} body {background:#888888; height: 100%;}"
648 htmlpart2 := "</style></head><body><table>"
649 htmlpart2 .= "</table></body></html>"
650 html := htmlpart1 . htmlpart2
651
652 html2 := "<!DOCTYPE html><html><head><style type=text/css> html {overflow:hidden; width:100%; height: 100%;} body {background:#777777; width:100%; height: 100%;}</style></head></html>"
653 }
654 featuredoc.open()
655 featuredoc.write(html)
656 featuredoc.close()
657 maindoc2.open()
658 maindoc2.write(html2)
659 maindoc2.close()
660 }
661 if(selectedfeature == "shop"){
662 if(storedselectedfeature <> selectedfeature){
663 storedselectedfeature := selectedfeature
664 htmlpart1 := "<!DOCTYPE html><html><head><style type=text/css> html {overflow:auto; height: 100%;} body {background:#888888; height: 100%; font-family:verdana; font-size:12px;} table {left:0px; top:0px; width:100%; border-style: none; position:absolute;} [disable=disabled]{background: #666666 !important;}"
665 htmlpart1 .= ".scrollable {overflow-y: auto;}"
666 htmlpart2 := "</style></head><body><table class='scrollable'>"
667 loop, % allupgrades.MaxIndex(){
668 shopentry := allupgrades[A_index]
669 htmlpart1 .= "." . shopentry . "{width: 100%; height: 30px; background: #AAAAAA; color: #000000;}"
670 htmlpart2 .= "<tr id='" . shopentry . "table'><td style=""width:10%;""><button class='" . shopentry . "' id='" . shopentry . "' disable=''> " . %shopentry%["name"] . "</button></td><td><p id='" . shopentry . "price'>Price: " . round(calculateshopprice(%shopentry%)) . "</p></td></tr>"
671 }
672 htmlpart2 .= "</table></div></body></html>"
673 html := htmlpart1 . htmlpart2
674
675 html2part1 := "<!DOCTYPE html><html><head><style type=text/css> html {overflow:hidden; height: 100%;} body {background:#777777; height: 100%;} table {left:0px; top:0px; width:100%; border-style: none; position:absolute;} [disable=disabled]{background: #666666 !important;}"
676 html2part1 .= ".inspect{width:100%; height: 30px; left:0px; background: #AAAAAA; color: #000000;}"
677 html2part1 .= ".purchase{width:100%; height: 30px; left:0px; background: #AAAAAA; color: #000000;}"
678 html2part2 := "</style></head><body><table style='float:left;'>"
679 html2part2 .= "<tr><td><button class='inspect' id='inspect' mode='inspect'>Inspect mode</button></td></tr>"
680 html2part2 .= "<tr><td><button class='purchase' id='purchase' mode='purchase'>Purchase Mode</button></td></tr>"
681 html2part2 .= "</table></div></body></html>"
682 html2 := html2part1 . html2part2
683 featuredoc.open()
684 featuredoc.write(html)
685 featuredoc.close()
686
687 maindoc2.open()
688 maindoc2.write(html2)
689 maindoc2.close()
690 shoppurchasebutton := maindoc2.getElementById("purchase")
691 shopinspectbutton := maindoc2.getElementById("inspect")
692 ComObjConnect(shoppurchasebutton, "shopmode_")
693 ComObjConnect(shopinspectbutton, "shopmode_")
694 for, mainentry, maincontent in allupgrades{
695 if(%maincontent%){
696 shopupgrade%maincontent%button := featuredoc.getElementById(maincontent)
697 ComObjConnect(shopupgrade%maincontent%button, "shoppurchase_")
698 }
699 }
700 }
701 for shopentry, shopcontent in allupgrades{
702 ;example of an upgrade with an unlock requirement: clickingpower2 := {unlockcondition:[{name:"clickingpower", array:"purchased", amount:10, requirement:">="}, {name:"power", amount:5000, requirement:">="}]}
703 ;this part hides any upgrade that does not have their unlock requirement met and permanently shows them if they are met.
704 unlockcheck := "unlocked"
705 if(%shopcontent%["unlocked"] <> "unlocked"){
706 ;this part checks for buttons with an unlock requirement and checks if that requirement has been met.
707 loop % %shopcontent%["unlockcondition"].Count(){
708 unlockcondition := %shopcontent%["unlockcondition"]
709 shopvalue := unlockcondition[A_index]["name"]
710 if(unlockcondition[A_index]["array"]){
711 shopvalue := %shopvalue%[unlockcondition[A_index]["array"]]
712 }
713 else{
714 shopvalue := %shopvalue%
715 }
716 if(unlockcondition[A_index]["requirement"] == "<"){
717 if(shopvalue >= unlockcondition[A_index]["amount"]){
718 unlockcheck := "locked"
719 }
720 }
721 if(unlockcondition[A_index]["requirement"] == "<="){
722 if(shopvalue > unlockcondition[A_index]["amount"]){
723 unlockcheck := "locked"
724 }
725 }
726 if(unlockcondition[A_index]["requirement"] == "=="){
727 if(shopvalue <> unlockcondition[A_index]["amount"]){
728 unlockcheck := "locked"
729 }
730 }
731 if(unlockcondition[A_index]["requirement"] == ">="){
732 if(unlockcondition[A_index]["amount"] > shopvalue){
733 unlockcheck := "locked"
734 }
735 }
736 if(unlockcondition[A_index]["requirement"] == ">"){
737 if(unlockcondition[A_index]["amount"] >= shopvalue){
738 unlockcheck := "locked"
739 }
740 }
741 }
742 if(unlockcheck == "unlocked"){
743 %shopcontent%["unlocked"] := "unlocked"
744 }
745 }
746 shopupgradetable := featuredoc.getElementById(shopcontent . "table")
747 shopupgradebutton := featuredoc.getElementById(shopcontent)
748 shopupgradeprice := featuredoc.getElementById(shopcontent . "price")
749 ;disable does not mean the button is disabled. disabled with an d at the end means that its disabled. Disable is something I added myself which only changes the button color.
750 if(shopupgradebutton.disable <> "disabled" && (%shopcontent%["repeated"] && %shopcontent%["purchased"] >= %shopcontent%["repeated"]) || !%shopcontent%["repeated"] && %shopcontent%["purchased"] > 0){
751 shopupgradebutton.disable := "disabled"
752 }
753 else if(shopupgradebutton.disable == "disabled" && %shopcontent%["repeated"] > %shopcontent%["purchased"]){
754 shopupgradebutton.disable := ""
755 }
756 if(%shopcontent%["unlocked"] <> "unlocked"){
757 shopupgradetable.style.display := "none"
758 }
759 else{
760 shopupgradetable.style.display := "block"
761 }
762 ;change the button value to itself to update the visibillity/color etc
763 shopupgradebutton.value := %shopcontent%["name"]
764 if(shopupgradebutton.disable <> "disabled"){
765 shopupgradeprice.innerhtml := "Price: " . round(calculateshopprice(%shopcontent%))
766 }
767 else{
768 shopupgradeprice.innerhtml := "Max level"
769 }
770 }
771 if(shopmode){
772 mainbuttoncheck := maindoc2.getElementById(shopmode)
773 mainbuttoncheck.disable := "disabled"
774 mainbuttoncheck.value := mainbuttoncheck.value
775 }
776 }
777 if(selectedfeature == "garden" || selectedfeature == "freezer"){
778 if(storedselectedfeature <> selectedfeature || storedgardentiles <> gardentiles || storedfreezertiles <> freezertiles){
779 storedselectedfeature := selectedfeature
780 storedgardentiles := gardentiles
781 storedfreezertiles := freezertiles
782 htmlpart1 := "<!DOCTYPE html><html><head><style type=text/css> html {overflow: hidden; height:100%; width:100%;} body {background:#888888; height:100%; width:100%;} [disable=disabled]{background: #666666 !important;}"
783 htmlpart1 .= ".gardentable {width:100%; height:100%; left:0px; top:0px; border-style:none; position:absolute;}"
784 htmlpart2 := "</style></head><body><table class='gardentable'>"
785 guicontrolget, featuredoc, pos
786 loop, % gardenmaxX * gardenmaxY{
787 ;this loop creates the buttons for every garden and freezer tile
788 CX := mod(A_index, gardenmaxX)
789 CY := ceil(A_index / gardenmaxY)
790 if(CX == 1){
791 htmlpart2 .= "<tr>"
792 }
793 if(CX == 0){
794 CX := gardenmaxX
795 }
796 ;IMPORTANT buttons here are set at a specific pixel length instead of % length. For some reason pressing any button with % width shrinks it before it turns normal again (only the first one is unaffected)
797 ;to see this for yourself. Replace the following
798 ;width: " . round(featuredocW / 100 * 9, 1) . "px; >>>> width: " . round((100 / gardenmaxX) * 0.9) . "px;
799 ;height: " . round(featuredocH / 100 * 9, 1) . "px; >>>> height: " . round((100 / gardenmaxY) * 0.9) . "px;
800 if(selectedfeature == "garden"){
801 htmlpart1 .= ".Tile" . CX . "A" . CY . " {left:" . round((CX - 0.95) * (100 / gardenmaxX), 1) . "%; width: " . round(featuredocW / 100 * 9, 1) . "px; top:" . round((CY - 0.95) * (100 / gardenmaxY), 1) . "%; height: " . round(featuredocH / 100 * 9, 1) . "px; font-size:25px; background: #55DD88; color: #000000; position: absolute;}"
802 htmlpart2 .= "<td><button class='Tile" . CX . "A" . CY . "' id='tile" . CX . "A" . CY . "'></button></td>"
803 }
804 else if(selectedfeature == "freezer"){
805 htmlpart1 .= ".Freezertile" . CX . "A" . CY . " {left:" . round((CX - 0.95) * (100 / gardenmaxX), 1) . "%; width: " . round(featuredocW / 100 * 9, 1) . "px; top:" . round((CY - 0.95) * (100 / gardenmaxY), 1) . "%; height: " . round(featuredocH / 100 * 9, 1) . "px; font-size:25px; background: #AADDDD; color: #000000; position: absolute;}"
806 htmlpart2 .= "<td><button class='Freezertile" . CX . "A" . CY . "' id='freezertile" . CX . "A" . CY . "' style=''></button></td>"
807 }
808 if(CX == gardenmaxX){
809 htmlpart2 .= "</tr>"
810 }
811 }
812 htmlpart2 .= "</table>"
813 html := htmlpart1 . htmlpart2
814
815 html2part1 := "<!DOCTYPE html><html><head><style type=text/css> html {overflow:hidden; border-style:none; border-color:#FFFFFF; height: 100%; width: 100%;} body {background:#777777; height: 100%; width: 100%;} table {left:0px; top:0px; width:100%; border-style: none; position:absolute;} [disable=disabled]{background: #666666 !important;}"
816 html2part1 .= ".button{word-break: break-word;}"
817 html2part1 .= ".inspect{width:100%; left:0px; height: 30px; background: #AAAAAA; color: #000000;}"
818 html2part1 .= ".harvest{width:100%; left:0px; height: 30px; background: #AAAAAA; color: #000000;}"
819 html2part1 .= ".protect{width:100%; left:0px; height: 30px; background: #AAAAAA; color: #000000;}"
820 html2part1 .= ".swap{width:100%; left:0px; height: 30px; background: #AAAAAA; color: #000000;}"
821 html2part1 .= ".swapgarden{width:100%; left:0px; height: 30px; color: #000000;}"
822 html2part1 .= ".almanac{width:100%; left:0px; height: 30px;, background: #55DD88; color: #000000;}"
823 html2part1 .= ".purchasetile{width:100%; left:0px; height: 64px; background: #AAAAAA; color: #000000;}"
824 html2part2 := "</style></head><body><table style='float:left;'>"
825 html2part2 .= "<tr><td><button class='inspect' id='inspect' mode='inspect'>Inspect mode</button></td></tr>"
826 html2part2 .= "<tr><td><button class='harvest' id='harvest' mode='harvest'>Harvest mode</button></td></tr>"
827 html2part2 .= "<tr><td><button class='swap' id='swap' mode='swap'>Swap mode</button></td></tr>"
828 html2part2 .= "<tr><td><button class='protect' id='protect' mode='protect'>Protect mode</button></td></tr>"
829 if(selectedfeature == "garden"){
830 html2part2 .= "<tr><td><button class='swapgarden' id='swapgarden' mode='freezer' style=""background: #AADDDD;"">Freezer</button></td></tr>"
831 html2part2 .= "<tr id='almanactable' style=""display:none;""><td><button class='almanac' id='almanac' mode='almanac'>Almanac</button></td></tr>"
832 html2part2 .= "<tr><td><button class='purchasetile' id='purchasetile' topurchase='gardentile'>Purchase garden tile</br>costs " . tileprice("garden") . "</button></td></tr>"
833 }
834 if(selectedfeature == "freezer"){
835 html2part2 .= "<tr><td><button class='swapgarden' id='swapgarden' mode='garden' style=""background: #55DD88;"">Garden</button></td></tr>"
836 html2part2 .= "<tr id='almanactable' style=""display:none;""><td><button class='almanac' id='almanac' mode='almanac'>Almanac</button></td></tr>"
837 html2part2 .= "<tr><td><button class='purchasetile' id='purchasetile' topurchase='freezertile'>Purchase freezer tile</br>costs " . tileprice("freezer") . "</button></td></tr>"
838 }
839 html2part2 .= "</table></body></html>"
840 html2 := html2part1 . html2part2
841 featuredoc.open()
842 featuredoc.write(html)
843 featuredoc.close()
844
845 maindoc2.open()
846 maindoc2.write(html2)
847 maindoc2.close()
848 if(gardenmode){
849 mainbuttoncheck := maindoc2.getElementById(gardenmode)
850 mainbuttoncheck.disable := "disabled"
851 mainbuttoncheck.value := mainbuttoncheck.value
852 }
853 gardeninspectbutton := maindoc2.getElementById("inspect")
854 gardenharvestbutton := maindoc2.getElementById("harvest")
855 gardenprotectbutton := maindoc2.getElementById("protect")
856 gardenswapbutton := maindoc2.getElementById("swap")
857 gardenswapgardenbutton := maindoc2.getElementById("swapgarden")
858 gardenalmanacbutton := maindoc2.getElementById("almanac")
859 gardenalmanactable := maindoc2.getElementById("almanactable")
860 gardenpurchasetilebutton := maindoc2.getElementById("purchasetile")
861 ComObjConnect(gardeninspectbutton, "gardenmode_")
862 ComObjConnect(gardenharvestbutton, "gardenmode_")
863 ComObjConnect(gardenswapbutton, "gardenmode_")
864 ComObjConnect(gardenprotectbutton, "gardenmode_")
865 ComObjConnect(gardenswapgardenbutton, "selectfeature_")
866 ComObjConnect(gardenpurchasetilebutton, "purchasetile_")
867 ComObjConnect(gardenalmanacbutton, "selectfeature_")
868 ComObjConnect(gardenswapgardenbutton, "selectfeature_")
869
870 loop, % gardenmaxX * gardenmaxY{
871 CX := mod(A_index, gardenMaxX)
872 CY := ceil(A_index / gardenMaxY)
873 if(CX == 0){
874 CX := gardenMaxX
875 }
876 if(selectedfeature == "garden"){
877 gardentile%CX%A%CY%button := featuredoc.getElementById("tile" . CX . "A" . CY)
878 ComObjConnect(gardentile%CX%A%CY%button, "garden_")
879 }
880 else if(selectedfeature == "freezer"){
881 freezertile%CX%A%CY%button := featuredoc.getElementById("freezertile" . CX . "A" . CY)
882 ComObjConnect(freezertile%CX%A%CY%button, "garden_")
883 }
884 }
885 if(selectedfeature == "garden" && gardentiles >= GardenmaxX * GardenmaxY){
886 gardenpurchasetilebutton.disable := "disabled"
887 gardenpurchasetilebutton.value := gardentiles . " Tiles!"
888 }
889 else if(selectedfeature == "garden"){
890 gardenpurchasetilebutton.disable := ""
891 gardenpurchasetilebutton.value := "Purchase garden tile</br>costs " . tileprice("garden")
892 }
893 else if(selectedfeature == "freezer" && freezertiles >= GardenmaxX * GardenmaxY){
894 gardenpurchasetilebutton.disable := "disabled"
895 gardenpurchasetilebutton.value := freezertiles . " Tiles!"
896 }
897 else if(selectedfeature == "garden"){
898 gardenpurchasetilebutton.disable := ""
899 gardenpurchasetilebutton.value := "Purchase freezer tile</br>costs " . tileprice("freezer")
900 }
901 loop, % gardenMaxX * gardenMaxY{
902 CX := mod(A_index, gardenMaxX)
903 CY := ceil(A_index / gardenMaxY)
904 if(CX == 0){
905 CX := gardenMaxX
906 }
907 if(selectedfeature == "garden"){
908 gardenbuttoncheck := featuredoc.getElementById("tile" . CX . "A" . CY)
909 ;this part hides garden tiles that you havent unlocked yet or if there's somehow a plant on it. It disables them instead
910 if(tile%CX%A%CY%["plant"]["name"] && A_index > gardentiles){
911 gardenbuttoncheck.disable := "disabled"
912 }
913 else if(A_index > gardentiles){
914 gardenbuttoncheck.style.display := "none"
915 }
916 else{
917 gardenbuttoncheck.style.display := "block"
918 gardenbuttoncheck.disable := ""
919 }
920 }
921 if(selectedfeature == "freezer"){
922 gardenbuttoncheck := featuredoc.getElementById("freezertile" . CX . "A" . CY)
923 if(freezertile%CX%A%CY%["plant"]["name"] && A_index > freezertiles){
924 gardenbuttoncheck.disable := "disabled"
925 gardenbuttoncheck.style.display := "block"
926 }
927 else if(A_index > freezertiles){
928 gardenbuttoncheck.style.display := "none"
929 }
930 else{
931 gardenbuttoncheck.style.display := "block"
932 gardenbuttoncheck.disable := ""
933 }
934 }
935 }
936 }
937 if(gardenalmanactable.style.display == "none" && almanacunlocked){
938 gardenalmanactable.style.display := "block"
939 }
940 loop, % gardenmaxX * GardenmaxY{
941 CX := mod(A_index, 10)
942 CY := ceil(A_index / 10)
943 if(CX == 0){
944 CX = 10
945 }
946 ;update any garden tiles that don't have their current name as the same one displayed on the button
947 if(selectedfeature == "garden"){
948 storedplantname := tile%CX%A%CY%["plant"]["name"]
949 if(storedplantname == "lockbloom" && !keyavailable){
950 tile%CX%A%CY%["plant"]["symbol"] := "Lb"
951 }
952 storedplantsymbol := tile%CX%A%CY%["plant"]["symbol"]
953 storedplantbackgroundcolor := tile%CX%A%CY%["plant"]["background"]
954 storedplanttextcolor := tile%CX%A%CY%["plant"]["textcolor"]
955 gardendocedit := featuredoc.getelementbyid("tile" . CX . "A" . CY)
956 if(CX == plantselect["location"][1] && CY == plantselect["location"][2] && plantselect["location"][3] == "garden"){
957 gardendocedit.style.background := "#FF6666"
958 }
959 else if(tile%CX%A%CY%["plant"]["protected"] == 1){
960 gardendocedit.style.background := "#557744"
961 }
962 else{
963 gardendocedit.style.background := "#55DD88"
964 }
965 }
966 if(selectedfeature == "freezer"){
967 storedplantname := freezertile%CX%A%CY%["plant"]["name"]
968 storedplantsymbol := freezertile%CX%A%CY%["plant"]["symbol"]
969 storedplantbackgroundcolor := freezertile%CX%A%CY%["plant"]["background"]
970 storedplanttextcolor := freezertile%CX%A%CY%["plant"]["textcolor"]
971 gardendocedit := featuredoc.getelementbyid("freezertile" . CX . "A" . CY)
972 if(CX == plantselect["location"][1] && CY == plantselect["location"][2] && plantselect["location"][3] == "freezer"){
973 gardendocedit.style.background := "#FF6666"
974 }
975 else if(freezertile%CX%A%CY%["plant"]["protected"] == 1){
976 gardendocedit.style.background := "#AAAADD"
977 }
978 else{
979 gardendocedit.style.background := "#AADDDD"
980 }
981 }
982 ;update garden tile names if they have been changed.
983 if((storedplantname <> gardendocedit.value && storedplantsymbol <> gardendocedit.value)){
984 if(storedplantbackgroundcolor){
985 if(storedplantsymbol){
986 gardendocedit.value := "<table style=""background:" . storedplantbackgroundcolor . "; width:60%; height:60%;""><td>" . storedplantsymbol . "</td></table>"
987 }
988 else{
989 gardendocedit.value := "<table style=""background:" . storedplantbackgroundcolor . "; width:60%; height:60%;""><td>" . storedplantname . "</td></table>"
990 }
991 }
992 else{
993 if(storedplantsymbol){
994 gardendocedit.value := storedplantsymbol
995 }
996 else{
997 gardendocedit.value := storedplantname
998 }
999 }
1000 if(storedplanttextcolor){
1001 gardendocedit.style.color := storedplanttextcolor
1002 }
1003 else{
1004 gardendocedit.style.color := "#000000"
1005 }
1006 }
1007 }
1008 if(gardenmode){
1009 mainbuttoncheck := maindoc2.getElementById(gardenmode)
1010 mainbuttoncheck.disable := "disabled"
1011 mainbuttoncheck.value := mainbuttoncheck.value
1012 }
1013 }
1014 if(selectedfeature == "almanac"){
1015 if(storedselectedfeature <> selectedfeature || storedalmanacplant <> selectedalmanacplant || plantknowledge["knowledge"] <> storedknowledge){
1016 storedselectedfeature := selectedfeature
1017 storedalmanacplant := selectedalmanacplant
1018 storedknowledge := plantknowledge["knowledge"]
1019 ;the almanac is rather complex. Most of the code is either displaying the html or comparing knowledge points invested in the selected plant to see which recipes to display.
1020 htmlpart1 := "<!DOCTYPE html><html><head><style type=text/css> html {overflow: hidden; height:100%; width:100%; font-family: 'Verdana'; font-size:16px;} body {background:#888888; height:100%; width:100%;} table {top:0px; border-style: none;} [disable=disabled]{background: #666666 !important;}"
1021 htmlpart1 .= ".know{background: #55DD88; color: #000000; width:100%;}"
1022 htmlpart1 .= ".maindiv{position:absolute; left:0px; top:0px; width:100%;}"
1023 htmlpart2 := "</style></head><body>"
1024 if(selectedalmanacplant){
1025 mainvalue := %selectedalmanacplant%
1026 htmlpart2 .= "<div class='maindiv' style=""overflow-y:scroll; overflow-X:hidden; height:66%;""><table>"
1027 htmlpart2 .= "<tr><td><button style=""width: " . round(featuredocW / 100 * 9, 1) . "px; height: " . round(featuredocH / 100 * 9, 1) . "px; font-size:25px; background: #55DD88; "
1028 if(mainvalue["textcolor"]){
1029 htmlpart2 .= "color: " . mainvalue["textcolor"] . "; "
1030 }
1031 else{
1032 htmlpart2 .= "color: #000000; "
1033 }
1034 htmlpart2 .= """>"
1035 if(mainvalue["background"]){
1036 if(mainvalue["symbol"]){
1037 htmlpart2 .= "<table style=""background:" . mainvalue["background"] . "; width:60%; height:60%;""><td>" . mainvalue["symbol"] . "</td></table>"
1038 }
1039 else{
1040 htmlpart2 .= "<table style=""background:" . mainvalue["background"] . "; width:60%; height:60%;""><td>" . mainvalue["name"] . "</td></table>"
1041 }
1042 }
1043 else if(mainvalue["symbol"]){
1044 htmlpart2 .= mainvalue["symbol"]
1045 }
1046 else{
1047 htmlpart2 .= mainvalue["name"]
1048 }
1049 htmlpart2 .= "</button></td></tr></table><table>"
1050 htmlpart2 .= "<tr><td colspan='2'><p>" . getplantdescription(mainvalue, "</br>") . "</p></td></tr></table><table>"
1051 mainvalue := plantknowledge[selectedalmanacplant]
1052 if(mainvalue["current"] > 0){
1053 createdby := 0
1054 cancreate := 0
1055 loop, % plantcombos.maxIndex(){
1056 mainindex := A_index
1057 for mainentry, maincontent in plantcombos[mainindex]{
1058 if(mainentry == "result" && maincontent == selectedalmanacplant){
1059 createdby += 1
1060 }
1061 }
1062 for mainentry, maincontent in plantcombos[mainindex]["pardners"]{
1063 if(maincontent == selectedalmanacplant){
1064 cancreate += 1
1065 break
1066 }
1067 }
1068 }
1069 writtendescriptions := 0
1070 loop, % plants.MaxIndex(){
1071 if(plants[A_index]["name"] == selectedalmanacplant){
1072 createdby += 1
1073 }
1074 }
1075 if((mainvalue["current"] / mainvalue["cap"] * 100) >= ((100 / createdby) - (50 / createdby)) / 2 && createdby > 0){
1076 htmlpart2 .= "<tr><td><p></br>This plant can be created the following way"
1077 if((mainvalue["current"] / mainvalue["cap"] * 100) >= (((100 / createdby) * 2) - (50 / createdby)) / 2 && createdby > 1){
1078 htmlpart2 .= "s"
1079 }
1080 htmlpart2 .= ":</p></td></tr>"
1081 }
1082 loop, % plants.MaxIndex(){
1083 if(plants[A_index]["name"] == selectedalmanacplant){
1084 if((mainvalue["current"] / mainvalue["cap"] * 100) >= (100 / createdby) / 2){
1085 htmlpart2 .= "<tr><td><p>By randomly appearing in the garden</p></td></tr>"
1086 writtendescriptions += 1
1087 }
1088 else if((mainvalue["current"] / mainvalue["cap"] * 100) >= ((100 / createdby) - (50 / createdby)) / 2){
1089 htmlpart2 .= "<tr><td><p>????????????????????</p></td></tr>"
1090 writtendescriptions += 1
1091 }
1092 }
1093 }
1094 loop, % plantcombos.maxIndex(){
1095 mainindex := A_index
1096 for mainentry, maincontent in plantcombos[mainindex]{
1097 if(mainentry == "result" && maincontent == selectedalmanacplant){
1098 writtendescriptions += 1
1099 if((mainvalue["current"] / mainvalue["cap"] * 100) >= (100 / createdby) * writtendescriptions / 2){
1100 htmlpart2 .= "<tr><td><p>breeding using a "
1101 for mainentry2, maincontent2 in plantcombos[mainindex]["pardners"]{
1102 plantname := %maincontent2%["name"]
1103 if(plantknowledge[maincontent2]["current"] / plantknowledge[maincontent2]["cap"] >= 0.25){
1104 htmlpart2 .= plantname . " and a "
1105 }
1106 else{
1107 htmlpart2 .= "????? and a "
1108 }
1109 }
1110 stringtrimright, htmlpart2, htmlpart2, 7
1111 htmlpart2 .= "</p></td></tr>"
1112 }
1113 else if((mainvalue["current"] / mainvalue["cap"] * 100) >= (((100 / createdby) * writtendescriptions) - (50 / createdby)) / 2){
1114 htmlpart2 .= "<tr><td><p>????????????????????</p></td></tr>"
1115 }
1116 }
1117 }
1118 }
1119 writtendescriptions := 0
1120 if((mainvalue["current"] / mainvalue["cap"] * 100) >= 50 + (((100 / cancreate) - (50 / cancreate)) / 2) && cancreate > 0){
1121 htmlpart2 .= "<tr><td><p></br>This plant can be used in creating the following plant"
1122 if((mainvalue["current"] / mainvalue["cap"] * 100) >= 50 + ((((100 / cancreate) * 2) - (50 / cancreate)) / 2) && cancreate > 1){
1123 htmlpart2 .= "s"
1124 }
1125 htmlpart2 .= ":</p></td></tr>"
1126 }
1127 loop, % plantcombos.maxIndex(){
1128 mainindex := A_index
1129 for mainentry, maincontent in plantcombos[mainindex]["pardners"]{
1130 if(maincontent == selectedalmanacplant){
1131 writtendescriptions += 1
1132 if((mainvalue["current"] / mainvalue["cap"] * 100) >= 50 + ((100 / cancreate) * writtendescriptions / 2)){
1133 htmlpart2 .= "<tr><td><p>breeding using a "
1134 for mainentry2, maincontent2 in plantcombos[mainindex]["pardners"]{
1135 plantname := %maincontent2%["name"]
1136 if(plantknowledge[maincontent2]["current"] / plantknowledge[maincontent2]["cap"] >= 0.5 || maincontent2 == selectedalmanacplant){
1137 htmlpart2 .= plantname . " and a "
1138 }
1139 else{
1140 htmlpart2 .= "????? and a "
1141 }
1142 }
1143 stringtrimright, htmlpart2, htmlpart2, 7
1144 htmlpart2 .= " may result in a "
1145 plantname := plantcombos[mainindex]["result"]
1146 plantname := %plantname%["name"]
1147 if(plantknowledge[plantcombos[mainindex]["result"]]["current"] / plantknowledge[plantcombos[mainindex]["result"]]["cap"] >= 0.1){
1148 htmlpart2 .= plantname
1149 }
1150 else{
1151 htmlpart2 .= "?????"
1152 }
1153 mhtlpart2 .= "</p></td></tr>"
1154 }
1155 else if((mainvalue["current"] / mainvalue["cap"] * 100) >= 50 + (((100 / cancreate * writtendescriptions) - (50 / cancreate)) / 2)){
1156 htmlpart2 .= "<tr><td><p>????????????????????</p></td></tr>"
1157 }
1158 break
1159 }
1160 }
1161 }
1162 }
1163 htmlpart2 .= "</table></div><div style=""bottom:0px; position:absolute;""><table><tr><td></br></br><p>knowledge: " . plantknowledge["knowledge"] . "</p></td></tr>"
1164 htmlpart2 .= "<tr><td><button class='know' id='addknowledge1' mode='1' percent='false'>add 1 knowledge</button></td>"
1165 htmlpart2 .= "<td><button class='know' id='addknowledge2' mode='10' percent='true'>add 10% of your knowledge</button></td></tr>"
1166 htmlpart2 .= "<tr><td><button class='know' id='addknowledge3' mode='10' percent='false'>add 10 knowledge</button></td>"
1167 htmlpart2 .= "<td><button class='know' id='addknowledge4' mode='25' percent='true'>add 25% of your knowledge</button></td></tr>"
1168 htmlpart2 .= "<tr><td><button class='know' id='addknowledge5' mode='100' percent='false'>add 100 knowledge</button></td>"
1169 htmlpart2 .= "<td><button class='know' id='addknowledge6' mode='50' percent='true'>add 50% of your knowledge</button></td></tr>"
1170 htmlpart2 .= "<tr><td><button class='know' id='addknowledge7' mode='1000' percent='false'>add 1000 knowledge</button></td>"
1171 htmlpart2 .= "<td><button class='know' id='addknowledge8' mode='100' percent='true'>add 100% of your knowledge</button></td></tr>"
1172 htmlpart2 .= "<tr><td><p>knowledge: " . mainvalue["current"] . "/" . mainvalue["cap"] . "</p></td></tr></table></div>"
1173 }
1174 htmlpart2 .= "</body></html>"
1175 html := htmlpart1 . htmlpart2
1176
1177 html2part1 := "<!DOCTYPE html><html><head><style type=text/css> html {overflow-x:hidden; height:100%; width:100%; font-family: 'Verdana'; font-size:12px;} body {background:#777777; height:100%; width:100%;} table {left:0px; top:0px; width:100%; border-style: none; position:absolute;} [disable=disabled]{background: #666666 !important;}"
1178 html2part1 .= "button{width:100%; left:0px; height: 30px; background: #AAAAAA; color: #000000;}"
1179 html2part2 := "</style></head><body><table>"
1180 html2part2 .= "<tr><td><p>seen plants</p></td></tr>"
1181
1182 for mainentry, maincontent in plantknowledge{
1183 if(maincontent["seen"] > 0){
1184 html2part2 .= "<tr><td><button id='" . mainentry . "' mode='" . mainentry . "'>" . %mainentry%["name"] . "</td></tr>"
1185 }
1186 }
1187 html2part2 .= "</table></body></html>"
1188 html2 := html2part1 . html2part2
1189
1190 featuredoc.open()
1191 featuredoc.write(html)
1192 featuredoc.close()
1193
1194 maindoc2.open()
1195 maindoc2.write(html2)
1196 maindoc2.close()
1197 if(selectedalmanacplant){
1198 addknowledgebutton1 := featuredoc.getElementById("addknowledge1")
1199 addknowledgebutton2 := featuredoc.getElementById("addknowledge2")
1200 addknowledgebutton3 := featuredoc.getElementById("addknowledge3")
1201 addknowledgebutton4 := featuredoc.getElementById("addknowledge4")
1202 addknowledgebutton5 := featuredoc.getElementById("addknowledge5")
1203 addknowledgebutton6 := featuredoc.getElementById("addknowledge6")
1204 addknowledgebutton7 := featuredoc.getElementById("addknowledge7")
1205 addknowledgebutton8 := featuredoc.getElementById("addknowledge8")
1206 comObjConnect(addknowledgebutton1, "addknowledge_")
1207 comObjConnect(addknowledgebutton2, "addknowledge_")
1208 comObjConnect(addknowledgebutton3, "addknowledge_")
1209 comObjConnect(addknowledgebutton4, "addknowledge_")
1210 comObjConnect(addknowledgebutton5, "addknowledge_")
1211 comObjConnect(addknowledgebutton6, "addknowledge_")
1212 comObjConnect(addknowledgebutton7, "addknowledge_")
1213 comObjConnect(addknowledgebutton8, "addknowledge_")
1214 }
1215 for mainentry, maincontent in plantknowledge{
1216 if(maincontent["seen"] > 0){
1217 almanac%mainentry%button := maindoc2.getElementById(mainentry)
1218 comObjConnect(almanac%mainentry%button, "almanacmode_")
1219 }
1220 }
1221 }
1222 if(selectedalmanacplant){
1223 mainbuttoncheck := maindoc2.getElementById(selectedalmanacplant)
1224 mainbuttoncheck.disable := "disabled"
1225 mainbuttoncheck.value := mainbuttoncheck.value
1226 }
1227 }
1228 if(selectedfeature == "treasure"){
1229 if(storedselectedfeature <> selectedfeature){
1230 storedselectedfeature := selectedfeature
1231 htmlpart1 := "<!DOCTYPE html><html><head><style type=text/css> html {overflow: hidden; height:100%; width:100%;} body {background:#888888; height:100%; width:100%;} table {left:0px; top:0px; width:20%; border-style: none; position:absolute;} [disable=disabled]{background: #888888 !important;}"
1232 htmlpart1 .= ".radarbutton{width: 100%; height: 64px; left:0px; background: #AAAAAA; color: #000000;}"
1233 htmlpart1 .= ".radardot{position:absolute; color: #000000; font-size:20px;}"
1234 htmlpart2 := "</style></head><body><table align='left'>"
1235 htmlpart2 .= "<tr><td><button class='radarbutton' id='radarbutton'>Purchase radar</br>costs 50000 power</button></td></tr>"
1236 htmlpart2 .= "</table><p class='radardot' id='radardot'></p>"
1237 htmlpart2 .= "</body></html>"
1238 html := htmlpart1 . htmlpart2
1239
1240 html2part1 := "<!DOCTYPE html><html><head><style type=text/css> html {overflow:hidden; height: 100%; width: 100%; font-family: 'Verdana'; font-size:12px;} body {background:#777777; height: 100%; width: 100%;} table {left:0px; top:0px; width:100%; border-style: none; position:absolute;} [disable=disabled]{background: #666666 !important;}"
1241 html2part1 .= "p{height:0%;}"
1242 html2part1 .= ".openchest{width:100%; height: 64px; left:0px; background: #AAAAAA; color: #000000;}"
1243 html2part1 .= ".openallchests{width: 100%; height: 96px; left:0px; background: #AAAAAA; color: #000000;}"
1244 html2part1 .= ".treasureinfo{word-wrap:break-word;}"
1245 html2part2 := "</style></head><body><table>"
1246 html2part2 .= "<tr><td><button class='openchest' id='openchest' mode='1' style=""font-size:10px;"">Open A treasure chest</br>using 1 key</button></td></tr>"
1247 html2part2 .= "<tr><td><button class='openallchests' id='openallchests' mode='all' style=""font-size:10px;""></button></td></tr>"
1248 html2part2 .= "<tr><td><p id='chests'><p></td></tr>"
1249 html2part2 .= "<tr><td><p id='keys'><p></td></tr>"
1250 for mainentry, maincontent in treasures{
1251 html2part2 .= "<tr><td><p id='" . mainentry . "'><p></td></tr>"
1252 }
1253 html2part2 .= "<tr><td><p id='treasureinfo' style='height:100%;'><p></td></tr>"
1254 html2part2 .= "</table></body></html>"
1255 html2 := html2part1 . html2part2
1256 featuredoc.open()
1257 featuredoc.write(html)
1258 featuredoc.close()
1259
1260 maindoc2.open()
1261 maindoc2.write(html2)
1262 maindoc2.close()
1263 treasureopenchestbutton := maindoc2.getElementById("openchest")
1264 treasureopenallchestsbutton := maindoc2.getElementById("openallchests")
1265 treasureradarbutton := featuredoc.getElementById("radarbutton")
1266 treasureradardot := featuredoc.getElementById("radardot")
1267 treasureinfotable := maindoc2.getElementById("treasureinfotable")
1268 treasureinfo := maindoc2.getElementById("treasureinfo")
1269 treasurecheststext := maindoc2.getElementById("chests")
1270 treasurekeystext := maindoc2.getElementById("keys")
1271 for mainentry, maincontent in treasures{
1272 treasure%mainentry%text := maindoc2.getElementById(mainentry)
1273 }
1274 ComObjConnect(treasureopenchestbutton, "treasureopen_")
1275 ComObjConnect(treasureopenallchestsbutton, "treasureopen_")
1276 ComObjConnect(treasureradarbutton, "purchaseradar_")
1277 }
1278 if(treasureradarbought <> 1){
1279 treasureradardot.style.display := "none"
1280 treasureradarbutton.style.display := "block"
1281 }
1282 else{
1283 treasureradardot.style.display := "block"
1284 treasureradarbutton.style.display := "none"
1285 }
1286 treasurecheststext.Innerhtml := "chests: " . treasurechests
1287 treasurekeystext.Innerhtml := "golden keys: " . treasurekeys
1288 mainvalue := Min(treasurechests, treasurekeys)
1289 if(mainvalue == 1){
1290 treasureopenallchestsbutton.Innerhtml := "Open 1 chest</br>usng 1 Key"
1291 }
1292 else{
1293 treasureopenallchestsbutton.Innerhtml := "Open " . mainvalue . " chests</br>using " . mainvalue . " Keys"
1294 }
1295 for mainentry, maincontent in treasures{
1296 treasure%mainentry%text.InnerHtml := mainentry . ": " . maincontent
1297 }
1298 treasureinfo.InnerHtml := treasureinfotext
1299 }
1300 if(selectedfeature == "logs"){
1301 if(storedselectedfeature <> selectedfeature){
1302 storedselectedfeature := selectedfeature
1303 htmlpart1 := "<!DOCTYPE html><html><head><style type=text/css> html {overflow:shown; border-style:none; height: 100%; font-family: 'Verdana'; font-size:12px;} body {background:#888888; height: 100%;}"
1304 htmlpart1 .= ".logstext{width:100%; height:30px; left:0px; color: #000000;}"
1305 htmlpart2 := "</style></head><body><table width='100%'>"
1306 htmlpart2 .= "<tr><td><p class='logstext' id='logstext' style='height:100%; width:100%;'></p></td></tr>"
1307 htmlpart2 .= "</table></body></html>"
1308 html := htmlpart1 . htmlpart2
1309
1310 html2part1 := "<!DOCTYPE html><html><head><style type=text/css> html {overflow:hidden; border-style:none; height: 100%;} body {background:#777777; height: 100%;} table {left:0px; top:0px; width:100%; border-style: none; position:absolute;} [disable=disabled]{background: #666666 !important;}"
1311 html2part1 .= ".general{width:100%; height:30px; left:0px; background: #AAAAAA; color: #000000;}"
1312 html2part1 .= ".power{width:100%; height:30px; left:0px; background: #AAAAAA; color: #000000;}"
1313 html2part1 .= ".garden{width:100%; height:30px; left:0px; background: #AAAAAA; color: #000000;}"
1314 html2part1 .= ".treasure{width:100%; height:30px; left:0px; background: #AAAAAA; color: #000000;}"
1315 html2part1 .= ".shop{width:100%; height:30px; left:0px; background: #AAAAAA; color: #000000;}"
1316 html2part2 := "</style></head><body><table width='100%' id='logstable'>"
1317 html2part2 .= "<tr><td><button class='general' id='general' mode='general'>General logs</button></td></tr>"
1318 html2part2 .= "<tr><td><button class='shop' id='shop' mode='shop'>Shop logs</button></td></tr>"
1319 html2part2 .= "<tr><td><button class='power' id='power' mode='power'>Power logs</button></td></tr>"
1320 html2part2 .= "<tr><td id='gardentable'><button class='garden' id='garden' mode='garden'>Garden Logs</button></td></tr>"
1321 html2part2 .= "<tr><td id='treasuretable'><button class='treasure' id='treasure' mode='treasure'>Treasure Logs</button></td></tr>"
1322 html2part2 .= "</table></body></html>"
1323 html2 := html2part1 . html2part2
1324
1325 featuredoc.open()
1326 featuredoc.write(html)
1327 featuredoc.close()
1328
1329 maindoc2.open()
1330 maindoc2.write(html2)
1331 maindoc2.close()
1332
1333 logstext := featuredoc.getElementById("logstext")
1334 logsgeneralbutton := maindoc2.getElementById("general")
1335 logsshopbutton := maindoc2.getElementById("shop")
1336 logspowerbutton := maindoc2.getElementById("power")
1337 logsgardenbutton := maindoc2.getElementById("garden")
1338 logsgardentable := maindoc2.getElementById("gardentable")
1339 logstreasurebutton := maindoc2.getElementById("treasure")
1340 logstreasuretable := maindoc2.getElementById("treasuretable")
1341 ComObjConnect(logsgeneralbutton, "logsmode_")
1342 ComObjConnect(logsshopbutton, "logsmode_")
1343 ComObjConnect(logspowerbutton, "logsmode_")
1344 ComObjConnect(logsgardenbutton, "logsmode_")
1345 ComObjConnect(logstreasurebutton, "logsmode_")
1346 }
1347 if(logsmode){
1348 mainbuttoncheck := maindoc2.getElementById(logsmode)
1349 mainbuttoncheck.disable := "disabled"
1350 mainbuttoncheck.value := mainbuttoncheck.value
1351 }
1352 totallogs := ""
1353 for logsentry, logscontent in logs{
1354 while(logscontent.MaxIndex() > 50){
1355 logs[logsentry].remove(1) ;logscontent
1356 }
1357 loop, % logs[logsentry].MaxIndex(){
1358 if(logsentry == logsmode || logsmode == "all"){
1359 totallogs .= logs[logsentry][A_index] . "</br>"
1360 }
1361 if(totallogs.MaxIndex() > 50){
1362 totallogs.Remove(1)
1363 }
1364 }
1365 }
1366 logstext.innerhtml := totallogs
1367 }
1368 if(selectedfeature == "stats"){
1369 storedselectedfeature := selectedfeature
1370 htmlpart1 := "<!DOCTYPE html><html><head><style type=text/css> html {overflow: hidden; height:100%; width:100%; font-family: 'Verdana'; font-size:12px;} body {background:#888888; height:100%; width:100%;} table {left:0px; top:0px; width:100%; border-style: none; position:absolute;} [disable=disabled]{background: #666666 !important;}"
1371 htmlpart2 := "</style></head><body><table>"
1372 if(stats["clicks"] >= 0){
1373 htmlpart2 .= "<tr><td>times power gained by clicking: " . stats["clicks"] . "</td></tr>"
1374 }
1375 if(stats["powergained"] >= 0){
1376 htmlpart2 .= "<tr><td>total power gained: " . stats["powergained"] . "</td></tr>"
1377 }
1378 if(stats["powerspent"] >= 0){
1379 htmlpart2 .= "<tr><td>total power spent: " . stats["powerspent"] . "</td></tr>"
1380 }
1381 if(stats["upgradespurchased"] >= 0){
1382 htmlpart2 .= "<tr><td>Upgrades purchased: " . stats["upgradespurchased"] . "</td></tr>"
1383 }
1384 if(stats["mousemoves"] >= 0){
1385 htmlpart2 .= "<tr><td>times power gained by moving the mouse: " . stats["mousemoves"] . "</td></tr>"
1386 }
1387 if(stats["keyboardletterspressed"] >= 0){
1388 htmlpart2 .= "<tr><td>times power gained by using the keyboard: " . stats["keyboardletterspressed"] . "</td></tr>"
1389 }
1390 if(stats["hiddentreasuresfound"] >= 0){
1391 htmlpart2 .= "<tr><td>hidden treasures found: " . stats["hiddentreasuresfound"] . "</td></tr>"
1392 }
1393 if(stats["goldenkeyspressed"] >= 0){
1394 htmlpart2 .= "<tr><td>golden keyboard keys pressed: " . stats["goldenkeyspressed"] . "</td></tr>"
1395 }
1396 if(stats["treasurechestsfound"] >= 0){
1397 htmlpart2 .= "<tr><td>treasure chests found: " . stats["treasurechestsfound"] . "</td></tr>"
1398 }
1399 if(stats["goldenkeysfound"] >= 0){
1400 htmlpart2 .= "<tr><td>golden keys found: " . stats["goldenkeysfound"] . "</td></tr>"
1401 }
1402 if(stats["chestsopened"] >= 0){
1403 htmlpart2 .= "<tr><td>Chests opened: " . stats["chestsopened"] . "</td></tr>"
1404 }
1405 if(stats["gardenplantscreated"] >= 0){
1406 htmlpart2 .= "<tr><td>garden plants created: " . stats["gardenplantscreated"] . "</td></tr>"
1407 }
1408 if(stats["powerharvested"] >= 0){
1409 htmlpart2 .= "<tr><td>Total power harvested from plants: " . stats["powerharvested"] . "</td></tr>"
1410 }
1411 if(stats["plantsharvested"] >= 0){
1412 htmlpart2 .= "<tr><td>Total plants harvested: " . stats["plantsharvested"] . "</td></tr>"
1413 }
1414 htmlpart2 .= "</table></body></html>"
1415 html := htmlpart1 . htmlpart2
1416
1417 html2part1 := "<!DOCTYPE html><html><head><style type=text/css> html {overflow:hidden; height:100%; width:100%; font-family: 'Verdana'; font-size:12px;} body {background:#777777; height:100%; width:100%;} table {left:0px; top:0px; width:100%; border-style: none; position:absolute;} [disable=disabled]{background: #666666 !important;}"
1418 html2part2 := "</style></head><body><table>"
1419 html2part2 := "<tr><td></td></tr>"
1420 html2part2 .= "</table></body></html>"
1421 html2 := html2part1 . html2part2
1422 featuredoc.open()
1423 featuredoc.write(html)
1424 featuredoc.close()
1425 maindoc2.open()
1426 maindoc2.write(html2)
1427 maindoc2.close()
1428 }
1429 if(selectedfeature == "options"){
1430 if(storedselectedfeature <> selectedfeature){
1431 storedselectedfeature := selectedfeature
1432 ;these handle the option checkboxes. I'm not entirely sure what other options should be added though there should probably eventually be one to set autosave timer or notation.
1433 htmlpart1 := "<!DOCTYPE html><html><head><style type=text/css> html {border-style:none; overflow:shown; width:100%; height: 100%; font-family:verdana; font-size:12px;} body {background:#888888; width:100%; height: 100%;} table {left:0px; top:0px; border-style: none; position:absolute;} input[type='checkbox'] {width:20px; height:15px;}"
1434 htmlpart2 := "</style></head><body><table width='100%'>"
1435 for mainentry, maincontent in alloptions{
1436 htmlpart1 .= "." . mainentry . "{height: 30px; left:0px; color: #000000;}"
1437 htmlpart2 .= "<tr><td><input type='checkbox' class='" . mainentry . "' id='" . mainentry . "'>" . maincontent . "</td></tr>"
1438 }
1439 htmlpart2 .= "</table></body></html>"
1440 html := htmlpart1 . htmlpart2
1441
1442 html2 := "<!DOCTYPE html><html><head><style type=text/css> html {overflow:hidden; width:100%; height: 100%;} body {background:#777777; width:100%; height: 100%;}</style></head></html>"
1443 featuredoc.open()
1444 featuredoc.write(html)
1445 featuredoc.close()
1446
1447 maindoc2.open()
1448 maindoc2.write(html2)
1449 maindoc2.close()
1450 for mainentry, maincontent in alloptions{
1451 options%mainentry%checkbox := featuredoc.getElementById(mainentry)
1452 if(optionchecks[mainentry] == 1){
1453 options%mainentry%checkbox.checked := "true"
1454 optionchecks[mainentry] := 1
1455 }
1456 ComObjConnect(options%mainentry%checkbox, "optionscheckbox_")
1457 }
1458 }
1459 }
1460 if(selectedfeature == "help"){
1461 if(storedselectedfeature <> selectedfeature){
1462 storedselectedfeature := selectedfeature
1463 htmlpart1 := "<!DOCTYPE html><html><head><style type=text/css> html {overflow:shown; border-style: none; height: 100%; font-family: 'Verdana'; font-size:16px;} body {background:#888888; height: 100%;}"
1464 htmlpart1 .= ".helpinfo{width:100%; left:0px; color: #000000; word-wrap: break-word;}"
1465 htmlpart2 := "</style></head><body><table id='helpbuttonstable'>"
1466 htmlpart2 .= "<tr><td><p class='helpinfo 'id='helpinfo'></p></td></tr>"
1467 htmlpart2 .= "<table></body></html>"
1468 html := htmlpart1 . htmlpart2
1469
1470 html2part1 := "<!DOCTYPE html><html><head><style type=text/css> html {overflow:hidden; border-style: none; height: 100%;} body {background:#777777; height: 100%;} table {left:0px; top:0px; width:100%; border-style: none; position:absolute;} [disable=disabled]{background: #666666 !important;}"
1471 html2part1 .= ".basics{width:100%; height: 30px; left:0px; background: #AAAAAA; color: #000000;}"
1472 html2part1 .= ".powergeneration{width:100%; height: 60px; left:0px; background: #AAAAAA; color: #000000;}"
1473 html2part1 .= ".saving{width:100%; height: 30px; left:0px; background: #AAAAAA; color: #000000;}"
1474 html2part1 .= ".shop{width:100%; height: 30px; left:0px; background: #AAAAAA; color: #000000;}"
1475 html2part1 .= ".logs{width:100%; height: 30px; left:0px; background: #AAAAAA; color: #000000;}"
1476 html2part1 .= ".treasure{width:100%; height: 30px; left:0px; background: #AAAAAA; color: #000000;}"
1477 html2part1 .= ".garden{width:100%; height: 30px; left:0px; background: #AAAAAA; color: #000000;}"
1478 html2part1 .= ".almanac{width:100%; height: 30px; left:0px; background: #AAAAAA; color: #000000;}"
1479 html2part2 := "</style></head><body><table id='helpbuttonstable'>"
1480 html2part2 .= "<tr><td><button class='basics' id='basics' mode='basics'>The Basics</button></td></tr>"
1481 html2part2 .= "<tr><td><button class='powergeneration' id='powergeneration' mode='powergeneration'>Methods of</br>power generation</button></td></tr>"
1482 html2part2 .= "<tr><td><button class='saving' id='saving' mode='saving'>Saving the game</button></td></tr>"
1483 html2part2 .= "<tr><td><button class='shop' id='shop' mode='shop'>Shop</button></td></tr>"
1484 html2part2 .= "<tr><td><button class='logs' id='logs' mode='logs'>Logs</button></td></tr>"
1485 html2part2 .= "<tr id='treasuretable'><td><button class='treasure' id='treasure' mode='treasure'>Treasures</button></td></tr>"
1486 html2part2 .= "<tr id='gardentable'><td><button class='garden' id='garden' mode='garden'>Garden</button></td></tr>"
1487 html2part2 .= "<tr id='almanactable'><td><button class='almanac' id='almanac' mode='almanac'>Almanac</button></td></tr>"
1488 html2part2 .= "</table></body></html>"
1489 html2 := html2part1 . html2part2
1490
1491 featuredoc.open()
1492 featuredoc.write(html)
1493 featuredoc.close()
1494 maindoc2.open()
1495 maindoc2.write(html2)
1496 maindoc2.close()
1497
1498 helpbasicsbutton := maindoc2.getElementById("basics")
1499 helpsavingbutton := maindoc2.getElementById("saving")
1500 helplogsbutton := maindoc2.getElementById("logs")
1501 helpshopbutton := maindoc2.getElementById("shop")
1502 helpmousepowerbutton := maindoc2.getElementById("powergeneration")
1503 helpgardenbutton := maindoc2.getElementById("garden")
1504 helpgardentable := maindoc2.getElementById("gardentable")
1505 helpalmanacbutton := maindoc2.getElementById("almanac")
1506 helpalmanactable := maindoc2.getElementById("almanactable")
1507 helptreasurebutton := maindoc2.getElementById("treasure")
1508 helptreasuretable := maindoc2.getElementById("treasuretable")
1509 helpkeytable := maindoc2.getElementById("helpkeytable")
1510
1511 if(0 >= garden["purchased"]){
1512 ;hide these buttons if you haven't unlocked them yet.
1513 helpgardentable.style.display := "none"
1514 }
1515 else{
1516 helpgardentable.style.display := "block"
1517 }
1518 if(0 >= hiddentreasure["purchased"] && 0 >= goldenkeys["purchased"]){
1519 helptreasuretable.style.display := "none"
1520 }
1521 else{
1522 helptreasuretable.style.display := "block"
1523 }
1524 if(!plantknowledge["knowledge"]){
1525 helpalmanactable.style.display := "none"
1526 }
1527 else{
1528 helpalmanactable.style.display := "block"
1529 }
1530 ComObjConnect(helpbasicsbutton, "helpmode_")
1531 ComObjConnect(helpsavingbutton, "helpmode_")
1532 ComObjConnect(helpshopbutton, "helpmode_")
1533 ComObjConnect(helplogsbutton, "helpmode_")
1534 ComObjConnect(helpmousepowerbutton, "helpmode_")
1535 ComObjConnect(helpgardenbutton, "helpmode_")
1536 ComObjConnect(helpalmanacbutton, "helpmode_")
1537 ComObjConnect(helptreasurebutton, "helpmode_")
1538 helpinfotext := featuredoc.getElementById("helpinfo")
1539 }
1540 if(helpmode){
1541 mainbuttoncheck := maindoc2.getElementById(helpmode)
1542 mainbuttoncheck.disable := "disabled"
1543 mainbuttoncheck.value := mainbuttoncheck.value
1544 }
1545 helpvalue := ""
1546 if(helpmode == "basics"){
1547 helpvalue :=
1548 (
1549 "Welcome to Background power. Made by mipha (also known as /u/pimhazeveld) In this game you can earn power which is the game's main resource by clicking. Click anywhere you want, while having anything selected.
1550 It could be this screen, some page on the internet or even another game. This game will register the clicks and earn you power.</br>Clicking power gain is affected by various sources and new ways of earning power will quickly become available."
1551 )
1552 }
1553 if(helpmode == "saving"){
1554 helpvalue :=
1555 (
1556 "The game autosaves every 5 minutes and can be saved by manually pressing the save button. It saves by making a file near where the game is located and reads the savedata there.
1557 Saves can be backed up by copying them somewhere else and can be imported by replacing the current one. Make sure to quit the game before doing this, otherwise the game will overwrite parts of the save and possibly do some weird stuff.
1558 Futhermore the save should always be called 'backgroundpowersave.ini' otherwise it doesn't work."
1559 )
1560 }
1561 if(helpmode == "powergeneration"){
1562 if(calculateclickvalue() >= 1){
1563 helpvalue := calculateclickvalue() . " power is currently obtained every click.</br>"
1564 helpvalue .= clickpowerbonus . " from upgrades</br>"
1565 ;check if some upgrades have been bought at least once
1566 if(garden["purchased"] >= 1){
1567 helpvalue .= "+" . round(farmclickpower) . " from garden plants</br>"
1568 helpvalue .= "*" . round((farmclickpowerpercent / 100) + 1, 3) . " from garden plants</br>"
1569 }
1570 helpvalue .= "*" . round(clickpowermult, 3) . " from upgrades</br>"
1571 if(hiddentreasure["purchased"] >= 1){
1572 helpvalue .= "*" . round(treasureclickmult, 3) . " from amulets</br>"
1573 }
1574 if(knowledgepower2["purchased"] >= 1){
1575 helpvalue .= "*" . round(knowledgeclickpowermult, 3) . " from knowledge points</br>"
1576 }
1577 }
1578 if(calculatemovevalue() >= 1){
1579 helpvalue .= "</br>" . calculatemovevalue() * 2 . " power is currently obtained at most when moving the mouse</br>"
1580 helpvalue .= movepowerbonus . " from upgrades</br>"
1581 if(garden["purchased"] >= 1){
1582 helpvalue .= "+" . round(farmmovepower) . " from garden plants</br>"
1583 helpvalue .= "*" . round((farmmovepowerpercent / 100) + 1, 3) . " from garden plants</br>"
1584 }
1585 if(hiddentreasure["purchased"] >= 1){
1586 helpvalue .= "*" . round(treasuremovepowermult, 3) . " from rings</br>"
1587 }
1588 helpvalue .= "*" . round(movepowermult, 3) . " from upgrades</br>"
1589 helpvalue .= "* up to 2 depending on how much the mouse was moved</br>"
1590 if(knowledgepower2["purchased"] >= 1){
1591 helpvalue .= "*" . round(knowledgemovepowermult, 3) . " from knowledge points</br>"
1592 }
1593 if(mousemastery["purchased"] >= 1){
1594 helpvalue .= "+" . calculateclickvalue() . " from clicking power added by mouse mastery</br>"
1595 }
1596 }
1597 if(calculatemovespeed() >= 1){
1598 helpvalue .= "</br>Mouse movement efficiency is " . calculatemovespeed() . "</br>"
1599 helpvalue .= movespeedbonus . " from upgrades</br>"
1600 if(garden["purchased"] >= 1){
1601 helpvalue .= "+" . round(farmmovespeed) . " from garden plants</br>"
1602 helpvalue .= "*" . round((farmmovespeedpercent / 100) + 1, 3) . " from garden plants</br>"
1603 }
1604 helpvalue .= "*" . round(movespeedmult, 3) . " from upgrades</br>"
1605 if(hiddentreasure["purchased"] >= 1){
1606 helpvalue .= "*" . round(treasuremovespeedmult, 3) . " from pearls</br>"
1607 }
1608 helpvalue .= "Mouse movement affects how quick power is built up when moving the mouse</br>"
1609 }
1610 if(calculatekeyboardkeyvalue() >= 1){
1611 helpvalue .= "</br>power gained from keyboard keys is " . calculatekeyboardkeyvalue() . "</br>"
1612 helpvalue .= keyboardkeypowerbonus . " from upgrades</br>"
1613 if(garden["purchased"] >= 1){
1614 helpvalue .= "+" . round(farmkeyboardkeypower) . " from garden plants</br>"
1615 helpvalue .= "*" . round((farmkeyboardkeypowerpercent / 100) + 1, 3) . " from garden plants</br>"
1616 }
1617 helpvalue .= "*" . round(keyboardkeypowermult, 3) . " from upgrades</br>"
1618 if(gamerfuel["purchased"] >= 1){
1619 helpvalue .= "*2 when pressing a WASD key</br>"
1620 }
1621 if(hiddentreasure["purchased"] >= 1){
1622 helpvalue .= "*" . round(treasurekeyboardkeymult, 3) . " from gold bars</br>"
1623 }
1624 if(knowledgepower2["purchased"] >= 1){
1625 helpvalue .= "*" . round(knowledgekeyboardkeymult, 3) . " from knowledge points</br>"
1626 }
1627 }
1628 }
1629 if(helpmode == "shop"){
1630 helpvalue :=
1631 (
1632 "In the shop you can spend power to gain upgrades. The shop has 2 modes, purchase and inspect. Inspect provides information about what the upgrade does and purchase mode does the same but will also attempt to buy the upgrades using power.
1633 Most upgrades in the shop are hidden until you meet the right requirement."
1634 )
1635 }
1636 if(helpmode == "logs"){
1637 helpvalue := "The logs show general info of what recently happened. Things like purchases, power gain from mouse moving"
1638 if(garden["purchased"] >= 1){
1639 helpvalue .= ", garden plants appearing"
1640 }
1641 if(hiddentreasure["purchased"] >= 1){
1642 helpvalue .= ", hidden treasures being found"
1643 }
1644 helpvalue .= ", the game being saved and many other things are all displayed there."
1645 }
1646 if(helpmode == "garden"){
1647 helpvalue :=
1648 (
1649 "In the garden. Plants appear over time when moving the mouse. Plants provide various buffs when left alone or harvested. Plants can occasionally create new plants next to them so keep your eyes open.</br>The garden has 4 modes to manage plants
1650 </br>Inspect mode, which displays information about the tile</br>Harvest mode which removes a plant and gives rewards based on the plant</br> Swap mode which swaps the contents of 2 tiles</br> and protect mode which prevents plants from
1651 accidentally being harvested.</br> Furthermore there's also a freezer which is an entirely different garden but plants wont grow there. Plants can be moved from the garden to the freezer"
1652 )
1653 calculateharvestvalue()
1654 helpvalue .= "</br></br>Power gained from harvesting a plant varies per plant. Here is an example when harvesting a plant that yields 50 power.</br>"
1655 helpvalue .= "It would yield 50 from the plant itself</br>"
1656 helpvalue .= "+" . harvestpowerbonus . " from upgrades</br>"
1657 helpvalue .= "+" . round(farmharvestpower) . " from garden plants</br>"
1658 helpvalue .= "*" . round((farmharvestpowerpercent / 100) + 1, 3) . " from garden plants</br>"
1659 helpvalue .= "*" . round(harvestpowermult, 3) . " from upgrades</br>"
1660 if(hiddentreasure["purchased"] >= 1){
1661 helpvalue .= "*" . round(treasureharvestmult, 3) . " from emeralds</br>"
1662 }
1663 if(knowledgepower2["purchased"] >= 1){
1664 helpvalue .= "*" . round(knowledgeharvestpowermult, 3) . " from knowledge points</br>"
1665 }
1666 helpvalue .= "For a total of " . calculateharvestvalue(50) . " power"
1667 plantchance := 3
1668 gardenplantchance := 0
1669 for globalentry, globalcontent in upgrades{
1670 if(%globalentry%["plantchance"]){
1671 gardenplantchance += %globalentry%["plantchance"] * globalcontent["purchased"]
1672 }
1673 }
1674 plantchance += (((gardenplantchance * plantchance / 100)))
1675 helpvalue .= "</br></br>Empty tiles have a " . round(plantchance, 3) . " - " . round(plantchance * 2, 3) . "% chance of spawning a plant when the mouse is moved depending on how much the mouse was moved."
1676
1677 }
1678 if(helpmode == "almanac"){
1679 helpvalue :=
1680 (
1681 "The almanac is an extension to the garden. Here you can learn more about plants without many other plants affecting their stats so you can take a good look at them. Note however that rewards gained by harvesting are still affected by things
1682 like upgrades or global buffs.</br>Furthermore, here you can dump knowledge points
1683 in your discovered plants which are obtained by harvesting knowleaf plants. As more knowledge is dumped into plants, you'll discover how to create the plant and eventually start discovering how you can create other plants with it
1684 as well. Note that recipes often show question marks (?????). That means that either the plant does not have enough knowledge yet, or that it is trying to show a different plant that you do not have enough knowledge for yet.
1685 So dumping knowledge in every plant should be a priority if you want to know every plant there is to create.</br></br>"
1686 )
1687 if(10 <> calculateknowledge(10)){
1688 helpvalue .= "knowledge gained from a plant varies per plant. Here is an example when harvesting a plant that yields 10 knowledge.</br>"
1689 helpvalue .= "It would yield 10 from the plant itself</br>"
1690 helpvalue .= "+" . knowledgebonus . " from upgrades</br>"
1691 helpvalue .= "+" . round(farmknowledge) . " from garden plants</br>"
1692 helpvalue .= "*" . round((farmknowledgepercent / 100) + 1, 3) . " from garden plants</br>"
1693 helpvalue .= "*" . round(knowledgemult, 3) . " from upgrades</br>"
1694 helpvalue .= "For a total of " . calculateknowledge(10) . " knowledge"
1695 }
1696 }
1697 if(helpmode == "treasure"){
1698 if(hiddentreasure["purchased"] >= 1){
1699 helpvalue :=
1700 (
1701 "</br></br>Points on the screen can occasionally be assigned as hidden treasures when pressing keyboard keys. Mousing close to them digs them up and grants rewards. The process is entirely silent.
1702 You wont know whenever a treasure appears or when one is collected as to not bug the player with information while doing something else.</br></br>Furthermore treasure chests can occasionally be found and opened with a key to gain additional power and treasures."
1703 )
1704 if(0 >= hiddenkeys["purchased"]){
1705 helpvalue .= " How do you get a key you ask? Well you'll have to wait a little longer to find out.</br>"
1706 }
1707 helpvalue .= "power gained from hidden treasures is currently " . calculateclickvalue() * 25 . "</br>"
1708 helpvalue .=
1709 (
1710 "</br>Each treasure obtained from chests provides a 1% boost to a feature.</br>Amulets boost power gain from clicking.</br>Emeralds boost power gain from harvesting garden plants.</br>
1711 Gold bars boost power gain from opening treasure chests.</br>Grails boost power gain from finding keys.</br>Pearls boost mouse movement effeciency</br>Rings boost power gain from moving the mouse"
1712 )
1713 if(treasureradarbought == 1){
1714 helpvalue .=
1715 (
1716 "</br></br>The treasure radar is an useful feature that shows where treasures are currently located on the screen. Your mouse is displayed as a dot most of the time. When you are near a treasure.
1717 The mouse becomes an o, getting even closer makes it a 0 and finally an O until you move away or collect it."
1718 )
1719 }
1720 }
1721 if(goldenkeys["purchased"] >= 1){
1722 helpvalue .=
1723 (
1724 "</br></br>Golden keys are a slightly different type of key where occasionally a random letter key on the keyboard becomes a secret golden key when the mouse has been moved.
1725 Pressing that letter gives way more power than a normal keyboard key and occasionally an usable key</br>"
1726 )
1727 if(0 >= hiddentreasure["purchased"]){
1728 helpvalue .= " Where do you use these keys? Well you'll have to wait a little longer to find out.</br>"
1729 }
1730 helpvalue .= "power gained from golden keys currently is " . calculatekeyboardkeyvalue() * 25 . "</br>"
1731 }
1732 if(hiddentreasure["purchased"] >= 1 && goldenkeys["purchased"] >= 1){
1733 helpvalue .= "</br>Hidden treasures and golden keys can appear when both moving the mouse or pressing keyboard keys but pressing keys is more effective for treasures to appear and moving the mouse is more effective for golden keys"
1734 }
1735 }
1736 helpinfotext.innerHTML := helpvalue
1737 }
1738 critical, off
1739}
1740
1741selectfeature_onclick(selectfeaturedoc){
1742 global
1743 ;change the selected feature and disable the pressed button
1744 if(selectedfeature){
1745 buttoncheck := maindoc.getElementById(selectedfeature)
1746 buttoncheck.disable := ""
1747 buttoncheck.value := buttoncheck.value
1748 }
1749 selectedfeature := selectfeaturedoc.mode
1750 if(selectedfeature == "freezer" && gardenmode == "harvest"){
1751 gardenmode := "inspect"
1752 }
1753 updatemain()
1754}
1755
1756shopmode_onclick(shopmodedoc){
1757 global
1758 if(shopmode){
1759 buttoncheck := maindoc2.getElementById(shopmode)
1760 buttoncheck.disable := ""
1761 buttoncheck.value := buttoncheck.value
1762 }
1763 shopmode := shopmodedoc.mode
1764 updatemain()
1765}
1766
1767gardenmode_onclick(gardenmodedoc){
1768 global
1769 gardenmodedoc := gardenmodedoc.mode
1770 if(gardenmode){
1771 gardenbuttoncheck := maindoc2.getElementById(gardenmode)
1772 gardenbuttoncheck.disable := ""
1773 gardenbuttoncheck.value := gardenbuttoncheck.value
1774 }
1775 ;changes garden mode. Also handles changing from garden to freezer and vice versa.
1776 if(gardenmodedoc == "harvest" && selectedfeature == "freezer"){
1777 addtooltip("Harvest mode doesnt work in the freezer")
1778 }
1779 else{
1780 gardenmode := gardenmodedoc
1781 plantselect := ""
1782 }
1783 updatemain()
1784}
1785
1786almanacmode_onclick(almanacdoc){
1787 global
1788 if(selectedalmanacplant){
1789 buttoncheck := maindoc2.getElementById(selectedalmanacplant)
1790 buttoncheck.disable := ""
1791 buttoncheck.value := buttoncheck.value
1792 }
1793 selectedalmanacplant := almanacdoc.mode
1794 updatemain()
1795}
1796
1797addknowledge_onclick(addknowledgedoc){
1798 global
1799 ;add knowledge points to a plant based on which button is pressed and the amount of knowledge you and the plant already have.
1800 almanacvalue := min(plantknowledge[selectedalmanacplant]["cap"] - plantknowledge[selectedalmanacplant]["current"])
1801 if(addknowledgedoc.percent == "true"){
1802 addknowledgevalue := round(min(almanacvalue, plantknowledge["knowledge"] / 100 * addknowledgedoc.mode))
1803 plantknowledge[selectedalmanacplant]["current"] := round(plantknowledge[selectedalmanacplant]["current"] + addknowledgevalue)
1804 }
1805 else{
1806 addknowledgevalue := round(min(almanacvalue, plantknowledge["knowledge"], addknowledgedoc.mode))
1807 plantknowledge[selectedalmanacplant]["current"] := round(plantknowledge[selectedalmanacplant]["current"] + addknowledgevalue)
1808 }
1809 plantknowledge["knowledge"] := round(plantknowledge["knowledge"] - addknowledgevalue)
1810 updatemain()
1811}
1812
1813logsmode_onclick(logsmodedoc){
1814 global
1815 if(logsmode){
1816 buttoncheck := maindoc2.getElementById(logsmode)
1817 buttoncheck.disable := ""
1818 buttoncheck.value := buttoncheck.value
1819 }
1820 logsmode := logsmodedoc.mode
1821 updatemain()
1822}
1823
1824helpmode_onclick(helpmodedoc){
1825 global
1826 if(helpmode){
1827 buttoncheck := maindoc2.getElementById(helpmode)
1828 buttoncheck.disable := ""
1829 buttoncheck.value := buttoncheck.value
1830 }
1831 helpmode := helpmodedoc.mode
1832 updatemain()
1833}
1834
1835optionscheckbox_onclick(optionscheckboxdoc){
1836 global
1837 ;for the checkboxes in the options
1838 gui, Options:default
1839 optionscheckboxvalue := optionscheckboxdoc.id
1840 if(optionscheckboxdoc.checked){
1841 optionchecks[optionscheckboxvalue] := 1
1842 }
1843 else{
1844 optionchecks[optionscheckboxvalue] := 0
1845 }
1846 updatemain()
1847}
1848
1849purchaseradar_onclick(){
1850 global
1851 if(power > 50000 && treasureradarbought <> 1){
1852 changepower(50000, "subtract")
1853 treasureradarbought := 1
1854 addtooltip("radar bought. Look in the help tab about treasure power generation to learn more about it", 50)
1855 addlog("radar bought. Look in the help tab about treasure power generation to learn more about it", "treasure")
1856 updatemain()
1857 }
1858}
1859
1860shoppurchase_onclick(shoppurchasedoc){
1861 global
1862 shoppurchasedoc := shoppurchasedoc.id
1863 shoppurchasedoc := % %shoppurchasedoc%
1864 ;this gets the id of the button pressed which contains the name of an upgrad. The name of the upgrade then gets turned into its value because every upgrade contains an array of its stats and cost and such.
1865 ;shopmode is set in shopmode_onclick()
1866 upgradeprice := calculateshopprice(shoppurchasedoc)
1867 upgradeprice := round(upgradeprice)
1868 totaldescription := ""
1869 if(shopmode == "purchase"){
1870 ;if you can afford the upgrade and you haven't bought equal or more upgrades than the repeated tag or you haven't bought this and there is no repeated tag. Buy the upgrade
1871 if(power >= upgradeprice && ((shoppurchasedoc["repeated"] > shoppurchasedoc["purchased"]) || (shoppurchasedoc["purchased"] == 0 && !shoppurchasedoc["repeated"]))){
1872 addlog("bought " . shoppurchasedoc["name"] . " " . shoppurchasedoc["purchased"] . " > " . shoppurchasedoc["purchased"] + 1 . ". Power -" . upgradeprice, "shop")
1873 changepower(upgradeprice, "subtract")
1874 shoppurchasedoc["purchased"] += 1
1875 if(!stats["upgradespurchased"]){
1876 stats["upgradespurchased"] := 0
1877 }
1878 stats["upgradespurchased"] += 1
1879 }
1880 else if(shoppurchasedoc["purchased"] >= shoppurchasedoc["repeated"] || !shoppurchasedoc["repeated"]){
1881 totaldescription .= "No more levels of that upgrade available`n"
1882 }
1883 else if(upgradeprice > power){
1884 totaldescription .= "Not enough power (need " . round(upgradeprice - power) . " more)`n"
1885 }
1886 }
1887 ;this creates the description of the upgrade based on what they boost and their associated description. Use tostring(name of upgrade) to see how the array and its description look.
1888 totaldescription .= shoppurchasedoc["name"] . "`n"
1889 if(shoppurchasedoc["repeated"] > hoppurchasedoc["purchased"]){
1890 totaldescription .= "Cost: " . upgradeprice . "`n"
1891 }
1892 if(shoppurchasedoc["repeated"]){
1893 totaldescription .= "Level: " . shoppurchasedoc["purchased"] . "/" . shoppurchasedoc["repeated"] . "`n"
1894 }
1895 else{
1896 totaldescription .= "Level: " . shoppurchasedoc["purchased"] . "`n"
1897 }
1898 for UpgradeDescrA, UpgradeDescrB in shoppurchasedoc{
1899 if(UpgradeDescrA == "clickpower"){
1900 totaldescription .= "+" . UpgradeDescrB . " power gained for every click. (" . UpgradeDescrB * shoppurchasedoc["purchased"] . ") total`n"
1901 }
1902 if(UpgradeDescrA == "clickpowerpercent"){
1903 totaldescription .= "+" . UpgradeDescrB . "% power gained for every click (" . UpgradeDescrB * shoppurchasedoc["purchased"] . ") total`n"
1904 }
1905 if(UpgradeDescrA == "movepower"){
1906 totaldescription .= "+" . UpgradeDescrB . " power gained for moving the mouse. (" . UpgradeDescrB * shoppurchasedoc["purchased"] . ") total`n"
1907 }
1908 if(UpgradeDescrA == "movepowerpercent"){
1909 totaldescription .= "+" . UpgradeDescrB . "% power gained for moving the mouse. (" . UpgradeDescrB * shoppurchasedoc["purchased"] . ") total`n"
1910 }
1911 if(UpgradeDescrA == "movespeedtopower"){
1912 totaldescription .= "+" . UpgradeDescrB . " power gained every time the mouse moves. (" . UpgradeDescrB * shoppurchasedoc["purchased"] . ") total`n"
1913 }
1914 if(UpgradeDescrA == "movespeed"){
1915 totaldescription .= "+" . UpgradeDescrB . " to mouse movement efficiency. (" . UpgradeDescrB * shoppurchasedoc["purchased"] . ") total`n"
1916 }
1917 if(UpgradeDescrA == "harvestpower"){
1918 totaldescription .= "+" . UpgradeDescrB . " power gained from harvested plants. (" . UpgradeDescrB * shoppurchasedoc["purchased"] . ") total`n"
1919 }
1920 if(UpgradeDescrA == "harvestpowerpercent"){
1921 totaldescription .= "+" . UpgradeDescrB . "% power gained from harvested plants. (" . UpgradeDescrB * shoppurchasedoc["purchased"] . ") total`n"
1922 }
1923 if(UpgradeDescrA == "plantchance"){
1924 totaldescription .= "+" . UpgradeDescrB . "% plant appearance rate. (" . UpgradeDescrB * shoppurchasedoc["purchased"] . ") total`n"
1925 }
1926 if(UpgradeDescrA == "treasurepower"){
1927 totaldescription .= "+" . UpgradeDescrB . " power gained from hidden treasures. (" . UpgradeDescrB * shoppurchasedoc["purchased"] . ") total`n"
1928 }
1929 if(UpgradeDescrA == "keyboardkeypower"){
1930 totaldescription .= "+" . UpgradeDescrB . " power gained from keyboard keys. (" . UpgradeDescrB * shoppurchasedoc["purchased"] . ") total`n"
1931 }
1932 if(UpgradeDescrA == "knowledgepower"){
1933 totaldescription .= "each point of knowledge grants + " . UpgradeDescrB . "% power generation from all sources`n"
1934 }
1935 }
1936 totaldescription .= shoppurchasedoc["descr"]
1937 addtooltip(totaldescription, 150, "shopdescription")
1938 updatemain()
1939}
1940
1941updategardeneffects(){
1942 global
1943
1944 farmclickpower := 0
1945 farmclickpowerpercent := 0
1946 farmmovepower := 0
1947 farmmovepowerpercent := 0
1948 farmharvestpower := 0
1949 farmharvestpowerpercent := 0
1950 farmmovespeed := 0
1951 farmmovespeedpercent := 0
1952 farmmovespeedtopower := 0
1953 farmmovespeedtopowerpercent := 0
1954 farmtreasurepower := 0
1955 farmtreasurepowerpercent := 0
1956 farmkeyboardkeypower := 0
1957 farmkeyboardkeypowerpercent := 0
1958 farmknowledge := 0
1959 farmknowledgepercent := 0
1960 ;all plant effects are here. They need to be set to 0 here otherwise things that use them return empty string instead of an actual number.
1961
1962 loop, % gardentiles{
1963 GX := mod(A_index, 10)
1964 GY := ceil(A_index / 10)
1965 if(GX == 0){
1966 GX = 10
1967 }
1968 ;remove the temporary effects on tiles. FIRST. Otherwise effects from plants to the top or left get wiped.
1969 tile%GX%A%GY%["temp"] := {}
1970 }
1971 loop, % gardentiles{
1972 GX := mod(A_index, 10)
1973 GY := ceil(A_index / 10)
1974 if(GX == 0){
1975 GX = 10
1976 }
1977 if(tile%GX%A%GY%["plant"]["auras"]){
1978 loop, % tile%GX%A%GY%["nextto"].MaxIndex(){
1979 nexttoentry := tile%GX%A%GY%["nextto"][A_index]
1980 tile%nexttoentry%["temp"] := fusearrays([tile%nexttoentry%["temp"], tile%GX%A%GY%["plant"]["auras"]])
1981 ;the temp stat of a plant gets combined with the auras of all nearby plants
1982 }
1983 }
1984 }
1985 ;This part was rather complicated so I put all plant effects here so I can easily take a look at them
1986 ;tree := {harvest:{harvestpower:25}, global:{clickpower:1}}
1987 ;barkwood := {harvest:{harvestpower:50}, passive:{harvestpowerpercent:400}}
1988 ;titantree := {harvest:{harvestpower:300}, global:{harvestpowerpercent:10}}
1989 ;flower := {global:{clickpowerpercent:1}}
1990 ;yellowberry := {name: "Y berry"}
1991 ;bluestalk := {harvest:{harvestpower:350}, global:{clickpower:3}}
1992 ;appletree := {harvest:{harvestpower:170}, global:{clickpowerpercent:4}}
1993 ;yellowbulb := {name: "Y bulb", harvest:{tpower:250}}
1994 ;yellowstalk := {harvest:{harvestpower:100}, global:{clickpower:2, movepower: 1, clickpowerpercent:1}}
1995 ;dimbloom := {harvest:{harvestpower:200}, global:{clickpowerpercent:9}}
1996 ;greenstalk := {harvest:{harvestpower:450}, global:{clickpower:5, movepower:1, clickpowerpercent:1}}
1997 ;sapleaf := {auras:{global:{clickpower:1}, harvest:{harvestpower:1, harvestpowerpercent:5}}, tileauras:{harvest:{harvestpowerpercent:5}}}
1998 ;grimpetal := {global:{clickpower:1}, auras:{passive:{clickpowerpercent:5}}}
1999 ;gripvine := {global:{movepower:5, movespeed:1}}
2000 ;GX := 2
2001 ;GY := 2
2002 ;farmvalue := fusearrays([tile%GX%A%GY%["plant"], tile%GX%A%GY%["temp"]])
2003 ;msgbox % arraytostring(farmvalue)
2004 loop, % gardentiles{
2005 GX := mod(A_index, 10)
2006 GY := ceil(A_index / 10)
2007 if(GX == 0){
2008 GX = 10
2009 }
2010 if(tile%GX%A%GY%["plant"]["name"]){
2011 ;this part gathers all the stats of all plants and puts them into one appropriate value for each different stat for other features to use.
2012 farmvalue := fusearrays([tile%GX%A%GY%["plant"], tile%GX%A%GY%["permanent"], tile%GX%A%GY%["temp"]])
2013 ;msgbox % arraytostring(farmvalue) ;shows the entire array of what the tile with its plant, temp and permanent effects look like
2014 for gardeneffectentry, gardeneffectcontent in farmvalue["global"]{
2015 ;gardenglobalbonus contains the global bonus
2016 gardenglobalbonus := gardeneffectcontent
2017 Stringright, farmvalue3, gardeneffectentry, 7
2018 if(farmvalue3 <> "percent"){
2019 gardenpassivebonus := farmvalue["passive"][gardeneffectentry]
2020 ;gardenpassive bonus contains an added passive bonus for the global bonus
2021 }
2022 gardenpassivepercentbonus := farmvalue["passive"][gardeneffectentry . "percent"]
2023 ;gardenpassivepercent bonus contains an added passive % bonus for the global bonus
2024 if gardenpassivebonus is not number
2025 {
2026 gardenpassivebonus := 0
2027 }
2028 if gardenpassivepercentbonus is not number
2029 {
2030 gardenpassivepercentbonus := 0
2031 }
2032 if(!farmvalue[gardeneffectentry]){
2033 farmvalue[gardeneffectentry] := 0
2034 }
2035 farm%gardeneffectentry% += (gardenglobalbonus + gardenpassivebonus) * ((gardenpassivepercentbonus / 100) + 1)
2036 }
2037 }
2038 }
2039}
2040
2041purchasetile_onclick(purchasedoc){
2042 global
2043 ;handles purchasing garden/freezer tiles. Its very similar to buying upgrades. The price is 300 power for every garden tile + 8% for every garden tile. The price for freezer tiles is 400 per freezer tile + 8% per freezer tile
2044 purchasedoc := purchasedoc.topurchase
2045 if(purchasedoc == "gardentile"){
2046 if(power >= tileprice("garden") && 100 > gardentiles){
2047 changepower(tileprice("garden"), "subtract")
2048 addlog("bought garden tile " . gardentiles . ". Power -" . tileprice("garden"), "garden")
2049 gardentiles += 1
2050 updatemain()
2051 }
2052 }
2053 else if(purchasedoc == "freezertile"){
2054 if(power >= tileprice("freezer") && 100 > freezertiles){
2055 changepower(tileprice("freezer"), "subtract")
2056 addlog("bought freezer tile " . freezertiles . ". Power -" . tileprice("freezer"), "garden")
2057 freezertiles += 1
2058 updatemain()
2059 }
2060 }
2061}
2062
2063garden_onclick(gardendoc){
2064 global
2065 updategardeneffects()
2066 contents := gardendoc.id
2067 contents := % %contents%
2068 loginfo := ""
2069 ;when any tile on the garden/freezer is clicked. This activates. The biggest part here is assembling the description for the tiles based on what's on there at the moment
2070 farmvalue := fusearrays([contents["plant"], contents["permanent"], contents["temp"]])
2071 ;when trying to harvest a plant. This part activates
2072 if (gardenmode == "harvest" && featuredoc.getElementById(gardendoc.id).getAttribute("disable") <> "disabled" && !contents["plant"]["protected"]){
2073 if(farmvalue["name"] == ""){
2074 ;addtooltip("there is no plant here to harvest")
2075 }
2076 else{
2077 contents["plant"] := ""
2078 addlog("Harvested a " . farmvalue["name"], "garden")
2079 descr := "harvested " . farmvalue["name"]
2080 loginfo .= "harvested " . farmvalue["name"]
2081 gardentreasurelog := ""
2082 for farmentry, farmcontent in allplants{
2083 if(farmcontent["name"] == farmvalue["name"]){
2084 ;show new harvested plants in the almanac
2085 plantknowledge[farmentry]["seen"] := 1
2086 }
2087 }
2088 farmvalue2 := {}
2089 farmvalue2["harvest"] := fusearrays([farmvalue["harvest"], farmvalue["passive"], farmvalue["global"]])
2090 for gardenentry, gardencontent in farmvalue2["harvest"]{
2091 if(gardenentry == "harvestpower"){
2092 gardenvalue := calculateharvestvalue(farmvalue2)
2093 ;plant example
2094 ;barkwood := {rarity: 25, descr: "A small but dense tree. Its bark makes for a great power source but sadly this plant has barely any of it", name:"barkwood", harvest:{power:5}, passive:{harvestpowerpercent:400}}
2095 descr .= "`ngained " . gardenvalue . " power"
2096 addlog("Harvested a " . farmvalue["name"] . ". Gained " . gardenvalue . " Power.", "power")
2097 changepower(gardenvalue)
2098 if(!stats["powerharvested"]){
2099 stats["powerharvested"] := 0
2100 }
2101 stats["powerharvested"] += gardenvalue
2102 }
2103 if(gardenentry == "chest"){
2104 gardentreasurelog .= "Harvested a " . farmvalue["name"] . ". Gained " . gardencontent . " chest"
2105 descr .= "`ngained " . gardencontent . " chest"
2106 if(gardenvalue <> 1){
2107 gardentreasurelog .= "s"
2108 descr .= "s"
2109 }
2110 gardentreasurelog .= "`n"
2111 treasurechests += gardencontent
2112 if(!stats["treasurechestsfound"]){
2113 stats["treasurechestsfound"] := 0
2114 }
2115 stats["treasurechestsfound"] += gardencontent
2116 }
2117 if(gardenentry == "key"){
2118 gardentreasurelog .= "Harvested a " . farmvalue["name"] . ". Gained " . gardencontent . " key"
2119 descr .= "`ngained " . gardencontent . " key"
2120 if(gardenvalue <> 1){
2121 gardentreasurelog .= "s"
2122 descr .= "s"
2123 }
2124 gardentreasurelog .= "`n"
2125 goldenkeys += gardencontent
2126 if(!stats["goldenkeysfound"]){
2127 stats["goldenkeysfound"] := 0
2128 }
2129 stats["goldenkeysfound"] += gardencontent
2130 }
2131 if(gardenentry == "knowledge"){
2132 gardenvalue := calculateknowledge(farmvalue2)
2133 if(!almanacunlocked){
2134 almanacunlocked := 1
2135 addtooltip("You could harness this knowledge into something useful. You unlocked the almanac", 100)
2136 }
2137 plantknowledge["knowledge"] += gardenvalue
2138 descr .= "`ngained " . gardenvalue . " knowledge"
2139 }
2140 }
2141 if(farmvalue["fusion"]){
2142 ;this entire part handles plant fusion. Its rather complex
2143 fusiontargets := []
2144 loop, % contents["nextto"].Maxindex(){
2145 farmvalue2 := contents["nextto"][A_index]
2146 if (tile%farmvalue2%["plant"] && (!tile%farmvalue2%["plant"]["weakness"] || farmvalue["fusion"]["strength"] > tile%farmvalue2%["plant"]["weakness"] || limitlessfusions == "true")){
2147 fusiontargets.push(tile%farmvalue2%["plant"])
2148 ;gather all plants around the harvested tile that have less weakness than the harvested plant has strength
2149 }
2150 }
2151 while(fusiontargets.MaxIndex() > farmvalue["fusion"]["amount"]){
2152 random, farmrngesus, 1, fusiontargets.MaxIndex()
2153 fusiontargets.remove(farmrngesus)
2154 }
2155 ;then it removes random ones until it has equal or less than the max amount of plants it can fuse. The rest is handled in the createamalgamplant() function which combines the stats of the selected plants
2156 amalgamplant := createamalgamplant(fusiontargets, farmvalue["fusion"])
2157 if(amalgamplant){
2158 loginfo := "Harvesting the " . farmvalue["name"] . " made it target " . fusiontargets.Maxindex() . " plant"
2159 descr .= "`n fused " . fusiontargets.Maxindex() . " plant"
2160 if(fusiontargets.MaxIndex() <> 1){
2161 loginfo .= "s"
2162 descr .= "s"
2163 }
2164 descr .= " together into one plant"
2165 loginfo .= " and added their stats together forming an " . amalgamplant["name"] . " on tile " . contents["location"][1] . " - " . contents["location"][2]
2166 addlog(loginfo, "garden")
2167 }
2168 }
2169 if(amalgamplant){
2170 contents["plant"] := amalgamplant
2171 amalgamplant := ""
2172 if(!stats["gardenplantscreated"]){
2173 stats["gardenplantscreated"] := 0
2174 }
2175 stats["gardenplantscreated"] += 1
2176 }
2177 if(gardentreasurelog){
2178 addlog(gardentreasurelog)
2179 }
2180 if(!stats["plantsharvested"]){
2181 stats["plantsharvested"] := 0
2182 }
2183 stats["plantsharvested"] += 1
2184 addtooltip(descr, 100, "gardendescription")
2185 }
2186 }
2187 if(gardenmode == "swap"){
2188 if(!plantselect){
2189 plantselect := objfullyclone(contents)
2190 ;I don't really understand how these clones work but it prevents changing arrays in weird ways. The normal clone() function is imperfect so objfullyclone() handles that
2191 }
2192 else if(plantselect == contents){
2193 plantselect := ""
2194 }
2195 else{
2196 ;change the location of both selected plants.
2197 swapprepvalue2 := plantselect["location"][1]
2198 swapprepvalue3 := plantselect["location"][2]
2199 swapprepvalue4 := contents["location"][1]
2200 swapprepvalue5 := contents["location"][2]
2201 ;plantselect == first clicked tile. contents == second clicked tile
2202 if(plantselect["location"][3] == "freezer"){
2203 freezertile%swapprepvalue2%A%swapprepvalue3%["plant"] := contents["plant"]
2204 }
2205 else{
2206 tile%swapprepvalue2%A%swapprepvalue3%["plant"] := contents["plant"]
2207 }
2208 if(contents["location"][3] == "freezer"){
2209 freezertile%swapprepvalue4%A%swapprepvalue5%["plant"] := plantselect["plant"]
2210 }
2211 else{
2212 tile%swapprepvalue4%A%swapprepvalue5%["plant"] := plantselect["plant"]
2213 }
2214 plantselect := ""
2215 }
2216 if(plantselect){
2217 addtooltip("selected " . plantselect["plant"]["name"] . " in the " . selectedfeature . " on tile " . plantselect["location"][1] . "-" . plantselect["location"][2], 150, "gardendescription")
2218 }
2219 updatemain()
2220 }
2221 if(gardenmode == "protect"){
2222 ;protect is really simple. It just switches a value on the plant.
2223 if(!contents["plant"]["protected"]){
2224 contents["plant"]["protected"] := 1
2225 }
2226 else{
2227 contents["plant"]["protected"] := 0
2228 }
2229 }
2230 if(gardenmode == "inspect"){
2231 ;re-assign farmvalue because the clicked plant may have been swapped or harvested
2232 farmvalue := fusearrays([contents["plant"], contents["permanent"], contents["temp"]])
2233 addtooltip(getplantdescription(farmvalue, "`n", contents, gardendoc), 150, "gardendescription")
2234 }
2235 updatemain()
2236}
2237
2238getplantdescription(plant, break, tile:="", doc:=""){
2239 global
2240 ;ahk tooltip's use `n to create a new line why html uses </br>
2241 descr := ""
2242 if(tile){
2243 descr .= tile["location"][3] . " tile " . tile["location"][1] . "-" . tile["location"][2]
2244 }
2245 if(plant["name"]){
2246 descr .= " (" . plant["name"] . ")"
2247 if(featuredoc.getElementById(doc.id).getAttribute("disable") && doc.disable == "disabled"){
2248 descr .= break . "The plant here is currently inactive because its garden tile disappeared." . break . "It can't be moved or harvested and has no effects."
2249 }
2250 }
2251 descr .= break
2252 farmvalue := fusearrays([tile["temp"], tile["permanent"]])
2253 for farmentry, farmcontent in farmvalue{
2254 if(farmentry == "global" && farmcontent["clickpower"]){
2255 descr .= "plants here gain +" . round(farmcontent["clickpower"]) . " power per click" . break
2256 }
2257 if(farmentry == "passive" && farmcontent["clickpowerpercent"]){
2258 descr .= "increases the click power by " . round(farmcontent["clickpowerpercent"], 3) . "% on plants here" . break
2259 }
2260 if(farmentry == "global" && farmcontent["movepower"]){
2261 descr .= "plants here gain +" . round(farmcontent["movepower"]) . " move power" . break
2262 }
2263 if(farmentry == "passive" && farmcontent["movepowerpercent"]){
2264 descr .= "increases the move power by " . round(farmcontent["movepowerpercent"], 3) . "% to plants here" . break
2265 }
2266 if(farmentry == "passive" && farmcontent["harvestpower"]){
2267 descr .= "plants here gain +" . round(farmcontent["harvestpower"]) . " power when harvested" . break
2268 }
2269 if(farmentry == "passive" && farmcontent["harvestpowerpercent"]){
2270 descr .= "increases resources harvested by " . round(farmcontent["harvestpowerpercent"], 3) . "% to plants here" . break
2271 }
2272 if(farmentry == "global" && farmcontent["harvestpowerpercent"]){
2273 descr .= "plants here grant +" . round(farmcontent["harvestpowerpercent"], 3) . "% resources harvested from all plants" . break
2274 }
2275 if(farmentry == "global" && farmcontent["treasurepower"]){
2276 descr .= "plants here gain +" . round(farmcontent["treasurepower"], 3) . " power when finding treasures" . break
2277 }
2278 if(farmentry == "passive" && farmcontent["treasurepowerpercent"]){
2279 descr .= "Increases the treasure power gained by " . round(farmcontent["treasurepowerpercent"], 3) . "% to plants here" . break
2280 }
2281 if(farmentry == "global" && farmcontent["keyboardkeypower"]){
2282 descr .= "plants here gain +" . round(farmcontent["keyboardkeypower"], 3) . " power when pressing keyboard keys" . break
2283 }
2284 if(farmentry == "passive" && farmcontent["keyboardkeypowerpercent"]){
2285 descr .= "Increases the keyboard key power gained by " . round(farmcontent["keyboardkeypowerpercent"], 3) . "% to plants here" . break
2286 }
2287 if(farmentry == "passive" && farmcontent["knowledge"]){
2288 descr .= "plants here grant +" . farmcontent["knowledge"] . " knowledge points when harvested" . break
2289 }
2290 if(farmentry == "passive" && farmcontent["knowledgepercent"]){
2291 descr .= "Increases knowledge points gained by " . round(farmcontent["knowledgepercent"], 3) . "% to plants here" . break
2292 }
2293 if(farmentry == "global" && farmcontent["knowledgepercent"]){
2294 descr .= "plants here grant +" . round(farmcontent["knowledgepercent"], 3) . "% knowledge points harvested to all plants" . break
2295 }
2296 if(farmentry == "passive" && farmcontent["toxic"]){
2297 descr .= "Something is preventing basic plants from spawning here" . break
2298 }
2299 }
2300 if(plant["rarity"]){
2301 descr .= break . "Plant rarity: " . plant["rarity"] . " (lower numbers mean a rarer plant)" . break
2302 }
2303 if((plant["global"] || plant["auras"] || plant["tileauras"]) && plant["name"]){
2304 descr .= break . "Passive bonusses:" . break
2305 if(gardenselection == "freezer"){
2306 descr .= "These do currently not apply because the plant is frozen" . break
2307 }
2308 ;msgbox % arraytostring(farmvalue["global"])
2309 for farmentry, farmcontent in plant["global"]{
2310 farmglobalbonus := farmcontent
2311 Stringright, farmvalue, farmentry, 7
2312 if(farmvalue <> "percent"){
2313 farmpassivebonus := plant["passive"][farmentry]
2314 ;gardenpassive bonus contains an added passive bonus for the global bonus
2315 }
2316 farmpassivepercentbonus := plant["passive"][farmentry . "percent"]
2317 if farmpassivebonus is not number
2318 {
2319 farmpassivebonus := 0
2320 }
2321 if farmpassivepercentbonus is not number
2322 {
2323 farmpassivepercentbonus := 0
2324 }
2325 ;msgbox % farmpassivepercentbonus . ", " . farmpassivebonus . ", " farmglobalbonus . ", " . round((farmglobalbonus + farmpassivebonus) * ((farmpassivepercentbonus / 100) + 1))
2326 if(farmentry == "clickpower"){
2327 descr .= "Increases power gain from clicking by " . round((farmglobalbonus + farmpassivebonus) * ((farmpassivepercentbonus / 100) + 1)) break
2328 }
2329 if(farmentry == "clickpowerpercent"){
2330 descr .= "Increases power gain from clicking by " . round(farmcontent, 3) . "%" . break
2331 }
2332 if(farmentry == "movepower"){
2333 descr .= "Increases power gain from moving the mouse by " . round((farmglobalbonus + farmpassivebonus) * ((farmpassivepercentbonus / 100) + 1)) break
2334 }
2335 if(farmentry == "movepowerpercent"){
2336 descr .= "Increases power gain from moving the mouse by " . round(farmcontent, 3) . "%" . break
2337 }
2338 if(farmentry == "movespeed"){
2339 descr .= "Increases mouse movement efficiency by " . round((farmglobalbonus + farmpassivebonus) * ((farmpassivepercentbonus / 100) + 1)) break
2340 }
2341 if(farmentry == "harvestpower"){
2342 descr .= "Increases power gain from all harvested plants by " . round((farmglobalbonus + farmpassivebonus) * ((farmpassivepercentbonus / 100) + 1)) break
2343 }
2344 if(farmentry == "harvestpowerpercent"){
2345 descr .= "Increases power gain from all harvested plants by " . round(farmcontent, 3) . "%" . break
2346 }
2347 if(farmentry == "treasurepower"){
2348 descr .= "Increases power gain from treasures by " . round((farmglobalbonus + farmpassivebonus) * ((farmpassivepercentbonus / 100) + 1)) break
2349 }
2350 if(farmentry == "treasurepowerpercent"){
2351 descr .= "Increases power gain from treasures by " . round(farmcontent, 3) . "%" . break
2352 }
2353 if(farmentry == "keyboardkeypower"){
2354 descr .= "Increases power gain from keyboard keys by " . round((farmglobalbonus + farmpassivebonus) * ((farmpassivepercentbonus / 100) + 1)) . "%" . break
2355 }
2356 if(farmentry == "keyboardkeypowerpercent"){
2357 descr .= "Increases power gain from keyboard keys by " . round(farmcontent, 3) . "%" . break
2358 }
2359 }
2360 ;msgbox % arraytostring(farmvalue["auras"])
2361 for farmentry, farmcontent in plant["auras"]{
2362 if(farmentry == "global" && farmcontent["clickpower"]){
2363 descr .= "boosts the power per click of plants around this by " . farmcontent["clickpower"] break
2364 }
2365 if(farmentry == "passive" && farmcontent["clickpowerpercent"]){
2366 descr .= "boosts the power per click % bonus of plants around this by " . farmcontent["clickpowerpercent"] . "%" . break
2367 }
2368 if(farmentry == "global" && farmcontent["movepower"]){
2369 descr .= "boosts the power gained from moving the mouse of plants around this by " . farmcontent["movepower"] break
2370 }
2371 if(farmentry == "passive" && farmcontent["movepowerpercent"]){
2372 descr .= "boosts the power % gained from moving the mouse of plants around this by " . farmcontent["movepowerpercent"] . "%" . break
2373 }
2374 if(farmentry == "passive" && farmcontent["harvestpower"]){
2375 descr .= "boosts the power gained from harvesting plants around this by " . farmcontent["harvestpower"] break
2376 }
2377 if(farmentry == "passive" && farmcontent["harvestpowerpercent"]){
2378 descr .= "boosts the power gained from harvesting plants around this by " . farmcontent["harvestpowerpercent"] . "%" . break
2379 }
2380 if(farmentry == "global" && farmcontent["treasurepower"]){
2381 descr .= "boosts the power gained from hidden treasures of plants around this by " . farmcontent["treasurepower"] break
2382 }
2383 if(farmentry == "passive" && farmcontent["treasurepowerpercent"]){
2384 descr .= "boosts the power gained from hidden treasures of plants around this by " . farmcontent["treasurepowerpercent"] . "%" . break
2385 }
2386 if(farmentry == "global" && farmcontent["keyboardkeypower"]){
2387 descr .= "boosts the power gained from keyboard keys of plants around this by " . farmcontent["keyboardkeypower"] . "%" . break
2388 }
2389 if(farmentry == "passive" && farmcontent["keyboardkeypowerpercent"]){
2390 descr .= "boosts the power gained from keyboard keys of plants around this by " . farmcontent["keyboardkeypowerpercent"] . "%" . break
2391 }
2392 if(farmentry == "passive" && farmcontent["knowledge"]){
2393 descr .= "boosts the knowledge gained from plants around this by " . farmcontent["knowledge"] break
2394 }
2395 if(farmentry == "passive" && farmcontent["knowledgepercent"]){
2396 descr .= "boosts the knowledge gained from plants around this by " . farmcontent["knowledgepercent"] . "%" . break
2397 }
2398 }
2399 ;msgbox % arraytostring(farmvalue["tileauras"])
2400 for farmentry, farmcontent in plant["tileauras"]{
2401 ;rootwraith := {auras:{passive:{harvestpower:15, harvestpowerpercent:7}}, tileauras:{passive:{harvestpower:10}, global:{harvestpowerpercent:1}}}
2402 if(farmentry == "global" && farmcontent["clickpower"]){
2403 descr .= "slowly affects nearby tiles with a permanent bonus to click power. up to a max of " . farmcontent["clickpower"] break
2404 }
2405 if(farmentry == "passive" && farmcontent["clickpowerpercent"]){
2406 descr .= "slowly affects nearby tiles with a permanent bonus to click power. up to a max of " . farmcontent["clickpowerpercent"] . "%" . break
2407 }
2408 if(farmentry == "global" && farmcontent["movepower"]){
2409 descr .= "slowly affects nearby tiles with a permanent bonus to move power. up to a max of " . farmcontent["movepower"] break
2410 }
2411 if(farmentry == "passive" && farmcontent["movepowerpercent"]){
2412 descr .= "slowly affects nearby tiles with a permanent bonus to move power. up to a max of " . farmcontent["movepowerpercent"] . "%" . break
2413 }
2414 if(farmentry == "passive" && farmcontent["harvestpower"]){
2415 descr .= "slowly affects nearby tiles with a permanent bonus to harvest power. up to a max of " . farmcontent["harvestpower"] break
2416 }
2417 if(farmentry == "passive" && farmcontent["harvestpowerpercent"]){
2418 descr .= "slowly affects nearby tiles with a permanent bonus to harvest power. up to a max of " . farmcontent["harvestpowerpercent"] . "%" . break
2419 }
2420 if(farmentry == "global" && farmcontent["harvestpowerpercent"]){
2421 descr .= "slowly affects nearby tiles with a permanent bonus to harvest power to all plants. up to a max of " . farmcontent["harvestpowerpercent"] . "%" . break
2422 }
2423 if(farmentry == "global" && farmcontent["treasurepower"]){
2424 descr .= "slowly affects nearby tiles with a permanent bonus to treasure power. up to a max of " . farmcontent["treasurepower"] break
2425 }
2426 if(farmentry == "passive" && farmcontent["treasurepowerpercent"]){
2427 descr .= "slowly affects nearby tiles with a permanent bonus to treasure power. up to a max of " . farmcontent["treasurepowerpercent"] . "%" . break
2428 }
2429 if(farmentry == "global" && farmcontent["keyboardkeypower"]){
2430 descr .= "slowly affects nearby tiles with a permanent bonus to keyboard key power. up to a max of " . farmcontent["keyboardkeypower"] break
2431 }
2432 if(farmentry == "passive" && farmcontent["keyboardkeypowerpercent"]){
2433 descr .= "slowly affects nearby tiles with a permanent bonus to keyboard key power. up to a max of " . farmcontent["keyboardkeypowerpercent"] break
2434 }
2435 if(farmentry == "global" && farmcontent["knowledgepercent"]){
2436 descr .= "slowly affects nearby tiles with a permanent bonus to knowledge points gained from all plants up to a max of " . farmcontent["knowledgepercent"] . "%" . break
2437 }
2438 }
2439 if(plant["weakness"]){
2440 descr .= break . "Fusion weakness: " . plant["weakness"] . " (weakened plants can only be fused using plants with more strength than this has weakness)" . break
2441 }
2442 }
2443 plant2 := {}
2444 plant2["harvest"] := fusearrays([plant["harvest"], plant["passive"], plant["global"]])
2445 for farmentry, farmcontent in plant2["harvest"]{
2446 stringleft, farmvalue, farmentry, 7
2447 if(farmvalue == "harvest"){
2448 descr .= break . "Harvest rewards:" . break
2449 if(gardenselection == "freezer"){
2450 descr .= "move this plant to the garden to be able to harvest it" . break
2451 }
2452 break
2453 }
2454 }
2455 for farmentry, farmcontent in plant2["harvest"]{
2456 farmglobalbonus := farmcontent
2457 farmpassivepercentbonus := plant[farmentry . "percent"]
2458 if farmpassivepercentbonus is not number
2459 {
2460 farmpassivepercentbonus := 0
2461 }
2462 if(farmentry == "harvestpower"){
2463 descr .= "Power: " . calculateharvestvalue(plant2) break
2464 }
2465 if(farmentry == "harvestseeds"){
2466 descr .= "plants up" . floor(farmglobalbonus) . " plants around this."
2467 }
2468 if(farmentry == "chest"){
2469 descr .= farmglobalbonus . " chest"
2470 if(farmglobalbonus <> 1){
2471 descr .= "s"
2472 }
2473 descr .= break
2474 }
2475 if(farmentry == "key"){
2476 descr .= farmglobalbonus . " key"
2477 if(farmglobalbonus <> 1){
2478 descr .= "s"
2479 }
2480 descr .= break
2481 }
2482 if(farmentry == "knowledge"){
2483 descr .= "plant knowledge: " . calculateknowledge(plant2) break
2484 }
2485 }
2486 if(plant["fusion"]){
2487 descr .= break . "Fusion strength: " . plant["fusion"]["strength"] . " (Higher strength levels are required to fuse already fused plants together)" . break
2488 descr .= "This plant copies the stats of up to " . plant["fusion"]["amount"] . " nearby plants when harvested and forms it together." . break . "Creating a single plant with the stats of all selected plants combined." . break
2489 }
2490 if(plant["descr"]){
2491 descr .= break "Description: " . plant["descr"]
2492 }
2493 return descr
2494}
2495
2496creategardenplant(fixedchance:=5, fixedposX:="", fixedposY:="", fixedplant:="", aggressive:=""){
2497 global
2498 ;fixedchance. If this value is given, the chance of a plant appearing for tiles checked will be a percentage equal to the given value. Say putting it on 50 gives a 50% for putting a plant on every tile
2499 ;fixedposX, if this value is given, plants can only appear on the X location of the given value
2500 ;fixedposY is pretty self explanatory now
2501 ;aggressive, if this value is given. Plants will override other plants.
2502 ;fixedplant should be filled with the array of a plant, examples are shown here below. This changes all plants changed to be this specific plant instead.
2503 if(s0 >= garden["purchased"]){
2504 ;no plants when there is no garden
2505 return
2506 }
2507 loop, %gardentiles%{
2508 SX := mod(A_index, gardenmaxX)
2509 SY := ceil(A_index / gardenmaxY)
2510 if(SX == 0){
2511 SX = 10
2512 }
2513 if(fixedposX && SX <> fixedposX){
2514 continue
2515 ;continue just ends the current loop and starts a new one
2516 }
2517 if(fixedposY && SY <> fixedposY){
2518 continue
2519 }
2520 if(tile%SX%A%SY%["plant"]["name"] == "" || aggressive){
2521 random, rngesus, 1, 100
2522 if(fixedchance >= rngesus || maxgardenplantchance == "true"){
2523 ;plant combo example
2524 ;plantcombos := [{pardners:["tree", "flower"], result:"appletree", rarity:100}]
2525 random, trycombo, 1, 2
2526 ;if trycombo is 2 it tries to create a combo plant which checks nearby tiles to see if it can create something
2527 loop{
2528 result := ""
2529 if(trycombo == 2){
2530 plantcombototal := {}
2531 ;first it loops through every available combo
2532 loop, % plantcombos.MaxIndex(){
2533 plantloop := A_index
2534 plantsneeded := {}
2535 ;an array is created containing a number according to the plant needed.
2536 loop, % plantcombos[plantloop]["Pardners"].MaxIndex(){
2537 whatneeded := plantcombos[plantloop]["Pardners"][A_index]
2538 whatneeded := %whatneeded%["name"]
2539 if(!plantsneeded[whatneeded]){
2540 plantsneeded[whatneeded] := 0
2541 }
2542 plantsneeded[whatneeded] += 1
2543 }
2544 ;it checks all the tiles next to the selected tile and if it finds a plant that the combo needs. It subtracts 1 from the array.
2545 for, creategardenplantentry, creategardenplantcontent in tile%SX%A%SY%["nextto"]{
2546 if(plantsneeded[tile%creategardenplantcontent%["plant"]["name"]] > 0){
2547 plantsneeded[tile%creategardenplantcontent%["plant"]["name"]] -= 1
2548 }
2549 }
2550 ;so simple! it checks the entire array and gets the largest number. If its 0 then the combo is successful. Else it removes the combo from the current list and tries again.
2551 if(0 >= objectminmax(plantsneeded, "max")){
2552 random, rngesus3, 1, 1000
2553 if(plantcombos[plantloop]["rarity"] * 10 >= rngesus3 || ignoreplantrarity == "true"){
2554 plantcombototal.push(plantcombos[plantloop]["result"])
2555 }
2556 }
2557 }
2558 loop{
2559 ;loop through all successful combos and choose one.
2560 if(plantcombototal.MaxIndex() > 0){
2561 random, rngesus3, 1, 1000
2562 random, whichcombo, 1, plantcombototal.MaxIndex()
2563 creategardenplantvalue := plantcombototal[whichcombo]
2564 ;check the rarity. If the check fails. Remove this combo too and try the next one.
2565 if(%creategardenplantvalue%["rarity"] * 10 >= rngesus3 || ignoreplantrarity == "true"){
2566 ;if it succeeds. Put the plant in result which will be added to the garden
2567 result := %creategardenplantvalue%
2568 break
2569 }
2570 else{
2571 plantcombototal.remove(whichcombo)
2572 }
2573 }
2574 else{
2575 break
2576 }
2577 }
2578 if(plantcombototal.MaxIndex() >= 1){
2579 break
2580 }
2581 else{
2582 ;no combinations are possible. Create a normal non-combo plant instead
2583 trycombo = 1
2584 }
2585 }
2586 else{
2587 random, rngesus2, 1, plants.MaxIndex()
2588 random, rngesus3, 1, 1000
2589 selectedplant := plants[rngesus2]
2590 ;take a random plant from the list, check its rarity and if the check succeeds.
2591 if((selectedplant["rarity"] * 10) >= rngesus3 || ignoreplantrarity == "true"){
2592 ;if it succeeds. Put the plant in result which will be added to the garden
2593 if(!tile%SX%A%SY%["temp"]["passive"]["toxic"]){
2594 ;non-combo plants can not be created next to a toxic plant. No more useless clearing of dust trees and tick flowers while searching for those rare plants
2595 result := selectedplant
2596 }
2597 break
2598 }
2599 }
2600 }
2601 random, gardentimerrngesus, 1, 1000
2602 if(fixedplant){
2603 result := fixedplant
2604 }
2605 if(result){
2606 if(result["name"] == "lockbloom" && keyavailable){
2607 result["symbol"] := keyavailable
2608 }
2609 tile%SX%A%SY%["plant"] := ObjFullyClone(result)
2610 if(silentplants == "false" || silentplants >= gardentimerrngesus){
2611 ;silentplants is a dev function which causes plants to not fill the logs as much as they normally do.
2612 addlog(result["name"] . " appeared on tile " . SX . " - " . SY, "garden")
2613 }
2614 ;I had a lot of trouble with this until I figured out objfullyclone(). If I remove this function. Every plant will think its next to the same spaces
2615 gardendocedit := gardendoc.getelementbyid("tile" . SX . "A" . SY)
2616 storedplantname := tile%SX%A%SY%["plant"]["name"]
2617 if(!stats["gardenplantscreated"]){
2618 stats["gardenplantscreated"] := 0
2619 }
2620 stats["gardenplantscreated"] += 1
2621 updategardeneffects()
2622 }
2623 updatemain()
2624 }
2625 }
2626 }
2627}
2628
2629gardentick(){
2630 global
2631 ;plant example
2632 ;clickvine := {tileauras:{passive:{percent:{clickpower:5}, direct:{clickpower:5}}}}
2633 ;this function activates whenever mouse movement tries to spawn garden plants.
2634 ;this part handles garden ticks which happen after moving the mouse. The activate effects like permanent tile buffing.
2635 loop, % gardentiles{
2636 GTX := mod(A_index, 10)
2637 GTY := ceil(A_index / 10)
2638 if(GTX == 0){
2639 GTX = 10
2640 }
2641 ;rootwraith := {tileauras:{global:{harvestpower:10, harvestpowerpercent:1}}}
2642 gardentickvalue := fusearrays([tile%GTX%A%GTY%["plant"], tile%GTX%A%GTY%["passive"], tile%GTX%A%GTY%["permanent"]])
2643 for gardentickentry, gardentickcontent in gardentickvalue["tileauras"]{
2644 for gardentickentry2, gardentickcontent2 in gardentickvalue["tileauras"][gardentickentry]{
2645 for, gardentickentry3, gardentickcontent3 in tile%GTX%A%GTY%["nextto"]{
2646 ;this part is painfully complex but kinda required to handle this correctly.
2647 if(!tile%gardentickcontent3%["permanent"]){
2648 tile%gardentickcontent3%["permanent"] := {}
2649 }
2650 if(!tile%gardentickcontent3%["permanent"][gardentickentry]){
2651 tile%gardentickcontent3%["permanent"][gardentickentry] := {}
2652 }
2653 if(!tile%gardentickcontent3%["permanent"][gardentickentry][gardentickentry2]){
2654 tile%gardentickcontent3%["permanent"][gardentickentry][gardentickentry2] := 0
2655 }
2656 tile%gardentickcontent3%["permanent"][gardentickentry][gardentickentry2] += calculateauraincrease(gardentickcontent2, tile%gardentickcontent3%["permanent"][gardentickentry][gardentickentry2])
2657 }
2658 }
2659 }
2660 if(gardentickvalue["name"] == "lockbloom" && keyavailable){
2661 ;lockbloom's symbol can randomly change to that of the current hidden key
2662 random, gardentickrngesus, 1, 100
2663 if(gardentickrngesus >= 98){
2664 tile%GTX%A%GTY%["plant"]["symbol"] := keyavailable
2665 }
2666 }
2667 }
2668 updategardeneffects()
2669}
2670
2671calculateauraincrease(plantmax, tilecurrent){
2672 global maxgardenpermbuffs
2673 ;the rate at which permanent buffs grow is higher based on the value on the plant and slows down after the value on the tile is higher.
2674 ;there is a mimimum growth so the value doesn't stay right under the maximum all the time but it stops increasing at all once it reaches the max.
2675 if tilecurrent is not number
2676 {
2677 tilecurrent := 0
2678 }
2679 a := (plantmax / 500) * (1 - min((tilecurrent + 1) / plantmax, 1)) + (plantmax / 1000)
2680 if(tilecurrent + a >= plantmax || maxgardenpermbuffs == "true"){
2681 a := max(plantmax - tilecurrent, 0)
2682 }
2683 return a
2684}
2685
2686tileprice(value:=""){
2687 global gardentiles, freezertiles
2688 if(value == "garden"){
2689 return round((200 * gardentiles) * (1.08 ** gardentiles))
2690 }
2691 else if(value == "freezer"){
2692 return round((225 * freezertiles) * (1.08 ** freezertiles))
2693 }
2694}
2695
2696treasureopen_onclick(treasureopendoc){
2697 global
2698 ;activates when the open treasure button is clicked.
2699 treasureopendoc := treasureopendoc.Mode
2700 treasuretoopen := treasureopendoc
2701 if (treasureopendoc == "all"){
2702 treasuretoopen := Min(treasurekeys, treasurechests)
2703 }
2704 treasuresopened := "false"
2705 ;loop once for every treasure chest to open
2706 loop, % treasuretoopen{
2707 if(treasurekeys >= 1 && treasurechests >= 1){
2708 if(treasuresopened == "false"){
2709 treasuresinfo := []
2710 ;true when at least one chest has been opened. It resets the description of what happened
2711 treasuresopened := "true"
2712 }
2713 treasurekeys -= 1
2714 treasurechests -= 1
2715 random, powergained, 5000, 10000
2716 random, treasureartifacts, 0, 4
2717 treasureresult := []
2718 loop{
2719 random, whichtreasure, 1, treasurestats.Count()
2720 for, treasureentry, treasurecontent in treasures{
2721 random, whichtreasurechance, 1, 100
2722 if(A_index == whichtreasure){
2723 if(treasurestats[treasureentry]["rarity"] >= whichtreasurechance){
2724 treasureresult.Push(treasureentry)
2725 treasureartifacts -= 1
2726 }
2727 if(0 >= treasureartifacts){
2728 break
2729 }
2730 }
2731 }
2732 if(0 >= treasureartifacts){
2733 break
2734 }
2735
2736 }
2737 if(!treasuresinfo["power"]){
2738 treasuresinfo["power"] := [0, "power"]
2739 }
2740 treasuresinfo["power"][1] += powergained
2741 changepower(powergained)
2742 for each, treasureopencontent in treasureresult{
2743 treasures[treasureopencontent] += 1
2744 if(!treasuresinfo[treasureopencontent]){
2745 treasuresinfo[treasureopencontent] := [0, treasurestats[treasureopencontent]["name"]]
2746 }
2747 treasuresinfo[treasureopencontent][1] += 1
2748 }
2749 }
2750 }
2751 if(treasuresopened == "true"){
2752 ;turns the treasuresinfo string into an actual readable description and changes the description to that text.
2753 if(!stats["chestsopened"]){
2754 stats["chestsopened"] := 0
2755 }
2756 stats["chestsopened"] += treasuretoopen
2757 treasureinfotext := "Last "
2758 if(treasuretoopen > 1){
2759 treasureinfotext .= treasuretoopen . " chests gave"
2760 }
2761 else{
2762 treasureinfotext .= "chest gave"
2763 }
2764 for treasureopenentry, treasureopencontent in treasuresinfo{
2765 treasureinfotext .= "</br>" . treasureopencontent[1] . " " . treasureopencontent[2]
2766 if(treasureopencontent[1] <> 1 && treasureopenentry <> "power"){
2767 treasureinfotext .= "s"
2768 }
2769 }
2770 }
2771 updatemain()
2772}
2773
2774ObjFullyClone(obj){
2775 ;no idea how this works but it solves my problems so.. Yay
2776 nobj := obj.Clone()
2777 for k,v in nobj
2778 if IsObject(v)
2779 nobj[k] := A_ThisFunc.(v)
2780 return nobj
2781}
2782
2783addlog(log, ID:="Default"){
2784 global logs
2785 ;this function adds an extra log to the pile...... Anyways. This stuff is handled in the updatelogs() function
2786 if(!logs[ID]){
2787 logs[ID] := []
2788 }
2789 logs[ID].push(log)
2790}
2791
2792addtooltip(content:="nothingness", timer:=15, identifier:=""){
2793 global tooltips
2794 ;timer goes down by 1 around 5 times every second
2795 loop{
2796 if(!tooltips[A_index]){
2797 tooltips[A_index] := {content:content, timer:timer, identifier:identifier}
2798 break
2799 }
2800 }
2801}
2802
2803;I found this V function on the internet. Its a better way to put the tooltip next to the mouse which doesnt flicker.
2804ToolTipFM(Text="", WhichToolTip=16, xOffset=16, yOffset=16) { ; ToolTip which Follows the Mouse
2805 static LastText, hwnd, VirtualScreenWidth, VirtualScreenHeight ; http://www.autohotkey.com/forum/post-430240.html#430240
2806
2807 if (VirtualScreenWidth = "" or VirtualScreenHeight = "")
2808 {
2809 SysGet, VirtualScreenWidth, 78
2810 SysGet, VirtualScreenHeight, 79
2811 }
2812
2813 if (Text = "") ; destroy tooltip
2814 {
2815 ToolTip,,,, % WhichToolTip
2816 LastText := "", hwnd := ""
2817 return
2818 }
2819 else ; move or recreate tooltip
2820 {
2821 CoordMode, Mouse, Screen
2822 MouseGetPos, x,y
2823 x += xOffset, y += yOffset
2824 WinGetPos,,,w,h, ahk_id %hwnd%
2825
2826 ; if necessary, adjust Tooltip position
2827 if ((x+w) > VirtualScreenWidth)
2828 AdjustX := 1
2829 if ((y+h) > VirtualScreenHeight)
2830 AdjustY := 1
2831
2832 if (AdjustX and AdjustY)
2833 x := x - xOffset*2 - w, y := y - yOffset*2 - h
2834 else if AdjustX
2835 x := VirtualScreenWidth - w
2836 else if AdjustY
2837 y := VirtualScreenHeight - h
2838
2839 if (Text = LastText) ; move tooltip
2840 DllCall("MoveWindow", A_PtrSize ? "UPTR" : "UInt",hwnd,"Int",x,"Int",y,"Int",w,"Int",h,"Int",0)
2841 else ; recreate tooltip
2842 {
2843 ; Perfect solution would be to update tooltip text (TTM_UPDATETIPTEXT), but must be compatible with all versions of AHK_L and AHK Basic.
2844 ; My Ask For Help link: http://www.autohotkey.com/forum/post-421841.html#421841
2845 CoordMode, ToolTip, Screen
2846 ToolTip,,,, % WhichToolTip ; destroy old
2847 ToolTip, % Text, x, y, % WhichToolTip ; show new
2848 hwnd := WinExist("ahk_class tooltips_class32 ahk_pid " DllCall("GetCurrentProcessId")), LastText := Text
2849 %A_ThisFunc%(Text, WhichToolTip, xOffset, yOffset) ; move new
2850 }
2851 Winset, AlwaysOnTop, on, ahk_id %hwnd%
2852 }
2853}
2854
2855removetooltip(identifier:="", all:="false"){
2856 ;remove tooltips based on their identifier. Very versatile
2857 global tooltips
2858 loop{
2859 if(!tooltips[A_index]){
2860 break
2861 }
2862 else if(tooltips[A_index]["identifier"] == identifier || all <> "false"){
2863 tooltips[A_index] := ""
2864 }
2865 }
2866}
2867
2868isnum(number){
2869 ;if (thing) is number is stupid and works really bad with and/or statements so dumped into a function it is.
2870 if number is number
2871 {
2872 return 1
2873 }
2874 return 0
2875}
2876
2877randompointonscreen(){
2878 ;simple
2879 random, X, 0, A_screenwidth
2880 random, Y, 0, A_screenheight
2881 return, [X, Y]
2882}
2883
2884randomletter(){
2885 ;gets a random letter from the alphabet. Used for golden keys
2886 random, rngesus, 1, 26
2887 return % Chr(rngesus+96)
2888}
2889
2890arraytostring(object){
2891 ;turns arrays and objects into strings.
2892 ;very rough example. I haven't tested many things on it like inputting incorrect arrays.
2893 firstrun := 1
2894 firstrun2 := 1
2895 result := object
2896 for entry, content in object{
2897 if(firstrun == 1){
2898 result := "{"
2899 firstrun == 0
2900 }
2901 result .= entry . ":" . arraytostring(content) . ", "
2902 }
2903 for entry, content in object{
2904 if(firstrun2 == 1){
2905 StringTrimright, result, result, 2
2906 result .= "}"
2907 firstrun2 := 0
2908 }
2909 }
2910 if result is not number
2911 if(firstrun2 == 1)
2912 {
2913 result := """" . result . """"
2914 }
2915 return result
2916}
2917
2918stringToArray(String){
2919 ;my experiment of turning strings into objects. Also very rough and will also break on array strings being sent instead of objects.
2920 stringleft, a, string, 1
2921 stringright, b, string, 1
2922 if(a == "{"){
2923 stringtrimleft, string, string, 1
2924 }
2925 if(b == "}"){
2926 stringtrimright, string, string, 1
2927 string .= ","
2928 }
2929 if(a <> "{" && b <> "}"){
2930 return string
2931 }
2932 result := []
2933 storedvalue := ""
2934 bracketcount := 0
2935 plaintext := "false"
2936 part := 1
2937 loop, parse, string
2938 {
2939 if(A_loopfield == """"){
2940 if(plaintext == "false"){
2941 plaintext := "true"
2942 }
2943 else{
2944 plaintext := "false"
2945 }
2946 }
2947 if(plaintext == "false" && bracketcount == 0){
2948 if(A_loopfield == " "){
2949 continue
2950 }
2951 if(A_loopfield == ":" && part == 1){
2952 part := 2
2953 storedpart := storedvalue
2954 storedvalue := ""
2955 continue
2956 }
2957 if(A_loopfield == "," && part == 2){
2958 part := 1
2959 result[storedpart] := stringtoarray(storedvalue)
2960 storedvalue := ""
2961 continue
2962 }
2963 if(A_loopfield == "{"){
2964 bracketcount += 1
2965 storedvalue := ""
2966 }
2967 }
2968 else if(plaintext == "false" && bracketcount > 0){
2969 if(A_loopfield == "{"){
2970 bracketcount += 1
2971 }
2972 if(A_loopfield == "}"){
2973 bracketcount -= 1
2974 }
2975 }
2976 if(A_loopfield <> """" || bracketcount > 0){
2977 dontstore := ""
2978 storedvalue .= A_loopfield
2979 if(A_loopfield == "e"){
2980 }
2981 }
2982 }
2983 if(!IsObject(result) || result.Count() == 0 || result.Count() == ""){
2984 return, storedvalue
2985 }
2986 return, result
2987}
2988
2989fusearrays(object){
2990 result2 := {}
2991 ;another very rought example similar to the arraytostring() and stringtoarray() but this one should work with any kind of array, object or string with no problems.
2992 ;if one object has another object in place another one has an string or number. The object gets priority. Same with numbers over strings. If there's just strings. Only the one of the first plant gets used.
2993 for entry, content in object{
2994 if (IsObject(object[A_index]) || object[A_index].Count() > 0 || selected == "object"){
2995 selected := "object"
2996 }
2997 else if (isnum(object[A_index]) || selected == "number"){
2998 selected := "number"
2999 }
3000 else{
3001 selected := "text"
3002 }
3003 }
3004 for entry, content in object{
3005 storedvalue := A_index
3006 if (selected == "text"){
3007 if(!result){
3008 result := object[storedvalue]
3009 }
3010 }
3011 else if(selected == "number"){
3012 if result is not number
3013 {
3014 result := 0
3015 }
3016 result += object[storedvalue]
3017 }
3018 else if(selected == "object"){
3019 for entry2, content2 in object[storedvalue]{
3020 if(!result){
3021 result := {}
3022 }
3023 if(!result[entry2]){
3024 for entry3, content3 in object{
3025 result2.Push(object[entry3][entry2])
3026 }
3027 result[entry2] := fusearrays(result2)
3028 result2 := {}
3029 }
3030 }
3031 }
3032 }
3033 return result
3034}
3035
3036createamalgamplant(object, fusionstats){
3037 ;the continuation of an already tricky piece of code. The purpose of this function is to fuse multiple plants objects together which thankfully is way easier with the combine arrays function
3038 result := []
3039 result := fusearrays(object)
3040 resultdescription := fusionstats["descr"] . " The combined power of a "
3041 for entry, content in object{
3042 storedrarity := min(storedrarity, content["rarity"])
3043 ;the rarity of the resulting plant is the lowest of all combined plants
3044 morethanzeroplants := "true"
3045 resultdescription .= content["name"] . " and a "
3046 for, entry2, content2 in object[A_index]["harvest"]["direct"]["fusion"]{
3047 ;overwrite any fusion stats this plant has with the highest of a single plant. This is to prevent 2 fusion strength 1 plants to combine into one that has 2 strength which would result in potential infinite fusions
3048 if content2 is number
3049 {
3050 if(!result["harvest"]["direct"]["fusion"][entry2]){
3051 result["harvest"]["direct"]["fusion"][entry2] := 0
3052 }
3053 result["harvest"]["direct"]["fusion"][entry2] := Max(result["harvest"]["direct"]["fusion"][entry2], content2)
3054 }
3055 else if(!result["harvest"]["direct"]["fusion"][entry2]){
3056 result["harvest"]["direct"]["fusion"][entry2] := content2
3057 }
3058 }
3059 }
3060 ;some extra values to add to the plant. Name, descr and weakness don't depend on the fused plants but on the plant used to fuse instead.
3061 ;V create the plant and further build the description if the plant used to fuse targetted anything.
3062 stringtrimright, resultdescription, resultdescription, 7
3063 result["name"] := fusionstats["name"]
3064 result["descr"] := resultdescription
3065 result["weakness"] := fusionstats["strength"]
3066 result["rarity"] := storedrarity
3067 if(fusionstats["background"]){
3068 result["background"] := fusionstats["background"]
3069 }
3070 else{
3071 result.delete("background")
3072 }
3073 if(fusionstats["textcolor"]){
3074 result["textcolor"] := fusionstats["textcolor"]
3075 }
3076 else{
3077 result.delete("textcolor")
3078 }
3079 if(fusionstats["symbol"]){
3080 result["symbol"] := fusionstats["symbol"]
3081 }
3082 else{
3083 result.delete("symbol")
3084 }
3085 stringtrimright, resultdescription, resultdescription, 6
3086 if(!morethanzeroplants){
3087 ;if no plant was used to fuse. Just return nothing.
3088 return
3089 }
3090 return result
3091}
3092
3093HasVal(haystack, needle){
3094 ;check if an array contains a specific word
3095 if !(IsObject(haystack)) || (haystack.Length() == 0){
3096 return 0
3097 }
3098 for index, value in haystack{
3099 if (value = needle){
3100 return index
3101 }
3102 }
3103 return 0
3104}
3105
3106objectminmax(object, minmax){
3107 ;get the highest or lowest number in an entire object (doesnt work on objects inside objects)
3108 switch := 1
3109 if (!IsObject(object) || object.Count() == 0 ||object.Count() == ""){
3110 return object
3111 }
3112 for, a, b in object{
3113 if(isnum(b)){
3114 if(switch){
3115 switch := ""
3116 result := b
3117 }
3118 if(minmax == "min"){
3119 result := min(result, b)
3120 }
3121 else if(minmax == "max"){
3122 result := max(result, b)
3123 }
3124 }
3125 }
3126 return result
3127}
3128
3129VersionCompare(version1, version2){
3130 ;I found and copy/pasted this from somewhere. Checks if your ahk version is higher or lower depending on the one that I made this game in.
3131 ;I have had a couple people telling me that they got errors with lower versions meaning they likely didn't see the message I put up. So any help with that is appreciated
3132 StringSplit, verA, version1, .
3133 StringSplit, verB, version2, .
3134 Loop, % (verA0> verB0 ? verA0 : verB0)
3135 {
3136 if (verA0 < A_Index)
3137 verA%A_Index% := "0"
3138 if (verB0 < A_Index)
3139 verB%A_Index% := "0"
3140 if (verA%A_Index% > verB%A_Index%)
3141 return 1
3142 if (verB%A_Index% > verA%A_Index%)
3143 return 2
3144 }
3145 return 0
3146}
3147
3148fixwindowpos(name){
3149 ;name is case sensitive. Moves windows that are slightly or entirely offscreen. Can be disabled with an checkbox option
3150 GetKeyState, LButtonState, LButton, P
3151 if(LButtonState == "U"){
3152 wingetpos, X, Y, W, H, %name%
3153 if(X + W > A_screenwidth){
3154 WinMove,%name%,, A_screenwidth - W, Y
3155 }
3156 wingetpos, X, Y, W, H, %name%
3157 if(Y + H >= A_screenheight){
3158 WinMove,%name%,, X, A_screenheight - H
3159 }
3160 wingetpos, X, Y, W, H, %name%
3161 if(0 > X){
3162 WinMove,%name%,, 0, Y
3163 }
3164 wingetpos, X, Y, W, H, %name%
3165 if(0 > Y){
3166 WinMove,%name%,, X, 0
3167 }
3168 }
3169}
3170
3171toscientific(input:=0, rounding:=1, donttouchnumberlength:=6){
3172 ;rounding means the amount of numbers the result should have. For example an input of 1000000 and a rounding of 4 should result in 1.000E+6, a rounding of 5 becomes 1.0000E+6
3173 ;I might add different roundings eventually if the demand is high.
3174 numbers := strlen(input)
3175 if(donttouchnumberlength >= numbers){
3176 return input
3177 }
3178 StringLeft, result, input, 1
3179 StringTrimLeft, result2, input, 1
3180 Stringleft, result2, result2, rounding - 1
3181 result .= "." . result2 . "E+" . numbers - 1
3182 return result
3183}
3184
3185devbutton_onclick(){
3186 ;this button does whatever I want it to do.
3187 global
3188 ;addtooltip(plantchance)
3189 ;addtooltip(seeddrops)
3190 ;addtooltip(keyavailable)
3191 ;treasurekeys += 1
3192 ;treasurechests += 1
3193 ;plantknowledge["knowledge"] += 10
3194 ;addtooltip(plantknowledge["knowledge"])
3195 ;power *= 1.5
3196 ;tile2A2["plant"] := {rarity: 100, knowledge:6, descr: "This is a plant that knows a lot about plants. Who knows what info you can extract when you harvest this", name:"knowleaf", symbol:"kl", background:"#55AA88", textcolor:"#FFAAFF", harvest:{harvestpower:100, knowledge:100}}
3197 creategardenplant(100, 2, 2, lockbloom, "aggressive")
3198 if(!keyavailable){
3199 keyavailable := randomletter()
3200 }
3201 updatemain()
3202}
3203
3204changepower(change:=0, subtract:="", changepercent:=100){
3205 global
3206 ;the main reason this function exists is to track the stats when power is increased or decreased
3207 if(!stats["powergained"]){
3208 stats["powergained"] := 0
3209 }
3210 if(!stats["powerspent"]){
3211 stats["powerspent"] := 0
3212 }
3213 if(!subtract){
3214 stats["powergained"] += change
3215 }
3216 else{
3217 stats["powerspent"] += change
3218 }
3219 if(power * (changepercent / 100) > power){
3220 stats["powergained"] += ((power * (changepercent / 100)) - power)
3221 }
3222 if(power > power * (changepercent / 100)){
3223 stats["powerspent"] += ((power * (changepercent / 100)) + power)
3224 }
3225 if(!subtract){
3226 power += change
3227 }
3228 else{
3229 power -= change
3230 }
3231 power *= (changepercent / 100)
3232}
3233
3234;These are all the functions that calculate power gain. Most are the same but some got tiny differences.
3235calculateclickvalue(){
3236 global
3237 ;base
3238 clickpower := 0
3239 ;from upgrades
3240 clickpowerbonus := 0
3241 ;% increase from upgrades
3242 clickpowermult := 1
3243 ;% increase from treasures
3244 treasureclickpowermult := 1 + (treasures["amulets"] / 100)
3245 ;from knowledge points
3246 knowledgeclickpowermult := 1
3247
3248 for a, b in upgrades{
3249 ;loop through all upgrades
3250 clickpowerbonus += %a%["clickpower"] * %a%["purchased"]
3251 if(%a%["clickpowerpercent"] && %a%["purchased"]){
3252 clickpowermult *= (%a%["clickpowerpercent"] * %a%["purchased"] / 100) + 1
3253 }
3254 if(%a%["knowledgepower"] && %a%["purchased"]){
3255 knowledgeclickpowermult *= (%a%["knowledgepower"] * plantknowledge["knowledge"] * %a%["purchased"] / 100) + 1
3256 }
3257 }
3258 clickpower += clickpowerbonus
3259 clickpower += farmclickpower
3260 clickpower *= (farmclickpowerpercent / 100) + 1
3261 clickpower *= clickpowermult
3262 clickpower *= treasureclickpowermult
3263 clickpower *= knowledgeclickpowermult
3264 return round(clickpower)
3265}
3266
3267calculateharvestvalue(plantharvest:=""){
3268 global
3269 ;a plant array or number can be used here to affect power gain. Note that when a plant is input here. It should be combined with the temp and permanent stats to apply those in the harvest
3270 harvestpower := 0
3271 plantharvestpowermult := 0
3272 if plantharvest is number
3273 {
3274 harvestpower := plantharvest
3275 }
3276 for, a, b in plantharvest["harvest"]{
3277 if(a == "harvestpower"){
3278 harvestpower += b
3279 }
3280 if(a == "harvestpowerpercent"){
3281 plantharvestpowermult += b
3282 }
3283 }
3284 harvestpowerbonus := 0
3285 harvestpowermult := 1
3286 treasureharvestmult := 1 + (treasures["emeralds"] / 100)
3287 knowledgeharvestpowermult := 1
3288 for a, b in upgrades{
3289 harvestpowerbonus += %a%["harvestpower"] * %a%["purchased"]
3290 if(%a%["harvestpowerpercent"] && %a%["purchased"]){
3291 harvestpowermult *= (%a%["harvestpowerpercent"] * %a%["purchased"] / 100) + 1
3292 }
3293 if(%a%["knowledgepower"] && %a%["purchased"]){
3294 knowledgeharvestpowermult *= (%a%["knowledgepower"] * plantknowledge["knowledge"] * %a%["purchased"] / 100) + 1
3295 }
3296 }
3297 harvestpower += harvestpowerbonus
3298 harvestpower += farmharvestpower
3299 harvestpower *= (farmharvestpowerpercent / 100) + 1
3300 harvestpower *= (plantharvestpowermult / 100) + 1
3301 harvestpower *= harvestpowermult
3302 harvestpower *= treasureharvestmult
3303 harvestpower *= knowledgeharvestpowermult
3304 return round(harvestpower)
3305}
3306
3307calculateknowledge(plantharvest:=""){
3308 global
3309 knowledge := 0
3310 plantharvestknowledgemult := 0
3311 if plantharvest is number
3312 {
3313 knowledge := plantharvest
3314 }
3315 for, a, b in plantharvest["harvest"]{
3316 if(a == "knowledge"){
3317 knowledge += b
3318 }
3319 if(a == "knowledgepercent"){
3320 plantharvestknowledgemult += b
3321 }
3322 }
3323 knowledgebonus := 0
3324 knowledgemult := 1
3325 treasureknowledgemult := 1
3326 for a, b in upgrades{
3327 knowledgebonus += %a%["knowledge"] * %a%["purchased"]
3328 if(%a%["knowledgepercent"] && %a%["purchased"]){
3329 knowledgemult *= (%a%["knowledgepercent"] * %a%["purchased"] / 100) + 1
3330 }
3331 }
3332 knowledge += knowledgebonus
3333 knowledge += farmknowledge
3334 knowledge *= (farmknowledgepercent / 100) + 1
3335 knowledge *= (plantharvestknowledgemult / 100) + 1
3336 knowledge *= knowledgemult
3337 knowledge *= treasureknowledgemult
3338 return round(knowledge)
3339}
3340
3341calculatemovevalue(){
3342 global
3343 movepower := 0
3344 movepowerbonus := 0
3345 movepowermult := 1
3346 treasuremovepowermult := 1 + (treasures["rings"] / 100)
3347 knowledgemovepowermult := 1
3348 for a, b in upgrades{
3349 movepowerbonus += %a%["movepower"] * %a%["purchased"]
3350 if(%a%["movepowerpercent"] && %a%["purchased"]){
3351 movepowermult *= (%a%["movepowerpercent"] * %a%["purchased"] / 100) + 1
3352 }
3353 if(%a%["knowledgepower"] && %a%["purchased"]){
3354 knowledgemovepowermult *= (%a%["knowledgepower"] * plantknowledge["knowledge"] * %a%["purchased"] / 100) + 1
3355 }
3356 }
3357 movepower += movepowerbonus
3358 movepower += farmmovepower
3359 movepower *= (farmmovepowerpercent / 100) + 1
3360 movepower *= treasuremovepowermult
3361 movepower *= movepowermult
3362 movepower *= knowledgemovepowermult
3363 if(mousemastery["purchased"] >= 1){
3364 movepower += calculateclickvalue()
3365 }
3366 return round(movepower)
3367}
3368
3369calculatemovespeed(){
3370 global
3371 movespeed := 0
3372 movespeedbonus := 0
3373 movespeedmult := 1
3374 treasuremovespeedmult := 1 + (treasures["pearls"] / 100)
3375 for a, b in upgrades{
3376 movespeedbonus += %a%["movespeed"] * %a%["purchased"]
3377 if(%a%["movespeedpercent"] && %a%["purchased"]){
3378 movespeedmult *= (%a%["movespeedpercent"] * %a%["purchased"] / 100) + 1
3379 }
3380 }
3381 movespeed += movespeedbonus
3382 movespeed += farmmovespeed
3383 movespeed *= (farmmovespeedpercent / 100) + 1
3384 movespeed *= treasuremovespeedmult
3385 movespeed *= movespeedmult
3386 return round(movespeed)
3387}
3388
3389calculatemovespeedtopowervalue(movespeedtopower:=0){
3390 global
3391 ;super OP and rightfully unused right now
3392 movespeedtopowerbonus := 0
3393 movespeedtopowermult := 1
3394 treasuremovespeedtopowermult := 1
3395 knowledgemovespeedtopowermult := 1
3396 for a, b in upgrades{
3397 movespeedtopowerbonus += %a%["movespeedtopower"] * %a%["purchased"]
3398 if(%a%["movespeedtopowerpercent"] && %a%["purchased"]){
3399 movespeedtopowermult *= (%a%["movespeedtopowerpercent"] * %a%["purchased"] / 100) + 1
3400 }
3401 if(%a%["knowledgepower"] && %a%["purchased"]){
3402 knowledgemovespeedtopowermult *= (%a%["knowledgepower"] * plantknowledge["knowledge"] * %a%["purchased"] / 100) + 1
3403 }
3404 }
3405 movespeedtopower += movespeedtopowerbonus
3406 movespeedtopower += farmmovespeedtopower
3407 movespeedtopower *= (farmmovespeedtopowerpercent / 100) + 1
3408 movespeedtopower *= treasuremovespeedtopowermult
3409 movespeedtopower *= movespeedtopowermult
3410 movespeedtopower *= knowledgemovespeedtopowermult
3411 return round(movespeedtopower)
3412}
3413
3414calculatekeyboardkeyvalue(key:=""){
3415 global
3416 keyboardkeypower := 0
3417 keyboardkeypowerbonus := 0
3418 keyboardkeypowermult := 1
3419 treasurekeyboardkeymult := 1 + (treasures["grails"] / 100)
3420 knowledgekeyboardkeymult := 1
3421 for a, b in upgrades{
3422 keyboardkeypowerbonus += %a%["keyboardkeypower"] * %a%["purchased"]
3423 if(%a%["keyboardkeypowerpercent"] && %a%["purchased"]){
3424 keyboardkeypowermult *= (%a%["keyboardkeypowerpercent"] * %a%["purchased"] / 100) + 1
3425 }
3426 if(%a%["knowledgepower"] && %a%["purchased"]){
3427 knowledgekeyboardkeymult *= (%a%["knowledgepower"] * plantknowledge["knowledge"] * %a%["purchased"] / 100) + 1
3428 }
3429 }
3430 keyboardkeypower += keyboardkeypowerbonus
3431 keyboardkeypower += farmkeyboardkeypower
3432 if(gamersfuel["purchased"] >= 1){
3433 if(key = "~W up" || key = "~A up" || key = "~S up" || key = "~D up" ||){
3434 ;turns out gaming is a good way to earn money (power) afterall
3435 keyboardkeypower *= 2
3436 }
3437 }
3438 keyboardkeypower *= (farmkeyboardkeypowerpercent / 100) + 1
3439 keyboardkeypower *= treasurekeyboardkeymult
3440 keyboardkeypower *= keyboardkeypowermult
3441 keyboardkeypower *= knowledgekeyboardkeymult
3442 return round(keyboardkeypower)
3443}
3444
3445calculateshopprice(object){
3446 price := object["price"]
3447 if(object["priceincrease"]){
3448 price += (object["priceincrease"] * object["purchased"])
3449 }
3450 if(object["priceincreasepercent"]){
3451 price *= ((1 + (object["priceincreasepercent"] / 100)) ** object["purchased"])
3452 }
3453 return price
3454}
3455
3456getchests(){
3457 chestchance := 30
3458 random, chestodds, 1, 100
3459 if(chestchance >= chestodds){
3460 return 1
3461 }
3462 else{
3463 return 0
3464 }
3465}
3466
3467getkeys(){
3468 keychance := 30
3469 random, keyodds, 1, 100
3470 if(keychance >= keyodds){
3471 return 1
3472 }
3473 else{
3474 return 0
3475 }
3476}
3477
3478savegame_onclick(){
3479 global
3480 critical, on
3481 if(lastsave){
3482 gui, backgroundpower:default
3483 gui, hide
3484 }
3485 autosavewait := A_tickcount + autosavewaitvalue
3486 iniwrite, % power, %savename%, values, power
3487 iniwrite, % gardentiles, %savename%, values, gardentiles
3488 iniwrite, % freezertiles, %savename%, values, freezertiles
3489 iniwrite, % treasurekeys, %savename%, values, treasurekeys
3490 iniwrite, % treasurechests, %savename%, values, treasurechests
3491 iniwrite, % treasureradarbought, %savename%, values, treasureradarbought
3492 iniwrite, % currentversion, %savename%, values, version
3493 iniwrite, % almanacunlocked, %savename%, garden, almanacunlocked
3494 iniwrite, % arraytostring(treasures), %savename%, treasures, treasures
3495 for savegameindex, savegamecontent in upgrades{
3496 for savegameindex2, savegamecontent2 in upgrades[savegameindex]{
3497 upgrades[savegameindex][savegameindex2] := %savegameindex%[savegameindex2]
3498 }
3499 }
3500 iniwrite, % arraytostring(upgrades), %savename%, upgrades, upgrades
3501 iniwrite, % arraytostring(plantknowledge), %savename%, garden, plantknowledge
3502 iniwrite, % arraytostring(optionchecks), %savename%, options, optionchecks
3503 iniwrite, % arraytostring(stats), %savename%, values, stats
3504 ;saving garden tiles can get pretty long at times if there's many unlocked tiles
3505 loop, % gardentiles{
3506 SaveX := mod(A_index, 10)
3507 SaveY := ceil(A_index / 10)
3508 if(SaveX == 0){
3509 SaveX = 10
3510 }
3511 savevalue := {plant:tile%SaveX%A%SaveY%["plant"], permanent:tile%SaveX%A%SaveY%["permanent"]}
3512 savevalue := arraytostring(savevalue)
3513 IniWrite, % savevalue, %savename%, garden, tile%SaveX%A%SaveY%
3514 }
3515 loop, % freezertiles{
3516 SaveX := mod(A_index, 10)
3517 SaveY := ceil(A_index / 10)
3518 if(SaveX == 0){
3519 SaveX = 10
3520 }
3521 savevalue := {plant:freezertile%SaveX%A%SaveY%["plant"]}
3522 savevalue := arraytostring(savevalue)
3523 IniWrite, % savevalue, %savename%, garden, freezertile%SaveX%A%SaveY%
3524 }
3525 addlog("saved the game", "general")
3526 critical, off
3527}
3528
3529exit_onclick(){
3530 global
3531 lastsave := 1
3532 exitapp
3533}
3534
3535BackgroundpowerGuiClose:
3536lastsave := 1
3537exitapp
3538return
3539
3540~F11::
3541if(F11reset == "true"){
3542 savegame_onclick()
3543 Reload
3544}
3545return
3546
3547;changelog: v1.30
3548;Changed the layout of the entire game. All menus are now combined. Also changed the visuals of everything. I hope it looks good
3549;added autoclick prevention.... Don't worry however because its an option you can turn on to disable power gain from clicking when clicking really fast.
3550;The garden and the shop now show their info in a tooltip instead of in the menu itself
3551;Garden plant spawn rate reduced
3552;Garden plants now spawn with their own background and text color.
3553;added protect feature to the garden to prevent accidentally harvesting plants
3554;Added a new feature. Keyboard keys. Its the simpler version of hidden keys that works on any keyboard key and once every second
3555;Talking about hidden keys. The feature has been renamed to golden keys
3556;Added a new feature. Almanac. This replaces the old garden knowledge system and gives more info about plants.
3557;due to the old knowledge system being removed, everyone gains 2 knowledge points for every revealed recipe they had
3558;added 4 new plants to help knowledge harvesting including a rather powerful one.
3559;added a couple other plants as well and changed many plant names, descriptions, stats etc. Early obtainable plants are also a bit more powerful and every plant is harvested for more power
3560;Reworked the radar. Instead of 2 dots it now shows 1 dot which changes shapes when you get near a hidden treasure
3561;saying the word garden one more time (I will start working on other features soon.)
3562;Added some new upgrades
3563
3564
3565;here are all future ideas listed for the game that I hope to implement some day.
3566
3567;Ascension system with a new resource: Mana. Mana is gained from varying sources like upgrades or garden plants. (garden plants need to be alive and not harvest to get their mana)
3568;Ascension destroys most things and ascends your character into a deity. Allowing you to spend your mana on a skill tree to buff further progression.
3569;Future playthrough players would be able to build a statue to your previous character as a deity for example which would yield various buffs
3570
3571;Bloobs, Floobs are pets that you can breed and train (sorta). Bloobs have various benefits that can be utilized when they are equipped. 1 can be equipped by default but some ways unlock more slots.
3572;Bloobs can breed when put in a queen and king slot (they dont buff your stats in there). Over time they create new bloops with stats based on the current bloob with around an equal chance of increasing or decreasing the stats
3573;Bloobs have a stat cap which they will quickly reach. Once all stats are maxed, a bloob can be ascended and be reset back but their max stat caps will be increased
3574
3575;I have started working on this feature V
3576;A dungeon crawler feature controlled by the arrow/wasd keys. A character moves through a dungeon based on your input and encounters treasures, blockades and enemies.
3577;The player enters stairs automatically upon entering and the stairs are always near a wall. Enemies trap you when walking on them and pressing a arroy/wasd key starts attacking it.
3578;I'm not sure if I want to introduce a health system or just want the character to be invurnerable with progress limited by time.
3579;Deeper floors give better rewards of course
3580;The character gets various buffs from other features, like bloobs or plants.
3581;The theme of the dungeon is reptiles. Almost every enemy is some sort of lizard or snake. This doesn't mean there wont be a wide variety of enemies.
3582;Locked doors which are enemies that have large amounts of health but are insta-killed when a golden key is collected during combat.
3583;hidden doors which are the same thing but finding a hidden treasure kills them instead
3584
3585;Maybe a safe cracking minigame played with the number keys. Eventually pressing enough buttons will open the safe and grant rewards.
3586
3587;Garden rework (again). I'm not entirely sure what I want the garden to be. But right now my mind goes something like this.
3588;Fully remove random plant spawns. Seeds for plants can be bought and mystery seeds can be planted to attempt breeding pairs.
3589;Special enchants on tile allow random plant spawns
3590;Plant managing. Plants that move other plants around or auto-harvest them (this does not break the no-idle rule as plants only appear/grow/move/harvest when the mouse moves)
3591;A growth system. Plants are less efficient when they are not fully grown and many powerful effects only work when the plant is grown 100% (note: making an amalgam plant combines the growth times for both plants so it may take long to grow at times)
3592;extra reasons to use the knowledge system. More knowledge can be invested in completed plants for increased 'mana' gain
3593;Rework the breeding system. Instead of requiring plants nearby. Plants require certain stats to be met. For example one plant could need the 8 plants around it to have a combined total of 10 clickpower before it grows there.