Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # ** FF9 Help
- #------------------------------------------------------------------------------
- # Author: BuddySievers/Griver03
- #
- # Version History:
- # v1.00 - 2015.10.15 > First release
- # v1.01 - 2015.10.23 > First public release
- # v1.02 - 2015.10.24 > Fixed a bug with toggle on/off when there is no help available
- # v1.03 - 2015.10.24 > Forgot to call a method in Window_Selectable from the last update.
- # v1.04 - 2015.10.25 > Optimized window positioning.
- # v1.10 - 2015.10.28 > Optimized code and fixed the update proccess which caused lag.
- # v1.11 - 2015.10.28 > Added window shadows.
- #
- # Credits:
- # TheoAllen for his 'Command Help Popup' script which was the base for this.
- # Vlue for parts of his 'Popup Window' script.
- # vFoggy from rpgmakervxace.net forums for the 'index_of_visible_row' method.
- # RedShard from rpgmakervxace.net forums for asking me to release it.
- #
- #------------------------------------------------------------------------------
- # Description:
- # This is a clone from the help system of SquareSoft's masterpiece
- # 'Final Fantasy IX' which i actually made for my own project.
- # The rpgmakervxace.net forums user RedShard asked me if i plan to release
- # it but it was a mess, not plug and play and not user friendly at all so
- # i cleaned up the code and added a simple configuration module.
- #
- #------------------------------------------------------------------------------
- # Compatibility:
- # Requires the script 'Victor Engine - Arrow Cursor' v 1.01 or higher
- # which in turn rquires 'Victor Engine - Basic Module' v 1.09 or higher.
- #
- #------------------------------------------------------------------------------
- # Instructions:
- # To instal the script, open you script editor and paste this script on
- # a new section on bellow the Materials section. This script must also
- # be bellow the scripts 'Victor Engine - Basic Module' and
- # 'Victor Engine - Arrow Cursor'.
- # Place all of the scripts above the most other custom scripts best compatibility!
- #
- #------------------------------------------------------------------------------
- # Additional Info:
- # The all graphics must be in the folder Graphics/System/FF9_Help.
- #
- # If you want to use custom graphics you have to edit the script yourself.
- # It was hard enough for me to get this done and its far away from beeing
- # perfect so dont ask me for help when you want to use custom graphics.
- # If you need help with anything else or a have bug to report feel free
- # to contact me at http://www.rpgmakervxace.net/ forums!
- #
- # I hope you enjoy this script and i would like to see it when you
- # give TheoAllen, Vlue, vFoggy and maybe me credits in your game! :)
- #
- #==============================================================================
- #==============================================================================
- # ■ Config
- #==============================================================================
- module Config
- module FF9_Help
- #--------------------------------------------------------------------------
- # Set the key to be pressed to toggle the help on and off.
- # Can be A, B, C, X, Y, Z, L, R, SHIFT, CTRL or ALT.
- #--------------------------------------------------------------------------
- Toggle_Key = :ALT
- #--------------------------------------------------------------------------
- # Auto toggle the help off when change to these scenes.
- #--------------------------------------------------------------------------
- Force_Deactivate = ["Scene_Map", "Scene_Title"]
- #--------------------------------------------------------------------------
- # Format is RPG::SE.new(Filename, Volume, Pitch)
- # to set a sound effect which gets played when toggle the help on.
- # Otherwise set to nil if you dont want to use a sound effect.
- #--------------------------------------------------------------------------
- Activate_SE = RPG::SE.new("FF9_Help_Moogle.wav", 80, 100)
- #--------------------------------------------------------------------------
- # Format is RPG::SE.new(Filename, Volume, Pitch)
- # to set a sound effect which gets played when toggle the help off.
- # Otherwise set to nil if you dont want to use a sound effect.
- #--------------------------------------------------------------------------
- Deactivate_SE = nil
- #--------------------------------------------------------------------------
- # Adjust the Z position of help window.
- #--------------------------------------------------------------------------
- Window_Z = 8000
- #--------------------------------------------------------------------------
- # Use the help window header sprite.
- #--------------------------------------------------------------------------
- Window_Header = true
- #--------------------------------------------------------------------------
- # Adjust the X position of the help window header sprite.
- # Can be negative, like -2.
- #--------------------------------------------------------------------------
- Header_X = 8
- #--------------------------------------------------------------------------
- # Adjust the Y position of the help window header sprite.
- # Can be negative, like -2.
- #--------------------------------------------------------------------------
- Header_Y = 0
- #--------------------------------------------------------------------------
- # Change the font settings for the help window text.
- #--------------------------------------------------------------------------
- Font_Name = Font.default_name
- Font_Size = Font.default_size
- Font_Bold = false
- Font_Italic = false
- Font_Outline = false
- Font_Shadow = false
- Font_Color = Color.new(0, 0, 0, 255)
- Font_Outline_Color = Color.new(0,0,0,128)
- #--------------------------------------------------------------------------
- # Use window shadow.
- #--------------------------------------------------------------------------
- Window_Shadow = true
- #--------------------------------------------------------------------------
- # Adjust the X position of the window shadow.
- # Can be negative, like -2.
- #--------------------------------------------------------------------------
- Window_Shadow_X = 3
- #--------------------------------------------------------------------------
- # Adjust the Y position of the window shadow.
- # Can be negative, like -2.
- #--------------------------------------------------------------------------
- Window_Shadow_Y = 3
- #--------------------------------------------------------------------------
- # Adjust the opacity of the window shadow. (0-255)
- #--------------------------------------------------------------------------
- Window_Shadow_Opacity = 120
- #--------------------------------------------------------------------------
- # Set here your help text's you want to show for the
- # corresponding items in selectable windows.
- # Works for everything with a .name variable.
- # The format is "Name" => ['Text'],
- # Make sure to use single quotes ('') not double quotes ("")
- # Dont use \n for a new line, instead use this format ['Line 1', 'Line 2']
- # If you have a ' in your string like character's use \' like character\'s
- # You can use controll codes like \i[icon_id] to draw an icon or
- # \c[color_id] to change the text color.
- #--------------------------------------------------------------------------
- Window_Selectable = {
- # Items
- "Potion" => ['Recovers \c[17]500 \c[15]HP.'],
- "Hi-Potion" => ['Recovers \c[17]2,500 \c[15]HP.', 'Just a test line...'],
- "Full Potion" => ['Recovers all HP.', 'Just a test line...', 'And another one...'],
- "Magic Water" => ['Recovers \c[17]200 \c[15]MP.', 'Just a test line...', 'And another one...', 'Dude, seriously?!'],
- "Stimulant" => ['Recovers ally from \c[18]death\c[15].'],
- "Antidote" => ['Treats \c[18]poison\c[15].'],
- "Dispel Herb" => ['Treats many status ailments.'],
- "Elixir" => ['Restores all HP and MP.'],
- "Life Up" => ['Increases MaxHP by \c[17]50\c[15].'],
- "Mana Up" => ['Increases MaxMP by \c[17]10\c[15].'],
- "Power Up" => ['Increases ATK by \c[17]3\c[15].'],
- "Guard Up" => ['Increases DEF by \c[17]3\c[15].'],
- "Magic Up" => ['Increases MAT by \c[17]3\c[15].'],
- "Resist Up" => ['Increases MDF by \c[17]3\c[15].'],
- "Speed Up" => ['Increases AGI by \c[17]3\c[15].'],
- "Luck Up" => ['Increases LUK by \c[17]3\c[15].'],
- # Weapons
- "Hand Ax" => ['Small ax used for harvesting wood.'],
- "Battle Axe" => ['Double-sided axe made for combat.'],
- "Bardiche" => ['Three crescent blades on this axe.'],
- "Mithril Axe" => ['Mithril axe made of the magic mineral.'],
- "Crimson Axe" => ['Crimson soaked battle axe.'],
- "Gigantes Axe" => ['Heavy axe used by giants.'],
- # Armors
- "Casual Clothes" => ['Very lightweight clothes.'],
- "Leather Top" => ['Made with the best leather.'],
- "Adventurer's Garb" => ['Worn clothing that can withstand a harsh journey.'],
- "Hard Leather" => ['Hardened leather vest.'],
- "Brigandine" => ['Clothing made with reinforced steel.'],
- "Bandana" => ['Headband cloth that protects the head.'],
- "Leather Bandana" => ['Headband made of leather to protect the head.'],
- "Fur Hat" => ['Hat made of fur.'],
- "Turban" => ['Thick cloth wrapped repeatedly around one\'s head.'],
- "Feather Cap" => ['Stylish hat with feathers from many beautiful birds.'],
- "Wood Shield" => ['A shield made with hard wood.'],
- "Iron Shield" => ['Shield made of steel.'],
- "Knight Shield" => ['Knights use this shield.'],
- "Mithril Shield" => ['Mithril shield made of the magic mineral.'],
- "Dragon Shield" => ['Shield made of dragon scales.'],
- "War God's Belt" => ['Metal belt engraved with the War God\'s name.'],
- "Defense Piece" => ['Hung at the magic forest for defense.'],
- "Winged Boots" => ['The holy spirit of the wind dwell in these boots.'],
- "Earth's Embrace" => ['The power of the earth protects the wearer.'],
- "Lucky Charm" => ['A charm engraved with the name of the goddess of luck.'],
- "Holy Symbol" => ['A symbol worn by those who serve God.'],
- "Solomon's Ring" => ['A ring with the hidden power of a genie.'],
- "Odin's Necklace" => ['A magic necklace that empowers those who fight.'],
- "Eyepatch of Fury" => ['An eyepatch worn by powerful berserkers.'],
- "Talisman of Light" => ['The king of gods dwell in this talisman.'],
- # Skills
- "Strong Attack" => ['A strong attack against one enemy.'],
- "Cleave" => ['An attack against all enemies.'],
- "Berserker's Roar" => ['For 5 turns, increase ATK of party.'],
- "Berserker's Dance" => ['Axe skill.', 'Powerful attack against 3 random enemies.'],
- "Giant's Rampage" => ['Axe Skill.', 'A strong attack against all enemies.'],
- }
- #--------------------------------------------------------------------------
- # Set here your help text's you want to show for the
- # corresponding commands in command windows.
- # The format is "Name" => ['Text'],
- # Make sure to use single quotes ('') not double quotes ("")
- # Dont use \n for a new line, instead use this format ['Line 1', 'Line 2']
- # If you have a ' in your string like character's use \' like character\'s
- # You can use controll codes like \i[icon_id] to draw an icon or
- # \c[color_id] to change the text color.
- #--------------------------------------------------------------------------
- Window_Command = {
- # Title Scene
- "New Game" => ['Start a new game.'],
- "Continue" => ['Load a saved game.'],
- "Shutdown" => ['Close the game.'],
- # Menu Scene
- "Items" => ['View items and equip you have.', 'View key items you have', 'recieved in the game.'],
- "Skills" => ['View and use the character\'s skills.'],
- "Equipment" => ['Change the character\'s equipment.'],
- "Status" => ['View character\'s parameters', 'and learned skills.'],
- "Formation" => ['Rearrange the party order.'],
- "Save" => ['Save the game.'],
- "Game End" => ['End the current game.'],
- "System" => ['Open the game configuration.'],
- # Skill Scene
- "Special" => ['View learned specials.'],
- "Magic" => ['View learned magic.'],
- # Equipment Scene
- "Change" => ['Change your current equipment.'],
- "Optimize" => ['Optimize your equipment.'],
- "Clear" => ['Clear your equipment.'],
- # End Scene
- "To Title" => ['End your current game and', 'go back to the title screen.'],
- "Cancel" => ['Cancel and go back to the main menu.'],
- # System Scene
- "Window Red" => ['\c[18]Red \c[15]color adjustment.'],
- "Window Green" => ['\c[11]Green \c[15]color adjustment.'],
- "Window Blue" => ['\c[9]Blue \c[15]color adjustment.'],
- "BGM Volume" => ['Background music adjustment.'],
- "BGS Volume" => ['Background sound adjustment.'],
- "SFX Volume" => ['Soundeffect adjustment.'],
- "Auto-Dash" => ['Change default movement.'],
- "Instant Text" => ['Change how dialouge text', 'is displayed.'],
- "Battle Animations" => ['Disable animations in battle.'],
- "Return to Title Screen" => ['End the game and return', 'to the title screen.'],
- "Shutdown Game" => ['End the current game.'],
- }
- end
- end
- #==============================================================================
- # ■ Require
- #==============================================================================
- $imported = {} if $imported.nil?
- $imported[:BS_FF9_Help] = true
- if !$imported[:ve_arrow_cursor]
- string = "The script 'Final Fantasy IX Help System' requires\n"
- string += "Victor's 'Arrow Cursor' script to work.\n"
- string += "Go to https://victorscripts.wordpress.com/ to download this script.\n"
- string += "Remember that the script 'Arrow Cursor' in turn requires Victor's\n"
- string += "'Base Module' script to work.\n"
- string += "Place the 'FF9 Help' script below the 'Arrow Cursor' script."
- msgbox(string)
- exit
- end
- #==============================================================================
- # ■ Cache
- #==============================================================================
- module Cache
- def self.ff9_help(filename)
- load_bitmap("Graphics/System/FF9_Help/", filename)
- end
- end
- #==============================================================================
- # ■ SceneManager
- #==============================================================================
- module SceneManager
- class << self
- alias :griver_ff9_help_scenemanager_goto :goto
- alias :griver_ff9_help_scenemanager_call :call
- alias :griver_ff9_help_scenemanager_return :return
- end
- def self.goto(scene_class)
- $ff9_help_active = false if Config::FF9_Help::Force_Deactivate.include?(scene_class.to_s)
- griver_ff9_help_scenemanager_goto(scene_class)
- end
- def self.call(scene_class)
- $ff9_help_active = false if Config::FF9_Help::Force_Deactivate.include?(scene_class.to_s)
- griver_ff9_help_scenemanager_call(scene_class)
- end
- def self.return
- scene_stack = @stack.dup
- scene_class = scene_stack.pop
- scene_name = scene_class.class.name.to_s
- $ff9_help_active = false if Config::FF9_Help::Force_Deactivate.include?(scene_name)
- griver_ff9_help_scenemanager_return
- end
- end
- #==============================================================================
- # ■ Window_Shadow
- #==============================================================================
- class Window_Shadow < Window_Base
- def initialize
- super(0, 0, 1, 1)
- self.windowskin = Cache.ff9_help("FF9_Window_Shadow")
- self.tone.set(Tone.new(0, 0, 0, 0))
- self.opacity = Config::FF9_Help::Window_Shadow_Opacity
- self.back_opacity = 255
- self.visible = false
- end
- def refresh(x, y, z, width, height)
- self.x = x + Config::FF9_Help::Window_Shadow_X
- self.y = y + Config::FF9_Help::Window_Shadow_Y
- self.z = z
- self.width = width
- self.height = height
- end
- def update_tone
- end
- end
- #==============================================================================
- # ■ Window_Selectable
- #==============================================================================
- class Window_Selectable < Window_Base
- alias :griver_ff9_help_window_selectable_initialize :initialize
- def initialize(*args)
- griver_ff9_help_window_selectable_initialize(*args)
- @ff9_help_window = Window_FF9_Help.new(viewport)
- end
- alias :griver_ff9_help_window_selectable_update :update
- def update
- griver_ff9_help_window_selectable_update
- @ff9_help_window.update
- ff9_help_show if $ff9_help_active && $ff9_help_refresh && ff9_help_avalaible?
- end
- alias :griver_ff9_help_window_selectable_dispose :dispose
- def dispose
- griver_ff9_help_window_selectable_dispose
- @ff9_help_window.dispose
- end
- alias :griver_ff9_help_window_selectable_process_handling :process_handling
- def process_handling
- griver_ff9_help_window_selectable_process_handling
- return unless open? && active
- if @data
- if $ff9_help_active
- Config::FF9_Help::Deactivate_SE.play if ff9_help_open? && Input.trigger?(Config::FF9_Help::Toggle_Key) && Config::FF9_Help::Deactivate_SE != nil
- return ff9_help_toggle if Input.trigger?(Config::FF9_Help::Toggle_Key)
- else
- Config::FF9_Help::Activate_SE.play if ff9_help_avalaible? && Input.trigger?(Config::FF9_Help::Toggle_Key) && Config::FF9_Help::Activate_SE != nil
- return ff9_help_toggle if ff9_help_avalaible? && Input.trigger?(Config::FF9_Help::Toggle_Key)
- end
- end
- end
- alias :griver_ff9_help_window_selectable_process_ok :process_ok
- def process_ok
- griver_ff9_help_window_selectable_process_ok
- ff9_help_hide if !self.active
- $ff9_help_refresh = true
- end
- alias :griver_ff9_help_window_selectable_process_cancel :process_cancel
- def process_cancel
- griver_ff9_help_window_selectable_process_cancel
- ff9_help_hide if !self.active
- $ff9_help_refresh = true
- end
- alias :griver_ff9_help_window_selectable_cursor_down :cursor_down
- def cursor_down(wrap = false)
- griver_ff9_help_window_selectable_cursor_down(wrap)
- if $ff9_help_active && ff9_help_avalaible? && cursor_movable?
- ff9_help_show
- else
- ff9_help_hide
- end
- end
- alias :griver_ff9_help_window_selectable_cursor_up :cursor_up
- def cursor_up(wrap = false)
- griver_ff9_help_window_selectable_cursor_up(wrap)
- if $ff9_help_active && ff9_help_avalaible? && cursor_movable?
- ff9_help_show
- else
- ff9_help_hide
- end
- end
- alias :griver_ff9_help_window_selectable_cursor_right :cursor_right
- def cursor_right(wrap = false)
- griver_ff9_help_window_selectable_cursor_right(wrap)
- if $ff9_help_active && ff9_help_avalaible? && cursor_movable?
- ff9_help_show
- else
- ff9_help_hide
- end
- end
- alias :griver_ff9_help_window_selectable_cursor_left :cursor_left
- def cursor_left(wrap = false)
- griver_ff9_help_window_selectable_cursor_left(wrap)
- if $ff9_help_active && ff9_help_avalaible? && cursor_movable?
- ff9_help_show
- else
- ff9_help_hide
- end
- end
- alias :griver_ff9_help_window_selectable_cursor_pagedown :cursor_pagedown
- def cursor_pagedown
- griver_ff9_help_window_selectable_cursor_pagedown
- if $ff9_help_active && ff9_help_avalaible? && cursor_movable?
- ff9_help_show
- else
- ff9_help_hide
- end
- end
- alias :griver_ff9_help_window_selectable_cursor_pageup :cursor_pageup
- def cursor_pageup
- griver_ff9_help_window_selectable_cursor_pageup
- if $ff9_help_active && ff9_help_avalaible? && cursor_movable?
- ff9_help_show
- else
- ff9_help_hide
- end
- end
- def ff9_help_toggle
- if $ff9_help_active
- $ff9_help_active = false
- ff9_help_hide
- else
- $ff9_help_active = true
- ff9_help_show if $ff9_help_active && ff9_help_avalaible?
- end
- end
- def ff9_help_show
- return unless open? && active
- cursor_x = (@cursor[0].x - (@cursor[0].bitmap.width / 2)) - 2
- cursor_y = (@cursor[0].y - (@cursor[0].bitmap.height / 2)) - 26
- window_rows = [page_row_max / 2, 1].max
- window_rows += 1 if !window_rows.even?
- window_index = index_of_visible_row + 1
- @ff9_help_window.show(ff9_help_text, cursor_x, cursor_y, window_rows, window_index)
- end
- def ff9_help_hide
- Config::FF9_Help::Deactivate_SE.play if ff9_help_open? && Config::FF9_Help::Deactivate_SE != nil
- @ff9_help_window.hide
- end
- def ff9_help_text
- Config::FF9_Help::Window_Selectable[@data[index].name]
- end
- def ff9_help_avalaible?
- Config::FF9_Help::Window_Selectable.include?(@data[index].name) rescue false
- end
- def ff9_help_open?
- @ff9_help_window.open?
- end
- def index_of_visible_row
- row - top_row
- end
- end
- #==============================================================================
- # ■ Window_Command
- #==============================================================================
- class Window_Command < Window_Selectable
- alias :griver_ff9_help_window_command_update :update
- def update
- griver_ff9_help_window_command_update
- ff9_help_hide if @closing
- end
- alias :griver_ff9_help_window_command_process_handling :process_handling
- def process_handling
- griver_ff9_help_window_command_process_handling
- return unless open? && active
- if $ff9_help_active
- Config::FF9_Help::Deactivate_SE.play if ff9_help_open? && Input.trigger?(Config::FF9_Help::Toggle_Key) && Config::FF9_Help::Deactivate_SE != nil
- return ff9_help_toggle if Input.trigger?(Config::FF9_Help::Toggle_Key)
- else
- Config::FF9_Help::Activate_SE.play if ff9_help_avalaible? && Input.trigger?(Config::FF9_Help::Toggle_Key) && Config::FF9_Help::Activate_SE != nil
- return ff9_help_toggle if ff9_help_avalaible? && Input.trigger?(Config::FF9_Help::Toggle_Key)
- end
- end
- def ff9_help_show
- return unless open? && active
- cursor_x = (@cursor[0].x - (@cursor[0].bitmap.width / 2)) - 2
- cursor_y = (@cursor[0].y - (@cursor[0].bitmap.height / 2)) - 26
- window_rows = [page_row_max / 2, 1].max
- window_rows += 1 if !window_rows.even?
- window_index = index_of_visible_row + 1
- @ff9_help_window.show(ff9_help_text, cursor_x, cursor_y, window_rows, window_index)
- end
- def ff9_help_text
- Config::FF9_Help::Window_Command[command_name(index)]
- end
- def ff9_help_avalaible?
- Config::FF9_Help::Window_Command.include?(command_name(index)) rescue false
- end
- end
- #==============================================================================
- # ■ Window_FF9_Help
- #==============================================================================
- class Window_FF9_Help < Window_Base
- def initialize(viewport)
- super(0,0,1,1)
- self.viewport = viewport
- self.openness = 255
- self.windowskin = Cache.ff9_help("FF9_Help_Window.png")
- self.tone.set(Tone.new(0, 0, 0, 0))
- self.opacity = 255
- self.back_opacity = 255
- self.visible = false
- self.z = Config::FF9_Help::Window_Z
- @text = [""]
- @toggle = false
- @moogle_x = 0
- @moogle_y = 0
- @help_arrow_pos = :TOP
- @help_arrow_x = 0
- @help_arrow_y = 0
- if Config::FF9_Help::Window_Header
- @header_sprite = Sprite.new
- @header_sprite.bitmap = Cache.ff9_help("FF9_Help_Header.png")
- @header_sprite.x = 0
- @header_sprite.y = 0
- @header_sprite.z = self.z + 1000
- @header_sprite.visible = false
- end
- @arrow_sprite = Sprite.new
- @arrow_sprite.bitmap = Cache.ff9_help("FF9_Help_Arrow_Top.png")
- @arrow_sprite.x = 0
- @arrow_sprite.y = 0
- @arrow_sprite.z = self.z + 1000
- @arrow_sprite.visible = false
- @moogle_sprite = Sprite.new
- @moogle_sprite.bitmap = Cache.ff9_help("FF9_Help_Moogle.png")
- @moogle_sprite.x = 0
- @moogle_sprite.y = 0
- @moogle_sprite.z = self.z + 1000
- @moogle_sprite.visible = false
- @init_shadow = false
- create_window_shadow
- end
- def create_window_shadow
- @window_shadow = Window_Shadow.new
- @init_shadow = true
- end
- def window_height
- (line_height * @text.size) + standard_padding * 2
- end
- def icon_width
- size = text_size(' ').width
- ' ' * (24 / size)
- end
- def open?
- self.visible
- end
- def update
- super
- if @toggle
- self.visible = true
- @moogle_sprite.visible = true
- @arrow_sprite.visible = true
- @header_sprite.visible = true if Config::FF9_Help::Window_Header
- else
- self.visible = false
- @arrow_sprite.visible = false
- @moogle_sprite.visible = false
- @header_sprite.visible = false if Config::FF9_Help::Window_Header
- end
- if @init_shadow && Config::FF9_Help::Window_Shadow
- @window_shadow.refresh(self.x, self.y, self.z - 1, self.width, self.height)
- @init_shadow = false
- end
- @window_shadow.visible = self.visible if Config::FF9_Help::Window_Shadow
- end
- def dispose
- super
- @window_shadow.dispose
- @arrow_sprite.dispose
- @moogle_sprite.dispose
- @header_sprite.dispose if Config::FF9_Help::Window_Header
- end
- def show(help, cursor_x, cursor_y, window_rows, window_index)
- $ff9_help_refresh = false
- @text = help
- @moogle_x = cursor_x
- @moogle_y = cursor_y
- text = @text
- text_sizes = []
- text.each do |string|
- temp_string = string.gsub(/\\[^invpgINVPG]\[\d{0,3}\]/) { "" }
- temp_string = temp_string.gsub(/\\i\[\d{0,3}\]/) { icon_width }
- temp_string = convert_escape_characters(temp_string)
- text_sizes.push(text_size(temp_string).width)
- end
- text_sizes.sort!
- size = text_sizes[text_sizes.size - 1]
- self.width = (size + (standard_padding * 2) + 2)
- self.height = window_height
- create_contents
- @moogle_sprite.x = @moogle_x
- @moogle_sprite.y = @moogle_y
- if window_index < window_rows
- @help_arrow_pos = :TOP
- elsif window_index == window_rows
- @help_arrow_pos = :TOP
- else
- @help_arrow_pos = :BOTTOM
- end
- case @help_arrow_pos
- when :BOTTOM
- left_height = @moogle_y + 4
- if self.height >= left_height
- @help_arrow_pos = :TOP
- @help_arrow_x = @moogle_x + 34
- @help_arrow_y = @moogle_y + 34
- else
- @help_arrow_x = @moogle_x + 34
- @help_arrow_y = @moogle_y + 4
- end
- rest_width = Graphics.width - (@help_arrow_x - 22)
- result = 0
- if rest_width < self.width
- window_rest = self.width - rest_width
- result = window_rest + 6
- self.x = @help_arrow_x - 24 - result
- else
- self.x = (@help_arrow_x + 16) - (self.width/2)
- end
- self.x = 8 if self.x < 8
- case @help_arrow_pos
- when :BOTTOM
- self.y = @help_arrow_y - self.height + 10
- @arrow_sprite.bitmap = Cache.ff9_help("FF9_Help_Arrow_Bottom.png")
- when :TOP
- self.y = @help_arrow_y + 22
- @arrow_sprite.bitmap = Cache.ff9_help("FF9_Help_Arrow_Top.png")
- end
- when :TOP
- left_height = Graphics.height - @moogle_y + 34
- if self.height >= left_height
- @help_arrow_pos = :BOTTOM
- @help_arrow_x = @moogle_x + 34
- @help_arrow_y = @moogle_y + 4
- else
- @help_arrow_x = @moogle_x + 34
- @help_arrow_y = @moogle_y + 34
- end
- rest_width = Graphics.width - (@help_arrow_x - 22)
- result = 0
- if rest_width < self.width
- window_rest = self.width - rest_width
- result = window_rest + 6
- self.x = @help_arrow_x - 24 - result
- else
- self.x = (@help_arrow_x + 16) - (self.width/2)
- end
- self.x = 8 if self.x < 8
- case @help_arrow_pos
- when :BOTTOM
- self.y = @help_arrow_y - self.height + 10
- @arrow_sprite.bitmap = Cache.ff9_help("FF9_Help_Arrow_Bottom.png")
- when :TOP
- self.y = @help_arrow_y + 22
- @arrow_sprite.bitmap = Cache.ff9_help("FF9_Help_Arrow_Top.png")
- end
- end
- @arrow_sprite.x = @help_arrow_x
- @arrow_sprite.y = @help_arrow_y
- @header_sprite.x = self.x + Config::FF9_Help::Header_X if Config::FF9_Help::Window_Header
- @header_sprite.y = self.y + Config::FF9_Help::Header_Y if Config::FF9_Help::Window_Header
- @text.each_with_index {|text, i| draw_help_text(0, i * line_height, @text[i]) }
- @window_shadow.refresh(self.x, self.y, self.z - 1, self.width, self.height) if Config::FF9_Help::Window_Shadow
- @toggle = true
- end
- def hide
- @toggle = false
- end
- def draw_help_text(x, y, text)
- reset_font_settings
- contents.font.name = Config::FF9_Help::Font_Name
- contents.font.size = Config::FF9_Help::Font_Size
- contents.font.bold = Config::FF9_Help::Font_Bold
- contents.font.italic = Config::FF9_Help::Font_Italic
- contents.font.outline = Config::FF9_Help::Font_Outline
- contents.font.shadow = Config::FF9_Help::Font_Shadow
- contents.font.color = Config::FF9_Help::Font_Color
- contents.font.out_color = Config::FF9_Help::Font_Outline_Color
- text = convert_escape_characters(text)
- pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
- process_character(text.slice!(0, 1), text, pos) until text.empty?
- end
- def update_tone
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement