Advertisement
Lucidious89

Debug_Menu Update

Jul 21st, 2019
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.54 KB | None | 0 0
  1. class CommandMenuList
  2. attr_accessor :currentList
  3.  
  4. def initialize
  5. @commands = []
  6. @currentList = "main"
  7. end
  8.  
  9. def add(parent,cmd,name,desc=nil)
  10. @commands.push([parent,cmd,name,desc])
  11. end
  12.  
  13. def list
  14. ret = []
  15. for i in @commands
  16. ret.push(i[2]) if i[0]==@currentList
  17. end
  18. return ret
  19. end
  20.  
  21. def getCommand(index)
  22. count = 0
  23. for i in @commands
  24. if i[0]==@currentList
  25. return i[1] if count==index
  26. count += 1
  27. end
  28. end
  29. return nil
  30. end
  31.  
  32. def getDesc(index)
  33. count = 0
  34. for i in @commands
  35. if i[0]==@currentList
  36. return i[3] if count==index && i[3]
  37. count += 1
  38. end
  39. end
  40. return "<No description available>"
  41. end
  42.  
  43. def hasSubMenu?(cmd)
  44. for i in @commands
  45. return true if i[0]==cmd
  46. end
  47. return false
  48. end
  49.  
  50. def getParent
  51. ret = nil
  52. for i in @commands
  53. if i[1]==@currentList
  54. ret = i[0]; break
  55. end
  56. end
  57. if ret
  58. count = 0
  59. for i in @commands
  60. if i[0]==ret
  61. return [ret,count] if i[1]==@currentList
  62. count += 1
  63. end
  64. end
  65. return [ret,0]
  66. end
  67. return nil
  68. end
  69. end
  70.  
  71.  
  72. def pbDebugMenuCommands(showall=true)
  73. commands = CommandMenuList.new
  74. if showall
  75. commands.add("main","fieldmenu",_INTL("Field options..."),
  76. _INTL("Warp to maps, edit switches/variables, use the PC, edit Day Care, etc."))
  77. commands.add("fieldmenu","warp",_INTL("Warp to Map"),
  78. _INTL("Instantly warp to another map of your choice."))
  79. # - Optional coordinates
  80. commands.add("fieldmenu","refreshmap",_INTL("Refresh Map"),
  81. _INTL("Make all events on this map, and common events, refresh themselves."))
  82. commands.add("fieldmenu","switches",_INTL("Switches"),
  83. _INTL("Edit all Game Switches (except Script Switches)."))
  84. commands.add("fieldmenu","variables",_INTL("Variables"),
  85. _INTL("Edit all Game Variables. Can set them to numbers or text."))
  86. commands.add("fieldmenu","usepc",_INTL("Use PC"),
  87. _INTL("Use a PC to access Pokémon storage and player's PC."))
  88. commands.add("fieldmenu","togglewallpapers",_INTL("Toggle Storage Wallpapers"),
  89. _INTL("Unlock and lock special wallpapers used in Pokémon storage."))
  90. commands.add("fieldmenu","daycare",_INTL("Day Care"),
  91. _INTL("View Pokémon in the Day Care and edit them."))
  92. commands.add("fieldmenu","relicstone",_INTL("Use Relic Stone"),
  93. _INTL("Shadow Pokémon. Choose a Pokémon to show to the Relic Stone for purification."))
  94. commands.add("fieldmenu","purifychamber",_INTL("Use Purify Chamber"),
  95. _INTL("Shadow Pokémon. Open the Purify Chamber for purification."))
  96.  
  97. commands.add("main","battlemenu",_INTL("Battle options..."),
  98. _INTL("Start battles, reset this map's trainers, ready rematches, edit roamers, etc."))
  99. commands.add("battlemenu","testwildbattle",_INTL("Test Wild Battle"),
  100. _INTL("Start a battle against a wild Pokémon. You choose the species and level."))
  101. commands.add("battlemenu","testdoublewildbattle",_INTL("Test Double Wild Battle"),
  102. _INTL("Start a battle against two wild Pokémon. You choose the species and levels."))
  103. commands.add("battlemenu","testtrainerbattle",_INTL("Test Trainer Battle"),
  104. _INTL("Start a battle against a defined trainer. You choose which trainer."))
  105. commands.add("battlemenu","testdoubletrainerbattle",_INTL("Test Double Trainer Battle"),
  106. _INTL("Start a battle against two defined trainers. You choose which trainers."))
  107. commands.add("battlemenu","togglelogging",_INTL("Toggle Battle Logging"),
  108. _INTL("Record debug logs for battles in Data/debuglog.txt."))
  109. commands.add("battlemenu","resettrainers",_INTL("Reset Map's Trainers"),
  110. _INTL("Turn off Self Switches A and B for all events with \"Trainer\" in their name."))
  111. commands.add("battlemenu","readyrematches",_INTL("Ready All Phone Rematches"),
  112. _INTL("Make all trainers in the phone ready for rematches."))
  113. commands.add("battlemenu","roamers",_INTL("Roaming Pokémon"),
  114. _INTL("Toggle and edit all roaming Pokémon."))
  115.  
  116. commands.add("main","itemsmenu",_INTL("Item options..."),
  117. _INTL("Give and take items."))
  118. commands.add("itemsmenu","additem",_INTL("Add Item"),
  119. _INTL("Choose an item and a quantity of it to add to the Bag."))
  120. commands.add("itemsmenu","fillbag",_INTL("Fill Bag"),
  121. _INTL("Add a certain number of every item to the Bag."))
  122. commands.add("itemsmenu","emptybag",_INTL("Empty Bag"),
  123. _INTL("Remove all items from the Bag."))
  124.  
  125. commands.add("main","pokemonmenu",_INTL("Pokémon options..."),
  126. _INTL("Give Pokémon, heal party, fill/empty PC storage, etc."))
  127. commands.add("pokemonmenu","addpokemon",_INTL("Add Pokémon"),
  128. _INTL("Give yourself a Pokémon of a chosen species/level. Goes to PC if party is full."))
  129. commands.add("pokemonmenu","demoparty",_INTL("Give Demo Party"),
  130. _INTL("Give yourself 6 preset Pokémon. They overwrite the current party."))
  131. commands.add("pokemonmenu","healparty",_INTL("Heal Party"),
  132. _INTL("Fully heal the HP/status/PP of all Pokémon in the party."))
  133. commands.add("pokemonmenu","quickhatch",_INTL("Quick Hatch"),
  134. _INTL("Make all eggs in the party require just one more step to hatch."))
  135. commands.add("pokemonmenu","fillboxes",_INTL("Fill Storage Boxes"),
  136. _INTL("Add one Pokémon of each species (at Level 50) to storage."))
  137. commands.add("pokemonmenu","clearboxes",_INTL("Clear Storage Boxes"),
  138. _INTL("Remove all Pokémon in storage."))
  139. commands.add("pokemonmenu","openstorage",_INTL("Access Pokémon Storage"),
  140. _INTL("Opens the Pokémon storage boxes in Organize Boxes mode."))
  141.  
  142. commands.add("main","playermenu",_INTL("Player options..."),
  143. _INTL("Set money, badges, Pokédexes, player's appearance and name, etc."))
  144. commands.add("playermenu","setbadges",_INTL("Set Badges"),
  145. _INTL("Toggle possession of each Gym Badge."))
  146. commands.add("playermenu","setmoney",_INTL("Set Money"),
  147. _INTL("Edit how much money you have."))
  148. commands.add("playermenu","setcoins",_INTL("Set Coins"),
  149. _INTL("Edit how many Game Corner Coins you have."))
  150. #===========================================================================
  151. # Birthsigns - Debug Options
  152. #===========================================================================
  153. commands.add("playermenu","birthsigns",_INTL("Player Birthsign..."),
  154. _INTL("Edit your trainer birthsign."))
  155. commands.add("birthsigns","setzodiac",_INTL("Zodiac - Set Sign"),
  156. _INTL("Set a specific sign out of the active zodiac."))
  157. commands.add("birthsigns","randzodiac",_INTL("Zodiac - Random"),
  158. _INTL("Set a random sign out of the active zodiac."))
  159. commands.add("birthsigns","setsign",_INTL("All Signs - Set Sign"),
  160. _INTL("Set a specific sign out of all birthsings."))
  161. commands.add("birthsigns","randsign",_INTL("All Signs - Random"),
  162. _INTL("Set a random sign out of all birthsigns."))
  163. commands.add("birthsigns","rivalsign",_INTL("Set Rival"),
  164. _INTL("Set the Rival of the current sign or month."))
  165. commands.add("birthsigns","partnersign",_INTL("Set Partner"),
  166. _INTL("Set a Partner of the current sign or month."))
  167. commands.add("birthsigns","blessing",_INTL("Blessed Toggle"),
  168. _INTL("Toggle a blessing on your sign."))
  169. commands.add("birthsigns","maxcounter",_INTL("Max Boss Counter"),
  170. _INTL("Max out journal counter for Celestial Bosses."))
  171. commands.add("birthsigns","resetcounter",_INTL("Reset Boss Counter"),
  172. _INTL("Reset journal counter for Celestial Bosses."))
  173. #===========================================================================
  174. commands.add("playermenu","toggleshoes",_INTL("Toggle Running Shoes"),
  175. _INTL("Toggle possession of running shoes."))
  176. commands.add("playermenu","togglepokegear",_INTL("Toggle Pokégear"),
  177. _INTL("Toggle possession of the Pokégear."))
  178. commands.add("playermenu","dexlists",_INTL("Toggle Pokédex and Dexes"),
  179. _INTL("Toggle possession of the Pokédex, and edit Regional Dex accessibility."))
  180. commands.add("playermenu","setplayer",_INTL("Set Player Character"),
  181. _INTL("Edit the player's character, as defined in \"metadata.txt\"."))
  182. commands.add("playermenu","changeoutfit",_INTL("Set Player Outfit"),
  183. _INTL("Edit the player's outfit number."))
  184. commands.add("playermenu","renameplayer",_INTL("Set Player Name"),
  185. _INTL("Rename the player."))
  186. commands.add("playermenu","randomid",_INTL("Randomise Player ID"),
  187. _INTL("Generate a random new ID for the player."))
  188. end
  189.  
  190. commands.add("main","editorsmenu",_INTL("Information editors..."),
  191. _INTL("Edit information in the PBS files, terrain tags, battle animations, etc."))
  192. commands.add("editorsmenu","setmetadata",_INTL("Edit Metadata"),
  193. _INTL("Edit global and map-specific metadata."))
  194. commands.add("editorsmenu","mapconnections",_INTL("Edit Map Connections"),
  195. _INTL("Connect maps using a visual interface. Can also edit map encounters/metadata."))
  196. commands.add("editorsmenu","terraintags",_INTL("Edit Terrain Tags"),
  197. _INTL("Edit the terrain tags of tiles in tilesets. Required for tags 8+."))
  198. commands.add("editorsmenu","setencounters",_INTL("Edit Wild Encounters"),
  199. _INTL("Edit the wild Pokémon that can be found on maps, and how they are encountered."))
  200. commands.add("editorsmenu","trainertypes",_INTL("Edit Trainer Types"),
  201. _INTL("Edit the properties of trainer types."))
  202. commands.add("editorsmenu","edittrainers",_INTL("Edit Individual Trainers"),
  203. _INTL("Edit individual trainers, their Pokémon and items."))
  204. commands.add("editorsmenu","edititems",_INTL("Edit Items"),
  205. _INTL("Edit item data."))
  206. commands.add("editorsmenu","editpokemon",_INTL("Edit Pokémon"),
  207. _INTL("Edit Pokémon species data."))
  208. commands.add("editorsmenu","editdexes",_INTL("Edit Regional Dexes"),
  209. _INTL("Create, rearrange and delete Regional Pokédex lists."))
  210. commands.add("editorsmenu","positionsprites",_INTL("Edit Pokémon Sprite Positions"),
  211. _INTL("Reposition Pokémon sprites in battle."))
  212. commands.add("editorsmenu","autopositionsprites",_INTL("Auto-Position All Sprites"),
  213. _INTL("Automatically reposition all Pokémon sprites in battle. Don't use lightly."))
  214. commands.add("editorsmenu","animeditor",_INTL("Battle Animation Editor"),
  215. _INTL("Edit the battle animations."))
  216. commands.add("editorsmenu","importanims",_INTL("Import All Battle Animations"),
  217. _INTL("Import all battle animations from the \"Animations\" folder."))
  218. commands.add("editorsmenu","exportanims",_INTL("Export All Battle Animations"),
  219. _INTL("Export all battle animations individually to the \"Animations\" folder."))
  220.  
  221. commands.add("main","othermenu",_INTL("Other options..."),
  222. _INTL("Mystery Gifts, translations, compile data, etc."))
  223. commands.add("othermenu","mysterygift",_INTL("Manage Mystery Gifts"),
  224. _INTL("Edit and enable/disable Mystery Gifts."))
  225. commands.add("othermenu","extracttext",_INTL("Extract Text"),
  226. _INTL("Extract all text in the game to a single file for translating."))
  227. commands.add("othermenu","compiletext",_INTL("Compile Text"),
  228. _INTL("Import text and converts it into a language file."))
  229. commands.add("othermenu","compiledata",_INTL("Compile Data"),
  230. _INTL("Fully compile all data."))
  231. commands.add("othermenu","debugconsole",_INTL("Debug Console"),
  232. _INTL("Open the Debug Console."))
  233.  
  234. return commands
  235. end
  236.  
  237. def pbDebugMenuActions(cmd="",sprites=nil,viewport=nil)
  238. case cmd
  239. #=============================================================================
  240. # Field options
  241. #=============================================================================
  242. when "warp"
  243. map = pbWarpToMap
  244. if map
  245. pbFadeOutAndHide(sprites)
  246. Kernel.pbDisposeMessageWindow(sprites["textbox"])
  247. pbDisposeSpriteHash(sprites)
  248. viewport.dispose
  249. if $scene.is_a?(Scene_Map)
  250. $game_temp.player_new_map_id = map[0]
  251. $game_temp.player_new_x = map[1]
  252. $game_temp.player_new_y = map[2]
  253. $game_temp.player_new_direction = 2
  254. $scene.transfer_player
  255. $game_map.refresh
  256. else
  257. Kernel.pbCancelVehicles
  258. $MapFactory.setup(map[0])
  259. $game_player.moveto(map[1],map[2])
  260. $game_player.turn_down
  261. $game_map.update
  262. $game_map.autoplay
  263. $game_map.refresh
  264. end
  265. return true # Closes the debug menu to allow the warp
  266. end
  267. when "refreshmap"
  268. $game_map.need_refresh = true
  269. Kernel.pbMessage(_INTL("The map will refresh."))
  270. when "switches"
  271. pbDebugVariables(0)
  272. when "variables"
  273. pbDebugVariables(1)
  274. when "usepc"
  275. pbPokeCenterPC
  276. when "togglewallpapers"
  277. w = $PokemonStorage.allWallpapers
  278. if w.length<=PokemonStorage::BASICWALLPAPERQTY
  279. Kernel.pbMessage(_INTL("There are no special wallpapers defined."))
  280. else
  281. paperscmd = 0
  282. unlockarray = $PokemonStorage.unlockedWallpapers
  283. loop do
  284. paperscmds = []
  285. paperscmds.push(_INTL("Unlock all"))
  286. paperscmds.push(_INTL("Lock all"))
  287. for i in PokemonStorage::BASICWALLPAPERQTY...w.length
  288. paperscmds.push(_INTL("{1} {2}",unlockarray[i] ? "[Y]" : "[ ]",w[i]))
  289. end
  290. paperscmd = Kernel.pbShowCommands(nil,paperscmds,-1,paperscmd)
  291. break if paperscmd<0
  292. if paperscmd==0 # Unlock all
  293. for i in PokemonStorage::BASICWALLPAPERQTY...w.length
  294. unlockarray[i] = true
  295. end
  296. elsif paperscmd==1 # Lock all
  297. for i in PokemonStorage::BASICWALLPAPERQTY...w.length
  298. unlockarray[i] = false
  299. end
  300. else
  301. paperindex = paperscmd-2+PokemonStorage::BASICWALLPAPERQTY
  302. unlockarray[paperindex] = !$PokemonStorage.unlockedWallpapers[paperindex]
  303. end
  304. end
  305. end
  306. when "daycare"
  307. pbDebugDayCare
  308. when "relicstone"
  309. pbRelicStone
  310. when "purifychamber"
  311. pbPurifyChamber
  312. #=============================================================================
  313. # Battle options
  314. #=============================================================================
  315. when "testwildbattle"
  316. species = pbChooseSpeciesList
  317. if species!=0
  318. params = ChooseNumberParams.new
  319. params.setRange(1,PBExperience::MAXLEVEL)
  320. params.setInitialValue(5)
  321. params.setCancelValue(0)
  322. level = Kernel.pbMessageChooseNumber(_INTL("Set the wild {1}'s level.",PBSpecies.getName(species)),params)
  323. if level>0
  324. $PokemonTemp.encounterType = -1
  325. pbWildBattle(species,level)
  326. end
  327. end
  328. when "testdoublewildbattle"
  329. Kernel.pbMessage(_INTL("Choose the first Pokémon."))
  330. species1 = pbChooseSpeciesList
  331. if species1!=0
  332. params = ChooseNumberParams.new
  333. params.setRange(1,PBExperience::MAXLEVEL)
  334. params.setInitialValue(5)
  335. params.setCancelValue(0)
  336. level1 = Kernel.pbMessageChooseNumber(_INTL("Set the wild {1}'s level.",PBSpecies.getName(species1)),params)
  337. if level1>0
  338. Kernel.pbMessage(_INTL("Choose the second Pokémon."))
  339. species2 = pbChooseSpeciesList
  340. if species2!=0
  341. params = ChooseNumberParams.new
  342. params.setRange(1,PBExperience::MAXLEVEL)
  343. params.setInitialValue(5)
  344. params.setCancelValue(0)
  345. level2 = Kernel.pbMessageChooseNumber(_INTL("Set the wild {1}'s level.",PBSpecies.getName(species2)),params)
  346. if level2>0
  347. $PokemonTemp.encounterType = -1
  348. pbDoubleWildBattle(species1,level1,species2,level2)
  349. end
  350. end
  351. end
  352. end
  353. when "testtrainerbattle"
  354. battle = pbListScreen(_INTL("SINGLE TRAINER"),TrainerBattleLister.new(0,false))
  355. if battle
  356. trainerdata = battle[1]
  357. pbTrainerBattle(trainerdata[0],trainerdata[1],"...",false,trainerdata[4],true)
  358. end
  359. when "testdoubletrainerbattle"
  360. battle1 = pbListScreen(_INTL("DOUBLE TRAINER 1"),TrainerBattleLister.new(0,false))
  361. if battle1
  362. battle2 = pbListScreen(_INTL("DOUBLE TRAINER 2"),TrainerBattleLister.new(0,false))
  363. if battle2
  364. trainerdata1 = battle1[1]
  365. trainerdata2 = battle2[1]
  366. pbDoubleTrainerBattle(trainerdata1[0],trainerdata1[1],trainerdata1[4],"...",
  367. trainerdata2[0],trainerdata2[1],trainerdata2[4],"...",
  368. true)
  369. end
  370. end
  371. when "togglelogging"
  372. $INTERNAL = !$INTERNAL
  373. Kernel.pbMessage(_INTL("Debug logs for battles will be made in the Data folder.")) if $INTERNAL
  374. Kernel.pbMessage(_INTL("Debug logs for battles will not be made.")) if !$INTERNAL
  375. when "resettrainers"
  376. if $game_map
  377. for event in $game_map.events.values
  378. if event.name[/Trainer/]
  379. $game_self_switches[[$game_map.map_id,event.id,"A"]] = false
  380. $game_self_switches[[$game_map.map_id,event.id,"B"]] = false
  381. end
  382. end
  383. $game_map.need_refresh = true
  384. Kernel.pbMessage(_INTL("All Trainers on this map were reset."))
  385. else
  386. Kernel.pbMessage(_INTL("This command can't be used here."))
  387. end
  388. when "readyrematches"
  389. if !$PokemonGlobal.phoneNumbers || $PokemonGlobal.phoneNumbers.length==0
  390. Kernel.pbMessage(_INTL("There are no trainers in the Phone."))
  391. else
  392. for i in $PokemonGlobal.phoneNumbers
  393. if i.length==8 # A trainer with an event
  394. i[4] = 2
  395. pbSetReadyToBattle(i)
  396. end
  397. end
  398. Kernel.pbMessage(_INTL("All trainers in the Phone are now ready to rebattle."))
  399. end
  400. when "roamers"
  401. pbDebugRoamers
  402. #=============================================================================
  403. # Item options
  404. #=============================================================================
  405. when "additem"
  406. pbListScreenBlock(_INTL("ADD ITEM"),ItemLister.new(0)){|button,item|
  407. if button==Input::C && item && item>0
  408. params = ChooseNumberParams.new
  409. params.setRange(1,BAGMAXPERSLOT)
  410. params.setInitialValue(1)
  411. params.setCancelValue(0)
  412. qty = Kernel.pbMessageChooseNumber(_INTL("Choose the number of items."),params)
  413. if qty>0
  414. $PokemonBag.pbStoreItem(item,qty)
  415. Kernel.pbMessage(_INTL("Gave {1}x {2}.",qty,PBItems.getName(item)))
  416. end
  417. end
  418. }
  419. when "fillbag"
  420. params = ChooseNumberParams.new
  421. params.setRange(1,BAGMAXPERSLOT)
  422. params.setInitialValue(1)
  423. params.setCancelValue(0)
  424. qty = Kernel.pbMessageChooseNumber(_INTL("Choose the number of items."),params)
  425. if qty>0
  426. itemconsts = []
  427. for i in PBItems.constants
  428. itemconsts.push(PBItems.const_get(i))
  429. end
  430. itemconsts.sort!{|a,b| a<=>b }
  431. for i in itemconsts
  432. $PokemonBag.pbStoreItem(i,qty)
  433. end
  434. Kernel.pbMessage(_INTL("The Bag was filled with {1} of each item.",qty))
  435. end
  436. when "emptybag"
  437. $PokemonBag.clear
  438. Kernel.pbMessage(_INTL("The Bag was cleared."))
  439. #=============================================================================
  440. # Pokémon options
  441. #=============================================================================
  442. when "addpokemon"
  443. species = pbChooseSpeciesList
  444. if species!=0
  445. params = ChooseNumberParams.new
  446. params.setRange(1,PBExperience::MAXLEVEL)
  447. params.setInitialValue(5)
  448. params.setCancelValue(0)
  449. level = Kernel.pbMessageChooseNumber(_INTL("Set the Pokémon's level."),params)
  450. if level>0
  451. pbAddPokemon(species,level)
  452. end
  453. end
  454. when "demoparty"
  455. pbCreatePokemon
  456. Kernel.pbMessage(_INTL("Filled party with demo Pokémon."))
  457. when "healparty"
  458. for i in $Trainer.party
  459. i.heal
  460. end
  461. Kernel.pbMessage(_INTL("Your Pokémon were fully healed."))
  462. when "quickhatch"
  463. for pokemon in $Trainer.party
  464. pokemon.eggsteps = 1 if pokemon.egg?
  465. end
  466. Kernel.pbMessage(_INTL("All eggs in your party now require one step to hatch."))
  467. when "fillboxes"
  468. $Trainer.formseen = [] if !$Trainer.formseen
  469. $Trainer.formlastseen = [] if !$Trainer.formlastseen
  470. added = 0; completed = true
  471. dexdata = pbOpenDexData
  472. formdata = pbLoadFormsData
  473. for i in 1..PBSpecies.maxValue
  474. if added>=STORAGEBOXES*30
  475. completed = false; break
  476. end
  477. cname = getConstantName(PBSpecies,i) rescue nil
  478. next if !cname
  479. pkmn = PokeBattle_Pokemon.new(i,50,$Trainer)
  480. $PokemonStorage[(i-1)/$PokemonStorage.maxPokemon(0),
  481. (i-1)%$PokemonStorage.maxPokemon(0)] = pkmn
  482. # Record all forms of this Pokémon as seen and owned
  483. $Trainer.seen[i] = true
  484. $Trainer.owned[i] = true
  485. $Trainer.formseen[i] = [[],[]]
  486. formdata[i] = [i] if !formdata[i]
  487. if formdata[i]
  488. for form in 0...formdata[i].length
  489. fSpecies = pbGetFSpeciesFromForm(i,form)
  490. formname = pbGetMessage(MessageTypes::FormNames,fSpecies)
  491. if form==0
  492. pbDexDataOffset(dexdata,i,18)
  493. genderbyte = dexdata.fgetb
  494. case genderbyte
  495. when 0, 254, 255 # Male only, female only, genderless
  496. gender = (genderbyte==254) ? 1 : 0
  497. $Trainer.formseen[i][gender][form] = true
  498. $Trainer.formlastseen[i] = [gender,0]
  499. else # Both male and female
  500. $Trainer.formseen[i][0][form] = true
  501. $Trainer.formseen[i][1][form] = true
  502. $Trainer.formlastseen[i] = [0,0]
  503. end
  504. elsif formname && formname!=""
  505. $Trainer.formseen[i][0][form] = true
  506. end
  507. end
  508. end
  509. added += 1
  510. end
  511. dexdata.close
  512. Kernel.pbMessage(_INTL("Storage boxes were filled with one Pokémon of each species."))
  513. if !completed
  514. Kernel.pbMessage(_INTL("Note: The number of storage spaces ({1} boxes of 30) is less than the number of species.",STORAGEBOXES))
  515. end
  516. when "clearboxes"
  517. for i in 0...$PokemonStorage.maxBoxes
  518. for j in 0...$PokemonStorage.maxPokemon(i)
  519. $PokemonStorage[i,j] = nil
  520. end
  521. end
  522. Kernel.pbMessage(_INTL("The storage boxes were cleared."))
  523. when "openstorage"
  524. pbFadeOutIn(99999){
  525. scene = PokemonStorageScene.new
  526. screen = PokemonStorageScreen.new(scene,$PokemonStorage)
  527. screen.pbStartScreen(0)
  528. }
  529. #=============================================================================
  530. # Player options
  531. #=============================================================================
  532. when "setbadges"
  533. badgecmd = 0
  534. loop do
  535. badgecmds = []
  536. badgecmds.push(_INTL("Give all"))
  537. badgecmds.push(_INTL("Remove all"))
  538. for i in 0...24
  539. badgecmds.push(_INTL("{1} Badge {2}",$Trainer.badges[i] ? "[Y]" : "[ ]",i+1))
  540. end
  541. badgecmd = Kernel.pbShowCommands(nil,badgecmds,-1,badgecmd)
  542. break if badgecmd<0
  543. if badgecmd==0 # Give all
  544. for i in 0...24; $Trainer.badges[i] = true; end
  545. elsif badgecmd==1 # Remove all
  546. for i in 0...24; $Trainer.badges[i] = false; end
  547. else
  548. $Trainer.badges[badgecmd-2] = !$Trainer.badges[badgecmd-2]
  549. end
  550. end
  551. when "setmoney"
  552. params = ChooseNumberParams.new
  553. params.setMaxDigits(6)
  554. params.setDefaultValue($Trainer.money)
  555. $Trainer.money = Kernel.pbMessageChooseNumber(_INTL("Set the player's money."),params)
  556. Kernel.pbMessage(_INTL("You now have ${1}.",pbCommaNumber($Trainer.money)))
  557. when "setcoins"
  558. params = ChooseNumberParams.new
  559. params.setRange(0,MAXCOINS)
  560. params.setDefaultValue($PokemonGlobal.coins)
  561. $PokemonGlobal.coins = Kernel.pbMessageChooseNumber(_INTL("Set the player's Coin amount."),params)
  562. Kernel.pbMessage(_INTL("You now have {1} Coins.",pbCommaNumber($PokemonGlobal.coins)))
  563. #=============================================================================
  564. # Birthsigns - Applies zodiac signs
  565. #=============================================================================
  566. when "setzodiac"
  567. if ZODIACSET==0
  568. Kernel.pbMessage(_INTL("There isn't a Zodiac Set currently active."))
  569. return
  570. elsif $Trainer.isBlessed?
  571. Kernel.pbMessage(_INTL("Can't change birthsigns when blessed."))
  572. return
  573. end
  574. sign = pbChooseZodiacList
  575. if sign!=0
  576. $Trainer.setZodiacsign(sign)
  577. Kernel.pbMessage(_INTL("{1} was set.",PBBirthsigns.getName($Trainer.birthsign)))
  578. end
  579. #=============================================================================
  580. # Birthsigns - Applies random zodiac sign
  581. #=============================================================================
  582. when "randzodiac"
  583. if ZODIACSET==0
  584. Kernel.pbMessage(_INTL("There isn't a Zodiac Set currently active."))
  585. return
  586. elsif $Trainer.isBlessed?
  587. Kernel.pbMessage(_INTL("Can't change birthsigns when blessed."))
  588. return
  589. else
  590. $Trainer.setRandomZodiac
  591. Kernel.pbMessage(_INTL("{1} is now active.",$Trainer.pbGetBirthsignName))
  592. end
  593. #=============================================================================
  594. # Birthsigns - Applies any sign
  595. #=============================================================================
  596. when "setsign"
  597. if $Trainer.isBlessed?
  598. Kernel.pbMessage(_INTL("Can't change birthsigns when blessed."))
  599. return
  600. end
  601. sign = pbChooseBirthsignList
  602. if sign!=0
  603. $Trainer.setBirthsign(sign)
  604. Kernel.pbMessage(_INTL("{1} was set.",PBBirthsigns.getName($Trainer.birthsign)))
  605. end
  606. #=============================================================================
  607. # Birthsigns - Applies any random sign
  608. #=============================================================================
  609. when "randsign"
  610. if $Trainer.isBlessed?
  611. Kernel.pbMessage(_INTL("Can't change birthsigns when blessed."))
  612. return
  613. else
  614. $Trainer.setRandomsign
  615. Kernel.pbMessage(_INTL("{1} is now active.",$Trainer.pbGetBirthsignName))
  616. end
  617. #=============================================================================
  618. # Birthsigns - Applies a Rival sign to the current sign or month.
  619. #=============================================================================
  620. when "rivalsign"
  621. if $Trainer.isBlessed?
  622. Kernel.pbMessage(_INTL("Can't change birthsigns when blessed."))
  623. return
  624. elsif $Trainer.hasZodiacsign?
  625. $Trainer.setRivalsign($Trainer.getCalendarsign)
  626. Kernel.pbMessage(_INTL("{1} is now active.",$Trainer.pbGetBirthsignName))
  627. else
  628. $Trainer.setRivalsign(Time.now.mon)
  629. Kernel.pbMessage(_INTL("{1} is now active.",$Trainer.pbGetBirthsignName))
  630. end
  631. #=============================================================================
  632. # Birthsigns - Applies a random Partner sign to the current sign or month
  633. #=============================================================================
  634. when "partnersign"
  635. if $Trainer.isBlessed?
  636. Kernel.pbMessage(_INTL("Can't change birthsigns when blessed."))
  637. return
  638. elsif $Trainer.hasZodiacsign?
  639. $Trainer.setPartnersign($Trainer.getCalendarsign)
  640. Kernel.pbMessage(_INTL("{1} is now active.",$Trainer.pbGetBirthsignName))
  641. else
  642. $Trainer.setPartnersign(Time.now.mon)
  643. Kernel.pbMessage(_INTL("{1} is now active.",$Trainer.pbGetBirthsignName))
  644. end
  645. #=============================================================================
  646. # Birthsigns - Blessed Toggle
  647. #=============================================================================
  648. when "blessing"
  649. if !$Trainer.hasBirthsign?
  650. Kernel.pbMessage(_INTL("Can't be blessed without a birthsign."))
  651. return
  652. elsif $Trainer.isBlessed?
  653. $Trainer.makeUnblessed
  654. Kernel.pbMessage(_INTL("You're no longer blessed."))
  655. elsif !$Trainer.isBlessed?
  656. $Trainer.makeBlessed
  657. Kernel.pbMessage(_INTL("You are now blessed."))
  658. end
  659. #=============================================================================
  660. # Birthsigns - Reset Boss Counter
  661. #=============================================================================
  662. when "maxcounter"
  663. if ZODIACSET!=3
  664. $Trainer.celestialcheck[0]=JAN_BIRTHSIGN
  665. $Trainer.celestialcheck[1]=FEB_BIRTHSIGN
  666. $Trainer.celestialcheck[2]=MAR_BIRTHSIGN
  667. $Trainer.celestialcheck[3]=APR_BIRTHSIGN
  668. $Trainer.celestialcheck[4]=MAY_BIRTHSIGN
  669. $Trainer.celestialcheck[5]=JUN_BIRTHSIGN
  670. $Trainer.celestialcheck[6]=JUL_BIRTHSIGN
  671. $Trainer.celestialcheck[7]=AUG_BIRTHSIGN
  672. $Trainer.celestialcheck[8]=SEP_BIRTHSIGN
  673. $Trainer.celestialcheck[9]=OCT_BIRTHSIGN
  674. $Trainer.celestialcheck[10]=NOV_BIRTHSIGN
  675. $Trainer.celestialcheck[11]=DEC_BIRTHSIGN
  676. Kernel.pbMessage(_INTL("Boss counter maxed."))
  677. else
  678. Kernel.pbMessage(_INTL("Can't apply boss counters when a randomized zodiac is active!"))
  679. end
  680. #=============================================================================
  681. # Birthsigns - Max Boss Counter
  682. #=============================================================================
  683. when "resetcounter"
  684. pbBossCountReset
  685. Kernel.pbMessage(_INTL("Boss counter reset."))
  686. #=============================================================================
  687. when "toggleshoes"
  688. $PokemonGlobal.runningShoes = !$PokemonGlobal.runningShoes
  689. Kernel.pbMessage(_INTL("Gave Running Shoes.")) if $PokemonGlobal.runningShoes
  690. Kernel.pbMessage(_INTL("Lost Running Shoes.")) if !$PokemonGlobal.runningShoes
  691. when "togglepokegear"
  692. $Trainer.pokegear = !$Trainer.pokegear
  693. Kernel.pbMessage(_INTL("Gave Pokégear.")) if $Trainer.pokegear
  694. Kernel.pbMessage(_INTL("Lost Pokégear.")) if !$Trainer.pokegear
  695. when "dexlists"
  696. dexescmd = 0
  697. loop do
  698. dexescmds = []
  699. dexescmds.push(_INTL("Have Pokédex: {1}",$Trainer.pokedex ? "[YES]" : "[NO]"))
  700. d = pbDexNames
  701. for i in 0...d.length
  702. name = d[i]
  703. name = name[0] if name.is_a?(Array)
  704. dexindex = i
  705. unlocked = $PokemonGlobal.pokedexUnlocked[dexindex]
  706. dexescmds.push(_INTL("{1} {2}",unlocked ? "[Y]" : "[ ]",name))
  707. end
  708. dexescmd = Kernel.pbShowCommands(nil,dexescmds,-1,dexescmd)
  709. break if dexescmd<0
  710. dexindex = dexescmd-1
  711. if dexindex<0 # Toggle Pokédex ownership
  712. $Trainer.pokedex = !$Trainer.pokedex
  713. else # Toggle Regional Dex accessibility
  714. if $PokemonGlobal.pokedexUnlocked[dexindex]
  715. pbLockDex(dexindex)
  716. else
  717. pbUnlockDex(dexindex)
  718. end
  719. end
  720. end
  721. when "setplayer"
  722. limit = 0
  723. for i in 0...8
  724. meta = pbGetMetadata(0,MetadataPlayerA+i)
  725. if !meta
  726. limit = i; break
  727. end
  728. end
  729. if limit<=1
  730. Kernel.pbMessage(_INTL("There is only one player defined."))
  731. else
  732. params = ChooseNumberParams.new
  733. params.setRange(0,limit-1)
  734. params.setDefaultValue($PokemonGlobal.playerID)
  735. newid = Kernel.pbMessageChooseNumber(_INTL("Choose the new player character."),params)
  736. if newid!=$PokemonGlobal.playerID
  737. pbChangePlayer(newid)
  738. Kernel.pbMessage(_INTL("The player character was changed."))
  739. end
  740. end
  741. when "changeoutfit"
  742. oldoutfit = $Trainer.outfit
  743. params = ChooseNumberParams.new
  744. params.setRange(0,99)
  745. params.setDefaultValue(oldoutfit)
  746. $Trainer.outfit = Kernel.pbMessageChooseNumber(_INTL("Set the player's outfit."),params)
  747. Kernel.pbMessage(_INTL("Player's outfit was changed.")) if $Trainer.outfit!=oldoutfit
  748. when "renameplayer"
  749. trname = pbEnterPlayerName("Your name?",0,PLAYERNAMELIMIT,$Trainer.name)
  750. if trname=="" && Kernel.pbConfirmMessage(_INTL("Give yourself a default name?"))
  751. trainertype = pbGetPlayerTrainerType
  752. gender = pbGetTrainerTypeGender(trainertype)
  753. trname = pbSuggestTrainerName(gender)
  754. end
  755. if trname==""
  756. Kernel.pbMessage(_INTL("The player's name remained {1}.",$Trainer.name))
  757. else
  758. $Trainer.name = trname
  759. Kernel.pbMessage(_INTL("The player's name was changed to {1}.",$Trainer.name))
  760. end
  761. when "randomid"
  762. $Trainer.id = rand(256)
  763. $Trainer.id |= rand(256)<<8
  764. $Trainer.id |= rand(256)<<16
  765. $Trainer.id |= rand(256)<<24
  766. Kernel.pbMessage(_INTL("The player's ID was changed to {1} (full ID: {2}).",$Trainer.publicID,$Trainer.id))
  767. #=============================================================================
  768. # Information editors
  769. #=============================================================================
  770. when "setmetadata"
  771. pbMetadataScreen(pbDefaultMap)
  772. pbClearData
  773. when "mapconnections"
  774. pbFadeOutIn(99999){ pbConnectionsEditor }
  775. when "terraintags"
  776. pbFadeOutIn(99999){ pbTilesetScreen }
  777. when "setencounters"
  778. encdata = load_data("Data/encounters.dat")
  779. oldencdata = Marshal.dump(encdata)
  780. map = pbDefaultMap
  781. loop do
  782. map = pbListScreen(_INTL("SET ENCOUNTERS"),MapLister.new(map))
  783. break if map<=0
  784. pbEncounterEditorMap(encdata,map)
  785. end
  786. save_data(encdata,"Data/encounters.dat")
  787. pbSaveEncounterData
  788. pbClearData
  789. when "trainertypes"
  790. pbFadeOutIn(99999){ pbTrainerTypeEditor }
  791. when "edittrainers"
  792. pbFadeOutIn(99999){ pbTrainerBattleEditor }
  793. when "edititems"
  794. pbFadeOutIn(99999){ pbItemEditor }
  795. when "editpokemon"
  796. pbFadeOutIn(99999){ pbPokemonEditor }
  797. when "editdexes"
  798. pbFadeOutIn(99999){ pbRegionalDexEditorMain }
  799. when "positionsprites"
  800. pbFadeOutIn(99999) {
  801. sp = SpritePositioner.new
  802. sps = SpritePositionerScreen.new(sp)
  803. sps.pbStart
  804. }
  805. when "autopositionsprites"
  806. if Kernel.pbConfirmMessage(_INTL("Are you sure you want to reposition all sprites?"))
  807. msgwindow = Kernel.pbCreateMessageWindow
  808. Kernel.pbMessageDisplay(msgwindow,_INTL("Repositioning all sprites. Please wait."),false)
  809. Graphics.update
  810. pbAutoPositionAll
  811. Kernel.pbDisposeMessageWindow(msgwindow)
  812. end
  813. when "animeditor"
  814. pbFadeOutIn(99999){ pbAnimationEditor }
  815. when "importanims"
  816. pbImportAllAnimations
  817. when "exportanims"
  818. pbExportAllAnimations
  819. #=============================================================================
  820. # Other options
  821. #=============================================================================
  822. when "mysterygift"
  823. pbManageMysteryGifts
  824. when "extracttext"
  825. pbExtractText
  826. when "compiletext"
  827. pbCompileTextUI
  828. when "compiledata"
  829. msgwindow=Kernel.pbCreateMessageWindow
  830. pbCompileAllData(true) {|msg| Kernel.pbMessageDisplay(msgwindow,msg,false) }
  831. Kernel.pbMessageDisplay(msgwindow,_INTL("All game data was compiled."))
  832. Kernel.pbDisposeMessageWindow(msgwindow)
  833. when "debugconsole"
  834. Console::setup_console
  835. end
  836. return false
  837. end
  838.  
  839. def pbDebugMenu(showall=true)
  840. commands = pbDebugMenuCommands(showall)
  841. viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
  842. viewport.z = 99999
  843. sprites = {}
  844. sprites["textbox"] = Kernel.pbCreateMessageWindow
  845. sprites["textbox"].letterbyletter = false
  846. sprites["cmdwindow"] = Window_CommandPokemonEx.new(commands.list)
  847. cmdwindow = sprites["cmdwindow"]
  848. cmdwindow.x = 0
  849. cmdwindow.y = 0
  850. cmdwindow.width = Graphics.width
  851. cmdwindow.height = Graphics.height-sprites["textbox"].height
  852. cmdwindow.viewport = viewport
  853. cmdwindow.visible = true
  854. sprites["textbox"].text = commands.getDesc(cmdwindow.index)
  855. pbFadeInAndShow(sprites)
  856. ret = -1
  857. refresh = true
  858. loop do
  859. loop do
  860. oldindex = cmdwindow.index
  861. cmdwindow.update
  862. if refresh || cmdwindow.index!=oldindex
  863. sprites["textbox"].text = commands.getDesc(cmdwindow.index)
  864. refresh = false
  865. end
  866. Graphics.update
  867. Input.update
  868. if Input.trigger?(Input::B)
  869. parent = commands.getParent
  870. if parent
  871. commands.currentList = parent[0]
  872. cmdwindow.commands = commands.list
  873. cmdwindow.index = parent[1]
  874. refresh = true
  875. else
  876. ret = -1
  877. break
  878. end
  879. elsif Input.trigger?(Input::C)
  880. ret = cmdwindow.index
  881. break
  882. end
  883. end
  884. break if ret<0
  885. cmd = commands.getCommand(ret)
  886. if commands.hasSubMenu?(cmd)
  887. commands.currentList = cmd
  888. cmdwindow.commands = commands.list
  889. cmdwindow.index = 0
  890. refresh = true
  891. else
  892. return if pbDebugMenuActions(cmd,sprites,viewport)
  893. end
  894. end
  895. pbFadeOutAndHide(sprites)
  896. Kernel.pbDisposeMessageWindow(sprites["textbox"])
  897. pbDisposeSpriteHash(sprites)
  898. viewport.dispose
  899. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement