Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- ╔══════════════════════════════════════════════════════════════════════════════╗
- ║ Extra Stats Script ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ Version : 4.0 ║
- ║ Author : Companion Wulf ║
- ║ Platform : RMVX ║
- ║ Release Date : 29 August 2015 ║
- ║ Last Update : 10 May 2015 ║
- ║ Demo Version : N/A ║
- ║ Demo Date : Unreleased ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ ◄ Websites ► ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ Website : http://rpgmakertimes.info ║
- ║ Main Blog : http://blog.rpgmakertimes.info ║
- ║ Companion Blog : http://rpgmakertimes.blogspot.com ║
- ║ Otherworld : http://projects.rpgmakertimes.info/otherworld ║
- ║ ║
- ╠══════════════════════════════════════════════════════════════════════════════╣
- ║ ◄ DESCRIPTION ► ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ The Extra Stats script is for keeping track of some in-game stats, ranging ║
- ║ from battles to game progress. It evolved from a small scriptlet to log ║
- ║ the number of battles fought, won and lost, and more stats were added over ║
- ║ time to become a complete script. ║
- ║ ║
- ╠══════════════════════════════════════════════════════════════════════════════╣
- ║ ◄ KNOWN COMPATABILITY ISSUES ► ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ As far as I know there are no compatibility issues with this script. There ║
- ║ may be some for other scripts that modify or overwrite Scene_Menu though. ║
- ║ ║
- ╠══════════════════════════════════════════════════════════════════════════════╣
- ║ ◄ REQUIRED SCRIPTS ► ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ The following script is required to run the Extra Stats script: ║
- ║ ║
- ║ ● Global Colors Module (GCM) ║
- ║ ║
- ╠══════════════════════════════════════════════════════════════════════════════╣
- ║ ◄ INSTRUCTIONS ► ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ **Instructions are to follow!** ║
- ║ ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ ◄ Instruction Manual ► ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ A comprehensive manual will be produced (in DOC and PDF formats) soon. ║
- ║ ║
- ╠══════════════════════════════════════════════════════════════════════════════╣
- ║ ◄ EXTRA STATS SCRIPT VERSION HISTORY ► ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ The version history tracking will be changing to the following format: ║
- ║ ║
- ║ Release.Updates.Developmental.Manual ║
- ║ ║
- ║ Release numbers indicate public release versions. ║
- ║ ║
- ║ Updates refers to new scripts/scriptlets and new methods that have been ║
- ║ added. This includes major and minor updates. ║
- ║ ║
- ║ Developmental updates are for tweaks or bug fixes. ║
- ║ ║
- ║ Manual indicates major updates to the Extra Stats manual. ║
- ║ ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ ◄ Updates Version History ► ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ I didn't keep accurate version updates with this script, so I've based ║
- ║ this on the information I have. After Version 2.0.0.0, I kept more regular ║
- ║ records as I added things to it and made additional tweaks. ║
- ║ ║
- ║ I also realised that I've never released a proper manual for this script ║
- ║ (not that it necessarily needs one, since it's mostly plug-and-play). The ║
- ║ manual is available, nevertheless, for completeness and to explain how to ║
- ║ use its settings and how to implement some of its features. ║
- ║ ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ VERSION 5.0+ - Future Updates ║
- ║ ● Add: Total Damage Inflicted [Battle Stats] ║
- ║ ● Add: Total Damage Sustained [Battle Stats] ║
- ║ ● Add: Total Combat Rounds [Battle Stats] ║
- ║ ● Add: Party Members graphics [System Stats] ║
- ║ ● Add: Total Potions Used [System Stats] ║
- ║ ● Add: Total Money (Bought) [System Shop] ║
- ║ ● Add: Total Money (Sold) [System Shop] ║
- ║ ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v4.0.0.0 (29-Aug-2015) ║
- ║ ● Release: Version 4.0 ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v3.5.17.0 (22-Aug-2015) ║
- ║ ● Add: Compatibility with SojaBird's Achievement script ║
- ║ ● Tweak: Section titles reflect settings in COMMAND_LIST ║
- ║ ● Tweak: Maximum secrets (configurable) ║
- ║ ● Bug Fix: Saved stats reset upon loading save file ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v3.4.14.0 (10-May-2015) ║
- ║ ● Bug Fix: Rescue for missing or incorrect section pictures ║
- ║ ● Tweak: Display currency term (from Database) rather than generic term ║
- ║ ● Stats Added: ║
- ║ o Party Leader ║
- ║ ● Tweak: Remove some duplicate code ║
- ║ ● Add: Stats section pictures ║
- ║ ● Tweak: Renamed/reordered some sections ║
- ║ ● Tweak: Add Shops and Party stats sections ║
- ║ ● Update: Complete rewrite to include stats menu ║
- ║ ● Update: Removed reliability on Universal Configuration Settings ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v3.1.7.0 (13-Nov-2013) ║
- ║ ● Tweak: Column separator line ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v3.1.6.0 (08-Nov-2013) ║
- ║ ● Add: Background (set in EXTRA_STATS_CONFIG Module) ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v3.1.5.0 (30-Sep-2013) ║
- ║ ● Bug Fix: Total gold spent updating twice ║
- ║ ● Add: Total gold update when gained through Change Gold event command ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v3.1.3.0 (28-Sep-2013) ║
- ║ ● Stat Added: Number of shops visited ║
- ║ ● Separated variables into single class (rather than into Game_System) ║
- ║ ● Add: Universal Configuration Settings checker ║
- ║ ● Integrated old config settings into Universal Configuration Settings ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v3.0.0.0 (30-Apr-2013) ║
- ║ ● Release: Version 3.0 ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v2.2.12.1 (23-Apr-2013) ║
- ║ ● Manual: Full manual written ║
- ║ ● Add: Exp gain from Change EXP event command ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v2.2.11.0 (21-Apr-2013) ║
- ║ ● Add: Money Spent (in shops) counter ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v2.2.10.0 (20-Apr-2013) ║
- ║ ● Demo: Began working demo ║
- ║ ● Bug Fix: Save Menu command index corrected ║
- ║ ● Bug Fix: Menu commands not pushing properly ║
- ║ ● Add: Dispose Extra Stats with Keypress alongside default cancel button ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v2.1.7.0 (23-Mar-2013) ║
- ║ ● Tweak: Extra Stats Window closed with cancel/assigned key (on map) ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v2.1.6.0 (22-Mar-2013) ║
- ║ ● Bug Fix: Keypress function malfunction ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v2.1.5.0 (18-Mar-2013) ║
- ║ ● Add: Encounter Ratio value ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v2.1.4.0 (15-Mar-2013) ║
- ║ ● Add: Number of Party Members ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v2.1.3.0 (28-Jan-2013) ║
- ║ ● Add: Player Coordinates ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v2.1.2.0 (27-Jan-2013) ║
- ║ ● Add: Keypress function to display Extra Stats on map ║
- ║ ● Bug Fix: Total Gold counter ║
- ║ ● Bug Fix: Total Exp counter ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v2.0.0.0 (20-Jan-2013) ║
- ║ ● Release Version 2.0 ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v1.2.16.0 (06-Sep-2012) ║
- ║ ● Integrated with Q-Engine ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v1.1.16.0 (??-???-2012) ║
- ║ ● Bug Fix: Total Gold counter not updating correctly ║
- ║ ● Bug Fix: Total Exp counter not updating correctly ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v1.1.14.0 (07-Feb-2011) ║
- ║ ● Stats Added: ║
- ║ o Total Experience Gained ║
- ║ o Total Gold Obtained (Battles Only) ║
- ║ o Number of Chests Opened ║
- ║ o Number of Keys Found ║
- ║ o Number of Secrets Found ║
- ║ o Number of Towns Visited ║
- ║ o Total Number of Battles ║
- ║ ● Changed layout and tidied code ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v1.0.7.0 (15-Aug-2010) ║
- ║ ● Remove: Game Title/Author options in Extra Stats Window ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v1.0.6.0 (??-???-2010) ║
- ║ ● Add: Map Location ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v1.0.5.0 (07-Jul-2010) ║
- ║ ● Add: Game Progress Counter ║
- ║ ● Add: Total Quests/Completed ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v1.0.2.0 (29-Jun-2010) ║
- ║ ● Add: Total Chests Opened and Total Achievements ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v1.0.1.0 (??-???-2010) ║
- ║ ● Add: Total Battles ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v1.0.0.0 (18-Jun-2010) ║
- ║ ● Release: Version 1.0 ║
- ║ ● Stats Added: ║
- ║ o Number of Saves ║
- ║ o Number of Inn Stays ║
- ║ o Number of Steps ║
- ║ o Total Victories ║
- ║ o Total Kills ║
- ║ o Total Escapes ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ v0.1.0.0 (15-Jun-2010) ║
- ║ ● Began the Extra Stats script (ported from RMXP version - now lost) ║
- ║ ║
- ╚══════════════════════════════════════════════════════════════════════════════╝
- =end
- #==============================================================================
- # Extra Stats VX Core Engine
- #==============================================================================
- $imported = {} if $imported == nil; $imported["CW-ExtraStats-VX-v4"] = true
- module EXTRA_STATS_CONFIG
- include CW_GLOBAL_COLORS
- #────────────────────────────────────────────────────────────────────────────
- # * Font Settings
- #────────────────────────────────────────────────────────────────────────────
- DEFAULT_FONT = "Trebuchet MS" # Change default font
- DEFAULT_SIZE = 18 # Change default font size
- DEFAULT_TITLE_FONT = "Arial" # Change default font for titles
- DEFAULT_TITLE_SIZE = 26 # Change default font size for titles
- #────────────────────────────────────────────────────────────────────────────
- # * Text Colours
- #────────────────────────────────────────────────────────────────────────────
- DEFAULT_TEXT_COLOR = WHITE # Default colour for text
- DEFAULT_TITLE_COLOR = YELLOW # Default colour for titles
- DEFAULT_SHADOW_COLOR = YELLOW # Set colour for draw_font_shadow method
- DEFAULT_OUTLINE_COLOR = YELLOW # Set colour for draw_outline method
- LINE_COLOR = LightBlue # Default colour for dividing underlines
- #────────────────────────────────────────────────────────────────────────────
- # * Extra Stats Menu Settings *
- #────────────────────────────────────────────────────────────────────────────
- EXTRA_STATS = true # Include in Status Menu on/off
- STATS_MENU_TEXT = "Extra Stats" # Menu item text
- EXTRA_STATS_KEYPRESS = true # Allow/disallow access keypress from map
- EXTRA_STATS_KEY = Input::Z # Set keypress to call Extra Stats from map
- COMMAND_LIST = [ # Extra Stats section headers
- "System Stats", "Battle Stats", "Personal Stats", "Progress Stats",
- "Time/Date Stats", "Map Stats", "Shop Stats", "Party Stats"
- ]
- #────────────────────────────────────────────────────────────────────────────
- # * Additional Extra Stats Settings *
- #────────────────────────────────────────────────────────────────────────────
- TOTAL_SECRETS = 10 # Total number of secrets
- #────────────────────────────────────────────────────────────────────────────
- # * Menu Background *
- #────────────────────────────────────────────────────────────────────────────
- MENU_BACKGROUND = true # Toggle background behind menu screens
- MENU_BG_GRAPHIC = "" # Set the menu background
- MENU_BG_OPAQUE = 155 # Set the menu background opacity
- WINDOWS_OPACITY = 60 # Set opacity for all windows
- #────────────────────────────────────────────────────────────────────────────
- # * Menu Pictures *
- #────────────────────────────────────────────────────────────────────────────
- # Each picture is stored in the "Graphics/Pictures" folder and is named the
- # same as the corresponding menu item (the same as in COMMAND_LIST above):
- #
- # System Stats, Battle Stats, Personal Stats, Game Stats, TimeDate Stats,
- # Map Stats and Shop Stats.
- #
- # Recommended size is no larger than 364 x 129, as these will be placed at
- # the bottom of each section.
- #
- # Pictures aren't mandatory, however, so if any (or all) don't exist, then
- # the normal stats information will be displayed with no pictures.
- #────────────────────────────────────────────────────────────────────────────
- SHOW_PICTURES = true # Show pictures for each command item
- PICTURES_LIST = [ # List of section pictures to display
- ]
- end
- #==============================================================================
- # ** Game_Stats
- #==============================================================================
- class Game_Stats
- #--------------------------------------------------------------------------
- # * Public Instance Variables |--ADDED--|
- #--------------------------------------------------------------------------
- attr_accessor :victory_count # Number of battles won
- attr_accessor :inn_count # Number of stays at an inn
- attr_accessor :kill_count # Number of monsters defeated
- attr_accessor :escape_count # Number of escapes from battle
- attr_accessor :game_progress # Game progress percentage
- attr_accessor :chest_count # Number of chests opened
- attr_accessor :door_count # Number of doors opened
- attr_accessor :secrets_count # Number of secrets unlocked
- attr_accessor :town_count # Number of towns visited
- attr_accessor :battle_count # Total number of battles won
- attr_accessor :total_exp_count # Total experience gained
- attr_accessor :total_gold_count # Total gold obtained
- attr_accessor :total_gold_spent # Total gold spent (in shops)
- attr_accessor :shop_count # Number of times shop visited
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def start
- if not $imported["CWColors"]
- RPG::BGM.stop
- p("The Global Colors Module is not installed. " +
- "Please make sure it is installed or enabled before the game is run.")
- exit
- end
- # Set up variables
- @victory_count = 0
- @inn_count = 0
- @kill_count = 0
- @escape_count = 0
- @game_progress = 0
- @chest_count = 0
- @door_count = 0
- @secrets_count = 0
- @town_count = 0
- @battle_count = 0
- @total_exp_count = 0
- @total_gold_count = 0
- @total_gold_spent = 0
- @shop_count = 0
- end
- end
- #==============================================================================
- # ** Scene_Stats |--ADDED--|
- #------------------------------------------------------------------------------
- # This class handles the stat window, where all of the stat variables are
- # displayed.
- #==============================================================================
- class Scene_Stats < Scene_Base
- include EXTRA_STATS_CONFIG
- #--------------------------------------------------------------------------
- # * Initialize
- #--------------------------------------------------------------------------
- def initialize(menu_index = 0)
- @menu_index = menu_index
- $game_temp.stats_menu_flag = -1
- end
- #--------------------------------------------------------------------------
- # * Start processing
- #--------------------------------------------------------------------------
- def start
- super
- if MENU_BACKGROUND
- @menuback_sprite = Sprite.new
- @menuback_sprite.bitmap = Cache.picture(MENU_BG_GRAPHIC)
- @menuback_sprite.x = 0
- @menuback_sprite.y = 0
- @menuback_sprite.color.set(16, 16, 16, MENU_BG_OPAQUE)
- update_menu_background
- end
- create_windows
- create_commands_list
- end
- #--------------------------------------------------------------------------
- # * Create windows
- #--------------------------------------------------------------------------
- def create_windows
- @stats_title = Window_Title.new
- @stats_window = Window_Stats.new(181, 56)
- @stats_title.opacity = @stats_window.opacity = WINDOWS_OPACITY
- end
- #--------------------------------------------------------------------------
- # * Create commands list
- #--------------------------------------------------------------------------
- def create_commands_list
- commands = COMMAND_LIST
- @command_window = Window_Command.new(180, commands, 1)
- @command_window.x, @command_window.y = 0, 56
- @command_window.opacity = WINDOWS_OPACITY
- @command_window.index = @menu_index
- end
- #--------------------------------------------------------------------------
- # * Dispose windows
- #--------------------------------------------------------------------------
- def terminate
- super
- @stats_title.dispose
- @stats_window.dispose
- @command_window.dispose
- @menuback_sprite.dispose
- end
- #--------------------------------------------------------------------------
- # * Return to previous scene
- #--------------------------------------------------------------------------
- def return_scene
- if $game_map.from_map == true
- $game_map.from_map = false
- $scene = Scene_Map.new
- else
- $scene = Scene_Menu.new(4)
- end
- end
- #--------------------------------------------------------------------------
- # * Update
- #--------------------------------------------------------------------------
- def update
- @stats_window.update
- @command_window.update
- if EXTRA_STATS_KEYPRESS && $game_map.from_map
- if Input.trigger?(EXTRA_STATS_KEY)
- Sound.play_cancel
- return_scene
- end
- end
- if Input.trigger?(Input::B)
- Sound.play_cancel
- return_scene
- elsif Input.trigger?(Input::C)
- $game_temp.stats_menu_flag = @command_window.index
- command_selection(@command_window.index)
- end
- end
- #--------------------------------------------------------------------------
- # * Select commands
- #--------------------------------------------------------------------------
- def command_selection(cmd_index)
- @cmd_index = cmd_index
- $game_temp.stats_menu_flag = cmd_index
- end
- end
- #==============================================================================
- # ** Window_Stats |--ADDED--|
- #------------------------------------------------------------------------------
- # This is the window for displaying the stats.
- #==============================================================================
- class Window_Stats < Window_Base
- include EXTRA_STATS_CONFIG
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(x, y)
- super(x, y, 364, 362)
- self.contents.font.size = 16
- define_variables
- refresh
- end
- #--------------------------------------------------------------------------
- # * Define Variables
- #--------------------------------------------------------------------------
- def define_variables
- y = 0; @dy = y + WLH
- @gold_term = $data_system.terms.gold
- @saves = $game_system.save_count
- @rests = $game_stats.inn_count
- @steps = $game_party.steps
- @battles = $game_stats.battle_count
- @escapes = $game_stats.escape_count
- @kills = $game_stats.kill_count
- @victories = $game_stats.victory_count
- @chests = $game_stats.chest_count
- @doors = $game_stats.door_count
- @secrets = $game_stats.secrets_count
- @towns = $game_stats.town_count
- @progress = $game_stats.game_progress
- @total_exp = $game_stats.total_exp_count
- @total_gold = $game_stats.total_gold_count
- @total_spent= $game_stats.total_gold_spent
- @party = $game_party.members.size
- @leader = $game_party.members[0].name
- @encounters = $game_player.encounter_count
- @shops = $game_stats.shop_count
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- #~ return if Graphics.frame_count % 10 != 0
- self.contents.clear
- draw_block($game_temp.stats_menu_flag)
- end
- #--------------------------------------------------------------------------
- # * Draw stat blocks
- #--------------------------------------------------------------------------
- def draw_block(idx)
- case idx
- when -1 # Default
- $game_map.from_map ? text = "Press Z to return to the map" :
- text = "Press A to select the stat to view."
- self.contents.draw_text(0, @dy * 6, self.width, WLH, text, 1)
- when 0 # System Stats
- x = 0
- self.contents.draw_title(x, @dy * 0, COMMAND_LIST[0], 330, WLH, 1)
- self.contents.font.color = normal_color
- self.contents.draw_text(x, @dy * 2, 200, WLH, "Number of Saves:")
- self.contents.draw_text(x, @dy * 4, 200, WLH, "Number of Times Rested:")
- self.contents.draw_text(x, @dy * 6, 200, WLH, "Number of Steps:")
- x += 4; self.contents.font.color = system_color
- self.contents.draw_text(x, @dy * 2, 320, WLH, @saves.to_s, 2)
- self.contents.draw_text(x, @dy * 4, 320, WLH, @rests.to_s, 2)
- self.contents.draw_text(x, @dy * 6, 320, WLH, @steps.to_s, 2)
- when 1 # Battle Stats
- x = 0
- self.contents.draw_title(x, @dy * 0, COMMAND_LIST[1], 364, WLH, 1)
- self.contents.draw_text(x, @dy * 1, 200, WLH, "Battles Won:")
- self.contents.draw_text(x, @dy * 2, 200, WLH, "Battles Escaped:")
- self.contents.draw_text(x, @dy * 3, 200, WLH, "Total Battles:")
- self.contents.draw_text(x, @dy * 4, 200, WLH, "Total Damage Inflicted:")
- self.contents.draw_text(x, @dy * 5, 200, WLH, "Total Damage Sustained:")
- self.contents.draw_text(x, @dy * 6, 200, WLH, "Total Kill Count:")
- self.contents.draw_text(x, @dy * 7, 200, WLH, "Encounter Ratio:")
- x += 4; self.contents.font.color = system_color
- self.contents.draw_text(x, @dy * 1, 320, WLH, @victories.to_s, 2)
- self.contents.draw_text(x, @dy * 2, 320, WLH, @escapes.to_s, 2)
- self.contents.draw_text(x, @dy * 3, 320, WLH, @battles.to_s, 2)
- self.contents.draw_text(x, @dy * 4, 320, WLH, "Not implemented", 2)
- self.contents.draw_text(x, @dy * 5, 320, WLH, "Not implemented", 2)
- self.contents.draw_text(x, @dy * 6, 320, WLH, @kills.to_s, 2)
- self.contents.draw_text(x, @dy * 7, 320, WLH, @encounters.to_s, 2)
- when 2 # Parameter Stats
- x = 0
- self.contents.draw_title(x, @dy * 0, COMMAND_LIST[2], 364, WLH, 1)
- self.contents.draw_text(x, @dy * 2, 200, WLH, "Total Exp Gained:")
- self.contents.draw_text(x, @dy * 4, 200, WLH, "Total #{@gold_term} Gained:")
- self.contents.draw_text(x, @dy * 5, 200, WLH, "Total #{@gold_term} Lost:")
- x += 4; self.contents.font.color = system_color
- self.contents.draw_text(x, @dy * 2, 320, WLH, @total_exp.to_s, 2)
- self.contents.draw_text(x, @dy * 4, 320, WLH, @total_gold.to_s, 2)
- self.contents.draw_text(x, @dy * 5, 320, WLH, @total_spent.to_s, 2)
- when 3 # Game Stats
- x = 0
- self.contents.draw_title(x, @dy * 0, COMMAND_LIST[3], 364, WLH, 1)
- self.contents.draw_text(x, @dy * 2, 200, WLH, "Game Progress:")
- self.contents.draw_text(x, @dy * 4, 200, WLH, "Chests Opened:")
- self.contents.draw_text(x, @dy * 5, 200, WLH, "Doors Opened:")
- self.contents.draw_text(x, @dy * 7, 200, WLH, "Secrets Unlocked:")
- self.contents.draw_text(x, @dy * 9, 200, WLH, "Achievements:") if $imported["SojaBird_Achievements"]
- x += 4; self.contents.font.color = system_color
- self.contents.draw_text(x, @dy * 2, 320, WLH, @progress.to_s+"%", 2)
- self.contents.draw_text(x, @dy * 4, 320, WLH, @chests.to_s, 2)
- self.contents.draw_text(x, @dy * 5, 320, WLH, @doors.to_s, 2)
- self.contents.draw_text(x, @dy * 7, 320, WLH, @secrets.to_s+"/"+TOTAL_SECRETS.to_s, 2)
- self.contents.draw_text(x, @dy * 9, 320, WLH, "#{Achief.get_completed}/#{$game_system.achievements.size}", 2) if $imported["SojaBird_Achievements"]
- when 4 # Time/Date Stats
- x = 0
- self.contents.draw_title(x, @dy * 0, COMMAND_LIST[4], 364, WLH, 1)
- self.contents.draw_text(x, @dy * 2, 200, WLH, "Time Played:")
- self.contents.draw_text(x, @dy * 5, 200, WLH, "Current Date:")
- self.contents.draw_text(x, @dy * 6, 200, WLH, "Current Time:")
- get_time_date
- x += 4; self.contents.font.color = system_color
- self.contents.draw_text(x, @dy * 2, 320, WLH, @timeplayed.to_s, 2)
- self.contents.draw_text(x, @dy * 5, 320, WLH, @cdate, 2)
- self.contents.draw_text(x, @dy * 6, 320, WLH, @ctime, 2)
- when 5 # Map Stats
- x = 0
- self.contents.draw_title(x, @dy * 0, COMMAND_LIST[5], 364, WLH, 1)
- self.contents.draw_text(x, @dy * 2, 200, WLH, "Map Location:")
- self.contents.draw_text(x, @dy * 3, 200, WLH, "Player Coordinates:")
- self.contents.draw_text(x, @dy * 5, 200, WLH, "Towns Visited:")
- x += 4; self.contents.font.color = system_color
- self.contents.draw_text(x, @dy * 2, 320, WLH, $game_map.name, 2)
- draw_player_coords(x, @dy * 3, 320, WLH, 2)
- self.contents.draw_text(x, @dy * 5, 320, WLH, @towns.to_s, 2)
- when 6 # Shop Stats
- x = 0
- self.contents.draw_title(x, @dy * 0, COMMAND_LIST[6], 364, WLH, 1)
- self.contents.draw_text(x, @dy * 2, 200, WLH, "Number of Shop Visits:")
- self.contents.draw_text(x, @dy * 4, 200, WLH, "Total #{@gold_term} Gained (Sold):")
- self.contents.draw_text(x, @dy * 5, 200, WLH, "Total #{@gold_term} Spent (Bought):")
- x += 4; self.contents.font.color = system_color
- self.contents.draw_text(x, @dy * 2, 320, WLH, @shops.to_s, 2)
- self.contents.draw_text(x, @dy * 4, 320, WLH, "Not implemented", 2)
- self.contents.draw_text(x, @dy * 5, 320, WLH, "Not implemented", 2)
- when 7 # Party Stats
- x = 0
- self.contents.draw_title(x, @dy * 0, COMMAND_LIST[7], 364, WLH, 1)
- #~ #--------------------------------------------------------------------------
- #~ # * Draw Party Characters
- #~ # x : Draw spot X coordinate
- #~ # y : Draw spot Y coordinate
- #~ #--------------------------------------------------------------------------
- self.contents.draw_text(x, @dy * 3, 200, WLH, "Number of Party Members:")
- self.contents.draw_text(x, @dy * 4, 200, WLH, "Party Leader:")
- x += 4; self.contents.font.color = system_color
- self.contents.draw_text(x, @dy * 3, 320, WLH, @party.to_s, 2)
- self.contents.draw_text(x, @dy * 4, 320, WLH, @leader.to_s, 2)
- end
- if SHOW_PICTURES && idx >= 0
- self.contents.draw_picture(COMMAND_LIST[idx], 0, 216) rescue return
- end
- end
- #--------------------------------------------------------------------------
- # * Get System Time and Date
- #--------------------------------------------------------------------------
- def get_time_date
- t = Time.new
- @total_sec = Graphics.frame_count / Graphics.frame_rate
- hour = @total_sec / 60 / 60
- min = @total_sec / 60 % 60
- sec = @total_sec % 60
- @timeplayed = sprintf("%02d:%02d:%02d", hour, min, sec)
- @cdate = t.strftime("%a, %d %b, %Y")
- @ctime = t.strftime("%I:%M:%S %p")
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- refresh
- end
- end
- class Game_Temp
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :stats_menu_flag
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- alias cwxs_gmtmp_initialize initialize
- def initialize
- cwxs_gmtmp_initialize
- @stats_menu_flag = false
- end
- end
- #==============================================================================
- # ** Game_Enemy
- #==============================================================================
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # This adds the "Kill Counter" for each monster defeated |--ALIASED--|
- #--------------------------------------------------------------------------
- alias cwexs_perform_collapse perform_collapse
- def perform_collapse
- cwexs_perform_collapse
- # Check number of enemies
- $game_stats.kill_count = {} if $game_stats.kill_count == nil
- if $game_stats.kill_count == nil
- $game_stats.kill_count = 0
- end
- # Add to "Kill Count" per monster
- $game_stats.kill_count += 1
- end
- end
- #==============================================================================
- # ** Game_Map
- #==============================================================================
- class Game_Map
- #--------------------------------------------------------------------------
- # * Public Instance Variables |--ADDED--|
- #--------------------------------------------------------------------------
- attr_accessor :from_map # Set game map flag
- attr_accessor :from_shop
- #--------------------------------------------------------------------------
- # * Object Initialization |--ALIASED--|
- #--------------------------------------------------------------------------
- alias cwexs_gmap_initialize initialize
- def initialize
- cwexs_gmap_initialize
- @from_map = false
- @from_shop = false
- end
- #--------------------------------------------------------------------------
- # * Map Name |--ADDED--|
- #--------------------------------------------------------------------------
- def name
- map_data = load_data("Data/MapInfos.rvdata")
- return map_data[$game_map.map_id].name
- end
- end
- #==============================================================================
- # ** Game_Interpreter
- #==============================================================================
- class Game_Interpreter
- include EXTRA_STATS_CONFIG
- #--------------------------------------------------------------------------
- # * Change EXP |--OVERWRITTEN--|
- #--------------------------------------------------------------------------
- def command_315
- value = operate_value(@params[1], @params[2], @params[3])
- iterate_actor_id(@params[0]) do |actor|
- actor.change_exp(actor.exp + value, @params[4])
- $game_stats.total_exp_count += value
- end
- return true
- end
- #--------------------------------------------------------------------------
- # * Change Gold
- #--------------------------------------------------------------------------
- def command_125
- value = operate_value(@params[0], @params[1], @params[2])
- $game_party.gain_gold(value)
- $game_stats.total_gold_count += value unless $game_map.from_shop
- p($game_map.from_shop)
- return true
- end
- end
- #==============================================================================
- # ** Window_Base
- #==============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # * Draw Player Coordinates
- # x : Draw x-coordinate
- # y : Draw y-coordinate
- # w : Content width
- # h : Content height
- # a : Text alignment
- #--------------------------------------------------------------------------
- def draw_player_coords(x, y, w, h, a = 1)
- @player_x, @player_y = $game_player.x, $game_player.y
- text = "X: "+@player_x.to_s+", Y: "+@player_y.to_s
- self.contents.draw_text(x, y, w, h, text, a)
- end
- end
- #==============================================================================
- # ** Scene_Title
- #==============================================================================
- class Scene_Title < Scene_Base
- #--------------------------------------------------------------------------
- # * Start processing
- #--------------------------------------------------------------------------
- alias cwxstat_start start
- def start
- cwxstat_start
- $game_stats.start
- end
- #--------------------------------------------------------------------------
- # * Create Game Objects
- #--------------------------------------------------------------------------
- alias cwxstat_create_objects create_game_objects
- def create_game_objects
- cwxstat_create_objects
- $game_stats = Game_Stats.new
- end
- end
- #==============================================================================
- # ** Scene_Menu
- #==============================================================================
- class Scene_Menu < Scene_Base
- include EXTRA_STATS_CONFIG
- #--------------------------------------------------------------------------
- # * Create Command Window |--OVERWRITTEN--|
- #--------------------------------------------------------------------------
- def create_command_window
- command_list = [Vocab::item, Vocab::skill, Vocab::equip, Vocab::status,
- Vocab::save, Vocab::game_end]
- if EXTRA_STATS
- commands = command_list.first(4)
- commands.push STATS_MENU_TEXT
- 2.times do |cmd| commands.push command_list.last(2)[cmd] end
- else
- commands = command_list
- end
- @command_window = Window_Command.new(160, commands)
- @command_window.index = @menu_index
- if $game_party.members.size == 0 # If number of party members is 0
- @command_window.draw_item(0, false) # Disable item
- @command_window.draw_item(1, false) # Disable skill
- @command_window.draw_item(2, false) # Disable equipment
- @command_window.draw_item(3, false) # Disable status
- end
- if $game_system.save_disabled # If save is forbidden
- @command_window.draw_item(4, false) # Disable save
- end
- end
- #--------------------------------------------------------------------------
- # * Update Command Selection |--OVERWRITTEN--|
- #--------------------------------------------------------------------------
- def update_command_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- $scene = Scene_Map.new
- elsif Input.trigger?(Input::C)
- if $game_party.members.size == 0 and @command_window.index < 4
- Sound.play_buzzer
- return
- elsif $game_system.save_disabled and @command_window.index == 4
- Sound.play_buzzer
- return
- end
- Sound.play_decision
- case @command_window.index
- when 0 # Item
- $scene = Scene_Item.new
- when 1,2,3 # Skill, equipment, status
- start_actor_selection
- when 4 # Extra Stats/Save
- if EXTRA_STATS
- $scene = Scene_Stats.new
- else $scene = Scene_File.new(true, false, false)
- end
- when 5 # Save/End Game
- if EXTRA_STATS; $scene = Scene_File.new(true, false, false)
- else $scene = Scene_End.new
- end
- when 6
- if EXTRA_STATS; $scene = Scene_End.new; end
- end
- end
- end
- end
- #==============================================================================
- # ** Window_Title
- #------------------------------------------------------------------------------
- # This is the window for displaying the Extra Stats title.
- #==============================================================================
- class Window_Title < Window_Base
- include EXTRA_STATS_CONFIG
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(x = 0, y = 0)
- super(x, y, 544, WLH + 32)
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.draw_title(0, 0, STATS_MENU_TEXT, 544, WLH, 1, false)
- end
- end
- #==============================================================================
- # ** Scene_Map
- #==============================================================================
- class Scene_Map < Scene_Base
- include EXTRA_STATS_CONFIG
- #--------------------------------------------------------------------------
- # * Frame Update |--ALIASED--|
- #--------------------------------------------------------------------------
- alias cwexs_scnmap_update update
- def update
- cwexs_scnmap_update
- if EXTRA_STATS_KEYPRESS
- if Input.press?(EXTRA_STATS_KEY)
- $game_map.from_map = true
- $scene = Scene_Stats.new
- end
- end
- end
- end
- #==============================================================================
- # ** Scene_Battle
- #==============================================================================
- class Scene_Battle
- #--------------------------------------------------------------------------
- # * Process Start Battle |--ALIASED--|
- #--------------------------------------------------------------------------
- alias cwexsbai_scnbtl_procbtlstrt process_battle_start
- def process_battle_start(*args)
- # Add to battle counter
- $game_stats.battle_count += 1
- # Run Original Method
- cwexsbai_scnbtl_procbtlstrt(*args)
- end
- #--------------------------------------------------------------------------
- # This adds to the "Escape Counter" for each successful escape|--ALIASED--|
- #--------------------------------------------------------------------------
- alias cw_process_escape process_escape
- def process_escape
- cw_process_escape
- if $game_troop.preemptive
- success = true
- else
- success = (rand(100) < @escape_ratio)
- end
- Sound.play_escape
- if success
- wait_for_message
- battle_end(1)
- $game_stats.escape_count += 1
- else
- @escape_ratio += 10
- $game_message.texts.push('\.' + Vocab::EscapeFailure)
- wait_for_message
- $game_party.clear_actions
- start_main
- end
- end
- #--------------------------------------------------------------------------
- # This adds to the "Victory Counter" for each combat won |--ALIASED--|
- #--------------------------------------------------------------------------
- alias cw_process_victory process_victory
- def process_victory
- cw_process_victory
- $game_stats.victory_count += 1
- end
- #--------------------------------------------------------------------------
- # * Display Gained Experience and Gold |--OVERWRITTEN--|
- #--------------------------------------------------------------------------
- def display_exp_and_gold
- exp = $game_troop.exp_total
- gold = $game_troop.gold_total
- $game_party.gain_gold(gold)
- $game_stats.total_gold_count += gold
- $game_stats.total_exp_count += exp
- text = sprintf(Vocab::Victory, $game_party.name)
- $game_message.texts.push('\|' + text)
- if exp > 0
- text = sprintf(Vocab::ObtainExp, exp)
- $game_message.texts.push('\.' + text)
- end
- if gold > 0
- text = sprintf(Vocab::ObtainGold, gold, Vocab::gold)
- $game_message.texts.push('\.' + text)
- end
- wait_for_message
- end
- end
- #==============================================================================
- # ** Scene_Shop
- #==============================================================================
- class Scene_Shop < Scene_Base
- #--------------------------------------------------------------------------
- # * Confirm Number Input
- #--------------------------------------------------------------------------
- alias cwexs_scnshop_decide_number decide_number_input
- def decide_number_input
- cwexs_scnshop_decide_number
- case @command_window.index
- when 0
- $game_stats.total_gold_spent += (@number_window.number * @item.price)
- when 1
- $game_stats.total_gold_count += $game_party.gain_gold((@item.price / 2))
- end
- end
- #--------------------------------------------------------------------------
- # * Dispose of Command Window
- #--------------------------------------------------------------------------
- alias cwexs_scnshop_dispose_cmd dispose_command_window
- def dispose_command_window
- cwexs_scnshop_dispose_cmd
- $game_map.from_shop = true
- $game_stats.shop_count += 1
- end
- end
- #==============================================================================
- # ** Scene_File
- #==============================================================================
- class Scene_File < Scene_Base
- #--------------------------------------------------------------------------
- # * Write Save Data
- # file : write file object (opened)
- #--------------------------------------------------------------------------
- alias cwess_scnfl_write_save write_save_data
- def write_save_data(file)
- cwess_scnfl_write_save(file)
- Marshal.dump($game_stats, file)
- end
- #--------------------------------------------------------------------------
- # * Read Save Data
- # file : file object for reading (opened)
- #--------------------------------------------------------------------------
- alias cwess_scnfl_read_save read_save_data
- def read_save_data(file)
- cwess_scnfl_read_save(file)
- $game_stats = Marshal.load(file)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement