Advertisement
Guest User

FF9 Help Plugin: Window_MenuStatus

a guest
Oct 28th, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 5.90 KB | None | 0 0
  1. module Config
  2.   module FF9_Help
  3.     Window_MenuStatus = {
  4.       "Skills" => ['Select character.'],
  5.       "Equipment" => ['Select character.    '],
  6.       "Status" => ['Select character.'],
  7.       "Formation" => ['Select character.'],
  8.     }
  9.   end
  10. end
  11.  
  12. class Window_MenuStatus < Window_Selectable
  13.  
  14.   alias :griver_ff9_help_window_menustatusff_process_handling :process_handling
  15.   def process_handling
  16.     griver_ff9_help_window_menustatusff_process_handling
  17.     return unless open? && active
  18.     if @command_window_index
  19.       if $ff9_help_active
  20.         Config::FF9_Help::Deactivate_SE.play if ff9_help_open? && Input.trigger?(Config::FF9_Help::Toggle_Key) if Config::FF9_Help::Deactivate_SE != nil
  21.         return ff9_help_toggle if Input.trigger?(Config::FF9_Help::Toggle_Key)
  22.       else
  23.         Config::FF9_Help::Activate_SE.play if ff9_help_avalaible? && Input.trigger?(Config::FF9_Help::Toggle_Key) if Config::FF9_Help::Activate_SE != nil
  24.         return ff9_help_toggle if ff9_help_avalaible? && Input.trigger?(Config::FF9_Help::Toggle_Key)
  25.       end
  26.     end
  27.   end
  28.  
  29.   def ff9_help_show
  30.     return unless open? && active
  31.     cursor_x = (@cursor[0].x - (@cursor[0].bitmap.width / 2)) - 2
  32.     cursor_y = (@cursor[0].y - (@cursor[0].bitmap.height / 2)) - 26
  33.     window_rows = [page_row_max / 2, 1].max
  34.     window_index = index_of_visible_row + 1
  35.     if pending_index >= 0
  36.       line1 = 'Select same character twice to choose'
  37.       line2 = '\c[18]front row \c[15]or \c[18]back row \c[15]in battle.'
  38.       line3 = 'Select two different characters to'
  39.       line4 = '\c[18]switch places\c[15].'
  40.       text = [line1, line2, line3, line4]
  41.     else
  42.       if @command_window.command_name(@command_window_index) == "Equipment"
  43.         equip_type_icons = []
  44.         equip_type_icons.push(144)
  45.         equip_type_icons.push(160)
  46.         equip_type_icons.push(162)
  47.         equip_type_icons.push(168)
  48.         equip_type_icons.push(179)
  49.         equip_names = []
  50.         equip_icons = []
  51.         actor = $game_party.members[index]
  52.         actor.equips.each_with_index do |item, i|
  53.           if actor.equips[i] != nil
  54.             equip_names.push(actor.equips[i].name)
  55.             equip_icons.push(actor.equips[i].icon_index)
  56.           else
  57.             equip_names.push('')
  58.             equip_icons.push(0)
  59.           end
  60.         end
  61.         line1 = ff9_help_text[0]
  62.         line2 = "\\i[#{equip_type_icons[0]}]:" + "\\i[#{equip_icons[0]}]"+ "#{equip_names[0]}"
  63.         line3 = "\\i[#{equip_type_icons[1]}]:" + "\\i[#{equip_icons[1]}]"+ "#{equip_names[1]}"
  64.         line4 = "\\i[#{equip_type_icons[2]}]:" + "\\i[#{equip_icons[2]}]"+ "#{equip_names[2]}"
  65.         line5 = "\\i[#{equip_type_icons[3]}]:" + "\\i[#{equip_icons[3]}]"+ "#{equip_names[3]}"
  66.         line6 = "\\i[#{equip_type_icons[4]}]:" + "\\i[#{equip_icons[4]}]"+ "#{equip_names[4]}"
  67.         text = [line1, line2, line3, line4, line5, line6]
  68.       elsif @command_window.command_name(@command_window_index) == "Status"
  69.         actor = $game_party.members[index]
  70.         s_next = sprintf(Vocab::ExpNext, Vocab::level)
  71.         s1 = actor.max_level? ? "   -------" : actor.exp
  72.         s2 = actor.max_level? ? "-------" : actor.next_level_exp - actor.exp
  73.         line1 = ff9_help_text[0]
  74.         if !actor.max_level?
  75.           if s1 >= 1000000
  76.             line2 = "#{Vocab::ExpTotal}" + ":        " + s1.to_s
  77.           elsif s1 >= 100000
  78.             line2 = "#{Vocab::ExpTotal}" + ":         " + s1.to_s
  79.           elsif s1 >= 10000
  80.             line2 = "#{Vocab::ExpTotal}" + ":          " + s1.to_s
  81.           elsif s1 >= 1000
  82.             line2 = "#{Vocab::ExpTotal}" + ":           " + s1.to_s
  83.           elsif s1 >= 100
  84.             line2 = "#{Vocab::ExpTotal}" + ":            " + s1.to_s
  85.           elsif s1 >= 10
  86.             line2 = "#{Vocab::ExpTotal}" + ":             " + s1.to_s
  87.           elsif s1 >= 0
  88.             line2 = "#{Vocab::ExpTotal}" + ":              " + s1.to_s
  89.           end
  90.           if s2 >= 1000000
  91.             line3 = "#{s_next}" + ": " + s2.to_s
  92.           elsif s2 >= 100000
  93.             line3 = "#{s_next}" + ":  " + s2.to_s
  94.           elsif s2 >= 10000
  95.             line3 = "#{s_next}" + ":   " + s2.to_s
  96.           elsif s2 >= 1000
  97.             line3 = "#{s_next}" + ":    " + s2.to_s
  98.           elsif s2 >= 100
  99.             line3 = "#{s_next}" + ":     " + s2.to_s
  100.           elsif s2 >= 10
  101.             line3 = "#{s_next}" + ":      " + s2.to_s
  102.           elsif s2 >= 0
  103.             line3 = "#{s_next}" + ":       " + s2.to_s
  104.           end
  105.         else
  106.           line2 = "#{Vocab::ExpTotal}" + ":     " + s1.to_s
  107.           line3 = "#{s_next}" + ": " + s2.to_s
  108.         end
  109.         text = [line1, line2, line3]
  110.       else
  111.         text = ff9_help_text
  112.       end
  113.     end
  114.     @ff9_help_window.show(text, cursor_x, cursor_y, window_rows, window_index)
  115.   end
  116.  
  117.   def ff9_help_text
  118.     Config::FF9_Help::Window_MenuStatus[@command_window.command_name(@command_window_index)]
  119.   end
  120.  
  121.   def ff9_help_avalaible?
  122.     Config::FF9_Help::Window_MenuStatus.include?(@command_window.command_name(@command_window_index)) rescue return
  123.   end
  124.  
  125.   def command_window=(window)
  126.     @command_window = window
  127.   end
  128.  
  129.   def command_window_index=(index)
  130.     @command_window_index = index
  131.   end
  132.  
  133.   def process_cancel
  134.     if pending_index == -1
  135.       ff9_help_hide
  136.     end
  137.     super
  138.   end
  139. end
  140.  
  141. class Scene_Menu < Scene_MenuBase
  142.  
  143.   alias :griver_ff9_help_patch_window_menustatusff_scene_menu_update :update
  144.   def update
  145.     griver_ff9_help_patch_window_menustatusff_scene_menu_update
  146.     @status_window.command_window_index = @command_window.index if @command_window.active
  147.   end
  148.  
  149.   alias :griver_ff9_help_patch_window_menustatusff_scene_menu_create_status_window :create_status_window
  150.   def create_status_window
  151.     griver_ff9_help_patch_window_menustatusff_scene_menu_create_status_window
  152.     @status_window.command_window = @command_window
  153.   end
  154. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement