Advertisement
KK20

Zer0_CMS + Guillarume777 Multi-Slot

Feb 18th, 2013
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 106.72 KB | None | 0 0
  1. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  2. # Zer0_CMS by ForeverZer0        #============================================#
  3. # Version: 1.2                   # Edit by KK20 for Guillaume777's Multi-Slot #
  4. # Date: 11.11.2010               #============================================#
  5. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  6. #                             VERSION HISTORY
  7. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  8. #
  9. # v.1.0 (6.16.2010)
  10. #   - Original script completed
  11. # v.1.1 (7.9.2010)
  12. #   - Bug fixed that would crash game on equip screen
  13. #   - Added an Auto-Font Installer (Wachunga)
  14. # v.1.2 (9.25.2010)
  15. #   - Fixed bug that would crash game if status window opened with nothing
  16. #     equipped.
  17. #   - Fixed bug that would sometimes scramble up what items should be displayed
  18. #     in the equipment screen
  19. #   - Fixed the undefined "stat1" bug.
  20. #   - Fixed a few other potential problems.
  21. # v.1.3 (11.11.2010)
  22. #   - Fixed bug that would sometimes scramble up what items should be displayed
  23. #     in the equipment screen. (didn't I just read that...)
  24. #   - Fixed compatibility issue with CCTS v.1.2
  25. #   - Fixed bug that would throw an error if skin or font wass attemted to be
  26. #     changed when none were unlocked.
  27. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  28. #
  29. # Introduction:
  30. #   This is my first CMS that I have created. It originally was going to be
  31. #   used exclusively in my own project, but I have no financial ambitions with
  32. #   RMXP, so therefore I decided to share it with everyone. I have added as
  33. #   much compatability with other scripts as I could, but there are a few
  34. #   lingering issues that could arise with other specific scripts. This is
  35. #   mainly due to the fact that, as I just stated, it was not originally made to
  36. #   be created with every concievable script out there, only my own, but most
  37. #   users will experience no problems. Enjoy!
  38. #
  39. # Features:
  40. #   - Optimized code to only create windows as needed, which means less lag.
  41. #   - Animated windows.
  42. #   - Clean, simple interface.
  43. #   - Custom Save System, with easy compatibility for scripts that alias
  44. #     Scene_Load and Scene_Save.
  45. #   - Options menu with many configurable options including Font, Shaded Text,
  46. #     Gradient Bars, Windowskins, Window Opacity, Volume, SFX, and more.
  47. #   - Displays game time on menu, using either CCTS or ATES.
  48. #   - Built in quest manager. (Based off of game_guy's Quest script)
  49. #   - Items can be sorted by Type, Alpha-Numerical, Quantity, and by Key Item.
  50. #   - Save and Load available from menu.
  51. #   - Can use L and R to switch characters on the Equip and Status screens.
  52. #   - Can use variable to log Game Completion on File Windows.
  53. #   - Ability to allow player to unlock Windowskins and Fonts that can be used,
  54. #     much like Chrono Cross.
  55. #   - Compatability with Blizzard's Equap Skills from Tons.
  56. #   - Font Installer included
  57. #   - Much more!
  58. #
  59. # Requirements:
  60. #   - Tons-of-Add-Ons, version 6.03 or higher.
  61. #   - Either CCTS or ATES. The system will detect which one you are using, but
  62. #     ONE of them is required. The script CAN use another time system, but it
  63. #     will require some minor edits to Window_GameInfo.
  64. #   - Starting with v.1.1, if you would like to use the Auto-Font Installer, it
  65. #     is required that you have the 'FileUtils' module by Minero Aoki in
  66. #     the data folder of your game. (included in demo)
  67. #
  68. # Credits/Thanks:
  69. #   - Blizzard, for Tons and and a few other methods I used.
  70. #   - game_guy, for the base script of the Quest system.
  71. #   - Fantasist, for the window movement script.
  72. #   - Wachunga, for the font installer
  73. #
  74. # Author's Notes:
  75. #   As for the 'Quest' system that is integrated into the script, I understand
  76. #   that not all users will wish to have this feature, but the script was not
  77. #   originally written for everyone. I apologize for the inconvienence, but I
  78. #   will not offer support on how to remove it. I have plans on at some point
  79. #   creating a 'Plug-In' feature for this CMS that will allow users to create
  80. #   there own independent scripts, and easily link them into this one without
  81. #   a labor-intensive script merge, but until then, the Quest command is there.
  82. #
  83. # Instructions:
  84. #   - Place script below default scripts and above CCTS/ATES and Tons.
  85. #   - Configuration is below.
  86. #   - The Quest script is just below the configuration.
  87. #     It can be removed from this script and placed in its own slot if desired.
  88. #   - You will also need to make one edit to Scene_Title. Find the lines:
  89. #
  90. #       @continue_enabled = false
  91. #       for i in 0..3
  92. #         if FileTest.exist?("Save#{i+1}.rxdata")
  93. #           @continue_enabled = true
  94. #         end
  95. #       end
  96. #
  97. #     ...and REPLACE them with:
  98. #
  99. #       @continue_enabled = (0...Zer0_CMS::Save_File_Number).any? {|i|
  100. #         FileTest.exist?("#{Zer0_CMS::Save_Name}#{i+1}.#{Zer0_CMS::Save_Ext}")}
  101. #
  102. #   - To add a fonts and windowskins to the available options during the game,
  103. #     use these script calls:
  104. #       - $game_system.add_skin('FILENAME')
  105. #       - $game_system.add_font('FONTNAME')
  106. #     The configuration for each below are just what the game begins with.
  107. #   - Be sure that if you use non-standard fonts to include an installer that
  108. #     will add the fonts when the game is first run.
  109. #   - To set the deafult font and size, change the settings in Ultimate Font
  110. #     Override in Tons(2).
  111. #
  112. #=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
  113. #                           BEGIN CONFIGURATION
  114. #=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
  115. module Zer0_CMS
  116.  
  117.   # These are the words use on the menu for the commands
  118.   Commands = ['Item', 'Skill', 'Quest', 'Equip', 'Status', 'Options', 'Data']
  119.  
  120.   # Default window opacity
  121.   Opacity = 160
  122.  
  123.   # These are the available windowskins that your game begins with.
  124.   Windowskins = []#['Black', 'Thorns', 'Simple Line']
  125.  
  126.   # If you would like for fonts to be installed automatically the first time the
  127.   # game is ran, set to true (see config below). Can only install fonts if the
  128.   # user has the proper permissions on their account.
  129.   Auto_Install_Fonts = true
  130.  
  131.   # Available fonts that are available at the start of the game.
  132.   Fonts = ['Calibri', 'Times New Roman', 'Tahoma']
  133.  
  134.   # Minumum/Maximum allowed sizes for fonts
  135.   Font_Size_Range = [10, 30]
  136.  
  137.   # These are the SFX the player can select from that will be played when a
  138.   # window is moved. Nil will be used for 'None'. Set up like this:
  139.   # ['SE_FILENAME', VOLUME, PITCH]
  140.   Window_Move_SE = [nil, ['086-Action01', 60, 70], ['Paper', 60, 100],
  141.                   ['Swish1', 60, 100]]
  142.        
  143.  
  144.   # IDs of items that are considered key items. They will not display in the
  145.   # normal item window, only with the 'Key Items' sort method.
  146.   Quest_Items = [23, 24, 25, 26, 27]
  147.  
  148.   # If true, will display icons instead of words for states/elements on the
  149.   # Status Screen. Element icons must be in folder named 'Element', and state
  150.   # icons must be in folder named 'State'. These folders must be in the Icons
  151.   # folder. Each file must be labeled the same as the state/element that it
  152.   # represents, except in all lower-case letters.
  153.   Use_Element_Icons = true
  154.   Use_State_Icons = true  
  155.  
  156.   # Word used for the 'Evasion' stat. Used on status window, etc.
  157.   Evasion_Word = 'EVA'
  158.  
  159.   # The 'plus' and 'minus' color, used on the equip screen. (R, G, B [, alpha])
  160.   Plus_Color  = Color.new(128, 255, 128)
  161.   Minus_Color = Color.new(255, 128, 128)
  162.  
  163.   # Filename of the backgound used behind the menu. Set to nil if you want the
  164.   # game map used. Bitmap must be 640x480, and in the 'Titles' folder.
  165.   Menu_Background = nil              
  166.                  
  167.   # Filename of the background used behind the save file windows when 'Continue'
  168.   # is chosen on the title screen. Set to nil if you want it to use the same
  169.   # background as the title screen. Bitmap must be in the 'Titles' folder.
  170.   Load_Screen_Background = nil
  171.  
  172.   # Transition used when loading a game. Must be in 'Transitions' folder.
  173.   # Set up as follows: ['FILENAME', DURATION, VAGUE]. Set to nil if you do not
  174.   # want to use this feature.
  175.   Load_Transition = ['020-Flat01', 30, 15]
  176.  
  177.   # Number of save-files available in your game.
  178.   Save_File_Number = 10
  179.  
  180.   # The name given to save-files ('Save' by default)
  181.   Save_Name = 'Save'
  182.  
  183.   # Extension given to save-files ('rxdata' by default)
  184.   Save_Ext = 'rxdata'
  185.  
  186.   # Add any additional data that needs to be saved and loaded here. Just add the
  187.   # global variable that references the class into the array as a string ('').
  188.   # This will make the save system compatible with scripts that alias Scene_Save
  189.   # and Scene_Load and need the script's global variable saved/loaded.
  190.   Save_Data = ['$dummy']
  191.  
  192.   # If you would like to use a variable that lets the player know the 'percent
  193.   # complete' of the game, set this to true. It will display on the file screen.
  194.   Game_Completion = true
  195.  
  196.   # ID of the variable that will be used. It is equal to the percent (0..100).
  197.   # You will need to increase it at intervals throughout the game.
  198.   Completion_Variable = 22
  199.  
  200.   # If true, the map name where the save occurred will be displayed on the
  201.   # save/load screen.
  202.   Use_Map_Name = true
  203.  
  204.   # Set to true ONLY if you are using a time script other than CCTS or ATES, and
  205.   # have made the required edits. This will prevent the error message.
  206.   Time_System_Override = false
  207.  
  208. end
  209.  
  210. module Fonts
  211.  
  212.   # This is the configuration for the font-installer. It was written by Wachunga,
  213.   # and I take no credit for it. Be sure to include ALL fonts that your game
  214.   # may have as an available option. The default location for the fonts is in a
  215.   # folder labeled 'Fonts', within your games 'Data' folder.
  216.  
  217.   # New fonts aren't recognized in RMXP until the program is restarted, so the
  218.   # game (unfortunately) needs to exit and restart after the initial installation.
  219.  
  220.   # Filenames of fonts to be installed
  221.   Filenames = ['calibri.ttf', 'comic.ttf', 'Candara.ttf', 'tahoma.ttf']
  222.    
  223.   # Names (not filenames) of fonts to be installed
  224.   Names = ['Calibri', 'Comic Sans MS', 'Candara', 'Tahoma']
  225.  
  226.   # Whether to notify player (via pop-up message) that fonts were installed
  227.   Notify = true
  228.  
  229.   # Location of fonts (relative to game folder)
  230.   Source = 'Data/Fonts/'
  231.    
  232.   # Location of fonts after installation
  233.   Dest = ENV['SystemRoot'] + '\Fonts\\'
  234.    
  235. end
  236. #-------------------------------------------------------------------------------  
  237. #
  238. # Quest Script
  239. #
  240. #   Here you can define the quests used in your game. Explantions for each
  241. #   configuration are below. Here are the commands that can be used:
  242. #
  243. #  Quest.complete(ID)
  244. #     - Completes quest with ID
  245. #
  246. #  Quest.fail(ID)
  247. #     - Fails quest with ID
  248. #
  249. #  Quest.add(ID)
  250. #     - Adds quest with ID to the party's quest log
  251. #
  252. #  Quest.remove(ID)
  253. #     - Removes quest with ID
  254. #
  255. #  Quest.status(ID)
  256. #     - Mainly a scripting variable, it will return a string of the quest with
  257. #       ID's status ('Complete', 'In Progress', or 'Failed')
  258. #
  259. #-------------------------------------------------------------------------------
  260. module Quest
  261.  
  262.   # The name of the quest.
  263.   def self.name(id)
  264.     text = case id
  265.     when 1 then 'Picking Fruit'
  266.     when 2 then 'Example #2'
  267.     end
  268.     return text != nil ? text : '?????' # <-- Default for undefined
  269.   end
  270.  
  271.   # The picture used for each quest. Must be in a folder labeld 'Quest' within
  272.   # the 'Pictures' folder.
  273.   def self.picture(id)
  274.     filename = case id
  275.     when 1 then 'Fruit'
  276.     when 2 then 'PLACE PICTURE NAME HERE'
  277.     end
  278.     return filename != nil ? RPG::Cache.picture("Quest/#{filename}") : nil
  279.   end
  280.  
  281.   # The location for each quest.
  282.   def self.location(id)
  283.     text = case id
  284.     when 1 then 'Lonely Forest'
  285.     when 2 then 'Somewhere...'
  286.     end
  287.     return text != nil ? text : '?????'
  288.   end
  289.  
  290.   # Paragraph that explains/describes each quest. Blizzard's text-slice method
  291.   # will be used to automatically break to new lines. You can seperate the lines
  292.   # with + signs to make this section a little more over-viewable.
  293.   def self.description(id)
  294.     text = case id
  295.     when 1
  296.       'Farmer Bob has asked you to go collect Fruit for him. You need to ' +
  297.       'collect at least 10 Fruit for him, or else he will feed you to his pigs.'
  298.     when 2
  299.       'Just another example of a Quest description.'
  300.     end
  301.     return text != nil ? text : '?????'
  302.   end
  303.  
  304.   # The reward used for each quest. You will need to use an event to actually
  305.   # give this to the player.
  306.   def self.reward(id)
  307.     text = case id
  308.     when 1 then 'High Potion'
  309.     when 2 then '1000 Gold'
  310.     end
  311.     return text != nil ? text : '?????'
  312.   end
  313.  
  314. #=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
  315. #                             END CONFIGURATION
  316. #=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
  317.  
  318.   def self.complete(id)
  319.     $game_party.quests[id] = 'Complete'
  320.   end
  321.  
  322.   def self.fail(id)
  323.     $game_party.quests[id] = 'Failed'
  324.   end
  325.  
  326.   def self.add(id)
  327.     $game_party.quests[id] = 'In Progress'
  328.   end  
  329.  
  330.   def self.status(id)
  331.     return $game_party.quests[id] != nil ? $game_party.quests[id] : ''
  332.   end
  333.  
  334.   def self.remove(id)
  335.     $game_party.quests.delete(id)
  336.   end
  337. end
  338.  
  339. #===============================================================================
  340. # ** Scene_Menu
  341. #===============================================================================
  342.  
  343.   $zer0_CMS = 1.2
  344.  
  345. class Scene_Menu
  346.  
  347.   def initialize(index = 0, save_calling = false)
  348.     @menu_index = index
  349.     @save_calling = save_calling
  350.   end
  351. #-------------------------------------------------------------------------------
  352.   def main
  353.     if Zer0_CMS::Menu_Background != nil
  354.       background = Sprite.new
  355.       background.bitmap = RPG::Cache.title(Zer0_CMS::Menu_Background)
  356.     else
  357.       background = Spriteset_Map.new
  358.     end
  359.     @command_window = Window_Command_HMod.new(Zer0_CMS::Commands)
  360.     @command_window.index = @menu_index
  361.     @info_window, @help_window = Window_GameInfo.new, Window_Zer0_Help.new
  362.     Graphics.transition
  363.     [@info_window, @command_window].each {|win| move(win, false)}
  364.     @all_windows = [@command_window, @info_window, @help_window]
  365.     call_save_screen if @save_calling
  366.     loop {Graphics.update; Input.update; update; break if $scene != self}
  367.     loop {Graphics.update; @all_windows.each {|window| window.update}
  368.         break unless @all_windows.any? {|window| window.moving?}}
  369.     Graphics.freeze
  370.     @all_windows.each {|window| window.dispose}
  371.     background.dispose
  372.     if @loading_flag != nil && $scene.is_a?(Scene_Map)
  373.       if Zer0_CMS::Load_Transition != nil
  374.         tran = Zer0_CMS::Load_Transition
  375.         Graphics.transition(tran[1], "Graphics/Transitions/#{tran[0]}", tran[2])
  376.         Graphics.freeze
  377.         20.times {Graphics.update}
  378.         map = Spriteset_Map.new
  379.         Graphics.transition(tran[1], "Graphics/Transitions/#{tran[0]}", tran[2])
  380.         map.dispose
  381.       end
  382.     end
  383.   end
  384. #-------------------------------------------------------------------------------
  385.   def update
  386.     @all_windows.each {|window| window.update}
  387.     if @command_window.active
  388.       update_command
  389.     elsif @char_select != nil && @char_select.active
  390.       update_character_select
  391.     elsif @item_window != nil && @item_window.active
  392.       update_item
  393.     elsif @item_options_window != nil && @item_options_window.active
  394.       update_item_options
  395.     elsif @item_sort_window != nil && @item_sort_window.active
  396.       update_item_sort
  397.     elsif @data_window != nil && @data_window.active
  398.       update_data
  399.     elsif @quest_list != nil && @quest_list.active
  400.       update_quest_select
  401.     elsif @options_window != nil && @options_window.active
  402.       update_options
  403.     elsif @equip_right != nil && @equip_right.active
  404.       update_equip_right
  405.     elsif @equip_item != nil && @equip_item.active
  406.       update_equip_item
  407.     elsif @skill_window != nil && @skill_window.active
  408.       update_skill
  409.     elsif @file_active != nil && @file_active
  410.       update_file_select
  411.     elsif @confirm_window != nil && @confirm_window.active
  412.       update_confirm
  413.     end
  414.   end
  415. #-------------------------------------------------------------------------------  
  416.   def update_command
  417.     if Input.trigger?(Input::B)
  418.       $game_system.se_play($data_system.cancel_se)
  419.       [@info_window, @command_window].each {|win| move(win)}
  420.       $scene = Scene_Map.new
  421.     elsif Input.trigger?(Input::C)
  422.       $game_system.se_play($data_system.decision_se)
  423.       case @command_window.index
  424.       when 0 # Item
  425.         if @item_window == nil
  426.           @item_window = Window_Zer0_Item.new
  427.           options = ['Use','Sort']
  428.           @item_options_window = Window_Command_HMod.new(options)
  429.           @item_options_window.x, @item_options_window.y = @command_window.width, -57
  430.           @item_options_window.active = false
  431.           @all_windows.push(@item_window, @item_options_window)
  432.         end
  433.         @item_window.index = @item_options_window.index = 0
  434.         @item_window.help_window = @help_window
  435.         [@item_window, @item_options_window, @help_window].each {|win| move(win, false)}
  436.         @command_window.active, @item_window.active = false, true
  437.       when 1 # Skill
  438.         if @char_select == nil
  439.           @char_select = Window_CharSelect.new
  440.           @all_windows.push(@char_select)
  441.         end
  442.         @char_select.index = 0
  443.         move(@char_select, false)
  444.         @char_select.active, @command_window.active = true, false
  445.       when 2 # Quest
  446.         if @quest_list == nil
  447.           quests = []
  448.           $game_party.quests.each_key {|i| quests.push(Quest.name(i))}
  449.           quests.push('None') if quests.empty?
  450.           @quest_list = Window_Command_Mod.new(192, quests)
  451.           @quest_list.height = 286 if @quest_list.height > 286
  452.           @quest_list.x, @quest_list.y = -192, 194
  453.           @all_windows.push(@quest_list)
  454.         end
  455.         @quest_list.index = 0
  456.         @quest_list.active, @command_window.active = true, false
  457.         move(@quest_list, false)
  458.       when 3 # Equip
  459.         if @char_select == nil
  460.           @char_select = Window_CharSelect.new
  461.           @all_windows.push(@char_select)
  462.         end
  463.         @char_select.index = 0
  464.         move(@char_select, false)
  465.         @char_select.active, @command_window.active = true, false
  466.       when 4 # Status
  467.         if @char_select == nil
  468.           @char_select = Window_CharSelect.new
  469.           @all_windows.push(@char_select)
  470.         end
  471.         @char_select.index = 0
  472.         move(@char_select, false)
  473.         @char_select.active, @command_window.active = true, false
  474.       when 5 # Options
  475.         if @options_window == nil
  476.           @options_window = Window_Zer0_Options.new
  477.           @all_windows.push(@options_window)
  478.         end
  479.         @options_window.index = 0
  480.         $game_system.bgm_memorize
  481.         $game_system.bgs_memorize
  482.         [@help_window, @options_window].each {|win| move(win, false)}
  483.         @options_window.active, @command_window.active = true, false
  484.       when 6 # Data
  485.         if @data_window == nil
  486.           @data_window = Window_Command_HMod.new(['Save', 'Load'])
  487.           @all_windows.push(@data_window)
  488.           @data_window.x, @data_window.y = 640, 0
  489.         end
  490.         if $game_system.save_disabled
  491.           @data_window.disable_item(0)
  492.         end
  493.         move(@data_window, false)
  494.         @command_window.active, @data_window.active = false, true
  495.       end
  496.     end
  497.   end  
  498. #-------------------------------------------------------------------------------
  499.   def update_character_select  
  500.     help_text = case @command_window.index
  501.     when 0 # Item
  502.       if @char_select.index == -1
  503.         "Use #{@item.name} on entire party?"
  504.       else
  505.         "Use #{@item.name} on #{$game_party.actors[@char_select.index].name}?"
  506.       end      
  507.     when 1 # Skill
  508.       if @skill_use_flag != nil && @skill_use_flag && @skill != nil
  509.         if @char_select.index == -1
  510.           "Use #{@skill.name} on entire party?"
  511.         else
  512.           "Use #{@skill.name} on #{$game_party.actors[@char_select.index].name}?"
  513.         end
  514.       else
  515.         "View/Use #{$game_party.actors[@char_select.index].name}'s skills?"
  516.       end
  517.     when 3 then "Change #{$game_party.actors[@char_select.index].name}'s equipment?"
  518.     end
  519.     @help_window.set_text(help_text) if help_text != nil
  520.     if Input.trigger?(Input::B)
  521.       $game_system.se_play($data_system.cancel_se)
  522.       @char_select.active = false
  523.       case @command_window.index
  524.       when 0 # Item
  525.         move(@char_select)
  526.         @item_window.active = true
  527.       when 1 # Skill
  528.         if @skill_use_flag != nil && @skill_use_flag
  529.           @char_select.index = $game_party.actors.index(@skill_window.actor)
  530.           @skill_use_flag, @skill_window.active = false, true
  531.         else
  532.           [@skill_window, @skill_status, @help_window, @char_select].each {|win|
  533.             move(win)}
  534.           @command_window.active = true
  535.         end
  536.       when 3 # Equip
  537.         [@equip_item, @equip_right, @equip_left, @help_window, @char_select].each {|win|
  538.           move(win)}
  539.         @command_window.active = true
  540.       when 4 # Status
  541.         [@char_select, @status_window].each {|win| move(win)}
  542.         @command_window.active = true
  543.       end
  544.     elsif Input.trigger?(Input::C)
  545.       case @command_window.index
  546.       when 0 # Item
  547.         @actor = $game_party.actors[@char_select.index]
  548.         if @char_select.index == -1
  549.           used = false
  550.           $game_party.actors.each {|actor| used |= actor.item_effect(@item)}
  551.         elsif @char_select.index >= 0
  552.           target = $game_party.actors[@char_select.index]
  553.           used = target.item_effect(@item)
  554.         end
  555.         if used
  556.           $game_system.se_play(@item.menu_se)
  557.           if @item.consumable
  558.             $game_party.lose_item(@item.id, 1)
  559.           end
  560.           if $game_party.all_dead?
  561.             $scene = Scene_Gameover.new
  562.           elsif @item.common_event_id > 0
  563.             $game_temp.common_event_id = @item.common_event_id
  564.             $scene = Scene_Map.new
  565.           end
  566.         else
  567.           $game_system.se_play($data_system.buzzer_se)
  568.         end
  569.         @char_select.refresh
  570.         @item_window.draw_item(@item_window.index)
  571.         @item_window.refresh if $game_party.item_number(@item.id) == 0
  572.         if $game_party.item_number(@item.id) <= 0
  573.           move(@char_select)
  574.           @char_select.active, @item_window.active = false, true
  575.         end
  576.       when 1 # Skill
  577.         if @skill_window == nil
  578.           @actor = $game_party.actors[@char_select.index]
  579.           @skill_window = Window_Zer0_Skill.new(@actor)
  580.           @skill_status = Window_Zer0_SkillStatus.new(@actor)
  581.           @all_windows.push(@skill_window, @skill_status)
  582.           @skill_use_flag = false
  583.         end
  584.         if @skill_use_flag == nil || !@skill_use_flag
  585.           $game_system.se_play($data_system.decision_se)
  586.           @actor = $game_party.actors[@char_select.index]
  587.           @skill_window.index, @skill_window.help_window = 0, @help_window
  588.           [@help_window, @skill_window, @skill_status].each {|win| move(win, false)}
  589.           @skill_window.active, @char_select.active = true, false
  590.           @skill_window.actor = @skill_status.actor = @actor
  591.           @skill_status.element = @skill_window.skill.id
  592.         else
  593.           unless @actor.skill_can_use?(@skill.id)
  594.             return $game_system.se_play($data_system.buzzer_se)
  595.           end
  596.           if @char_select.index == -1
  597.             used = false
  598.             $game_party.actors.each {|actor|
  599.               used |= actor.skill_effect(@actor, @skill)}
  600.           end
  601.           if @char_select.index <= -2
  602.             target = $game_party.actors[@char_select.index + 10]
  603.             used = target.skill_effect(@actor, @skill)
  604.           end
  605.           if @char_select.index >= 0
  606.             target = $game_party.actors[@char_select.index]
  607.             used = target.skill_effect(@actor, @skill)
  608.           end
  609.           if used
  610.             $game_system.se_play(@skill.menu_se)
  611.             @actor.sp -= @skill.sp_cost
  612.             [@skill_status, @skill_window, @char_select].each {|win| win.refresh}
  613.             if $game_party.all_dead?
  614.               $scene = Scene_Gameover.new
  615.             elsif @skill.common_event_id > 0
  616.               $game_temp.common_event_id = @skill.common_event_id
  617.               $scene = Scene_Map.new
  618.             end
  619.           else
  620.             $game_system.se_play($data_system.buzzer_se)
  621.           end
  622.         end
  623.       when 3 # Equip #KK20
  624.         @actor = $game_party.actors[@char_select.index]
  625.         if @equip_item == nil
  626.           @equip_item = Window_Zer0_Item.new(@actor, true)
  627.           @equip_left = Window_Zer0_EquipLeft.new(@actor)
  628.           @equip_right = Window_Zer0_EquipRight.new(@actor)
  629.           @all_windows.push(@equip_item, @equip_left, @equip_right)
  630.         end
  631.         $game_system.se_play($data_system.decision_se)
  632.         @equip_item.actor = @actor
  633.         @equip_right.help_window = @help_window
  634.         [@help_window, @equip_item, @equip_right, @equip_left].each {|win|
  635.           move(win, false)}
  636.           # FIX HERE
  637.         @equip_right.index = 0
  638.         @equip_right.active, @char_select.active = true, false
  639.         @equip_item.equip_type = 0
  640.       when 4 # Status
  641.         $game_system.se_play($data_system.decision_se)
  642.         @actor = $game_party.actors[@char_select.index]
  643.         if @status_window == nil
  644.           @status_window = Window_Zer0_Status.new
  645.           @all_windows.push(@status_window)
  646.         end
  647.         move(@status_window, false)
  648.       end
  649.     elsif Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN)
  650.       if @command_window.index == 1 && @skill_window != nil
  651.         if @skill_use_flag == nil || !@skill_use_flag
  652.           @actor = $game_party.actors[@char_select.index]
  653.           @skill_window.actor = @skill_status.actor = @actor
  654.         end
  655.       elsif @command_window.index == 4 && @status_window != nil
  656.         @actor = $game_party.actors[@char_select.index]
  657.         @status_window.actor = @actor
  658.       elsif @command_window.index == 3 && @equip_right != nil
  659.         @actor = $game_party.actors[@char_select.index]
  660.         @equip_left.actor = @equip_right.actor = @equip_item.actor = @actor
  661.       end
  662.     end
  663.   end
  664. #-------------------------------------------------------------------------------  
  665.   def update_item
  666.     if Input.trigger?(Input::B)
  667.       $game_system.se_play($data_system.cancel_se)
  668.       @item_window.index = -1
  669.       @item_window.active, @item_options_window.active = false, true
  670.     elsif Input.trigger?(Input::C)
  671.       @item = @item_window.item
  672.       unless @item.is_a?(RPG::Item) && $game_party.item_can_use?(@item.id)
  673.         return $game_system.se_play($data_system.buzzer_se)
  674.       end
  675.       if @item.scope >= 3
  676.         if @char_select == nil
  677.           @char_select = Window_CharSelect.new
  678.           @all_windows.push(@char_select)
  679.         end
  680.         $game_system.se_play($data_system.decision_se)
  681.         @char_select.index = [4, 6].include?(@item.scope) ? -1 : 0
  682.         move(@char_select, false)
  683.         @item_window.active, @char_select.active = false, true
  684.       elsif @item.common_event_id > 0
  685.         $game_temp.common_event_id = @item.common_event_id
  686.         $game_system.se_play(@item.menu_se)
  687.         if @item.consumable
  688.           $game_party.lose_item(@item.id, 1)
  689.           @item_window.refresh
  690.         end
  691.         $scene = Scene_Map.new
  692.       else
  693.         $game_system.se_play($data_system.buzzer_se)
  694.       end
  695.     end
  696.   end
  697. #-------------------------------------------------------------------------------  
  698.   def update_item_options
  699.     text = case @item_options_window.index
  700.     when 0 then 'Use items and view inventory.'
  701.     when 1 then 'Sort inventory by parameters.'
  702.     end
  703.     @help_window.set_text(text)
  704.     if Input.trigger?(Input::B)
  705.       $game_system.se_play($data_system.cancel_se)
  706.       [@item_options_window, @help_window, @item_window].each {|win| move(win)}
  707.       @command_window.active, @item_options_window.active = true, false
  708.     elsif Input.trigger?(Input::C)
  709.       $game_system.se_play($data_system.decision_se)
  710.       case @item_options_window.index
  711.       when 0 # Use
  712.         @item_window.help_window = @help_window
  713.         @item_window.index = 0
  714.         @item_window.active, @item_options_window.active = true, false
  715.       when 1 # Sort
  716.         if @item_sort_window == nil
  717.           sort_types = ['All', 'Items', 'Weapons', 'Armor', 'Key Items', 'ABC',
  718.                         'Quantity']
  719.           @item_sort_window = Window_Command_Mod.new(96, sort_types)
  720.           @item_sort_window.x, @item_sort_window.y = 96, 480
  721.           @all_windows.push(@item_sort_window)
  722.         end
  723.         move(@item_sort_window, false)
  724.         @item_options_window.active, @item_sort_window.active = false, true
  725.       end
  726.       @item_window.refresh
  727.     end
  728.   end
  729. #-------------------------------------------------------------------------------  
  730.   def update_item_sort
  731.     help_text = case @item_sort_window.index
  732.     when 0 then 'View all items, weapons, and armors.'
  733.     when 1 then 'View only items.'
  734.     when 2 then 'View only weapons.'
  735.     when 3 then 'View only armors.'
  736.     when 4 then 'View only key/quest items.'
  737.     when 5 then 'Sort current display in alpha-numerical order.'
  738.     when 6 then 'Sort current display by quantity in inventory.'
  739.     end
  740.     @help_window.set_text(help_text)
  741.     if Input.trigger?(Input::B)
  742.       $game_system.se_play($data_system.cancel_se)
  743.       @item_options_window.active, @item_sort_window.active = true, false
  744.       move(@item_sort_window)
  745.     elsif Input.trigger?(Input::C)
  746.       $game_system.se_play($data_system.decision_se)
  747.       if @item_sort_window.index <= 4
  748.         @item_window.sort_type = @item_sort_window.index
  749.         @item_window.abc_sort = @item_window.quantity_sort = false
  750.       elsif @item_sort_window.index == 5
  751.         @item_window.abc_sort, @item_window.quantity_sort = true, false
  752.       elsif @item_sort_window.index == 6
  753.         @item_window.quantity_sort, @item_window.abc_sort = true, false
  754.       end
  755.       @item_window.index = 0
  756.       @item_window.refresh
  757.     end
  758.   end
  759. #-------------------------------------------------------------------------------
  760.   def update_skill
  761.     if Input.trigger?(Input::B)
  762.       $game_system.se_play($data_system.cancel_se)
  763.       @skill_window.active, @char_select.active = false, true
  764.       @skill_use_flag, @skill_window.index = false, -1
  765.       @skill_status.element = nil
  766.     elsif Input.trigger?(Input::L) || Input.trigger?(Input::R)
  767.       $game_system.se_play($data_system.decision_se)
  768.       @char_select.index += Input.trigger?(Input::L) ? 1 : -1
  769.       @char_select.index %= $game_party.actors.size
  770.       @actor = $game_party.actors[@char_select.index]
  771.       @skill_window.actor = @skill_status.actor = @actor
  772.     elsif Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN) ||
  773.       Input.trigger?(Input::LEFT) || Input.trigger?(Input::RIGHT)
  774.       @skill_status.element = @skill_window.skill.id
  775.     elsif Input.trigger?(Input::C)
  776.       @actor_index = $game_party.actors.index(@actor)
  777.       @skill = @skill_window.skill
  778.       if @skill == nil || !@actor.skill_can_use?(@skill.id)
  779.         $game_system.se_play($data_system.buzzer_se)
  780.         return
  781.       end
  782.       $game_system.se_play($data_system.decision_se)
  783.       if @skill.scope >= 3
  784.         @skill_use_flag = true
  785.         @char_select.active, @skill_window.active = true, false
  786.         if [4, 6].include?(@skill.scope)
  787.           @char_select.index = -1
  788.         elsif @skill.scope == 7
  789.           @char_select.index = @actor_index - 10
  790.         else
  791.           @char_select.index = 0
  792.         end
  793.       elsif @skill.common_event_id > 0
  794.         $game_temp.common_event_id = @skill.common_event_id
  795.         $game_system.se_play(@skill.menu_se)
  796.         @actor.sp -= @skill.sp_cost
  797.         [@skill_window, @char_select, @skill_status].each {|win| win.refresh}
  798.         $scene = Scene_Map.new
  799.       end
  800.     end
  801.   end
  802. #-------------------------------------------------------------------------------
  803.   def update_equip_right #KK20
  804.     if Input.trigger?(Input::B)
  805.       $game_system.se_play($data_system.cancel_se)
  806.       @equip_right.active, @char_select.active = false, true
  807.       @equip_right.index = 0
  808.       @equip_right.index = -1
  809.       @equip_item.equip_type = 0
  810.       @equip_item.refresh
  811.     elsif Input.trigger?(Input::L) || Input.trigger?(Input::R)
  812.       $game_system.se_play($data_system.decision_se)
  813.       @char_select.index += Input.trigger?(Input::L) ? -1 : 1
  814.       @char_select.index %= $game_party.actors.size
  815.       @actor = $game_party.actors[@char_select.index]
  816.       if @actor.weapon_slots[@equip_right.index] != nil
  817.         @equip_item.equip_type = 0
  818.       else
  819.         @equip_item.equip_type = @actor.armor_slots[@equip_right.index-@actor.weapon_slots.size]
  820.       end
  821.       @equip_item.actor = @equip_left.actor = @equip_right.actor = @actor
  822.     elsif Input.repeat?(Input::UP) || Input.repeat?(Input::DOWN) ||
  823.       Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN)
  824.       # EDIT=========
  825.       if @actor.weapon_slots[@equip_right.index] != nil
  826.         @equip_item.equip_type = 0
  827.       else
  828.         @equip_item.equip_type = @actor.armor_slots[@equip_right.index-@actor.weapon_slots.size]
  829.       end
  830.       #==============
  831.       @equip_item.refresh
  832.     elsif Input.trigger?(Input::C)
  833.       if @actor.equip_fix?(@equip_right.index)
  834.         $game_system.se_play($data_system.buzzer_se)
  835.         return
  836.       end
  837.       $game_system.se_play($data_system.decision_se)
  838.       @equip_right.active, @equip_item.active = false, true
  839.       @equip_item.index = 0
  840.       @equip_left.refresh(@equip_right.item, @equip_item.item)
  841.     end
  842.   end
  843. #-------------------------------------------------------------------------------
  844.   def update_equip_item #KK20
  845.     if Input.trigger?(Input::B)
  846.       $game_system.se_play($data_system.cancel_se)
  847.       @equip_left.refresh
  848.       @equip_item.index = -1
  849.       @equip_right.active, @equip_item.active = true, false
  850.     elsif Input.trigger?(Input::C)
  851.       $game_system.se_play($data_system.equip_se)
  852.       item = @equip_item.item
  853.       #===========
  854.       if @actor.weapon_slots[@equip_right.index] != nil
  855.         if @equip_right.index == 0
  856.           type = 0
  857.         else
  858.           type = [@actor.armor_slots.size, 4].max + @equip_right.index
  859.         end
  860.       else
  861.         type = @actor.armor_slots[@equip_right.index-@actor.weapon_slots.size]
  862.       end
  863.       @actor.equip_type_force = index_to_equip_part(@equip_right.index)
  864.       @actor.equip(type, item == nil ? 0 : item.id)
  865.       #===========
  866.       @equip_right.active, @equip_item.active = true, false
  867.       @equip_item.index = -1
  868.       [@equip_right, @equip_item, @equip_left].each {|window| window.refresh}
  869.     elsif Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN) ||
  870.         Input.trigger?(Input::LEFT) || Input.trigger?(Input::RIGHT)
  871.       @equip_left.refresh(@equip_right.item, @equip_item.item)
  872.     end
  873.   end
  874. #-------------------------------------------------------------------------------  
  875.   def update_options
  876.     help_text = case @options_window.index
  877.     when 0 then 'Change the windowskin used to display the windows.'
  878.     when 1 then 'Change the opacity of the game windows.'
  879.     when 2 then 'Change the font type used.'
  880.     when 3 then 'Change the size of the selected font.'
  881.     when 4 then 'Change the shaded text feature ON/OFF.'
  882.     when 5 then 'Change the over-all volume of the music.'
  883.     when 6 then 'Change the over-all volume of the sound effects.'
  884.     when 7 then 'Change the sound effect played when a window moves.'
  885.     when 8 then 'Change the speed that the windows move.'
  886.     when 9 then 'Change the gradient bars ON/OFF.'
  887.     when 10 then 'Change the style of gradient bar to use.'
  888.     when 11 then 'Change the opacity of the gradient bars.'
  889.     end
  890.     @help_window.set_text(help_text)
  891.     if Input.trigger?(Input::B)
  892.       $game_system.se_play($data_system.cancel_se)
  893.       @options_window.active, @command_window.active = false, true
  894.       [@options_window, @help_window].each {|win| move(win)}
  895.     elsif Input.repeat?(Input::LEFT) || Input.repeat?(Input::RIGHT)
  896.       $game_system.se_play($data_system.cursor_se)
  897.       case @options_window.index
  898.       when 0 # Windowskin
  899.         index = $game_system.unlocked_skins.index($game_system.windowskin_name)
  900.         return $game_system.se_play($data_system.buzzer_se) if index == nil
  901.         Input.repeat?(Input::LEFT) ? index -= 1 : index += 1
  902.         index %= $game_system.unlocked_skins.size
  903.         $game_system.windowskin_name = $game_system.unlocked_skins[index]
  904.       when 1 # Window Opacity
  905.         $game_system.window_opacity += Input.repeat?(Input::LEFT) ? -5 : 5
  906.         $game_system.window_opacity %= 260
  907.       when 2 # Font Type
  908.         index = $game_system.unlocked_fonts.index($game_system.fontname)
  909.         return $game_system.se_play($data_system.buzzer_se) if index == nil
  910.         Input.repeat?(Input::LEFT) ? index -= 1 : index += 1
  911.         index %= $game_system.unlocked_fonts.size
  912.         $game_system.fontname = $game_system.unlocked_fonts[index]
  913.       when 3 # Font Size
  914.         $game_system.fontsize += Input.repeat?(Input::LEFT) ? -1 : 1
  915.         sz = Zer0_CMS::Font_Size_Range
  916.         $game_system.fontsize = [[$game_system.fontsize, sz[1]].min, sz[0]].max
  917.       when 4 # Shaded Text
  918.         $game_system.SHADED_TEXT = $game_system.SHADED_TEXT == true ? false : true
  919.       when 5 # BGM Volume
  920.         $game_system.bgm_volume += Input.repeat?(Input::LEFT) ? -5 : 5
  921.         $game_system.bgm_volume %= 105
  922.         $game_system.bgm_play($game_system.bgm_memorize)
  923.       when 6 # BGS Volume
  924.         $game_system.se_volume += Input.repeat?(Input::LEFT) ? -5 : 5
  925.         $game_system.se_volume %= 105
  926.         $game_system.bgs_play($game_system.bgs_memorize)
  927.       when 7 # Window SE
  928.         $game_system.window_SE += Input.trigger?(Input::LEFT) ? -1 : 1
  929.         $game_system.window_SE %= Zer0_CMS::Window_Move_SE.size
  930.         audio = Zer0_CMS::Window_Move_SE[$game_system.window_SE]
  931.         if audio != nil
  932.           $game_system.se_play(RPG::AudioFile.new(audio[0], audio[1], audio[2]))
  933.         end
  934.       when 8 # Window Move Speed
  935.         $game_system.window_speed += Input.repeat?(Input::LEFT) ? -1 : 1
  936.         @all_windows.each {|window| window.refresh_speed}
  937.       when 9 # Bars
  938.         $game_system.BARS = $game_system.BARS == true ? false : true
  939.       when 10 # Bar Style
  940.         $game_system.bar_style += Input.repeat?(Input::LEFT) ? -1 : 1
  941.         $game_system.bar_style %= 7
  942.       when 11 # Bar Opacity
  943.         $game_system.bar_opacity += Input.repeat?(Input::LEFT) ? -5 : 5
  944.       end
  945.       @all_windows.each {|window|
  946.         window.back_opacity = $game_system.window_opacity
  947.         if window.contents != nil
  948.           window.contents.font.name = $game_system.fontname
  949.           window.contents.font.size = $game_system.fontsize
  950.         end
  951.         window.refresh if defined?(window.refresh)
  952.       }
  953.     end
  954.   end
  955. #-------------------------------------------------------------------------------  
  956.   def update_quest_select
  957.     if Input.trigger?(Input::B)
  958.       $game_system.se_play($data_system.cancel_se)
  959.       @quest_list.active, @command_window.active = false, true
  960.       [@quest_info, @quest_list].each {|win| move(win)}
  961.     elsif Input.trigger?(Input::C)
  962.       if @quest_info == nil
  963.         @quests = []
  964.         $game_party.quests.each_key {|i| @quests.push(i)}
  965.         @quest_info = Window_QuestInfo.new(@quests[@quest_list.index])
  966.         @all_windows.push(@quest_info)
  967.       end
  968.       se = @quests.empty? ? $data_system.buzzer_se : $data_system.decision_se
  969.       $game_system.se_play(se)
  970.       unless @quests.empty?
  971.         @quest_info.quest = @quests[@quest_list.index]
  972.         move(@quest_info, false)
  973.       end
  974.     end
  975.   end
  976. #-------------------------------------------------------------------------------  
  977.   def update_data
  978.     if Input.trigger?(Input::B)
  979.       $game_system.se_play($data_system.cancel_se)
  980.       [@file_windows, @data_window, @help_window].each {|win| move(win)}
  981.       @data_window.active, @command_window.active = false, true
  982.     elsif Input.trigger?(Input::C)
  983.       if $game_system.save_disabled && @data_window.index == 0
  984.         $game_system.se_play($data_system.buzzer_se)
  985.         return
  986.       end
  987.       $game_system.se_play($data_system.decision_se)
  988.       if @file_windows == nil
  989.         @file_windows = []
  990.         (0...Zer0_CMS::Save_File_Number).each {|i|
  991.           filename = "#{Zer0_CMS::Save_Name}#{i+1}.#{Zer0_CMS::Save_Ext}"
  992.           @file_windows[i] = Window_Zer0_File.new(i, filename)
  993.           @all_windows.push(@file_windows[i])}
  994.       end
  995.       latest_time = Time.at(0)
  996.       (0...Zer0_CMS::Save_File_Number).each {|i|
  997.         filename = "#{Zer0_CMS::Save_Name}#{i+1}.#{Zer0_CMS::Save_Ext}"
  998.         if FileTest.exist?(filename)
  999.           file = File.open(filename, 'r')
  1000.           if file.mtime > latest_time
  1001.             latest_time = file.mtime
  1002.             $game_temp.last_file_index = i
  1003.           end
  1004.           file.close
  1005.         end
  1006.       }
  1007.       @file_index = $game_temp.last_file_index
  1008.       [@file_windows, @help_window].each {|win| move(win, false)}
  1009.       @file_windows[@file_index].selected, @data_window.active = true, false
  1010.       @file_active = true
  1011.     end
  1012.   end    
  1013. #-------------------------------------------------------------------------------
  1014.   def update_file_select
  1015.     help_text = case @data_window.index
  1016.     when 0 then 'Which file would you like to save to?'
  1017.     when 1 then 'Which file would you like to load?'
  1018.     end
  1019.     @help_window.set_text(help_text)
  1020.     if Input.trigger?(Input::B)
  1021.       if @save_calling
  1022.         [@command_window, @info_window, @data_window, @file_windows,
  1023.          @help_window].each {|win| move(win)}
  1024.         $game_temp.save_calling = false
  1025.         $scene = Scene_Map.new
  1026.         return
  1027.       end
  1028.       [@help_window, @file_windows].each {|win| move(win)}
  1029.       @file_active, @data_window.active = false, true
  1030.       @file_windows.each {|window| window.selected = false}
  1031.     elsif Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN)
  1032.       unless @file_windows.any? {|window| window.moving?}
  1033.         $game_system.se_play($data_system.cursor_se)
  1034.         @file_windows[@file_index].selected = false
  1035.         Input.trigger?(Input::UP) ? @file_index -= 1 : @file_index += 1
  1036.         @file_index = [[@file_index, @file_windows.size - 1].min, 0].max
  1037.         @file_windows[@file_index].selected = true
  1038.         if @file_windows[@file_index].y >= 480
  1039.             @file_windows.each_index {|i|
  1040.               @file_windows[i].y += Input.trigger?(Input::UP) ? 122 : -122
  1041.               @file_windows[i].y %= (@file_windows.size) * 122
  1042.             }
  1043.         end
  1044.       end
  1045.     elsif Input.trigger?(Input::C)
  1046.       if @confirm_window == nil
  1047.         @header_text = Window_Base.new(32, 480, 160, 82)
  1048.         @header_text.contents = Bitmap.new(128, 25)
  1049.         @confirm_window = Window_Command_HMod.new(['Yes', 'No'])
  1050.         @confirm_window.opacity = 0
  1051.         @confirm_window.x, @confirm_window.y = 32, 506
  1052.         @all_windows.push(@confirm_window, @header_text)
  1053.       end
  1054.       @header_text.contents.clear
  1055.       if @data_window.index == 0
  1056.         @header_text.contents.draw_text(0, 0, 128, 25, 'Overwrite this file?', 1)
  1057.       else
  1058.         @header_text.contents.draw_text(0, 0, 128, 25, 'Load this file?', 1)
  1059.       end
  1060.       @confirm_window.active, @file_active = true, false
  1061.       [@header_text, @confirm_window].each {|win| move(win, false)}
  1062.     end
  1063.   end
  1064. #-------------------------------------------------------------------------------
  1065.   def update_confirm
  1066.     if Input.trigger?(Input::B)
  1067.       @confirm_window.active, @file_active = false, true
  1068.       [@header_text, @confirm_window].each {|win| move(win)}
  1069.     elsif Input.trigger?(Input::C)
  1070.       case @confirm_window.index
  1071.       when 0 # Yes
  1072.         filename = @file_windows[@file_index].filename
  1073.         case @data_window.index
  1074.         when 0 # Save
  1075.           $game_system.se_play($data_system.save_se)
  1076.           file = File.open(filename, 'wb')
  1077.           characters = []
  1078.           $game_party.actors.each {|actor|
  1079.             characters.push([actor.character_name, actor.character_hue])}
  1080.           Marshal.dump(characters, file)
  1081.           Marshal.dump(Graphics.frame_count, file)
  1082.           $game_system.save_count += 1
  1083.           $game_system.magic_number = $data_system.magic_number
  1084.           Marshal.dump($game_system, file)
  1085.           Marshal.dump($game_switches, file)
  1086.           Marshal.dump($game_variables, file)
  1087.           Marshal.dump($game_map, file)
  1088.           Marshal.dump($game_self_switches, file)
  1089.           Marshal.dump($game_screen, file)
  1090.           Marshal.dump($game_actors, file)
  1091.           Marshal.dump($game_party, file)
  1092.           Marshal.dump($game_troop, file)
  1093.           Marshal.dump($game_player, file)
  1094.           Zer0_CMS::Save_Data.each {|data| eval("Marshal.dump(#{data}, file)")}
  1095.           file.close
  1096.           @file_active, @confirm_window.active= true, false
  1097.           @file_windows[@file_index].refresh
  1098.           [@header_text, @confirm_window].each {|win| move(win)}
  1099.         when 1 # Load
  1100.           unless FileTest.exist?(filename)
  1101.             $game_system.se_play($data_system.buzzer_se)
  1102.             return
  1103.           end
  1104.           $game_system.se_play($data_system.load_se)
  1105.           file = File.open(filename, 'rb')
  1106.           characters = Marshal.load(file)
  1107.           Graphics.frame_count = Marshal.load(file)
  1108.           $game_system         = Marshal.load(file)
  1109.           $game_switches       = Marshal.load(file)
  1110.           $game_variables      = Marshal.load(file)
  1111.           $game_map            = Marshal.load(file)
  1112.           $game_self_switches  = Marshal.load(file)
  1113.           $game_screen         = Marshal.load(file)
  1114.           $game_actors         = Marshal.load(file)
  1115.           $game_party          = Marshal.load(file)
  1116.           $game_troop          = Marshal.load(file)
  1117.           $game_player         = Marshal.load(file)
  1118.           Zer0_CMS::Save_Data.each {|data| eval("#{data} = Marshal.load(file)")}
  1119.           if $game_system.magic_number != $data_system.magic_number
  1120.             $game_map.setup($game_map.map_id)
  1121.             $game_player.center($game_player.x, $game_player.y)
  1122.           end
  1123.           $game_party.refresh
  1124.           file.close
  1125.           $game_system.bgm_play($game_system.playing_bgm)
  1126.           $game_system.bgs_play($game_system.playing_bgs)
  1127.           @loading_flag = true
  1128.           $scene = Scene_Map.new
  1129.         end
  1130.       when 1 # No
  1131.         @confirm_window.active, @file_active = false, true
  1132.         [@header_text, @confirm_window].each {|win| move(win)}
  1133.       end
  1134.     end
  1135.   end
  1136. #-------------------------------------------------------------------------------  
  1137.   def call_save_screen
  1138.     # Used when the "Call Save Screen" event command is used.
  1139.     @data_window = Window_Command_HMod.new(['Save', 'Load'])
  1140.     @data_window.active, @data_window.index = false, 0
  1141.     @file_windows = []
  1142.     [0, 1, 2].each {|i|
  1143.       filename = "#{Zer0_CMS::Save_Name}#{i+1}.#{Zer0_CMS::Save_Ext}"
  1144.       @file_windows[i] = Window_Zer0_File.new(i, filename)
  1145.     }
  1146.     @file_windows.each {|window| @all_windows.push(window)}
  1147.     @all_windows.push(@data_window)
  1148.     @file_index = $game_temp.last_file_index
  1149.     @file_windows[@file_index].selected, @file_active = true, true
  1150.     @command_window.active = false  
  1151.     [@file_windows, @help_window, @data_window].each {|win| move(win, false)}
  1152.   end
  1153. #-------------------------------------------------------------------------------
  1154.   def move(window, out = true)
  1155.     cmnd_width = @command_window.width
  1156.     dest = case window
  1157.     when @command_window then out ? [-cmnd_width, 0] : [0, 0]
  1158.     when @help_window then out ? [640, 57] : [192, 57]
  1159.     when @info_window then out ? [0, 480] : [0, 57]
  1160.     when @char_select then out ? [-192, 194] : [0, 194]
  1161.     when @status_window then out ? [640, 57] : [192, 57]
  1162.     when @item_window then out ? [192, 480] : [192, 114]
  1163.     when @item_options_window then out ? [cmnd_width, -57] : [cmnd_width, 0]
  1164.     when @item_sort_window then out ? [96, 480] : [96, 194]
  1165.     when @quest_list then out ? [-192, 194] : [0, 194]
  1166.     when @quest_info then out ? [640, 57] : [192, 57]
  1167.     when @options_window then out ? [192, 480] : [192, 114]
  1168.     when @skill_window then out ? [192, 480] : [192, 240]
  1169.     when @skill_status then out ? [640, 114] : [192, 114]
  1170.     when @equip_item then out ? [192, 480] : [192, 306]
  1171.     when @equip_left then out ? [640, 114] : [192, 114]
  1172.     when @equip_right then out ? [832, 114] : [384, 114]
  1173.     when @data_window then out ? [640, 0] : [cmnd_width, 0]
  1174.     when @confirm_window then out ? [32, 506] : [32, 220]
  1175.     when @header_text then out ? [32, 480] : [32, 194]
  1176.     when @file_windows
  1177.       @file_windows.each_index {|i|
  1178.         y = out ? 640 + (i * 122) : 114 + (i * 122)
  1179.         index = @file_index > 2 ? (i + @file_index) % @file_windows.size : i
  1180.         @file_windows[index].move(192, y)
  1181.       }
  1182.       return
  1183.     end
  1184.     unless window == nil
  1185.       window.move(dest[0], dest[1])
  1186.     end
  1187.   end
  1188. end
  1189.  
  1190. #===============================================================================
  1191. # ** Scene_Load
  1192. #===============================================================================
  1193.  
  1194. class Scene_Load
  1195.  
  1196.   def initialize
  1197.     $game_temp = Game_Temp.new if $game_temp == nil
  1198.   end
  1199. #-------------------------------------------------------------------------------
  1200.   def main
  1201.     @sprite = Sprite.new
  1202.     if Zer0_CMS::Load_Screen_Background != nil
  1203.       @sprite.bitmap = RPG::Cache.title(Zer0_CMS::Load_Screen_Background)
  1204.     else
  1205.       @sprite.bitmap = RPG::Cache.title($data_system.title_name)
  1206.     end
  1207.     @header = Window_Base.new(-640, 0, 640, 57)
  1208.     @header.contents = Bitmap.new(608, 25)
  1209.     @header.contents.draw_text(0, 0, 608, 25, 'Load Game', 1)
  1210.     @help_window = Window_Zer0_Help.new
  1211.     @help_window.x, @help_window.y = -@help_window.width, 57
  1212.     @help_window.set_text('Which file would you like to load?')
  1213.     @file_windows = []
  1214.     (0...Zer0_CMS::Save_File_Number).each {|i|
  1215.       @file_windows[i] = Window_Zer0_File.new(i, make_filename(i))
  1216.       @file_windows[i].x = 0}
  1217.     latest_time = Time.at(0)
  1218.     (0...Zer0_CMS::Save_File_Number).each {|i|
  1219.       filename = make_filename(i)
  1220.       if FileTest.exist?(filename)
  1221.         file = File.open(filename, 'r')
  1222.         if file.mtime > latest_time
  1223.           latest_time = file.mtime
  1224.           $game_temp.last_file_index = i
  1225.         end
  1226.         file.close
  1227.       end
  1228.     }
  1229.     @file_active, @file_index = true, $game_temp.last_file_index
  1230.     @file_windows[@file_index].selected = true
  1231.     @confirm = Window_Command.new(96, ['Load', 'Cancel'])
  1232.     @confirm.x, @confirm.y, @confirm.active = 640, selected_y, false
  1233.     Graphics.transition
  1234.     @header.move(0, 0)
  1235.     @help_window.move(0, 57)
  1236.     @file_windows.each_index {|i|
  1237.       y = 114 + (i * 122)
  1238.       index = @file_index > 2 ? (i + @file_index) % @file_windows.size : i
  1239.       @file_windows[index].move(0, y)}
  1240.     loop {Graphics.update; Input.update; update; break if $scene != self}
  1241.     Graphics.freeze
  1242.     [@sprite.bitmap, @sprite, @help_window, @confirm, @header].each {|sprite|
  1243.       sprite.dispose}
  1244.     @file_windows.each {|window| window.dispose}
  1245.   end
  1246. #-------------------------------------------------------------------------------
  1247.   def update
  1248.     [@help_window, @confirm, @header].each {|window| window.update}
  1249.     @file_windows.each {|window| window.update}
  1250.     if @file_active
  1251.       update_file
  1252.     elsif @confirm.active
  1253.       update_confirm
  1254.     end
  1255.   end
  1256. #-------------------------------------------------------------------------------
  1257.   def update_file
  1258.     if Input.trigger?(Input::B)
  1259.       $game_system.se_play($data_system.cancel_se)
  1260.       $scene = Scene_Title.new
  1261.     elsif Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN)
  1262.       $game_system.se_play($data_system.cursor_se)
  1263.       @file_windows[@file_index].selected = false
  1264.       Input.trigger?(Input::UP) ? @file_index -= 1 : @file_index += 1
  1265.       @file_index = [[@file_index, @file_windows.size - 1].min, 0].max
  1266.       @file_windows[@file_index].selected = true
  1267.       if @file_windows[@file_index].y >= 480
  1268.         @file_windows.each_index {|i|
  1269.           @file_windows[i].y += Input.trigger?(Input::UP) ? 122 : -122
  1270.           @file_windows[i].y %= (@file_windows.size) * 122}
  1271.       end
  1272.     elsif Input.trigger?(Input::C)
  1273.       unless FileTest.exist?(make_filename(@file_index))
  1274.         $game_system.se_play($data_system.buzzer_se)
  1275.         return
  1276.       end
  1277.       $game_system.se_play($data_system.decision_se)
  1278.       @confirm.active, @file_active, @confirm.index = true, false, 0
  1279.       @confirm.y = selected_y
  1280.       @confirm.move(448, selected_y)
  1281.       @help_window.set_text("Load File #{@file_index + 1}?")
  1282.     end
  1283.   end
  1284. #-------------------------------------------------------------------------------
  1285.   def update_confirm
  1286.     if Input.trigger?(Input::B)
  1287.       $game_system.se_play($data_system.cancel_se)
  1288.       @confirm.y = selected_y
  1289.       @confirm.move(640, selected_y)
  1290.       @confirm.active, @file_active = false, true
  1291.       @help_window.set_text('Which file would you like to load?')
  1292.     elsif Input.trigger?(Input::C)
  1293.       if @confirm.index == 0
  1294.         $game_system.se_play($data_system.load_se)
  1295.         file = File.open(make_filename(@file_index), 'rb')
  1296.         characters           = Marshal.load(file)
  1297.         Graphics.frame_count = Marshal.load(file)
  1298.         $game_system         = Marshal.load(file)
  1299.         $game_switches       = Marshal.load(file)
  1300.         $game_variables      = Marshal.load(file)
  1301.         $game_map            = Marshal.load(file)
  1302.         $game_self_switches  = Marshal.load(file)
  1303.         $game_screen         = Marshal.load(file)
  1304.         $game_actors         = Marshal.load(file)
  1305.         $game_party          = Marshal.load(file)
  1306.         $game_troop          = Marshal.load(file)
  1307.         $game_player         = Marshal.load(file)
  1308.         Zer0_CMS::Save_Data.each {|data| eval("#{data} = Marshal.load(file)")}
  1309.         if $game_system.magic_number != $data_system.magic_number
  1310.           $game_map.setup($game_map.map_id)
  1311.           $game_player.center($game_player.x, $game_player.y)
  1312.         end
  1313.         $game_party.refresh
  1314.         file.close
  1315.         $game_system.bgm_play($game_system.playing_bgm)
  1316.         $game_system.bgs_play($game_system.playing_bgs)
  1317.         $scene = Scene_Map.new
  1318.       else
  1319.         $game_system.se_play($data_system.cancel_se)
  1320.         @confirm.active, @file_active = false, true
  1321.         @confirm.y = selected_y
  1322.         @confirm.move(640, selected_y)
  1323.         @help_window.set_text('Which file would you like to load?')
  1324.       end
  1325.     end
  1326.   end
  1327. #-------------------------------------------------------------------------------
  1328.   def selected_y
  1329.     @file_windows.each {|window|
  1330.       if window.selected
  1331.         return @file_windows[@file_windows.index(window)].y + 13
  1332.       end
  1333.     }
  1334.   end
  1335. #-------------------------------------------------------------------------------
  1336.   def make_filename(file_index)
  1337.     return "#{Zer0_CMS::Save_Name}#{file_index + 1}.#{Zer0_CMS::Save_Ext}"
  1338.   end
  1339. end
  1340.  
  1341. #===============================================================================
  1342. # ** Scene_Map
  1343. #===============================================================================
  1344.  
  1345. class Scene_Map
  1346.  
  1347.   def call_save
  1348.     $game_player.straighten
  1349.     $scene = Scene_Menu.new(6, true)
  1350.   end
  1351. end
  1352.  
  1353. #===============================================================================
  1354. # ** Game_Map
  1355. #===============================================================================
  1356.  
  1357. class Game_Map
  1358.  
  1359.   def name(id = @map_id)
  1360.     return $map_names[id]
  1361.   end
  1362. end
  1363.  
  1364. #===============================================================================
  1365. # ** Game_Party
  1366. #===============================================================================
  1367.  
  1368. class Game_Party
  1369.  
  1370.   attr_accessor :quests
  1371.  
  1372.   alias zer0_quest_init initialize
  1373.   def initialize
  1374.     zer0_quest_init
  1375.     @quests = {}
  1376.   end
  1377. end
  1378.  
  1379. #===============================================================================
  1380. # ** Bitmap (Method created by Blizzard)
  1381. #===============================================================================
  1382.  
  1383. class Bitmap
  1384.  
  1385.   def slice_text(text, width)
  1386.     words = text.split(' ')
  1387.     return words if words.size == 1
  1388.     result, current_text = [], words.shift
  1389.     words.each_index {|i|
  1390.     if self.text_size("#{current_text} #{words[i]}").width > width
  1391.       result.push(current_text)
  1392.       current_text = words[i]
  1393.     else
  1394.       current_text = "#{current_text} #{words[i]}"
  1395.     end
  1396.     result.push(current_text) if i >= words.size - 1}
  1397.     return result
  1398.   end
  1399. end
  1400.  
  1401. #===============================================================================
  1402. # ** Game_System
  1403. #===============================================================================
  1404.  
  1405. class Game_System
  1406.  
  1407.   attr_accessor :bgm_volume, :se_volume, :window_opacity, :window_SE
  1408.   attr_reader   :window_speed, :unlocked_skins, :unlocked_fonts
  1409.  
  1410.   alias zer0_cms_system_init initialize
  1411.   def initialize
  1412.     zer0_cms_system_init
  1413.     @unlocked_skins, @unlocked_fonts = Zer0_CMS::Windowskins, Zer0_CMS::Fonts
  1414.     @window_opacity, @window_SE, @window_speed = 160, 1, 5
  1415.     @bgm_volume = @se_volume = 100
  1416.     if $tons_version == nil || $tons_version < 6.03
  1417.       raise("Blizzard's Tons-of-Addons is required for Zer0_CMS to work.\n" +
  1418.             'Please install first to continue. (Version 6.03 or higher)')
  1419.     else
  1420.       unless TONS_OF_ADDONS::ULTIMATE_FONT_OVERRIDE
  1421.         raise("ULTIMATE_FONT_OVERRIDE must be 'true' for many features to work\n" +
  1422.               'correctly. Please set to true in Tons-of-Addons(2) to continue.')
  1423.       end
  1424.     end
  1425.     if $ccts == nil && $ates == nil
  1426.       unless Zer0_CMS::Time_System_Override
  1427.         raise("Zer0_CMS requires Complete Climate and Time System (CCTS) or\n" +
  1428.               "Advanced Time and Environment System (ATES) to work!\n" +
  1429.               'Please install one of them before continuing.')
  1430.       end
  1431.     elsif $ccts != nil && $ates != nil
  1432.       raise("Zer0_CMS is not compatible with both ATES and CCTS.\n" +
  1433.             'Remove one of them to continue.')
  1434.     end
  1435.     unless Zer0_CMS::Save_Data.all? {|data| data.is_a?(String)}
  1436.       raise("Zer0_CMS Configuration Error!\n" +
  1437.             'All Save_Data must be written as a string. (\'\').')
  1438.     end
  1439.     if Zer0_CMS::Auto_Install_Fonts && !FileTest.exists?('Data\fileutils.rb')
  1440.       raise("\"fileutils.rb\" missing from Data folder.\n" +
  1441.             'This file is required for installing fonts.')
  1442.     end
  1443.   end
  1444. #-------------------------------------------------------------------------------
  1445.   def add_skin(filename)
  1446.     unless @unlocked_skins.include?(filename)
  1447.       @unlocked_skins.push(filename)
  1448.     end
  1449.   end
  1450. #-------------------------------------------------------------------------------
  1451.   def add_font(font)
  1452.     unless @unlocked_fonts.include?(font)
  1453.       @unlocked_fonts.push(font)
  1454.     end
  1455.   end
  1456. #-------------------------------------------------------------------------------  
  1457.   def window_speed=(speed)
  1458.     @window_speed = [[speed, 10].min, 1].max
  1459.   end
  1460. #-------------------------------------------------------------------------------  
  1461.   def bgm_play(bgm)
  1462.     @playing_bgm = bgm
  1463.     if bgm != nil && bgm.name != ''
  1464.       volume = bgm.volume * (@bgm_volume / 100.0)
  1465.       Audio.bgm_play('Audio/BGM/' + bgm.name, volume, bgm.pitch)
  1466.     else
  1467.       Audio.bgm_stop
  1468.     end
  1469.     Graphics.frame_reset
  1470.   end
  1471. #-------------------------------------------------------------------------------  
  1472.   def bgs_play(bgs)
  1473.     @playing_bgs = bgs
  1474.     if bgs != nil && bgs.name != ''
  1475.       volume = bgs.volume * (@se_volume / 100.0)
  1476.       Audio.bgs_play('Audio/BGS/' + bgs.name, volume, bgs.pitch)
  1477.     else
  1478.       Audio.bgs_stop
  1479.     end
  1480.     Graphics.frame_reset
  1481.   end
  1482. #-------------------------------------------------------------------------------
  1483.   def me_play(me)
  1484.     if me != nil && me.name != ''
  1485.       volume = me.volume * (@bgm_volume / 100.0)
  1486.       Audio.me_play('Audio/ME/' + me.name, volume, me.pitch)
  1487.     else
  1488.       Audio.me_stop
  1489.     end
  1490.     Graphics.frame_reset
  1491.   end
  1492. #-------------------------------------------------------------------------------
  1493.   def se_play(se)
  1494.     if se != nil && se.name != ''
  1495.       volume = se.volume * (@se_volume / 100.0)
  1496.       Audio.se_play('Audio/SE/' + se.name, volume, se.pitch)
  1497.     end
  1498.   end
  1499. end
  1500.  
  1501. #===============================================================================
  1502. # ** Game_Actor
  1503. #===============================================================================
  1504.  
  1505. class Game_Actor
  1506.  
  1507.   def guard_elements(icon_flag = false)
  1508.     elements = []
  1509.     [@armor1_id, @actor2_id, @actor3_id, @actor4_id].each {|id|
  1510.       if id != nil && $data_armors[id] != nil
  1511.         $data_armors[id].guard_element_set.each {|element_id|
  1512.           unless elements.include?($data_system.elements[element_id]) ||
  1513.             $DUMMY_ELEMENTS.include?(element_id)
  1514.             elements.push($data_system.elements[element_id])
  1515.           end
  1516.         }
  1517.       end
  1518.     }
  1519.     if icon_flag
  1520.       elements.each_index {|i|
  1521.         elements[i] = RPG::Cache.icon("Element/#{elements[i].downcase}")}
  1522.     end
  1523.     return elements    
  1524.   end
  1525. #-------------------------------------------------------------------------------
  1526.   def guard_states(icon_flag = false)
  1527.     states = []
  1528.     [@armor1_id, @actor2_id, @actor3_id, @actor4_id].each {|id|
  1529.       if id != nil && id != 0
  1530.         $data_armors[id].guard_state_set.each {|state_id|
  1531.           unless states.include?($data_states[state_id].name) ||
  1532.             $DUMMY_STATES.include?(state_id)
  1533.             states.push($data_states[state_id].name)
  1534.           end
  1535.         }
  1536.       end
  1537.     }
  1538.     if icon_flag
  1539.       states.each_index {|i|
  1540.         states[i] = RPG::Cache.icon("State/#{states[i].downcase}")}
  1541.     end
  1542.     return states    
  1543.   end
  1544. #-------------------------------------------------------------------------------
  1545.   def attack_elements(icon_flag = false)
  1546.     elements = []
  1547.     if @weapon_id != nil
  1548.       return [] if $data_weapons[@weapon_id] == nil
  1549.       $data_weapons[@weapon_id].element_set.each {|element_id|
  1550.         unless $DUMMY_ELEMENTS.include?(element_id)
  1551.           elements.push($data_system.elements[element_id])
  1552.         end
  1553.       }
  1554.     end
  1555.     if icon_flag
  1556.       elements.each_index {|i|
  1557.         elements[i] = RPG::Cache.icon("Element/#{elements[i].downcase}")}
  1558.     end
  1559.     return elements
  1560.   end
  1561. #-------------------------------------------------------------------------------
  1562.   def attack_states(icon_flag = false)
  1563.     states = []
  1564.     if @weapon_id != nil
  1565.       return [] if $data_weapons[@weapon_id] == nil
  1566.       $data_weapons[@weapon_id].plus_state_set.each {|state_id|
  1567.         unless $DUMMY_STATES.include?(state_id)
  1568.           states.push($data_states[state_id].name)
  1569.         end
  1570.       }
  1571.     end
  1572.     if icon_flag
  1573.       states.each_index {|i|
  1574.         states[i] = RPG::Cache.icon("State/#{states[i].downcase}")}
  1575.     end
  1576.     return states
  1577.   end
  1578. end
  1579.  
  1580. #===============================================================================
  1581. # ** Window_Base (Original script by Fantasist, with minor edit for audio)
  1582. #===============================================================================
  1583.  
  1584. class Window_Base < Window
  1585.  
  1586.   attr_accessor :dest_x, :dest_y, :move_speed
  1587.  
  1588.   alias move_wins_winbase_init initialize
  1589.   def initialize(x, y, width, height)
  1590.     move_wins_winbase_init(x, y, width, height)
  1591.     self.back_opacity = $game_system.window_opacity
  1592.     self.dest_x = x
  1593.     self.dest_y = y
  1594.     self.move_speed = $game_system.window_speed
  1595.   end
  1596. #-------------------------------------------------------------------------------
  1597.   def moving?
  1598.     return (self.x != self.dest_x || self.y != self.dest_y)
  1599.   end
  1600. #-------------------------------------------------------------------------------
  1601.   def move(dest_x, dest_y, move_speed = nil, se_flag = true)
  1602.     self.dest_x = dest_x
  1603.     self.dest_y = dest_y
  1604.     self.move_speed = move_speed unless move_speed.nil?
  1605.     if se_flag && moving?
  1606.       audio = Zer0_CMS::Window_Move_SE[$game_system.window_SE]
  1607.       if audio != nil
  1608.         file = RPG::AudioFile.new(audio[0], audio[1], audio[2])
  1609.         $game_system.se_play(file)
  1610.       end
  1611.     end
  1612.   end
  1613. #-------------------------------------------------------------------------------  
  1614.   def refresh_speed
  1615.     self.move_speed = $game_system.window_speed
  1616.   end
  1617. #-------------------------------------------------------------------------------
  1618.   def move_wins
  1619.     dx = (self.dest_x - self.x).to_f / self.move_speed
  1620.     dy = (self.dest_y - self.y).to_f / self.move_speed
  1621.     dx = self.dest_x > self.x ? dx.ceil : dx.floor
  1622.     dy = self.dest_y > self.y ? dy.ceil : dy.floor
  1623.     self.x += dx
  1624.     self.y += dy
  1625.   end
  1626. #-------------------------------------------------------------------------------
  1627.   def x=(val)
  1628.     self.dest_x = val unless moving?
  1629.     super(val)
  1630.   end
  1631. #-------------------------------------------------------------------------------
  1632.   def y=(val)
  1633.     self.dest_y = val unless moving?
  1634.     super(val)
  1635.   end
  1636. #-------------------------------------------------------------------------------
  1637.   alias move_wins_winbase_update update
  1638.   def update
  1639.     move_wins_winbase_update
  1640.     move_wins if moving?
  1641.   end
  1642. end
  1643. #==============================================================================
  1644. # ** Window_Selectable_Mod
  1645. #==============================================================================
  1646.  
  1647. class Window_Selectable_Mod < Window_Base
  1648.  
  1649.   attr_reader   :index, :help_window                              
  1650.  
  1651.   def initialize(x, y, width, height)
  1652.     super(x, y, width, height)
  1653.     @item_max, @column_max, @index = 1, 1, -1
  1654.   end
  1655. #-------------------------------------------------------------------------------
  1656.   def index=(index)
  1657.     @index = index
  1658.     if self.active && @help_window != nil
  1659.       update_help
  1660.     end
  1661.     update_cursor_rect
  1662.   end
  1663. #-------------------------------------------------------------------------------
  1664.   def row_max
  1665.     return (@item_max + @column_max - 1) / @column_max
  1666.   end
  1667. #-------------------------------------------------------------------------------
  1668.   def top_row
  1669.     return self.oy / 25
  1670.   end
  1671. #-------------------------------------------------------------------------------
  1672.   def top_row=(row)
  1673.     self.oy = [[row, 0].max, row_max - 1].min * 25
  1674.   end
  1675. #-------------------------------------------------------------------------------
  1676.   def page_row_max
  1677.     return (self.height - 32) / 25
  1678.   end
  1679. #-------------------------------------------------------------------------------
  1680.   def page_item_max
  1681.     return page_row_max * @column_max
  1682.   end
  1683. #-------------------------------------------------------------------------------
  1684.   def help_window=(help_window)
  1685.     @help_window = help_window
  1686.     if self.active && @help_window != nil
  1687.       update_help
  1688.     end
  1689.   end
  1690. #-------------------------------------------------------------------------------
  1691.   def update_cursor_rect
  1692.     if @index < 0
  1693.       self.cursor_rect.empty
  1694.       return
  1695.     end
  1696.     row = @index / @column_max
  1697.     if row < self.top_row
  1698.       self.top_row = row
  1699.     end
  1700.     if row > self.top_row + (self.page_row_max - 1)
  1701.       self.top_row = row - (self.page_row_max - 1)
  1702.     end
  1703.     cursor_width = self.width / @column_max - 32
  1704.     x = @index % @column_max * (cursor_width + 32)
  1705.     y = @index / @column_max * 25 - self.oy
  1706.     self.cursor_rect.set(x, y, cursor_width, 25)
  1707.   end
  1708. #-------------------------------------------------------------------------------
  1709.   def update
  1710.     super
  1711.     if self.active && @item_max > 0 && @index >= 0
  1712.       if Input.repeat?(Input::DOWN)
  1713.         if (@column_max == 1 && Input.trigger?(Input::DOWN)) ||
  1714.            @index < @item_max - @column_max
  1715.           $game_system.se_play($data_system.cursor_se)
  1716.           @index = (@index + @column_max) % @item_max
  1717.         end
  1718.       elsif Input.repeat?(Input::UP)
  1719.         if (@column_max == 1 && Input.trigger?(Input::UP)) ||
  1720.            @index >= @column_max
  1721.           $game_system.se_play($data_system.cursor_se)
  1722.           @index = (@index - @column_max + @item_max) % @item_max
  1723.         end
  1724.       elsif Input.repeat?(Input::RIGHT)
  1725.         if @column_max >= 2 && @index < @item_max - 1
  1726.           $game_system.se_play($data_system.cursor_se)
  1727.           @index += 1
  1728.         end
  1729.       elsif Input.repeat?(Input::LEFT)
  1730.         if @column_max >= 2 && @index > 0
  1731.           $game_system.se_play($data_system.cursor_se)
  1732.           @index -= 1
  1733.         end
  1734.       elsif Input.repeat?(Input::R)
  1735.         if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
  1736.           $game_system.se_play($data_system.cursor_se)
  1737.           @index = [@index + self.page_item_max, @item_max - 1].min
  1738.           self.top_row += self.page_row_max
  1739.         end
  1740.       elsif Input.repeat?(Input::L)
  1741.         if self.top_row > 0
  1742.           $game_system.se_play($data_system.cursor_se)
  1743.           @index = [@index - self.page_item_max, 0].max
  1744.           self.top_row -= self.page_row_max
  1745.         end
  1746.       end
  1747.     end
  1748.     if self.active && @help_window != nil
  1749.       update_help
  1750.     end
  1751.     update_cursor_rect
  1752.   end
  1753. end
  1754.  
  1755. #===============================================================================
  1756. # ** Window_Selectable_HMod
  1757. #===============================================================================
  1758.  
  1759. class Window_Selectable_HMod < Window_Base
  1760.  
  1761.   attr_reader :index, :help_window    
  1762.  
  1763.   def initialize(x, y, width, height)
  1764.     super(x, y, width, height)
  1765.     @item_max, @column_max, @index = 1, 1, -1
  1766.   end
  1767. #-------------------------------------------------------------------------------
  1768.   def index=(index)
  1769.     @index = index
  1770.     if self.active && @help_window != nil
  1771.       update_help
  1772.     end
  1773.     update_cursor_rect
  1774.   end
  1775. #-------------------------------------------------------------------------------
  1776.   def row_max
  1777.     return (@item_max + @column_max - 1) / @column_max
  1778.   end
  1779. #-------------------------------------------------------------------------------
  1780.   def top_row
  1781.     return self.oy / 25
  1782.   end
  1783. #-------------------------------------------------------------------------------
  1784.   def top_row=(row)
  1785.     if row < 0
  1786.       row = 0
  1787.     end
  1788.     if row > row_max - 1
  1789.       row = row_max - 1
  1790.     end
  1791.     self.oy = row * 25
  1792.   end
  1793. #-------------------------------------------------------------------------------
  1794.   def page_row_max
  1795.     return (self.height - 32) / 25
  1796.   end
  1797. #-------------------------------------------------------------------------------
  1798.   def page_item_max
  1799.     return page_row_max * @column_max
  1800.   end
  1801. #-------------------------------------------------------------------------------
  1802.   def help_window=(help_window)
  1803.     @help_window = help_window
  1804.     if self.active && @help_window != nil
  1805.       update_help
  1806.     end
  1807.   end
  1808. #-------------------------------------------------------------------------------
  1809.   def update_cursor_rect
  1810.     if @index < 0
  1811.       self.cursor_rect.empty
  1812.       return
  1813.     end
  1814.     row = @index / @column_max
  1815.     if row < self.top_row
  1816.       self.top_row = row
  1817.     end
  1818.     if row > self.top_row + (self.page_row_max - 1)
  1819.       self.top_row = row - (self.page_row_max - 1)
  1820.     end
  1821.     cursor_width = (self.width - 32) / @column_max
  1822.     x = @index * 64
  1823.     y = @index / @column_max * 25 - self.oy
  1824.     self.cursor_rect.set(x, y, cursor_width, 25)
  1825.   end
  1826. #-------------------------------------------------------------------------------
  1827.   def update
  1828.     super
  1829.     if self.active && @item_max > 0 && @index >= 0
  1830.       if Input.repeat?(Input::DOWN)
  1831.         if (@column_max == 1 && Input.trigger?(Input::DOWN)) ||
  1832.           @index < @item_max - @column_max
  1833.           $game_system.se_play($data_system.cursor_se)
  1834.           @index = (@index + @column_max) % @item_max
  1835.         end
  1836.       elsif Input.repeat?(Input::UP)
  1837.         if (@column_max == 1 && Input.trigger?(Input::UP)) ||
  1838.           @index >= @column_max
  1839.           $game_system.se_play($data_system.cursor_se)
  1840.           @index = (@index - @column_max + @item_max) % @item_max
  1841.         end
  1842.       elsif Input.repeat?(Input::RIGHT)
  1843.         if @column_max >= 2
  1844.           $game_system.se_play($data_system.cursor_se)
  1845.           @index = (@index + 1) % @item_max
  1846.         end
  1847.       elsif Input.repeat?(Input::LEFT)
  1848.         if @column_max >= 2
  1849.           $game_system.se_play($data_system.cursor_se)
  1850.           @index = (@index - 1) % @item_max
  1851.         end
  1852.       elsif Input.repeat?(Input::R)
  1853.         if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
  1854.           $game_system.se_play($data_system.cursor_se)
  1855.           @index = [@index + self.page_item_max, @item_max - 1].min
  1856.           self.top_row += self.page_row_max
  1857.         end
  1858.       elsif Input.repeat?(Input::L)
  1859.         if self.top_row > 0
  1860.           $game_system.se_play($data_system.cursor_se)
  1861.           @index = [@index - self.page_item_max, 0].max
  1862.           self.top_row -= self.page_row_max
  1863.         end
  1864.       end
  1865.     end
  1866.     if self.active && @help_window != nil
  1867.       update_help
  1868.     end
  1869.     update_cursor_rect
  1870.   end
  1871. end
  1872.  
  1873. #===============================================================================
  1874. # ** Window_Command_Mod
  1875. #===============================================================================
  1876.  
  1877. class Window_Command_Mod < Window_Selectable_Mod
  1878.  
  1879.   def initialize(width, commands)
  1880.     super(0, 0, width, commands.size * 25 + 32)
  1881.     @item_max = commands.size
  1882.     @commands = commands
  1883.     self.contents = Bitmap.new(width - 32, @item_max * 25)
  1884.     refresh
  1885.     self.index = 0
  1886.   end
  1887. #-------------------------------------------------------------------------------
  1888.   def refresh
  1889.     self.contents.clear
  1890.     (0...@item_max).each {|i| draw_item(i, normal_color)}
  1891.   end
  1892. #-------------------------------------------------------------------------------
  1893.   def draw_item(index, color)
  1894.     self.contents.font.color = color
  1895.     rect = Rect.new(4, 25 * index, self.contents.width - 8, 25)
  1896.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  1897.     self.contents.draw_text(rect, @commands[index])
  1898.   end
  1899. #-------------------------------------------------------------------------------
  1900.   def disable_item(index)
  1901.     draw_item(index, disabled_color)
  1902.   end
  1903. #-------------------------------------------------------------------------------
  1904.   def update_cursor_rect
  1905.     super
  1906.     cursor_width = self.width / @column_max - 32
  1907.     x = @index % @column_max * (cursor_width + 32)
  1908.     y = @index / @column_max * 25 - self.oy
  1909.     self.cursor_rect.set(x, y, cursor_width, 25)
  1910.   end  
  1911. end
  1912.  
  1913. #===============================================================================
  1914. # ** Window_Command_HMod
  1915. #===============================================================================
  1916.  
  1917. class Window_Command_HMod < Window_Selectable_HMod
  1918.  
  1919.   def initialize(commands)
  1920.     super((commands.size * 64 + 32) * -1, 0, commands.size * 64 + 32, 57)
  1921.     @column_max = @item_max = commands.size
  1922.     @commands = commands
  1923.     self.contents = Bitmap.new(@item_max * 64, 25)
  1924.     refresh
  1925.     self.index = 0
  1926.   end
  1927. #-------------------------------------------------------------------------------
  1928.   def refresh
  1929.     self.contents.clear
  1930.     (0...@item_max).each {|i| draw_item(i, normal_color)}
  1931.   end
  1932. #-------------------------------------------------------------------------------
  1933.   def draw_item(index, color)
  1934.     self.contents.font.color = color
  1935.     self.contents.draw_text(index * 64, 0, 64, 25, @commands[index], 1)
  1936.   end
  1937. #-------------------------------------------------------------------------------
  1938.   def disable_item(index)
  1939.     draw_item(index, disabled_color)
  1940.   end
  1941. end
  1942.  
  1943. #===============================================================================
  1944. # ** Window_GameInfo
  1945. #===============================================================================
  1946.  
  1947. class Window_GameInfo < Window_Base
  1948.  
  1949.   def initialize
  1950.     number = 7
  1951.     super(0, 480, 192, number * 15 + 32)
  1952.     self.contents = Bitmap.new(160, number * 15)
  1953.     refresh
  1954.   end
  1955. #-------------------------------------------------------------------------------
  1956.   def refresh
  1957.     self.contents.clear
  1958.     @total_sec = Graphics.frame_count / Graphics.frame_rate
  1959.     if $ccts != nil
  1960.       @minute, hour = $game_system.time.minute, $game_system.time.hour
  1961.       day, day_name = $game_system.time.day.to_s, $game_system.time.day_name
  1962.       if $ccts < 1.2
  1963.         month = CCTS::Months[$game_system.time.month - 1]
  1964.       else
  1965.         month = CCTS::MONTHS[$game_system.time.month - 1]
  1966.       end
  1967.       year = $game_system.time.year.to_s
  1968.     elsif $ates != nil
  1969.       @minute, hour = $game_system.ates.time.min, $game_system.ates.time.hour
  1970.       day = $game_system.ates.time.day.to_s
  1971.       day_name = ATES::WEEKDAYS[$game_system.ates.time.wday - 1]
  1972.       month = ATES::MONTHS[$game_system.ates.time.mon]
  1973.       year = $game_system.ates.time.year.to_s
  1974.     end
  1975.     h, m, s = @total_sec / 60 / 60, @total_sec / 60 % 60, @total_sec % 60
  1976.     time = sprintf('%2d:%02d', hour, @minute)
  1977.     date = "#{month} #{day}, #{year}"
  1978.     steps, gold = $game_party.steps.to_s, $game_party.gold.to_s
  1979.     playtime = sprintf('%02d:%02d:%02d', h, m, s)
  1980.     words = ['Area:', 'Time:', 'Day:', 'Date:', 'Steps:', 'Play Time:',
  1981.              $data_system.words.gold + ':']
  1982.     info = [$game_map.name, time, day_name, date, steps, playtime, gold]
  1983.     info.each_index {|i|
  1984.       self.contents.font.color = system_color
  1985.       self.contents.draw_text(0, i * 15, 160, 15, words[i])
  1986.       self.contents.font.color = normal_color
  1987.       self.contents.draw_text(0, i * 15, 160, 15, info[i], 2)}
  1988.   end
  1989. #-------------------------------------------------------------------------------
  1990.   def update
  1991.     super
  1992.     min = $ccts != nil ? $game_system.time.minute : $game_system.ates.time.min
  1993.     if @minute != min || Graphics.frame_count / Graphics.frame_rate != @total_sec
  1994.       refresh
  1995.     end
  1996.   end
  1997. end
  1998.  
  1999. #===============================================================================
  2000. # ** Window_CharSelect
  2001. #===============================================================================
  2002.  
  2003. class Window_CharSelect < Window_Selectable
  2004.  
  2005.   def initialize
  2006.     @actors = $game_party.actors
  2007.     height = @actors.size == 4 ? 286 : @actors.size * 64 + 32
  2008.     super(-192, 194, 192, height)
  2009.     self.contents = Bitmap.new(160, height - 32)
  2010.     self.index, self.active, @item_max = 0, false, @actors.size
  2011.     refresh
  2012.   end
  2013. #-------------------------------------------------------------------------------
  2014.   def refresh
  2015.     self.contents.clear
  2016.     @actors.each_index {|i|
  2017.       y = i * 64
  2018.       draw_actor_graphic(@actors[i], 16, y + 58)
  2019.       draw_actor_level(@actors[i], 96, y - 4)
  2020.       draw_actor_name(@actors[i], 32, y - 4)
  2021.       draw_actor_hp(@actors[i], 36, y + 9, 124)
  2022.       draw_actor_sp(@actors[i], 36, y + 30, 124)}
  2023.   end
  2024. #-------------------------------------------------------------------------------
  2025.   def update_cursor_rect
  2026.     if @index < 0
  2027.       self.cursor_rect.empty
  2028.       return
  2029.     end
  2030.     row = @index / @column_max
  2031.     self.top_row = row if row < self.top_row
  2032.     if row > self.top_row + (self.page_row_max - 1)
  2033.       self.top_row = row - (self.page_row_max - 1)
  2034.     end
  2035.     cursor_width = self.width / @column_max - 32
  2036.     x = @index % @column_max * (cursor_width + 32)
  2037.     y = @index / @column_max * 64 - self.oy
  2038.     self.cursor_rect.set(x, y, cursor_width, 64)
  2039.   end
  2040. end
  2041.  
  2042. #===============================================================================
  2043. # ** Window_Zer0_Help
  2044. #===============================================================================
  2045.  
  2046. class Window_Zer0_Help < Window_Base
  2047.  
  2048.   def initialize(width = 448)
  2049.     super(640, 57, width, 57)
  2050.     self.contents = Bitmap.new(width - 32, height - 32)
  2051.   end
  2052. #-------------------------------------------------------------------------------
  2053.   def set_text(text, align = 0)
  2054.     if text != @text || align != @align
  2055.       self.contents.clear
  2056.       self.contents.font.color = normal_color
  2057.       self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
  2058.       @text = text
  2059.       @align = align
  2060.       @actor = nil
  2061.     end
  2062.     self.visible = true
  2063.   end
  2064. #-------------------------------------------------------------------------------
  2065.   def refresh
  2066.     if @text != nil && @align != nil
  2067.       self.contents.clear
  2068.       self.contents.draw_text(4, 0, self.width - 40, 32, @text, @align)
  2069.     end
  2070.   end
  2071. end
  2072.  
  2073. #===============================================================================
  2074. # ** Window_Zer0_Item
  2075. #===============================================================================
  2076. # KK20
  2077. class Window_Zer0_Item < Window_Selectable
  2078.  
  2079.   attr_accessor :abc_sort, :quantity_sort, :sort_type, :equip_type
  2080.  
  2081.   def initialize(actor = $game_party.actors[0], equip_flag = false)
  2082.     height = equip_flag == true ? 174 : 366
  2083.     super(192, 480, 448, height)
  2084.     @column_max = 2
  2085.     self.index = @sort_type = 0
  2086.     @abc_sort = @quantity_sort = false
  2087.     if equip_flag
  2088.       @actor, @equip_flag = actor, equip_flag  
  2089.       @equip_type, self.index = 0, -1
  2090.     end
  2091.     refresh
  2092.   end
  2093. #-------------------------------------------------------------------------------
  2094.   def actor=(actor)
  2095.     @actor = actor
  2096.     refresh
  2097.   end
  2098. #-------------------------------------------------------------------------------
  2099.   def item
  2100.     return @data[self.index]
  2101.   end
  2102. #-------------------------------------------------------------------------------
  2103.   def refresh
  2104.     if self.contents != nil
  2105.       self.contents.dispose
  2106.       self.contents = nil
  2107.     end
  2108.     unless @equip_flag # If normal item window
  2109.       data1, data2, data3, data4 = [], [], [], []
  2110.       (1...$data_items.size).each {|i|
  2111.         if $game_party.item_number(i) > 0
  2112.           if Zer0_CMS::Quest_Items.include?(i)
  2113.             data4.push($data_items[i])
  2114.           else
  2115.             data1.push($data_items[i])
  2116.           end
  2117.         end
  2118.       }
  2119.       (1...$data_weapons.size).each {|i|
  2120.         if $game_party.weapon_number(i) > 0
  2121.           data2.push($data_weapons[i])
  2122.         end
  2123.       }
  2124.       (1...$data_armors.size).each {|i|
  2125.         if $game_party.armor_number(i) > 0
  2126.           data3.push($data_armors[i])
  2127.         end
  2128.       }
  2129.       if @abc_sort
  2130.         [data1, data2, data3, data4].each {|list| list.sort! {|a, b|
  2131.           a.name <=> b.name}}
  2132.       elsif @quantity_sort
  2133.         [data1, data4].each {|list| list.sort! {|a, b|
  2134.           $game_party.item_number(a.id) <=> $game_party.item_number(b.id)}}
  2135.         data2.sort! {|a, b|
  2136.           $game_party.weapon_number(a.id) <=> $game_party.weapon_number(b.id)}
  2137.         data3.sort! {|a, b|
  2138.           $game_party.armor_number(a.id) <=> $game_party.armor_number(b.id)}
  2139.       end
  2140.       @data = case @sort_type
  2141.       when 0 then data1 + data2 + data3
  2142.       when 1 then data1
  2143.       when 2 then data2
  2144.       when 3 then data3
  2145.       when 4 then data4
  2146.       end
  2147.     else # If equip item window
  2148.       @data = []
  2149.       if @equip_type == 0 # Weapons
  2150.         weapon_set = $data_classes[@actor.class_id].weapon_set
  2151.         (1...$data_weapons.size).each {|i|
  2152.           if $game_party.weapon_number(i) > 0 && weapon_set.include?(i)
  2153.             @data.push($data_weapons[i])
  2154.           end
  2155.         }
  2156.       end
  2157.       if @equip_type != 0 # Armors
  2158.         armor_set = $data_classes[@actor.class_id].armor_set
  2159.         (1...$data_armors.size).each {|i|
  2160.           if $game_party.armor_number(i) > 0 && armor_set.include?(i)
  2161.             if $data_armors[i].kind == @equip_type-1
  2162.               @data.push($data_armors[i])
  2163.             end
  2164.           end
  2165.         }
  2166.       end
  2167.     end
  2168.     @item_max = @data.size
  2169.     if @item_max > 0
  2170.       self.contents = Bitmap.new(width - 32, row_max * 32)
  2171.       (0...@item_max).each {|i| draw_item(i)}
  2172.     end
  2173.   end
  2174. #-------------------------------------------------------------------------------
  2175.   def draw_item(index)
  2176.     item = @data[index]
  2177.     number = case item
  2178.     when RPG::Item then $game_party.item_number(item.id)
  2179.     when RPG::Weapon then $game_party.weapon_number(item.id)
  2180.     when RPG::Armor then $game_party.armor_number(item.id)
  2181.     end
  2182.     if (item.is_a?(RPG::Item) && $game_party.item_can_use?(item.id)) ||
  2183.       @equip_flag
  2184.       self.contents.font.color = normal_color
  2185.     else
  2186.       self.contents.font.color = disabled_color
  2187.     end
  2188.     x = 4 + index % 2 * (192 + 32)
  2189.     y = index / 2 * 32
  2190.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  2191.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  2192.     bitmap = RPG::Cache.icon(item.icon_name)
  2193.     opacity = self.contents.font.color == normal_color ? 255 : 128
  2194.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  2195.     self.contents.draw_text(x + 28, y, 172, 32, item.name, 0)
  2196.     self.contents.draw_text(x + 144, y, 16, 32, ':', 1)
  2197.     self.contents.draw_text(x + 160, y, 24, 32, number.to_s, 2)
  2198.   end
  2199. #-------------------------------------------------------------------------------
  2200.   def update_help
  2201.     @help_window.set_text(self.item == nil ? '' : self.item.description)
  2202.   end
  2203. end
  2204.  
  2205. #==============================================================================
  2206. # ** Window_Zer0_Skill
  2207. #==============================================================================
  2208.  
  2209. class Window_Zer0_Skill < Window_Selectable
  2210.  
  2211.   attr_reader :actor
  2212.  
  2213.   def initialize(actor)
  2214.     super(192, 480, 448, 320)
  2215.     @actor, @column_max, self.index = actor, 2, 0
  2216.     refresh
  2217.   end
  2218. #-------------------------------------------------------------------------------
  2219.   def actor=(actor)
  2220.     @actor = actor
  2221.     refresh
  2222.   end
  2223. #-------------------------------------------------------------------------------
  2224.   def skill
  2225.     return @data[self.index]
  2226.   end
  2227. #-------------------------------------------------------------------------------
  2228.   def refresh
  2229.     if self.contents != nil
  2230.       self.contents.dispose
  2231.       self.contents = nil
  2232.     end
  2233.     @data = []
  2234.     @actor.skills.each {|i|
  2235.       skill = $data_skills[i]
  2236.       @data.push(skill) if skill != nil}
  2237.     @item_max = @data.size
  2238.     if @item_max > 0
  2239.       self.contents = Bitmap.new(width - 32, row_max * 32)
  2240.       (0...@item_max).each {|i| draw_item(i)}
  2241.     end
  2242.   end
  2243. #-------------------------------------------------------------------------------
  2244.   def draw_item(index)
  2245.     skill = @data[index]
  2246.     if @actor.skill_can_use?(skill.id)
  2247.       self.contents.font.color = normal_color
  2248.     else
  2249.       self.contents.font.color = disabled_color
  2250.     end
  2251.     x = 4 + index % 2 * (192 + 32)
  2252.     y = index / 2 * 32
  2253.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  2254.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  2255.     bitmap = RPG::Cache.icon(skill.icon_name)
  2256.     opacity = self.contents.font.color == normal_color ? 255 : 128
  2257.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  2258.     skill_name = skill.name
  2259.     if $tons_version >= 4.0 && TONS_OF_ADDONS::EQUAP_SKILLS && DISPLAY_AP_REQ
  2260.       aps = BlizzCFG.maxap(skill.id)
  2261.       if aps > 0
  2262.         skill_name += " (#{@actor.ap(skill.id)}/#{aps})"
  2263.       elsif DISPLAY_AP_ZERO
  2264.         skill_name += ' (0/0)'
  2265.       end
  2266.     end
  2267.     self.contents.draw_text(x + 28, y, 172, 32, skill_name, 0)
  2268.     self.contents.draw_text(x + 144, y, 36, 32, skill.sp_cost.to_s, 2)
  2269.   end
  2270. #-------------------------------------------------------------------------------
  2271.   def update_help
  2272.     @help_window.set_text(self.skill == nil ? '' : self.skill.description)
  2273.   end
  2274. end
  2275.  
  2276. #==============================================================================
  2277. # ** Window_Zer0_SkillStatus
  2278. #==============================================================================
  2279.  
  2280. class Window_Zer0_SkillStatus < Window_Base
  2281.  
  2282.   def initialize(actor)
  2283.     super(640, 114, 448, 126)
  2284.     self.contents = Bitmap.new(width - 32, height - 32)
  2285.     @actor = actor
  2286.     refresh
  2287.   end
  2288. #-------------------------------------------------------------------------------
  2289.   def refresh
  2290.     self.contents.clear
  2291.     draw_actor_name(@actor, 4, 0)
  2292.     draw_actor_state(@actor, 164, 0)
  2293.     draw_actor_hp(@actor, 4, 32)
  2294.     draw_actor_sp(@actor, 4,64)
  2295.     if @elements != nil
  2296.       if Zer0_CMS::Use_Element_Icons
  2297.         @elements.each_index {|i|
  2298.           break if 164+i*28 > self.contents.width
  2299.           icon = RPG::Cache.icon("Element/#{@elements[i].downcase}")
  2300.           self.contents.blt(164+i*28, 64, icon, Rect.new(0, 0, 24, 24))}
  2301.       else
  2302.         elem_string = ''
  2303.         @elements.each_index {|i|
  2304.           elem_string += @elements[i]
  2305.           elem_string += ', ' if i != (@elements.size - 1)}
  2306.         self.contents.draw_text(164, 64, 224, 15, elem_string)
  2307.       end
  2308.     end
  2309.     self.contents.font.color = system_color
  2310.     self.contents.draw_text(164, 32, 96, 32, 'Element')
  2311.   end
  2312. #-------------------------------------------------------------------------------
  2313.   def element=(skill_id)
  2314.     @elements = []
  2315.     if skill_id != nil && skill_id != 0
  2316.       $data_skills[skill_id].element_set.each {|i|
  2317.         unless $DUMMY_ELEMENTS.include?(i)
  2318.           @elements.push($data_system.elements[i])
  2319.         end
  2320.       }
  2321.     end
  2322.     refresh
  2323.   end
  2324. #-------------------------------------------------------------------------------
  2325.   def actor=(actor)
  2326.     @actor = actor
  2327.     refresh
  2328.   end
  2329. end
  2330.  
  2331. #==============================================================================
  2332. # ** Window_Zer0_EquipLeft
  2333. #==============================================================================
  2334.  
  2335. class Window_Zer0_EquipLeft < Window_Base
  2336.  
  2337.   def initialize(actor)
  2338.     super(640, 114, 192, 192)
  2339.     self.contents = Bitmap.new(width - 32, height - 32)
  2340.     @actor = actor
  2341.     refresh
  2342.   end
  2343. #-------------------------------------------------------------------------------
  2344.   def refresh(item1 = nil, item2 = nil)
  2345.     self.contents.clear
  2346.     words = [$data_system.words.atk, $data_system.words.pdef,
  2347.              $data_system.words.mdef, $data_system.words.str,
  2348.              $data_system.words.int, $data_system.words.dex,
  2349.              $data_system.words.agi, Zer0_CMS::Evasion_Word]
  2350.     stats = [@actor.base_atk, @actor.base_pdef, @actor.base_mdef, @actor.base_str,
  2351.              @actor.base_int, @actor.base_dex, @actor.base_agi, @actor.base_eva]
  2352.     stats.each_index {|i|
  2353.       self.contents.font.color = system_color
  2354.       self.contents.draw_text(4, i*15, 160, 15, words[i])
  2355.       self.contents.font.color = normal_color
  2356.       self.contents.draw_text(0, i*15, 110, 15, stats[i].to_s, 2)}
  2357.     values = []
  2358.     if item1 != nil && item2 != nil
  2359.       atk = 0
  2360.       if item1.is_a?(RPG::Weapon) && item2.is_a?(RPG::Weapon)
  2361.         atk = item2.atk - item1.atk
  2362.       end
  2363.       pdef = item2.pdef - item1.pdef
  2364.       mdef = item2.mdef - item1.mdef
  2365.       str_p = item2.str_plus - item1.str_plus
  2366.       int_p = item2.int_plus - item1.int_plus
  2367.       dex_p = item2.dex_plus - item1.dex_plus
  2368.       agi_p = item2.agi_plus - item1.agi_plus
  2369.       eva = item1.is_a?(RPG::Armor) ? item2.eva - item1.eva : 0
  2370.       last_hp = @actor.hp
  2371.       last_sp = @actor.sp
  2372.       values = [atk, pdef, mdef, str_p, int_p, dex_p, agi_p, eva]
  2373.     elsif item1 != nil && item2 == nil
  2374.       values = [item1.is_a?(RPG::Weapon) ? -item1.atk : 0, -item1.pdef, -item1.mdef,
  2375.                 -item1.str_plus, -item1.int_plus, -item1.dex_plus, -item1.agi_plus,
  2376.                 item1.is_a?(RPG::Armor) ? -item1.eva : 0]
  2377.     elsif item1 == nil && item2 != nil
  2378.       values = [item2.is_a?(RPG::Weapon) ? item2.atk : 0, item2.pdef, item2.mdef,
  2379.                 item2.str_plus, item2.int_plus, item2.dex_plus, item2.agi_plus,
  2380.                 item2.is_a?(RPG::Armor) ? item2.eva : 0]  
  2381.     end
  2382.     values.each_index {|i|
  2383.       if values[i] > 0
  2384.         self.contents.font.color = Zer0_CMS::Plus_Color
  2385.         self.contents.draw_text(0, i*15, 160, 15, "+#{values[i]}", 2)
  2386.       elsif values[i] < 0
  2387.         self.contents.font.color = Zer0_CMS::Minus_Color
  2388.         self.contents.draw_text(0, i*15, 160, 15, "#{values[i]}", 2)
  2389.       end
  2390.     }
  2391.   end
  2392. #-------------------------------------------------------------------------------
  2393.   def actor=(actor)
  2394.     @actor = actor
  2395.     refresh
  2396.   end
  2397. end
  2398.  
  2399. #===============================================================================
  2400. # ** Window_Zer0_EquipRight
  2401. #===============================================================================
  2402. # KK20
  2403. class Window_Zer0_EquipRight < Window_EquipRight
  2404.  
  2405.   def initialize(actor)
  2406.     super(actor)
  2407.     self.x,self.y,self.width,self.height = 832, 114, 256, 192
  2408.     self.contents = Bitmap.new(width - 32, 600)
  2409.     @actor, self.index = actor, 0
  2410.     refresh
  2411.   end
  2412. #-------------------------------------------------------------------------------
  2413.   def item
  2414.     return @data[self.index]
  2415.   end
  2416. #-------------------------------------------------------------------------------
  2417.   def actor=(actor)
  2418.     @actor = actor
  2419.     refresh
  2420.   end  
  2421. #-------------------------------------------------------------------------------
  2422.   def update
  2423.     if Input.repeat?(Input::UP) && !Input.trigger?(Input::UP) && self.index == 0
  2424.       self.index = (self.index - 1) % @data.size
  2425.       $game_system.se_play($data_system.cursor_se)
  2426.     elsif Input.repeat?(Input::DOWN) && !Input.trigger?(Input::DOWN) &&
  2427.       self.index == @data.size-1
  2428.       $game_system.se_play($data_system.cursor_se)
  2429.       self.index = 0
  2430.     else
  2431.       super
  2432.     end
  2433.   end
  2434. #-------------------------------------------------------------------------------
  2435.   def update_help
  2436.     @help_window.set_text(self.item == nil ? '' : self.item.description)
  2437.   end
  2438. end
  2439.  
  2440. #===============================================================================
  2441. # ** Window_Zer0_Status
  2442. #===============================================================================
  2443.  
  2444. class Window_Zer0_Status < Window_Base
  2445.  
  2446.   def initialize(actor = $game_party.actors[0])
  2447.     super(640, 57, 448, 423)
  2448.     @actor = actor
  2449.     self.contents = Bitmap.new(width - 32, height - 32)
  2450.     refresh
  2451.   end
  2452. #-------------------------------------------------------------------------------
  2453.   def refresh
  2454.     self.contents.clear
  2455.     self.contents.font.color = normal_color
  2456.     draw_actor_graphic(@actor, 32, 80)
  2457.     draw_actor_name(@actor, 4, 0)
  2458.     draw_actor_class(@actor, 96, 0)
  2459.     draw_actor_level(@actor, 96, 32)
  2460.     flag = $game_system.BARS
  2461.     $game_system.BARS = false
  2462.     draw_actor_hp(@actor, 4, 85, 176)
  2463.     draw_actor_sp(@actor, 4, 100, 176)
  2464.     $game_system.BARS = flag
  2465.     (0..6).each {|i| draw_actor_parameter(@actor, 4, 115 + 15 * i, i)}
  2466.     exp_value = [@actor.exp_s, @actor.next_exp_s, @actor.next_rest_exp_s]
  2467.     exp_value.each_index {|i|
  2468.       self.contents.draw_text(272, i*15, 84, 15, exp_value[i], 2)}
  2469.     self.contents.font.color = system_color
  2470.     eqmt = [$data_system.words.weapon, $data_system.words.armor1,
  2471.     $data_system.words.armor2, $data_system.words.armor3, $data_system.words.armor4]
  2472.     eqmt.each_index {|i| self.contents.draw_text(192, 64+i*32, 96, 32, eqmt[i])}
  2473.     self.contents.draw_text(4, 235, 416, 32, 'Status:')
  2474.     exp_words = ['Experience', 'Next Level', 'Needed']
  2475.     exp_words.each_index {|i|
  2476.       self.contents.draw_text(192, i*15, 80, 15, exp_words[i])}
  2477.     self.contents.font.color = normal_color
  2478.     draw_actor_state(@actor, 64, 235, 300)
  2479.     draw_item_name($data_weapons[@actor.weapon_id], 272, 64)
  2480.     draw_item_name($data_armors[@actor.armor1_id], 272, 96)
  2481.     draw_item_name($data_armors[@actor.armor2_id], 272, 128)
  2482.     draw_item_name($data_armors[@actor.armor3_id], 272, 160)
  2483.     draw_item_name($data_armors[@actor.armor4_id], 272, 192)
  2484.     elem_atk = @actor.attack_elements(Zer0_CMS::Use_Element_Icons)
  2485.     elem_grd = @actor.guard_elements(Zer0_CMS::Use_Element_Icons)
  2486.     stat_atk = @actor.attack_states(Zer0_CMS::Use_State_Icons)
  2487.     stat_grd = @actor.guard_states(Zer0_CMS::Use_State_Icons)
  2488.     if Zer0_CMS::Use_Element_Icons
  2489.       elem_atk.each_index {|i|
  2490.         break if i > 6
  2491.         self.contents.blt(4+i*28, 306, elem_atk[i], Rect.new(0, 0, 24, 24))}
  2492.       elem_grd.each_index {|i|
  2493.         break if i > 6
  2494.         self.contents.blt(4+i*28, 360, elem_grd[i], Rect.new(0, 0, 24, 24))}
  2495.     else
  2496.       elem1 = elem2 = ''
  2497.       elem_atk.each_index {|i|
  2498.         elem1 += elem_atk[i]
  2499.         elem1 += ', ' if i != (elem_atk.size-1)}
  2500.       elem_grd.each_index {|i|
  2501.         elem2 += elem_grd[i]
  2502.         elem2 += ', ' if i != (elem_grd.size-1)}
  2503.       self.contents.draw_text(4, 302, 192, 24, elem1)
  2504.       self.contents.draw_text(4, 356, 192, 24, elem2)
  2505.     end
  2506.     if Zer0_CMS::Use_State_Icons
  2507.       stat_atk.each_index {|i|
  2508.         break if i > 6
  2509.         self.contents.blt(244+i*28, 306, stat_atk[i], Rect.new(0, 0, 24, 24))}
  2510.       stat_grd.each_index {|i|
  2511.         break if i > 6
  2512.         self.contents.blt(244+i*28, 360, stat_grd[i], Rect.new(0, 0, 24, 24))}
  2513.     else
  2514.       stat1 = stat2 = ''
  2515.       stat_atk.each_index {|i|
  2516.         stat1 += stat_atk[i]
  2517.         stat1 += ', ' if i != (stat_atk.size-1)}
  2518.       stat_grd.each_index {|i|
  2519.         stat2 += stat_grd[i]
  2520.         stat2 += ', ' if i != (stat_grd.size-1)}
  2521.       self.contents.draw_text(244, 302, 192, 24, stat1)
  2522.       self.contents.draw_text(244, 356, 192, 24, stat2)
  2523.     end
  2524.     self.contents.font.color = Color.new(128, 255, 128)
  2525.     self.contents.draw_text(0, 286, 192, 15, 'Elemental Attack:')
  2526.     self.contents.draw_text(0, 338, 192, 15, 'Elemental Guard:')
  2527.     self.contents.draw_text(240, 286, 192, 15, 'Status Attack:')
  2528.     self.contents.draw_text(240, 338, 192, 15, 'Status Guard:')
  2529.   end
  2530. #-------------------------------------------------------------------------------
  2531.   def actor=(actor)
  2532.     @actor = actor
  2533.     refresh
  2534.   end
  2535. end
  2536.  
  2537. #===============================================================================
  2538. # ** Window_Options
  2539. #===============================================================================
  2540.  
  2541. class Window_Zer0_Options < Window_Selectable_Mod
  2542.  
  2543.   def initialize
  2544.     @options = ['Windowskin', 'Window Opacity', 'Font Type',
  2545.                 'Font Size', 'Shaded Text', 'BGM Volume', 'SE Volume',
  2546.                 'Window SE', 'Window Speed', 'Bars', 'Bar Style', 'Bar Opacity']
  2547.     height = @options.size >= 12 ? 366 : 57 + @options.size * 25
  2548.     super(192, 480, 448, height)
  2549.     self.contents = Bitmap.new(width - 32, height - 32)
  2550.     refresh
  2551.     @item_max = @row_max = @options.size
  2552.     @column_max = self.index = 1
  2553.   end
  2554. #-------------------------------------------------------------------------------
  2555.   def refresh
  2556.     self.contents.clear
  2557.     values = [$game_system.windowskin_name, $game_system.window_opacity,
  2558.               $game_system.fontname, $game_system.fontsize,
  2559.               $game_system.SHADED_TEXT ? 'Yes' : 'No',
  2560.               "#{$game_system.bgm_volume}%", "#{$game_system.se_volume}%",
  2561.               $game_system.window_SE == 0 ? 'None' : "Type #{$game_system.window_SE}",
  2562.               $game_system.window_speed,
  2563.               $game_system.BARS ? 'Yes' : 'No',
  2564.               $game_system.bar_style + 1, $game_system.bar_opacity]
  2565.     @options.each_index {|i|
  2566.       self.contents.font.color = system_color
  2567.       self.contents.draw_text(4, i*25, 416, 25, @options[i])
  2568.       self.contents.font.color = normal_color
  2569.       self.contents.draw_text(-4, i*25, 416, 25, values[i].to_s, 2)}
  2570.     x, y, w, rate = 144, self.contents.height - 41, 160, 1
  2571.     color1 = Color.new(20, 80, 20, 192)
  2572.     color2 = Color.new(60, 240, 60, 192)
  2573.     color3 = Color.new(0, 80, 0, 192)
  2574.     self.contents.gradient_bar(x, y, w, color1, color2, color3, rate)
  2575.   end
  2576. end
  2577.  
  2578. #==============================================================================
  2579. # ** Window_Zer0_File
  2580. #==============================================================================
  2581.  
  2582. class Window_Zer0_File < Window_Base
  2583.  
  2584.   attr_reader   :filename, :selected                            
  2585.  
  2586.   def initialize(file_index, filename)
  2587.     super(192, 640 + (file_index * 122), 448, 122)
  2588.     self.contents = Bitmap.new(width - 32, height - 32)
  2589.     @file_index, @filename, @time_stamp = file_index, filename, Time.at(0)
  2590.     @file_exist, @selected = FileTest.exist?(@filename), false
  2591.     refresh
  2592.   end
  2593. #-------------------------------------------------------------------------------
  2594.   def refresh
  2595.     self.contents.clear
  2596.     @file_exist = FileTest.exist?(@filename)
  2597.     if @file_exist
  2598.       file = File.open(@filename, 'r')
  2599.       @time_stamp = file.mtime
  2600.       @characters = Marshal.load(file)
  2601.       @frame_count = Marshal.load(file)
  2602.       @game_system = Marshal.load(file)
  2603.       @game_switches = Marshal.load(file)
  2604.       @game_variables = Marshal.load(file)
  2605.       @game_map = Marshal.load(file)
  2606.       @total_sec = @frame_count / Graphics.frame_rate
  2607.       file.close
  2608.     end
  2609.     self.contents.font.color = normal_color
  2610.     self.contents.draw_text(4, 0, 448, 32, "File #{@file_index + 1}")
  2611.     if @file_exist
  2612.       @characters.each_index {|i|
  2613.         bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
  2614.         cw = bitmap.rect.width / 4
  2615.         ch = bitmap.rect.height / 4
  2616.         src_rect = Rect.new(0, 0, cw, ch)
  2617.         x = 160 - @characters.size * 32 + i * 50 - cw / 2
  2618.         self.contents.blt(x, 80 - ch, bitmap, src_rect)}
  2619.       hr, min, sec = @total_sec / 60 / 60, @total_sec / 60 % 60, @total_sec % 60
  2620.       time_string1 = sprintf('%02d:%02d:%02d', hr, min, sec)
  2621.       time_string2 = @time_stamp.strftime('%H:%M %m/%d/%Y')
  2622.       save_count = @game_system.save_count.to_s
  2623.       words = ['Play Time:', 'Last Save:', 'Save Count:']
  2624.       values = [time_string1, time_string2, save_count]
  2625.       if Zer0_CMS::Game_Completion
  2626.         id = Zer0_CMS::Completion_Variable
  2627.         @game_variables[id]= [[@game_variables[id], 100].min, 0].max
  2628.         words.push('Completion:')
  2629.         values.push("#{@game_variables[id]}%")
  2630.       end
  2631.       if Zer0_CMS::Use_Map_Name
  2632.         words.push('Location:')
  2633.         values.push(@game_map.name)
  2634.       end
  2635.       words.each_index {|i|
  2636.         y = ((self.contents.height - (words.size * 15)) / 2) + i*15
  2637.         self.contents.font.color = normal_color
  2638.         self.contents.draw_text(212, y, 200, 25, values[i], 2)
  2639.         self.contents.font.color = system_color
  2640.         self.contents.draw_text(216, y, 200, 25, words[i])
  2641.       }
  2642.     end
  2643.   end
  2644. #-------------------------------------------------------------------------------
  2645.   def selected=(selected)
  2646.     @selected = selected
  2647.     update_cursor_rect
  2648.   end
  2649. #-------------------------------------------------------------------------------
  2650.   def update_cursor_rect
  2651.     if @selected
  2652.       self.cursor_rect.set(0, 0, self.contents.width, self.contents.height)
  2653.     else
  2654.       self.cursor_rect.empty
  2655.     end
  2656.   end
  2657. end
  2658.  
  2659. #===============================================================================
  2660. # ** Window_QuestInfo
  2661. #===============================================================================
  2662.  
  2663. class Window_QuestInfo < Window_Base
  2664.  
  2665.   def initialize(quest)
  2666.     super(640, 57, 448, 423)
  2667.     self.contents = Bitmap.new(width - 32, height - 32)
  2668.     @quest = quest
  2669.     refresh
  2670.   end
  2671. #-------------------------------------------------------------------------------
  2672.   def refresh
  2673.     return if @quest == nil
  2674.     self.contents.clear
  2675.     bitmap = Quest.picture(@quest)
  2676.     if bitmap != nil
  2677.       rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  2678.       self.contents.blt(448 - bitmap.width - 32, 0, bitmap, rect)
  2679.     end
  2680.     self.contents.font.color = system_color
  2681.     words = ['Quest:', 'Reward:', 'Location:', 'Status:', 'Description:']
  2682.     words.each_index {|i| self.contents.draw_text(0, i*45, 416, 32, words[i])}
  2683.     self.contents.font.color = normal_color
  2684.     self.contents.draw_text(0, 15, 416, 32, Quest.name(@quest))
  2685.     self.contents.draw_text(0, 60, 416, 32, Quest.reward(@quest))
  2686.     self.contents.draw_text(0, 105, 416, 32, Quest.location(@quest))
  2687.     text = self.contents.slice_text(Quest.description(@quest), 416)
  2688.     text.each_index {|i| self.contents.draw_text(0, 205 + i*15, 416, 32, text[i])}
  2689.     status = Quest.status(@quest)
  2690.     self.contents.font.color = case status
  2691.     when 'Complete' then Color.new(128, 255, 128)
  2692.     when 'Failed' then Color.new(255, 64, 64)
  2693.     when 'In Progress' then Color.new(255, 255, 64)
  2694.     end
  2695.     self.contents.draw_text(0, 150, 416, 32, status)
  2696.   end
  2697. #-------------------------------------------------------------------------------  
  2698.   def quest=(quest)
  2699.     @quest = quest
  2700.     refresh
  2701.   end
  2702. end
  2703.  
  2704. #===============================================================================
  2705. # ** Scene_Title
  2706. #===============================================================================
  2707.  
  2708. class Scene_Title
  2709.    
  2710.   AFR = Win32API.new('gdi32', 'AddFontResource', ['P'], 'L')
  2711.   WPS = Win32API.new('kernel32', 'WriteProfileString', ['P'] * 3, 'L')
  2712.   SM = Win32API.new('user32', 'SendMessage', ['L'] * 4, 'L')
  2713.   WM_FONTCHANGE = 0x001D
  2714.   HWND_BROADCAST = 0xffff
  2715.  
  2716.   alias wachunga_autofontinstall_st_main main
  2717.   def main
  2718.     if Zer0_CMS::Auto_Install_Fonts
  2719.       success = []
  2720.       Fonts::Filenames.each_index {|i|
  2721.         f = Fonts::Filenames[i]
  2722.         if !FileTest.exists?(Fonts::Dest + f)
  2723.           if FileTest.exists?(Fonts::Source + f)
  2724.             require Dir.getwd + '/Data/fileutils.rb'
  2725.             FileUtils.cp(Fonts::Source + f, Fonts::Dest + f)
  2726.             AFR.call(Fonts::Dest + f)
  2727.             WPS.call('Fonts', Fonts::Names[i] + ' (TrueType)', f)
  2728.             SM.call(HWND_BROADCAST,WM_FONTCHANGE,0,0)
  2729.             if FileTest.exists?(Fonts::Dest + f)
  2730.               success.push(Fonts::Names[i])
  2731.             else
  2732.               print "Auto Font Install:\n\nFailed to install " +
  2733.                 Fonts::Names[i] + '.'
  2734.             end
  2735.           else
  2736.             print "Auto Font Install:\n\nFont " + f + " not found."
  2737.           end
  2738.         end
  2739.       }
  2740.       if success != []
  2741.         if Fonts::Notify
  2742.           fonts = ''
  2743.           success.each {|f| fonts << f << ', '}
  2744.           print "Auto Font Install:\n\nSucessfully installed " + fonts[0..-3] +
  2745.             '.'
  2746.         end
  2747.         a = Thread.new { system('Game') }
  2748.         exit
  2749.       end
  2750.     end
  2751.     wachunga_autofontinstall_st_main
  2752.   end
  2753. end
  2754. #===============================================================================
  2755. # ** Scene_Menu  -  edit by KK20
  2756. #   + Added a method that was used in Guillaume777's Multi-Slot script
  2757. #===============================================================================
  2758. class Scene_Menu
  2759.   #--------------------------------------------------------------------------
  2760.   # * Convert index to equip part
  2761.   #     index : slot number
  2762.   #--------------------------------------------------------------------------
  2763.   def index_to_equip_part(index)
  2764.     # Return index of slot in the
  2765.     # array [0, @actor.armor_slots, actor.weapon_slots]
  2766.     # If Armor
  2767.     if index >= @actor.weapon_slots.size
  2768.       return index - (@actor.weapon_slots.size - 1)
  2769.     # If extra weapon
  2770.     elsif index >= 1
  2771.       # Make it last
  2772.       return index + [@actor.armor_slots.size, 4].max
  2773.     else
  2774.       return 0
  2775.     end
  2776.  end
  2777. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement