Advertisement
TechSkylander1518

Customizable PokeDex (v19)

Sep 25th, 2021 (edited)
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 6.99 KB | None | 0 0
  1. module Custom_Entries
  2.   attr_accessor :entries
  3.  
  4.  
  5.   @entries = []
  6. end
  7.  
  8.  
  9.  
  10. class Player
  11. include Custom_Entries
  12. end
  13.  
  14.  
  15. def customEntry?(species)
  16.     idno = GameData::Species.get(species).id_number
  17.   if $Trainer.entries &&
  18.     $Trainer.entries[idno]!=nil &&
  19.     $Trainer.entries[idno]!=" " &&
  20.     $Trainer.entries[idno]!=""
  21.     return true
  22.   else
  23.     return false
  24.   end
  25. end
  26.  
  27.  
  28. def entry(species,var)
  29.     idno = GameData::Species.get(species).id_number
  30.   if customEntry?(species)
  31.       $game_variables[var] = $Trainer.entries[idno]
  32.     else
  33.       $game_variables[var] = GameData::Species.get(species).pokedex_entry
  34.   end
  35.  
  36. end
  37.  
  38. class PokemonPokedexInfo_Scene
  39.  
  40.   def drawPageInfo
  41.     @sprites["background"].setBitmap(_INTL("Graphics/Pictures/Pokedex/bg_info"))
  42.     overlay = @sprites["overlay"].bitmap
  43.     base   = Color.new(88, 88, 80)
  44.     shadow = Color.new(168, 184, 184)
  45.     imagepos = []
  46.     if @brief
  47.       imagepos.push([_INTL("Graphics/Pictures/Pokedex/overlay_info"), 0, 0])
  48.     end
  49.     species_data = GameData::Species.get_species_form(@species, @form)
  50.     # Write various bits of text
  51.     indexText = "???"
  52.     if @dexlist[@index][4] > 0
  53.       indexNumber = @dexlist[@index][4]
  54.       indexNumber -= 1 if @dexlist[@index][5]
  55.       indexText = sprintf("%03d", indexNumber)
  56.     end
  57.     textpos = [
  58.        [_INTL("{1}{2} {3}", indexText, " ", species_data.name),
  59.           246, 36, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)],
  60.        [_INTL("Height"), 314, 152, 0, base, shadow],
  61.        [_INTL("Weight"), 314, 184, 0, base, shadow]
  62.     ]
  63.     if $Trainer.owned?(@species)
  64.       # Write the category
  65.       textpos.push([_INTL("{1} Pokémon", species_data.category), 246, 68, 0, base, shadow])
  66.       # Write the height and weight
  67.       height = species_data.height
  68.       weight = species_data.weight
  69.       if System.user_language[3..4] == "US"   # If the user is in the United States
  70.         inches = (height / 0.254).round
  71.         pounds = (weight / 0.45359).round
  72.         textpos.push([_ISPRINTF("{1:d}'{2:02d}\"", inches / 12, inches % 12), 460, 152, 1, base, shadow])
  73.         textpos.push([_ISPRINTF("{1:4.1f} lbs.", pounds / 10.0), 494, 184, 1, base, shadow])
  74.       else
  75.         textpos.push([_ISPRINTF("{1:.1f} m", height / 10.0), 470, 152, 1, base, shadow])
  76.         textpos.push([_ISPRINTF("{1:.1f} kg", weight / 10.0), 482, 184, 1, base, shadow])
  77.       end
  78.       # Draw the Pokédex entry text
  79.       entry = species_data.pokedex_entry
  80.       if !$Trainer.entries
  81.         $Trainer.entries = []
  82.         GameData::Species.each do |sp|
  83.           $Trainer.entries[sp.id_number]         = ""
  84.         end
  85.       end
  86.       idno = species_data.id_number
  87.         if $Trainer.entries[idno]!=nil &&
  88.           $Trainer.entries[idno]!=" " &&
  89.           $Trainer.entries[idno]!=""
  90.           entry = $Trainer.entries[idno]
  91.         end
  92.       drawTextEx(overlay, 40, 244, Graphics.width - (40 * 2), 4,   # overlay, x, y, width, num lines
  93.                  entry, base, shadow)
  94.       # Draw the footprint
  95.       footprintfile = GameData::Species.footprint_filename(@species, @form)
  96.       if footprintfile
  97.         footprint = RPG::Cache.load_bitmap("",footprintfile)
  98.         overlay.blt(226, 138, footprint, footprint.rect)
  99.         footprint.dispose
  100.       end
  101.       # Show the owned icon
  102.       imagepos.push(["Graphics/Pictures/Pokedex/icon_own", 212, 44])
  103.       # Draw the type icon(s)
  104.       type1 = species_data.type1
  105.       type2 = species_data.type2
  106.       type1_number = GameData::Type.get(type1).id_number
  107.       type2_number = GameData::Type.get(type2).id_number
  108.       type1rect = Rect.new(0, type1_number * 32, 96, 32)
  109.       type2rect = Rect.new(0, type2_number * 32, 96, 32)
  110.       overlay.blt(296, 120, @typebitmap.bitmap, type1rect)
  111.       overlay.blt(396, 120, @typebitmap.bitmap, type2rect) if type1 != type2
  112.     else
  113.       # Write the category
  114.       textpos.push([_INTL("????? Pokémon"), 246, 68, 0, base, shadow])
  115.       # Write the height and weight
  116.       if System.user_language[3..4] == "US"   # If the user is in the United States
  117.         textpos.push([_INTL("???'??\""), 460, 152, 1, base, shadow])
  118.         textpos.push([_INTL("????.? lbs."), 494, 184, 1, base, shadow])
  119.       else
  120.         textpos.push([_INTL("????.? m"), 470, 152, 1, base, shadow])
  121.         textpos.push([_INTL("????.? kg"), 482, 184, 1, base, shadow])
  122.       end
  123.     end
  124.     # Draw all text
  125.     pbDrawTextPositions(overlay, textpos)
  126.     # Draw all images
  127.     pbDrawImagePositions(overlay, imagepos)
  128.   end
  129.  
  130.   def pbScene
  131.     GameData::Species.play_cry_from_species(@species, @form)
  132.     loop do
  133.       Graphics.update
  134.       Input.update
  135.       pbUpdate
  136.       dorefresh = false
  137.       if Input.trigger?(Input::ACTION)
  138.         pbSEStop
  139.         GameData::Species.play_cry_from_species(@species, @form) if @page == 1
  140.       elsif Input.trigger?(Input::BACK)
  141.         pbPlayCloseMenuSE
  142.         break
  143.       elsif Input.trigger?(Input::USE)
  144.         if @page==2   # Area
  145. #          dorefresh = true
  146.         elsif @page==3   # Forms
  147.           if @available.length>1
  148.             pbPlayDecisionSE
  149.             pbChooseForm
  150.             dorefresh = true
  151.           end
  152.         end
  153.       elsif Input.trigger?(Input::ALT) && $Trainer.owned?(@species)
  154.         if @page==1
  155.           if !$Trainer.entries
  156.             $Trainer.entries = []
  157.             GameData::Species.each do |sp|
  158.               $Trainer.entries[sp.id_number]         = ""
  159.             end
  160.           end
  161.           species_data = GameData::Species.get_species_form(@species, @form)
  162.           idno = species_data.id_number
  163.           $Trainer.entries[idno]=pbMessageFreeText(_INTL("New PokéDex entry?"),"",false,170,Graphics.width)
  164.           dorefresh = true
  165.           drawPageInfo
  166.         end
  167.       elsif Input.trigger?(Input::UP)
  168.         oldindex = @index
  169.         pbGoToPrevious
  170.         if @index!=oldindex
  171.           pbUpdateDummyPokemon
  172.           @available = pbGetAvailableForms
  173.           pbSEStop
  174.           (@page==1) ? GameData::Species.play_cry_from_species(@species, @form) : pbPlayCursorSE
  175.           dorefresh = true
  176.         end
  177.       elsif Input.trigger?(Input::DOWN)
  178.         oldindex = @index
  179.         pbGoToNext
  180.         if @index!=oldindex
  181.           pbUpdateDummyPokemon
  182.           @available = pbGetAvailableForms
  183.           pbSEStop
  184.           (@page==1) ? GameData::Species.play_cry_from_species(@species, @form) : pbPlayCursorSE
  185.           dorefresh = true
  186.         end
  187.       elsif Input.trigger?(Input::LEFT)
  188.         oldpage = @page
  189.         @page -= 1
  190.         @page = 1 if @page<1
  191.         @page = 3 if @page>3
  192.         if @page!=oldpage
  193.           pbPlayCursorSE
  194.           dorefresh = true
  195.         end
  196.       elsif Input.trigger?(Input::RIGHT)
  197.         oldpage = @page
  198.         @page += 1
  199.         @page = 1 if @page<1
  200.         @page = 3 if @page>3
  201.         if @page!=oldpage
  202.           pbPlayCursorSE
  203.           dorefresh = true
  204.         end
  205.       end
  206.       if dorefresh
  207.         drawPage(@page)
  208.       end
  209.     end
  210.     return @index
  211.   end
  212.  
  213.  
  214.  
  215. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement