Advertisement
ForeverZer0

[RMXP] Zer0 CMS 1.3

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