Class: Yuki::Debug::Groups
- Defined in:
- scripts/01100 Yuki/02403 Debug_Groups.rb
Overview
Show the Groups in debug mod
Constant Summary collapse
- ZONE_TYPE_NAMES =
List of the Zone type names
[ 'default (%d)', 'tall grass (%d)', 'taller grass (%d)', 'cave (%d)', 'mount (%d)', 'sand (%d)', 'pond (%d)', 'sea (%d)', 'under water (%d)', 'snow (%d)', 'ice (%d)', ]
- ZONE_TYPE_NAMES_NTAG =
List of the Zone type names without the tag
[ 'default', 'tall grass', 'taller grass', 'cave', 'mount', 'sand', 'pond', 'sea', 'under water', 'snow', 'ice' ]
- FISHING_NAMES =
List of the fishing names
{ normal: 'OldRod (%s)', super: 'GoodRod (%s)', mega: 'SuperRod (%s)', rock: 'Rock Smash (%s)', headbutt: 'HeadButt (%s)' }
Instance Method Summary collapse
-
#initialize(viewport, stack) ⇒ Groups
constructor
Create a new Group viewer.
-
#load_fishing_groups(y)
Load the fishing groups.
-
#load_groups
Load the groups.
-
#load_remaining_groups(y) ⇒ Integer
Load the remaining groups.
-
#update
Update the view.
Constructor Details
#initialize(viewport, stack) ⇒ Groups
Create a new Group viewer
35 36 37 38 39 |
# File 'scripts/01100 Yuki/02403 Debug_Groups.rb', line 35 def initialize(, stack) @stack = UI::SpriteStack.new(, stack.x, stack.y + 64, default_cache: :b_icon) @width = .rect.width - stack.x @height = .rect.height - @stack.y end |
Instance Method Details
#load_fishing_groups(y)
Load the fishing groups
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'scripts/01100 Yuki/02403 Debug_Groups.rb', line 92 def load_fishing_groups(y) x = 0 name_format = PFM::Pokemon::MALE_NAME $wild_battle.fishing.each do |type, arr| break if y >= @height name = FISHING_NAMES[type] arr.each_with_index do |group, zone| next unless group @stack.add_text(x, y, 320, 16, format(name, ZONE_TYPE_NAMES_NTAG[zone]), color: 9) group.ids.each do |id| @stack.push(x, y, format(name_format, id)) x += 32 if x >= @width y += 32 x = 0 end end y += 32 x = 0 break if y >= @height end end end |
#load_groups
Load the groups
57 58 59 60 61 |
# File 'scripts/01100 Yuki/02403 Debug_Groups.rb', line 57 def load_groups @stack.add_text(0, 0, 320, 16, "Zone : #{$env.get_current_zone_data&.map_name}", color: 9) y = load_remaining_groups(16) load_fishing_groups(y) end |
#load_remaining_groups(y) ⇒ Integer
Load the remaining groups
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'scripts/01100 Yuki/02403 Debug_Groups.rb', line 66 def load_remaining_groups(y) x = 0 name_format = PFM::Pokemon::MALE_NAME $wild_battle.remaining_pokemons.each_with_index do |arr, zone| break if y >= @height arr.each_with_index do |group, tag| next unless group @stack.add_text(x, y, 320, 16, format(ZONE_TYPE_NAMES[zone], tag), color: 9) group.ids.each do |id| @stack.push(x, y, format(name_format, id)) x += 32 if x >= @width y += 32 x = 0 end end y += 32 x = 0 break if y >= @height end end return y end |
#update
Update the view
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'scripts/01100 Yuki/02403 Debug_Groups.rb', line 42 def update if $scene.is_a?(Scene_Map) && $wild_battle @stack.visible ||= true if @last_code != $wild_battle.code || @last_id != $game_map.map_id @last_code = $wild_battle.code @last_id = $game_map.map_id @stack.dispose load_groups end else @stack.visible &&= false end end |