Advertisement
modern_algebra

SSS Status Menu

Jul 9th, 2011
1,630
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 19.59 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # Shanghai Simple Script - Final Fantasy 13 Status Menu
  4. # Last Date Updated: 2010.06.26
  5. # Level: Normal
  6. #
  7. # NOTE! This requires Yanfly Engine Melody's Status Menu Melody script to be
  8. # installed and located above this script to work. This makes your status 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["FinalFantasy13StatusMenu"] = 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 status menu text items.
  46.   MENU_STATUS_OPTIONS = "Options"
  47.   MENU_STATUS_PARAM = "Parameters"
  48.   MENU_STATUS_BOOSTER = "Boost Items"
  49.   MENU_STATUS_ELEMENT = "Element Items"
  50.   MENU_STATUS_STATES = "Status Items"
  51.  
  52. end
  53.  
  54. #==============================================================================
  55. # ** Game_Actor
  56. #==============================================================================
  57.  
  58. class Game_Actor < Game_Battler
  59.   #--------------------------------------------------------------------------
  60.   # * Public Instance Variables
  61.   #--------------------------------------------------------------------------
  62.   attr_accessor :boost_dex
  63.   attr_accessor :boost_res
  64. end
  65.  
  66. #==============================================================================
  67. # ** Window_Base
  68. #==============================================================================
  69.  
  70. class Window_Base < Window
  71.   #--------------------------------------------------------------------------
  72.   # * Object Initialization
  73.   #--------------------------------------------------------------------------
  74.   alias initialize_sss_ff13_status_menu_window_base initialize unless $@
  75.   def initialize(x, y, width, height)
  76.     initialize_sss_ff13_status_menu_window_base(x, y, width, height)
  77.     self.opacity = 0 if $scene.is_a?(Scene_Status)
  78.   end
  79. end
  80.  
  81. #==============================================================================
  82. # ** Window_Actor_Status
  83. #==============================================================================
  84.  
  85. class Window_Actor_Status < Window_Base
  86.   #--------------------------------------------------------------------------
  87.   # refresh
  88.   #--------------------------------------------------------------------------
  89.   def refresh
  90.     self.contents.clear
  91.     dx = 120; dy = 0
  92.     difference = contents.width-124-dx-4
  93.     draw_actor_name(@actor, dx, dy)
  94.     draw_actor_class(@actor, contents.width-124, dy)
  95.     draw_actor_level(@actor, dx, dy + WLH * 1)
  96.     draw_actor_hp(@actor, contents.width-124, dy + WLH * 1)
  97.     draw_actor_mp(@actor, contents.width-124, dy + WLH * 2)
  98.     draw_actor_exp(@actor, dx, dy + WLH * 2, difference)
  99.   end
  100. end
  101.  
  102. #==============================================================================
  103. # ** Window_Underscore
  104. #==============================================================================
  105.  
  106. class Window_Underscore < Window_Base
  107.   #--------------------------------------------------------------------------
  108.   # * Object Initialization
  109.   #--------------------------------------------------------------------------
  110.   def initialize(align = 0)
  111.     super(0, 0, Graphics.width, 56)
  112.     @align = align
  113.     refresh
  114.   end
  115.   #--------------------------------------------------------------------------
  116.   # * Refresh
  117.   #--------------------------------------------------------------------------
  118.   def refresh
  119.     self.contents.clear
  120.     self.contents.font.name = ["UmePlus Gothic", "Courier New"]
  121.     self.contents.font.size += 4
  122.     text = "―――――――――――――――――――――――――――――――――――――――――――――――――――――――"
  123.     self.contents.draw_text(0, 0, contents.width, WLH, text, @align)
  124.   end
  125. end
  126.  
  127. #==============================================================================
  128. # ** Window_MenuHelp
  129. #==============================================================================
  130.  
  131. class Window_MenuHelp < Window_Help
  132.   #--------------------------------------------------------------------------
  133.   # * Set Text
  134.   #--------------------------------------------------------------------------
  135.   def set_text(text, align = 0)
  136.     if text != @text or align != @align
  137.       self.contents.clear
  138.       self.contents.font.shadow = false
  139.       self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
  140.       self.contents.draw_text(4, 0, self.width - 40, WLH, text, align)
  141.       @text = text
  142.       @align = align
  143.     end
  144.   end
  145. end
  146.  
  147. #==============================================================================
  148. # ** Window_MenuTimer
  149. #==============================================================================
  150.  
  151. class Window_MenuTimer < Window_Base
  152.   #--------------------------------------------------------------------------
  153.   # * Object Initialization
  154.   #--------------------------------------------------------------------------
  155.   def initialize
  156.     super(0, Graphics.height - 60, 120, 56)
  157.     self.contents.font.size = Font.default_size - 4
  158.     self.contents.font.shadow = false
  159.     self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
  160.     refresh
  161.   end
  162.   #--------------------------------------------------------------------------
  163.   # * Refresh
  164.   #--------------------------------------------------------------------------
  165.   def refresh
  166.     self.contents.clear
  167.     format = "%03d:%02d:%02d"
  168.     @game_time = Graphics.frame_count / Graphics.frame_rate
  169.     hours = @game_time / 3600
  170.     minutes = @game_time / 60 % 60
  171.     seconds = @game_time % 60
  172.     text = sprintf(format, hours, minutes, seconds)
  173.     self.contents.draw_text(0, 0, contents.width-4, WLH, text, 2)
  174.   end
  175.   #--------------------------------------------------------------------------
  176.   # * Update
  177.   #--------------------------------------------------------------------------
  178.   def update
  179.     super
  180.     refresh if @game_time != (Graphics.frame_count / Graphics.frame_rate)
  181.   end
  182. end
  183.  
  184. #==============================================================================
  185. # ** Window_MenuGold
  186. #==============================================================================
  187.  
  188. class Window_MenuGold < Window_Base
  189.   #--------------------------------------------------------------------------
  190.   # * Object Initialization
  191.   #--------------------------------------------------------------------------
  192.   def initialize
  193.     super(100, Graphics.height - 60, 120, 56)
  194.     self.contents.font.size = Font.default_size - 4
  195.     self.contents.font.shadow = false
  196.     self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
  197.     refresh
  198.   end
  199.   #--------------------------------------------------------------------------
  200.   # * Refresh
  201.   #--------------------------------------------------------------------------
  202.   def refresh
  203.     self.contents.clear
  204.     text = sprintf("%d%s", $game_party.gold, Vocab.gold)
  205.     self.contents.draw_text(0, 0, contents.width-4, WLH, text, 0)
  206.   end
  207. end
  208.  
  209. #==============================================================================
  210. # ** Window_MenuLocation
  211. #==============================================================================
  212.  
  213. class Window_MenuLocation < Window_Base
  214.   #--------------------------------------------------------------------------
  215.   # * Object Initialization
  216.   #--------------------------------------------------------------------------
  217.   def initialize
  218.     super(Graphics.width/2-16, Graphics.height - 60, Graphics.width/2+16, 56)
  219.     self.contents.font.size = Font.default_size - 4
  220.     self.contents.font.shadow = false
  221.     self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
  222.     refresh
  223.   end
  224.   #--------------------------------------------------------------------------
  225.   # * Refresh
  226.   #--------------------------------------------------------------------------
  227.   def refresh
  228.     self.contents.clear
  229.     text = sprintf(SSS::MENU_LOCATION, $game_map.map_name)
  230.     self.contents.draw_text(4, 0, contents.width, WLH, text, 0)
  231.   end
  232. end
  233.  
  234.  
  235. #===============================================================================
  236. # Override Status Menu Melody Settings
  237. #===============================================================================
  238.  
  239. YEM::STATUS::BOOSTER_FONT_SIZE = 16
  240. YEM::STATUS::COMMANDS = [:boosters, :elements, :states]
  241.  
  242. #==============================================================================
  243. # ** Scene_Status
  244. #==============================================================================
  245.  
  246. class Scene_Status < Scene_Base
  247.   #--------------------------------------------------------------------------
  248.   # public instance variables
  249.   #--------------------------------------------------------------------------
  250.   attr_accessor :actor
  251.   #--------------------------------------------------------------------------
  252.   # * Start processing
  253.   #--------------------------------------------------------------------------
  254.   alias start_sss_ff13_status_menu start unless $@
  255.   def start
  256.     for member in $game_party.members
  257.       member.boost_dex = 0 if member.boost_dex == nil
  258.       member.boost_res = 0 if member.boost_res == nil
  259.     end
  260.     start_sss_ff13_status_menu
  261.     start_ff13_menu_style
  262.   end
  263.   #--------------------------------------------------------------------------
  264.   # * Start Final Fantasy 13 Menu Style
  265.   #--------------------------------------------------------------------------
  266.   def start_ff13_menu_style
  267.     @gold_window = Window_MenuGold.new
  268.     @menu_timer_window = Window_MenuTimer.new
  269.     @location_window = Window_MenuLocation.new
  270.     @help_window.dispose
  271.     @help_window = Window_MenuHelp.new
  272.     @help_window.x += 48
  273.     @help_window.width -= 48
  274.     @help_window.create_contents
  275.     @help_window.contents.font.size = Font.default_size - 4
  276.     for window in @windows
  277.       next unless window.is_a?(Window_Selectable)
  278.       window.help_window = @help_window
  279.     end
  280.     @command_window.y = @help_window.height+2
  281.     @command_window.height = 24*3+32
  282.     @command_window.x += (Graphics.width-240-@command_window.width-32)/2
  283.     @help_window.y += 12
  284.     @status_window.y = @command_window.y - 16
  285.     @status_window.x += 16
  286.     unless @boosters_window.nil?
  287.       @boosters_window.x += 8
  288.       @boosters_window.width -= 16
  289.       @boosters_window.create_contents
  290.       @boosters_window.refresh
  291.     end
  292.     unless @elements_window.nil?
  293.       @elements_window.x += 8
  294.       @elements_window.width -= 16
  295.       @elements_window.create_contents
  296.       @elements_window.refresh
  297.     end
  298.     unless @states_window.nil?
  299.       @states_window.x += 8
  300.       @states_window.width -= 16
  301.       @states_window.create_contents
  302.       @states_window.refresh
  303.     end
  304.     create_underscore_windows
  305.     create_dummy_text_windows
  306.     create_item_image
  307.     update_visible_windows
  308.   end
  309.   #--------------------------------------------------------------------------
  310.   # * Create Underscore Windows
  311.   #--------------------------------------------------------------------------
  312.   def create_underscore_windows
  313.     @underscore_window1 = Window_Underscore.new(2)
  314.     @underscore_window2 = Window_Underscore.new(0)
  315.     @underscore_window3 = Window_Underscore.new(0)
  316.     @underscore_window1.y = @command_window.y + @command_window.height - 40
  317.     @underscore_window1.x = -Graphics.width/3-60
  318.     @underscore_window2.y = @command_window.y + @command_window.height - 40
  319.     @underscore_window2.x = @underscore_window1.x + @underscore_window1.width-2
  320.     @underscore_window3.x = @underscore_window1.x
  321.     @underscore_window3.y = @help_window.y + @help_window.height-24
  322.   end
  323.   #--------------------------------------------------------------------------
  324.   # * Create Dummy Text Windows
  325.   #--------------------------------------------------------------------------
  326.   def create_dummy_text_windows
  327.     # Lower Left
  328.     @dummy_stats1_window = Window_Base.new(0, 0, Graphics.width, 56)
  329.     @dummy_stats1_window.contents.font.size = YEM::EQUIP::STAT_FONT_SIZE
  330.     rect = Rect.new(0, 0, @dummy_stats1_window.contents.width, 24)
  331.     text = SSS::MENU_STATUS_BOOSTER
  332.     @dummy_stats1_window.contents.draw_text(rect, text, 2)
  333.     @dummy_stats1_window.x = @underscore_window1.x-4
  334.     @dummy_stats1_window.y = @underscore_window1.y-8
  335.     # Lower Right
  336.     @dummy_stats2_window = Window_Base.new(0, 0, Graphics.width, 56)
  337.     @dummy_stats2_window.contents.font.size = YEM::EQUIP::STAT_FONT_SIZE
  338.     rect = Rect.new(0, 0, @dummy_stats2_window.contents.width, 24)
  339.     text = SSS::MENU_STATUS_PARAM
  340.     @dummy_stats2_window.contents.draw_text(rect, text, 0)
  341.     @dummy_stats2_window.x = @underscore_window2.x+4
  342.     @dummy_stats2_window.y = @underscore_window2.y-8
  343.     # Upper Left
  344.     @dummy_stats3_window = Window_Base.new(0, 0, Graphics.width, 56)
  345.     @dummy_stats3_window.contents.font.size = YEM::EQUIP::STAT_FONT_SIZE
  346.     rect = Rect.new(0, 0, @dummy_stats3_window.contents.width, 24)
  347.     text = SSS::MENU_STATUS_OPTIONS
  348.     @dummy_stats3_window.contents.draw_text(rect, text, 2)
  349.     @dummy_stats3_window.x = @underscore_window3.x-4
  350.     @dummy_stats3_window.y = @underscore_window3.y-8
  351.   end
  352.   #--------------------------------------------------------------------------
  353.   # * Create Item Image
  354.   #--------------------------------------------------------------------------
  355.   def create_item_image
  356.     @item_back_sprite = Sprite.new
  357.     bitmap_w = 286
  358.     item_window_height = @command_window.y + @command_window.height - 25
  359.     bitmap_h = @boosters_window.nil? ? 8 : (@boosters_window.height-32)/24
  360.     @item_back_sprite.bitmap = Bitmap.new(bitmap_w, bitmap_h*24)
  361.     rect = Rect.new(0, 0, 286, 24)
  362.     source = Cache.system(SSS::MENU_BACK_PROFILE_ITEM)
  363.     yy = 0
  364.     bitmap_h.times do
  365.       @item_back_sprite.bitmap.blt(0, yy, source, rect)
  366.       yy += 24
  367.     end
  368.   end
  369.   #--------------------------------------------------------------------------
  370.   # * Termination Processing
  371.   #--------------------------------------------------------------------------
  372.   alias terminate_sss_ff13_status_menu terminate unless $@
  373.   def terminate
  374.     @gold_window.dispose
  375.     @menu_timer_window.dispose
  376.     @profile_back_sprite.bitmap.dispose
  377.     @profile_back_sprite.dispose
  378.     @location_window.dispose
  379.     @underscore_window1.dispose
  380.     @underscore_window2.dispose
  381.     @underscore_window3.dispose
  382.     @dummy_stats1_window.dispose
  383.     @dummy_stats2_window.dispose
  384.     @dummy_stats3_window.dispose
  385.     @item_back_sprite.bitmap.dispose
  386.     @item_back_sprite.dispose
  387.     terminate_sss_ff13_status_menu
  388.   end
  389.   #--------------------------------------------------------------------------
  390.   # * Create Background for Menu Screen
  391.   #--------------------------------------------------------------------------
  392.   def create_menu_background
  393.     @menuback_sprite.dispose unless @menuback_sprite.nil?
  394.     @menuback_sprite = Sprite.new
  395.     @actor = $game_party.members[@actor_index]
  396.     filename = SSS::MENU_PROFILE_IMAGES[@actor.id]
  397.     filename = SSS::MENU_PROFILE_IMAGES[1] if filename.nil?
  398.     @menuback_sprite.bitmap = Cache.system(filename)
  399.     blur_times = 2
  400.     blur_times.times do @menuback_sprite.bitmap.blur end
  401.     @menuback_sprite.color.set(16, 16, 16, 64)
  402.     @profile_back_sprite.dispose unless @profile_back_sprite.nil?
  403.     @profile_back_sprite = Sprite.new
  404.     @profile_back_sprite.bitmap = Cache.system(SSS::MENU_BACK_PROFILE_IMAGE)
  405.     update_menu_background
  406.   end
  407.   #--------------------------------------------------------------------------
  408.   # * Update Background for Menu Screen
  409.   #--------------------------------------------------------------------------
  410.   def update_menu_background
  411.     super
  412.     @gold_window.update unless @gold_window.nil?
  413.     @menu_timer_window.update unless @menu_timer_window.nil?
  414.     @profile_back_sprite.update unless @profile_back_sprite.nil?
  415.   end
  416.   #--------------------------------------------------------------------------
  417.   # * Update Visible Windows
  418.   #--------------------------------------------------------------------------
  419.   def update_visible_windows
  420.     @help_window.y = Graphics.height * 8
  421.     for window in @windows; window.y = Graphics.height * 8; end
  422.     @item_back_sprite.y = Graphics.height*8 unless @item_back_sprite.nil?
  423.     item_window_height = @command_window.y + @command_window.height - 25
  424.     case @data[@command_window.index]
  425.     when :general
  426.       @general_window.y = @command_window.height
  427.     when :boosters
  428.       @help_window.y = 12
  429.       @boosters_window.y = item_window_height
  430.       @boosters_stats.y = item_window_height
  431.       @boosters_window.update_help
  432.       unless @dummy_stats1_window.nil?
  433.         @dummy_stats1_window.contents.clear
  434.         rect = Rect.new(0, 0, @dummy_stats1_window.contents.width, 24)
  435.         text = SSS::MENU_STATUS_BOOSTER
  436.         @dummy_stats1_window.contents.draw_text(rect, text, 2)
  437.       end
  438.       unless @item_back_sprite.nil?
  439.         @item_back_sprite.y = item_window_height+16
  440.       end
  441.     when :elements
  442.       @help_window.y = 12
  443.       @elements_window.y = item_window_height
  444.       @elements_stats.y = item_window_height
  445.       @elements_window.update_help
  446.       unless @dummy_stats1_window.nil?
  447.         @dummy_stats1_window.contents.clear
  448.         rect = Rect.new(0, 0, @dummy_stats1_window.contents.width, 24)
  449.         text = SSS::MENU_STATUS_ELEMENT
  450.         @dummy_stats1_window.contents.draw_text(rect, text, 2)
  451.       end
  452.       unless @item_back_sprite.nil?
  453.         @item_back_sprite.y = item_window_height+16
  454.       end
  455.     when :states
  456.       @help_window.y = 12
  457.       @states_window.y = item_window_height
  458.       @states_stats.y = item_window_height
  459.       @states_window.update_help
  460.       unless @dummy_stats1_window.nil?
  461.         @dummy_stats1_window.contents.clear
  462.         rect = Rect.new(0, 0, @dummy_stats1_window.contents.width, 24)
  463.         text = SSS::MENU_STATUS_STATES
  464.         @dummy_stats1_window.contents.draw_text(rect, text, 2)
  465.       end
  466.       unless @item_back_sprite.nil?
  467.         @item_back_sprite.y = item_window_height+16
  468.       end
  469.     end
  470.   end
  471.   #--------------------------------------------------------------------------
  472.   # * Set New Actor
  473.   #--------------------------------------------------------------------------
  474.   alias set_new_actor_sss_ff13_status_menu set_new_actor unless $@
  475.   def set_new_actor
  476.     set_new_actor_sss_ff13_status_menu
  477.     Graphics.freeze
  478.     create_menu_background
  479.     Graphics.transition(10)
  480.   end
  481. end
  482.  
  483. #===============================================================================
  484. #
  485. # END OF FILE
  486. #
  487. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement