Advertisement
mikb89

[Ace] Shangai FF13 Status Menu per MihaChan

Apr 23rd, 2012
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 12.33 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. # Converted by mikb89 to work for VX Ace.
  8. # UNOFFICIAL porting, all credits go to Shangai.
  9. #===============================================================================
  10. # Instructions
  11. # -----------------------------------------------------------------------------
  12. # To install this script, open up your script editor and copy/paste this script
  13. # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
  14. #
  15. #===============================================================================
  16.  
  17. $imported = {} if $imported == nil
  18. $imported["FinalFantasy13StatusMenu"] = true
  19.  
  20. module SSS
  21.   # This is the image used for the header and footer of the profile scenes.
  22.   # Must be 544x416 pixels or whatever resolution size you're using.
  23.   MENU_BACK_PROFILE_IMAGE = "ProfileBack"
  24.  
  25.   # This is the image used for the item back image. Must be 286x24 pixels.
  26.   MENU_BACK_PROFILE_ITEM = "ProfileItem"
  27.  
  28.   # This sets the menu help window's text color.
  29.   MENU_HELP_TEXT_COLOR = Color.new(0, 0, 0)
  30.  
  31.   # This is the text format used to write out the current map.
  32.   MENU_LOCATION = "Location: %s"
  33.  
  34.   # This hash sets the image files for your actors. These images must be placed
  35.   # inside of the Graphics\System folder and they have to be 544x416 pixels or
  36.   # whatever resolution size you're using.
  37.   MENU_PROFILE_IMAGES ={
  38.     1 => "Charas",
  39.     2 => "Charas",
  40.     3 => "Charas",
  41.     4 => "Charas",
  42.   } # Remove this and perish.
  43.  
  44.   # This is the text used to write out various status menu text items.
  45.   MENU_STATUS_OPTIONS = "Options"
  46.   MENU_STATUS_PARAM = "Parameters"
  47.   MENU_STATUS_BOOSTER = "Boost Items"
  48.   MENU_STATUS_ELEMENT = "Element Items"
  49.   MENU_STATUS_STATES = "Status Items"
  50.  
  51. end
  52.  
  53. #==============================================================================
  54. # ** Window_Base
  55. #==============================================================================
  56.  
  57. class Window_Base < Window
  58.   WLH = 24
  59.   #--------------------------------------------------------------------------
  60.   # * Object Initialization
  61.   #--------------------------------------------------------------------------
  62.   alias initialize_sss_ff13_status_menu_window_base initialize unless $@
  63.   def initialize(x, y, width, height)
  64.     initialize_sss_ff13_status_menu_window_base(x, y, width, height)
  65.     self.opacity = 0 if SceneManager.scene_is?(Scene_Status)
  66.   end
  67. end
  68.  
  69. #==============================================================================
  70. # ** Window_Actor_Status
  71. #==============================================================================
  72.  
  73. class Window_Actor_Status < Window_Base
  74.   #--------------------------------------------------------------------------
  75.   # refresh
  76.   #--------------------------------------------------------------------------
  77.   def refresh
  78.     self.contents.clear
  79.     dx = 120; dy = 0
  80.     difference = contents.width-124-dx-4
  81.     draw_actor_name(@actor, dx, dy)
  82.     draw_actor_class(@actor, contents.width-124, dy)
  83.     draw_actor_level(@actor, dx, dy + WLH * 1)
  84.     draw_actor_hp(@actor, contents.width-124, dy + WLH * 1)
  85.     draw_actor_mp(@actor, contents.width-124, dy + WLH * 2)
  86.     draw_actor_exp(@actor, dx, dy + WLH * 2, difference)
  87.   end
  88. end
  89.  
  90. #==============================================================================
  91. # ** Window_Status
  92. #==============================================================================
  93.  
  94. class Window_Status < Window_Selectable
  95.   #--------------------------------------------------------------------------
  96.   # * Refresh
  97.   #--------------------------------------------------------------------------
  98.   def refresh
  99.     contents.clear
  100.     draw_block1   (line_height * 0)
  101.     draw_horz_line(line_height * 1)
  102.     draw_block2   (line_height * 2)
  103.     draw_horz_line(line_height * 6)
  104.     draw_block3   (line_height * 7)
  105.   end
  106. end
  107.  
  108. #~ #==============================================================================
  109. #~ # ** Window_Underscore
  110. #~ #==============================================================================
  111.  
  112. #~ class Window_Underscore < Window_Base
  113. #~   #--------------------------------------------------------------------------
  114. #~   # * Object Initialization
  115. #~   #--------------------------------------------------------------------------
  116. #~   def initialize(align = 0)
  117. #~     super(0, 0, Graphics.width, 56)
  118. #~     @align = align
  119. #~     refresh
  120. #~   end
  121. #~   #--------------------------------------------------------------------------
  122. #~   # * Refresh
  123. #~   #--------------------------------------------------------------------------
  124. #~   def refresh
  125. #~     self.contents.clear
  126. #~     self.contents.font.name = ["UmePlus Gothic", "Courier New"]
  127. #~     self.contents.font.size += 4
  128. #~     text = "―――――――――――――――――――――――――――――――――――――――――――――――――――――――"
  129. #~     self.contents.draw_text(0, 0, contents.width, WLH, text, @align)
  130. #~   end
  131. #~ end
  132.  
  133. #==============================================================================
  134. # ** Window_MenuHelp
  135. #==============================================================================
  136.  
  137. class Window_MenuHelp < Window_Help
  138.   #--------------------------------------------------------------------------
  139.   # * Set Text
  140.   #--------------------------------------------------------------------------
  141.   def set_text(text, align = 0)
  142.     if text != @text or align != @align
  143.       self.contents.clear
  144.       self.contents.font.shadow = false
  145.       self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
  146.       self.contents.draw_text(4, 0, self.width - 40, WLH, text, align)
  147.       @text = text
  148.       @align = align
  149.     end
  150.   end
  151. end
  152.  
  153. #==============================================================================
  154. # ** Window_MenuTimer
  155. #==============================================================================
  156.  
  157. class Window_MenuTimer < Window_Base
  158.   #--------------------------------------------------------------------------
  159.   # * Object Initialization
  160.   #--------------------------------------------------------------------------
  161.   def initialize
  162.     super(0, Graphics.height - 60, 120, 56)
  163.     self.contents.font.size = Font.default_size - 4
  164.     self.contents.font.shadow = false
  165.     self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
  166.     refresh
  167.   end
  168.   #--------------------------------------------------------------------------
  169.   # * Refresh
  170.   #--------------------------------------------------------------------------
  171.   def refresh
  172.     self.contents.clear
  173.     format = "%03d:%02d:%02d"
  174.     @game_time = Graphics.frame_count / Graphics.frame_rate
  175.     hours = @game_time / 3600
  176.     minutes = @game_time / 60 % 60
  177.     seconds = @game_time % 60
  178.     text = sprintf(format, hours, minutes, seconds)
  179.     self.contents.draw_text(0, 0, contents.width-4, WLH, text, 2)
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # * Update
  183.   #--------------------------------------------------------------------------
  184.   def update
  185.     super
  186.     refresh if @game_time != (Graphics.frame_count / Graphics.frame_rate)
  187.   end
  188. end
  189.  
  190. #==============================================================================
  191. # ** Window_MenuGold
  192. #==============================================================================
  193.  
  194. class Window_MenuGold < Window_Base
  195.   #--------------------------------------------------------------------------
  196.   # * Object Initialization
  197.   #--------------------------------------------------------------------------
  198.   def initialize
  199.     super(100, Graphics.height - 60, 120, 56)
  200.     self.contents.font.size = Font.default_size - 4
  201.     self.contents.font.shadow = false
  202.     self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
  203.     refresh
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # * Refresh
  207.   #--------------------------------------------------------------------------
  208.   def refresh
  209.     self.contents.clear
  210.     text = sprintf("%d%s", $game_party.gold, Vocab::currency_unit)
  211.     self.contents.draw_text(0, 0, contents.width-4, WLH, text, 0)
  212.   end
  213. end
  214.  
  215. #==============================================================================
  216. # ** Window_MenuLocation
  217. #==============================================================================
  218.  
  219. class Window_MenuLocation < Window_Base
  220.   #--------------------------------------------------------------------------
  221.   # * Object Initialization
  222.   #--------------------------------------------------------------------------
  223.   def initialize
  224.     super(Graphics.width/2-16, Graphics.height - 60, Graphics.width/2+16, 56)
  225.     self.contents.font.size = Font.default_size - 4
  226.     self.contents.font.shadow = false
  227.     self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
  228.     refresh
  229.   end
  230.   #--------------------------------------------------------------------------
  231.   # * Refresh
  232.   #--------------------------------------------------------------------------
  233.   def refresh
  234.     self.contents.clear
  235.     text = sprintf(SSS::MENU_LOCATION, $game_map.display_name)
  236.     self.contents.draw_text(4, 0, contents.width, WLH, text, 0)
  237.   end
  238. end
  239.  
  240. #==============================================================================
  241. # ** Scene_Status
  242. #==============================================================================
  243.  
  244. class Scene_Status
  245.   #--------------------------------------------------------------------------
  246.   # public instance variables
  247.   #--------------------------------------------------------------------------
  248.   attr_accessor :actor
  249.   #--------------------------------------------------------------------------
  250.   # * Start processing
  251.   #--------------------------------------------------------------------------
  252.   alias start_sss_ff13_status_menu start unless $@
  253.   def start
  254.     start_sss_ff13_status_menu
  255.     @menuback_sprite.dispose unless @menuback_sprite.nil?
  256.     @menuback_sprite = Sprite.new(@viewport)
  257.     start_ff13_menu_style
  258.     load_actor
  259.     create_background
  260.   end
  261.   #--------------------------------------------------------------------------
  262.   # * Start Final Fantasy 13 Menu Style
  263.   #--------------------------------------------------------------------------
  264.   def start_ff13_menu_style
  265.     @gold_window = Window_MenuGold.new
  266.     @menu_timer_window = Window_MenuTimer.new
  267.     @location_window = Window_MenuLocation.new
  268.     @help_window.dispose if @help_window != nil
  269.     @help_window = Window_MenuHelp.new
  270.     @help_window.x += 48
  271.     @help_window.width -= 48
  272.     @help_window.create_contents
  273.     @help_window.contents.font.size = Font.default_size - 4
  274.     @help_window.y += 12
  275.     @status_window.y = @help_window.height+2 - 16 - 14
  276.     @status_window.x += 16
  277.     @status_window.z += 100000
  278.     @help_window.z += 100000
  279.   end
  280.   #--------------------------------------------------------------------------
  281.   # * Change actor
  282.   #--------------------------------------------------------------------------
  283.   def on_actor_change
  284.     @status_window.actor = @actor
  285.     load_actor
  286.     @status_window.activate
  287.   end
  288.   #--------------------------------------------------------------------------
  289.   # * Load actor
  290.   #--------------------------------------------------------------------------
  291.   def load_actor
  292.     @help_window.set_text(@actor.description)
  293.     filename = SSS::MENU_PROFILE_IMAGES[@actor.id]
  294.     filename = SSS::MENU_PROFILE_IMAGES[1] if filename.nil?
  295.     @menuback_sprite.bitmap.dispose if @menuback_sprite.bitmap != nil
  296.     @menuback_sprite.bitmap = Cache.system(filename).clone
  297.     blur_times = 2
  298.     blur_times.times do @menuback_sprite.bitmap.blur end
  299.     @menuback_sprite.color.set(16, 16, 16, 64)
  300.   end
  301.   #--------------------------------------------------------------------------
  302.   # * Create Background for Menu Screen
  303.   #--------------------------------------------------------------------------
  304.   def create_background
  305.     super
  306.     @background_sprite.color.set(0, 0, 0, 0)
  307.     b = Cache.system(SSS::MENU_BACK_PROFILE_IMAGE)
  308.     @background_sprite.bitmap.blt(0,0,b,b.rect,128)
  309.   end
  310. end
  311.  
  312. #===============================================================================
  313. #
  314. # END OF FILE
  315. #
  316. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement