Advertisement
mikb89

[Ace] Shangai FF13 Skill Menu per MihaChan

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