Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # Zer0_CMS
- # Author: ForeverZer0
- # Version: 1.3
- # Date: 11.11.2010
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # VERSION HISTORY
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- #
- # v.1.0 (6.16.2010)
- # - Original script completed
- # v.1.1 (7.9.2010)
- # - Bug fixed that would crash game on equip screen
- # - Added an Auto-Font Installer (Wachunga)
- # v.1.2 (9.25.2010)
- # - Fixed bug that would crash game if status window opened with nothing
- # equipped.
- # - Fixed bug that would sometimes scramble up what items should be displayed
- # in the equipment screen
- # - Fixed the undefined "stat1" bug.
- # - Fixed a few other potential problems.
- # v.1.3 (11.11.2010)
- # - Fixed bug that would sometimes scramble up what items should be displayed
- # in the equipment screen. (didn't I just read that...)
- # - Fixed compatibility issue with CCTS v.1.2
- # - Fixed bug that would throw an error if skin or font wass attemted to be
- # changed when none were unlocked.
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- #
- # Introduction:
- # This is my first CMS that I have created. It originally was going to be
- # used exclusively in my own project, but I have no financial ambitions with
- # RMXP, so therefore I decided to share it with everyone. I have added as
- # much compatability with other scripts as I could, but there are a few
- # lingering issues that could arise with other specific scripts. This is
- # mainly due to the fact that, as I just stated, it was not originally made to
- # be created with every concievable script out there, only my own, but most
- # users will experience no problems. Enjoy!
- #
- # Features:
- # - Optimized code to only create windows as needed, which means less lag.
- # - Animated windows.
- # - Clean, simple interface.
- # - Custom Save System, with easy compatibility for scripts that alias
- # Scene_Load and Scene_Save.
- # - Options menu with many configurable options including Font, Shaded Text,
- # Gradient Bars, Windowskins, Window Opacity, Volume, SFX, and more.
- # - Displays game time on menu, using either CCTS or ATES.
- # - Built in quest manager. (Based off of game_guy's Quest script)
- # - Items can be sorted by Type, Alpha-Numerical, Quantity, and by Key Item.
- # - Save and Load available from menu.
- # - Can use L and R to switch characters on the Equip and Status screens.
- # - Can use variable to log Game Completion on File Windows.
- # - Ability to allow player to unlock Windowskins and Fonts that can be used,
- # much like Chrono Cross.
- # - Compatability with Blizzard's Equap Skills from Tons.
- # - Font Installer included
- # - Much more!
- #
- # Requirements:
- # - Tons-of-Add-Ons, version 6.03 or higher.
- # - Either CCTS or ATES. The system will detect which one you are using, but
- # ONE of them is required. The script CAN use another time system, but it
- # will require some minor edits to Window_GameInfo.
- # - Starting with v.1.1, if you would like to use the Auto-Font Installer, it
- # is required that you have the 'FileUtils' module by Minero Aoki in
- # the data folder of your game. (included in demo)
- #
- # Credits/Thanks:
- # - Blizzard, for Tons and and a few other methods I used.
- # - game_guy, for the base script of the Quest system.
- # - Fantasist, for the window movement script.
- # - Wachunga, for the font installer
- #
- # Author's Notes:
- # As for the 'Quest' system that is integrated into the script, I understand
- # that not all users will wish to have this feature, but the script was not
- # originally written for everyone. I apologize for the inconvienence, but I
- # will not offer support on how to remove it. I have plans on at some point
- # creating a 'Plug-In' feature for this CMS that will allow users to create
- # there own independent scripts, and easily link them into this one without
- # a labor-intensive script merge, but until then, the Quest command is there.
- #
- # Instructions:
- # - Place script below default scripts and above CCTS/ATES and Tons.
- # - Configuration is below.
- # - The Quest script is just below the configuration.
- # It can be removed from this script and placed in its own slot if desired.
- # - You will also need to make one edit to Scene_Title. Find the lines:
- #
- # @continue_enabled = false
- # for i in 0..3
- # if FileTest.exist?("Save#{i+1}.rxdata")
- # @continue_enabled = true
- # end
- # end
- #
- # ...and REPLACE them with:
- #
- # @continue_enabled = (0...Zer0_CMS::Save_File_Number).any? {|i|
- # FileTest.exist?("#{Zer0_CMS::Save_Name}#{i+1}.#{Zer0_CMS::Save_Ext}")}
- #
- # - To add a fonts and windowskins to the available options during the game,
- # use these script calls:
- # - $game_system.add_skin('FILENAME')
- # - $game_system.add_font('FONTNAME')
- # The configuration for each below are just what the game begins with.
- # - Be sure that if you use non-standard fonts to include an installer that
- # will add the fonts when the game is first run.
- # - To set the deafult font and size, change the settings in Ultimate Font
- # Override in Tons(2).
- #
- #=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
- # BEGIN CONFIGURATION
- #=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
- module Zer0_CMS
- # These are the words use on the menu for the commands
- Commands = ['Item', 'Skill', 'Quest', 'Equip', 'Status', 'Options', 'Data']
- # Default window opacity
- Opacity = 160
- # These are the available windowskins that your game begins with.
- Windowskins = []#['Black', 'Thorns', 'Simple Line']
- # If you would like for fonts to be installed automatically the first time the
- # game is ran, set to true (see config below). Can only install fonts if the
- # user has the proper permissions on their account.
- Auto_Install_Fonts = true
- # Available fonts that are available at the start of the game.
- Fonts = ['Calibri', 'Times New Roman', 'Tahoma']
- # Minumum/Maximum allowed sizes for fonts
- Font_Size_Range = [10, 30]
- # These are the SFX the player can select from that will be played when a
- # window is moved. Nil will be used for 'None'. Set up like this:
- # ['SE_FILENAME', VOLUME, PITCH]
- Window_Move_SE = [nil, ['086-Action01', 60, 70], ['Paper', 60, 100],
- ['Swish1', 60, 100]]
- # IDs of items that are considered key items. They will not display in the
- # normal item window, only with the 'Key Items' sort method.
- Quest_Items = [23, 24, 25, 26, 27]
- # If true, will display icons instead of words for states/elements on the
- # Status Screen. Element icons must be in folder named 'Element', and state
- # icons must be in folder named 'State'. These folders must be in the Icons
- # folder. Each file must be labeled the same as the state/element that it
- # represents, except in all lower-case letters.
- Use_Element_Icons = true
- Use_State_Icons = true
- # Word used for the 'Evasion' stat. Used on status window, etc.
- Evasion_Word = 'EVA'
- # The 'plus' and 'minus' color, used on the equip screen. (R, G, B [, alpha])
- Plus_Color = Color.new(128, 255, 128)
- Minus_Color = Color.new(255, 128, 128)
- # Filename of the backgound used behind the menu. Set to nil if you want the
- # game map used. Bitmap must be 640x480, and in the 'Titles' folder.
- Menu_Background = nil
- # Filename of the background used behind the save file windows when 'Continue'
- # is chosen on the title screen. Set to nil if you want it to use the same
- # background as the title screen. Bitmap must be in the 'Titles' folder.
- Load_Screen_Background = nil
- # Transition used when loading a game. Must be in 'Transitions' folder.
- # Set up as follows: ['FILENAME', DURATION, VAGUE]. Set to nil if you do not
- # want to use this feature.
- Load_Transition = ['020-Flat01', 30, 15]
- # Number of save-files available in your game.
- Save_File_Number = 10
- # The name given to save-files ('Save' by default)
- Save_Name = 'Save'
- # Extension given to save-files ('rxdata' by default)
- Save_Ext = 'rxdata'
- # Add any additional data that needs to be saved and loaded here. Just add the
- # global variable that references the class into the array as a string ('').
- # This will make the save system compatible with scripts that alias Scene_Save
- # and Scene_Load and need the script's global variable saved/loaded.
- Save_Data = ['$dummy']
- # If you would like to use a variable that lets the player know the 'percent
- # complete' of the game, set this to true. It will display on the file screen.
- Game_Completion = true
- # ID of the variable that will be used. It is equal to the percent (0..100).
- # You will need to increase it at intervals throughout the game.
- Completion_Variable = 22
- # If true, the map name where the save occurred will be displayed on the
- # save/load screen.
- Use_Map_Name = true
- # Set to true ONLY if you are using a time script other than CCTS or ATES, and
- # have made the required edits. This will prevent the error message.
- Time_System_Override = false
- end
- module Fonts
- # This is the configuration for the font-installer. It was written by Wachunga,
- # and I take no credit for it. Be sure to include ALL fonts that your game
- # may have as an available option. The default location for the fonts is in a
- # folder labeled 'Fonts', within your games 'Data' folder.
- # New fonts aren't recognized in RMXP until the program is restarted, so the
- # game (unfortunately) needs to exit and restart after the initial installation.
- # Filenames of fonts to be installed
- Filenames = ['calibri.ttf', 'comic.ttf', 'Candara.ttf', 'tahoma.ttf']
- # Names (not filenames) of fonts to be installed
- Names = ['Calibri', 'Comic Sans MS', 'Candara', 'Tahoma']
- # Whether to notify player (via pop-up message) that fonts were installed
- Notify = true
- # Location of fonts (relative to game folder)
- Source = 'Data/Fonts/'
- # Location of fonts after installation
- Dest = ENV['SystemRoot'] + '\Fonts\\'
- end
- #-------------------------------------------------------------------------------
- #
- # Quest Script
- #
- # Here you can define the quests used in your game. Explantions for each
- # configuration are below. Here are the commands that can be used:
- #
- # Quest.complete(ID)
- # - Completes quest with ID
- #
- # Quest.fail(ID)
- # - Fails quest with ID
- #
- # Quest.add(ID)
- # - Adds quest with ID to the party's quest log
- #
- # Quest.remove(ID)
- # - Removes quest with ID
- #
- # Quest.status(ID)
- # - Mainly a scripting variable, it will return a string of the quest with
- # ID's status ('Complete', 'In Progress', or 'Failed')
- #
- #-------------------------------------------------------------------------------
- module Quest
- # The name of the quest.
- def self.name(id)
- text = case id
- when 1 then 'Picking Fruit'
- when 2 then 'Example #2'
- end
- return text != nil ? text : '?????' # <-- Default for undefined
- end
- # The picture used for each quest. Must be in a folder labeld 'Quest' within
- # the 'Pictures' folder.
- def self.picture(id)
- filename = case id
- when 1 then 'Fruit'
- when 2 then 'PLACE PICTURE NAME HERE'
- end
- return filename != nil ? RPG::Cache.picture("Quest/#{filename}") : nil
- end
- # The location for each quest.
- def self.location(id)
- text = case id
- when 1 then 'Lonely Forest'
- when 2 then 'Somewhere...'
- end
- return text != nil ? text : '?????'
- end
- # Paragraph that explains/describes each quest. Blizzard's text-slice method
- # will be used to automatically break to new lines. You can seperate the lines
- # with + signs to make this section a little more over-viewable.
- def self.description(id)
- text = case id
- when 1
- 'Farmer Bob has asked you to go collect Fruit for him. You need to ' +
- 'collect at least 10 Fruit for him, or else he will feed you to his pigs.'
- when 2
- 'Just another example of a Quest description.'
- end
- return text != nil ? text : '?????'
- end
- # The reward used for each quest. You will need to use an event to actually
- # give this to the player.
- def self.reward(id)
- text = case id
- when 1 then 'High Potion'
- when 2 then '1000 Gold'
- end
- return text != nil ? text : '?????'
- end
- #=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
- # END CONFIGURATION
- #=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
- def self.complete(id)
- $game_party.quests[id] = 'Complete'
- end
- def self.fail(id)
- $game_party.quests[id] = 'Failed'
- end
- def self.add(id)
- $game_party.quests[id] = 'In Progress'
- end
- def self.status(id)
- return $game_party.quests[id] != nil ? $game_party.quests[id] : ''
- end
- def self.remove(id)
- $game_party.quests.delete(id)
- end
- end
- #===============================================================================
- # ** Scene_Menu
- #===============================================================================
- $zer0_CMS = 1.2
- class Scene_Menu
- def initialize(index = 0, save_calling = false)
- @menu_index = index
- @save_calling = save_calling
- end
- #-------------------------------------------------------------------------------
- def main
- if Zer0_CMS::Menu_Background != nil
- background = Sprite.new
- background.bitmap = RPG::Cache.title(Zer0_CMS::Menu_Background)
- else
- background = Spriteset_Map.new
- end
- @command_window = Window_Command_HMod.new(Zer0_CMS::Commands)
- @command_window.index = @menu_index
- @info_window, @help_window = Window_GameInfo.new, Window_Zer0_Help.new
- Graphics.transition
- [@info_window, @command_window].each {|win| move(win, false)}
- @all_windows = [@command_window, @info_window, @help_window]
- call_save_screen if @save_calling
- loop {Graphics.update; Input.update; update; break if $scene != self}
- loop {Graphics.update; @all_windows.each {|window| window.update}
- break unless @all_windows.any? {|window| window.moving?}}
- Graphics.freeze
- @all_windows.each {|window| window.dispose}
- background.dispose
- if @loading_flag != nil && $scene.is_a?(Scene_Map)
- if Zer0_CMS::Load_Transition != nil
- tran = Zer0_CMS::Load_Transition
- Graphics.transition(tran[1], "Graphics/Transitions/#{tran[0]}", tran[2])
- Graphics.freeze
- 20.times {Graphics.update}
- map = Spriteset_Map.new
- Graphics.transition(tran[1], "Graphics/Transitions/#{tran[0]}", tran[2])
- map.dispose
- end
- end
- end
- #-------------------------------------------------------------------------------
- def update
- @all_windows.each {|window| window.update}
- if @command_window.active
- update_command
- elsif @char_select != nil && @char_select.active
- update_character_select
- elsif @item_window != nil && @item_window.active
- update_item
- elsif @item_options_window != nil && @item_options_window.active
- update_item_options
- elsif @item_sort_window != nil && @item_sort_window.active
- update_item_sort
- elsif @data_window != nil && @data_window.active
- update_data
- elsif @quest_list != nil && @quest_list.active
- update_quest_select
- elsif @options_window != nil && @options_window.active
- update_options
- elsif @equip_right != nil && @equip_right.active
- update_equip_right
- elsif @equip_item != nil && @equip_item.active
- update_equip_item
- elsif @skill_window != nil && @skill_window.active
- update_skill
- elsif @file_active != nil && @file_active
- update_file_select
- elsif @confirm_window != nil && @confirm_window.active
- update_confirm
- end
- end
- #-------------------------------------------------------------------------------
- def update_command
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- [@info_window, @command_window].each {|win| move(win)}
- $scene = Scene_Map.new
- elsif Input.trigger?(Input::C)
- $game_system.se_play($data_system.decision_se)
- case @command_window.index
- when 0 # Item
- if @item_window == nil
- @item_window = Window_Zer0_Item.new
- options = ['Use','Sort']
- @item_options_window = Window_Command_HMod.new(options)
- @item_options_window.x, @item_options_window.y = @command_window.width, -57
- @item_options_window.active = false
- @all_windows.push(@item_window, @item_options_window)
- end
- @item_window.index = @item_options_window.index = 0
- @item_window.help_window = @help_window
- [@item_window, @item_options_window, @help_window].each {|win| move(win, false)}
- @command_window.active, @item_window.active = false, true
- when 1 # Skill
- if @char_select == nil
- @char_select = Window_CharSelect.new
- @all_windows.push(@char_select)
- end
- @char_select.index = 0
- move(@char_select, false)
- @char_select.active, @command_window.active = true, false
- when 2 # Quest
- if @quest_list == nil
- quests = []
- $game_party.quests.each_key {|i| quests.push(Quest.name(i))}
- quests.push('None') if quests.empty?
- @quest_list = Window_Command_Mod.new(192, quests)
- @quest_list.height = 286 if @quest_list.height > 286
- @quest_list.x, @quest_list.y = -192, 194
- @all_windows.push(@quest_list)
- end
- @quest_list.index = 0
- @quest_list.active, @command_window.active = true, false
- move(@quest_list, false)
- when 3 # Equip
- if @char_select == nil
- @char_select = Window_CharSelect.new
- @all_windows.push(@char_select)
- end
- @char_select.index = 0
- move(@char_select, false)
- @char_select.active, @command_window.active = true, false
- when 4 # Status
- if @char_select == nil
- @char_select = Window_CharSelect.new
- @all_windows.push(@char_select)
- end
- @char_select.index = 0
- move(@char_select, false)
- @char_select.active, @command_window.active = true, false
- when 5 # Options
- if @options_window == nil
- @options_window = Window_Zer0_Options.new
- @all_windows.push(@options_window)
- end
- @options_window.index = 0
- $game_system.bgm_memorize
- $game_system.bgs_memorize
- [@help_window, @options_window].each {|win| move(win, false)}
- @options_window.active, @command_window.active = true, false
- when 6 # Data
- if @data_window == nil
- @data_window = Window_Command_HMod.new(['Save', 'Load'])
- @all_windows.push(@data_window)
- @data_window.x, @data_window.y = 640, 0
- end
- if $game_system.save_disabled
- @data_window.disable_item(0)
- end
- move(@data_window, false)
- @command_window.active, @data_window.active = false, true
- end
- end
- end
- #-------------------------------------------------------------------------------
- def update_character_select
- help_text = case @command_window.index
- when 0 # Item
- if @char_select.index == -1
- "Use #{@item.name} on entire party?"
- else
- "Use #{@item.name} on #{$game_party.actors[@char_select.index].name}?"
- end
- when 1 # Skill
- if @skill_use_flag != nil && @skill_use_flag && @skill != nil
- if @char_select.index == -1
- "Use #{@skill.name} on entire party?"
- else
- "Use #{@skill.name} on #{$game_party.actors[@char_select.index].name}?"
- end
- else
- "View/Use #{$game_party.actors[@char_select.index].name}'s skills?"
- end
- when 3 then "Change #{$game_party.actors[@char_select.index].name}'s equipment?"
- end
- @help_window.set_text(help_text) if help_text != nil
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @char_select.active = false
- case @command_window.index
- when 0 # Item
- move(@char_select)
- @item_window.active = true
- when 1 # Skill
- if @skill_use_flag != nil && @skill_use_flag
- @char_select.index = $game_party.actors.index(@skill_window.actor)
- @skill_use_flag, @skill_window.active = false, true
- else
- [@skill_window, @skill_status, @help_window, @char_select].each {|win|
- move(win)}
- @command_window.active = true
- end
- when 3 # Equip
- [@equip_item, @equip_right, @equip_left, @help_window, @char_select].each {|win|
- move(win)}
- @command_window.active = true
- when 4 # Status
- [@char_select, @status_window].each {|win| move(win)}
- @command_window.active = true
- end
- elsif Input.trigger?(Input::C)
- case @command_window.index
- when 0 # Item
- @actor = $game_party.actors[@char_select.index]
- if @char_select.index == -1
- used = false
- $game_party.actors.each {|actor| used |= actor.item_effect(@item)}
- elsif @char_select.index >= 0
- target = $game_party.actors[@char_select.index]
- used = target.item_effect(@item)
- end
- if used
- $game_system.se_play(@item.menu_se)
- if @item.consumable
- $game_party.lose_item(@item.id, 1)
- end
- if $game_party.all_dead?
- $scene = Scene_Gameover.new
- elsif @item.common_event_id > 0
- $game_temp.common_event_id = @item.common_event_id
- $scene = Scene_Map.new
- end
- else
- $game_system.se_play($data_system.buzzer_se)
- end
- @char_select.refresh
- @item_window.draw_item(@item_window.index)
- @item_window.refresh if $game_party.item_number(@item.id) == 0
- if $game_party.item_number(@item.id) <= 0
- move(@char_select)
- @char_select.active, @item_window.active = false, true
- end
- when 1 # Skill
- if @skill_window == nil
- @actor = $game_party.actors[@char_select.index]
- @skill_window = Window_Zer0_Skill.new(@actor)
- @skill_status = Window_Zer0_SkillStatus.new(@actor)
- @all_windows.push(@skill_window, @skill_status)
- @skill_use_flag = false
- end
- if @skill_use_flag == nil || !@skill_use_flag
- $game_system.se_play($data_system.decision_se)
- @actor = $game_party.actors[@char_select.index]
- @skill_window.index, @skill_window.help_window = 0, @help_window
- [@help_window, @skill_window, @skill_status].each {|win| move(win, false)}
- @skill_window.active, @char_select.active = true, false
- @skill_window.actor = @skill_status.actor = @actor
- @skill_status.element = @skill_window.skill.id
- else
- unless @actor.skill_can_use?(@skill.id)
- return $game_system.se_play($data_system.buzzer_se)
- end
- if @char_select.index == -1
- used = false
- $game_party.actors.each {|actor|
- used |= actor.skill_effect(@actor, @skill)}
- end
- if @char_select.index <= -2
- target = $game_party.actors[@char_select.index + 10]
- used = target.skill_effect(@actor, @skill)
- end
- if @char_select.index >= 0
- target = $game_party.actors[@char_select.index]
- used = target.skill_effect(@actor, @skill)
- end
- if used
- $game_system.se_play(@skill.menu_se)
- @actor.sp -= @skill.sp_cost
- [@skill_status, @skill_window, @char_select].each {|win| win.refresh}
- if $game_party.all_dead?
- $scene = Scene_Gameover.new
- elsif @skill.common_event_id > 0
- $game_temp.common_event_id = @skill.common_event_id
- $scene = Scene_Map.new
- end
- else
- $game_system.se_play($data_system.buzzer_se)
- end
- end
- when 3 # Equip
- @actor = $game_party.actors[@char_select.index]
- if @equip_item == nil
- @equip_item = Window_Zer0_Item.new(@actor, true)
- @equip_left = Window_Zer0_EquipLeft.new(@actor)
- @equip_right = Window_Zer0_EquipRight.new(@actor)
- @all_windows.push(@equip_item, @equip_left, @equip_right)
- end
- $game_system.se_play($data_system.decision_se)
- @equip_item.actor = @actor
- @equip_right.help_window = @help_window
- [@help_window, @equip_item, @equip_right, @equip_left].each {|win|
- move(win, false)}
- # FIX HERE
- @equip_right.index = @equip_item.equip_type
- @equip_right.active, @char_select.active = true, false
- when 4 # Status
- $game_system.se_play($data_system.decision_se)
- @actor = $game_party.actors[@char_select.index]
- if @status_window == nil
- @status_window = Window_Zer0_Status.new
- @all_windows.push(@status_window)
- end
- move(@status_window, false)
- end
- elsif Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN)
- if @command_window.index == 1 && @skill_window != nil
- if @skill_use_flag == nil || !@skill_use_flag
- @actor = $game_party.actors[@char_select.index]
- @skill_window.actor = @skill_status.actor = @actor
- end
- elsif @command_window.index == 4 && @status_window != nil
- @actor = $game_party.actors[@char_select.index]
- @status_window.actor = @actor
- elsif @command_window.index == 3 && @equip_right != nil
- @actor = $game_party.actors[@char_select.index]
- @equip_left.actor = @equip_right.actor = @equip_item.actor = @actor
- end
- end
- end
- #-------------------------------------------------------------------------------
- def update_item
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @item_window.index = -1
- @item_window.active, @item_options_window.active = false, true
- elsif Input.trigger?(Input::C)
- @item = @item_window.item
- unless @item.is_a?(RPG::Item) && $game_party.item_can_use?(@item.id)
- return $game_system.se_play($data_system.buzzer_se)
- end
- if @item.scope >= 3
- if @char_select == nil
- @char_select = Window_CharSelect.new
- @all_windows.push(@char_select)
- end
- $game_system.se_play($data_system.decision_se)
- @char_select.index = [4, 6].include?(@item.scope) ? -1 : 0
- move(@char_select, false)
- @item_window.active, @char_select.active = false, true
- elsif @item.common_event_id > 0
- $game_temp.common_event_id = @item.common_event_id
- $game_system.se_play(@item.menu_se)
- if @item.consumable
- $game_party.lose_item(@item.id, 1)
- @item_window.refresh
- end
- $scene = Scene_Map.new
- else
- $game_system.se_play($data_system.buzzer_se)
- end
- end
- end
- #-------------------------------------------------------------------------------
- def update_item_options
- text = case @item_options_window.index
- when 0 then 'Use items and view inventory.'
- when 1 then 'Sort inventory by parameters.'
- end
- @help_window.set_text(text)
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- [@item_options_window, @help_window, @item_window].each {|win| move(win)}
- @command_window.active, @item_options_window.active = true, false
- elsif Input.trigger?(Input::C)
- $game_system.se_play($data_system.decision_se)
- case @item_options_window.index
- when 0 # Use
- @item_window.help_window = @help_window
- @item_window.index = 0
- @item_window.active, @item_options_window.active = true, false
- when 1 # Sort
- if @item_sort_window == nil
- sort_types = ['All', 'Items', 'Weapons', 'Armor', 'Key Items', 'ABC',
- 'Quantity']
- @item_sort_window = Window_Command_Mod.new(96, sort_types)
- @item_sort_window.x, @item_sort_window.y = 96, 480
- @all_windows.push(@item_sort_window)
- end
- move(@item_sort_window, false)
- @item_options_window.active, @item_sort_window.active = false, true
- end
- @item_window.refresh
- end
- end
- #-------------------------------------------------------------------------------
- def update_item_sort
- help_text = case @item_sort_window.index
- when 0 then 'View all items, weapons, and armors.'
- when 1 then 'View only items.'
- when 2 then 'View only weapons.'
- when 3 then 'View only armors.'
- when 4 then 'View only key/quest items.'
- when 5 then 'Sort current display in alpha-numerical order.'
- when 6 then 'Sort current display by quantity in inventory.'
- end
- @help_window.set_text(help_text)
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @item_options_window.active, @item_sort_window.active = true, false
- move(@item_sort_window)
- elsif Input.trigger?(Input::C)
- $game_system.se_play($data_system.decision_se)
- if @item_sort_window.index <= 4
- @item_window.sort_type = @item_sort_window.index
- @item_window.abc_sort = @item_window.quantity_sort = false
- elsif @item_sort_window.index == 5
- @item_window.abc_sort, @item_window.quantity_sort = true, false
- elsif @item_sort_window.index == 6
- @item_window.quantity_sort, @item_window.abc_sort = true, false
- end
- @item_window.index = 0
- @item_window.refresh
- end
- end
- #-------------------------------------------------------------------------------
- def update_skill
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @skill_window.active, @char_select.active = false, true
- @skill_use_flag, @skill_window.index = false, -1
- @skill_status.element = nil
- elsif Input.trigger?(Input::L) || Input.trigger?(Input::R)
- $game_system.se_play($data_system.decision_se)
- @char_select.index += Input.trigger?(Input::L) ? 1 : -1
- @char_select.index %= $game_party.actors.size
- @actor = $game_party.actors[@char_select.index]
- @skill_window.actor = @skill_status.actor = @actor
- elsif Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN) ||
- Input.trigger?(Input::LEFT) || Input.trigger?(Input::RIGHT)
- @skill_status.element = @skill_window.skill.id
- elsif Input.trigger?(Input::C)
- @actor_index = $game_party.actors.index(@actor)
- @skill = @skill_window.skill
- if @skill == nil || !@actor.skill_can_use?(@skill.id)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- if @skill.scope >= 3
- @skill_use_flag = true
- @char_select.active, @skill_window.active = true, false
- if [4, 6].include?(@skill.scope)
- @char_select.index = -1
- elsif @skill.scope == 7
- @char_select.index = @actor_index - 10
- else
- @char_select.index = 0
- end
- elsif @skill.common_event_id > 0
- $game_temp.common_event_id = @skill.common_event_id
- $game_system.se_play(@skill.menu_se)
- @actor.sp -= @skill.sp_cost
- [@skill_window, @char_select, @skill_status].each {|win| win.refresh}
- $scene = Scene_Map.new
- end
- end
- end
- #-------------------------------------------------------------------------------
- def update_equip_right
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @equip_right.active, @char_select.active = false, true
- @equip_right.index = -1
- elsif Input.trigger?(Input::L) || Input.trigger?(Input::R)
- $game_system.se_play($data_system.decision_se)
- @char_select.index += Input.trigger?(Input::L) ? 1 : -1
- @char_select.index %= $game_party.actors.size
- @actor = $game_party.actors[@char_select.index]
- @equip_item.actor = @equip_left.actor = @equip_right.actor = @actor
- elsif Input.repeat?(Input::UP) || Input.repeat?(Input::DOWN) ||
- Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN)
- @equip_item.equip_type += Input.trigger?(Input::UP) ? -1 : 1
- @equip_item.equip_type = @equip_right.index
- @equip_item.refresh
- elsif Input.trigger?(Input::C)
- if @actor.equip_fix?(@equip_right.index)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- @equip_right.active, @equip_item.active = false, true
- @equip_item.index = 0
- @equip_left.refresh(@equip_right.item, @equip_item.item)
- end
- end
- #-------------------------------------------------------------------------------
- def update_equip_item
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @equip_left.refresh
- @equip_item.index = -1
- @equip_right.active, @equip_item.active = true, false
- elsif Input.trigger?(Input::C)
- $game_system.se_play($data_system.equip_se)
- item = @equip_item.item
- @actor.equip(@equip_right.index, item == nil ? 0 : item.id)
- @equip_right.active, @equip_item.active = true, false
- @equip_item.index = -1
- [@equip_right, @equip_item, @equip_left].each {|window| window.refresh}
- elsif Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN) ||
- Input.trigger?(Input::LEFT) || Input.trigger?(Input::RIGHT)
- @equip_left.refresh(@equip_right.item, @equip_item.item)
- end
- end
- #-------------------------------------------------------------------------------
- def update_options
- help_text = case @options_window.index
- when 0 then 'Change the windowskin used to display the windows.'
- when 1 then 'Change the opacity of the game windows.'
- when 2 then 'Change the font type used.'
- when 3 then 'Change the size of the selected font.'
- when 4 then 'Change the shaded text feature ON/OFF.'
- when 5 then 'Change the over-all volume of the music.'
- when 6 then 'Change the over-all volume of the sound effects.'
- when 7 then 'Change the sound effect played when a window moves.'
- when 8 then 'Change the speed that the windows move.'
- when 9 then 'Change the gradient bars ON/OFF.'
- when 10 then 'Change the style of gradient bar to use.'
- when 11 then 'Change the opacity of the gradient bars.'
- end
- @help_window.set_text(help_text)
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @options_window.active, @command_window.active = false, true
- [@options_window, @help_window].each {|win| move(win)}
- elsif Input.repeat?(Input::LEFT) || Input.repeat?(Input::RIGHT)
- $game_system.se_play($data_system.cursor_se)
- case @options_window.index
- when 0 # Windowskin
- index = $game_system.unlocked_skins.index($game_system.windowskin_name)
- return $game_system.se_play($data_system.buzzer_se) if index == nil
- Input.repeat?(Input::LEFT) ? index -= 1 : index += 1
- index %= $game_system.unlocked_skins.size
- $game_system.windowskin_name = $game_system.unlocked_skins[index]
- when 1 # Window Opacity
- $game_system.window_opacity += Input.repeat?(Input::LEFT) ? -5 : 5
- $game_system.window_opacity %= 260
- when 2 # Font Type
- index = $game_system.unlocked_fonts.index($game_system.fontname)
- return $game_system.se_play($data_system.buzzer_se) if index == nil
- Input.repeat?(Input::LEFT) ? index -= 1 : index += 1
- index %= $game_system.unlocked_fonts.size
- $game_system.fontname = $game_system.unlocked_fonts[index]
- when 3 # Font Size
- $game_system.fontsize += Input.repeat?(Input::LEFT) ? -1 : 1
- sz = Zer0_CMS::Font_Size_Range
- $game_system.fontsize = [[$game_system.fontsize, sz[1]].min, sz[0]].max
- when 4 # Shaded Text
- $game_system.SHADED_TEXT = $game_system.SHADED_TEXT == true ? false : true
- when 5 # BGM Volume
- $game_system.bgm_volume += Input.repeat?(Input::LEFT) ? -5 : 5
- $game_system.bgm_volume %= 105
- $game_system.bgm_play($game_system.bgm_memorize)
- when 6 # BGS Volume
- $game_system.se_volume += Input.repeat?(Input::LEFT) ? -5 : 5
- $game_system.se_volume %= 105
- $game_system.bgs_play($game_system.bgs_memorize)
- when 7 # Window SE
- $game_system.window_SE += Input.trigger?(Input::LEFT) ? -1 : 1
- $game_system.window_SE %= Zer0_CMS::Window_Move_SE.size
- audio = Zer0_CMS::Window_Move_SE[$game_system.window_SE]
- if audio != nil
- $game_system.se_play(RPG::AudioFile.new(audio[0], audio[1], audio[2]))
- end
- when 8 # Window Move Speed
- $game_system.window_speed += Input.repeat?(Input::LEFT) ? -1 : 1
- @all_windows.each {|window| window.refresh_speed}
- when 9 # Bars
- $game_system.BARS = $game_system.BARS == true ? false : true
- when 10 # Bar Style
- $game_system.bar_style += Input.repeat?(Input::LEFT) ? -1 : 1
- $game_system.bar_style %= 7
- when 11 # Bar Opacity
- $game_system.bar_opacity += Input.repeat?(Input::LEFT) ? -5 : 5
- end
- @all_windows.each {|window|
- window.back_opacity = $game_system.window_opacity
- if window.contents != nil
- window.contents.font.name = $game_system.fontname
- window.contents.font.size = $game_system.fontsize
- end
- window.refresh if defined?(window.refresh)
- }
- end
- end
- #-------------------------------------------------------------------------------
- def update_quest_select
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @quest_list.active, @command_window.active = false, true
- [@quest_info, @quest_list].each {|win| move(win)}
- elsif Input.trigger?(Input::C)
- if @quest_info == nil
- @quests = []
- $game_party.quests.each_key {|i| @quests.push(i)}
- @quest_info = Window_QuestInfo.new(@quests[@quest_list.index])
- @all_windows.push(@quest_info)
- end
- se = @quests.empty? ? $data_system.buzzer_se : $data_system.decision_se
- $game_system.se_play(se)
- unless @quests.empty?
- @quest_info.quest = @quests[@quest_list.index]
- move(@quest_info, false)
- end
- end
- end
- #-------------------------------------------------------------------------------
- def update_data
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- [@file_windows, @data_window, @help_window].each {|win| move(win)}
- @data_window.active, @command_window.active = false, true
- elsif Input.trigger?(Input::C)
- if $game_system.save_disabled && @data_window.index == 0
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- if @file_windows == nil
- @file_windows = []
- (0...Zer0_CMS::Save_File_Number).each {|i|
- filename = "#{Zer0_CMS::Save_Name}#{i+1}.#{Zer0_CMS::Save_Ext}"
- @file_windows[i] = Window_Zer0_File.new(i, filename)
- @all_windows.push(@file_windows[i])}
- end
- latest_time = Time.at(0)
- (0...Zer0_CMS::Save_File_Number).each {|i|
- filename = "#{Zer0_CMS::Save_Name}#{i+1}.#{Zer0_CMS::Save_Ext}"
- if FileTest.exist?(filename)
- file = File.open(filename, 'r')
- if file.mtime > latest_time
- latest_time = file.mtime
- $game_temp.last_file_index = i
- end
- file.close
- end
- }
- @file_index = $game_temp.last_file_index
- [@file_windows, @help_window].each {|win| move(win, false)}
- @file_windows[@file_index].selected, @data_window.active = true, false
- @file_active = true
- end
- end
- #-------------------------------------------------------------------------------
- def update_file_select
- help_text = case @data_window.index
- when 0 then 'Which file would you like to save to?'
- when 1 then 'Which file would you like to load?'
- end
- @help_window.set_text(help_text)
- if Input.trigger?(Input::B)
- if @save_calling
- [@command_window, @info_window, @data_window, @file_windows,
- @help_window].each {|win| move(win)}
- $game_temp.save_calling = false
- $scene = Scene_Map.new
- return
- end
- [@help_window, @file_windows].each {|win| move(win)}
- @file_active, @data_window.active = false, true
- @file_windows.each {|window| window.selected = false}
- elsif Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN)
- unless @file_windows.any? {|window| window.moving?}
- $game_system.se_play($data_system.cursor_se)
- @file_windows[@file_index].selected = false
- Input.trigger?(Input::UP) ? @file_index -= 1 : @file_index += 1
- @file_index = [[@file_index, @file_windows.size - 1].min, 0].max
- @file_windows[@file_index].selected = true
- if @file_windows[@file_index].y >= 480
- @file_windows.each_index {|i|
- @file_windows[i].y += Input.trigger?(Input::UP) ? 122 : -122
- @file_windows[i].y %= (@file_windows.size) * 122
- }
- end
- end
- elsif Input.trigger?(Input::C)
- if @confirm_window == nil
- @header_text = Window_Base.new(32, 480, 160, 82)
- @header_text.contents = Bitmap.new(128, 25)
- @confirm_window = Window_Command_HMod.new(['Yes', 'No'])
- @confirm_window.opacity = 0
- @confirm_window.x, @confirm_window.y = 32, 506
- @all_windows.push(@confirm_window, @header_text)
- end
- @header_text.contents.clear
- if @data_window.index == 0
- @header_text.contents.draw_text(0, 0, 128, 25, 'Overwrite this file?', 1)
- else
- @header_text.contents.draw_text(0, 0, 128, 25, 'Load this file?', 1)
- end
- @confirm_window.active, @file_active = true, false
- [@header_text, @confirm_window].each {|win| move(win, false)}
- end
- end
- #-------------------------------------------------------------------------------
- def update_confirm
- if Input.trigger?(Input::B)
- @confirm_window.active, @file_active = false, true
- [@header_text, @confirm_window].each {|win| move(win)}
- elsif Input.trigger?(Input::C)
- case @confirm_window.index
- when 0 # Yes
- filename = @file_windows[@file_index].filename
- case @data_window.index
- when 0 # Save
- $game_system.se_play($data_system.save_se)
- file = File.open(filename, 'wb')
- characters = []
- $game_party.actors.each {|actor|
- characters.push([actor.character_name, actor.character_hue])}
- Marshal.dump(characters, file)
- Marshal.dump(Graphics.frame_count, file)
- $game_system.save_count += 1
- $game_system.magic_number = $data_system.magic_number
- Marshal.dump($game_system, file)
- Marshal.dump($game_switches, file)
- Marshal.dump($game_variables, file)
- Marshal.dump($game_map, file)
- Marshal.dump($game_self_switches, file)
- Marshal.dump($game_screen, file)
- Marshal.dump($game_actors, file)
- Marshal.dump($game_party, file)
- Marshal.dump($game_troop, file)
- Marshal.dump($game_player, file)
- Zer0_CMS::Save_Data.each {|data| eval("Marshal.dump(#{data}, file)")}
- file.close
- @file_active, @confirm_window.active= true, false
- @file_windows[@file_index].refresh
- [@header_text, @confirm_window].each {|win| move(win)}
- when 1 # Load
- unless FileTest.exist?(filename)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.load_se)
- file = File.open(filename, 'rb')
- characters = Marshal.load(file)
- Graphics.frame_count = Marshal.load(file)
- $game_system = Marshal.load(file)
- $game_switches = Marshal.load(file)
- $game_variables = Marshal.load(file)
- $game_map = Marshal.load(file)
- $game_self_switches = Marshal.load(file)
- $game_screen = Marshal.load(file)
- $game_actors = Marshal.load(file)
- $game_party = Marshal.load(file)
- $game_troop = Marshal.load(file)
- $game_player = Marshal.load(file)
- Zer0_CMS::Save_Data.each {|data| eval("#{data} = Marshal.load(file)")}
- if $game_system.magic_number != $data_system.magic_number
- $game_map.setup($game_map.map_id)
- $game_player.center($game_player.x, $game_player.y)
- end
- $game_party.refresh
- file.close
- $game_system.bgm_play($game_system.playing_bgm)
- $game_system.bgs_play($game_system.playing_bgs)
- @loading_flag = true
- $scene = Scene_Map.new
- end
- when 1 # No
- @confirm_window.active, @file_active = false, true
- [@header_text, @confirm_window].each {|win| move(win)}
- end
- end
- end
- #-------------------------------------------------------------------------------
- def call_save_screen
- # Used when the "Call Save Screen" event command is used.
- @data_window = Window_Command_HMod.new(['Save', 'Load'])
- @data_window.active, @data_window.index = false, 0
- @file_windows = []
- [0, 1, 2].each {|i|
- filename = "#{Zer0_CMS::Save_Name}#{i+1}.#{Zer0_CMS::Save_Ext}"
- @file_windows[i] = Window_Zer0_File.new(i, filename)
- }
- @file_windows.each {|window| @all_windows.push(window)}
- @all_windows.push(@data_window)
- @file_index = $game_temp.last_file_index
- @file_windows[@file_index].selected, @file_active = true, true
- @command_window.active = false
- [@file_windows, @help_window, @data_window].each {|win| move(win, false)}
- end
- #-------------------------------------------------------------------------------
- def move(window, out = true)
- cmnd_width = @command_window.width
- dest = case window
- when @command_window then out ? [-cmnd_width, 0] : [0, 0]
- when @help_window then out ? [640, 57] : [192, 57]
- when @info_window then out ? [0, 480] : [0, 57]
- when @char_select then out ? [-192, 194] : [0, 194]
- when @status_window then out ? [640, 57] : [192, 57]
- when @item_window then out ? [192, 480] : [192, 114]
- when @item_options_window then out ? [cmnd_width, -57] : [cmnd_width, 0]
- when @item_sort_window then out ? [96, 480] : [96, 194]
- when @quest_list then out ? [-192, 194] : [0, 194]
- when @quest_info then out ? [640, 57] : [192, 57]
- when @options_window then out ? [192, 480] : [192, 114]
- when @skill_window then out ? [192, 480] : [192, 240]
- when @skill_status then out ? [640, 114] : [192, 114]
- when @equip_item then out ? [192, 480] : [192, 306]
- when @equip_left then out ? [640, 114] : [192, 114]
- when @equip_right then out ? [832, 114] : [384, 114]
- when @data_window then out ? [640, 0] : [cmnd_width, 0]
- when @confirm_window then out ? [32, 506] : [32, 220]
- when @header_text then out ? [32, 480] : [32, 194]
- when @file_windows
- @file_windows.each_index {|i|
- y = out ? 640 + (i * 122) : 114 + (i * 122)
- index = @file_index > 2 ? (i + @file_index) % @file_windows.size : i
- @file_windows[index].move(192, y)
- }
- return
- end
- unless window == nil
- window.move(dest[0], dest[1])
- end
- end
- end
- #===============================================================================
- # ** Scene_Load
- #===============================================================================
- class Scene_Load
- def initialize
- $game_temp = Game_Temp.new if $game_temp == nil
- end
- #-------------------------------------------------------------------------------
- def main
- @sprite = Sprite.new
- if Zer0_CMS::Load_Screen_Background != nil
- @sprite.bitmap = RPG::Cache.title(Zer0_CMS::Load_Screen_Background)
- else
- @sprite.bitmap = RPG::Cache.title($data_system.title_name)
- end
- @header = Window_Base.new(-640, 0, 640, 57)
- @header.contents = Bitmap.new(608, 25)
- @header.contents.draw_text(0, 0, 608, 25, 'Load Game', 1)
- @help_window = Window_Zer0_Help.new
- @help_window.x, @help_window.y = -@help_window.width, 57
- @help_window.set_text('Which file would you like to load?')
- @file_windows = []
- (0...Zer0_CMS::Save_File_Number).each {|i|
- @file_windows[i] = Window_Zer0_File.new(i, make_filename(i))
- @file_windows[i].x = 0}
- latest_time = Time.at(0)
- (0...Zer0_CMS::Save_File_Number).each {|i|
- filename = make_filename(i)
- if FileTest.exist?(filename)
- file = File.open(filename, 'r')
- if file.mtime > latest_time
- latest_time = file.mtime
- $game_temp.last_file_index = i
- end
- file.close
- end
- }
- @file_active, @file_index = true, $game_temp.last_file_index
- @file_windows[@file_index].selected = true
- @confirm = Window_Command.new(96, ['Load', 'Cancel'])
- @confirm.x, @confirm.y, @confirm.active = 640, selected_y, false
- Graphics.transition
- @header.move(0, 0)
- @help_window.move(0, 57)
- @file_windows.each_index {|i|
- y = 114 + (i * 122)
- index = @file_index > 2 ? (i + @file_index) % @file_windows.size : i
- @file_windows[index].move(0, y)}
- loop {Graphics.update; Input.update; update; break if $scene != self}
- Graphics.freeze
- [@sprite.bitmap, @sprite, @help_window, @confirm, @header].each {|sprite|
- sprite.dispose}
- @file_windows.each {|window| window.dispose}
- end
- #-------------------------------------------------------------------------------
- def update
- [@help_window, @confirm, @header].each {|window| window.update}
- @file_windows.each {|window| window.update}
- if @file_active
- update_file
- elsif @confirm.active
- update_confirm
- end
- end
- #-------------------------------------------------------------------------------
- def update_file
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Title.new
- elsif Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN)
- $game_system.se_play($data_system.cursor_se)
- @file_windows[@file_index].selected = false
- Input.trigger?(Input::UP) ? @file_index -= 1 : @file_index += 1
- @file_index = [[@file_index, @file_windows.size - 1].min, 0].max
- @file_windows[@file_index].selected = true
- if @file_windows[@file_index].y >= 480
- @file_windows.each_index {|i|
- @file_windows[i].y += Input.trigger?(Input::UP) ? 122 : -122
- @file_windows[i].y %= (@file_windows.size) * 122}
- end
- elsif Input.trigger?(Input::C)
- unless FileTest.exist?(make_filename(@file_index))
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- @confirm.active, @file_active, @confirm.index = true, false, 0
- @confirm.y = selected_y
- @confirm.move(448, selected_y)
- @help_window.set_text("Load File #{@file_index + 1}?")
- end
- end
- #-------------------------------------------------------------------------------
- def update_confirm
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @confirm.y = selected_y
- @confirm.move(640, selected_y)
- @confirm.active, @file_active = false, true
- @help_window.set_text('Which file would you like to load?')
- elsif Input.trigger?(Input::C)
- if @confirm.index == 0
- $game_system.se_play($data_system.load_se)
- file = File.open(make_filename(@file_index), 'rb')
- characters = Marshal.load(file)
- Graphics.frame_count = Marshal.load(file)
- $game_system = Marshal.load(file)
- $game_switches = Marshal.load(file)
- $game_variables = Marshal.load(file)
- $game_map = Marshal.load(file)
- $game_self_switches = Marshal.load(file)
- $game_screen = Marshal.load(file)
- $game_actors = Marshal.load(file)
- $game_party = Marshal.load(file)
- $game_troop = Marshal.load(file)
- $game_player = Marshal.load(file)
- Zer0_CMS::Save_Data.each {|data| eval("#{data} = Marshal.load(file)")}
- if $game_system.magic_number != $data_system.magic_number
- $game_map.setup($game_map.map_id)
- $game_player.center($game_player.x, $game_player.y)
- end
- $game_party.refresh
- file.close
- $game_system.bgm_play($game_system.playing_bgm)
- $game_system.bgs_play($game_system.playing_bgs)
- $scene = Scene_Map.new
- else
- $game_system.se_play($data_system.cancel_se)
- @confirm.active, @file_active = false, true
- @confirm.y = selected_y
- @confirm.move(640, selected_y)
- @help_window.set_text('Which file would you like to load?')
- end
- end
- end
- #-------------------------------------------------------------------------------
- def selected_y
- @file_windows.each {|window|
- if window.selected
- return @file_windows[@file_windows.index(window)].y + 13
- end
- }
- end
- #-------------------------------------------------------------------------------
- def make_filename(file_index)
- return "#{Zer0_CMS::Save_Name}#{file_index + 1}.#{Zer0_CMS::Save_Ext}"
- end
- end
- #===============================================================================
- # ** Scene_Map
- #===============================================================================
- class Scene_Map
- def call_save
- $game_player.straighten
- $scene = Scene_Menu.new(6, true)
- end
- end
- #===============================================================================
- # ** Game_Map
- #===============================================================================
- class Game_Map
- def name(id = @map_id)
- return $map_names[id]
- end
- end
- #===============================================================================
- # ** Game_Party
- #===============================================================================
- class Game_Party
- attr_accessor :quests
- alias zer0_quest_init initialize
- def initialize
- zer0_quest_init
- @quests = {}
- end
- end
- #===============================================================================
- # ** Bitmap (Method created by Blizzard)
- #===============================================================================
- class Bitmap
- def slice_text(text, width)
- words = text.split(' ')
- return words if words.size == 1
- result, current_text = [], words.shift
- words.each_index {|i|
- if self.text_size("#{current_text} #{words[i]}").width > width
- result.push(current_text)
- current_text = words[i]
- else
- current_text = "#{current_text} #{words[i]}"
- end
- result.push(current_text) if i >= words.size - 1}
- return result
- end
- end
- #===============================================================================
- # ** Game_System
- #===============================================================================
- class Game_System
- attr_accessor :bgm_volume, :se_volume, :window_opacity, :window_SE
- attr_reader :window_speed, :unlocked_skins, :unlocked_fonts
- alias zer0_cms_system_init initialize
- def initialize
- zer0_cms_system_init
- @unlocked_skins, @unlocked_fonts = Zer0_CMS::Windowskins, Zer0_CMS::Fonts
- @window_opacity, @window_SE, @window_speed = 160, 1, 5
- @bgm_volume = @se_volume = 100
- if $tons_version == nil || $tons_version < 6.03
- raise("Blizzard's Tons-of-Addons is required for Zer0_CMS to work.\n" +
- 'Please install first to continue. (Version 6.03 or higher)')
- else
- unless TONS_OF_ADDONS::ULTIMATE_FONT_OVERRIDE
- raise("ULTIMATE_FONT_OVERRIDE must be 'true' for many features to work\n" +
- 'correctly. Please set to true in Tons-of-Addons(2) to continue.')
- end
- end
- if $ccts == nil && $ates == nil
- unless Zer0_CMS::Time_System_Override
- raise("Zer0_CMS requires Complete Climate and Time System (CCTS) or\n" +
- "Advanced Time and Environment System (ATES) to work!\n" +
- 'Please install one of them before continuing.')
- end
- elsif $ccts != nil && $ates != nil
- raise("Zer0_CMS is not compatible with both ATES and CCTS.\n" +
- 'Remove one of them to continue.')
- end
- unless Zer0_CMS::Save_Data.all? {|data| data.is_a?(String)}
- raise("Zer0_CMS Configuration Error!\n" +
- 'All Save_Data must be written as a string. (\'\').')
- end
- if Zer0_CMS::Auto_Install_Fonts && !FileTest.exists?('Data\fileutils.rb')
- raise("\"fileutils.rb\" missing from Data folder.\n" +
- 'This file is required for installing fonts.')
- end
- end
- #-------------------------------------------------------------------------------
- def add_skin(filename)
- unless @unlocked_skins.include?(filename)
- @unlocked_skins.push(filename)
- end
- end
- #-------------------------------------------------------------------------------
- def add_font(font)
- unless @unlocked_fonts.include?(font)
- @unlocked_fonts.push(font)
- end
- end
- #-------------------------------------------------------------------------------
- def window_speed=(speed)
- @window_speed = [[speed, 10].min, 1].max
- end
- #-------------------------------------------------------------------------------
- def bgm_play(bgm)
- @playing_bgm = bgm
- if bgm != nil && bgm.name != ''
- volume = bgm.volume * (@bgm_volume / 100.0)
- Audio.bgm_play('Audio/BGM/' + bgm.name, volume, bgm.pitch)
- else
- Audio.bgm_stop
- end
- Graphics.frame_reset
- end
- #-------------------------------------------------------------------------------
- def bgs_play(bgs)
- @playing_bgs = bgs
- if bgs != nil && bgs.name != ''
- volume = bgs.volume * (@se_volume / 100.0)
- Audio.bgs_play('Audio/BGS/' + bgs.name, volume, bgs.pitch)
- else
- Audio.bgs_stop
- end
- Graphics.frame_reset
- end
- #-------------------------------------------------------------------------------
- def me_play(me)
- if me != nil && me.name != ''
- volume = me.volume * (@bgm_volume / 100.0)
- Audio.me_play('Audio/ME/' + me.name, volume, me.pitch)
- else
- Audio.me_stop
- end
- Graphics.frame_reset
- end
- #-------------------------------------------------------------------------------
- def se_play(se)
- if se != nil && se.name != ''
- volume = se.volume * (@se_volume / 100.0)
- Audio.se_play('Audio/SE/' + se.name, volume, se.pitch)
- end
- end
- end
- #===============================================================================
- # ** Game_Actor
- #===============================================================================
- class Game_Actor
- def guard_elements(icon_flag = false)
- elements = []
- [@armor1_id, @actor2_id, @actor3_id, @actor4_id].each {|id|
- if id != nil && $data_armors[id] != nil
- $data_armors[id].guard_element_set.each {|element_id|
- unless elements.include?($data_system.elements[element_id]) ||
- $DUMMY_ELEMENTS.include?(element_id)
- elements.push($data_system.elements[element_id])
- end
- }
- end
- }
- if icon_flag
- elements.each_index {|i|
- elements[i] = RPG::Cache.icon("Element/#{elements[i].downcase}")}
- end
- return elements
- end
- #-------------------------------------------------------------------------------
- def guard_states(icon_flag = false)
- states = []
- [@armor1_id, @actor2_id, @actor3_id, @actor4_id].each {|id|
- if id != nil && id != 0
- $data_armors[id].guard_state_set.each {|state_id|
- unless states.include?($data_states[state_id].name) ||
- $DUMMY_STATES.include?(state_id)
- states.push($data_states[state_id].name)
- end
- }
- end
- }
- if icon_flag
- states.each_index {|i|
- states[i] = RPG::Cache.icon("State/#{states[i].downcase}")}
- end
- return states
- end
- #-------------------------------------------------------------------------------
- def attack_elements(icon_flag = false)
- elements = []
- if @weapon_id != nil
- return [] if $data_weapons[@weapon_id] == nil
- $data_weapons[@weapon_id].element_set.each {|element_id|
- unless $DUMMY_ELEMENTS.include?(element_id)
- elements.push($data_system.elements[element_id])
- end
- }
- end
- if icon_flag
- elements.each_index {|i|
- elements[i] = RPG::Cache.icon("Element/#{elements[i].downcase}")}
- end
- return elements
- end
- #-------------------------------------------------------------------------------
- def attack_states(icon_flag = false)
- states = []
- if @weapon_id != nil
- return [] if $data_weapons[@weapon_id] == nil
- $data_weapons[@weapon_id].plus_state_set.each {|state_id|
- unless $DUMMY_STATES.include?(state_id)
- states.push($data_states[state_id].name)
- end
- }
- end
- if icon_flag
- states.each_index {|i|
- states[i] = RPG::Cache.icon("State/#{states[i].downcase}")}
- end
- return states
- end
- end
- #===============================================================================
- # ** Window_Base (Original script by Fantasist, with minor edit for audio)
- #===============================================================================
- class Window_Base < Window
- attr_accessor :dest_x, :dest_y, :move_speed
- alias move_wins_winbase_init initialize
- def initialize(x, y, width, height)
- move_wins_winbase_init(x, y, width, height)
- self.back_opacity = $game_system.window_opacity
- self.dest_x = x
- self.dest_y = y
- self.move_speed = $game_system.window_speed
- end
- #-------------------------------------------------------------------------------
- def moving?
- return (self.x != self.dest_x || self.y != self.dest_y)
- end
- #-------------------------------------------------------------------------------
- def move(dest_x, dest_y, move_speed = nil, se_flag = true)
- self.dest_x = dest_x
- self.dest_y = dest_y
- self.move_speed = move_speed unless move_speed.nil?
- if se_flag && moving?
- audio = Zer0_CMS::Window_Move_SE[$game_system.window_SE]
- if audio != nil
- file = RPG::AudioFile.new(audio[0], audio[1], audio[2])
- $game_system.se_play(file)
- end
- end
- end
- #-------------------------------------------------------------------------------
- def refresh_speed
- self.move_speed = $game_system.window_speed
- end
- #-------------------------------------------------------------------------------
- def move_wins
- dx = (self.dest_x - self.x).to_f / self.move_speed
- dy = (self.dest_y - self.y).to_f / self.move_speed
- dx = self.dest_x > self.x ? dx.ceil : dx.floor
- dy = self.dest_y > self.y ? dy.ceil : dy.floor
- self.x += dx
- self.y += dy
- end
- #-------------------------------------------------------------------------------
- def x=(val)
- self.dest_x = val unless moving?
- super(val)
- end
- #-------------------------------------------------------------------------------
- def y=(val)
- self.dest_y = val unless moving?
- super(val)
- end
- #-------------------------------------------------------------------------------
- alias move_wins_winbase_update update
- def update
- move_wins_winbase_update
- move_wins if moving?
- end
- end
- #==============================================================================
- # ** Window_Selectable_Mod
- #==============================================================================
- class Window_Selectable_Mod < Window_Base
- attr_reader :index, :help_window
- def initialize(x, y, width, height)
- super(x, y, width, height)
- @item_max, @column_max, @index = 1, 1, -1
- end
- #-------------------------------------------------------------------------------
- def index=(index)
- @index = index
- if self.active && @help_window != nil
- update_help
- end
- update_cursor_rect
- end
- #-------------------------------------------------------------------------------
- def row_max
- return (@item_max + @column_max - 1) / @column_max
- end
- #-------------------------------------------------------------------------------
- def top_row
- return self.oy / 25
- end
- #-------------------------------------------------------------------------------
- def top_row=(row)
- self.oy = [[row, 0].max, row_max - 1].min * 25
- end
- #-------------------------------------------------------------------------------
- def page_row_max
- return (self.height - 32) / 25
- end
- #-------------------------------------------------------------------------------
- def page_item_max
- return page_row_max * @column_max
- end
- #-------------------------------------------------------------------------------
- def help_window=(help_window)
- @help_window = help_window
- if self.active && @help_window != nil
- update_help
- end
- end
- #-------------------------------------------------------------------------------
- def update_cursor_rect
- if @index < 0
- self.cursor_rect.empty
- return
- end
- row = @index / @column_max
- if row < self.top_row
- self.top_row = row
- end
- if row > self.top_row + (self.page_row_max - 1)
- self.top_row = row - (self.page_row_max - 1)
- end
- cursor_width = self.width / @column_max - 32
- x = @index % @column_max * (cursor_width + 32)
- y = @index / @column_max * 25 - self.oy
- self.cursor_rect.set(x, y, cursor_width, 25)
- end
- #-------------------------------------------------------------------------------
- def update
- super
- if self.active && @item_max > 0 && @index >= 0
- if Input.repeat?(Input::DOWN)
- if (@column_max == 1 && Input.trigger?(Input::DOWN)) ||
- @index < @item_max - @column_max
- $game_system.se_play($data_system.cursor_se)
- @index = (@index + @column_max) % @item_max
- end
- elsif Input.repeat?(Input::UP)
- if (@column_max == 1 && Input.trigger?(Input::UP)) ||
- @index >= @column_max
- $game_system.se_play($data_system.cursor_se)
- @index = (@index - @column_max + @item_max) % @item_max
- end
- elsif Input.repeat?(Input::RIGHT)
- if @column_max >= 2 && @index < @item_max - 1
- $game_system.se_play($data_system.cursor_se)
- @index += 1
- end
- elsif Input.repeat?(Input::LEFT)
- if @column_max >= 2 && @index > 0
- $game_system.se_play($data_system.cursor_se)
- @index -= 1
- end
- elsif Input.repeat?(Input::R)
- if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
- $game_system.se_play($data_system.cursor_se)
- @index = [@index + self.page_item_max, @item_max - 1].min
- self.top_row += self.page_row_max
- end
- elsif Input.repeat?(Input::L)
- if self.top_row > 0
- $game_system.se_play($data_system.cursor_se)
- @index = [@index - self.page_item_max, 0].max
- self.top_row -= self.page_row_max
- end
- end
- end
- if self.active && @help_window != nil
- update_help
- end
- update_cursor_rect
- end
- end
- #===============================================================================
- # ** Window_Selectable_HMod
- #===============================================================================
- class Window_Selectable_HMod < Window_Base
- attr_reader :index, :help_window
- def initialize(x, y, width, height)
- super(x, y, width, height)
- @item_max, @column_max, @index = 1, 1, -1
- end
- #-------------------------------------------------------------------------------
- def index=(index)
- @index = index
- if self.active && @help_window != nil
- update_help
- end
- update_cursor_rect
- end
- #-------------------------------------------------------------------------------
- def row_max
- return (@item_max + @column_max - 1) / @column_max
- end
- #-------------------------------------------------------------------------------
- def top_row
- return self.oy / 25
- end
- #-------------------------------------------------------------------------------
- def top_row=(row)
- if row < 0
- row = 0
- end
- if row > row_max - 1
- row = row_max - 1
- end
- self.oy = row * 25
- end
- #-------------------------------------------------------------------------------
- def page_row_max
- return (self.height - 32) / 25
- end
- #-------------------------------------------------------------------------------
- def page_item_max
- return page_row_max * @column_max
- end
- #-------------------------------------------------------------------------------
- def help_window=(help_window)
- @help_window = help_window
- if self.active && @help_window != nil
- update_help
- end
- end
- #-------------------------------------------------------------------------------
- def update_cursor_rect
- if @index < 0
- self.cursor_rect.empty
- return
- end
- row = @index / @column_max
- if row < self.top_row
- self.top_row = row
- end
- if row > self.top_row + (self.page_row_max - 1)
- self.top_row = row - (self.page_row_max - 1)
- end
- cursor_width = (self.width - 32) / @column_max
- x = @index * 64
- y = @index / @column_max * 25 - self.oy
- self.cursor_rect.set(x, y, cursor_width, 25)
- end
- #-------------------------------------------------------------------------------
- def update
- super
- if self.active && @item_max > 0 && @index >= 0
- if Input.repeat?(Input::DOWN)
- if (@column_max == 1 && Input.trigger?(Input::DOWN)) ||
- @index < @item_max - @column_max
- $game_system.se_play($data_system.cursor_se)
- @index = (@index + @column_max) % @item_max
- end
- elsif Input.repeat?(Input::UP)
- if (@column_max == 1 && Input.trigger?(Input::UP)) ||
- @index >= @column_max
- $game_system.se_play($data_system.cursor_se)
- @index = (@index - @column_max + @item_max) % @item_max
- end
- elsif Input.repeat?(Input::RIGHT)
- if @column_max >= 2
- $game_system.se_play($data_system.cursor_se)
- @index = (@index + 1) % @item_max
- end
- elsif Input.repeat?(Input::LEFT)
- if @column_max >= 2
- $game_system.se_play($data_system.cursor_se)
- @index = (@index - 1) % @item_max
- end
- elsif Input.repeat?(Input::R)
- if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
- $game_system.se_play($data_system.cursor_se)
- @index = [@index + self.page_item_max, @item_max - 1].min
- self.top_row += self.page_row_max
- end
- elsif Input.repeat?(Input::L)
- if self.top_row > 0
- $game_system.se_play($data_system.cursor_se)
- @index = [@index - self.page_item_max, 0].max
- self.top_row -= self.page_row_max
- end
- end
- end
- if self.active && @help_window != nil
- update_help
- end
- update_cursor_rect
- end
- end
- #===============================================================================
- # ** Window_Command_Mod
- #===============================================================================
- class Window_Command_Mod < Window_Selectable_Mod
- def initialize(width, commands)
- super(0, 0, width, commands.size * 25 + 32)
- @item_max = commands.size
- @commands = commands
- self.contents = Bitmap.new(width - 32, @item_max * 25)
- refresh
- self.index = 0
- end
- #-------------------------------------------------------------------------------
- def refresh
- self.contents.clear
- (0...@item_max).each {|i| draw_item(i, normal_color)}
- end
- #-------------------------------------------------------------------------------
- def draw_item(index, color)
- self.contents.font.color = color
- rect = Rect.new(4, 25 * index, self.contents.width - 8, 25)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- self.contents.draw_text(rect, @commands[index])
- end
- #-------------------------------------------------------------------------------
- def disable_item(index)
- draw_item(index, disabled_color)
- end
- #-------------------------------------------------------------------------------
- def update_cursor_rect
- super
- cursor_width = self.width / @column_max - 32
- x = @index % @column_max * (cursor_width + 32)
- y = @index / @column_max * 25 - self.oy
- self.cursor_rect.set(x, y, cursor_width, 25)
- end
- end
- #===============================================================================
- # ** Window_Command_HMod
- #===============================================================================
- class Window_Command_HMod < Window_Selectable_HMod
- def initialize(commands)
- super((commands.size * 64 + 32) * -1, 0, commands.size * 64 + 32, 57)
- @column_max = @item_max = commands.size
- @commands = commands
- self.contents = Bitmap.new(@item_max * 64, 25)
- refresh
- self.index = 0
- end
- #-------------------------------------------------------------------------------
- def refresh
- self.contents.clear
- (0...@item_max).each {|i| draw_item(i, normal_color)}
- end
- #-------------------------------------------------------------------------------
- def draw_item(index, color)
- self.contents.font.color = color
- self.contents.draw_text(index * 64, 0, 64, 25, @commands[index], 1)
- end
- #-------------------------------------------------------------------------------
- def disable_item(index)
- draw_item(index, disabled_color)
- end
- end
- #===============================================================================
- # ** Window_GameInfo
- #===============================================================================
- class Window_GameInfo < Window_Base
- def initialize
- number = 7
- super(0, 480, 192, number * 15 + 32)
- self.contents = Bitmap.new(160, number * 15)
- refresh
- end
- #-------------------------------------------------------------------------------
- def refresh
- self.contents.clear
- @total_sec = Graphics.frame_count / Graphics.frame_rate
- if $ccts != nil
- @minute, hour = $game_system.time.minute, $game_system.time.hour
- day, day_name = $game_system.time.day.to_s, $game_system.time.day_name
- if $ccts < 1.2
- month = CCTS::Months[$game_system.time.month - 1]
- else
- month = CCTS::MONTHS[$game_system.time.month - 1]
- end
- year = $game_system.time.year.to_s
- elsif $ates != nil
- @minute, hour = $game_system.ates.time.min, $game_system.ates.time.hour
- day = $game_system.ates.time.day.to_s
- day_name = ATES::WEEKDAYS[$game_system.ates.time.wday - 1]
- month = ATES::MONTHS[$game_system.ates.time.mon]
- year = $game_system.ates.time.year.to_s
- end
- h, m, s = @total_sec / 60 / 60, @total_sec / 60 % 60, @total_sec % 60
- time = sprintf('%2d:%02d', hour, @minute)
- date = "#{month} #{day}, #{year}"
- steps, gold = $game_party.steps.to_s, $game_party.gold.to_s
- playtime = sprintf('%02d:%02d:%02d', h, m, s)
- words = ['Area:', 'Time:', 'Day:', 'Date:', 'Steps:', 'Play Time:',
- $data_system.words.gold + ':']
- info = [$game_map.name, time, day_name, date, steps, playtime, gold]
- info.each_index {|i|
- self.contents.font.color = system_color
- self.contents.draw_text(0, i * 15, 160, 15, words[i])
- self.contents.font.color = normal_color
- self.contents.draw_text(0, i * 15, 160, 15, info[i], 2)}
- end
- #-------------------------------------------------------------------------------
- def update
- super
- min = $ccts != nil ? $game_system.time.minute : $game_system.ates.time.min
- if @minute != min || Graphics.frame_count / Graphics.frame_rate != @total_sec
- refresh
- end
- end
- end
- #===============================================================================
- # ** Window_CharSelect
- #===============================================================================
- class Window_CharSelect < Window_Selectable
- def initialize
- @actors = $game_party.actors
- height = @actors.size == 4 ? 286 : @actors.size * 64 + 32
- super(-192, 194, 192, height)
- self.contents = Bitmap.new(160, height - 32)
- self.index, self.active, @item_max = 0, false, @actors.size
- refresh
- end
- #-------------------------------------------------------------------------------
- def refresh
- self.contents.clear
- @actors.each_index {|i|
- y = i * 64
- draw_actor_graphic(@actors[i], 16, y + 58)
- draw_actor_level(@actors[i], 96, y - 4)
- draw_actor_name(@actors[i], 32, y - 4)
- draw_actor_hp(@actors[i], 36, y + 9, 124)
- draw_actor_sp(@actors[i], 36, y + 30, 124)}
- end
- #-------------------------------------------------------------------------------
- def update_cursor_rect
- if @index < 0
- self.cursor_rect.empty
- return
- end
- row = @index / @column_max
- self.top_row = row if row < self.top_row
- if row > self.top_row + (self.page_row_max - 1)
- self.top_row = row - (self.page_row_max - 1)
- end
- cursor_width = self.width / @column_max - 32
- x = @index % @column_max * (cursor_width + 32)
- y = @index / @column_max * 64 - self.oy
- self.cursor_rect.set(x, y, cursor_width, 64)
- end
- end
- #===============================================================================
- # ** Window_Zer0_Help
- #===============================================================================
- class Window_Zer0_Help < Window_Base
- def initialize(width = 448)
- super(640, 57, width, 57)
- self.contents = Bitmap.new(width - 32, height - 32)
- end
- #-------------------------------------------------------------------------------
- def set_text(text, align = 0)
- if text != @text || align != @align
- self.contents.clear
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
- @text = text
- @align = align
- @actor = nil
- end
- self.visible = true
- end
- #-------------------------------------------------------------------------------
- def refresh
- if @text != nil && @align != nil
- self.contents.clear
- self.contents.draw_text(4, 0, self.width - 40, 32, @text, @align)
- end
- end
- end
- #===============================================================================
- # ** Window_Zer0_Item
- #===============================================================================
- class Window_Zer0_Item < Window_Selectable
- attr_accessor :abc_sort, :quantity_sort, :sort_type, :equip_type
- def initialize(actor = $game_party.actors[0], equip_flag = false)
- height = equip_flag == true ? 174 : 366
- super(192, 480, 448, height)
- @column_max = 2
- self.index = @sort_type = 0
- @abc_sort = @quantity_sort = false
- if equip_flag
- @actor, @equip_flag = actor, equip_flag
- @equip_type, self.index = 0, -1
- end
- refresh
- end
- #-------------------------------------------------------------------------------
- def actor=(actor)
- @actor = actor
- refresh
- end
- #-------------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #-------------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- unless @equip_flag # If normal item window
- data1, data2, data3, data4 = [], [], [], []
- (1...$data_items.size).each {|i|
- if $game_party.item_number(i) > 0
- if Zer0_CMS::Quest_Items.include?(i)
- data4.push($data_items[i])
- else
- data1.push($data_items[i])
- end
- end
- }
- (1...$data_weapons.size).each {|i|
- if $game_party.weapon_number(i) > 0
- data2.push($data_weapons[i])
- end
- }
- (1...$data_armors.size).each {|i|
- if $game_party.armor_number(i) > 0
- data3.push($data_armors[i])
- end
- }
- if @abc_sort
- [data1, data2, data3, data4].each {|list| list.sort! {|a, b|
- a.name <=> b.name}}
- elsif @quantity_sort
- [data1, data4].each {|list| list.sort! {|a, b|
- $game_party.item_number(a.id) <=> $game_party.item_number(b.id)}}
- data2.sort! {|a, b|
- $game_party.weapon_number(a.id) <=> $game_party.weapon_number(b.id)}
- data3.sort! {|a, b|
- $game_party.armor_number(a.id) <=> $game_party.armor_number(b.id)}
- end
- @data = case @sort_type
- when 0 then data1 + data2 + data3
- when 1 then data1
- when 2 then data2
- when 3 then data3
- when 4 then data4
- end
- else # If equip item window
- @data = []
- if @equip_type == 0 # Weapons
- weapon_set = $data_classes[@actor.class_id].weapon_set
- (1...$data_weapons.size).each {|i|
- if $game_party.weapon_number(i) > 0 && weapon_set.include?(i)
- @data.push($data_weapons[i])
- end
- }
- end
- if @equip_type != 0 # Armors
- armor_set = $data_classes[@actor.class_id].armor_set
- (1...$data_armors.size).each {|i|
- if $game_party.armor_number(i) > 0 && armor_set.include?(i)
- if $data_armors[i].kind == @equip_type-1
- @data.push($data_armors[i])
- end
- end
- }
- end
- end
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- (0...@item_max).each {|i| draw_item(i)}
- end
- end
- #-------------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- number = case item
- when RPG::Item then $game_party.item_number(item.id)
- when RPG::Weapon then $game_party.weapon_number(item.id)
- when RPG::Armor then $game_party.armor_number(item.id)
- end
- if (item.is_a?(RPG::Item) && $game_party.item_can_use?(item.id)) ||
- @equip_flag
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- x = 4 + index % 2 * (192 + 32)
- y = index / 2 * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 172, 32, item.name, 0)
- self.contents.draw_text(x + 144, y, 16, 32, ':', 1)
- self.contents.draw_text(x + 160, y, 24, 32, number.to_s, 2)
- end
- #-------------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.item == nil ? '' : self.item.description)
- end
- end
- #==============================================================================
- # ** Window_Zer0_Skill
- #==============================================================================
- class Window_Zer0_Skill < Window_Selectable
- attr_reader :actor
- def initialize(actor)
- super(192, 480, 448, 320)
- @actor, @column_max, self.index = actor, 2, 0
- refresh
- end
- #-------------------------------------------------------------------------------
- def actor=(actor)
- @actor = actor
- refresh
- end
- #-------------------------------------------------------------------------------
- def skill
- return @data[self.index]
- end
- #-------------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- @actor.skills.each {|i|
- skill = $data_skills[i]
- @data.push(skill) if skill != nil}
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- (0...@item_max).each {|i| draw_item(i)}
- end
- end
- #-------------------------------------------------------------------------------
- def draw_item(index)
- skill = @data[index]
- if @actor.skill_can_use?(skill.id)
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- x = 4 + index % 2 * (192 + 32)
- y = index / 2 * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(skill.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- skill_name = skill.name
- if $tons_version >= 4.0 && TONS_OF_ADDONS::EQUAP_SKILLS && DISPLAY_AP_REQ
- aps = BlizzCFG.maxap(skill.id)
- if aps > 0
- skill_name += " (#{@actor.ap(skill.id)}/#{aps})"
- elsif DISPLAY_AP_ZERO
- skill_name += ' (0/0)'
- end
- end
- self.contents.draw_text(x + 28, y, 172, 32, skill_name, 0)
- self.contents.draw_text(x + 144, y, 36, 32, skill.sp_cost.to_s, 2)
- end
- #-------------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.skill == nil ? '' : self.skill.description)
- end
- end
- #==============================================================================
- # ** Window_Zer0_SkillStatus
- #==============================================================================
- class Window_Zer0_SkillStatus < Window_Base
- def initialize(actor)
- super(640, 114, 448, 126)
- self.contents = Bitmap.new(width - 32, height - 32)
- @actor = actor
- refresh
- end
- #-------------------------------------------------------------------------------
- def refresh
- self.contents.clear
- draw_actor_name(@actor, 4, 0)
- draw_actor_state(@actor, 164, 0)
- draw_actor_hp(@actor, 4, 32)
- draw_actor_sp(@actor, 4,64)
- if @elements != nil
- if Zer0_CMS::Use_Element_Icons
- @elements.each_index {|i|
- break if 164+i*28 > self.contents.width
- icon = RPG::Cache.icon("Element/#{@elements[i].downcase}")
- self.contents.blt(164+i*28, 64, icon, Rect.new(0, 0, 24, 24))}
- else
- elem_string = ''
- @elements.each_index {|i|
- elem_string += @elements[i]
- elem_string += ', ' if i != (@elements.size - 1)}
- self.contents.draw_text(164, 64, 224, 15, elem_string)
- end
- end
- self.contents.font.color = system_color
- self.contents.draw_text(164, 32, 96, 32, 'Element')
- end
- #-------------------------------------------------------------------------------
- def element=(skill_id)
- @elements = []
- if skill_id != nil && skill_id != 0
- $data_skills[skill_id].element_set.each {|i|
- unless $DUMMY_ELEMENTS.include?(i)
- @elements.push($data_system.elements[i])
- end
- }
- end
- refresh
- end
- #-------------------------------------------------------------------------------
- def actor=(actor)
- @actor = actor
- refresh
- end
- end
- #==============================================================================
- # ** Window_Zer0_EquipLeft
- #==============================================================================
- class Window_Zer0_EquipLeft < Window_Base
- def initialize(actor)
- super(640, 114, 192, 192)
- self.contents = Bitmap.new(width - 32, height - 32)
- @actor = actor
- refresh
- end
- #-------------------------------------------------------------------------------
- def refresh(item1 = nil, item2 = nil)
- self.contents.clear
- words = [$data_system.words.atk, $data_system.words.pdef,
- $data_system.words.mdef, $data_system.words.str,
- $data_system.words.int, $data_system.words.dex,
- $data_system.words.agi, Zer0_CMS::Evasion_Word]
- stats = [@actor.base_atk, @actor.base_pdef, @actor.base_mdef, @actor.base_str,
- @actor.base_int, @actor.base_dex, @actor.base_agi, @actor.base_eva]
- stats.each_index {|i|
- self.contents.font.color = system_color
- self.contents.draw_text(4, i*15, 160, 15, words[i])
- self.contents.font.color = normal_color
- self.contents.draw_text(0, i*15, 110, 15, stats[i].to_s, 2)}
- values = []
- if item1 != nil && item2 != nil
- atk = 0
- if item1.is_a?(RPG::Weapon) && item2.is_a?(RPG::Weapon)
- atk = item2.atk - item1.atk
- end
- pdef = item2.pdef - item1.pdef
- mdef = item2.mdef - item1.mdef
- str_p = item2.str_plus - item1.str_plus
- int_p = item2.int_plus - item1.int_plus
- dex_p = item2.dex_plus - item1.dex_plus
- agi_p = item2.agi_plus - item1.agi_plus
- eva = item1.is_a?(RPG::Armor) ? item2.eva - item1.eva : 0
- last_hp = @actor.hp
- last_sp = @actor.sp
- values = [atk, pdef, mdef, str_p, int_p, dex_p, agi_p, eva]
- elsif item1 != nil && item2 == nil
- values = [item1.is_a?(RPG::Weapon) ? -item1.atk : 0, -item1.pdef, -item1.mdef,
- -item1.str_plus, -item1.int_plus, -item1.dex_plus, -item1.agi_plus,
- item1.is_a?(RPG::Armor) ? -item1.eva : 0]
- elsif item1 == nil && item2 != nil
- values = [item2.is_a?(RPG::Weapon) ? item2.atk : 0, item2.pdef, item2.mdef,
- item2.str_plus, item2.int_plus, item2.dex_plus, item2.agi_plus,
- item2.is_a?(RPG::Armor) ? item2.eva : 0]
- end
- values.each_index {|i|
- if values[i] > 0
- self.contents.font.color = Zer0_CMS::Plus_Color
- self.contents.draw_text(0, i*15, 160, 15, "+#{values[i]}", 2)
- elsif values[i] < 0
- self.contents.font.color = Zer0_CMS::Minus_Color
- self.contents.draw_text(0, i*15, 160, 15, "#{values[i]}", 2)
- end
- }
- end
- #-------------------------------------------------------------------------------
- def actor=(actor)
- @actor = actor
- refresh
- end
- end
- #===============================================================================
- # ** Window_Zer0_EquipRight
- #===============================================================================
- class Window_Zer0_EquipRight < Window_Selectable
- def initialize(actor)
- super(832, 114, 256, 192)
- self.contents = Bitmap.new(width - 32, height - 32)
- @actor, self.index = actor, 0
- refresh
- end
- #-------------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #-------------------------------------------------------------------------------
- def refresh
- self.contents.clear
- @data = []
- @data.push($data_weapons[@actor.weapon_id])
- @data.push($data_armors[@actor.armor1_id])
- @data.push($data_armors[@actor.armor2_id])
- @data.push($data_armors[@actor.armor3_id])
- @data.push($data_armors[@actor.armor4_id])
- @item_max = @data.size
- self.contents.font.color = system_color
- self.contents.draw_text(4, 0, 92, 32, $data_system.words.weapon)
- self.contents.draw_text(4, 32, 92, 32, $data_system.words.armor1)
- self.contents.draw_text(4, 64, 92, 32, $data_system.words.armor2)
- self.contents.draw_text(4, 96, 92, 32, $data_system.words.armor3)
- self.contents.draw_text(5, 128, 92, 32, $data_system.words.armor4)
- @data.each_index {|i| draw_item_name(@data[i], 92, 32 * i)}
- end
- #-------------------------------------------------------------------------------
- def actor=(actor)
- @actor = actor
- refresh
- end
- #-------------------------------------------------------------------------------
- def update
- if Input.repeat?(Input::UP) && !Input.trigger?(Input::UP) && self.index == 0
- self.index = (self.index - 1) % @data.size
- $game_system.se_play($data_system.cursor_se)
- elsif Input.repeat?(Input::DOWN) && !Input.trigger?(Input::DOWN) &&
- self.index == @data.size-1
- $game_system.se_play($data_system.cursor_se)
- self.index = 0
- else
- super
- end
- end
- #-------------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.item == nil ? '' : self.item.description)
- end
- end
- #===============================================================================
- # ** Window_Zer0_Status
- #===============================================================================
- class Window_Zer0_Status < Window_Base
- def initialize(actor = $game_party.actors[0])
- super(640, 57, 448, 423)
- @actor = actor
- self.contents = Bitmap.new(width - 32, height - 32)
- refresh
- end
- #-------------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.font.color = normal_color
- draw_actor_graphic(@actor, 32, 80)
- draw_actor_name(@actor, 4, 0)
- draw_actor_class(@actor, 96, 0)
- draw_actor_level(@actor, 96, 32)
- flag = $game_system.BARS
- $game_system.BARS = false
- draw_actor_hp(@actor, 4, 85, 176)
- draw_actor_sp(@actor, 4, 100, 176)
- $game_system.BARS = flag
- (0..6).each {|i| draw_actor_parameter(@actor, 4, 115 + 15 * i, i)}
- exp_value = [@actor.exp_s, @actor.next_exp_s, @actor.next_rest_exp_s]
- exp_value.each_index {|i|
- self.contents.draw_text(272, i*15, 84, 15, exp_value[i], 2)}
- self.contents.font.color = system_color
- eqmt = [$data_system.words.weapon, $data_system.words.armor1,
- $data_system.words.armor2, $data_system.words.armor3, $data_system.words.armor4]
- eqmt.each_index {|i| self.contents.draw_text(192, 64+i*32, 96, 32, eqmt[i])}
- self.contents.draw_text(4, 235, 416, 32, 'Status:')
- exp_words = ['Experience', 'Next Level', 'Needed']
- exp_words.each_index {|i|
- self.contents.draw_text(192, i*15, 80, 15, exp_words[i])}
- self.contents.font.color = normal_color
- draw_actor_state(@actor, 64, 235, 300)
- draw_item_name($data_weapons[@actor.weapon_id], 272, 64)
- draw_item_name($data_armors[@actor.armor1_id], 272, 96)
- draw_item_name($data_armors[@actor.armor2_id], 272, 128)
- draw_item_name($data_armors[@actor.armor3_id], 272, 160)
- draw_item_name($data_armors[@actor.armor4_id], 272, 192)
- elem_atk = @actor.attack_elements(Zer0_CMS::Use_Element_Icons)
- elem_grd = @actor.guard_elements(Zer0_CMS::Use_Element_Icons)
- stat_atk = @actor.attack_states(Zer0_CMS::Use_State_Icons)
- stat_grd = @actor.guard_states(Zer0_CMS::Use_State_Icons)
- if Zer0_CMS::Use_Element_Icons
- elem_atk.each_index {|i|
- break if i > 6
- self.contents.blt(4+i*28, 306, elem_atk[i], Rect.new(0, 0, 24, 24))}
- elem_grd.each_index {|i|
- break if i > 6
- self.contents.blt(4+i*28, 360, elem_grd[i], Rect.new(0, 0, 24, 24))}
- else
- elem1 = elem2 = ''
- elem_atk.each_index {|i|
- elem1 += elem_atk[i]
- elem1 += ', ' if i != (elem_atk.size-1)}
- elem_grd.each_index {|i|
- elem2 += elem_grd[i]
- elem2 += ', ' if i != (elem_grd.size-1)}
- self.contents.draw_text(4, 302, 192, 24, elem1)
- self.contents.draw_text(4, 356, 192, 24, elem2)
- end
- if Zer0_CMS::Use_State_Icons
- stat_atk.each_index {|i|
- break if i > 6
- self.contents.blt(244+i*28, 306, stat_atk[i], Rect.new(0, 0, 24, 24))}
- stat_grd.each_index {|i|
- break if i > 6
- self.contents.blt(244+i*28, 360, stat_grd[i], Rect.new(0, 0, 24, 24))}
- else
- stat1 = stat2 = ''
- stat_atk.each_index {|i|
- stat1 += stat_atk[i]
- stat1 += ', ' if i != (stat_atk.size-1)}
- stat_grd.each_index {|i|
- stat2 += stat_grd[i]
- stat2 += ', ' if i != (stat_grd.size-1)}
- self.contents.draw_text(244, 302, 192, 24, stat1)
- self.contents.draw_text(244, 356, 192, 24, stat2)
- end
- self.contents.font.color = Color.new(128, 255, 128)
- self.contents.draw_text(0, 286, 192, 15, 'Elemental Attack:')
- self.contents.draw_text(0, 338, 192, 15, 'Elemental Guard:')
- self.contents.draw_text(240, 286, 192, 15, 'Status Attack:')
- self.contents.draw_text(240, 338, 192, 15, 'Status Guard:')
- end
- #-------------------------------------------------------------------------------
- def actor=(actor)
- @actor = actor
- refresh
- end
- end
- #===============================================================================
- # ** Window_Options
- #===============================================================================
- class Window_Zer0_Options < Window_Selectable_Mod
- def initialize
- @options = ['Windowskin', 'Window Opacity', 'Font Type',
- 'Font Size', 'Shaded Text', 'BGM Volume', 'SE Volume',
- 'Window SE', 'Window Speed', 'Bars', 'Bar Style', 'Bar Opacity']
- height = @options.size >= 12 ? 366 : 57 + @options.size * 25
- super(192, 480, 448, height)
- self.contents = Bitmap.new(width - 32, height - 32)
- refresh
- @item_max = @row_max = @options.size
- @column_max = self.index = 1
- end
- #-------------------------------------------------------------------------------
- def refresh
- self.contents.clear
- values = [$game_system.windowskin_name, $game_system.window_opacity,
- $game_system.fontname, $game_system.fontsize,
- $game_system.SHADED_TEXT ? 'Yes' : 'No',
- "#{$game_system.bgm_volume}%", "#{$game_system.se_volume}%",
- $game_system.window_SE == 0 ? 'None' : "Type #{$game_system.window_SE}",
- $game_system.window_speed,
- $game_system.BARS ? 'Yes' : 'No',
- $game_system.bar_style + 1, $game_system.bar_opacity]
- @options.each_index {|i|
- self.contents.font.color = system_color
- self.contents.draw_text(4, i*25, 416, 25, @options[i])
- self.contents.font.color = normal_color
- self.contents.draw_text(-4, i*25, 416, 25, values[i].to_s, 2)}
- x, y, w, rate = 144, self.contents.height - 41, 160, 1
- color1 = Color.new(20, 80, 20, 192)
- color2 = Color.new(60, 240, 60, 192)
- color3 = Color.new(0, 80, 0, 192)
- self.contents.gradient_bar(x, y, w, color1, color2, color3, rate)
- end
- end
- #==============================================================================
- # ** Window_Zer0_File
- #==============================================================================
- class Window_Zer0_File < Window_Base
- attr_reader :filename, :selected
- def initialize(file_index, filename)
- super(192, 640 + (file_index * 122), 448, 122)
- self.contents = Bitmap.new(width - 32, height - 32)
- @file_index, @filename, @time_stamp = file_index, filename, Time.at(0)
- @file_exist, @selected = FileTest.exist?(@filename), false
- refresh
- end
- #-------------------------------------------------------------------------------
- def refresh
- self.contents.clear
- @file_exist = FileTest.exist?(@filename)
- if @file_exist
- file = File.open(@filename, 'r')
- @time_stamp = file.mtime
- @characters = Marshal.load(file)
- @frame_count = Marshal.load(file)
- @game_system = Marshal.load(file)
- @game_switches = Marshal.load(file)
- @game_variables = Marshal.load(file)
- @game_map = Marshal.load(file)
- @total_sec = @frame_count / Graphics.frame_rate
- file.close
- end
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 0, 448, 32, "File #{@file_index + 1}")
- if @file_exist
- @characters.each_index {|i|
- bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
- cw = bitmap.rect.width / 4
- ch = bitmap.rect.height / 4
- src_rect = Rect.new(0, 0, cw, ch)
- x = 160 - @characters.size * 32 + i * 50 - cw / 2
- self.contents.blt(x, 80 - ch, bitmap, src_rect)}
- hr, min, sec = @total_sec / 60 / 60, @total_sec / 60 % 60, @total_sec % 60
- time_string1 = sprintf('%02d:%02d:%02d', hr, min, sec)
- time_string2 = @time_stamp.strftime('%H:%M %m/%d/%Y')
- save_count = @game_system.save_count.to_s
- words = ['Play Time:', 'Last Save:', 'Save Count:']
- values = [time_string1, time_string2, save_count]
- if Zer0_CMS::Game_Completion
- id = Zer0_CMS::Completion_Variable
- @game_variables[id]= [[@game_variables[id], 100].min, 0].max
- words.push('Completion:')
- values.push("#{@game_variables[id]}%")
- end
- if Zer0_CMS::Use_Map_Name
- words.push('Location:')
- values.push(@game_map.name)
- end
- words.each_index {|i|
- y = ((self.contents.height - (words.size * 15)) / 2) + i*15
- self.contents.font.color = normal_color
- self.contents.draw_text(212, y, 200, 25, values[i], 2)
- self.contents.font.color = system_color
- self.contents.draw_text(216, y, 200, 25, words[i])
- }
- end
- end
- #-------------------------------------------------------------------------------
- def selected=(selected)
- @selected = selected
- update_cursor_rect
- end
- #-------------------------------------------------------------------------------
- def update_cursor_rect
- if @selected
- self.cursor_rect.set(0, 0, self.contents.width, self.contents.height)
- else
- self.cursor_rect.empty
- end
- end
- end
- #===============================================================================
- # ** Window_QuestInfo
- #===============================================================================
- class Window_QuestInfo < Window_Base
- def initialize(quest)
- super(640, 57, 448, 423)
- self.contents = Bitmap.new(width - 32, height - 32)
- @quest = quest
- refresh
- end
- #-------------------------------------------------------------------------------
- def refresh
- return if @quest == nil
- self.contents.clear
- bitmap = Quest.picture(@quest)
- if bitmap != nil
- rect = Rect.new(0, 0, bitmap.width, bitmap.height)
- self.contents.blt(448 - bitmap.width - 32, 0, bitmap, rect)
- end
- self.contents.font.color = system_color
- words = ['Quest:', 'Reward:', 'Location:', 'Status:', 'Description:']
- words.each_index {|i| self.contents.draw_text(0, i*45, 416, 32, words[i])}
- self.contents.font.color = normal_color
- self.contents.draw_text(0, 15, 416, 32, Quest.name(@quest))
- self.contents.draw_text(0, 60, 416, 32, Quest.reward(@quest))
- self.contents.draw_text(0, 105, 416, 32, Quest.location(@quest))
- text = self.contents.slice_text(Quest.description(@quest), 416)
- text.each_index {|i| self.contents.draw_text(0, 205 + i*15, 416, 32, text[i])}
- status = Quest.status(@quest)
- self.contents.font.color = case status
- when 'Complete' then Color.new(128, 255, 128)
- when 'Failed' then Color.new(255, 64, 64)
- when 'In Progress' then Color.new(255, 255, 64)
- end
- self.contents.draw_text(0, 150, 416, 32, status)
- end
- #-------------------------------------------------------------------------------
- def quest=(quest)
- @quest = quest
- refresh
- end
- end
- #===============================================================================
- # ** Scene_Title
- #===============================================================================
- class Scene_Title
- AFR = Win32API.new('gdi32', 'AddFontResource', ['P'], 'L')
- WPS = Win32API.new('kernel32', 'WriteProfileString', ['P'] * 3, 'L')
- SM = Win32API.new('user32', 'SendMessage', ['L'] * 4, 'L')
- WM_FONTCHANGE = 0x001D
- HWND_BROADCAST = 0xffff
- alias wachunga_autofontinstall_st_main main
- def main
- if Zer0_CMS::Auto_Install_Fonts
- success = []
- Fonts::Filenames.each_index {|i|
- f = Fonts::Filenames[i]
- if !FileTest.exists?(Fonts::Dest + f)
- if FileTest.exists?(Fonts::Source + f)
- require Dir.getwd + '/Data/fileutils.rb'
- FileUtils.cp(Fonts::Source + f, Fonts::Dest + f)
- AFR.call(Fonts::Dest + f)
- WPS.call('Fonts', Fonts::Names[i] + ' (TrueType)', f)
- SM.call(HWND_BROADCAST,WM_FONTCHANGE,0,0)
- if FileTest.exists?(Fonts::Dest + f)
- success.push(Fonts::Names[i])
- else
- print "Auto Font Install:\n\nFailed to install " +
- Fonts::Names[i] + '.'
- end
- else
- print "Auto Font Install:\n\nFont " + f + " not found."
- end
- end
- }
- if success != []
- if Fonts::Notify
- fonts = ''
- success.each {|f| fonts << f << ', '}
- print "Auto Font Install:\n\nSucessfully installed " + fonts[0..-3] +
- '.'
- end
- a = Thread.new { system('Game') }
- exit
- end
- end
- wachunga_autofontinstall_st_main
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement