Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # Shanghai Simple Script - Final Fantasy 13 Equip Menu
- # Last Date Updated: 2010.06.05
- # Level: Normal
- #
- # NOTE! This requires Yanfly Engine Ace's Ace Equip Engine script to be
- # installed and located above this script to work. This makes your equip menu
- # ordered like Final Fantasy 13's.
- #
- # Converted by mikb89 to work for VX Ace.
- # UNOFFICIAL porting, all credits go to Shangai.
- #===============================================================================
- # Instructions
- # -----------------------------------------------------------------------------
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
- #
- #===============================================================================
- $imported = {} if $imported == nil
- $imported["FinalFantasy13EquipMenu"] = true
- module SSS
- # This is the image used for the header and footer of the profile scenes.
- # Must be 544x416 pixels or whatever resolution size you're using.
- MENU_BACK_PROFILE_IMAGE = "ProfileBack"
- # This is the image used for the item back image. Must be 286x24 pixels.
- MENU_BACK_PROFILE_ITEM = "ProfileItem"
- # This sets the menu help window's text color.
- MENU_HELP_TEXT_COLOR = Color.new(0, 0, 0)
- # This is the text format used to write out the current map.
- MENU_LOCATION = "Location: %s"
- # This hash sets the image files for your actors. These images must be placed
- # inside of the Graphics\System folder and they have to be 544x416 pixels or
- # whatever resolution size you're using.
- MENU_PROFILE_IMAGES ={
- 1 => "Charas",
- 2 => "Charas",
- 3 => "Charas",
- 4 => "Charas",
- } # Remove this and perish.
- # This is the text used to write out various equip menu text items.
- MENU_TEXT_EQUIP_STATS1 = "Status"
- MENU_TEXT_EQUIP_STATS2 = "Aptitude Rates"
- MENU_TEXT_EQUIP_EQUIP1 = "Option"
- MENU_TEXT_EQUIP_EQUIP2 = "Equipment"
- MENU_TEXT_EQUIP_APT = "Aptitude"
- MENU_TEXT_EQUIP_PASSIVE = "Passives Abilities"
- # This is the text used to write out the passive names.
- MENU_TEXT_SUPER_GUARD = "Super Guard"
- MENU_TEXT_FAST_ATTACK = "Fast Attack"
- MENU_TEXT_DUAL_ATTACK = "Dual Attack"
- MENU_TEXT_PREVENT_CRI = "Prevent Critical"
- MENU_TEXT_HALF_MP_COST = "Half MP Cost"
- MENU_TEXT_PHARMACOLOGY = "Pharmacology"
- MENU_TEXT_DOUBLE_EXP = "Double EXP Gain"
- MENU_TEXT_AUTO_HP_REC = "Auto HP Recover"
- end
- #==============================================================================
- # ** Window_Base
- #==============================================================================
- class Window_Base < Window
- WLH = 24
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- alias initialize_sss_ff13_equip_menu_window_base initialize unless $@
- def initialize(x, y, width, height)
- initialize_sss_ff13_equip_menu_window_base(x, y, width, height)
- self.opacity = 0 if SceneManager.scene_is?(Scene_Equip)
- end
- end
- #===============================================================================
- # ** Window_Equip
- #===============================================================================
- class Window_Equip < Window_Selectable
- #--------------------------------------------------------------------------
- # * Draw Equipment Category
- #--------------------------------------------------------------------------
- def draw_equipment_category
- self.contents.font.size = YEA::EQUIP::STATUS_FONT_SIZE
- self.contents.font.shadow = true
- dy = 0
- for i in 0..(@actor.equip_type.size)
- self.contents.font.color = normal_color
- if i == 0 and @actor.weapons[0] != nil and @actor.weapons[0].two_handed
- text = @actor.weapons[0].two_hand_text
- elsif i == 0
- text = YEA::EQUIP::TYPE[0][0]
- elsif i == 1 and @actor.two_swords_style
- text = YEA::EQUIP::TYPE[0][0]
- else
- type = @actor.equip_slots[i-1]
- text = YEA::EQUIP::TYPE[type][0]
- end
- self.contents.draw_text(4, dy, 76, WLH, text, 1)
- dy += WLH
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Equipment Items
- #--------------------------------------------------------------------------
- def draw_equipment_items
- self.contents.font.size = YEA::EQUIP::STATUS_FONT_SIZE
- self.contents.font.shadow = false
- dy = 0; dx = 76
- for i in 0..(@actor.equip_type.size)
- self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
- item = @data[i]
- if item == nil
- text = YEA::EQUIP::NOTHING_TEXT
- self.contents.font.color.alpha = 128
- self.contents.draw_text(dx, dy, 196, WLH, text)
- else
- draw_item_name(item, dx, dy)
- end
- dy += WLH
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Item Name
- #--------------------------------------------------------------------------
- def draw_item_name(item, x, y, enabled = true)
- if item != nil
- draw_icon(item.icon_index, x, y, enabled)
- self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
- self.contents.font.color.alpha = enabled ? 255 : 128
- self.contents.draw_text(x + 24, y, 172, WLH, item.name)
- end
- end
- end
- #===============================================================================
- # ** Window_Equip_Item
- #===============================================================================
- class Window_Equip_Item < Window_Selectable
- #--------------------------------------------------------------------------
- # * Draw Item
- #--------------------------------------------------------------------------
- def draw_item(index)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- self.contents.font.size = YEA::EQUIP::STATUS_FONT_SIZE
- self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
- item = @data[index]
- if item == nil
- draw_icon(YEA::EQUIP::NOTHING_ICON, rect.x+12, rect.y)
- text = YEA::EQUIP::NOTHING_TEXT
- self.contents.draw_text(rect.x+36, rect.y, 172, WLH, text)
- return
- end
- number = $game_party.item_number(item)
- enabled = enable?(item)
- rect.width -= 4
- draw_item_name(item, rect.x+12, rect.y, enabled)
- draw_item_number(rect, item)
- end
- #--------------------------------------------------------------------------
- # * Draw Item Name
- #--------------------------------------------------------------------------
- def draw_item_name(item, x, y, enabled = true)
- if item != nil
- draw_icon(item.icon_index, x, y, enabled)
- self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
- self.contents.font.color.alpha = enabled ? 255 : 128
- self.contents.draw_text(x + 24, y, 172, WLH, item.name)
- end
- end
- end
- #==============================================================================
- # ** Window_MenuHelp
- #==============================================================================
- class Window_MenuHelp < Window_Help
- #--------------------------------------------------------------------------
- # * Set Text
- #--------------------------------------------------------------------------
- def set_text(text, align = 0)
- if text != @text or align != @align
- self.contents.clear
- self.contents.font.shadow = false
- self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
- self.contents.draw_text(4, 0, self.width - 40, WLH, text, align)
- @text = text
- @align = align
- end
- end
- end
- #==============================================================================
- # ** Window_MenuTimer
- #==============================================================================
- class Window_MenuTimer < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, Graphics.height - 60, 120, 56)
- self.contents.font.size = Font.default_size - 4
- self.contents.font.shadow = false
- self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- format = "%03d:%02d:%02d"
- @game_time = Graphics.frame_count / Graphics.frame_rate
- hours = @game_time / 3600
- minutes = @game_time / 60 % 60
- seconds = @game_time % 60
- text = sprintf(format, hours, minutes, seconds)
- self.contents.draw_text(0, 0, contents.width-4, WLH, text, 2)
- end
- #--------------------------------------------------------------------------
- # * Update
- #--------------------------------------------------------------------------
- def update
- super
- refresh if @game_time != (Graphics.frame_count / Graphics.frame_rate)
- end
- end
- #==============================================================================
- # ** Window_MenuGold
- #==============================================================================
- class Window_MenuGold < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(100, Graphics.height - 60, 120, 56)
- self.contents.font.size = Font.default_size - 4
- self.contents.font.shadow = false
- self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- text = sprintf("%d%s", $game_party.gold, Vocab::currency_unit)
- self.contents.draw_text(0, 0, contents.width-4, WLH, text, 0)
- end
- end
- #==============================================================================
- # ** Window_MenuLocation
- #==============================================================================
- class Window_MenuLocation < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(Graphics.width/2-16, Graphics.height - 60, Graphics.width/2+16, 56)
- self.contents.font.size = Font.default_size - 4
- self.contents.font.shadow = false
- self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- text = sprintf(SSS::MENU_LOCATION, $game_map.display_name)
- self.contents.draw_text(4, 0, contents.width, WLH, text, 0)
- end
- end
- #==============================================================================
- # ** Window_Equip
- #==============================================================================
- class Window_Equip < Window_Selectable
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- alias refresh_sss_ff13_equip_menu refresh unless $@
- def refresh
- if SceneManager.scene_is?(Scene_Equip) and not SceneManager.scene.passives_window.nil?
- SceneManager.scene.passives_window.refresh
- end
- refresh_sss_ff13_equip_menu
- end
- end
- #==============================================================================
- # ** Window_Underscore
- #==============================================================================
- class Window_Underscore < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(align = 0)
- super(0, 0, Graphics.width, 56)
- @align = align
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.font.name = ["UmePlus Gothic", "Courier New"]
- self.contents.font.size += 4
- text = "―――――――――――――――――――――――――――――――――――――――――――――――――――――――"
- self.contents.draw_text(0, 0, contents.width, WLH, text, @align)
- end
- end
- #==============================================================================
- # ** Window_MenuEquipPassives
- #==============================================================================
- class Window_MenuEquipPassives < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(yy, actor)
- super(Graphics.width-240, yy, 240, 6*24+32)
- #refresh(actor)
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh(actor)
- self.contents.clear
- self.contents.font.color = normal_color
- self.contents.font.size = YEA::EQUIP::STATUS_FONT_SIZE
- yy = WLH
- xx = 12
- if actor.super_guard
- text = SSS::MENU_TEXT_SUPER_GUARD
- self.contents.draw_text(xx, yy, contents.width, WLH, text)
- yy += WLH
- end
- if actor.fast_attack
- text = SSS::MENU_TEXT_FAST_ATTACK
- self.contents.draw_text(xx, yy, contents.width, WLH, text)
- yy += WLH
- end
- if actor.dual_attack
- text = SSS::MENU_TEXT_DUAL_ATTACK
- self.contents.draw_text(xx, yy, contents.width, WLH, text)
- yy += WLH
- end
- if actor.prevent_critical
- text = SSS::MENU_TEXT_PREVENT_CRI
- self.contents.draw_text(xx, yy, contents.width, WLH, text)
- yy += WLH
- end
- if actor.half_mp_cost
- text = SSS::MENU_TEXT_HALF_MP_COST
- self.contents.draw_text(xx, yy, contents.width, WLH, text)
- yy += WLH
- end
- if actor.pharmacology
- text = SSS::MENU_TEXT_PHARMACOLOGY
- self.contents.draw_text(xx, yy, contents.width, WLH, text)
- yy += WLH
- end
- if actor.double_exp_gain
- text = SSS::MENU_TEXT_DOUBLE_EXP
- self.contents.draw_text(xx, yy, contents.width, WLH, text)
- yy += WLH
- end
- if actor.auto_hp_recover
- text = SSS::MENU_TEXT_AUTO_HP_REC
- self.contents.draw_text(xx, yy, contents.width, WLH, text)
- yy += WLH
- end
- for state in actor.equip_autostates
- text = state.name
- self.contents.draw_text(xx, yy, contents.width, WLH, text)
- yy += WLH
- end
- end
- end
- #===============================================================================
- # Override Equipment Overhaul Settings
- #===============================================================================
- YEA::EQUIP::STATUS_FONT_SIZE = 16
- #==============================================================================
- # ** Scene_Equip
- #==============================================================================
- class Scene_Equip
- #--------------------------------------------------------------------------
- # public instance variables
- #--------------------------------------------------------------------------
- attr_accessor :actor
- attr_accessor :passives_window
- #--------------------------------------------------------------------------
- # * Start
- #--------------------------------------------------------------------------
- alias start_sss_ff13_equip_menu start unless $@
- def start
- start_sss_ff13_equip_menu
- @menuback_sprite.dispose unless @menuback_sprite.nil?
- @menuback_sprite = Sprite.new(@viewport)
- start_ff13_menu_style
- load_actor
- create_background
- end
- #--------------------------------------------------------------------------
- # * Start Final Fantasy 13 Menu Style
- #--------------------------------------------------------------------------
- def start_ff13_menu_style
- @actor_window.x = Graphics.width + 2 # get rid u.u
- @gold_window = Window_MenuGold.new
- @menu_timer_window = Window_MenuTimer.new
- @location_window = Window_MenuLocation.new
- @help_window.dispose if @help_window != nil
- @help_window = Window_MenuHelp.new
- @help_window.x += 48
- @help_window.width -= 48
- @help_window.create_contents
- @help_window.contents.font.size = Font.default_size - 4
- @item_window.help_window = @slot_window.help_window = @help_window
- @command_window.y = @help_window.height+2 - 14
- @command_window.x += (Graphics.width-240-@command_window.width-32)/2
- @help_window.y += 12
- @item_window.height = (@item_window.height-32)/24
- @item_window.height = @item_window.height*24+32
- @status_window.y = @command_window.y + 2
- @status_window.x -= 4
- create_underscore_windows
- create_dummy_text_windows
- create_item_image
- passives_y = @underscore_window2.y+10
- @passives_window = Window_MenuEquipPassives.new(passives_y-24, @actor)
- item_window_height = @command_window.y + @command_window.height - 25 - 16
- @help_window.y = 12
- @slot_window.y = item_window_height
- @item_window.y = @slot_window.y
- @slot_window.width -= 40
- @item_window.width = @slot_window.width
- @item_window.arrows_visible = false
- @slot_window.arrows_visible = false
- @slot_window.update_help
- unless @dummy_stats4_window.nil?
- @dummy_stats4_window.contents.clear
- rect = Rect.new(0, 0, @dummy_stats4_window.contents.width, 24)
- text = SSS::MENU_TEXT_EQUIP_STATS1
- @dummy_stats4_window.contents.draw_text(rect, text, 0)
- end
- unless @item_back_sprite.nil?
- @item_back_sprite.y = item_window_height+16-4
- end
- @status_window.z += 100000
- @help_window.z += 100000
- end
- #--------------------------------------------------------------------------
- # * Create Underscore Windows
- #--------------------------------------------------------------------------
- def create_underscore_windows
- @underscore_window1 = Window_Underscore.new(2)
- @underscore_window2 = Window_Underscore.new(0)
- @underscore_window3 = Window_Underscore.new(0)
- @underscore_window4 = Window_Underscore.new(2)
- @underscore_window1.y = @command_window.y + @command_window.height - 40 - 16
- @underscore_window1.x = -Graphics.width/3-60
- @underscore_window2.y = @status_window.height + @status_window.y - 24
- @underscore_window2.x = @underscore_window1.x + @underscore_window1.width-2
- @underscore_window3.x = @underscore_window1.x
- @underscore_window3.y = @help_window.y + @help_window.height-24 - 14
- @underscore_window4.x = @underscore_window2.x
- @underscore_window4.y = @underscore_window3.y
- for w in [@underscore_window1,@underscore_window2,@underscore_window3,@underscore_window4]
- w.z += 100000
- end
- end
- #--------------------------------------------------------------------------
- # * Create Dummy Text Windows
- #--------------------------------------------------------------------------
- def create_dummy_text_windows
- # Lower Left
- @dummy_stats1_window = Window_Base.new(0, 0, Graphics.width, 56)
- @dummy_stats1_window.contents.font.size = YEA::EQUIP::STATUS_FONT_SIZE
- rect = Rect.new(0, 0, @dummy_stats1_window.contents.width, 24)
- text = SSS::MENU_TEXT_EQUIP_EQUIP2
- @dummy_stats1_window.contents.draw_text(rect, text, 2)
- @dummy_stats1_window.x = @underscore_window1.x-4
- @dummy_stats1_window.y = @underscore_window1.y-8
- # Lower Right
- @dummy_stats2_window = Window_Base.new(0, 0, Graphics.width, 56)
- @dummy_stats2_window.contents.font.size = YEA::EQUIP::STATUS_FONT_SIZE
- rect = Rect.new(0, 0, @dummy_stats2_window.contents.width, 24)
- text = SSS::MENU_TEXT_EQUIP_PASSIVE
- @dummy_stats2_window.contents.draw_text(rect, text, 0)
- @dummy_stats2_window.x = @underscore_window2.x+4
- @dummy_stats2_window.y = @underscore_window2.y-8
- # Upper Left
- @dummy_stats3_window = Window_Base.new(0, 0, Graphics.width, 56)
- @dummy_stats3_window.contents.font.size = YEA::EQUIP::STATUS_FONT_SIZE
- rect = Rect.new(0, 0, @dummy_stats3_window.contents.width, 24)
- text = SSS::MENU_TEXT_EQUIP_EQUIP1
- @dummy_stats3_window.contents.draw_text(rect, text, 2)
- @dummy_stats3_window.x = @underscore_window3.x-4
- @dummy_stats3_window.y = @underscore_window3.y-8
- # Upper Right
- @dummy_stats4_window = Window_Base.new(0, 0, Graphics.width, 56)
- @dummy_stats4_window.contents.font.size = YEA::EQUIP::STATUS_FONT_SIZE
- rect = Rect.new(0, 0, @dummy_stats4_window.contents.width, 24)
- text = SSS::MENU_TEXT_EQUIP_STATS1
- @dummy_stats4_window.contents.draw_text(rect, text, 0)
- @dummy_stats4_window.x = @underscore_window4.x+4
- @dummy_stats4_window.y = @underscore_window4.y-8
- for w in [@dummy_stats1_window,@dummy_stats2_window,@dummy_stats3_window,@dummy_stats4_window]
- w.z += 100000
- end
- end
- #--------------------------------------------------------------------------
- # * Create Item Image
- #--------------------------------------------------------------------------
- def create_item_image
- @item_back_sprite = Sprite.new(@viewport)
- bitmap_w = 286
- bitmap_h = (@slot_window.height-32)/24
- @item_back_sprite.bitmap = Bitmap.new(bitmap_w, bitmap_h*24)
- rect = Rect.new(0, 0, 286, 24)
- source = Cache.system(SSS::MENU_BACK_PROFILE_ITEM)
- yy = 0
- bitmap_h.times do
- @item_back_sprite.bitmap.blt(0, yy, source, rect)
- yy += 24
- end
- end
- #--------------------------------------------------------------------------
- # * Create Background for Menu Screen
- #--------------------------------------------------------------------------
- def create_background
- super
- @background_sprite.color.set(0, 0, 0, 0)
- b = Cache.system(SSS::MENU_BACK_PROFILE_IMAGE)
- @background_sprite.bitmap.blt(0,0,b,b.rect,128)
- end
- #--------------------------------------------------------------------------
- # * Change actor
- #--------------------------------------------------------------------------
- alias_method :ff13_eqp_on_act_chg, :on_actor_change unless method_defined?(:ff13_eqp_on_act_chg)
- def on_actor_change
- ff13_eqp_on_act_chg
- @status_window.actor = @actor
- load_actor
- @status_window.activate
- end
- #--------------------------------------------------------------------------
- # * Load actor
- #--------------------------------------------------------------------------
- def load_actor
- filename = SSS::MENU_PROFILE_IMAGES[@actor.id]
- filename = SSS::MENU_PROFILE_IMAGES[1] if filename.nil?
- @menuback_sprite.bitmap.dispose if @menuback_sprite.bitmap != nil
- @menuback_sprite.bitmap = Cache.system(filename).clone
- blur_times = 2
- blur_times.times do @menuback_sprite.bitmap.blur end
- @menuback_sprite.color.set(16, 16, 16, 64)
- end
- end
- #===============================================================================
- #
- # END OF FILE
- #
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement