Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2011
1,601
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 22.76 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # Shanghai Simple Script - Final Fantasy 13 Skill Menu
  4. # Last Date Updated: 2010.06.20
  5. # Level: Normal
  6. #
  7. # NOTE! This requires Yanfly Engine Melody's Skill Overhaul script to be
  8. # installed and located above this script to work. This makes your equip menu
  9. # ordered like Final Fantasy 13's.
  10. #===============================================================================
  11. # Instructions
  12. # -----------------------------------------------------------------------------
  13. # To install this script, open up your script editor and copy/paste this script
  14. # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
  15. #
  16. #===============================================================================
  17.  
  18. $imported = {} if $imported == nil
  19. $imported["FinalFantasy13SkillMenu"] = true
  20.  
  21. module SSS
  22.   # This is the image used for the header and footer of the profile scenes.
  23.   # Must be 544x416 pixels or whatever resolution size you're using.
  24.   MENU_BACK_PROFILE_IMAGE = "ProfileBack"
  25.  
  26.   # This is the image used for the item back image. Must be 286x24 pixels.
  27.   MENU_BACK_PROFILE_ITEM = "ProfileItem"
  28.  
  29.   # This sets the menu help window's text color.
  30.   MENU_HELP_TEXT_COLOR = Color.new(0, 0, 0)
  31.  
  32.   # This is the text format used to write out the current map.
  33.   MENU_LOCATION = "Location: %s"
  34.  
  35.   # This hash sets the image files for your actors. These images must be placed
  36.   # inside of the Graphics\System folder and they have to be 544x416 pixels or
  37.   # whatever resolution size you're using.
  38.   MENU_PROFILE_IMAGES ={
  39.     1 => "ProfileRalph",
  40.     2 => "ProfileUlrika",
  41.     3 => "ProfileBennett",
  42.     4 => "ProfileYlva",
  43.   } # Remove this and perish.
  44.  
  45.   # This is the text used to write out various skill menu text items.
  46.   MENU_TEXT_SKILL_TITLE   = "Abilities"
  47.   MENU_TEXT_SKILL_DATA    = "Data"
  48.   MENU_TEXT_SKILL_LIST    = "Skills List"
  49. end
  50.  
  51. #==============================================================================
  52. # ** Window_Base
  53. #==============================================================================
  54.  
  55. class Window_Base < Window
  56.   #--------------------------------------------------------------------------
  57.   # * Object Initialization
  58.   #--------------------------------------------------------------------------
  59.   alias initialize_sss_ff13_skill_menu_window_base initialize unless $@
  60.   def initialize(x, y, width, height)
  61.     initialize_sss_ff13_skill_menu_window_base(x, y, width, height)
  62.     self.opacity = 0 if $scene.is_a?(Scene_Skill)
  63.   end
  64. end
  65.  
  66. #==============================================================================
  67. # ** Window_Selectable
  68. #==============================================================================
  69.  
  70. class Window_Selectable < Window_Base
  71.   #--------------------------------------------------------------------------
  72.   # * Public Instance Variables
  73.   #--------------------------------------------------------------------------
  74.   attr_accessor :column_max
  75. end
  76.  
  77. #==============================================================================
  78. # ** Window_MenuHelp
  79. #==============================================================================
  80.  
  81. class Window_MenuHelp < Window_Help
  82.   #--------------------------------------------------------------------------
  83.   # * Set Text
  84.   #--------------------------------------------------------------------------
  85.   def set_text(text, align = 0)
  86.     if text != @text or align != @align
  87.       self.contents.clear
  88.       self.contents.font.shadow = false
  89.       self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
  90.       self.contents.draw_text(4, 0, self.width - 40, WLH, text, align)
  91.       @text = text
  92.       @align = align
  93.     end
  94.   end
  95. end
  96.  
  97. #==============================================================================
  98. # ** Window_MenuTimer
  99. #==============================================================================
  100.  
  101. class Window_MenuTimer < Window_Base
  102.   #--------------------------------------------------------------------------
  103.   # * Object Initialization
  104.   #--------------------------------------------------------------------------
  105.   def initialize
  106.     super(0, Graphics.height - 60, 120, 56)
  107.     self.contents.font.size = Font.default_size - 4
  108.     self.contents.font.shadow = false
  109.     self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
  110.     refresh
  111.   end
  112.   #--------------------------------------------------------------------------
  113.   # * Refresh
  114.   #--------------------------------------------------------------------------
  115.   def refresh
  116.     self.contents.clear
  117.     format = "%03d:%02d:%02d"
  118.     @game_time = Graphics.frame_count / Graphics.frame_rate
  119.     hours = @game_time / 3600
  120.     minutes = @game_time / 60 % 60
  121.     seconds = @game_time % 60
  122.     text = sprintf(format, hours, minutes, seconds)
  123.     self.contents.draw_text(0, 0, contents.width-4, WLH, text, 2)
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # * Update
  127.   #--------------------------------------------------------------------------
  128.   def update
  129.     super
  130.     refresh if @game_time != (Graphics.frame_count / Graphics.frame_rate)
  131.   end
  132. end
  133.  
  134. #==============================================================================
  135. # ** Window_MenuGold
  136. #==============================================================================
  137.  
  138. class Window_MenuGold < Window_Base
  139.   #--------------------------------------------------------------------------
  140.   # * Object Initialization
  141.   #--------------------------------------------------------------------------
  142.   def initialize
  143.     super(100, Graphics.height - 60, 120, 56)
  144.     self.contents.font.size = Font.default_size - 4
  145.     self.contents.font.shadow = false
  146.     self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
  147.     refresh
  148.   end
  149.   #--------------------------------------------------------------------------
  150.   # * Refresh
  151.   #--------------------------------------------------------------------------
  152.   def refresh
  153.     self.contents.clear
  154.     text = sprintf("%d%s", $game_party.gold, Vocab.gold)
  155.     self.contents.draw_text(0, 0, contents.width-4, WLH, text, 0)
  156.   end
  157. end
  158.  
  159. #==============================================================================
  160. # ** Window_MenuLocation
  161. #==============================================================================
  162.  
  163. class Window_MenuLocation < Window_Base
  164.   #--------------------------------------------------------------------------
  165.   # * Object Initialization
  166.   #--------------------------------------------------------------------------
  167.   def initialize
  168.     super(Graphics.width/2-16, Graphics.height - 60, Graphics.width/2+16, 56)
  169.     self.contents.font.size = Font.default_size - 4
  170.     self.contents.font.shadow = false
  171.     self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
  172.     refresh
  173.   end
  174.   #--------------------------------------------------------------------------
  175.   # * Refresh
  176.   #--------------------------------------------------------------------------
  177.   def refresh
  178.     self.contents.clear
  179.     text = sprintf(SSS::MENU_LOCATION, $game_map.map_name)
  180.     self.contents.draw_text(4, 0, contents.width, WLH, text, 0)
  181.   end
  182. end
  183.  
  184. #==============================================================================
  185. # ** Window_Underscore
  186. #==============================================================================
  187.  
  188. class Window_Underscore < Window_Base
  189.   #--------------------------------------------------------------------------
  190.   # * Object Initialization
  191.   #--------------------------------------------------------------------------
  192.   def initialize(align = 0)
  193.     super(0, 0, Graphics.width, 56)
  194.     @align = align
  195.     refresh
  196.   end
  197.   #--------------------------------------------------------------------------
  198.   # * Refresh
  199.   #--------------------------------------------------------------------------
  200.   def refresh
  201.     self.contents.clear
  202.     self.contents.font.name = ["UmePlus Gothic", "Courier New"]
  203.     self.contents.font.size += 4
  204.     text = "―――――――――――――――――――――――――――――――――――――――――――――――――――――――"
  205.     self.contents.draw_text(0, 0, contents.width, WLH, text, @align)
  206.   end
  207. end
  208.  
  209. #===============================================================================
  210. # ** Window_LearnData
  211. #===============================================================================
  212.  
  213. class Window_LearnData < Window_Base
  214.   #--------------------------------------------------------------------------
  215.   # * Get System Text Color
  216.   #--------------------------------------------------------------------------
  217.   def system_color
  218.     return text_color(0)
  219.   end
  220. end
  221.  
  222. #===============================================================================
  223. # ** Window_Actor_Skill_Status
  224. #===============================================================================
  225.  
  226. class Window_Actor_Skill_Status < Window_Base
  227.   #--------------------------------------------------------------------------
  228.   # initialize
  229.   #--------------------------------------------------------------------------
  230.   def initialize(actor)
  231.     super(-8, Graphics.height - 105, Graphics.width+16, 56)
  232.     @actor = actor
  233.     @class_id = actor.class_id
  234.     refresh
  235.   end
  236.   #--------------------------------------------------------------------------
  237.   # actor=
  238.   #--------------------------------------------------------------------------
  239.   def actor=(new_actor)
  240.     @actor = new_actor
  241.     @class_id = new_actor.class_id
  242.     refresh
  243.   end
  244.   #--------------------------------------------------------------------------
  245.   # class_id=
  246.   #--------------------------------------------------------------------------
  247.   def class_id=(new_class)
  248.     @class_id = new_class
  249.     refresh
  250.   end
  251.   #--------------------------------------------------------------------------
  252.   # refresh
  253.   #--------------------------------------------------------------------------
  254.   def refresh
  255.     self.contents.clear
  256.     dx = 0; dy = 0
  257.     draw_actor_graphic(@actor, 16, 32); dx += 32
  258.     draw_actor_name(@actor, dx, dy); dx += 124
  259.     draw_actor_hp(@actor, dx, dy); dx += 124
  260.     draw_actor_mp(@actor, dx, dy); dx += 124
  261.     draw_actor_jp(@actor, @class_id, dx, dy); dx += 124
  262.   end
  263. end
  264.  
  265. #==============================================================================
  266. # ** Scene_Skill
  267. #==============================================================================
  268.  
  269. class Scene_Skill < Scene_Base
  270.   #--------------------------------------------------------------------------
  271.   # public instance variables
  272.   #--------------------------------------------------------------------------
  273.   attr_accessor :actor
  274.   #--------------------------------------------------------------------------
  275.   # * Start
  276.   #--------------------------------------------------------------------------
  277.   alias start_sss_ff13_skill_menu start unless $@
  278.   def start
  279.     start_sss_ff13_skill_menu
  280.     start_ff13_menu_style
  281.   end
  282.   #--------------------------------------------------------------------------
  283.   # * Start Final Fantasy 13 Menu Style
  284.   #--------------------------------------------------------------------------
  285.   def start_ff13_menu_style
  286.     @menuback_sprite.z = @viewport.z - 1 unless @viewport.nil?
  287.     @profile_back_sprite.z = @viewport.z - 1 unless @viewport.nil?
  288.     @gold_window = Window_MenuGold.new
  289.     @gold_window.viewport = @viewport
  290.     @menu_timer_window = Window_MenuTimer.new
  291.     @menu_timer_window.viewport = @viewport
  292.     @location_window = Window_MenuLocation.new
  293.     @location_window.viewport = @viewport
  294.     @help_window.dispose
  295.     @help_window = Window_MenuHelp.new
  296.     @help_window.x += 48
  297.     @help_window.width -= 48
  298.     @help_window.create_contents
  299.     @help_window.contents.font.size = Font.default_size - 4
  300.     @help_window.viewport = @viewport
  301.     for window in @windows
  302.       next unless window.is_a?(Window_Selectable)
  303.       window.help_window = @help_window
  304.     end
  305.     @command_window.y = @help_window.height+2
  306.     @command_window.height = 24*3+32
  307.     @command_window.x = 0
  308.     # Resize Skill Window
  309.     @skill_window.width = Graphics.width - 240 - 16
  310.     @skill_window.height = Graphics.height - 56 - 65
  311.     @skill_window.height = (@skill_window.height-32)/24
  312.     @skill_window.height = (@skill_window.height) * 24 + 32
  313.     @skill_window.column_max = 1
  314.     @skill_window.refresh
  315.     @skill_window.index = 0
  316.     # Create Skill Data Window
  317.     @skill_data = Window_LearnData.new(@actor, @skill_window)
  318.     @skill_data.height = 7 * 24 + 32
  319.     @skill_data.create_contents
  320.     @skill_data.refresh
  321.     @skill_data.active = false
  322.     @skill_data.viewport = @viewport
  323.     @windows.push(@skill_data)
  324.     # Resize Other Windows
  325.     unless @learn_window.nil?
  326.       @learn_window.width = @skill_window.width
  327.       @learn_window.height = @skill_window.height
  328.       @learn_data.height = @skill_data.height
  329.       @learn_data.create_contents
  330.       @learn_window.refresh
  331.       @learn_data.refresh
  332.     end
  333.     unless @passive_window.nil?
  334.       @passive_window.width = @skill_window.width
  335.       @passive_window.height = @skill_window.height
  336.       @passive_data.height = @skill_data.height
  337.       @passive_data.create_contents
  338.       @passive_window.refresh
  339.       @passive_data.refresh
  340.     end
  341.     unless @equip_skill_window.nil?
  342.       @equip_skill_window.width = @skill_window.width
  343.       @equip_skill_window.height = @skill_window.height
  344.       @equip_skill_data.height = @skill_window.height
  345.       @equip_skill_data.create_contents
  346.       @equip_skill_window.refresh
  347.       @equip_skill_data.refresh
  348.     end
  349.     # Create Other Stuff
  350.     create_underscore_windows
  351.     create_dummy_text_windows
  352.     create_item_image
  353.     update_windows
  354.   end
  355.   #--------------------------------------------------------------------------
  356.   # * Create Underscore Windows
  357.   #--------------------------------------------------------------------------
  358.   def create_underscore_windows
  359.     @underscore_window1 = Window_Underscore.new(2)
  360.     @underscore_window1.y = @command_window.y - 14
  361.     @underscore_window1.x = -Graphics.width+168
  362.     @underscore_window1.viewport = @viewport
  363.     @underscore_window2 = Window_Underscore.new(2)
  364.     @underscore_window2.y = @command_window.y + @command_window.height - 40
  365.     @underscore_window2.x = -Graphics.width+240
  366.     @underscore_window2.viewport = @viewport
  367.     @underscore_window3 = Window_Underscore.new(0)
  368.     @underscore_window3.y = @command_window.y - 14
  369.     @underscore_window3.x = Graphics.width-286-16
  370.     @underscore_window3.viewport = @viewport
  371.   end
  372.   #--------------------------------------------------------------------------
  373.   # * Create Dummy Text Windows
  374.   #--------------------------------------------------------------------------
  375.   def create_dummy_text_windows
  376.     # Upper Left
  377.     @dummy_stats1_window = Window_Base.new(0, 0, Graphics.width, 56)
  378.     @dummy_stats1_window.contents.font.size = YEM::SKILL::LEARN_DATA[:fontsize]
  379.     rect = Rect.new(0, 0, @dummy_stats1_window.contents.width, 24)
  380.     text = SSS::MENU_TEXT_SKILL_TITLE
  381.     @dummy_stats1_window.contents.draw_text(rect, text, 2)
  382.     @dummy_stats1_window.x = @underscore_window1.x-4
  383.     @dummy_stats1_window.y = @underscore_window1.y-8
  384.     @dummy_stats1_window.viewport = @viewport
  385.     # Lower Left
  386.     @dummy_stats2_window = Window_Base.new(0, 0, Graphics.width, 56)
  387.     @dummy_stats2_window.contents.font.size = YEM::SKILL::LEARN_DATA[:fontsize]
  388.     rect = Rect.new(0, 0, @dummy_stats1_window.contents.width, 24)
  389.     text = SSS::MENU_TEXT_SKILL_DATA
  390.     @dummy_stats2_window.contents.draw_text(rect, text, 2)
  391.     @dummy_stats2_window.x = @underscore_window2.x-4
  392.     @dummy_stats2_window.y = @underscore_window2.y-8
  393.     @dummy_stats2_window.viewport = @viewport
  394.     # Upper Left
  395.     @dummy_stats3_window = Window_Base.new(0, 0, Graphics.width, 56)
  396.     @dummy_stats3_window.contents.font.size = YEM::SKILL::LEARN_DATA[:fontsize]
  397.     rect = Rect.new(0, 0, @dummy_stats1_window.contents.width, 24)
  398.     text = SSS::MENU_TEXT_SKILL_LIST
  399.     @dummy_stats3_window.contents.draw_text(rect, text, 0)
  400.     @dummy_stats3_window.x = @underscore_window3.x+4
  401.     @dummy_stats3_window.y = @underscore_window3.y-8
  402.     @dummy_stats3_window.viewport = @viewport
  403.   end
  404.   #--------------------------------------------------------------------------
  405.   # * Create Item Image
  406.   #--------------------------------------------------------------------------
  407.   def create_item_image
  408.     @item_back_sprite = Sprite.new
  409.     bitmap_w = 286
  410.     bitmap_h = (@skill_window.height-32)/24
  411.     @item_back_sprite.bitmap = Bitmap.new(bitmap_w, bitmap_h*24)
  412.     rect = Rect.new(0, 0, 286, 24)
  413.     source = Cache.system(SSS::MENU_BACK_PROFILE_ITEM)
  414.     yy = 0
  415.     bitmap_h.times do
  416.       @item_back_sprite.bitmap.blt(0, yy, source, rect)
  417.       yy += 24
  418.     end
  419.     @item_back_sprite.viewport = @viewport
  420.   end
  421.   #--------------------------------------------------------------------------
  422.   # * Termination Processing
  423.   #--------------------------------------------------------------------------
  424.   alias terminate_sss_ff13_skill_menu terminate unless $@
  425.   def terminate
  426.     @gold_window.dispose
  427.     @menu_timer_window.dispose
  428.     @location_window.dispose
  429.     @profile_back_sprite.bitmap.dispose
  430.     @profile_back_sprite.dispose
  431.     @underscore_window1.dispose
  432.     @underscore_window2.dispose
  433.     @underscore_window3.dispose
  434.     @dummy_stats1_window.dispose
  435.     @dummy_stats2_window.dispose
  436.     @dummy_stats3_window.dispose
  437.     @skill_data.dispose
  438.     terminate_sss_ff13_skill_menu
  439.   end
  440.   #--------------------------------------------------------------------------
  441.   # * Update Background for Menu Screen
  442.   #--------------------------------------------------------------------------
  443.   def update_menu_background
  444.     super
  445.     @gold_window.update unless @gold_window.nil?
  446.     @menu_timer_window.update unless @menu_timer_window.nil?
  447.     @profile_back_sprite.update unless @profile_back_sprite.nil?
  448.   end
  449.   #--------------------------------------------------------------------------
  450.   # * Create Background for Menu Screen
  451.   #--------------------------------------------------------------------------
  452.   def create_menu_background
  453.     @menuback_sprite.dispose unless @menuback_sprite.nil?
  454.     @menuback_sprite = Sprite.new
  455.     @menuback_sprite.z = @viewport.z - 1 unless @viewport.nil?
  456.     @actor = $game_party.members[@actor_index]
  457.     filename = SSS::MENU_PROFILE_IMAGES[@actor.id]
  458.     filename = SSS::MENU_PROFILE_IMAGES[1] if filename.nil?
  459.     @menuback_sprite.bitmap = Cache.system(filename)
  460.     blur_times = 2
  461.     blur_times.times do @menuback_sprite.bitmap.blur end
  462.     @menuback_sprite.color.set(16, 16, 16, 64)
  463.     @profile_back_sprite.dispose unless @profile_back_sprite.nil?
  464.     @profile_back_sprite = Sprite.new
  465.     @profile_back_sprite.bitmap = Cache.system(SSS::MENU_BACK_PROFILE_IMAGE)
  466.     @profile_back_sprite.z = @viewport.z - 1 unless @viewport.nil?
  467.     update_menu_background
  468.   end
  469.   #--------------------------------------------------------------------------
  470.   # new method: show_view_skills
  471.   #--------------------------------------------------------------------------
  472.   def show_view_skills
  473.     @help_window.y = 12
  474.     @skill_window.y = @command_window.y
  475.     @skill_window.x = Graphics.width - @skill_window.width + 8
  476.     unless @skill_data.nil?
  477.       @skill_data.y = @command_window.y + @command_window.height - 24
  478.       @skill_data.x = 0
  479.     end
  480.     @skill_window.update_help
  481.     unless @item_back_sprite.nil?
  482.       @item_back_sprite.x = Graphics.width - 286
  483.       @item_back_sprite.y = @skill_window.y + 16
  484.     end
  485.   end
  486.   #--------------------------------------------------------------------------
  487.   # new method: show_learn_skill
  488.   #--------------------------------------------------------------------------
  489.   def show_learn_skill
  490.     @help_window.y = 12
  491.     @learn_window.y = @command_window.y
  492.     @learn_window.x = Graphics.width - @learn_window.width + 8
  493.     @learn_data.y = @command_window.y + @command_window.height - 24
  494.     @learn_data.x = 0
  495.     @learn_window.update_help
  496.     unless @item_back_sprite.nil?
  497.       @item_back_sprite.x = Graphics.width - 286
  498.       @item_back_sprite.y = @learn_window.y + 16
  499.     end
  500.   end
  501.   #--------------------------------------------------------------------------
  502.   # new method: show_learn_passive
  503.   #--------------------------------------------------------------------------
  504.   def show_learn_passive
  505.     @help_window.y = 12
  506.     @passive_window.y = @command_window.y
  507.     @passive_window.x = Graphics.width - @passive_window.width + 8
  508.     @passive_data.y = @command_window.y + @command_window.height - 24
  509.     @passive_data.x = 0
  510.     @passive_window.update_help
  511.     unless @item_back_sprite.nil?
  512.       @item_back_sprite.x = Graphics.width - 286
  513.       @item_back_sprite.y = @passive_window.y + 16
  514.     end
  515.   end
  516.   #--------------------------------------------------------------------------
  517.   # new method: show_equip_skill_windows
  518.   #--------------------------------------------------------------------------
  519.   if $imported["SkillEquipSystem"]
  520.   def show_equip_skill_windows
  521.     @help_window.y = 12
  522.     @equip_skill_window.y = @command_window.y
  523.     @equip_skill_window.x = Graphics.width - @equip_skill_window.width + 8
  524.     @equip_skill_data.y = @command_window.y + @command_window.height - 24
  525.     @passive_data.x = 0
  526.     @equip_skill_window.update_help
  527.     unless @item_back_sprite.nil?
  528.       @item_back_sprite.x = Graphics.width - 286
  529.       @item_back_sprite.y = @equip_skill_window.y + 16
  530.     end
  531.   end
  532.   end
  533.   #--------------------------------------------------------------------------
  534.   # * Set New Actor
  535.   #--------------------------------------------------------------------------
  536.   alias set_new_actor_sss_ff13_skill_menu set_new_actor unless $@
  537.   def set_new_actor
  538.     set_new_actor_sss_ff13_skill_menu
  539.     Graphics.freeze
  540.     create_menu_background
  541.     Graphics.transition(10)
  542.   end
  543.   #--------------------------------------------------------------------------
  544.   # * Update Skill Selection
  545.   #--------------------------------------------------------------------------
  546.   alias update_skill_selection_sss_ff13_skill_menu update_skill_selection
  547.   def update_skill_selection
  548.     @skill_data.update
  549.     update_skill_selection_sss_ff13_skill_menu
  550.   end
  551.   #--------------------------------------------------------------------------
  552.   # * Show Target Window
  553.   #--------------------------------------------------------------------------
  554.   alias show_target_window_sss_ff13_skill_menu show_target_window unless $@
  555.   def show_target_window(right)
  556.     show_target_window_sss_ff13_skill_menu(true)
  557.   end
  558. end
  559.  
  560. #===============================================================================
  561. #
  562. # END OF FILE
  563. #
  564. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement