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