Advertisement
KK20

Stormtronic + Equip Upgrade Compat.

Aug 21st, 2015
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 99.29 KB | None | 0 0
  1. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2. # Stormtronics CMS by Blizzard
  3. # Version: 5.51b - Hybrid Edition
  4. # Type: Enhanced Custom Menu System
  5. # Date v5.0: 27.8.2007
  6. # Date v5.0b: 12.9.2007
  7. # Date v5.1b: 28.1.2008
  8. # Date v5.2b: 29.1.2008
  9. # Date v5.3b: 23.7.2008
  10. # Date v5.31b: 20.8.2008
  11. # Date v5.32b: 21.8.2008
  12. # Date v5.33b: 15.11.2008
  13. # Date v5.34b: 8.4.2009
  14. # Date v5.35b: 9.4.2009
  15. # Date v5.36b: 6.5.2009
  16. # Date v5.37b: 20.5.2009
  17. # Date v5.38b: 31.5.2009
  18. # Date v5.39b: 24.6.2009
  19. # Date v5.5b: 24.5.2012
  20. # Date v5.51b: 30.7.2012
  21. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  22. #  
  23. #  This work is protected by the following license:
  24. # #----------------------------------------------------------------------------
  25. # #  
  26. # #  Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
  27. # #  ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
  28. # #  
  29. # #  You are free:
  30. # #  
  31. # #  to Share - to copy, distribute and transmit the work
  32. # #  to Remix - to adapt the work
  33. # #  
  34. # #  Under the following conditions:
  35. # #  
  36. # #  Attribution. You must attribute the work in the manner specified by the
  37. # #  author or licensor (but not in any way that suggests that they endorse you
  38. # #  or your use of the work).
  39. # #  
  40. # #  Noncommercial. You may not use this work for commercial purposes.
  41. # #  
  42. # #  Share alike. If you alter, transform, or build upon this work, you may
  43. # #  distribute the resulting work only under the same or similar license to
  44. # #  this one.
  45. # #  
  46. # #  - For any reuse or distribution, you must make clear to others the license
  47. # #    terms of this work. The best way to do this is with a link to this web
  48. # #    page.
  49. # #  
  50. # #  - Any of the above conditions can be waived if you get permission from the
  51. # #    copyright holder.
  52. # #  
  53. # #  - Nothing in this license impairs or restricts the author's moral rights.
  54. # #  
  55. # #----------------------------------------------------------------------------
  56. #
  57. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  58. #
  59. # Compatibility:
  60. #
  61. #   97% compatible with SDK v1.x. 80% compatible with SDK v2.x. Glitchs with
  62. #   Fukuyama's Caterpillar script (but not with mine). Designed only for 8
  63. #   elements. WILL corrupt old savegames.
  64. #
  65. #
  66. # Features:
  67. #
  68. #   - completely animated and graphically optimized (lag-free)
  69. #   - own set of windowskins, fonts and icons for every status change and
  70. #     element
  71. #   - saves all changed options together with the savefile
  72. #   - menu commands "Item", "Equipment", "Skill", "Equip", "Status", "Options",
  73. #     "Save", "Load", "Exit"
  74. #   - Item submenu: "Items", "Sort" (by quantity or by alphabet), "Quest Items"
  75. #   - Equipment submenu shows information about equippable items for the chosen
  76. #     character, switch the character with LEFT and RIGHT
  77. #   - Skill submenu shows available skills for use for the chosen character,
  78. #     switch character with L and R, menu status window in background shows the
  79. #     chosen character
  80. #   - Equip submenu shows complete information about Status resistance/attack,
  81. #     Element resistance/attack and complete character stat changing (has
  82. #     even "max HP" and "max SP" available if you are using "Weapon/Armor HP/SP
  83. #     Plus")
  84. #   - Status screen with overall information about character status
  85. #   - Options submenu with "BGM Volume", "SFX Volume", "Battle BGM",
  86. #     "Battle Cam" (if using KGC's Pseudo 3D Battle Camera with my add-on for
  87. #     disabling), "Bar Style", "Bar Opacity" (if you are using Gradient Bar
  88. #     Styler), "Font" and "Windowskin" (both with preview)
  89. #   - Standard Save, Load and Exit commands
  90. #   - uses "Ultimate Font Override", so the font changes will affect RPG Maker
  91. #     XP versions 1.00, 1.01, 1.02 and 1.03 (including Dyna Edition and
  92. #     Postality Knights Edition Enhanced) and the font even gets saved with the
  93. #     savedata
  94. #
  95. # new in Hybrid Edition:
  96. #   - supports either windowskin background or custom images:
  97. #                >>>  All Stormtronics CMS Editions in one!  <<<
  98. #   - compatible with all my scripts (even DREAM v4.0)
  99. #   - draws SR in the menu if CLRS was detected
  100. #   - supports any number of party members
  101. #   - removed some special add-ons, please get Tons of Add-ons if you want to
  102. #     continue using them, ST CMS will recognize Tons v4.98b and higher
  103. #   - more than 1500 code lines less than Nemesis Edition and almost 2000
  104. #     code lines less than Metal-Plate Edition
  105. #   - removes options from Options menu that are not / cannot being used at all
  106. #   - possibility to use a different equip system
  107. #   - doesn't need skin icons anymore, the icon is drawn from the skin directly
  108. #   - improved windowskins from "Lexima Legends™ IV - Chaos Project"
  109. #
  110. #
  111. # Instructions:
  112. #
  113. #   Copy your character faces into a the folder called "Characters". The
  114. #   facesets MUST have the same names as the character spritesets with a _face
  115. #   added at the end. Also copy the windowskins and the icons. Don't forget to
  116. #   include the font files used by the game in your game folder. Also change
  117. #   the variable ID in the conditional branches if you use another variable
  118. #   than 49.
  119. #
  120. #
  121. # Configuration:
  122. #
  123. #   CAM_AVAILABLE          - set to true if you use KGC 3DPBC
  124. #   FACESETS               - set to true if you want to use facesets
  125. #   BGM_Variable           - ID number of the variable for the Battle BGM
  126. #                            changer
  127. #   BGM_Lock               - ID number of the switch used to temporarily
  128. #                            disable the option of changing the Battle BGM, for
  129. #                            that, just turn the switch on and off to disable
  130. #                            and enable this option
  131. #   WEAPONS_AND_ARMORS     - set to false to not show weapons and armors in the
  132. #                            Item screen
  133. #   QUEST_ITEMS            - add any item IDs that are supposed to be quest
  134. #                            items, so the CMS can separate them
  135. #   BATTLE_BGMS            - add any battle BGMs you are using
  136. #   CMS_SKINS              - add any skin name you are using
  137. #   CMS_FONTS              - add any font name you are using, be sure to
  138. #                            include the font install files in your game
  139. #                            release as some people may not have those fonts
  140. #                            installed
  141. #   SAVE_NAME              - name of your savefiles (usually "Save")
  142. #   SAVE_EXTENSION         - extension of your savefiles (usually "rxdata")
  143. #   SAVE_FILES_NUMBER      - number of savefiles you are using (usually 4)
  144. #   MAP_BACKGROUND         - set to true to show map as background, otherwise
  145. #                            if BlizzCFG::CMS_EDITION is not nil or false the
  146. #                            "CMSFullscreen" image will be displayed
  147. #   CUSTOM_ITEM_SCENE      - set this to true if you want to use a different
  148. #                            equip scene and make this CMS compatible even with
  149. #                            exotic Item Systems
  150. #   CUSTOM_EQUIPMENT_SCENE - set this to true if you want to use a different
  151. #                            equip scene and make this CMS compatible even with
  152. #                            exotic Equipment Systems, change only if you have
  153. #                            another Equipment Scene script ready
  154. #   CUSTOM_EQUIP_SCENE     - set this to true if you want to use a different
  155. #                            equip scene and make this CMS compatible even with
  156. #                            exotic Equipment Systems
  157. #   CUSTOM_SKILL_SCENE     - set this to true if you want to use a different
  158. #                            skill scene and make this CMS compatible even with
  159. #                            exotic Skill Systems
  160. #   CUSTOM_STATUS_SCENE    - set this to true if you want to use a different
  161. #                            status scene
  162. #   CUSTOM_OPTIONS_SCENE   - set this to true if you want to use a different
  163. #                            options scene, change only if you have another
  164. #                            Options Scene script ready
  165. #   CUSTOM_END_SCENE       - set this to true if you want to use a different
  166. #                            end scene
  167. #   FONT_BACKGROUND_FIX    - set this to true if you want dark font colors to
  168. #                            be used in the menu, this comes in handy when the
  169. #                            custom background images you use are bright
  170. #   WIN_MIRRORED           - flips horizontally all window positions
  171. #   CMS_EDITION            - set this to false or nil if you want to use
  172. #                            Nemesis Edition, set to folder name where in the
  173. #                            Pictures/CMS the images should be loaded from if
  174. #                            you want to use custom images as background
  175. #   STCMS_DUMMY_ELEMENTS   - include EVERY dummy element ID that is used by
  176. #                            other scripts
  177. #   STCMS_DUMMY_STATES     - include EVERY dummy status effect ID that you use
  178. #
  179. #   The syntax $game_system.get_cam can be used by an event (Call script
  180. #   command) to restore the user's setting of the KGC 3DPBC if a forced cam
  181. #   control was initiated during an event.
  182. #
  183. #   You can use $game_system.reset_battle_bgm to reset the battle BGM to the
  184. #   player's menu setting if you have changed it for i.e. a boss fight via
  185. #   event.
  186. #
  187. #
  188. # FAQ:
  189. #
  190. # - Problem:
  191. #   I get an error that some icons can't be found. how do I solve this?
  192. #
  193. # - Solution:
  194. #   Copy the icons from the demo or download them and place the into the Icons
  195. #   folder into another folder called "CMS". Done.
  196. #
  197. # - Problem:
  198. #   I still get an error.
  199. #
  200. # - Solution:
  201. #   Rename the icons. If your elements were renamed and don't have the standard
  202. #   names, your icons need to be renamed as well. Same goes for status effects.
  203. #   Also be sure to add new icons with new names if you have more than the
  204. #   basic 8 elements and/or more than the basic 16 status effects in your
  205. #   database.
  206. #
  207. # - Question:
  208. #   Can I use my own skins, icons, fonts, battle BGMs, etc...?
  209. #
  210. # - Answer:
  211. #   Of course. Only be sure to change the appropriate options in the script and
  212. #   to use the appropriate names, so everything can function normally after
  213. #   that.
  214. #
  215. # - Question:
  216. #   Can this CMS be connected with other scripts? If yes, how and how much work
  217. #   is it?
  218. #
  219. # - Answer:
  220. #   Yes, it can. A little bit of scripting and enhancing the functions of the
  221. #   CMS are needed if it is going to be connected with other scripts. How much
  222. #   of additional work it can cause only depends how big the script merge is. A
  223. #   simple changing of the battle menu to display status effects in icons
  224. #   should take between 15~30 minutes of scripting and testing. Adding another
  225. #   option into the Options menu should also take only 15~30 minutes of
  226. #   scripting and testing. Even adding an entire series of new windows or
  227. #   implementing another Scene into the menu also won't take more than 30
  228. #   minutes, because the menu itself works with the "sub-scene" system, saving
  229. #   this way RAM and CPU.
  230. #
  231. # - Question:
  232. #   What is the "sub-scene" system? Also I have tried other animated CMS-es.
  233. #   Why is this one so lag-free?
  234. #
  235. # - Answer:
  236. #   It is lag-free just because of the "sub-scene" system. This system is also
  237. #   used in the "Scene_Battle". It only creates windows and handels them when
  238. #   they are needed or used, otherwise they get disposed or not created at all.
  239. #   In this script this method is being used to a possible maximum.
  240. #
  241. # - Question:
  242. #   Is this for real? This CMS doesn't even have 3000 lines of code!
  243. #
  244. # - Answer:
  245. #   Actually not even 2500 if you don't count the instructions.
  246. #
  247. # - Question:
  248. #   How is such a large collection of features possible with so relatively few
  249. #   lines of code?!
  250. #
  251. # - Answer:
  252. #   Smart coding. =P
  253. #
  254. #
  255. # Additional scripts/snipplets/add-ons:
  256. #
  257. #   - Ultimate Font Override v1.0b (by Blizzard)
  258. #   - BGM/SFX Volume Control with volume correction v1.0b (by Blizzard)
  259. #   - Map Name/Location v1.0b (by Blizzard)
  260. #   - Elemental Vulnerability Graph v1.0b (by Blizzard)
  261. #   - Battle BGM control v2.0b (by Blizzard)
  262. #   - Options control layout and funcionality v4.0b (by Blizzard)
  263. #   - CMS layout/funcionality v5.0b (by Blizzard)
  264. #   - optimized code and delagged by "sub-scene" window handling (by Blizzard)
  265. #
  266. #   If you experience the "Stack level too deep" error, you may already have
  267. #   one of the scripts listed above and it conflicts with itself, because of
  268. #   aliased recursive calling. Try removing script by script and testing
  269. #   everything. Don't forget to backup you Scripts.rxdata before doing so.
  270. #   Scripts.rxdata is a file that contains your current scripts and is located
  271. #   in the Data folder of your game folder.
  272. #
  273. #
  274. # If you find any bugs, please report them here:
  275. # http://forum.chaos-project.com
  276. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  277.  
  278. #==============================================================================
  279. # module BlizzCFG
  280. #==============================================================================
  281.  
  282. module BlizzCFG
  283.  
  284. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  285. # START Configuration
  286. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  287.   # basic config
  288.   CAM_AVAILABLE = false
  289.   FACESETS = false
  290.   BGM_Variable = 49
  291.   BGM_Lock = 49
  292.   WEAPONS_AND_ARMORS = true
  293.   QUEST_ITEMS = [23, 24, 25, 26, 27, 28, 29, 30, 31, 32]
  294.   # custom game configs
  295.   BATTLE_BGMS = [
  296.   #             ['BGM_NAME', VOLUME, PITCH, 'DISPLAY_NAME']
  297.                 ['001-Battle01', 100, 100, 'BGM 1'],
  298.                 ['002-Battle02', 100, 100, 'BGM 2'],
  299.                 ['003-Battle03', 100, 100, 'BGM 3'],
  300.                 ['004-Battle04', 100, 100, 'BGM 4']]
  301.   CMS_SKINS = ['Original', 'Heavy Gold', 'Hell Breath', 'Liquid Water',
  302.                'Violent Violet', 'Ice Cool', 'Fatal Venom', 'Perfect Chaos',
  303.                'Blizzard Master']
  304.   CMS_FONTS = ['Arial', 'Future', 'Comic Sans MS', 'Brush Script', 'Tahoma',
  305.                'Times New Roman']
  306.   # save file options
  307.   SAVE_NAME = 'Save'
  308.   SAVE_EXTENSION = 'rxdata'
  309.   SAVE_FILES_NUMBER = 4
  310.   # extra options
  311.   MAP_BACKGROUND = true
  312.   CUSTOM_ITEM_SCENE = false
  313.   CUSTOM_EQUIPMENT_SCENE = false
  314.   CUSTOM_EQUIP_SCENE = false
  315.   CUSTOM_SKILL_SCENE = false
  316.   CUSTOM_STATUS_SCENE = false
  317.   CUSTOM_OPTIONS_SCENE = false
  318.   CUSTOM_END_SCENE = false
  319.   FONT_BACKGROUND_FIX = false
  320.   WIN_MIRRORED = false
  321.   CMS_EDITION = false # 'Metal-Plate'
  322.   STCMS_DUMMY_ELEMENTS = [9, 10, 11, 12, 13, 14, 15, 16]
  323.   STCMS_DUMMY_STATES = []
  324. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  325. # END Configuration
  326. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  327.   # change only if changed in the 3DPBC script
  328.   CAM_Variable = 25 if CAM_AVAILABLE
  329.  
  330.   # you can't touch this
  331.   if $DUMMY_ELEMENTS == nil
  332.     $DUMMY_ELEMENTS = STCMS_DUMMY_ELEMENTS.clone
  333.   else
  334.     $DUMMY_ELEMENTS |= STCMS_DUMMY_ELEMENTS
  335.   end
  336.   STCMS_DUMMY_ELEMENTS = nil
  337.   if $DUMMY_STATES == nil
  338.     $DUMMY_STATES = STCMS_DUMMY_STATES.clone
  339.   else
  340.     $DUMMY_STATES |= STCMS_DUMMY_STATES
  341.   end
  342.   STCMS_DUMMY_STATES = nil
  343.  
  344. end
  345.  
  346. # for compatibility
  347. $stormtronics_cms = 5.51
  348.  
  349. #==============================================================================
  350. # Game_System
  351. #==============================================================================
  352.  
  353. class Game_System
  354.  
  355.   attr_accessor :bgm_volume
  356.   attr_accessor :sfx_volume
  357.   attr_accessor :cam
  358.   attr_reader   :fontname
  359.   attr_reader   :fontsize
  360.  
  361.   alias init_storm_cms_later initialize
  362.   def initialize
  363.     init_storm_cms_later
  364.     @bgm_volume = @sfx_volume = 100
  365.     @cam = 0
  366.     if $tons_version != nil
  367.       if $tons_version >= 6.03 && !@BARS
  368.         @bar_style, @bar_opacity = 0, 255
  369.       end
  370.       if $tons_version < 1.6
  371.         self.fontname = 'Arial'
  372.         self.fontsize = 24
  373.       end
  374.     else
  375.       self.fontname = 'Arial'
  376.       self.fontsize = 24
  377.     end
  378.   end
  379.  
  380.   def fontname=(name)
  381.     Font.default_name = $defaultfonttype = $fontface = @fontname = name
  382.   end
  383.    
  384.   def fontsize=(size)
  385.     Font.default_size = $defaultfontsize = $fontsize = @fontsize = size
  386.   end
  387.  
  388.   def get_cam
  389.     $game_variables[BlizzCFG::CAM_Variable] = @cam
  390.     return true
  391.   end
  392.    
  393.   def reset_battle_bgm
  394.     bgm = BlizzCFG::BATTLE_BGMS[$game_variables[BlizzCFG::BGM_Variable]]
  395.     $game_system.battle_bgm = RPG::AudioFile.new(bgm[0], bgm[1], bgm[2])
  396.     return true
  397.   end
  398.  
  399.   if $dream_music
  400.   def bgm_play(bgm)
  401.     @playing_bgm = bgm
  402.     if bgm != nil && bgm.name != ''
  403.       vol = correction(@bgm_volume)
  404.       dream_ed = bgm.clone
  405.       dream_ed.volume = dream_ed.volume * vol / 100
  406.       DREAM.play_encrypted_audio('Audio/BGM/', dream_ed, 0)
  407.     else
  408.       Audio.bgm_stop
  409.     end
  410.     Graphics.frame_reset
  411.   end
  412.  
  413.   def bgs_play(bgs)
  414.     @playing_bgs = bgs
  415.     if bgs != nil && bgs.name != ''
  416.       vol = correction(@sfx_volume)
  417.       dream_ed = bgs.clone
  418.       dream_ed.volume = dream_ed.volume * vol / 100
  419.       DREAM.play_encrypted_audio('Audio/BGS/', dream_ed, 1)
  420.     else
  421.       Audio.bgs_stop
  422.     end
  423.     Graphics.frame_reset
  424.   end
  425.  
  426.   def me_play(me)
  427.     if me != nil && me.name != ''
  428.       vol = correction(@bgm_volume)
  429.       dream_ed = me.clone
  430.       dream_ed.volume = dream_ed.volume * vol / 100
  431.       DREAM.play_encrypted_audio('Audio/ME/', dream_ed, 2)
  432.     else
  433.       Audio.me_stop
  434.     end
  435.     Graphics.frame_reset
  436.   end
  437.  
  438.   def se_play(se)
  439.     if se != nil && se.name != ''
  440.       vol = correction(@sfx_volume)
  441.       dream_ed = se.clone
  442.       dream_ed.volume = dream_ed.volume * vol / 100
  443.       DREAM.play_encrypted_audio('Audio/SE/', dream_ed, 3)
  444.     end
  445.   end
  446.   else
  447.   def bgm_play(bgm)
  448.     @playing_bgm = bgm
  449.     if bgm != nil && bgm.name != ''
  450.       vol = correction(@bgm_volume)
  451.       Audio.bgm_play('Audio/BGM/' + bgm.name , bgm.volume * vol / 100, bgm.pitch)
  452.     else
  453.       Audio.bgm_stop
  454.     end
  455.     Graphics.frame_reset
  456.   end
  457.  
  458.   def bgs_play(bgs)
  459.     @playing_bgs = bgs
  460.     if bgs != nil && bgs.name != ''
  461.       vol = correction(@sfx_volume)
  462.       Audio.bgs_play('Audio/BGS/' + bgs.name, bgs.volume * vol / 100, bgs.pitch)
  463.     else
  464.       Audio.bgs_stop
  465.     end
  466.     Graphics.frame_reset
  467.   end
  468.  
  469.   def me_play(me)
  470.     if me != nil && me.name != ''
  471.       vol = correction(@bgm_volume)
  472.       Audio.me_play('Audio/ME/' + me.name, me.volume * vol / 100, me.pitch)
  473.     else
  474.       Audio.me_stop
  475.     end
  476.     Graphics.frame_reset
  477.   end
  478.  
  479.   def se_play(se)
  480.     if se != nil && se.name != ''
  481.       vol = correction(@sfx_volume)
  482.       Audio.se_play('Audio/SE/' + se.name, se.volume * vol / 100, se.pitch)
  483.     end
  484.   end
  485.   end
  486.  
  487.   def correction(volume)
  488.     case volume
  489.     when 100 then return 100
  490.     when 95 then return 97
  491.     when 90 then return 95
  492.     when 85 then return 92
  493.     when 80 then return 90
  494.     when 75 then return 87
  495.     when 70 then return 85
  496.     when 65 then return 82
  497.     when 60 then return 80
  498.     when 55 then return 77
  499.     when 50 then return 75
  500.     when 45 then return 72
  501.     when 40 then return 70
  502.     when 35 then return 65
  503.     when 30 then return 60
  504.     when 25 then return 55
  505.     when 20 then return 50
  506.     when 15 then return 40
  507.     when 10 then return 35
  508.     when 5 then return 25
  509.     end
  510.     return 0
  511.   end
  512.  
  513. end
  514.  
  515. #==============================================================================
  516. # Game_Actor
  517. #==============================================================================
  518.  
  519. class Game_Actor < Game_Battler
  520.  
  521.   def now_exp
  522.     return (@exp-@exp_list[@level])
  523.   end
  524.  
  525.   def next_exp
  526.     return (@exp_list[@level+1] > 0 ? @exp_list[@level+1]-@exp_list[@level] : 0)
  527.   end
  528.  
  529.   def test_equip(equip_type, id)
  530.     case equip_type
  531.     when 0 then old_id, @weapon_id = @weapon_id, id
  532.     when 1 then old_id, @armor1_id = @armor1_id, id
  533.     when 2 then old_id, @armor2_id = @armor2_id, id
  534.     when 3 then old_id, @armor3_id = @armor3_id, id
  535.     when 4 then old_id, @armor4_id = @armor4_id, id
  536.     end
  537.     tested = [self.maxhp, self.maxsp, self.atk, self.pdef, self.mdef, self.str,
  538.               self.dex, self.agi, self.int, self.eva]
  539.     case equip_type
  540.     when 0 then @weapon_id = old_id
  541.     when 1 then @armor1_id = old_id
  542.     when 2 then @armor2_id = old_id
  543.     when 3 then @armor3_id = old_id
  544.     when 4 then @armor4_id = old_id
  545.     end
  546.     return tested
  547.   end
  548.  
  549. end
  550.  
  551. #==============================================================================
  552. # Scene_Title
  553. #==============================================================================
  554.  
  555. class Scene_Title
  556.  
  557.   alias main_storm_cms_later main
  558.   def main
  559.     $map_infos = load_data('Data/MapInfos.rxdata')
  560.     $map_infos.keys.each {|key| $map_infos[key] = $map_infos[key].name}
  561.     main_storm_cms_later
  562.   end
  563.  
  564. end
  565.  
  566. #==============================================================================
  567. # Game_Map
  568. #==============================================================================
  569.  
  570. class Game_Map
  571.        
  572.   def name
  573.     return $map_infos[@map_id]
  574.   end
  575.    
  576. end
  577.  
  578. #==============================================================================
  579. # Bitmap
  580. #==============================================================================
  581.  
  582. class Bitmap
  583.  
  584.   if $tons_version == nil || $tons_version < 3.71
  585.   alias init_ultimate_font_override_later initialize
  586.   def initialize(w, h = nil)
  587.     if w.is_a?(Numeric) && h.is_a?(Numeric)
  588.       init_ultimate_font_override_later(w, h)
  589.     else
  590.       init_ultimate_font_override_later(w)
  591.     end
  592.     if $game_system != nil && $game_system.fontname != nil &&
  593.         !$scene.is_a?(Scene_Title)
  594.       self.font.name = $game_system.fontname
  595.       self.font.size = $game_system.fontsize
  596.     else
  597.       self.font.name = Font.default_name
  598.       self.font.size = Font.default_size
  599.     end
  600.   end
  601.  
  602.   def gradient_bar(x, y, w, color1, color2, color3, rate, flag = false)
  603.     offset = 5
  604.     x += offset
  605.     y += 26
  606.     (0...offset+3).each {|i| fill_rect(x-i, y+i-2, w+3, 1, Color.new(0, 0, 0))}
  607.     (0...offset+1).each {|i| fill_rect(x-i, y+i-1, w+1, 1, Color.new(255, 255, 255))}
  608.     (0...w+offset).each {|i|
  609.         red = color3.red * i / (w + offset)
  610.         green = color3.green * i / (w + offset)
  611.         blue = color3.blue * i / (w + offset)
  612.         oy = i < offset ? offset-i : 0
  613.         off = i < offset ? i : i > w ? w+offset-i : offset
  614.         fill_rect(x+i-offset+1, y+oy-1, 1, off, Color.new(red, green, blue))}
  615.     if (w*rate).to_i >= offset
  616.       (0...(w*rate).to_i+offset).each {|i|
  617.           red = color1.red + (color2.red-color1.red)*i/((w+offset)*rate)
  618.           green = color1.green + (color2.green-color1.green)*i/((w+offset)*rate)
  619.           blue = color1.blue + (color2.blue-color1.blue)*i/((w+offset)*rate)
  620.           oy = i < offset ? offset-i : 0
  621.           off = i < offset ? i : i > w*rate ? (w*rate).to_i+offset-i : offset
  622.           fill_rect(x+i-offset+1, y+oy-1, 1, off, Color.new(red, green, blue))}
  623.     else
  624.       (0...(w*rate).to_i).each {|i| (0...offset-1).each {|j|
  625.           red = color1.red + (color2.red-color1.red) * i / (w * rate)
  626.           green = color1.green + (color2.green-color1.green) * i / (w * rate)
  627.           blue = color1.blue + (color2.blue-color1.blue) * i / (w * rate)
  628.           set_pixel(x+i-j+1, y+j-1, Color.new(red, green, blue))}}
  629.     end
  630.   end
  631.   end
  632.  
  633.   def draw_element_graph(x_plus, y_plus, rad, color, limit = -1)
  634.     (-rad-1...0).each {|r| (r...0).each {|x|
  635.         color.alpha = 255 * (rad+1.0-r.abs)/(rad+1)
  636.         y = (r.abs * Math.sin(Math.acos(x/r.to_f))).to_i
  637.         h = y * 2
  638.         case limit
  639.         when 1, 8 then h = (y < x.abs ? 0 : y - x.abs)
  640.         when 2, 7 then y > x.abs ? h = y = x.abs : h = y
  641.         when 3, 6
  642.           y > x.abs ? h = y = x.abs : h = y
  643.           y = 0 if y > 0
  644.         when 4, 5 then h, y = (y < x.abs ? 0 : y - x.abs), -x.abs
  645.         end
  646.         if limit < 5
  647.           fill_rect(rad*2-x + x_plus, rad-y + y_plus, 1, h, color)
  648.         else
  649.           fill_rect(rad*2+x+1 + x_plus, rad-y + y_plus, 1, h, color)
  650.         end}}
  651.   end
  652.  
  653. end
  654.  
  655. #==============================================================================
  656. # Window_Base
  657. #==============================================================================
  658.  
  659. class Window_Base < Window
  660.  
  661.   alias st_cms_hybrid_hack_init initialize
  662.   def initialize(xx, yy, w, h)
  663.     st_cms_hybrid_hack_init(xx, yy, w, h)
  664.     if BlizzCFG::CMS_EDITION && @background != nil
  665.       @backsprite = Sprite.new
  666.       @backsprite.bitmap = RPG::Cache.picture("CMS/#{BlizzCFG::CMS_EDITION}/#{@background}")
  667.       self.opacity, @backsprite.x, @backsprite.y = 0, self.x, self.y
  668.     end
  669.   end
  670.  
  671.   alias st_cms_hybrid_hack_x_ x=
  672.   def x=(xx)
  673.     st_cms_hybrid_hack_x_($scene.is_a?(Scene_Menu) && BlizzCFG::WIN_MIRRORED ? 640-width-xx : xx)
  674.     @backsprite.x = xx unless @backsprite == nil || @backsprite.disposed?
  675.   end
  676.  
  677.   alias st_cms_hybrid_hack_y_ y=
  678.   def y=(yy)
  679.     st_cms_hybrid_hack_y_(yy)
  680.     @backsprite.y = yy unless @backsprite == nil || @backsprite.disposed?
  681.   end
  682.  
  683.   alias st_cms_hybrid_hack_x x
  684.   def x
  685.     xx = st_cms_hybrid_hack_x
  686.     return ($scene.is_a?(Scene_Menu) && BlizzCFG::WIN_MIRRORED ? 640-width-xx : xx)
  687.   end
  688.  
  689.   alias st_cms_hybrid_hack_z z=
  690.   def z=(z)
  691.     st_cms_hybrid_hack_z(z)
  692.     @backsprite.z = z unless @backsprite == nil || @backsprite.disposed?
  693.   end
  694.  
  695.   alias st_cms_hybrid_hack_width width=
  696.   def width=(w)
  697.     self.x += w-width if $scene.is_a?(Scene_Menu) && BlizzCFG::WIN_MIRRORED
  698.     st_cms_hybrid_hack_width(w)
  699.   end
  700.  
  701.   alias st_cms_hybrid_hack_visible visible=
  702.   def visible=(expr)
  703.     st_cms_hybrid_hack_visible(expr)
  704.     @backsprite.visible = expr unless @backsprite == nil || @backsprite.disposed?
  705.   end
  706.  
  707.   alias disp_sprite_later dispose
  708.   def dispose
  709.     @backsprite.dispose unless @backsprite == nil || @backsprite.disposed?
  710.     disp_sprite_later
  711.   end
  712.  
  713.   alias st_cms_hybrid_hack_normal_color normal_color
  714.   def normal_color
  715.     if $scene.is_a?(Scene_Menu) && BlizzCFG::FONT_BACKGROUND_FIX
  716.       return Color.new(0, 0, 0)
  717.     else
  718.       return st_cms_hybrid_hack_normal_color
  719.     end
  720.   end
  721.  
  722.   alias st_cms_hybrid_hack_system_color system_color
  723.   def system_color
  724.     if $scene.is_a?(Scene_Menu) && BlizzCFG::FONT_BACKGROUND_FIX
  725.       return Color.new(160, 0, 255)
  726.     else
  727.       return st_cms_hybrid_hack_system_color
  728.     end
  729.   end
  730.  
  731.   alias st_cms_hybrid_hack_disabled_color disabled_color
  732.   def disabled_color
  733.     if $scene.is_a?(Scene_Menu) && BlizzCFG::FONT_BACKGROUND_FIX
  734.       return Color.new(96, 96, 96)
  735.     else
  736.       return st_cms_hybrid_hack_disabled_color
  737.     end
  738.   end
  739.  
  740.   alias st_cms_hybrid_hack_crisis_color crisis_color
  741.   def crisis_color
  742.     if $scene.is_a?(Scene_Menu) && BlizzCFG::FONT_BACKGROUND_FIX
  743.       return Color.new(192, 192, 0)
  744.     else
  745.       return st_cms_hybrid_hack_crisis_color
  746.     end
  747.   end
  748.  
  749.   alias draw_actor_graphic_st_cms_later draw_actor_graphic
  750.   def draw_actor_graphic(actor, x, y)
  751.     if actor != nil && actor.character_name != ''
  752.       if self.is_a?(Window_CMSMenuStatus) && BlizzCFG::FACESETS
  753.         bitmap = RPG::Cache.character("#{actor.character_name}_face", actor.character_hue)
  754.         x -= bitmap.width / 2
  755.         y -= bitmap.height
  756.         draw_actor_face_st_cms(actor, x, y)
  757.       else
  758.         draw_actor_graphic_st_cms_later(actor, x, y)
  759.       end
  760.     end
  761.   end
  762.  
  763.   def draw_actor_face_st_cms(actor, x, y)
  764.     if $tons_version == nil || $tons_version < 3.71 || !FACE_HUE
  765.       hue = 0
  766.     else
  767.       hue = (FACE_HUE ? actor.character_hue : 0)
  768.     end
  769.     bitmap = RPG::Cache.character("#{actor.character_name}_face", hue)
  770.     src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  771.     self.contents.blt(x, y, bitmap, src_rect)
  772.   end
  773.  
  774.   def draw_actor_battler(actor, x, y)
  775.     if actor != nil && actor.battler_name != ''
  776.       bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
  777.       cw = bitmap.width
  778.       ch = bitmap.height
  779.       src_rect = Rect.new(0, 0, cw,ch)
  780.       self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  781.     end
  782.   end
  783.  
  784.   def draw_actor_exp(actor, x, y, width = 144)
  785.     self.contents.font.color = system_color
  786.     self.contents.draw_text(x, y, 48, 32, 'EXP')
  787.     if actor.exp_s.to_i > 999999
  788.       w = self.contents.text_size('999999').width
  789.     else
  790.       w = self.contents.text_size(actor.exp_s).width
  791.     end
  792.     if actor.next_exp_s.to_i > 999999
  793.       w2 = self.contents.text_size('999999').width
  794.     else
  795.       w2 = self.contents.text_size(actor.next_exp_s).width
  796.     end
  797.     self.contents.font.color = normal_color
  798.     self.contents.draw_text(x + 108 - w2, y, w2, 32, actor.exp_s, 2)
  799.     self.contents.draw_text(x + 108, y, 12, 32, '/', 1)
  800.     self.contents.draw_text(x + 120, y, w2, 32, actor.next_exp_s)
  801.   end
  802.  
  803.   def draw_actor_exp_alt(actor, x, y)
  804.     self.contents.font.color = system_color
  805.     self.contents.draw_text(x, y, 64, 32, 'next')
  806.     self.contents.font.color = normal_color
  807.     self.contents.draw_text(x + 56, y, 84, 32, actor.next_rest_exp_s, 2)
  808.   end
  809.  
  810.   def draw_actor_name2(actor, x, y, w, a)
  811.     self.contents.font.color = normal_color
  812.     self.contents.draw_text(x, y, w, 32, actor.name, a)
  813.   end
  814.  
  815.   def up_color
  816.     return Color.new(0, 255, 0)
  817.   end
  818.  
  819.   def down_color
  820.     return Color.new(255, 0, 0)
  821.   end
  822.  
  823.   alias draw_actor_parameter_st_cms_later draw_actor_parameter
  824.   def draw_actor_parameter(actor, x, y, type)
  825.     if type == 7
  826.       self.contents.font.color = system_color
  827.       self.contents.draw_text(x, y, 120, 32, 'Evasion')
  828.       self.contents.font.color = normal_color
  829.       self.contents.draw_text(x + 120, y, 36, 32, actor.eva.to_s, 2)
  830.     else
  831.       draw_actor_parameter_st_cms_later(actor, x, y, type)
  832.     end
  833.   end
  834.  
  835.   def draw_actor_element_vulnerability(actor, x, y, rad = 60)
  836.     colors = []
  837.     (1..8).each {|i|
  838.         rate = actor.element_rate(i)
  839.         if rate < 0
  840.           colors.push(Color.new(0, 255 * (100-rate.abs) / 200, 255))
  841.         elsif rate == 0
  842.           colors.push(Color.new(0, 128, 255))
  843.         elsif rate <= 50
  844.           colors.push(Color.new(0, 255 * (rate+50) / 100, 255 * (50-rate) / 50))
  845.         elsif rate <= 100
  846.           colors.push(Color.new(255 * (rate-50) / 50 , 255, 0))
  847.         elsif rate <= 200
  848.           colors.push(Color.new(255, 255 * (200-rate) / 100, 0))
  849.         else
  850.           colors.push(normal_color)
  851.         end}
  852.     (1..8).each {|i|
  853.         self.contents.draw_element_graph(x + 16, y + 32, rad, colors[i-1], i)}
  854.     save_color = self.contents.font.color.clone
  855.     (1..8).each {|i|
  856.         str1 = $data_system.elements[i]
  857.         str2 = "#{actor.element_rate(i)}%"
  858.         w1 = self.contents.text_size(str1).width
  859.         w2 = self.contents.text_size(str2).width
  860.         case i
  861.         when 1 then x2, y2, x3, y3 = x+152,    y+20,  x+168,    y+4
  862.         when 2 then x2, y2, x3, y3 = x+176,    y+56,  x+192,    y+40
  863.         when 3 then x2, y2, x3, y3 = x+176,    y+92,  x+192,    y+108
  864.         when 4 then x2, y2, x3, y3 = x+152,    y+128, x+168,    y+144
  865.         when 5 then x2, y2, x3, y3 = x+120-w1, y+128, x+104-w2, y+144
  866.         when 6 then x2, y2, x3, y3 = x+96-w1,  y+92,  x+80-w2,  y+108
  867.         when 7 then x2, y2, x3, y3 = x+96-w1,  y+56,  x+80-w2,  y+40
  868.         when 8 then x2, y2, x3, y3 = x+120-w1, y+20,  x+104-w2, y+4
  869.         end
  870.         self.contents.font.color = save_color
  871.         self.contents.draw_text(x2, y2, w1, 32, str1)
  872.         self.contents.font.color = colors[i-1]
  873.         self.contents.draw_text(x3, y3, w2, 32, str2)}
  874.     self.contents.font.color = save_color
  875.   end
  876.  
  877.   if $Blizz_Art
  878.   alias draw_actor_exp_blizzart_later draw_actor_exp
  879.   def draw_actor_exp(actor, x, y, w = 148)
  880.     if $game_system.BARS
  881.       w -= 12
  882.       rate = (actor.next_exp != 0 ? actor.now_exp.to_f / actor.next_exp : 1)
  883.       if rate < 0.5
  884.         color1 = Color.new(20 * rate, 60, 80, 192)
  885.         color2 = Color.new(60 * rate, 180, 240, 192)
  886.       elsif rate >= 0.5
  887.         color1 = Color.new(20 + 120 * (rate-0.5), 60 + 40 * (rate-0.5), 80, 192)
  888.         color2 = Color.new(60 + 360 * (rate-0.5), 180 + 120 * (rate-0.5), 240, 192)
  889.       end
  890.       color3 = Color.new(80, 80, 80, 192)
  891.       self.contents.gradient_bar(x, y, w, color1, color2, color3, rate)
  892.     end
  893.     draw_actor_exp_blizzart_later(actor, x, y)
  894.   end
  895.  
  896.   alias draw_actor_exp_new2 draw_actor_exp_alt
  897.   def draw_actor_exp_alt(actor, x, y, w = 148)
  898.     w -= 12
  899.     rate = (actor.next_exp != 0 ? actor.now_exp.to_f / actor.next_exp : 1)
  900.     if rate < 0.5
  901.       color1 = Color.new(20 * rate, 60, 80)
  902.       color2 = Color.new(60 * rate, 180, 240)
  903.     elsif rate >= 0.5
  904.       color1 = Color.new(20 + 120 * (rate-0.5), 60 + 40 * (rate-0.5), 80)
  905.       color2 = Color.new(60 + 360 * (rate-0.5), 180 + 120 * (rate-0.5), 240)
  906.     end
  907.     color3 = Color.new(80, 80, 80, 192)
  908.     self.contents.gradient_bar(x, y, w, color1, color2, color3, rate)
  909.     draw_actor_exp_new2(actor, x, y)
  910.   end
  911.   end
  912.  
  913. end
  914.  
  915. #==============================================================================
  916. # Window_CMSCommand
  917. #==============================================================================
  918.  
  919. class Window_CMSCommand < Window_Command
  920.  
  921.   attr_reader :continue
  922.  
  923.   def initialize(index, continue)
  924.     @background = 'CMSCommand'
  925.     commands = [$data_system.words.item, 'Equipment', $data_system.words.equip,
  926.         $data_system.words.skill, 'Status', 'Options', 'Save', 'Load', 'Exit']
  927.     super(180, commands)
  928.     @continue, self.index, self.x, self.y, self.z = continue, index, 972, 0, 999
  929.   end
  930.  
  931.   def draw_item(i, color)
  932.     self.contents.fill_rect(0, i*32, 148, 32, Color.new(0, 0, 0, 0))
  933.     bitmap = RPG::Cache.icon("CMS/commandmenu#{i}")
  934.     opacity = (color == normal_color ? 255 : 128)
  935.     self.contents.blt(4, 4 + i*32, bitmap, Rect.new(0, 0, 24, 24), opacity)
  936.     self.contents.font.color = color
  937.     self.contents.draw_text(32, i*32, 148, 32, @commands[i])
  938.   end
  939.  
  940. end
  941.  
  942. #==============================================================================
  943. # Window_CMSChooseItem
  944. #==============================================================================
  945.  
  946. class Window_CMSChooseItem < Window_Selectable
  947.  
  948.   def initialize
  949.     @background = 'CMSHelp'
  950.     super(0, -576, 640, 64)
  951.     @commands = ['Items', 'Sort', 'Quest Items']
  952.     @item_max = @column_max = @commands.size
  953.     self.contents = Bitmap.new(width - 32, 32)
  954.     refresh
  955.     self.active, self.z, self.index = true, 2900, 0
  956.   end
  957.  
  958.   def refresh
  959.     self.contents.clear
  960.     (0...@item_max).each {|i| draw_item(i, normal_color)}
  961.   end
  962.  
  963.   def draw_item(i, color)
  964.     self.contents.font.color = color
  965.     self.contents.fill_rect(8 + 212*i, 0, 164, 32, Color.new(0, 0, 0, 0))
  966.     self.contents.draw_text(8 + 212*i, 0, 164, 32, @commands[i], 1)
  967.   end
  968.  
  969. end
  970.  
  971. #==============================================================================
  972. # Window_CMSOptions
  973. #==============================================================================
  974.  
  975. class Window_CMSOptions < Window_Selectable
  976.  
  977.   attr_accessor :current_font
  978.   attr_reader   :current_skin
  979.   attr_reader   :skin_name
  980.   attr_reader   :font_name
  981.  
  982.   def initialize
  983.     @background = 'CMSFullscreen'
  984.     super(0, 512, 640, 480)
  985.     @commands = ['BGM Volume', 'SFX Volume', 'Battle BGM']
  986.     @commands.push('Battle Cam') if BlizzCFG::CAM_AVAILABLE
  987.     @commands.push('Bar Style', 'Bar Opacity') if $Blizz_Art
  988.     @commands.push('Font', 'Windowskin')
  989.     get_skin_and_font
  990.     self.contents = Bitmap.new(width - 32, height - 32)
  991.     self.z, self.index = 2999, 0
  992.     @item_max = @commands.size
  993.     refresh
  994.   end
  995.  
  996.   def get_option
  997.     return @commands[index]
  998.   end
  999.  
  1000.   def refresh
  1001.     self.contents.clear
  1002.     self.contents.font.name = $game_system.fontname
  1003.     (0...@item_max).each {|i|
  1004.         self.contents.font.color = normal_color
  1005.         self.contents.fill_rect(24, 16 + i*36, 192, 32, Color.new(0, 0, 0, 0))
  1006.         self.contents.draw_text(24, 16 + i*36, 192, 32, @commands[i])
  1007.         draw_arrows(288, 4 + i*36)
  1008.         case @commands[i]
  1009.         when 'BGM Volume' then draw_volume(288, 4 + i*36)
  1010.         when 'SFX Volume' then draw_volume(288, 4 + i*36, true)
  1011.         when 'Battle BGM' then draw_battle_bgm(288, 4 + i*36)
  1012.         when 'Battle Cam' then draw_battle_cam(288, 4 + i*36)
  1013.         when 'Bar Style' then draw_style(288, 4 + i*36)
  1014.         when 'Bar Opacity' then draw_opacity(288, 4 + i*36)
  1015.         when 'Font' then draw_font(288, 4 + i*36)
  1016.         when 'Windowskin' then draw_skin(288, 4 + i*36)
  1017.         end}
  1018.   end
  1019.      
  1020.   def draw_arrows(x, y)
  1021.     self.contents.draw_text(x - 32, y + 13, 32, 32, '<<')
  1022.     self.contents.draw_text(x + 249, y + 13, 32, 32, '>>')
  1023.   end
  1024.  
  1025.   def draw_volume(x, y, mode = false, width = 224)
  1026.     volume = (mode ? $game_system.sfx_volume.to_f : $game_system.bgm_volume.to_f)
  1027.     vol = volume.to_f / 100
  1028.     color1 = Color.new(20, 40, 80, 192)
  1029.     color2 = Color.new(60, 120, 240, 192)
  1030.     color3 = Color.new(0, 0, 80, 192)
  1031.     old, $game_system.bar_opacity = $game_system.bar_opacity, 255 if $Blizz_Art
  1032.     self.contents.gradient_bar(x, y, width, color1, color2, color3, vol, true)
  1033.     $game_system.bar_opacity = old if $Blizz_Art
  1034.   end
  1035.  
  1036.   def draw_style(x, y, width = 224)
  1037.     color1 = Color.new(80, 80, 0, 192)
  1038.     color2 = Color.new(240, 240, 0, 192)
  1039.     self.contents.gradient_bar(x + 32, y, width - 64, color1, color2, color1, 1, true)
  1040.   end
  1041.  
  1042.   def draw_battle_bgm(x, y, width = 224)
  1043.     bgm = BlizzCFG::BATTLE_BGMS[$game_variables[BlizzCFG::BGM_Variable]][3]
  1044.     if $game_switches[BlizzCFG::BGM_Lock] || BlizzCFG::BATTLE_BGMS.size <= 1
  1045.       self.contents.font.color = Color.new(0, 0, 0, 255)
  1046.       self.contents.draw_text(x+1, y + 13+1, 224, 32, bgm, 1)
  1047.       self.contents.font.color = disabled_color
  1048.     else
  1049.       self.contents.font.color = normal_color
  1050.     end
  1051.     self.contents.draw_text(x, y + 13, 224, 32, bgm, 1)
  1052.   end
  1053.  
  1054.   def draw_battle_cam(x, y, width = 224)
  1055.     cam = ($game_variables[BlizzCFG::CAM_Variable] == 0 ? 'ON' : 'OFF')
  1056.     self.contents.draw_text(x, y + 13, 224, 32, cam, 1)
  1057.   end
  1058.  
  1059.   def draw_opacity(x, y, width = 224)
  1060.     alpha = case $game_system.bar_opacity
  1061.     when 0 then 'No Bar'
  1062.     when 1..85 then 'Light'
  1063.     when 86..170 then 'Medium'
  1064.     when 171..254 then 'Hard'
  1065.     when 255 then 'Full'
  1066.     end
  1067.     self.contents.draw_text(x, y + 13, 224, 32, alpha, 1)
  1068.   end
  1069.  
  1070.   def draw_font(x, y, width = 224)
  1071.     @font_name = BlizzCFG::CMS_FONTS[@current_font]
  1072.     self.contents.font.name = @font_name
  1073.     self.contents.draw_text(x, y + 13, 224, 32, @font_name, 1)
  1074.     self.contents.font.name = $game_system.fontname
  1075.   end
  1076.  
  1077.   def draw_skin(x, y, width = 224)
  1078.     @skin_name = BlizzCFG::CMS_SKINS[self.current_skin]
  1079.     self.contents.draw_text(x, y + 13, 224, 32, @skin_name, 1)
  1080.     self.contents.fill_rect(x + 48, y +428, 128, 128, Color.new(0, 0, 0, 0))
  1081.     bitmap = RPG::Cache.windowskin(@skin_name)
  1082.     self.contents.blt(x + 50, y + 50, bitmap, Rect.new(2, 2, 124, 124))
  1083.     self.contents.blt(x + 48, y + 48, bitmap, Rect.new(128, 0, 16, 16))
  1084.     self.contents.blt(x + 160, y + 48, bitmap, Rect.new(176, 0, 16, 16))
  1085.     self.contents.blt(x + 48, y + 160, bitmap, Rect.new(128, 48, 16, 16))
  1086.     self.contents.blt(x + 160, y + 160, bitmap, Rect.new(176, 48, 16, 16))
  1087.     (2..4).each {|i|
  1088.         self.contents.blt(x+i*32, y+48, bitmap, Rect.new(144, 0, 32, 16))}
  1089.     (2..4).each {|i|
  1090.         self.contents.blt(x+i*32, y+160, bitmap, Rect.new(144, 48, 32, 16))}
  1091.     (2..4).each {|i|
  1092.         self.contents.blt(x+48, y+i*32, bitmap, Rect.new(128, 16, 16, 32))}
  1093.     (2..4).each {|i|
  1094.         self.contents.blt(x+160, y+i*32, bitmap, Rect.new(176, 16, 16, 32))}
  1095.   end
  1096.  
  1097.   def current_skin
  1098.     return (@current_skin == nil ? 0 : @current_skin)
  1099.   end
  1100.  
  1101.   def current_skin=(val)
  1102.     @current_skin = (val.is_a?(Numeric) ? val : 0)
  1103.   end
  1104.  
  1105.   def get_skin_and_font
  1106.     @font_name = $game_system.fontname
  1107.     @current_font = BlizzCFG::CMS_FONTS.index(@font_name)
  1108.     @skin_name = $game_system.windowskin_name
  1109.     self.current_skin = BlizzCFG::CMS_SKINS.index(@skin_name)
  1110.   end
  1111.  
  1112.   def update_cursor_rect
  1113.     if self.index < 0
  1114.       self.cursor_rect.empty
  1115.     else
  1116.       self.cursor_rect.set(16, @index*36 + 16, 128, 32)
  1117.     end
  1118.   end
  1119.  
  1120. end
  1121.  
  1122. #==============================================================================
  1123. # Window_CMSTarget
  1124. #==============================================================================
  1125.  
  1126. class Window_CMSTarget < Window_Base
  1127.  
  1128.   attr_reader :index
  1129.   attr_reader :actor
  1130.   attr_reader :dir
  1131.  
  1132.   def initialize(actor, mode = false)
  1133.     @background = 'CMSTarget'
  1134.     super(-304, 64, 256, 104)
  1135.     self.contents = Bitmap.new(width - 32, height - 32)
  1136.     @actor, @item_max = actor, 1
  1137.     self.y += actor.index*104 unless mode
  1138.     self.z = 3999
  1139.     self.index = -1
  1140.     refresh
  1141.   end
  1142.  
  1143.   def index=(i)
  1144.     @index = i
  1145.     update_cursor_rect
  1146.   end
  1147.  
  1148.   def refresh
  1149.     self.contents.clear
  1150.     draw_actor_name(@actor, 4, -4)
  1151.     draw_actor_state(@actor, 100, -4, 112)
  1152.     draw_actor_hp(@actor, 44, 16)
  1153.     draw_actor_sp(@actor, 44, 38)
  1154.   end
  1155.  
  1156.   def update_actor(actor)
  1157.     @actor = actor
  1158.     refresh
  1159.   end
  1160.  
  1161.   def dir=(val)
  1162.     self.y -= val*40
  1163.     @dir = val
  1164.   end
  1165.  
  1166.   def update(i = @actor.index - 1)
  1167.     unless self.index == -2
  1168.       if @actor.index == i
  1169.         self.index = 0 if self.index == -1
  1170.       else
  1171.         self.index = -1 if self.index == 0
  1172.       end
  1173.     end
  1174.     self.y = 64+@actor.index*104 unless self.active
  1175.     @dir = 0 if (self.y-64) / 104 * 104 == self.y-64
  1176.     super()
  1177.     update_cursor_rect
  1178.   end
  1179.  
  1180.   def update_cursor_rect
  1181.     if !self.active || self.index == -1
  1182.       self.cursor_rect.empty
  1183.     elsif self.index >= 0
  1184.       self.cursor_rect.set(0, @index * 96, 224, 72)
  1185.     elsif self.index == -2
  1186.       self.cursor_rect.set(0, 0, 224, 72)
  1187.     end
  1188.   end
  1189.  
  1190. end
  1191.  
  1192. #==============================================================================
  1193. # Window_Help
  1194. #==============================================================================
  1195.  
  1196. class Window_Help < Window_Base
  1197.  
  1198.   alias init_storm_cms_later initialize
  1199.   def initialize
  1200.     @background = 'CMSHelp' if $scene.is_a?(Scene_Menu)
  1201.     init_storm_cms_later
  1202.     refresh
  1203.   end
  1204.  
  1205.   def refresh
  1206.     self.contents.font.name = $game_system.fontname
  1207.   end
  1208.  
  1209. end
  1210.  
  1211. #==============================================================================
  1212. # Window_CMSItem
  1213. #==============================================================================
  1214.  
  1215. class Window_CMSItem < Window_Selectable
  1216.  
  1217.   def initialize
  1218.     @background = 'CMSItem'
  1219.     super(256, -512, 384, 416)
  1220.     self.active, self.visible, self.z, self.index = false, false, 2999, -1
  1221.     refresh
  1222.   end
  1223.  
  1224.   def data
  1225.     return @data[self.index]
  1226.   end
  1227.  
  1228.   def draw_item(i)
  1229.     number = case @data[i]
  1230.     when RPG::Item then $game_party.item_number(@data[i].id)
  1231.     when RPG::Weapon then $game_party.weapon_number(@data[i].id)
  1232.     when RPG::Armor then $game_party.armor_number(@data[i].id)
  1233.     end
  1234.     if @data[i].is_a?(RPG::Item) && $game_party.item_can_use?(@data[i].id) ||
  1235.         @mode == nil
  1236.       self.contents.font.color = normal_color
  1237.     else
  1238.       self.contents.font.color = disabled_color
  1239.     end
  1240.     self.contents.fill_rect(4, i*32, 352, 32, Color.new(0, 0, 0, 0))
  1241.     bitmap = RPG::Cache.icon(@data[i].icon_name)
  1242.     opacity = self.contents.font.color == normal_color ? 255 : 128
  1243.     self.contents.blt(4, i*32 + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  1244.     self.contents.draw_text(32, i*32, 212, 32, @data[i].name, 0)
  1245.     self.contents.draw_text(308, i*32, 16, 32, ':', 1)
  1246.     self.contents.draw_text(324, i*32, 24, 32, number.to_s, 2)
  1247.   end
  1248.  
  1249.   def update_help
  1250.     @help_window.set_text(data == nil ? '' : data.description)
  1251.     @help_window.weapon = self.data
  1252.   end
  1253.  
  1254. end
  1255.  
  1256. #==============================================================================
  1257. # Window_NormalItem
  1258. #==============================================================================
  1259.  
  1260. class Window_NormalItem < Window_CMSItem
  1261.  
  1262.   attr_accessor :mode
  1263.  
  1264.   def initialize
  1265.     @mode = 0
  1266.     super
  1267.     self.visible = true
  1268.   end
  1269.  
  1270.   def refresh
  1271.     if self.contents != nil
  1272.       self.contents.dispose
  1273.       self.contents = nil
  1274.     end
  1275.     data1, data2, data3 = [], [], []
  1276.     (1...$data_items.size).each {|i|
  1277.         if $game_party.item_number(i) > 0 && !BlizzCFG::QUEST_ITEMS.include?(i)
  1278.           data1.push($data_items[i])
  1279.         end}
  1280.     if BlizzCFG::WEAPONS_AND_ARMORS
  1281.       (1...$data_weapons.size).each {|i|
  1282.           data2.push($data_weapons[i]) if $game_party.weapon_number(i) > 0}
  1283.       (1...$data_armors.size).each {|i|
  1284.           data3.push($data_armors[i]) if $game_party.armor_number(i) > 0}
  1285.     end
  1286.     if [1, 2].include?(@mode)
  1287.       data1.sort! {|a, b|
  1288.           $game_party.item_number(a.id) <=> $game_party.item_number(b.id)}
  1289.       data2.sort! {|a, b|
  1290.           $game_party.weapon_number(a.id) <=> $game_party.weapon_number(b.id)}
  1291.       data3.sort! {|a, b|
  1292.           $game_party.armor_number(a.id) <=> $game_party.armor_number(b.id)}
  1293.       [data1, data2, data3].each {|ary| ary.reverse!} if @mode == 2
  1294.     elsif [3, 4].include?(@mode)
  1295.       [data1, data2, data3].each {|ary| ary.sort! {|a, b| a.name <=> b.name}}
  1296.       [data1, data2, data3].each {|ary| ary.reverse!} if @mode == 4
  1297.     end
  1298.     @data = data1 + data2 + data3  
  1299.     @item_max = @data.size
  1300.     self.contents = Bitmap.new(width - 32, @item_max * 32) if @item_max > 0
  1301.     (0...@item_max).each {|i| draw_item(i)}
  1302.   end
  1303.  
  1304. end
  1305.  
  1306. #==============================================================================
  1307. # Window_QuestItem
  1308. #==============================================================================
  1309.  
  1310. class Window_QuestItem < Window_CMSItem
  1311.  
  1312.   def refresh
  1313.     if self.contents != nil
  1314.       self.contents.dispose
  1315.       self.contents = nil
  1316.     end
  1317.     @data = []
  1318.     (1...$data_items.size).each {|i|
  1319.         if $game_party.item_number(i) > 0 && BlizzCFG::QUEST_ITEMS.include?(i)
  1320.           @data.push($data_items[i])
  1321.         end}
  1322.     @item_max = @data.size
  1323.     self.contents = Bitmap.new(width - 32, @item_max * 32) if @item_max > 0
  1324.     (0...@item_max).each {|i| draw_item(i)}
  1325.   end
  1326.  
  1327. end
  1328.  
  1329. #==============================================================================
  1330. # Window_EquipmentItem
  1331. #==============================================================================
  1332.  
  1333. class Window_EquipmentItem < Window_CMSItem
  1334.  
  1335.   attr_accessor :item_max
  1336.  
  1337.   def initialize(actor)
  1338.     @actor = actor
  1339.     super()
  1340.     self.x, self.y, self.z, self.index = 256, -548, 2999, 0
  1341.     self.active = self.visible = true
  1342.   end
  1343.  
  1344.   def update_actor(actor)
  1345.     @actor = actor
  1346.     refresh
  1347.   end
  1348.  
  1349.   def refresh
  1350.     if self.contents != nil
  1351.       self.contents.dispose
  1352.       self.contents = nil
  1353.     end
  1354.     @data = []
  1355.     (1...$data_weapons.size).each {|i|
  1356.         @data.push($data_weapons[i]) if $game_party.weapon_number(i) > 0}
  1357.     (1...$data_armors.size).each {|i|
  1358.         @data.push($data_armors[i]) if $game_party.armor_number(i) > 0}
  1359.     @item_max = @data.size
  1360.     self.contents = Bitmap.new(width - 32, @item_max * 32) if @item_max > 0
  1361.     (0...@item_max).each {|i| draw_item(i)}
  1362.   end
  1363.  
  1364.   def draw_item(i)
  1365.     case @data[i]
  1366.     when RPG::Weapon
  1367.       if @actor.equippable?($data_weapons[@data[i].id])
  1368.         self.contents.font.color = normal_color
  1369.       else
  1370.         self.contents.font.color = disabled_color
  1371.       end
  1372.       number = $game_party.weapon_number(@data[i].id)
  1373.     when RPG::Armor
  1374.       if @actor.equippable?($data_armors[@data[i].id])
  1375.         self.contents.font.color = normal_color
  1376.       else
  1377.         self.contents.font.color = disabled_color
  1378.       end
  1379.       number = $game_party.armor_number(@data[i].id)
  1380.     end
  1381.     self.contents.fill_rect(4, i*32, 352, 32, Color.new(0, 0, 0, 0))
  1382.     bitmap = RPG::Cache.icon(@data[i].icon_name)
  1383.     opacity = self.contents.font.color == normal_color ? 255 : 128
  1384.     self.contents.blt(4, 4 + i*32, bitmap, Rect.new(0, 0, 24, 24), opacity)
  1385.     self.contents.draw_text(32, i*32, 212, 32, @data[i].name, 0)
  1386.     self.contents.draw_text(308, i*32, 16, 32, ':', 1)
  1387.     self.contents.draw_text(324, i*32, 24, 32, number.to_s, 2)
  1388.   end
  1389.  
  1390. end
  1391.  
  1392. #==============================================================================
  1393. # Window_CMSSkill
  1394. #==============================================================================
  1395.  
  1396. class Window_CMSSkill < Window_CMSItem
  1397.  
  1398.   def initialize(actor)
  1399.     @actor = actor
  1400.     super()
  1401.     self.x, self.y, self.z, self.index = -512, 64, 2999, 0
  1402.     self.active = self.visible = true
  1403.   end
  1404.  
  1405.   def update_actor(actor)
  1406.     @actor = actor
  1407.     refresh
  1408.   end
  1409.  
  1410.   def refresh
  1411.     if self.contents != nil
  1412.       self.contents.dispose
  1413.       self.contents = nil
  1414.     end
  1415.     @data = []
  1416.     @actor.skills.each {|id| @data.push($data_skills[id])}
  1417.     @item_max = @data.size
  1418.     self.contents = Bitmap.new(width - 32, @item_max * 32) if @item_max > 0
  1419.     (0...@item_max).each {|i| draw_item(i)}
  1420.   end
  1421.  
  1422.   def draw_item(i)
  1423.     self.contents.fill_rect(4, i*32, 352, 32, Color.new(0, 0, 0, 0))
  1424.     if @actor.skill_can_use?(@data[i].id)
  1425.       self.contents.font.color = normal_color
  1426.     else
  1427.       self.contents.font.color = disabled_color
  1428.     end
  1429.     bitmap = RPG::Cache.icon(@data[i].icon_name)
  1430.     opacity = self.contents.font.color == normal_color ? 255 : 128
  1431.     self.contents.blt(4, 4 + i*32, bitmap, Rect.new(0, 0, 24, 24), opacity)
  1432.     text = @data[i].name
  1433.     tons = ($tons_version != nil ? $tons_version : 0)
  1434.     if tons >= 4.0 && TONS_OF_ADDONS::EQUAP_SKILLS && DISPLAY_AP_REQ
  1435.       aps = BlizzCFG.maxap(@data[i].id)
  1436.       if aps > 0
  1437.         text += " (#{@actor.ap(@data[i].id)}/#{aps})"
  1438.       elsif DISPLAY_AP_ZERO
  1439.         text += ' (0/0)'
  1440.       end
  1441.     end
  1442.     self.contents.draw_text(32, i*32, 204, 32, text)
  1443.     if @data[i].sp_cost > 0
  1444.       sp_cost = @data[i].sp_cost
  1445.       if tons >= 6.54 && $game_system.SP_COST_MOD
  1446.         sp_cost = BlizzCFG.get_cost_mod(@actor.states, sp_cost)
  1447.       end
  1448.       self.contents.draw_text(292, i*32, 48, 32, sp_cost.to_s, 2)
  1449.     end
  1450.   end
  1451.  
  1452. end
  1453.  
  1454. #==============================================================================
  1455. # Window_CMSEquipLeft
  1456. #==============================================================================
  1457.  
  1458. class Window_CMSEquipLeft < Window_Base
  1459.  
  1460.   attr_accessor :mode
  1461.   attr_accessor :current
  1462.   attr_accessor :changed
  1463.  
  1464.   def initialize(actor)
  1465.     @background = 'CMSEquipLeft'
  1466.     super(640, 64, 288, 416)
  1467.     self.contents = Bitmap.new(width - 32, height - 32)
  1468.     @current = @changed = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  1469.     @elements, @states, @actor, @mode, self.z = [], [], actor, 0, 2999
  1470.     refresh
  1471.   end
  1472.  
  1473.   def update_actor(actor)
  1474.     @actor = actor
  1475.     refresh
  1476.   end
  1477.  
  1478.   def draw_actor_hp(actor, x, y, width = 144)
  1479.     self.contents.font.color = system_color
  1480.     self.contents.draw_text(x, y, 96, 32, "max #{$data_system.words.hp}")
  1481.     self.contents.font.color = normal_color
  1482.     self.contents.draw_text(x + 108, y, 48, 32, actor.maxhp.to_s, 2)
  1483.   end
  1484.    
  1485.   def draw_actor_sp(actor, x, y, width = 144)
  1486.     self.contents.font.color = system_color
  1487.     self.contents.draw_text(x, y, 96, 32, "max #{$data_system.words.sp}")
  1488.     self.contents.font.color = normal_color
  1489.     self.contents.draw_text(x + 108, y, 48, 32, actor.maxsp.to_s, 2)
  1490.   end
  1491.    
  1492.   def element_states_refresh
  1493.     self.contents.fill_rect(4, 276, 256, 108, Color.new(0, 0, 0, 0))
  1494.     if @mode == 0
  1495.       self.contents.font.color = up_color
  1496.       self.contents.draw_text(4, 276, 200, 32, 'Elemental attack:')
  1497.       self.contents.draw_text(4, 324, 200, 32, 'Status attack:')
  1498.     elsif @mode == 1
  1499.       self.contents.font.color = up_color
  1500.       self.contents.draw_text(4, 276, 200, 32, 'Elemental resistance:')
  1501.       self.contents.draw_text(4, 324, 200, 32, 'Status resistance:')
  1502.     end
  1503.     self.contents.font.color = normal_color
  1504.     draw_elements(4, 300)
  1505.     draw_states(4, 348)
  1506.   end
  1507.  
  1508.   def refresh
  1509.     self.contents.clear
  1510.     draw_actor_name(@actor, 4, 0)
  1511.     draw_actor_level(@actor, 180, 0)
  1512.     draw_actor_hp(@actor, 4, 28)
  1513.     draw_actor_sp(@actor, 4, 52)
  1514.     (0..7).each {|i| draw_actor_parameter(@actor, 4, 76 + i*24, i)}
  1515.     element_states_refresh
  1516.     @current.each_index {|i|
  1517.         val = @current[i] - @changed[i]
  1518.         if val != 0
  1519.           self.contents.font.color = system_color
  1520.           self.contents.draw_text(162, 28+i*24, 40, 32, '»»', 1)
  1521.           self.contents.font.color = (val > 0 ? down_color : up_color)
  1522.           self.contents.draw_text(204, 28+i*24, 48, 32, @changed[i].abs.to_s, 2)
  1523.         end}
  1524.   end
  1525.  
  1526.   def set_new_parameters(elements, states)
  1527.     @elements, @states = elements - $DUMMY_ELEMENTS, states - $DUMMY_STATES
  1528.     refresh
  1529.   end
  1530.  
  1531.   def draw_elements(x, y)
  1532.     @elements.each_index {|i|
  1533.         icon = RPG::Cache.icon("CMS/elm_#{$data_system.elements[@elements[i]].downcase}")
  1534.         self.contents.blt(x + i*28, y + 4, icon, Rect.new(0, 0, 24, 24))}
  1535.   end
  1536.  
  1537.   def draw_states(x, y)
  1538.     @states.each_index {|i|
  1539.         icon = RPG::Cache.icon("CMS/stat_#{$data_states[@states[i]].name.downcase}")
  1540.         self.contents.blt(x + i*28, y + 4, icon, Rect.new(0, 0, 24, 24))}
  1541.   end
  1542.  
  1543. end
  1544.  
  1545. #==============================================================================
  1546. # Window_CMSEquipRight
  1547. #==============================================================================
  1548.  
  1549. class Window_CMSEquipRight < Window_Selectable
  1550.  
  1551.   def initialize(actor)
  1552.     @background = 'CMSEquipRight'
  1553.     super(928, 64, 352, 192)
  1554.     self.contents = Bitmap.new(width - 32, height - 32)
  1555.     @actor, self.active, self.z, self.index = actor, true, 2999, 0
  1556.     refresh
  1557.   end
  1558.  
  1559.   def data
  1560.     return @data[self.index]
  1561.   end
  1562.  
  1563.   def update_actor(actor)
  1564.     @actor = actor
  1565.     refresh
  1566.   end
  1567.  
  1568.   def refresh
  1569.     self.contents.clear
  1570.     @data = []
  1571.     @data.push($data_weapons[@actor.weapon_id])
  1572.     @data.push($data_armors[@actor.armor1_id])
  1573.     @data.push($data_armors[@actor.armor2_id])
  1574.     @data.push($data_armors[@actor.armor3_id])
  1575.     @data.push($data_armors[@actor.armor4_id])
  1576.     @item_max = @data.size
  1577.     self.contents.font.color = system_color
  1578.     self.contents.draw_text(4, 32 * 0, 120, 32, $data_system.words.weapon)
  1579.     self.contents.draw_text(4, 32 * 1, 120, 32, $data_system.words.armor1)
  1580.     self.contents.draw_text(4, 32 * 2, 120, 32, $data_system.words.armor2)
  1581.     self.contents.draw_text(4, 32 * 3, 120, 32, $data_system.words.armor3)
  1582.     self.contents.draw_text(4, 32 * 4, 120, 32, $data_system.words.armor4)
  1583.     (0...5).each {|i| draw_item_name(@data[i], 120, 32 * i)}
  1584.   end
  1585.  
  1586.   def update_help
  1587.     @help_window.set_text(data == nil ? '' : data.description)
  1588.     @help_window.weapon = self.data
  1589.   end
  1590.  
  1591. end
  1592.  
  1593. #==============================================================================
  1594. # Window_CMSEquipItem
  1595. #==============================================================================
  1596.  
  1597. class Window_CMSEquipItem < Window_Selectable
  1598.  
  1599.   def initialize(actor, equip_type)
  1600.     @background = 'CMSEquipItem'
  1601.     super(928, 256, 352, 224)
  1602.     self.active = self.visible = false
  1603.     @actor, @equip_type, self.z, self.index = actor, equip_type, 3000, -1
  1604.     refresh
  1605.   end
  1606.  
  1607.   def data
  1608.     return @data[self.index]
  1609.   end
  1610.  
  1611.   def update_actor(actor, equip_type)
  1612.    @actor = actor
  1613.    @equip_type = equip_type
  1614.    refresh
  1615.  end
  1616.  
  1617.   def refresh
  1618.     if self.contents != nil
  1619.       self.contents.dispose
  1620.       self.contents = nil
  1621.     end
  1622.     @data = []
  1623.     if @equip_type == 0
  1624.       weapon_set = $data_classes[@actor.class_id].weapon_set
  1625.       (1...$data_weapons.size).each {|i|
  1626.           if $game_party.weapon_number(i) > 0
  1627.             id = i
  1628.             if $charlie_fleed_enhanced_equipment &&
  1629.                 i > $game_party.max_database_weapon_id
  1630.               id = $data_weapons[i].ref_id
  1631.             end
  1632.             @data.push($data_weapons[i]) if weapon_set.include?(id)
  1633.           end}
  1634.     else
  1635.       armor_set = $data_classes[@actor.class_id].armor_set
  1636.       (1...$data_armors.size).each {|i|
  1637.           if $data_armors[i].kind == @equip_type - 1 &&
  1638.               $game_party.armor_number(i) > 0
  1639.             id = i
  1640.             if $charlie_fleed_enhanced_equipment &&
  1641.                 i > $game_party.max_database_armor_id
  1642.               id = $data_armors[i].ref_id
  1643.             end
  1644.             @data.push($data_armors[i]) if armor_set.include?(id)
  1645.           end}
  1646.     end
  1647.     @data.push(nil)
  1648.     @item_max = @data.size
  1649.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  1650.     (0...@item_max-1).each {|i| draw_item(i)}
  1651.     self.contents.font.color = system_color
  1652.     self.contents.draw_text(4, (@item_max-1)*32, 100, 32, '[Unequip]')
  1653.   end
  1654.  
  1655.   def draw_item(i)
  1656.     number = case @data[i]
  1657.     when RPG::Weapon then $game_party.weapon_number(@data[i].id)
  1658.     when RPG::Armor then $game_party.armor_number(@data[i].id)
  1659.     end
  1660.     self.contents.font.color = normal_color
  1661.     bitmap = RPG::Cache.icon(@data[i].icon_name)
  1662.     self.contents.blt(4, 4 + i*32, bitmap, Rect.new(0, 0, 24, 24))
  1663.     self.contents.draw_text(32, i*32, 212, 32, @data[i].name, 0)
  1664.     self.contents.draw_text(212, i*32, 16, 32, ':', 1)
  1665.     self.contents.draw_text(228, i*32, 24, 32, number.to_s, 2)
  1666.   end
  1667.  
  1668.   def update_help
  1669.     @help_window.set_text(data == nil ? '' : data.description)
  1670.     @help_window.weapon = self.data
  1671.   end
  1672.  
  1673. end
  1674.  
  1675. #==============================================================================
  1676. # Window_CMSStatus
  1677. #==============================================================================
  1678.  
  1679. class Window_CMSStatus < Window_Base
  1680.  
  1681.   def initialize(actor)
  1682.     @background = 'CMSFullscreen'
  1683.     super(0, 512, 640, 480)
  1684.     self.contents = Bitmap.new(width - 32, height - 32)
  1685.     @actor, self.active, self.z = actor, true, 2999
  1686.     refresh
  1687.   end
  1688.  
  1689.   def refresh
  1690.     self.contents.clear
  1691.     self.contents.font.color = normal_color
  1692.     self.contents.draw_text(224, 0, 120, 32, @actor.name, 1)
  1693.     draw_actor_battler(@actor, 284, 232)
  1694.     draw_actor_class(@actor, 400, 32)
  1695.     draw_actor_level(@actor, 400, 0)
  1696.     draw_actor_state(@actor, 400, 64, 168)
  1697.     draw_actor_hp(@actor, 400, 92, 172)
  1698.     draw_actor_sp(@actor, 400, 122, 172)
  1699.     if $crls
  1700.       if BlizzCFG::DRAW_SR_BAR
  1701.         draw_actor_sr_with_bar(@actor, 400, 152, 172)
  1702.       else
  1703.         draw_actor_sr(@actor, 400, 152, 172)
  1704.       end
  1705.       draw_actor_exp(@actor, 400, 182, 172)
  1706.     else
  1707.       draw_actor_exp(@actor, 400, 152, 172)
  1708.     end
  1709.     (0..7).each {|i| draw_actor_parameter(@actor, 4, i*28, i)}
  1710.     self.contents.font.color = system_color
  1711.     w = self.contents.text_size('Elemental Vulnerability').width
  1712.     self.contents.draw_text(365, 244, w, 32, 'Elemental Vulnerability')
  1713.     self.contents.font.size -= 4
  1714.     draw_actor_element_vulnerability(@actor, 320, 268)
  1715.     self.contents.font.size += 4
  1716.     self.contents.font.color = system_color
  1717.     self.contents.draw_text(84, 244, 96, 32, 'Equipment')
  1718.     self.contents.draw_text(4, 276, 96, 32, $data_system.words.weapon)
  1719.     self.contents.draw_text(4, 308, 96, 32, $data_system.words.armor1)
  1720.     self.contents.draw_text(4, 340, 96, 32, $data_system.words.armor2)
  1721.     self.contents.draw_text(4, 372, 96, 32, $data_system.words.armor3)
  1722.     self.contents.draw_text(4, 404, 96, 32, $data_system.words.armor4)
  1723.     equips = [$data_weapons[@actor.weapon_id], $data_armors[@actor.armor1_id],
  1724.         $data_armors[@actor.armor2_id], $data_armors[@actor.armor3_id],
  1725.         $data_armors[@actor.armor4_id]]
  1726.     equips.each_index {|i|
  1727.         unless equips[i].nil?#@actor.equippable?(equips[i])
  1728.           draw_item_name(equips[i], 108, 276 + i*32)
  1729.         else
  1730.           self.contents.font.color = (i == 0 ? knockout_color : crisis_color)
  1731.           self.contents.draw_text(108, 276 + i*32, 192, 32, 'Nothing equipped')
  1732.         end}
  1733.   end
  1734.  
  1735.   def update_actor(actor)
  1736.     @actor = actor
  1737.     refresh
  1738.   end
  1739.  
  1740. end
  1741.  
  1742. #==============================================================================
  1743. # Window_CMSSortCommand
  1744. #==============================================================================
  1745.  
  1746. class Window_CMSSortCommand < Window_Command
  1747.  
  1748.   def initialize
  1749.     @background = 'CMSMini'
  1750.     super(180, ['Standard', 'by quantity', 'by alphabet'])
  1751.     self.x, self.y, self.z = 224, -128, 9999
  1752.   end
  1753.  
  1754. end
  1755.  
  1756. #==============================================================================
  1757. # Window_CMSEndCommand
  1758. #==============================================================================
  1759.  
  1760. class Window_CMSEndCommand < Window_Command
  1761.  
  1762.   def initialize
  1763.     @background = 'CMSMini'
  1764.     super(180, ['Back to game', 'Back to title', 'Exit game'])
  1765.     self.x, self.y, self.z = 460, 524, 3999
  1766.   end
  1767.  
  1768. end
  1769.  
  1770. #==============================================================================
  1771. # Window_CMSInfo
  1772. #==============================================================================
  1773.  
  1774. class Window_CMSInfo < Window_Base
  1775.  
  1776.   def initialize
  1777.     @background = 'CMSInfo'
  1778.     super(0, 0, 180, 160)
  1779.     self.contents = Bitmap.new(width - 32, height - 32)
  1780.     self.active, self.x, self.y, self.z = false, 460, 832, 1999
  1781.     refresh
  1782.   end
  1783.  
  1784.   def refresh
  1785.     self.contents.clear
  1786.     self.contents.font.name = $game_system.fontname
  1787.     @double_sec = Graphics.frame_count * 2 / Graphics.frame_rate
  1788.     total_sec = @double_sec / 2
  1789.     hour, min, sec = total_sec / 60 / 60, total_sec / 60 % 60, total_sec % 60
  1790.     if @double_sec % 2 == 1
  1791.       text = sprintf('%02d %02d %02d', hour, min, sec)
  1792.     else
  1793.       text = sprintf('%02d:%02d:%02d', hour, min, sec)
  1794.     end
  1795.     self.contents.font.color = system_color
  1796.     cx = contents.text_size($data_system.words.gold).width
  1797.     self.contents.draw_text(148-cx, 32, cx, 32, $data_system.words.gold, 2)
  1798.     self.contents.draw_text(0, 64, 148, 32, 'Location:')
  1799.     self.contents.font.color = normal_color
  1800.     self.contents.draw_text(0, 0, 148, 32, text, 1)
  1801.     self.contents.draw_text(0, 32, 144-cx, 32, $game_party.gold.to_s, 2)
  1802.     self.contents.draw_text(0, 96, 148, 32, $game_map.name, 2)
  1803.   end
  1804.  
  1805.   def update
  1806.     super
  1807.     refresh if Graphics.frame_count * 2 / Graphics.frame_rate != @double_sec
  1808.   end
  1809.  
  1810. end
  1811.  
  1812. #==============================================================================
  1813. # Window_CMSMenuStatus
  1814. #==============================================================================
  1815.  
  1816. class Window_CMSMenuStatus < Window_Base
  1817.  
  1818.   attr_reader :index
  1819.   attr_reader :actor
  1820.   attr_reader :dir
  1821.  
  1822.   def initialize(actor)
  1823.     @background = 'CMSMenuStatus'
  1824.     super(0, 0, 460, 120)
  1825.     self.contents = Bitmap.new(width - 32, height - 32)
  1826.     @actor = actor
  1827.     @dir = 0
  1828.     refresh
  1829.     self.active = false
  1830.     self.index = -1
  1831.     self.x, self.y, self.z = -512, @actor.index * 120, 999
  1832.   end
  1833.  
  1834.   def index=(i)
  1835.     @index = i
  1836.     update_cursor_rect
  1837.   end
  1838.  
  1839.   def refresh
  1840.     self.contents.clear
  1841.     self.contents.font.name = $game_system.fontname
  1842.     self.contents.font.color = normal_color
  1843.     draw_actor_graphic(@actor, 56, 80)
  1844.     draw_actor_name2(@actor, 8, 0, 88, 1)
  1845.     draw_actor_level(@actor, 104, 0)
  1846.     draw_actor_state(@actor, 168, 0, 252)
  1847.     draw_actor_hp(@actor, 104, 28)
  1848.     draw_actor_sp(@actor, 272, 28)
  1849.     draw_actor_exp_alt(@actor, 272, 56)
  1850.     if $crls
  1851.       if BlizzCFG::DRAW_SR_BAR
  1852.         draw_actor_sr_with_bar(@actor, 104, 56)
  1853.       else
  1854.         draw_actor_sr(@actor, 104, 56)
  1855.       end
  1856.     end
  1857.   end
  1858.  
  1859.   def dir=(val)
  1860.     self.y -= val*56
  1861.     @dir = val
  1862.   end
  1863.  
  1864.   def update(i = @actor.index - 1)
  1865.     if @actor.index == i
  1866.       self.index = 0 if self.index == -1
  1867.     else
  1868.       self.index = -1 if self.index == 0
  1869.     end
  1870.     self.y = @actor.index*120 unless self.active
  1871.     @dir = 0 if self.y / 120 * 120 == self.y
  1872.     super()
  1873.   end
  1874.  
  1875.   def update_cursor_rect
  1876.     if @index < 0
  1877.       self.cursor_rect.empty
  1878.     else
  1879.       self.cursor_rect.set(0, 0, width - 32, height - 32)
  1880.     end
  1881.   end
  1882.  
  1883. end
  1884.  
  1885. #==============================================================================
  1886. # Scene_Menu
  1887. #==============================================================================
  1888.  
  1889. class Scene_Menu
  1890.  
  1891.   def initialize(menu_index = 0)
  1892.     @menu_index = menu_index
  1893.     @actor_index = @target_index = -1
  1894.     @viewport1 = Viewport.new(0, 0, 640, 480)
  1895.     @moved = false
  1896.   end
  1897.  
  1898.   def main
  1899.     if BlizzCFG::MAP_BACKGROUND
  1900.       @spriteset = Spriteset_Map.new
  1901.     elsif BlizzCFG::CMS_EDITION
  1902.       @spriteset = Sprite.new
  1903.       @spriteset.bitmap = RPG::Cache.picture("CMS/#{BlizzCFG::CMS_EDITION}/CMSFullscreen")
  1904.     end
  1905.     continue = ((1..BlizzCFG::SAVE_FILES_NUMBER).any? {|i|
  1906.         FileTest.exist?("#{BlizzCFG::SAVE_NAME}#{i}.#{BlizzCFG::SAVE_EXTENSION}")})
  1907.     @command_window = Window_CMSCommand.new(@menu_index, continue)
  1908.     (0...5).each {|i| @command_window.disable_item(i)} if $game_party.actors.size == 0
  1909.     @command_window.disable_item(6) if $game_system.save_disabled
  1910.     @command_window.disable_item(7) unless @command_window.continue
  1911.     @info_window = Window_CMSInfo.new
  1912.     @status_windows, @target_windows = [], []
  1913.     $game_party.actors.each {|actor|
  1914.         @status_windows.push(Window_CMSMenuStatus.new(actor))}
  1915.     @help_window = Window_Help.new
  1916.     @help_window.x, @help_window.y, @help_window.z = 0, -368, 9999
  1917.     Graphics.transition
  1918.     loop do
  1919.       Graphics.update
  1920.       Input.update
  1921.       update
  1922.       break if @scene != nil || $scene != self
  1923.     end
  1924.     loop do
  1925.       Graphics.update
  1926.       (@status_windows + [@command_window, @info_window]).each {|win| win.update}
  1927.       move_win_outro
  1928.       break if @status_windows[0].x <= - 512
  1929.     end
  1930.     Graphics.freeze
  1931.     (@status_windows + @target_windows + [@command_window, @info_window,
  1932.         @help_window, @spriteset]).each {|obj| obj.dispose if obj != nil}
  1933.     del_sort if @sort_window != nil
  1934.     del_status if @playerstatus_window != nil
  1935.     del_equip if @left_window != nil
  1936.     del_skill if @skill_window != nil
  1937.     del_end if @end_window != nil
  1938.     del_items if @item_choose_window != nil
  1939.     del_equipment if @equips_window != nil
  1940.     del_options if @options_window != nil
  1941.     if @scene.is_a?(Scene_Title)
  1942.       Graphics.transition(25)
  1943.       Graphics.freeze
  1944.     end
  1945.     $scene = @scene
  1946.   end
  1947.  
  1948.   def equip_refresh
  1949.     if @item_window.active
  1950.       item = @item_window.data
  1951.       last_hp, last_sp = @actor.hp, @actor.sp
  1952.       @left_window.current = [@actor.maxhp, @actor.maxsp, @actor.atk,
  1953.           @actor.pdef, @actor.mdef, @actor.str, @actor.dex, @actor.agi,
  1954.           @actor.int, @actor.eva]
  1955.       @left_window.changed = @actor.test_equip(@right_window.index, item == nil ? 0 : item.id)
  1956.       @actor.hp, @actor.sp = last_hp, last_sp
  1957.     else
  1958.       item = @right_window.data
  1959.       @left_window.current = @left_window.changed = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  1960.     end
  1961.     elements = (item.is_a?(RPG::Weapon) ? item.element_set :
  1962.         (item.is_a?(RPG::Armor) ? item.guard_element_set : []))
  1963.     states = (item.is_a?(RPG::Weapon) ? item.plus_state_set :
  1964.         (item.is_a?(RPG::Armor) ? item.guard_state_set : []))
  1965.     @left_window.set_new_parameters(elements, states)
  1966.     @left_window.refresh
  1967.   end
  1968.  
  1969.   def element_states_refresh
  1970.     item = @right_window.data
  1971.     elements = (item.is_a?(RPG::Weapon) ? item.element_set :
  1972.         (item.is_a?(RPG::Armor) ? item.guard_element_set : []))
  1973.     states = (item.is_a?(RPG::Weapon) ? item.plus_state_set :
  1974.         (item.is_a?(RPG::Armor) ? item.guard_state_set : []))
  1975.     @left_window.set_new_parameters(elements, states)
  1976.     @left_window.element_states_refresh
  1977.   end
  1978.  
  1979.   def del_sort
  1980.     @sort_window.dispose
  1981.     @sort_window = nil
  1982.   end
  1983.  
  1984.   def del_status
  1985.     @playerstatus_window.dispose
  1986.     @playerstatus_window = nil
  1987.   end
  1988.  
  1989.   def del_equip
  1990.     @left_window.dispose
  1991.     @right_window.dispose
  1992.     @item_windows.each {|win| win.dispose}
  1993.     @left_window = @right_window = @item_window = @item_windows = nil
  1994.   end
  1995.  
  1996.   def del_skill
  1997.     @skill_window.dispose
  1998.     @skill_window = nil
  1999.   end
  2000.  
  2001.   def del_target
  2002.     @target_windows.each {|win| win.dispose}
  2003.     @target_windows = []
  2004.   end
  2005.  
  2006.   def del_end
  2007.     @end_window.dispose
  2008.     @end_window = nil
  2009.   end
  2010.  
  2011.   def del_items
  2012.     @items_window1.dispose
  2013.     @items_window1 = nil
  2014.     @items_window2.dispose
  2015.     @items_window2 = nil
  2016.     @item_choose_window.dispose
  2017.     @item_choose_window = nil
  2018.   end
  2019.  
  2020.   def del_equipment
  2021.     @equips_window.dispose
  2022.     @equips_window = nil
  2023.     del_target
  2024.   end
  2025.  
  2026.   def del_options
  2027.     @options_window.dispose
  2028.     @options_window = nil
  2029.   end
  2030.  
  2031.   def update
  2032.     @status_windows.each {|win| win.update(@actor_index)}
  2033.     @target_windows.each {|win| win.update(@target_index)}
  2034.     @info_window.update
  2035.     unless @status_windows[0].x < 0 || @status_windows[0].dir != 0 ||
  2036.         @target_windows[0] != nil && @target_windows[0].dir != 0
  2037.       @command_window.update
  2038.       [@help_window, @equips_window, @item_choose_window, @sort_window,
  2039.       @skill_window, @left_window, @right_window, @playerstatus_window,
  2040.       @options_window, @end_window].each {|win| win.update if win != nil}
  2041.     end
  2042.     move_win_main if @status_windows[0].x < 0
  2043.     move_win_selection if @status_windows[0].dir != 0
  2044.     move_win_targeting if @target_windows[0] != nil && @target_windows[0].dir != 0
  2045.     move_win_status if @playerstatus_window != nil && @playerstatus_window.y > 0
  2046.     move_win_equip if @left_window != nil && @left_window.x > 0
  2047.     move_win_skill if @skill_window != nil && @skill_window.x < 256
  2048.     move_win_target if @target_windows[0] != nil && @target_windows[0].x < 0
  2049.     move_win_items if @item_choose_window != nil && @item_choose_window.y < 0
  2050.     move_win_sort if @sort_window != nil && @sort_window.y < 64
  2051.     move_win_equipment if @equips_window != nil && @equips_window.y < 64
  2052.     move_win_options if @options_window != nil && @options_window.y > 0
  2053.     move_win_end if @end_window != nil && @end_window.y > 336
  2054.     if @moved
  2055.       @moved = false
  2056.       return
  2057.     end
  2058.     if @equips_window != nil
  2059.       update_equipment
  2060.     elsif @command_window.active
  2061.       update_command
  2062.     elsif @status_windows[0].active
  2063.       update_status
  2064.     elsif @item_choose_window != nil
  2065.       if @item_choose_window.active
  2066.         items_refresh
  2067.         update_items_choose
  2068.       elsif @sort_window != nil && @sort_window.active
  2069.         update_sort
  2070.       elsif @items_window1 != nil && @items_window1.active
  2071.         @items_window1.update
  2072.         update_item
  2073.       elsif @items_window2 != nil && @items_window2.active
  2074.         @items_window2.update
  2075.         update_item
  2076.       elsif @target_windows[0] != nil && @target_windows[0].active
  2077.         update_item_target
  2078.       end
  2079.     elsif @skill_window != nil && @skill_window.active
  2080.       update_skill
  2081.     elsif @target_windows[0] != nil && @target_windows[0].active
  2082.       update_skill_target
  2083.     elsif @right_window != nil
  2084.       if @right_window.active
  2085.         update_right_equip
  2086.       elsif @item_window != nil && @item_window.active
  2087.         @item_window.update
  2088.         update_eitem
  2089.       end
  2090.     elsif @playerstatus_window != nil && @playerstatus_window.active
  2091.       update_playerstatus
  2092.     elsif @options_window != nil && @options_window.active
  2093.       update_options
  2094.     elsif @end_window != nil
  2095.       update_end
  2096.     end
  2097.   end
  2098.  
  2099.   def move_windows(wins, border, mdiff, lead, xy, acc = false)
  2100.     if acc
  2101.       diff = [[((xy ? lead.x : lead.y)-border).abs, mdiff].min, 1].max
  2102.     else
  2103.       diff = [[((xy ? lead.x : lead.y)-border).abs/2, mdiff].min, 1].max
  2104.     end
  2105.     wins[0].each {|win| win.x += diff if win != nil}
  2106.     wins[1].each {|win| win.x -= diff if win != nil}
  2107.     wins[2].each {|win| win.y += diff if win != nil}
  2108.     wins[3].each {|win| win.y -= diff if win != nil}
  2109.     @moved = true
  2110.   end
  2111.  
  2112.   def move_win_main
  2113.     lead = @status_windows[0]
  2114.     x_plus = @status_windows
  2115.     x_minus = [@command_window]
  2116.     y_minus = [@info_window]
  2117.     move_windows([x_plus, x_minus, [], y_minus], 0, 128, lead, true)
  2118.   end
  2119.  
  2120.   def move_win_outro
  2121.     @flag = true
  2122.     lead = @status_windows[0]
  2123.     x_plus = [@command_window]
  2124.     x_minus = @status_windows + @target_windows + [@skill_window, @help_window]
  2125.     y_plus = [@info_window]
  2126.     y_minus = [@item_choose_window, @items_window1, @items_window2, @help_window]
  2127.     move_windows([x_plus, x_minus, y_plus, y_minus], 0, 128, lead, true, true)
  2128.   end
  2129.  
  2130.   def move_win_selection(lead = @status_windows[@actor_index])
  2131.     if lead.dir == 1
  2132.       move_windows([[], [], [], @status_windows], 360, 32, lead, false)
  2133.     else
  2134.       move_windows([[], [], @status_windows, []], 0, 32, lead, false)
  2135.     end
  2136.   end
  2137.  
  2138.   def move_win_targeting(lead = @target_windows[@target_index])
  2139.     if lead.dir == 1
  2140.       move_windows([[], [], [], @target_windows], 376, 32, lead, false)
  2141.     else
  2142.       move_windows([[], [], @target_windows, []], 64, 32, lead, false)
  2143.     end
  2144.   end
  2145.  
  2146.   def move_win_sort(win = @sort_window)
  2147.     move_windows([[], [], [win], []], 64, 32, win, false)
  2148.   end
  2149.  
  2150.   def move_win_status(win = @playerstatus_window)
  2151.     move_windows([[], [], [], [win]], 0, 64, win, false)
  2152.   end
  2153.  
  2154.   def move_win_equip(win = @left_window)
  2155.     x_minus = [@left_window, @right_window, @help_window] + @item_windows
  2156.     move_windows([[], x_minus, [], []], 0, 64, win, true)
  2157.   end  
  2158.    
  2159.   def move_win_skill(win = @skill_window)
  2160.     x_plus = [@skill_window, @help_window]
  2161.     move_windows([x_plus, [], [], []], 256, 64, win, true)
  2162.   end
  2163.  
  2164.   def move_win_target(win = @target_windows[0])
  2165.     move_windows([@target_windows, [], [], []], 0, 32, win, true)
  2166.   end
  2167.  
  2168.   def move_win_items(win = @item_choose_window)
  2169.     y_plus = [@item_choose_window, @items_window1, @items_window2, @help_window]
  2170.     move_windows([[], [], y_plus, []], 0, 64, win, false)
  2171.   end
  2172.  
  2173.   def move_win_equipment(win = @equips_window)
  2174.     y_plus = [@equips_window, @help_window]
  2175.     move_windows([[], [], y_plus, []], 64, 64, win, false)
  2176.   end
  2177.  
  2178.   def move_win_options(win = @options_window)
  2179.     move_windows([[], [], [], [win]], 0, 64, win, false)
  2180.   end
  2181.  
  2182.   def move_win_end(win = @end_window)
  2183.     move_windows([[], [], [], [win]], 336, 64, win, false)
  2184.   end
  2185.  
  2186.   def update_command
  2187.     if Input.trigger?(Input::B)
  2188.       $game_system.se_play($data_system.cancel_se)
  2189.       @scene = Scene_Map.new
  2190.     elsif Input.trigger?(Input::C)
  2191.       if $game_party.actors.size == 0 && @command_window.index < 5
  2192.         $game_system.se_play($data_system.buzzer_se)
  2193.         return
  2194.       end
  2195.       case @command_window.index
  2196.       when 0
  2197.         $game_system.se_play($data_system.decision_se)
  2198.         if BlizzCFG::CUSTOM_ITEM_SCENE
  2199.           @scene = Scene_Item.new
  2200.         else
  2201.           @item_choose_window = Window_CMSChooseItem.new
  2202.           @items_window1 = Window_NormalItem.new
  2203.           @items_window2 = Window_QuestItem.new
  2204.           @items_window1.help_window = @items_window2.help_window = @help_window
  2205.           @command_window.active = false
  2206.           @help_window.x, @help_window.y = 0, -576
  2207.           @help_window.set_text('')
  2208.           @help_window.visible = false
  2209.           items_refresh
  2210.         end
  2211.       when 1..4
  2212.         $game_system.se_play($data_system.decision_se)
  2213.         @command_window.active = false
  2214.         @status_windows.each {|win| win.active = true}
  2215.         @actor_index = 0
  2216.       when 5
  2217.         $game_system.se_play($data_system.decision_se)
  2218.         if BlizzCFG::CUSTOM_OPTIONS_SCENE
  2219.           @scene = Scene_Options.new
  2220.         else
  2221.           @options_window = Window_CMSOptions.new
  2222.           @command_window.active = false
  2223.         end
  2224.       when 6
  2225.         if $game_system.save_disabled
  2226.           $game_system.se_play($data_system.buzzer_se)
  2227.         else
  2228.           $game_system.se_play($data_system.decision_se)
  2229.           @scene = Scene_CMSSave.new
  2230.           Graphics.transition(0)
  2231.         end
  2232.       when 7
  2233.         if @command_window.continue
  2234.           $game_system.se_play($data_system.decision_se)
  2235.           @scene = Scene_CMSLoad.new
  2236.           Graphics.transition(0)
  2237.         else
  2238.           $game_system.se_play($data_system.buzzer_se)
  2239.         end
  2240.       when 8
  2241.         $game_system.se_play($data_system.decision_se)
  2242.         if BlizzCFG::CUSTOM_END_SCENE
  2243.           @scene = Scene_End.new
  2244.         else
  2245.           @command_window.active = false
  2246.           @end_window = Window_CMSEndCommand.new
  2247.         end
  2248.       end
  2249.     end
  2250.   end
  2251.  
  2252.   def update_status
  2253.     @actor = $game_party.actors[@actor_index]
  2254.     if Input.trigger?(Input::B)
  2255.       $game_system.se_play($data_system.cancel_se)
  2256.       @status_windows.each {|win| win.active, win.index = false, -1}
  2257.       @actor_index = -1
  2258.       @command_window.active = true
  2259.     elsif Input.trigger?(Input::C)
  2260.       case @command_window.index
  2261.       when 1
  2262.         $game_system.se_play($data_system.decision_se)
  2263.         if BlizzCFG::CUSTOM_EQUIPMENT_SCENE
  2264.           @scene = Scene_Equipment.new(@actor_index)
  2265.         else
  2266.           @equips_window = Window_EquipmentItem.new(@actor)
  2267.           @equips_window.help_window = @help_window
  2268.           @target_windows.push(Window_CMSTarget.new(@actor, true))
  2269.           @status_windows.each {|win| win.active = false}
  2270.           @help_window.visible = true
  2271.           @help_window.x, @help_window.y = 0, -612
  2272.         end
  2273.       when 2
  2274.         $game_system.se_play($data_system.decision_se)
  2275.         if BlizzCFG::CUSTOM_EQUIP_SCENE
  2276.           @scene = Scene_Equip.new(@actor_index)
  2277.         else
  2278.           @left_window = Window_CMSEquipLeft.new(@actor)
  2279.           @right_window = Window_CMSEquipRight.new(@actor)
  2280.           @right_window.help_window = @help_window
  2281.           @item_windows = []
  2282.           (0..4).each {|i| win = Window_CMSEquipItem.new(@actor, 4-i)
  2283.               win.help_window = @help_window
  2284.               @item_windows.unshift(win)}
  2285.           @item_windows[0].visible = @help_window.visible = true
  2286.           @help_window.x, @help_window.y = 640, 0
  2287.           @status_windows.each {|win| win.active = false}
  2288.         end
  2289.       when 3
  2290.         if @actor.restriction >= 2
  2291.           $game_system.se_play($data_system.buzzer_se)
  2292.         else
  2293.           $game_system.se_play($data_system.decision_se)
  2294.           if BlizzCFG::CUSTOM_SKILL_SCENE
  2295.             @scene = Scene_Skill.new(@actor_index)
  2296.           else
  2297.             @skill_window = Window_CMSSkill.new(@actor)
  2298.             @skill_window.help_window = @help_window
  2299.             @help_window.visible = true
  2300.             @help_window.x, @help_window.y = -768, 0
  2301.             @status_windows.each {|win| win.active = false}
  2302.           end
  2303.         end
  2304.       when 4
  2305.         $game_system.se_play($data_system.decision_se)
  2306.         if BlizzCFG::CUSTOM_STATUS_SCENE
  2307.           @scene = Scene_Status.new(@actor_index)
  2308.         else
  2309.           @playerstatus_window = Window_CMSStatus.new(@actor)
  2310.           @status_windows.each {|win| win.active = false}
  2311.         end
  2312.       end
  2313.     elsif Input.repeat?(Input::DOWN)
  2314.       $game_system.se_play($data_system.cursor_se)
  2315.       @actor_index = (@actor_index+1) % $game_party.actors.size
  2316.       if @status_windows[@actor_index].y < 0
  2317.         @status_windows.each {|win| win.y += ($game_party.actors.size-4)*120}
  2318.       elsif @status_windows[@actor_index].y >= 480
  2319.         @status_windows.each {|win| win.dir = 1}
  2320.       end
  2321.     elsif Input.repeat?(Input::UP)
  2322.       $game_system.se_play($data_system.cursor_se)
  2323.       @actor_index += $game_party.actors.size-1
  2324.       @actor_index %= $game_party.actors.size
  2325.       if @status_windows[@actor_index].y < 0
  2326.         @status_windows.each {|win| win.dir = -1}
  2327.       elsif @status_windows[@actor_index].y >= 480
  2328.         @status_windows.each {|win| win.y -= ($game_party.actors.size-4)*120}
  2329.       end
  2330.     end
  2331.   end
  2332.  
  2333.   def update_items_choose
  2334.     if Input.trigger?(Input::B)
  2335.       del_items
  2336.       $game_system.se_play($data_system.cancel_se)
  2337.       @command_window.active, @help_window.x, @help_window.y = true, 0, -612
  2338.     elsif Input.trigger?(Input::C)
  2339.       items_refresh
  2340.       @item_choose_window.active = false
  2341.       $game_system.se_play($data_system.decision_se)
  2342.       case @item_choose_window.index
  2343.       when 0
  2344.         @items_window1.active = @help_window.visible = true
  2345.         @items_window1.index = 0
  2346.       when 1 then @sort_window = Window_CMSSortCommand.new
  2347.       when 2
  2348.         @items_window2.active = @help_window.visible = true
  2349.         @items_window2.index = 0
  2350.       end
  2351.     end
  2352.   end
  2353.  
  2354.   def update_sort
  2355.     if Input.trigger?(Input::B)
  2356.       del_sort
  2357.       @item_choose_window.active = true
  2358.       $game_system.se_play($data_system.cancel_se)
  2359.     elsif Input.trigger?(Input::C)
  2360.       $game_system.se_play($data_system.decision_se)
  2361.       @items_window1.mode = case @sort_window.index
  2362.       when 0 then @sort_window.index
  2363.       when 1 then @items_window1.mode == 1 ? 2 : 1
  2364.       when 2 then @items_window1.mode == 3 ? 4 : 3
  2365.       end
  2366.       @items_window1.refresh
  2367.     end
  2368.   end
  2369.  
  2370.   def items_refresh
  2371.     index = @item_choose_window.index
  2372.     @items_window1.visible = [0, 1].include?(index)
  2373.     @items_window2.visible = (index == 2)
  2374.   end
  2375.    
  2376.   def update_equipment
  2377.     if Input.trigger?(Input::B)
  2378.       del_equipment
  2379.       $game_system.se_play($data_system.cancel_se)
  2380.       @actor_index = -1
  2381.       @command_window.active = true
  2382.       @help_window.visible = false
  2383.       @help_window.x, @help_window.y = 0, -612
  2384.     elsif Input.trigger?(Input::RIGHT) || Input.trigger?(Input::LEFT)
  2385.       $game_system.se_play($data_system.cursor_se)
  2386.       if Input.trigger?(Input::RIGHT)
  2387.         @actor_index = (@actor_index+1) % $game_party.actors.size
  2388.       elsif Input.trigger?(Input::LEFT)
  2389.         @actor_index += $game_party.actors.size-1
  2390.         @actor_index %= $game_party.actors.size
  2391.       end
  2392.       @target_windows[0].update_actor($game_party.actors[@actor_index])
  2393.       @equips_window.update_actor($game_party.actors[@actor_index])
  2394.       unless @equips_window.item_max > @equips_window.index
  2395.         @equips_window.index = 0
  2396.       end
  2397.     end
  2398.   end
  2399.  
  2400.   def update_item
  2401.     if Input.trigger?(Input::B)
  2402.       $game_system.se_play($data_system.cancel_se)
  2403.       @item_choose_window.active = true
  2404.       @help_window.set_text('')
  2405.       @items_window1.active = @items_window2.active = @help_window.visible = false
  2406.       @items_window1.index = @items_window2.index = -1
  2407.     elsif Input.trigger?(Input::C)
  2408.       win = (@item_choose_window.index == 0 ? @items_window1 : @items_window2)
  2409.       @item = win.data
  2410.       unless @item.is_a?(RPG::Item) && $game_party.item_can_use?(@item.id)
  2411.         $game_system.se_play($data_system.buzzer_se)
  2412.         return
  2413.       end
  2414.       $game_party.actors.each_index {|i|
  2415.           @target_windows.push(Window_CMSTarget.new($game_party.actors[i]))}
  2416.       @target_index = 0
  2417.       $game_system.se_play($data_system.decision_se)
  2418.       if @item.scope.between?(3, 6)
  2419.         win.active = false
  2420.         @target_windows.each {|win| win.active = true}
  2421.         if [4, 6].include?(@item.scope)
  2422.           @target_windows.each {|win| win.index = -2}
  2423.         else
  2424.           @target_windows[@target_index].index = 0
  2425.         end
  2426.       elsif @item.common_event_id > 0
  2427.         $game_temp.common_event_id = @item.common_event_id
  2428.         $game_system.se_play(@item.menu_se)
  2429.         if @item.consumable
  2430.           $game_party.lose_item(@item.id, 1)
  2431.           win.draw_item(win.index)
  2432.         end
  2433.         (@status_windows + @target_windows).each {|win| win.refresh}
  2434.         @scene = Scene_Map.new
  2435.       elsif @skill.scope == 7
  2436.         $game_system.se_play($data_system.buzzer_se)
  2437.       end
  2438.     end
  2439.   end
  2440.  
  2441.   def update_item_target
  2442.     if Input.trigger?(Input::B)
  2443.       del_target
  2444.       $game_system.se_play($data_system.cancel_se)
  2445.       @target_index = -1
  2446.       @items_window1.refresh unless $game_party.item_can_use?(@item.id)
  2447.       @items_window1.active = true
  2448.     elsif Input.trigger?(Input::C)
  2449.       if $game_party.item_number(@item.id) == 0
  2450.         $game_system.se_play($data_system.buzzer_se)
  2451.         return
  2452.       end
  2453.       if @target_windows[0].index == -2
  2454.         used = false
  2455.         $game_party.actors.each {|actor| used |= actor.item_effect(@item)}
  2456.       elsif @target_index >= 0
  2457.         used = $game_party.actors[@target_index].item_effect(@item)
  2458.       end
  2459.       if used
  2460.         $game_system.se_play(@item.menu_se)
  2461.         if @item.consumable
  2462.           $game_party.lose_item(@item.id, 1)
  2463.           @items_window1.draw_item(@items_window1.index)
  2464.         end
  2465.         (@status_windows + @target_windows).each {|win| win.refresh}
  2466.         if $game_party.all_dead?
  2467.           @scene = Scene_Gameover.new
  2468.         elsif @item.common_event_id > 0
  2469.           $game_temp.common_event_id = @item.common_event_id
  2470.           @scene = Scene_Map.new
  2471.         end
  2472.       else
  2473.         $game_system.se_play($data_system.buzzer_se)
  2474.       end
  2475.     else
  2476.       update_target
  2477.     end
  2478.   end
  2479.  
  2480.   def update_target
  2481.     return if @target_windows[0] == nil || @target_windows[0].index == -2
  2482.     if Input.repeat?(Input::DOWN)
  2483.       $game_system.se_play($data_system.cursor_se)
  2484.       @target_index = (@target_index+1) % $game_party.actors.size
  2485.       if @target_windows[@target_index].y < 64
  2486.         @target_windows.each {|win| win.y += ($game_party.actors.size-4)*104}
  2487.       elsif @target_windows[@target_index].y >= 480
  2488.         @target_windows.each {|win| win.dir = 1}
  2489.       end
  2490.     elsif Input.repeat?(Input::UP)
  2491.       $game_system.se_play($data_system.cursor_se)
  2492.       @target_index += $game_party.actors.size-1
  2493.       @target_index %= $game_party.actors.size
  2494.       if @target_windows[@target_index].y < 64
  2495.         @target_windows.each {|win| win.dir = -1}
  2496.       elsif @target_windows[@target_index].y >= 480
  2497.         @target_windows.each {|win| win.y -= ($game_party.actors.size-4)*104}
  2498.       end
  2499.     end
  2500.   end
  2501.  
  2502.   def update_skill
  2503.     if Input.trigger?(Input::B)
  2504.       del_skill
  2505.       $game_system.se_play($data_system.cancel_se)
  2506.       @help_window.x, @help_window.y = 0, -768
  2507.       @help_window.visible = false
  2508.       @command_window.active = true
  2509.       @actor_index = @target_index = -1
  2510.     elsif Input.trigger?(Input::C)
  2511.       @skill = @skill_window.data
  2512.       if @skill == nil || !@actor.skill_can_use?(@skill.id)
  2513.         $game_system.se_play($data_system.buzzer_se)
  2514.         return
  2515.       end
  2516.       $game_party.actors.each_index {|i|
  2517.           @target_windows.push(Window_CMSTarget.new($game_party.actors[i]))}
  2518.       @target_index = 0
  2519.       $game_system.se_play($data_system.decision_se)
  2520.       if @skill.scope.between?(3, 6)
  2521.         @skill_window.active = false
  2522.         @target_windows.each {|win| win.visible = win.active = true}
  2523.         if [4, 6].include?(@skill.scope)
  2524.           @target_windows.each {|win| win.index = -2}
  2525.         else
  2526.           @target_windows[@target_index].index = 0
  2527.         end
  2528.       elsif @skill.common_event_id > 0
  2529.         $game_temp.common_event_id = @skill.common_event_id
  2530.         $game_system.se_play(@skill.menu_se)
  2531.         @actor.sp -= @skill.sp_cost
  2532.         (@status_windows + @target_windows).each {|win| win.refresh}
  2533.         @skill_window.refresh
  2534.         @scene = Scene_Map.new
  2535.       elsif @skill.scope == 7
  2536.         $game_system.se_play($data_system.buzzer_se)
  2537.       end
  2538.     elsif Input.trigger?(Input::R) || Input.trigger?(Input::L)
  2539.       $game_system.se_play($data_system.cursor_se)
  2540.       if Input.trigger?(Input::R)
  2541.         @actor_index = (@actor_index+1) % $game_party.actors.size
  2542.       elsif Input.trigger?(Input::L)
  2543.         @actor_index += $game_party.actors.size-1
  2544.         @actor_index %= $game_party.actors.size
  2545.       end
  2546.       @actor = $game_party.actors[@actor_index]
  2547.       @skill_window.update_actor(@actor)
  2548.       @skill_window.index = 0
  2549.     end
  2550.   end
  2551.  
  2552.   def update_skill_target
  2553.     if Input.trigger?(Input::B)
  2554.       del_target
  2555.       $game_system.se_play($data_system.cancel_se)
  2556.       @skill_window.active = true
  2557.       @target_index = -1
  2558.     elsif Input.trigger?(Input::C)
  2559.       unless @actor.skill_can_use?(@skill.id)
  2560.         $game_system.se_play($data_system.buzzer_se)
  2561.         return
  2562.       end
  2563.       if @target_windows[0].index == -2
  2564.         used = false
  2565.         $game_party.actors.each {|actor| used |= actor.skill_effect(@actor, @skill)}
  2566.       else
  2567.         used = $game_party.actors[@target_index].skill_effect(@actor, @skill)
  2568.       end
  2569.       if used
  2570.         $game_system.se_play(@skill.menu_se)
  2571.         @actor.sp -= @skill.sp_cost
  2572.         (@status_windows + @target_windows).each {|win| win.refresh}
  2573.         @skill_window.refresh
  2574.         if $game_party.all_dead?
  2575.           @scene = Scene_Gameover.new
  2576.         elsif @skill.common_event_id > 0
  2577.           $game_temp.common_event_id = @skill.common_event_id
  2578.           @scene = Scene_Map.new
  2579.         end
  2580.       else
  2581.         $game_system.se_play($data_system.buzzer_se)
  2582.       end
  2583.     else
  2584.       update_target
  2585.     end
  2586.   end
  2587.  
  2588.   def update_right_equip
  2589.     @item_windows.each_index {|i|
  2590.         @item_windows[i].visible = (@right_window.index == i)}
  2591.     @item_window = @item_windows[@right_window.index]
  2592.     newmode = [@right_window.index, 1].min
  2593.     if newmode != @left_window.mode
  2594.       @left_window.mode = newmode
  2595.       @left_window.refresh
  2596.     end
  2597.     if Input.trigger?(Input::B)
  2598.       del_equip
  2599.       $game_system.se_play($data_system.cancel_se)
  2600.       @help_window.x, @help_window.y = 660, 0
  2601.       @command_window.active = true
  2602.       @actor_index = -1
  2603.     elsif Input.trigger?(Input::C)
  2604.       if @actor.equip_fix?(@right_window.index)
  2605.         $game_system.se_play($data_system.buzzer_se)
  2606.       else
  2607.         $game_system.se_play($data_system.decision_se)
  2608.         @right_window.active = false
  2609.         @item_window.active, @item_window.index = true, 0
  2610.         equip_refresh
  2611.       end
  2612.     elsif Input.trigger?(Input::R) || Input.trigger?(Input::L)
  2613.       $game_system.se_play($data_system.cursor_se)
  2614.       if Input.trigger?(Input::R)
  2615.         @actor_index = (@actor_index+1) % $game_party.actors.size
  2616.       elsif Input.trigger?(Input::L)
  2617.         @actor_index += $game_party.actors.size-1
  2618.         @actor_index %= $game_party.actors.size
  2619.       end
  2620.       @actor = $game_party.actors[@actor_index]
  2621.       @right_window.update_actor(@actor)
  2622.       @left_window.update_actor(@actor)
  2623.       @item_windows.each_index {|i| @item_windows[i].update_actor(@actor, i)}
  2624.     elsif Input.repeat?(Input::UP) || Input.repeat?(Input::DOWN)
  2625.       element_states_refresh
  2626.     end
  2627.   end
  2628.  
  2629.   def update_eitem
  2630.     if Input.trigger?(Input::B)
  2631.       $game_system.se_play($data_system.cancel_se)
  2632.       @right_window.active = true
  2633.       @item_window.active, @item_window.index = false, -1
  2634.       equip_refresh
  2635.     elsif Input.trigger?(Input::C)
  2636.       $game_system.se_play($data_system.equip_se)
  2637.       item = @item_window.data
  2638.       @actor.equip(@right_window.index, item == nil ? 0 : item.id)
  2639.       @right_window.active = true
  2640.       @item_window.active, @item_window.index = false, -1
  2641.       @right_window.refresh
  2642.       @item_window.refresh
  2643.       (@item_windows + @status_windows).each {|win| win.refresh}
  2644.       equip_refresh
  2645.     elsif Input.repeat?(Input::UP) || Input.repeat?(Input::DOWN) ||
  2646.         Input.repeat?(Input::R) || Input.repeat?(Input::L)
  2647.       equip_refresh
  2648.     end
  2649.   end
  2650.  
  2651.   def update_playerstatus
  2652.     if Input.trigger?(Input::B)
  2653.       $game_system.se_play($data_system.cancel_se)
  2654.       @command_window.active = true
  2655.       @actor_index = -1
  2656.       del_status
  2657.     elsif Input.trigger?(Input::R) || Input.trigger?(Input::RIGHT) ||
  2658.         Input.trigger?(Input::L) || Input.trigger?(Input::LEFT)
  2659.       $game_system.se_play($data_system.cursor_se)
  2660.       if Input.trigger?(Input::R) || Input.trigger?(Input::RIGHT)
  2661.         @actor_index = (@actor_index+1) % $game_party.actors.size
  2662.       elsif Input.trigger?(Input::L) || Input.trigger?(Input::LEFT)
  2663.         @actor_index += $game_party.actors.size-1
  2664.         @actor_index %= $game_party.actors.size
  2665.       end
  2666.       @actor = $game_party.actors[@actor_index]
  2667.       @playerstatus_window.update_actor(@actor)
  2668.     end
  2669.   end
  2670.  
  2671.   def update_options
  2672.     if Input.trigger?(Input::B)
  2673.       del_options
  2674.       $game_system.se_play($data_system.cancel_se)
  2675.       @command_window.active = true
  2676.       return
  2677.     end
  2678.     case @options_window.get_option
  2679.     when 'BGM Volume'
  2680.       if Input.repeat?(Input::RIGHT)
  2681.         $game_system.bgm_volume += 5
  2682.         $game_system.bgm_volume = 100 if $game_system.bgm_volume > 100
  2683.         $game_system.bgm_play($game_system.bgm_memorize)
  2684.         @options_window.refresh
  2685.       elsif Input.repeat?(Input::LEFT)
  2686.         $game_system.bgm_volume -= 5
  2687.         $game_system.bgm_volume = 0 if $game_system.bgm_volume < 0
  2688.         $game_system.bgm_play($game_system.bgm_memorize)
  2689.         @options_window.refresh
  2690.       end
  2691.     when 'SFX Volume'
  2692.       if Input.repeat?(Input::RIGHT)
  2693.         $game_system.sfx_volume += 5
  2694.         if $game_system.sfx_volume > 100
  2695.           $game_system.sfx_volume = 100
  2696.         else
  2697.           $game_system.se_play($data_system.cursor_se)
  2698.         end
  2699.         @options_window.refresh
  2700.       elsif Input.repeat?(Input::LEFT)
  2701.         $game_system.sfx_volume -= 5
  2702.         $game_system.sfx_volume = 0 if $game_system.sfx_volume < 0
  2703.         $game_system.se_play($data_system.cursor_se)
  2704.         @options_window.refresh
  2705.       end
  2706.     when 'Battle BGM'
  2707.       if Input.repeat?(Input::LEFT) || Input.repeat?(Input::RIGHT) ||
  2708.           Input.repeat?(Input::C)
  2709.         if $game_switches[BlizzCFG::BGM_Lock] || BlizzCFG::BATTLE_BGMS.size <= 1
  2710.           $game_system.se_play($data_system.buzzer_se)
  2711.         else
  2712.           $game_system.se_play($data_system.decision_se)
  2713.           ind = $game_variables[BlizzCFG::BGM_Variable]
  2714.           if Input.repeat?(Input::RIGHT) || Input.repeat?(Input::C)
  2715.             ind = (ind+1) % BlizzCFG::BATTLE_BGMS.size
  2716.           elsif Input.repeat?(Input::LEFT)
  2717.             ind = (ind+BlizzCFG::BATTLE_BGMS.size-1) % BlizzCFG::BATTLE_BGMS.size
  2718.           end
  2719.           $game_variables[BlizzCFG::BGM_Variable] = ind
  2720.           $game_system.reset_battle_bgm
  2721.           @options_window.refresh
  2722.         end
  2723.       end
  2724.     when 'Battle Cam'
  2725.       if Input.repeat?(Input::LEFT) || Input.repeat?(Input::RIGHT) ||
  2726.           Input.repeat?(Input::C)
  2727.         if BlizzCFG::CAM_AVAILABLE
  2728.           $game_system.se_play($data_system.decision_se)
  2729.           $game_system.cam = ($game_system.cam+1) % 2
  2730.           $game_system.get_cam
  2731.           @options_window.refresh
  2732.         else
  2733.           $game_system.se_play($data_system.buzzer_se)
  2734.         end
  2735.       end
  2736.     when 'Bar Style'
  2737.       if Input.repeat?(Input::RIGHT)
  2738.         if $game_system.bar_opacity == 0
  2739.           $game_system.se_play($data_system.buzzer_se)
  2740.         else
  2741.           $game_system.bar_style = ($game_system.bar_style + 1) % 7
  2742.           $game_system.se_play($data_system.decision_se)
  2743.           @options_window.refresh
  2744.           @status_windows.each {|win| win.refresh}
  2745.         end
  2746.       elsif Input.repeat?(Input::LEFT)
  2747.         if $game_system.bar_opacity == 0
  2748.           $game_system.se_play($data_system.buzzer_se)
  2749.         else
  2750.           $game_system.bar_style = ($game_system.bar_style + 6) % 7
  2751.           $game_system.se_play($data_system.decision_se)
  2752.           @options_window.refresh
  2753.           @status_windows.each {|win| win.refresh}
  2754.         end
  2755.       end
  2756.     when 'Bar Opacity'
  2757.       if Input.repeat?(Input::LEFT) || Input.repeat?(Input::RIGHT)
  2758.         $game_system.se_play($data_system.decision_se)
  2759.         $game_system.bar_opacity += (Input.repeat?(Input::RIGHT) ? 64 : -64)
  2760.         @options_window.refresh
  2761.         @status_windows.each {|win| win.refresh}
  2762.       end
  2763.     when 'Font'
  2764.       if Input.repeat?(Input::RIGHT)
  2765.         $game_system.se_play($data_system.decision_se)
  2766.         @options_window.current_font += 1
  2767.         @options_window.current_font %= BlizzCFG::CMS_FONTS.size
  2768.         @options_window.refresh
  2769.       elsif Input.repeat?(Input::LEFT)
  2770.         $game_system.se_play($data_system.decision_se)
  2771.         @options_window.current_font += BlizzCFG::CMS_FONTS.size - 1
  2772.         @options_window.current_font %= BlizzCFG::CMS_FONTS.size
  2773.         @options_window.refresh
  2774.       elsif Input.repeat?(Input::C)
  2775.         $game_system.se_play($data_system.decision_se)
  2776.         $game_system.fontname = @options_window.font_name
  2777.         @command_window.refresh
  2778.         @info_window.refresh
  2779.         @status_windows.each {|win| win.refresh}
  2780.         @help_window.refresh
  2781.         @options_window.refresh
  2782.         (0...5).each {|i| @command_window.disable_item(i)} if $game_party.actors.size == 0
  2783.         @command_window.disable_item(6) if $game_system.save_disabled
  2784.         @command_window.disable_item(7) unless @command_window.continue
  2785.       end
  2786.     when 'Windowskin'
  2787.       if Input.repeat?(Input::RIGHT)
  2788.         $game_system.se_play($data_system.decision_se)
  2789.         @options_window.current_skin += 1
  2790.         @options_window.current_skin %= BlizzCFG::CMS_SKINS.size
  2791.         @options_window.refresh
  2792.       elsif Input.repeat?(Input::LEFT)
  2793.         $game_system.se_play($data_system.decision_se)
  2794.         @options_window.current_skin += BlizzCFG::CMS_SKINS.size - 1
  2795.         @options_window.current_skin %= BlizzCFG::CMS_SKINS.size
  2796.         @options_window.refresh
  2797.       elsif Input.repeat?(Input::C)
  2798.         $game_system.se_play($data_system.decision_se)
  2799.         $game_system.windowskin_name = @options_window.skin_name
  2800.       end
  2801.     end
  2802.   end
  2803.  
  2804.   def update_end
  2805.     if Input.trigger?(Input::B) || Input.trigger?(Input::C) &&
  2806.         @end_window.index == 0
  2807.       $game_system.se_play($data_system.cancel_se)
  2808.       @command_window.active = true
  2809.       del_end
  2810.     elsif Input.trigger?(Input::C)
  2811.       Graphics.freeze
  2812.       $game_system.se_play($data_system.decision_se)
  2813.       Audio.bgm_fade(800)
  2814.       Audio.bgs_fade(800)
  2815.       Audio.me_fade(800)
  2816.       @end_window.index == 1 ? @scene = Scene_Title.new : $scene = nil
  2817.       del_end
  2818.     end
  2819.   end
  2820.  
  2821. end
  2822.  
  2823. #==============================================================================
  2824. # Scene_CMSSave
  2825. #==============================================================================
  2826.  
  2827. class Scene_CMSSave < Scene_Save
  2828.  
  2829.   def on_cancel
  2830.     $game_system.se_play($data_system.cancel_se)
  2831.     $scene = Scene_Menu.new(6)
  2832.   end
  2833.  
  2834. end
  2835.  
  2836. #==============================================================================
  2837. # Scene_CMSLoad
  2838. #==============================================================================
  2839.  
  2840. class Scene_CMSLoad < Scene_Load
  2841.  
  2842.   def on_cancel
  2843.     $game_system.se_play($data_system.cancel_se)
  2844.     $scene = Scene_Menu.new(7)
  2845.   end
  2846.  
  2847. end
  2848.  
  2849. #==============================================================================
  2850. # Window_Help
  2851. # Addition by KK20
  2852. # Aims to be compatible with Charlie Fleed's Equipment Upgrade System
  2853. #==============================================================================
  2854. class Window_Help < Window_Base
  2855.   alias create_slotshelp initialize
  2856.   def initialize
  2857.     @slots_help_window = Window_EnhanceSlots_Help.new
  2858.     @slots_help_window.z = 10000
  2859.     create_slotshelp
  2860.   end
  2861.  
  2862.   alias setx_slotshelp x=
  2863.   def x=(nx)
  2864.     @slots_help_window.x = 448 + nx
  2865.     setx_slotshelp(nx)
  2866.   end
  2867.  
  2868.   alias sety_slotshelp y=
  2869.   def y=(ny)
  2870.     @slots_help_window.y = ny
  2871.     sety_slotshelp(ny)
  2872.   end
  2873.  
  2874.   def weapon=(wep)
  2875.     @slots_help_window.weapon = wep
  2876.   end
  2877.  
  2878.   alias dispose_slotshelp dispose
  2879.   def dispose
  2880.     @slots_help_window.dispose
  2881.     dispose_slotshelp
  2882.   end
  2883.  
  2884.   alias update_slotshelp update
  2885.   def update
  2886.     @slots_help_window.update
  2887.     update_slotshelp
  2888.   end
  2889.  
  2890.   alias visible_slotshelp visible=
  2891.   def visible=(bool)
  2892.     @slots_help_window.visible = bool
  2893.     unless bool
  2894.       @slots_help_window.weapon = nil
  2895.       @slots_help_window.update
  2896.     end
  2897.     visible_slotshelp(bool)
  2898.   end
  2899.    
  2900. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement