Advertisement
TechSkylander1518

Custom Dex Entries v20

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