January 20, 2021, 01:01:16 PM

Author Topic: [bb] Plants VS Zombies Zen Garden Editor by Streaksy [ 1+ years ago ]  (Read 762 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
Title : Plants VS Zombies Zen Garden Editor
Author : Streaksy
Posted : 1+ years ago

Description : This edits the most recently added plant to the zen garden.  It allows you to get some plants that you're not supposed to be able to.  You can change pretty much everything about a plant, even what direction it's facing.

Make sure you quit the game before you run this otherwise changes will be reverted when the game does quit.  You can just by a Marigold and make it into whatever you want.  If you want to populate your zen garden quickly, you can buy a marigold, edit it with this, and when youve bought all 3 available marigolds, change your computers date settings (into anything else) and you'll be able to buy another marigold.

I don't have PvZ anymore so I can't quickly test this, sorry.  But it should be fine.  Also, I haven't ran through the code.  I don't know how rough it is (or if there are any obscenities :P) but I've had this a long time and thought I should share.

Oh, and unless you open it with a specific user file, it will edit the save of the first PvZ user account.


Code :
Code: BlitzBasic
  1. Graphics 410,468,32,2
  2. AppTitle "Zen Garden Editor"
  3. Global Typ=1
  4. Global Garden=0
  5. Global Column=0
  6. Global Row=0 ;3
  7. Global Direction=0
  8. Global F=0
  9. Global G=0 ;time stuff?
  10. Global H=0 ;time stuff
  11. Global Colour=0 ;2
  12. Global Growth=0
  13. Global Watered=0
  14. Global WateredTarget=4
  15. Global Require=0
  16. Global N=0
  17. Global O=0 ;time stuff?
  18. Global P=0 ;time stuff?
  19. Global Q=0
  20. Global R=0
  21. Global S=0
  22. Global T=0
  23. Global U=0
  24. Global V=0
  25.  
  26. Dim TypName$(255)
  27. TypName$(0)="Peashooter"
  28. TypName$(1)="Sunflower"
  29. TypName$(2)="Cherry Bomb"
  30. TypName$(3)="Wall-Nut"
  31. TypName$(4)="Potato Mine"
  32. TypName$(5)="Show Pea"
  33. TypName$(6)="Chomper"
  34. TypName$(7)="Repeater"
  35. TypName$(8)="Puff-Shroom"
  36. TypName$(9)="Sun-Shroom"
  37. TypName$(10)="Fume-Shroom"
  38. TypName$(11)="Grave Buster"
  39. TypName$(12)="Hypno-Shroom"
  40. TypName$(13)="Scaredy-Shroom"
  41. TypName$(14)="Ice-Shroom"
  42. TypName$(15)="Doom-Shroom"
  43. TypName$(16)="Lily Pad"
  44. TypName$(17)="Squash"
  45. TypName$(18)="Threepeater"
  46. TypName$(19)="Tangle Kelp"
  47. TypName$(20)="Jalapeno"
  48. TypName$(21)="Spikeweed"
  49. TypName$(22)="Torchwood"
  50. TypName$(23)="Tall-Nut"
  51. TypName$(24)="Sea-Shroom"
  52. TypName$(25)="Plantern"
  53. TypName$(26)="Cactus"
  54. TypName$(27)="Blover"
  55. TypName$(28)="Split Pea"
  56. TypName$(29)="Starfruit"
  57. TypName$(30)="Pumpkin"
  58. TypName$(31)="Magnet-Shroom"
  59. TypName$(32)="Cabbage-Pult"
  60. TypName$(33)="Flower Pot"
  61. TypName$(34)="Kernel-Pult"
  62. TypName$(35)="Coffee Bean"
  63. TypName$(36)="Garlic"
  64. TypName$(37)="Umbrella Leaf"
  65. TypName$(38)="Marigold"
  66. TypName$(39)="Melon-Pult"
  67.  
  68. TypName$(40)="Gatling Pea"
  69. TypName$(41)="Twin Sunflower"
  70. TypName$(42)="Gloom-Shroom"
  71. TypName$(43)="Cattail"
  72. TypName$(44)="Winter Melon"
  73. TypName$(45)="Gold Magnet"
  74. TypName$(46)="Spikerock"
  75. TypName$(47)="Cob Cannon"
  76. TypName$(48)="Imitater"
  77.  
  78. TypName$(49)="Explode-o-Nut"
  79. TypName$(50)="Giant Wall-Nut"
  80. TypName$(51)="Sprout"
  81. TypName$(52)="Reverse Repeater"
  82.  
  83. Dim GardenName$(4)
  84. GardenName$(0)="Daytime Garden"
  85. GardenName$(1)="Mushroom Garden";"Nighttime Garden"
  86. GardenName$(2)="Wheelbarrow"
  87. GardenName$(3)="Water Garden"
  88.  
  89. Global stages=4
  90. Dim stagename$(stages)
  91. StageName(1)="Sprout"
  92. StageName(2)="Small"
  93. StageName(3)="Medium"
  94. StageName(4)="Mature"
  95.  
  96. Global Cols=13
  97. Dim ColName$(255)
  98. colname(1)="White"
  99. colname(2)="Imitated (Low Saturation)"
  100. colname(3)="White"
  101. colname(4)="Magenta"
  102. colname(5)="Orange"
  103. colname(6)="Pink"
  104. colname(7)="Cyan" ;sky blue?
  105. colname(8)="Red"
  106. colname(9)="Blue"
  107. colname(10)="Purple"
  108. colname(11)="Pale Pink"
  109. colname(12)="Yellow"
  110. colname(13)="Pale Green"
  111. colname(14)="White"
  112. colname(15)="White"
  113. colname(16)="White"
  114. colname(17)=""
  115. colname(18)=""
  116. colname(19)=""
  117. colname(20)=""
  118. colname(21)=""
  119. colname(22)=""
  120. colname(23)=""
  121. colname(24)=""
  122. colname(25)=""
  123. colname(26)=""
  124. colname(27)=""
  125. colname(28)=""
  126. colname(29)=""
  127. colname(30)=""
  128. colname(31)=""
  129. colname(32)=""
  130. colname(33)=""
  131. colname(34)=""
  132. colname(35)=""
  133. colname(36)=""
  134.  
  135.  
  136.  
  137. Dim PColName$(255)
  138. pcolname(1)="Normal"
  139. pcolname(2)="Imitated (Low Saturation)"
  140. pcolname(3)="Normal"
  141. pcolname(4)="Red with magenta eyes"
  142. pcolname(5)="Orange"
  143. pcolname(6)="Orange with pink eyes"
  144. pcolname(7)="Green with teal eyes"
  145. pcolname(8)="Red"
  146. pcolname(9)="Dark green with blue eyes"
  147. pcolname(10)="Red with purple eyes"
  148. pcolname(11)="Normal with pale pink eyes"
  149. pcolname(12)="Normal with yellow eyes"
  150. pcolname(13)="Mossy green"
  151.  
  152.  
  153.  
  154. fn$="C:ProgramDataPopCap GamesPlantsVsZombiesuserdatauser3.dat"
  155.  
  156.  
  157. cm$=CommandLine$()
  158. If cm="" Then cm$=Chr(34)+"C:ProgramDataPopCap GamesPlantsVsZombiesuserdatauser1.dat"+Chr(34)
  159.  
  160. If Len(cm)<2 Then RuntimeError "Open with a userfile!"
  161. cm=Left(cm,Len(cm)-1)
  162. cm=Right(cm,Len(cm)-1)
  163. fn=cm
  164.  
  165. If Lower(Right(fn,4))<>".dat" Then RuntimeError "Wrong file!  Open with a userdatauser#.dat file!"
  166.  
  167. For t=Len(fn) To 1 Step -1
  168. If Mid(fn,t,1)="" Then stat=t+1:Exit
  169. Next
  170. If stat=0 Then RuntimeError "Wierd filename..."
  171.  
  172. If Lower(Mid(fn,stat,4))<>"user" Then RuntimeError "Wrong file!  Open with a userdatauser#.dat file!"
  173.  
  174.  
  175. siz=FileSize(fn)
  176. fil=OpenFile(fn)
  177. If fil=0 Then RuntimeError "Couldn't open "+fn
  178. If siz=0 Then RuntimeError "Size error"
  179.  
  180.  
  181.  
  182. SeekFile fil,(siz-88)+(4*11):wateredtarget=ReadByte(fil):SeekFile fil,FilePos(fil)-1
  183. If wateredtarget=0 Or wateredtarget>8 Then RuntimeError "Add a new plant to the Zen Garden and try again!  Make sure you do nothing else after aquiring a new plant!"
  184.  
  185.  
  186. API_ShowWindow(SystemProperty("AppHWND"),5)
  187.  
  188.  
  189. .restart
  190. SeekFile fil,siz-88
  191. Cls:Locate 0,0
  192. Print "MOST RECENTLY AQUIRED PLANT:"
  193. Print ""
  194.  
  195. Typ=ReadByte(fil):SeekFile fil,FilePos(fil)-1
  196. Print "(P) Plant: "+typname(typ)
  197. ;Nxt=0:WriteByte fil,nxt:Print "Now it is "+nxt+" ("+typname(nxt)+")"
  198.  
  199. SeekFile fil,(siz-88)+(4*1):Garden=ReadByte(fil):SeekFile fil,FilePos(fil)-1
  200. Print "(L) Location: "+gardenname(garden)
  201.  
  202. SeekFile fil,(siz-88)+(4*2):Column=ReadByte(fil):SeekFile fil,FilePos(fil)-1
  203. SeekFile fil,(siz-88)+(4*3):Row=ReadByte(fil):SeekFile fil,FilePos(fil)-1
  204. If Garden=0 Then Print "(S) Slot: x"+(column+1)+" y"+(row+1)+""
  205. If Garden>0 And garden<>2 Then Print "(S) Slot: "+(column+1)
  206.  
  207. SeekFile fil,(siz-88)+(4*4):Direction=ReadByte(fil):SeekFile fil,FilePos(fil)-1
  208. If Direction=0 Then Print "(F) Facing: Right (Normal)" Else Print "(F) Facing: Left (Flipped)"
  209. SeekFile fil,(siz-88)+(4*8):colour=ReadByte(fil):SeekFile fil,FilePos(fil)-1
  210. If typ<>23 Then Print "(C) Colour: "+colname(colour+1)
  211. If typ=23 Then Print "(C) Colour: "+pcolname(colour+1)
  212. SeekFile fil,(siz-88)+(4*9):growth=ReadByte(fil):SeekFile fil,FilePos(fil)-1
  213. Print "(G) Growth Stage: "+stagename(growth+1)
  214. SeekFile fil,(siz-88)+(4*10):watered=ReadByte(fil):SeekFile fil,FilePos(fil)-1
  215. SeekFile fil,(siz-88)+(4*11):wateredtarget=ReadByte(fil):SeekFile fil,FilePos(fil)-1
  216. Print "(W) Times Watered: "+watered+"/"+(wateredtarget+1)
  217. ;SeekFile fil,(siz-88)+(4*12):require=ReadByte(fil):SeekFile fil,FilePos(fil)-1
  218. ;If require=0 Then Print "(R) Next Growth Requirement: Fertiliser"
  219. ;If require=3 Then Print "(R) Next Growth Requirement: Bug Spray"
  220. ;If require=4 Then Print "(R) Next Growth Requirement: Gramophone"
  221.  
  222. FlushKeys
  223. Print ""
  224. i$=Upper(Input("Enter a letter or leave black to exit: "))
  225. If i="" Then End
  226.  
  227.  
  228.  
  229.  
  230. If i="P" Then
  231. Cls:Locate 0,0
  232. Print "SELECT A PLANT:":Print""
  233. For t=1 To 52
  234. If t=>26 Then Locate 200,28+((t-26)*12)
  235. Print t+": "+typname(t)
  236. Next
  237. Print ""
  238. i$=Input("Enter a number or leave black to cancel: ")
  239. If i<>"" Then
  240. ii=Int(i)
  241. If ii<0 Or ii>52 Then Print "Invalid number!  Press a key to continue.":WaitKey
  242. typ=ii
  243. SeekFile fil,siz-88
  244. WriteByte fil,typ
  245. EndIf
  246. EndIf
  247.  
  248.  
  249. If i="L" Then
  250. Cls:Locate 0,0
  251. Print "SELECT A LOCATION:":Print""
  252. Print ""
  253. Print "(D) Daytime Garden"
  254. Print "(M) Mushroom Garden"
  255. Print "(W) Water Garden"
  256. Print "(B) Wheelbarrow"
  257. Print ""
  258. i$=Upper(Input("Enter a letter or leave black to cancel: "))
  259. If i<>"" Then
  260. If i="D" Then garden=0
  261. If i="M" Then garden=1
  262. If i="W" Then garden=3
  263. If i="B" Then garden=2
  264. SeekFile fil,(siz-88)+(4*1)
  265. WriteByte fil,garden
  266. EndIf
  267. EndIf
  268.  
  269.  
  270. If i="S" Then
  271. Cls:Locate 0,0
  272. Print "SELECT A SLOT:":Print""
  273. Print ""
  274. iii=Int(Input("Enter a column (1-8): "))-1
  275. If iii<0 Or iii>7 Then Print "Out of range!  Press a key to continue.":WaitKey:Goto restart Else column=iii
  276.         If garden=0 Then
  277.         iii=Int(Input("Enter a row (1-4): "))-1
  278.         If iii<0 Or iii>3 Then Print "Out of range!  Press a key to continue.":WaitKey:Goto restart Else row=iii
  279.         EndIf
  280. SeekFile fil,(siz-88)+(4*2)
  281. WriteByte fil,column
  282. SeekFile fil,(siz-88)+(4*3)
  283. WriteByte fil,row
  284. EndIf
  285.  
  286. If i="F" Then
  287. Direction=Direction+1:If Direction>1 Then Direction=0
  288. SeekFile fil,(siz-88)+(4*4)
  289. WriteByte fil,direction
  290. EndIf
  291.  
  292.  
  293. If i="C" Then
  294. Cls:Locate 0,0
  295. Print "SELECT A COLOUR:":Print""
  296. Print ""
  297. Print " NOTE: Colour only seems to affect Marigolds and"
  298. Print " Tall-Nuts, except for the `Imitated' colour which"
  299. Print " seems to work for everything."
  300. Print ""
  301. For t=1 To cols
  302. If typ<>23 Then Print t+": "+colname(t)
  303. If typ=23 Then Print t+": "+pcolname(t)
  304. Next
  305. Print ""
  306. iii=Int(Input("Enter a colour code (1-?): "))-1
  307. If iii<0 Or iii>255 Then Print "Out of range!  Press a key to continue.":WaitKey:Goto restart Else colour=iii
  308. SeekFile fil,(siz-88)+(4*8)
  309. WriteByte fil,colour
  310. EndIf
  311.  
  312.  
  313.  
  314. If i="G" Then
  315. Cls:Locate 0,0
  316. Print "SELECT A GROWTH STAGE:":Print""
  317. Print ""
  318. For t=1 To stages
  319. Print t+": "+stagename(t)
  320. Next
  321. Print ""
  322. iii=Int(Input("Enter a number: "))-1
  323. If iii<0 Or iii>3 Then Print "Out of range!  Press a key to continue.":WaitKey:Goto restart Else growth=iii
  324. SeekFile fil,(siz-88)+(4*9)
  325. WriteByte fil,growth
  326. EndIf
  327.  
  328.  
  329. If i="W" Then
  330. Cls:Locate 0,0
  331. Print "SELECT WATERING SETTINGS:":Print""
  332. Print ""
  333. iii=Int(Input("How many drinks does the plant require? (1-8): "))-1
  334. If iii<0 Or iii>7 Then Print "Out of range!  Press a key to continue.":WaitKey:Goto restart Else wateredtarget=iii
  335. iii=Int(Input("How many drinks has it had so far? (0-"+(wateredtarget+1)+"): "))
  336. If iii<0 Or iii>(wateredtarget+1) Then Print "Out of range!  Press a key to continue.":WaitKey:Goto restart Else watered=iii
  337. SeekFile fil,(siz-88)+(4*10)
  338. WriteByte fil,watered
  339. SeekFile fil,(siz-88)+(4*11)
  340. WriteByte fil,wateredtarget
  341. EndIf
  342.  
  343.  
  344.  
  345. Goto restart
  346. CloseFile fil
  347. Print ""
  348. Print "Press a key to exit."
  349. WaitKey
  350. End


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal