Advertisement
CompanionWulf

Extra Stats Script v3.0 (RMVX)

Jan 17th, 2015
434
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 34.50 KB | None | 0 0
  1. =begin
  2. ==============================================================================
  3.  Extra Stats Script
  4.    Version      : 3.1.6.0
  5.    Platform     : RMVX
  6.    Author       : Companion Wulf
  7.    Release Date : 30 April 2013
  8.    Last Update  : 10 October 2013
  9.    Website      : http://rpgmakertimes.info
  10.    Blog         : http://blog.rpgmakertimes.info
  11.    Contact Email: companionwulf@rpgmakertimes.info
  12.  
  13.    Known Compatability Issues:
  14.      There may only be compatability issues for other scripts that overwrite
  15.      or modify the Scene_Menu class.
  16.      
  17.   Required Modules:
  18.     ● Universal Colors Module
  19.     ● Universal Configuration Settings
  20.  
  21.   COMING SOON
  22.     ● Downloadable demo
  23.     ● Demo video to showcase its features
  24.    
  25.   The Extra Stats Guide is now available in DOC or PDF formats, downloadable
  26.   from RPG Maker Times Companion.
  27. ==============================================================================
  28. =end
  29.  
  30. #==============================================================================
  31. # ** Configuration Settings Module - Extra Stats VX Configuration Settings
  32. #------------------------------------------------------------------------------
  33. # The configuration settings for the Extra Stats script has now been integrated
  34. # into the Universal Configuration Settings module. Please install the module
  35. # and place it at the top of the scripts list.
  36. #==============================================================================
  37.  
  38.  
  39. =begin
  40. ==============================================================================
  41.  VERSION HISTORY
  42. ==============================================================================
  43.  
  44.  The version history tracking will be changing to the following format:
  45.  
  46.      Release.Updates.Developmental.Manual
  47.  
  48.  Release numbers indicate public release versions.
  49.  
  50.  Updates refers to new scripts/scriptlets and new methods that have been
  51.  added. This includes major and minor updates.
  52.  
  53.  Developmental updates are for tweaks or bug fixes.
  54.  
  55.  Manual indicates major updates to the AMCE manual.
  56.  
  57. ------------------------------------------------------------------------------
  58.  Updates Version History
  59. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  60.  I didn't keep accurate version updates with this script, so I've based this
  61.  on the information I have. After Version 2.0.0.0, I kept more regular
  62.  records as I added things to it and made additional tweaks. I also realised
  63.  that I've never released a proper manual for this script (not that it
  64.  necessarily needs one, since it's mostly plug-and-play).
  65. ------------------------------------------------------------------------------
  66.  
  67. #~       ● Add: Total Damage Inflicted } Not implemented yet
  68. #~       ● Add: Total Damage Sustained } but looking into it
  69. #~       ● Add: Total Potions Used     } for future versions
  70.  
  71.     v3.1.6.0 (10-Oct-2013)
  72.       ● Bug Fix: Incorrect gold increase for items sold in shop
  73.     v3.1.5.0 (30-Sep-2013)
  74.       ● Bug Fix: Total gold spent updating twice
  75.       ● Add: Total gold update when gained through Change Gold event command
  76.     v3.1.3.0 (28-Sep-2013)
  77.       ● Stat Added: Number of shops visited
  78.       ● Separated variables into single class (rather than into Game_System)
  79.       ● Add: Universal Configuration Settings checker
  80.       ● Integrated old config settings into Universal Configuration Settings
  81.     v3.0.0.0 (30-Apr-2013)
  82.       ● Release: Version 3.0
  83.     v2.2.12.1 (23-Apr-2013)
  84.       ● Manual: Full manual written
  85.       ● Add: Exp gain from Change EXP event command
  86.     v2.2.11.0 (21-Apr-2013)
  87.       ● Add: Money Spent (in shops) counter
  88.     v2.2.10.0 (20-Apr-2013)
  89.       ● Demo: Began working demo
  90.       ● Bug Fix: Save Menu command index corrected
  91.       ● Bug Fix: Menu commands not pushing properly
  92.       ● Add: Dispose Extra Stats with Keypress alongside default cancel button
  93.     v2.1.7.0 (23-Mar-2013)
  94.       ● Tweak: Extra Stats Window closed with cancel/assigned key (on map)
  95.     v2.1.6.0 (22-Mar-2013)
  96.       ● Bug Fix: Keypress function malfunction
  97.     v2.1.5.0 (18-Mar-2013)
  98.       ● Add: Encounter Ratio value
  99.     v2.1.4.0 (15-Mar-2013)
  100.       ● Add: Number of Party Members
  101.     v2.1.3.0 (28-Jan-2013)
  102.       ● Add: Player Coordinates
  103.     v2.1.2.0 (27-Jan-2013)
  104.       ● Add: Keypress function to display Extra Stats on map
  105.       ● Bug Fix: Total Gold counter
  106.       ● Bug Fix: Total Exp counter
  107.     v2.0.0.0 (20-Jan-2013)
  108.       ● Release Version 2.0
  109.     v1.2.16.0 (06-Sep-2012)
  110.       ● Integrated with Q-Engine
  111.     v1.1.16.0 (??-???-2012)
  112.       ● Bug Fix: Total Gold counter not updating correctly
  113.       ● Bug Fix: Total Exp counter not updating correctly
  114.     v1.1.14.0 (07-Feb-2011)
  115.       ● Stats Added:
  116.         o Total Experience Gained
  117.         o Total Gold Obtained (Battles Only)
  118.         o Number of Chests Opened
  119.         o Number of Keys Found
  120.         o Number of Secrets Found
  121.         o Number of Towns Visited
  122.         o Total Number of Battles
  123.       ● Changed layout and tidied code
  124.     v1.0.7.0 (15-Aug-2010)
  125.       ● Remove: Game Title/Author options in Extra Stats Window
  126.     v1.0.6.0 (??-???-2010)
  127.       ● Add: Map Location
  128.     v1.0.5.0 (07-Jul-2010)
  129.       ● Add: Game Progress Counter
  130.       ● Add: Total Quests/Completed
  131.     v1.0.2.0 (29-Jun-2010)
  132.       ● Add: Total Chests Opened and Total Achievements
  133.     v1.0.1.0 (??-???-2010)
  134.       ● Add: Total Battles
  135.     v1.0.0.0 (18-Jun-2010)
  136.       ● Release: Version 1.0
  137.       ● Stats Added:
  138.         o Number of Saves
  139.         o Number of Inn Stays
  140.         o Number of Steps
  141.         o Total Victories
  142.         o Total Kills
  143.         o Total Escapes
  144.     v0.1.0.0 (15-Jun-2010)
  145.       ● Began the Extra Stats script (ported from RMXP version)
  146. ==============================================================================
  147.  
  148. ==============================================================================
  149.  COPYRIGHT NOTICE
  150. ==============================================================================
  151.  This script is copyrighted to Companion Wulf under the provisions of the
  152.  Digital Millennium Copyright Act (DMCA).
  153.  
  154.  However, permission is granted to use the script in non-commercial projects
  155.  only, provided that credit (to Companion Wulf) is given somewhere in the game.
  156.  Beginning or end credits are fine (or even in the game itself!).
  157.  
  158.  The script cannot be distributed without my express written permission. It is
  159.  only allowed for distribution (at present) on the following websites:
  160.  
  161.     RPG Maker Times               - http://rpgmakertimes.blogspot.com
  162.     RPG Maker Times Companion   - http://blog.rpgmakertimes.info
  163.  
  164.   If you would like to share the script on a website or other forum, write to me
  165.   for permission via RPG Maker Times Companion and the likelihood is I'll grant
  166.   it and add to the list of approved distribution sites.
  167.  
  168.   Not understanding the above conditions, or not understanding English, will not
  169.   exempt you in any way, shape or form.
  170.  
  171.   *For use in commercial projects*, I ask that a nominal fee of $3 for non-
  172.   exclusive rights be paid. This will then go towards domain costs and
  173.   additional scripts.
  174.  
  175.   Please do NOT use that email address for anything other than asking permission
  176.   or, of course, letting me know about your project. ~Wulf
  177. ==============================================================================
  178. =end
  179.  
  180.  
  181. #==============================================================================
  182. # Extra Stats VX Core Engine
  183. #==============================================================================
  184. $imported = {} if $imported == nil
  185. $imported["CWExtraStatsVX"] = true
  186.  
  187.  
  188. #==============================================================================
  189. # ** Game_System
  190. #==============================================================================
  191. class Game_Stats
  192.   #--------------------------------------------------------------------------
  193.   # * Public Instance Variables                                   |--ADDED--|
  194.   #--------------------------------------------------------------------------
  195.   attr_accessor :victory_count      # Number of battles won
  196.   attr_accessor :inn_count          # Number of stays at an inn
  197.   attr_accessor :kill_count         # Number of monsters defeated
  198.   attr_accessor :escape_count       # Number of escapes from battle
  199.   attr_accessor :game_progress      # Game progress percentage
  200.   attr_accessor :chest_count        # Number of chests opened
  201.   attr_accessor :door_count         # Number of doors opened
  202.   attr_accessor :secrets_count      # Number of secrets unlocked
  203.   attr_accessor :town_count         # Number of towns visited
  204.   attr_accessor :battle_count       # Total number of battles won
  205.   attr_accessor :total_exp_count    # Total experience gained
  206.   attr_accessor :total_gold_count   # Total gold obtained
  207.   attr_accessor :total_gold_spent   # Total gold spent (in shops)
  208.   attr_accessor :shop_count         # Number of times shop visited
  209.   #--------------------------------------------------------------------------
  210.   # * Object Initialization                                     |--ALIASED--|
  211.   #--------------------------------------------------------------------------
  212.   def start
  213.     if not $imported["CWUniConfig"]
  214.       p("The Universal Configuration Settings Module is not installed. " +
  215.       "Please make sure it is installed or enabled before the game is run.")
  216.       exit
  217.     end
  218.     # Set up variables
  219.     @victory_count = 0
  220.     @inn_count = 0
  221.     @kill_count = 0
  222.     @escape_count = 0
  223.     @game_progress = 0
  224.     @chest_count = 0
  225.     @door_count = 0
  226.     @secrets_count = 0
  227.     @town_count = 0
  228.     @battle_count = 0
  229.     @total_exp_count = 0
  230.     @total_gold_count = 0
  231.     @total_gold_spent = 0
  232.     @shop_count = 0
  233.   end
  234. end
  235.  
  236. #==============================================================================
  237. # ** Scene_Title
  238. #------------------------------------------------------------------------------
  239. #  This class performs the title screen processing.
  240. #==============================================================================
  241.  
  242. class Scene_Title < Scene_Base
  243.   #--------------------------------------------------------------------------
  244.   # * Start processing
  245.   #--------------------------------------------------------------------------
  246.   alias cwxstat_start start
  247.   def start
  248.     cwxstat_start
  249.     $game_stats.start
  250.   end
  251.   #--------------------------------------------------------------------------
  252.   # * Create Game Objects
  253.   #--------------------------------------------------------------------------
  254.   alias cwxstat_create_objects create_game_objects
  255.   def create_game_objects
  256.     $game_stats         = Game_Stats.new
  257.     cwxstat_create_objects
  258.   end
  259. end
  260.  
  261. #==============================================================================
  262. # ** Game_Map
  263. #==============================================================================
  264. class Game_Map
  265.   #--------------------------------------------------------------------------
  266.   # * Public Instance Variables                                   |--ADDED--|
  267.   #--------------------------------------------------------------------------
  268.   attr_accessor :from_map                 # Set game map flag
  269.   #--------------------------------------------------------------------------
  270.   # * Object Initialization                                     |--ALIASED--|
  271.   #--------------------------------------------------------------------------
  272.   alias cwexs_gmap_initialize initialize
  273.   def initialize
  274.     cwexs_gmap_initialize
  275.     @from_map = false
  276.   end
  277.   #--------------------------------------------------------------------------
  278.   # * Map Name                                                    |--ADDED--|
  279.   #--------------------------------------------------------------------------
  280.   def name
  281.     map_data = load_data("Data/MapInfos.rvdata")
  282.     return map_data[$game_map.map_id].name
  283.   end
  284. end
  285.  
  286. #==============================================================================
  287. # ** Game_Enemy
  288. #==============================================================================
  289. class Game_Enemy < Game_Battler
  290.   #--------------------------------------------------------------------------
  291.   # This adds the "Kill Counter" for each monster defeated      |--ALIASED--|
  292.   #--------------------------------------------------------------------------
  293.   alias cwexs_perform_collapse perform_collapse
  294.   def perform_collapse
  295.     cwexs_perform_collapse
  296.     # Check number of enemies
  297.     $game_stats.kill_count = {} if $game_stats.kill_count == nil
  298.     if $game_stats.kill_count == nil
  299.       $game_stats.kill_count = 0
  300.     end
  301.     # Add to "Kill Count" per monster
  302.     $game_stats.kill_count += 1
  303.   end
  304. end
  305.  
  306. #==============================================================================
  307. # ** Game_Interpreter
  308. #==============================================================================
  309.  
  310. class Game_Interpreter
  311.   include CW_UNIVERSAL_CONFIG if $imported["CWUniConfig"]
  312.   #--------------------------------------------------------------------------
  313.   # * Change EXP                                            |--OVERWRITTEN--|
  314.   #--------------------------------------------------------------------------
  315.   def command_315
  316.     value = operate_value(@params[1], @params[2], @params[3])
  317.     iterate_actor_id(@params[0]) do |actor|
  318.       actor.change_exp(actor.exp + value, @params[4])
  319.     $game_stats.total_exp_count += value if $imported["CWExtraStatsVX"] && EXTRA_STATS
  320.     end
  321.     return true
  322.   end
  323.   #--------------------------------------------------------------------------
  324.   # * Change Gold
  325.   #--------------------------------------------------------------------------
  326.   def command_125
  327.     value = operate_value(@params[0], @params[1], @params[2])
  328.     $game_party.gain_gold(value)
  329.     $game_stats.total_gold_count += value
  330.     return true
  331.   end
  332. end
  333.  
  334. #==============================================================================
  335. # ** Window_Base
  336. #==============================================================================
  337. class Window_Base < Window
  338.   #--------------------------------------------------------------------------
  339.   # * Draw Player Coordinates
  340.   #     x     : Draw x-coordinate
  341.   #     y     : Draw y-coordinate
  342.   #     w     : Content width
  343.   #     h     : Content height
  344.   #     a     : Text alignment
  345.   #--------------------------------------------------------------------------
  346.   def draw_player_coords(x, y, w, h, a = 1)
  347.     @player_x, @player_y = $game_player.x, $game_player.y
  348.     text = "X: "+@player_x.to_s+", Y: "+@player_y.to_s
  349.     self.contents.draw_text(x, y, w, h, text, a)
  350.   end
  351. end
  352.  
  353. #==============================================================================
  354. # ** Window_Stats                                                   |--ADDED--|
  355. #------------------------------------------------------------------------------
  356. #  This is the window for displaying the stats.
  357. #==============================================================================
  358. class Window_Stats < Window_Base
  359.   #--------------------------------------------------------------------------
  360.   # * Object Initialization
  361.   #--------------------------------------------------------------------------
  362.   def initialize(x, y)
  363.     super(0, 0, 544, 416)
  364.     self.contents.font.size = 16
  365.     define_variables
  366.     refresh
  367.   end
  368.   #--------------------------------------------------------------------------
  369.   # * Define Variables
  370.   #--------------------------------------------------------------------------
  371.   def define_variables
  372.     @dy = y + WLH
  373.     @saves      = $game_system.save_count
  374.     @rests      = $game_stats.inn_count
  375.     @steps      = $game_party.steps
  376.     @battles    = $game_stats.battle_count
  377.     @escapes    = $game_stats.escape_count
  378.     @kills      = $game_stats.kill_count
  379.     @victories  = $game_stats.victory_count
  380.     @chests     = $game_stats.chest_count
  381.     @doors      = $game_stats.door_count
  382.     @secrets    = $game_stats.secrets_count
  383.     @towns      = $game_stats.town_count
  384.     @progress   = $game_stats.game_progress
  385.     @total_exp  = $game_stats.total_exp_count
  386.     @total_gold = $game_stats.total_gold_count
  387.     @total_spent= $game_stats.total_gold_spent
  388.     @party      = $game_party.members.size
  389.     @encounters = $game_player.encounter_count
  390.     @shops      = $game_stats.shop_count
  391.   end
  392.   #--------------------------------------------------------------------------
  393.   # * Refresh
  394.   #--------------------------------------------------------------------------
  395.   def refresh
  396.     return if Graphics.frame_count % 10 != 0
  397.     self.contents.clear
  398.     draw_block1; draw_block2; draw_block3
  399.     draw_block4; draw_block5; draw_block6
  400.   end
  401.   #--------------------------------------------------------------------------
  402.   # * Draw Block: System Stats
  403.   #--------------------------------------------------------------------------
  404.   def draw_block1
  405.     x = 0
  406.     self.contents.draw_title(x, @dy * 0, "System Stats", 260, WLH, 1)
  407.     self.contents.font.color = normal_color
  408.     self.contents.draw_text(x, @dy * 1, 180, WLH, "Number of Saves:")
  409.     self.contents.draw_text(x, @dy * 2, 180, WLH, "Number of Rests:")
  410.     self.contents.draw_text(x, @dy * 3, 180, WLH, "Number of Steps:")
  411.     self.contents.draw_text(x, @dy * 4, 180, WLH, "Number of Shop Visits:")
  412.     self.contents.draw_text(x, @dy * 5, 180, WLH, "Number of Party Members:")
  413.     x += 4; self.contents.font.color = system_color
  414.     self.contents.draw_text(x, @dy * 1, 230, WLH, @saves.to_s, 2)
  415.     self.contents.draw_text(x, @dy * 2, 230, WLH, @rests.to_s, 2)
  416.     self.contents.draw_text(x, @dy * 3, 230, WLH, @steps.to_s, 2)
  417.     self.contents.draw_text(x, @dy * 4, 230, WLH, @shops.to_s, 2)
  418.     self.contents.draw_text(x, @dy * 5, 230, WLH, @party.to_s, 2)
  419.   end
  420.   #--------------------------------------------------------------------------
  421.   # * Draw Block: Battle Stats
  422.   #--------------------------------------------------------------------------
  423.   def draw_block2
  424.     x = 268
  425.     self.contents.draw_title(x, @dy * 0, "Battle Stats", 260, WLH, 1)
  426.     self.contents.draw_text(x, @dy * 1, 180, WLH, "Battles Won:")
  427.     self.contents.draw_text(x, @dy * 2, 180, WLH, "Battles Escaped:")
  428.     self.contents.draw_text(x, @dy * 3, 180, WLH, "Total Kill Count:")
  429.     self.contents.draw_text(x, @dy * 4, 180, WLH, "Total Battles:")
  430.     self.contents.draw_text(x, @dy * 5, 180, WLH, "Encounter Ratio:")
  431.     x += 4; self.contents.font.color = system_color
  432.     self.contents.draw_text(x, @dy * 1, 230, WLH, @victories.to_s, 2)
  433.     self.contents.draw_text(x, @dy * 2, 230, WLH, @escapes.to_s, 2)
  434.     self.contents.draw_text(x, @dy * 3, 230, WLH, @kills.to_s, 2)
  435.     self.contents.draw_text(x, @dy * 4, 230, WLH, @battles.to_s, 2)
  436.     self.contents.draw_text(x, @dy * 5, 230, WLH, @encounters.to_s, 2)
  437.   end
  438.   #--------------------------------------------------------------------------
  439.   # * Draw Block: Parameter Stats
  440.   #--------------------------------------------------------------------------
  441.   def draw_block3
  442.     x = 0
  443.     self.contents.draw_title(x, @dy * 6, "Parameter Stats", 260, WLH, 1)
  444.     self.contents.draw_text(x, @dy * 7, 180, WLH, "Total Exp Gained:")
  445.     self.contents.draw_text(x, @dy * 8, 180, WLH, "Total Gold Gained:")
  446.     self.contents.draw_text(x, @dy * 9, 180, WLH, "Total Gold Spent:")
  447.     x += 4; self.contents.font.color = system_color
  448.     self.contents.draw_text(x, @dy * 7, 230, WLH, @total_exp.to_s, 2)
  449.     self.contents.draw_text(x, @dy * 8, 230, WLH, @total_gold.to_s, 2)
  450.     self.contents.draw_text(x, @dy * 9, 230, WLH, @total_spent.to_s, 2)
  451.   end
  452.   #--------------------------------------------------------------------------
  453.   # * Draw Block: Game Stats
  454.   #--------------------------------------------------------------------------
  455.   def draw_block4
  456.     x =  268
  457.     self.contents.draw_title(x, @dy * 6, "Game Stats", 260, WLH, 1)
  458.     self.contents.draw_text(x, @dy * 7, 180, WLH, "Chests Opened:")
  459.     self.contents.draw_text(x, @dy * 8, 180, WLH, "Doors Opened:")
  460.     self.contents.draw_text(x, @dy * 9, 180, WLH, "Secrets Found:")
  461.     self.contents.draw_text(x, @dy * 10, 180, WLH, "Game Progress:")
  462.     x += 4; self.contents.font.color = system_color
  463.     self.contents.draw_text(x, @dy * 7, 230, WLH, @chests.to_s, 2)
  464.     self.contents.draw_text(x, @dy * 8, 230, WLH, @doors.to_s, 2)
  465.     self.contents.draw_text(x, @dy * 9, 230, WLH, @secrets.to_s, 2)
  466.     self.contents.draw_text(x, @dy * 10, 230, WLH, @progress.to_s, 2)
  467.   end
  468.   #--------------------------------------------------------------------------
  469.   # * Draw Block: Time/Date Stats
  470.   #--------------------------------------------------------------------------
  471.   def draw_block5
  472.     x = 0
  473.     self.contents.draw_title(x, @dy * 12, "Time/Date Stats", 260, WLH, 1)
  474.     self.contents.draw_text(x, @dy * 13, 180, WLH, "Time Played:")
  475.     self.contents.draw_text(x, @dy * 14, 180, WLH, "Current Date:")
  476.     self.contents.draw_text(x, @dy * 15, 180, WLH, "Current Time:")
  477.     get_time_date
  478.     x += 4; self.contents.font.color = system_color
  479.     self.contents.draw_text(x, @dy * 13, 230, WLH, @timeplayed.to_s, 2)
  480.     self.contents.draw_text(x, @dy * 14, 230, WLH, @cdate, 2)
  481.     self.contents.draw_text(x, @dy * 15, 230, WLH, @ctime, 2)
  482.   end
  483.   #--------------------------------------------------------------------------
  484.   # * Draw Block: Map Stats
  485.   #--------------------------------------------------------------------------
  486.   def draw_block6
  487.     x = 268
  488.     self.contents.draw_title(x, @dy * 12, "Map Stats", 260, WLH, 1)
  489.     self.contents.draw_text(x, @dy * 13, 180, WLH, "Map Location:")
  490.     self.contents.draw_text(x, @dy * 14, 180, WLH, "Player Coordinates:")
  491.     self.contents.draw_text(x, @dy * 15, 180, WLH, "Towns Visited:")
  492.     x += 4; self.contents.font.color = system_color
  493.     self.contents.draw_text(x, @dy * 13, 230, WLH, $game_map.name, 2)
  494.     draw_player_coords(x, @dy * 14, 230, WLH, 2)
  495.     self.contents.draw_text(x, @dy * 15, 230, WLH, @towns.to_s, 2)
  496.   end
  497.   #--------------------------------------------------------------------------
  498.   # * Get System Time and Date
  499.   #--------------------------------------------------------------------------
  500.   def get_time_date
  501.     t = Time.new
  502.     @total_sec = Graphics.frame_count / Graphics.frame_rate
  503.     hour = @total_sec / 60 / 60
  504.     min = @total_sec / 60 % 60
  505.     sec = @total_sec % 60
  506.     @timeplayed = sprintf("%02d:%02d:%02d", hour, min, sec)
  507.     @cdate = t.strftime("%a, %d %b, %Y")
  508.     @ctime = t.strftime("%I:%M:%S %p")
  509.   end
  510.   #--------------------------------------------------------------------------
  511.   # * Frame Update
  512.   #--------------------------------------------------------------------------
  513.   def update
  514.     super
  515.     refresh
  516.   end
  517. end
  518.  
  519. #==============================================================================
  520. # ** Scene_Menu
  521. #==============================================================================
  522. class Scene_Menu < Scene_Base
  523.   include CW_UNIVERSAL_CONFIG
  524.   #--------------------------------------------------------------------------
  525.   # * Create Command Window                                 |--OVERWRITTEN--|
  526.   #--------------------------------------------------------------------------
  527.   def create_command_window
  528.     command_list = [Vocab::item, Vocab::skill, Vocab::equip, Vocab::status,
  529.       Vocab::save, Vocab::game_end]
  530.     if EXTRA_STATS
  531.       commands = command_list.first(4)
  532.       commands.push STATS_MENU_TEXT
  533.       2.times do |cmd| commands.push command_list.last(2)[cmd] end
  534.     else
  535.       commands = command_list
  536.     end
  537.     @command_window = Window_Command.new(160, commands)
  538.     @command_window.index = @menu_index
  539.     if $game_party.members.size == 0          # If number of party members is 0
  540.       @command_window.draw_item(0, false)     # Disable item
  541.       @command_window.draw_item(1, false)     # Disable skill
  542.       @command_window.draw_item(2, false)     # Disable equipment
  543.       @command_window.draw_item(3, false)     # Disable status
  544.     end
  545.     if $game_system.save_disabled             # If save is forbidden
  546.       @command_window.draw_item(4, false)     # Disable save
  547.     end
  548.   end
  549.   #--------------------------------------------------------------------------
  550.   # * Update Command Selection                              |--OVERWRITTEN--|
  551.   #--------------------------------------------------------------------------
  552.   def update_command_selection
  553.     if Input.trigger?(Input::B)
  554.       Sound.play_cancel
  555.       $scene = Scene_Map.new
  556.     elsif Input.trigger?(Input::C)
  557.       if $game_party.members.size == 0 and @command_window.index < 4
  558.         Sound.play_buzzer
  559.         return
  560.       elsif $game_system.save_disabled and @command_window.index == 4
  561.         Sound.play_buzzer
  562.         return
  563.       end
  564.       Sound.play_decision
  565.       case @command_window.index
  566.       when 0      # Item
  567.         $scene = Scene_Item.new
  568.       when 1,2,3  # Skill, equipment, status
  569.         start_actor_selection
  570.       when 4      # Extra Stats/Save
  571.         if EXTRA_STATS; $scene = Scene_Stats.new
  572.         else $scene = Scene_File.new(true, false, false)
  573.         end
  574.       when 5      # Save/End Game
  575.         if EXTRA_STATS; $scene = Scene_File.new(true, false, false)
  576.         else $scene = Scene_End.new
  577.         end
  578.       when 6
  579.         if EXTRA_STATS; $scene = Scene_End.new; end
  580.       end
  581.     end
  582.   end
  583. end
  584.  
  585. #==============================================================================
  586. # ** Scene_Battle
  587. #==============================================================================
  588. class Scene_Battle
  589.   #--------------------------------------------------------------------------
  590.   # * Process Start Battle                                      |--ALIASED--|
  591.   #--------------------------------------------------------------------------
  592.   alias cwexsbai_scnbtl_procbtlstrt process_battle_start
  593.   def process_battle_start(*args)
  594.     # Add to battle counter
  595.     $game_stats.battle_count += 1
  596.     # Run Original Method
  597.     cwexsbai_scnbtl_procbtlstrt(*args)
  598.   end
  599.   #--------------------------------------------------------------------------
  600.   # This adds to the "Escape Counter" for each successful escape|--ALIASED--|
  601.   #--------------------------------------------------------------------------
  602.   alias cw_process_escape process_escape
  603.   def process_escape
  604.     cw_process_escape
  605.     if $game_troop.preemptive
  606.       success = true
  607.     else
  608.       success = (rand(100) < @escape_ratio)
  609.     end
  610.     Sound.play_escape
  611.     if success
  612.       wait_for_message
  613.       battle_end(1)
  614.       $game_stats.escape_count += 1
  615.     else
  616.       @escape_ratio += 10
  617.       $game_message.texts.push('\.' + Vocab::EscapeFailure)
  618.       wait_for_message
  619.       $game_party.clear_actions
  620.       start_main
  621.     end
  622.   end
  623.   #--------------------------------------------------------------------------
  624.   # This adds to the "Victory Counter" for each combat won      |--ALIASED--|
  625.   #--------------------------------------------------------------------------
  626.   alias cw_process_victory process_victory
  627.   def process_victory
  628.     cw_process_victory
  629.     $game_stats.victory_count += 1
  630.   end
  631.   #--------------------------------------------------------------------------
  632.   # * Display Gained Experience and Gold                    |--OVERWRITTEN--|
  633.   #--------------------------------------------------------------------------
  634.   def display_exp_and_gold
  635.     exp = $game_troop.exp_total
  636.     gold = $game_troop.gold_total
  637.     $game_party.gain_gold(gold)
  638.     $game_stats.total_gold_count += gold
  639.     $game_stats.total_exp_count += exp
  640.     text = sprintf(Vocab::Victory, $game_party.name)
  641.     $game_message.texts.push('\|' + text)
  642.     if exp > 0
  643.       text = sprintf(Vocab::ObtainExp, exp)
  644.       $game_message.texts.push('\.' + text)
  645.     end
  646.     if gold > 0
  647.       text = sprintf(Vocab::ObtainGold, gold, Vocab::gold)
  648.       $game_message.texts.push('\.' + text)
  649.     end
  650.     wait_for_message
  651.   end
  652. end
  653.  
  654. #==============================================================================
  655. # ** Scene_Shop
  656. #------------------------------------------------------------------------------
  657. #  This class performs shop screen processing.
  658. #==============================================================================
  659. class Scene_Shop < Scene_Base
  660.   #--------------------------------------------------------------------------
  661.   # * Confirm Number Input
  662.   #--------------------------------------------------------------------------
  663.   alias cwexs_scnshop_decide_number decide_number_input
  664.   def decide_number_input
  665.     cwexs_scnshop_decide_number
  666.     case @command_window.index
  667.     when 0
  668.       $game_stats.total_gold_spent += (@number_window.number * @item.price)
  669.     when 1
  670.       $game_stats.total_gold_count += (@number_window.number * (@item.price / 2))
  671.     end
  672.   end
  673.   #--------------------------------------------------------------------------
  674.   # * Dispose of Command Window
  675.   #--------------------------------------------------------------------------
  676.   alias cwexs_scnshop_dispose_cmd dispose_command_window
  677.   def dispose_command_window
  678.     cwexs_scnshop_dispose_cmd
  679.     $game_stats.shop_count += 1
  680. #~     @command_window.dispose
  681.   end
  682. end
  683.  
  684. #==============================================================================
  685. # ** Scene_Map
  686. #==============================================================================
  687. class Scene_Map < Scene_Base
  688.   include CW_UNIVERSAL_CONFIG
  689.   #--------------------------------------------------------------------------
  690.   # * Frame Update                                              |--ALIASED--|
  691.   #--------------------------------------------------------------------------
  692.   alias cwexs_scnmap_update update
  693.   def update
  694.     cwexs_scnmap_update
  695.     if EXTRA_STATS_KEYPRESS
  696.       if Input.press?(EXTRA_STATS_KEY)
  697.         $game_map.from_map = true
  698.         $scene = Scene_Stats.new
  699.       end
  700.     end
  701.   end
  702. end
  703.  
  704. #==============================================================================
  705. # ** Scene_File
  706. #------------------------------------------------------------------------------
  707. #  This class performs the save and load screen processing.
  708. #==============================================================================
  709. class Scene_File < Scene_Base
  710.   include CW_UNIVERSAL_CONFIG
  711.   #--------------------------------------------------------------------------
  712.   # * Return to Original Screen
  713.   #--------------------------------------------------------------------------
  714.   def return_scene
  715.     if @from_title
  716.       $scene = Scene_Title.new
  717.     elsif @from_event
  718.       $scene = Scene_Map.new
  719.     else
  720.       if EXTRA_STATS; return_code = 5 else return_code = 4; end
  721.       $scene = Scene_Menu.new(return_code)
  722.     end
  723.   end
  724.   #--------------------------------------------------------------------------
  725. end
  726.  
  727.  
  728. #==============================================================================
  729. # ** Scene_Stats                                                    |--ADDED--|
  730. #------------------------------------------------------------------------------
  731. #  This class handles the stat window, where all of the stat variables are
  732. # displayed.
  733. #==============================================================================
  734. class Scene_Stats < Scene_Base
  735.     include CW_UNIVERSAL_CONFIG
  736.   #--------------------------------------------------------------------------
  737.   # * Start
  738.   #--------------------------------------------------------------------------
  739.   def start
  740.     super
  741.     @stat_window = Window_Stats.new(50, 100)
  742.   end
  743.   #--------------------------------------------------------------------------
  744.   # * Terminate
  745.   #--------------------------------------------------------------------------
  746.   def terminate
  747.     super
  748.     @stat_window.dispose
  749.   end
  750.   #--------------------------------------------------------------------------
  751.   # * Return Scene
  752.   #--------------------------------------------------------------------------
  753.   def return_scene
  754.     if $game_map.from_map == true
  755.       $game_map.from_map = false
  756.       $scene = Scene_Map.new
  757.     else
  758.       $scene = Scene_Menu.new(4)
  759.     end
  760.   end
  761.   #--------------------------------------------------------------------------
  762.   # * Update
  763.   #--------------------------------------------------------------------------
  764.   def update
  765.     @stat_window.update
  766.     if Input.trigger?(Input::B) ||
  767.       if EXTRA_STATS_KEYPRESS; Input.trigger?(EXTRA_STATS_KEY); end
  768.       Sound.play_cancel
  769.       return_scene
  770.     end
  771.   end
  772. end
  773.  
  774. #==============================================================================
  775. # ** Bitmap Addons VX v0.5
  776. #------------------------------------------------------------------------------
  777. # This adds additional functions to the Bitmap class, including various text
  778. # options and shapes.
  779. #==============================================================================
  780. unless $imported["CWBitmap"]; class Bitmap
  781.   include CW_UNIVERSAL_CONFIG
  782.   #--------------------------------------------------------------------------
  783.   # * Reset Font Settings                                    |--NEW METHOD--|
  784.   #--------------------------------------------------------------------------
  785.   def reset_font_settings
  786.     self.font.bold = false
  787.     self.font.italic = false
  788.     self.font.name = DEFAULT_FONT
  789.     self.font.size = DEFAULT_SIZE
  790.     self.font.color = DEFAULT_TEXT_COLOR
  791.   end
  792.   #--------------------------------------------------------------------------
  793.   # * Draw Horizontal Line                                        |--ADDED--|
  794.   #   x  : x-coordinate
  795.   #   y  : y-coordinate
  796.   #   lw : line width
  797.   #   lc : line colour
  798.   #   ls : line size (proportionate height)
  799.   #   lh : line height (textual)
  800.   #--------------------------------------------------------------------------
  801.   def draw_horz_line(x, y, lw = self.width, lc = LINE_COLOR, ls = 1, lh = 24)
  802.     line_y = y + lh / 2 + 10
  803.     self.fill_rect(x, line_y, lw, ls, lc)
  804.   end
  805.   #--------------------------------------------------------------------------
  806.   # * Draw Title                                                  |--ADDED--|
  807.   #     x    : window x-coordinate
  808.   #     y    : window y-coordinate
  809.   #     w    : window width
  810.   #     h    : window height
  811.   #     text : text to display
  812.   #     a    : text align
  813.   #--------------------------------------------------------------------------
  814.   def draw_title(x, y, title, w = self.width, h = 24, a = 0)
  815.     self.font.bold = true
  816.     self.font.shadow = true
  817.     self.font.name = DEFAULT_TITLE_FONT
  818.     self.font.color = DEFAULT_TITLE_COLOR
  819.     self.font.size  = DEFAULT_TITLE_SIZE
  820.     self.font.size  = 20
  821.     self.draw_text(x, y, w, h, title, a)
  822.     self.draw_horz_line(x, y + h * 0, w)
  823.     reset_font_settings
  824.   end
  825. end; end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement