Advertisement
CompanionWulf

Extra Stats Script v4.0 (RMVX)

Aug 29th, 2015
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 60.17 KB | None | 0 0
  1. =begin
  2. ╔══════════════════════════════════════════════════════════════════════════════╗
  3. ║ Extra Stats Script                                                           ║
  4. ╟──────────────────────────────────────────────────────────────────────────────╢
  5. ║   Version       : 4.0                                                        ║
  6. ║   Author        : Companion Wulf                                             ║
  7. ║   Platform      : RMVX                                                       ║
  8. ║   Release Date  : 29 August 2015                                             ║
  9. ║   Last Update   : 10 May 2015                                                ║
  10. ║   Demo Version  : N/A                                                        ║
  11. ║   Demo Date     : Unreleased                                                 ║
  12. ╟──────────────────────────────────────────────────────────────────────────────╢
  13. ║ ◄ Websites ►                                                                 ║
  14. ╟──────────────────────────────────────────────────────────────────────────────╢
  15. ║   Website        : http://rpgmakertimes.info                                 ║
  16. ║   Main Blog      : http://blog.rpgmakertimes.info                            ║
  17. ║   Companion Blog : http://rpgmakertimes.blogspot.com                         ║
  18. ║   Otherworld     : http://projects.rpgmakertimes.info/otherworld             ║
  19. ║                                                                              ║
  20. ╠══════════════════════════════════════════════════════════════════════════════╣
  21. ║ ◄ DESCRIPTION ►                                                              ║
  22. ╟──────────────────────────────────────────────────────────────────────────────╢
  23. ║  The Extra Stats script is for keeping track of some in-game stats, ranging  ║
  24. ║  from battles to  game progress.  It evolved from a  small scriptlet to log  ║
  25. ║  the number of battles fought, won and lost, and more stats were added over  ║
  26. ║  time to become a complete script.                                           ║
  27. ║                                                                              ║
  28. ╠══════════════════════════════════════════════════════════════════════════════╣
  29. ║ ◄ KNOWN COMPATABILITY ISSUES ►                                               ║
  30. ╟──────────────────────────────────────────────────────────────────────────────╢
  31. ║  As far as I know there are no compatibility issues with this script. There  ║
  32. ║  may be some for other scripts that modify or overwrite Scene_Menu though.   ║
  33. ║                                                                              ║
  34. ╠══════════════════════════════════════════════════════════════════════════════╣
  35. ║ ◄ REQUIRED SCRIPTS ►                                                         ║
  36. ╟──────────────────────────────────────────────────────────────────────────────╢
  37. ║  The following script is required to run the Extra Stats script:             ║
  38. ║                                                                              ║
  39. ║   ● Global Colors Module (GCM)                                               ║
  40. ║                                                                              ║
  41. ╠══════════════════════════════════════════════════════════════════════════════╣
  42. ║ ◄ INSTRUCTIONS ►                                                             ║
  43. ╟──────────────────────────────────────────────────────────────────────────────╢
  44. ║  **Instructions are to follow!**                                             ║
  45. ║                                                                              ║
  46. ╟──────────────────────────────────────────────────────────────────────────────╢
  47. ║ ◄ Instruction Manual ►                                                       ║
  48. ╟──────────────────────────────────────────────────────────────────────────────╢
  49. ║  A comprehensive manual will be produced (in DOC and PDF formats) soon.      ║
  50. ║                                                                              ║
  51. ╠══════════════════════════════════════════════════════════════════════════════╣
  52. ║ ◄ EXTRA STATS SCRIPT VERSION HISTORY ►                                       ║
  53. ╟──────────────────────────────────────────────────────────────────────────────╢
  54. ║  The version history tracking will be changing to the following format:      ║
  55. ║                                                                              ║
  56. ║     Release.Updates.Developmental.Manual                                     ║
  57. ║                                                                              ║
  58. ║  Release numbers indicate public release versions.                           ║
  59. ║                                                                              ║
  60. ║  Updates refers to new  scripts/scriptlets and  new methods that  have been  ║
  61. ║  added. This includes major and minor updates.                               ║
  62. ║                                                                              ║
  63. ║  Developmental updates are for tweaks or bug fixes.                          ║
  64. ║                                                                              ║
  65. ║  Manual indicates major updates to the Extra Stats manual.                   ║
  66. ║                                                                              ║
  67. ╟──────────────────────────────────────────────────────────────────────────────╢
  68. ║ ◄ Updates Version History ►                                                  ║
  69. ╟──────────────────────────────────────────────────────────────────────────────╢
  70. ║  I didn't  keep accurate  version updates  with this script,  so I've based  ║
  71. ║  this on the information I have. After Version 2.0.0.0, I kept more regular  ║
  72. ║  records as I added things to it and made additional tweaks.                 ║
  73. ║                                                                              ║
  74. ║  I also realised  that I've never released a proper manual  for this script  ║
  75. ║  (not that it necessarily needs one,  since it's mostly plug-and-play). The  ║
  76. ║  manual is available, nevertheless, for  completeness and to explain how to  ║
  77. ║  use its settings and how to implement some of its features.                 ║
  78. ║                                                                              ║
  79. ╟──────────────────────────────────────────────────────────────────────────────╢
  80. ║ VERSION 5.0+ - Future Updates                                                ║
  81. ║   ● Add: Total Damage Inflicted  [Battle Stats]                              ║
  82. ║   ● Add: Total Damage Sustained  [Battle Stats]                              ║
  83. ║   ● Add: Total Combat Rounds     [Battle Stats]                              ║
  84. ║   ● Add: Party Members graphics  [System Stats]                              ║
  85. ║   ● Add: Total Potions Used      [System Stats]                              ║
  86. ║   ● Add: Total Money (Bought)    [System Shop]                               ║
  87. ║   ● Add: Total Money (Sold)      [System Shop]                               ║
  88. ║                                                                              ║
  89. ╟──────────────────────────────────────────────────────────────────────────────╢
  90. ║   v4.0.0.0 (29-Aug-2015)                                                     ║
  91. ║     ● Release: Version 4.0                                                   ║
  92. ╟──────────────────────────────────────────────────────────────────────────────╢
  93. ║   v3.5.17.0 (22-Aug-2015)                                                    ║
  94. ║     ● Add: Compatibility with SojaBird's Achievement script                  ║
  95. ║     ● Tweak: Section titles reflect settings in COMMAND_LIST                 ║
  96. ║     ● Tweak: Maximum secrets (configurable)                                  ║
  97. ║     ● Bug Fix: Saved stats reset upon loading save file                      ║
  98. ╟──────────────────────────────────────────────────────────────────────────────╢
  99. ║   v3.4.14.0 (10-May-2015)                                                    ║
  100. ║     ● Bug Fix: Rescue for missing or incorrect section pictures              ║
  101. ║     ● Tweak: Display currency term (from Database) rather than generic term  ║
  102. ║     ● Stats Added:                                                           ║
  103. ║       o Party Leader                                                         ║
  104. ║     ● Tweak: Remove some duplicate code                                      ║
  105. ║     ● Add: Stats section pictures                                            ║
  106. ║     ● Tweak: Renamed/reordered some sections                                 ║
  107. ║     ● Tweak: Add Shops and Party stats sections                              ║
  108. ║     ● Update: Complete rewrite to include stats menu                         ║
  109. ║     ● Update: Removed reliability on Universal Configuration Settings        ║
  110. ╟──────────────────────────────────────────────────────────────────────────────╢
  111. ║   v3.1.7.0 (13-Nov-2013)                                                     ║
  112. ║     ● Tweak: Column separator line                                           ║
  113. ╟──────────────────────────────────────────────────────────────────────────────╢
  114. ║   v3.1.6.0 (08-Nov-2013)                                                     ║
  115. ║     ● Add: Background (set in EXTRA_STATS_CONFIG Module)                     ║
  116. ╟──────────────────────────────────────────────────────────────────────────────╢
  117. ║   v3.1.5.0 (30-Sep-2013)                                                     ║
  118. ║     ● Bug Fix: Total gold spent updating twice                               ║
  119. ║     ● Add: Total gold update when gained through Change Gold event command   ║
  120. ╟──────────────────────────────────────────────────────────────────────────────╢
  121. ║   v3.1.3.0 (28-Sep-2013)                                                     ║
  122. ║     ● Stat Added: Number of shops visited                                    ║
  123. ║     ● Separated variables into single class (rather than into Game_System)   ║
  124. ║     ● Add: Universal Configuration Settings checker                          ║
  125. ║     ● Integrated old config settings into Universal Configuration Settings   ║
  126. ╟──────────────────────────────────────────────────────────────────────────────╢
  127. ║   v3.0.0.0 (30-Apr-2013)                                                     ║
  128. ║     ● Release: Version 3.0                                                   ║
  129. ╟──────────────────────────────────────────────────────────────────────────────╢
  130. ║   v2.2.12.1 (23-Apr-2013)                                                    ║
  131. ║     ● Manual: Full manual written                                            ║
  132. ║     ● Add: Exp gain from Change EXP event command                            ║
  133. ╟──────────────────────────────────────────────────────────────────────────────╢
  134. ║   v2.2.11.0 (21-Apr-2013)                                                    ║
  135. ║     ● Add: Money Spent (in shops) counter                                    ║
  136. ╟──────────────────────────────────────────────────────────────────────────────╢
  137. ║   v2.2.10.0 (20-Apr-2013)                                                    ║
  138. ║     ● Demo: Began working demo                                               ║
  139. ║     ● Bug Fix: Save Menu command index corrected                             ║
  140. ║     ● Bug Fix: Menu commands not pushing properly                            ║
  141. ║     ● Add: Dispose Extra Stats with Keypress alongside default cancel button ║
  142. ╟──────────────────────────────────────────────────────────────────────────────╢
  143. ║   v2.1.7.0 (23-Mar-2013)                                                     ║
  144. ║     ● Tweak: Extra Stats Window closed with cancel/assigned key (on map)     ║
  145. ╟──────────────────────────────────────────────────────────────────────────────╢
  146. ║   v2.1.6.0 (22-Mar-2013)                                                     ║
  147. ║     ● Bug Fix: Keypress function malfunction                                 ║
  148. ╟──────────────────────────────────────────────────────────────────────────────╢
  149. ║   v2.1.5.0 (18-Mar-2013)                                                     ║
  150. ║     ● Add: Encounter Ratio value                                             ║
  151. ╟──────────────────────────────────────────────────────────────────────────────╢
  152. ║   v2.1.4.0 (15-Mar-2013)                                                     ║
  153. ║     ● Add: Number of Party Members                                           ║
  154. ╟──────────────────────────────────────────────────────────────────────────────╢
  155. ║   v2.1.3.0 (28-Jan-2013)                                                     ║
  156. ║     ● Add: Player Coordinates                                                ║
  157. ╟──────────────────────────────────────────────────────────────────────────────╢
  158. ║   v2.1.2.0 (27-Jan-2013)                                                     ║
  159. ║     ● Add: Keypress function to display Extra Stats on map                   ║
  160. ║     ● Bug Fix: Total Gold counter                                            ║
  161. ║     ● Bug Fix: Total Exp counter                                             ║
  162. ╟──────────────────────────────────────────────────────────────────────────────╢
  163. ║   v2.0.0.0 (20-Jan-2013)                                                     ║
  164. ║     ● Release Version 2.0                                                    ║
  165. ╟──────────────────────────────────────────────────────────────────────────────╢
  166. ║   v1.2.16.0 (06-Sep-2012)                                                    ║
  167. ║     ● Integrated with Q-Engine                                               ║
  168. ╟──────────────────────────────────────────────────────────────────────────────╢
  169. ║   v1.1.16.0 (??-???-2012)                                                    ║
  170. ║     ● Bug Fix: Total Gold counter not updating correctly                     ║
  171. ║     ● Bug Fix: Total Exp counter not updating correctly                      ║
  172. ╟──────────────────────────────────────────────────────────────────────────────╢
  173. ║   v1.1.14.0 (07-Feb-2011)                                                    ║
  174. ║     ● Stats Added:                                                           ║
  175. ║       o Total Experience Gained                                              ║
  176. ║       o Total Gold Obtained (Battles Only)                                   ║
  177. ║       o Number of Chests Opened                                              ║
  178. ║       o Number of Keys Found                                                 ║
  179. ║       o Number of Secrets Found                                              ║
  180. ║       o Number of Towns Visited                                              ║
  181. ║       o Total Number of Battles                                              ║
  182. ║     ● Changed layout and tidied code                                         ║
  183. ╟──────────────────────────────────────────────────────────────────────────────╢
  184. ║   v1.0.7.0 (15-Aug-2010)                                                     ║
  185. ║     ● Remove: Game Title/Author options in Extra Stats Window                ║
  186. ╟──────────────────────────────────────────────────────────────────────────────╢
  187. ║   v1.0.6.0 (??-???-2010)                                                     ║
  188. ║     ● Add: Map Location                                                      ║
  189. ╟──────────────────────────────────────────────────────────────────────────────╢
  190. ║   v1.0.5.0 (07-Jul-2010)                                                     ║
  191. ║     ● Add: Game Progress Counter                                             ║
  192. ║     ● Add: Total Quests/Completed                                            ║
  193. ╟──────────────────────────────────────────────────────────────────────────────╢
  194. ║   v1.0.2.0 (29-Jun-2010)                                                     ║
  195. ║     ● Add: Total Chests Opened and Total Achievements                        ║
  196. ╟──────────────────────────────────────────────────────────────────────────────╢
  197. ║   v1.0.1.0 (??-???-2010)                                                     ║
  198. ║     ● Add: Total Battles                                                     ║
  199. ╟──────────────────────────────────────────────────────────────────────────────╢
  200. ║   v1.0.0.0 (18-Jun-2010)                                                     ║
  201. ║     ● Release: Version 1.0                                                   ║
  202. ║     ● Stats Added:                                                           ║
  203. ║       o Number of Saves                                                      ║
  204. ║       o Number of Inn Stays                                                  ║
  205. ║       o Number of Steps                                                      ║
  206. ║       o Total Victories                                                      ║
  207. ║       o Total Kills                                                          ║
  208. ║       o Total Escapes                                                        ║
  209. ╟──────────────────────────────────────────────────────────────────────────────╢
  210. ║   v0.1.0.0 (15-Jun-2010)                                                     ║
  211. ║     ● Began the Extra Stats script (ported from RMXP version - now lost)     ║
  212. ║                                                                              ║
  213. ╚══════════════════════════════════════════════════════════════════════════════╝
  214. =end
  215.  
  216. #==============================================================================
  217. # Extra Stats VX Core Engine
  218. #==============================================================================
  219. $imported = {} if $imported == nil; $imported["CW-ExtraStats-VX-v4"] = true
  220.  
  221. module EXTRA_STATS_CONFIG
  222.   include CW_GLOBAL_COLORS
  223.   #────────────────────────────────────────────────────────────────────────────
  224.   # * Font Settings
  225.   #────────────────────────────────────────────────────────────────────────────
  226.   DEFAULT_FONT = "Trebuchet MS"     # Change default font
  227.   DEFAULT_SIZE = 18                 # Change default font size
  228.   DEFAULT_TITLE_FONT = "Arial"      # Change default font for titles
  229.   DEFAULT_TITLE_SIZE = 26           # Change default font size for titles
  230.  
  231.   #────────────────────────────────────────────────────────────────────────────
  232.   # * Text Colours
  233.   #────────────────────────────────────────────────────────────────────────────
  234.   DEFAULT_TEXT_COLOR = WHITE        # Default colour for text
  235.   DEFAULT_TITLE_COLOR = YELLOW      # Default colour for titles
  236.   DEFAULT_SHADOW_COLOR = YELLOW     # Set colour for draw_font_shadow method
  237.   DEFAULT_OUTLINE_COLOR = YELLOW    # Set colour for draw_outline method
  238.   LINE_COLOR = LightBlue            # Default colour for dividing underlines
  239.  
  240.   #────────────────────────────────────────────────────────────────────────────
  241.   # * Extra Stats Menu Settings *
  242.   #────────────────────────────────────────────────────────────────────────────
  243.   EXTRA_STATS = true                # Include in Status Menu on/off
  244.     STATS_MENU_TEXT = "Extra Stats" # Menu item text
  245.   EXTRA_STATS_KEYPRESS = true       # Allow/disallow access keypress from map
  246.     EXTRA_STATS_KEY = Input::Z      # Set keypress to call Extra Stats from map
  247.   COMMAND_LIST = [                  # Extra Stats section headers
  248.       "System Stats", "Battle Stats", "Personal Stats", "Progress Stats",
  249.       "Time/Date Stats", "Map Stats", "Shop Stats", "Party Stats"
  250.     ]
  251.  
  252.   #────────────────────────────────────────────────────────────────────────────
  253.   # * Additional Extra Stats Settings *
  254.   #────────────────────────────────────────────────────────────────────────────
  255.   TOTAL_SECRETS = 10                # Total number of secrets
  256.  
  257.   #────────────────────────────────────────────────────────────────────────────
  258.   # * Menu Background *
  259.   #────────────────────────────────────────────────────────────────────────────
  260.   MENU_BACKGROUND = true            # Toggle background behind menu screens
  261.     MENU_BG_GRAPHIC = ""            # Set the menu background
  262.     MENU_BG_OPAQUE = 155            # Set the menu background opacity
  263.     WINDOWS_OPACITY = 60            # Set opacity for all windows
  264.    
  265.   #────────────────────────────────────────────────────────────────────────────
  266.   # * Menu Pictures *
  267.   #────────────────────────────────────────────────────────────────────────────
  268.   # Each picture is stored in the "Graphics/Pictures" folder and is named the
  269.   # same as the corresponding menu item (the same as in COMMAND_LIST above):
  270.   #
  271.   # System Stats, Battle Stats, Personal Stats, Game Stats, TimeDate Stats,
  272.   # Map Stats and Shop Stats.
  273.   #
  274.   # Recommended size is no larger than 364 x 129, as these will be placed at
  275.   # the bottom of each section.
  276.   #
  277.   # Pictures aren't mandatory, however, so if any (or all) don't exist, then
  278.   # the normal stats information will be displayed with no pictures.
  279.   #────────────────────────────────────────────────────────────────────────────
  280.   SHOW_PICTURES = true              # Show pictures for each command item
  281.     PICTURES_LIST = [               # List of section pictures to display
  282.     ]
  283. end
  284.  
  285. #==============================================================================
  286. # ** Game_Stats
  287. #==============================================================================
  288. class Game_Stats
  289.   #--------------------------------------------------------------------------
  290.   # * Public Instance Variables                                   |--ADDED--|
  291.   #--------------------------------------------------------------------------
  292.   attr_accessor :victory_count      # Number of battles won
  293.   attr_accessor :inn_count          # Number of stays at an inn
  294.   attr_accessor :kill_count         # Number of monsters defeated
  295.   attr_accessor :escape_count       # Number of escapes from battle
  296.   attr_accessor :game_progress      # Game progress percentage
  297.   attr_accessor :chest_count        # Number of chests opened
  298.   attr_accessor :door_count         # Number of doors opened
  299.   attr_accessor :secrets_count      # Number of secrets unlocked
  300.   attr_accessor :town_count         # Number of towns visited
  301.   attr_accessor :battle_count       # Total number of battles won
  302.   attr_accessor :total_exp_count    # Total experience gained
  303.   attr_accessor :total_gold_count   # Total gold obtained
  304.   attr_accessor :total_gold_spent   # Total gold spent (in shops)
  305.   attr_accessor :shop_count         # Number of times shop visited
  306.   #--------------------------------------------------------------------------
  307.   # * Object Initialization
  308.   #--------------------------------------------------------------------------
  309.   def start
  310.     if not $imported["CWColors"]
  311.       RPG::BGM.stop
  312.       p("The Global Colors Module is not installed. " +
  313.       "Please make sure it is installed or enabled before the game is run.")
  314.       exit
  315.     end
  316.     # Set up variables
  317.     @victory_count = 0
  318.     @inn_count = 0
  319.     @kill_count = 0
  320.     @escape_count = 0
  321.     @game_progress = 0
  322.     @chest_count = 0
  323.     @door_count = 0
  324.     @secrets_count = 0
  325.     @town_count = 0
  326.     @battle_count = 0
  327.     @total_exp_count = 0
  328.     @total_gold_count = 0
  329.     @total_gold_spent = 0
  330.     @shop_count = 0
  331.   end
  332. end
  333.  
  334. #==============================================================================
  335. # ** Scene_Stats                                                    |--ADDED--|
  336. #------------------------------------------------------------------------------
  337. #  This class handles the stat window, where all of the stat variables are
  338. # displayed.
  339. #==============================================================================
  340. class Scene_Stats < Scene_Base
  341.   include EXTRA_STATS_CONFIG
  342.   #--------------------------------------------------------------------------
  343.   # * Initialize
  344.   #--------------------------------------------------------------------------
  345.   def initialize(menu_index = 0)
  346.     @menu_index = menu_index
  347.     $game_temp.stats_menu_flag = -1
  348.   end
  349.   #--------------------------------------------------------------------------
  350.   # * Start processing
  351.   #--------------------------------------------------------------------------
  352.   def start
  353.     super
  354.     if MENU_BACKGROUND
  355.       @menuback_sprite = Sprite.new
  356.       @menuback_sprite.bitmap = Cache.picture(MENU_BG_GRAPHIC)
  357.       @menuback_sprite.x = 0
  358.       @menuback_sprite.y = 0
  359.       @menuback_sprite.color.set(16, 16, 16, MENU_BG_OPAQUE)
  360.       update_menu_background
  361.     end
  362.     create_windows
  363.     create_commands_list
  364.   end
  365.   #--------------------------------------------------------------------------
  366.   # * Create windows
  367.   #--------------------------------------------------------------------------
  368.   def create_windows
  369.     @stats_title = Window_Title.new
  370.     @stats_window = Window_Stats.new(181, 56)
  371.     @stats_title.opacity = @stats_window.opacity = WINDOWS_OPACITY
  372.   end
  373.   #--------------------------------------------------------------------------
  374.   # * Create commands list
  375.   #--------------------------------------------------------------------------
  376.   def create_commands_list
  377.     commands = COMMAND_LIST
  378.     @command_window = Window_Command.new(180, commands, 1)
  379.     @command_window.x, @command_window.y = 0, 56
  380.     @command_window.opacity = WINDOWS_OPACITY
  381.     @command_window.index = @menu_index
  382.   end
  383.   #--------------------------------------------------------------------------
  384.   # * Dispose windows
  385.   #--------------------------------------------------------------------------
  386.   def terminate
  387.     super
  388.     @stats_title.dispose
  389.     @stats_window.dispose
  390.     @command_window.dispose
  391.     @menuback_sprite.dispose
  392.   end
  393.   #--------------------------------------------------------------------------
  394.   # * Return to previous scene
  395.   #--------------------------------------------------------------------------
  396.   def return_scene
  397.     if $game_map.from_map == true
  398.       $game_map.from_map = false
  399.       $scene = Scene_Map.new
  400.     else
  401.       $scene = Scene_Menu.new(4)
  402.     end
  403.   end
  404.   #--------------------------------------------------------------------------
  405.   # * Update
  406.   #--------------------------------------------------------------------------
  407.   def update
  408.     @stats_window.update
  409.     @command_window.update
  410.     if EXTRA_STATS_KEYPRESS && $game_map.from_map
  411.       if Input.trigger?(EXTRA_STATS_KEY)
  412.         Sound.play_cancel
  413.         return_scene
  414.       end
  415.     end
  416.     if Input.trigger?(Input::B)
  417.       Sound.play_cancel
  418.       return_scene
  419.     elsif Input.trigger?(Input::C)
  420.       $game_temp.stats_menu_flag = @command_window.index
  421.       command_selection(@command_window.index)
  422.     end
  423.   end
  424.   #--------------------------------------------------------------------------
  425.   # * Select commands
  426.   #--------------------------------------------------------------------------
  427.   def command_selection(cmd_index)
  428.     @cmd_index = cmd_index
  429.     $game_temp.stats_menu_flag = cmd_index
  430.   end
  431. end
  432.  
  433. #==============================================================================
  434. # ** Window_Stats                                                   |--ADDED--|
  435. #------------------------------------------------------------------------------
  436. #  This is the window for displaying the stats.
  437. #==============================================================================
  438. class Window_Stats < Window_Base
  439.   include EXTRA_STATS_CONFIG
  440.   #--------------------------------------------------------------------------
  441.   # * Object Initialization
  442.   #--------------------------------------------------------------------------
  443.   def initialize(x, y)
  444.     super(x, y, 364, 362)
  445.     self.contents.font.size = 16
  446.     define_variables
  447.     refresh
  448.   end
  449.   #--------------------------------------------------------------------------
  450.   # * Define Variables
  451.   #--------------------------------------------------------------------------
  452.   def define_variables
  453.     y = 0; @dy = y + WLH
  454.     @gold_term  = $data_system.terms.gold
  455.     @saves      = $game_system.save_count
  456.     @rests      = $game_stats.inn_count
  457.     @steps      = $game_party.steps
  458.     @battles    = $game_stats.battle_count
  459.     @escapes    = $game_stats.escape_count
  460.     @kills      = $game_stats.kill_count
  461.     @victories  = $game_stats.victory_count
  462.     @chests     = $game_stats.chest_count
  463.     @doors      = $game_stats.door_count
  464.     @secrets    = $game_stats.secrets_count
  465.     @towns      = $game_stats.town_count
  466.     @progress   = $game_stats.game_progress
  467.     @total_exp  = $game_stats.total_exp_count
  468.     @total_gold = $game_stats.total_gold_count
  469.     @total_spent= $game_stats.total_gold_spent
  470.     @party      = $game_party.members.size
  471.     @leader     = $game_party.members[0].name
  472.     @encounters = $game_player.encounter_count
  473.     @shops      = $game_stats.shop_count
  474.   end
  475.  
  476.   #--------------------------------------------------------------------------
  477.   # * Refresh
  478.   #--------------------------------------------------------------------------
  479.   def refresh
  480. #~     return if Graphics.frame_count % 10 != 0
  481.     self.contents.clear
  482.     draw_block($game_temp.stats_menu_flag)
  483.   end
  484.   #--------------------------------------------------------------------------
  485.   # * Draw stat blocks
  486.   #--------------------------------------------------------------------------
  487.   def draw_block(idx)
  488.     case idx
  489.     when -1 # Default
  490.       $game_map.from_map ? text = "Press Z to return to the map" :
  491.         text = "Press A to select the stat to view."
  492.       self.contents.draw_text(0, @dy * 6, self.width, WLH, text, 1)
  493.      
  494.     when 0 # System Stats
  495.       x = 0
  496.       self.contents.draw_title(x, @dy * 0, COMMAND_LIST[0], 330, WLH, 1)
  497.       self.contents.font.color = normal_color
  498.       self.contents.draw_text(x, @dy * 2, 200, WLH, "Number of Saves:")
  499.       self.contents.draw_text(x, @dy * 4, 200, WLH, "Number of Times Rested:")
  500.       self.contents.draw_text(x, @dy * 6, 200, WLH, "Number of Steps:")
  501.       x += 4; self.contents.font.color = system_color
  502.       self.contents.draw_text(x, @dy * 2, 320, WLH, @saves.to_s, 2)
  503.       self.contents.draw_text(x, @dy * 4, 320, WLH, @rests.to_s, 2)
  504.       self.contents.draw_text(x, @dy * 6, 320, WLH, @steps.to_s, 2)
  505.      
  506.     when 1 # Battle Stats
  507.       x = 0
  508.       self.contents.draw_title(x, @dy * 0, COMMAND_LIST[1], 364, WLH, 1)
  509.       self.contents.draw_text(x, @dy * 1, 200, WLH, "Battles Won:")
  510.       self.contents.draw_text(x, @dy * 2, 200, WLH, "Battles Escaped:")
  511.       self.contents.draw_text(x, @dy * 3, 200, WLH, "Total Battles:")
  512.       self.contents.draw_text(x, @dy * 4, 200, WLH, "Total Damage Inflicted:")
  513.       self.contents.draw_text(x, @dy * 5, 200, WLH, "Total Damage Sustained:")
  514.       self.contents.draw_text(x, @dy * 6, 200, WLH, "Total Kill Count:")
  515.       self.contents.draw_text(x, @dy * 7, 200, WLH, "Encounter Ratio:")
  516.       x += 4; self.contents.font.color = system_color
  517.       self.contents.draw_text(x, @dy * 1, 320, WLH, @victories.to_s, 2)
  518.       self.contents.draw_text(x, @dy * 2, 320, WLH, @escapes.to_s, 2)
  519.       self.contents.draw_text(x, @dy * 3, 320, WLH, @battles.to_s, 2)
  520.       self.contents.draw_text(x, @dy * 4, 320, WLH, "Not implemented", 2)
  521.       self.contents.draw_text(x, @dy * 5, 320, WLH, "Not implemented", 2)
  522.       self.contents.draw_text(x, @dy * 6, 320, WLH, @kills.to_s, 2)
  523.       self.contents.draw_text(x, @dy * 7, 320, WLH, @encounters.to_s, 2)
  524.      
  525.     when 2 # Parameter Stats
  526.       x = 0
  527.       self.contents.draw_title(x, @dy * 0, COMMAND_LIST[2], 364, WLH, 1)
  528.       self.contents.draw_text(x, @dy * 2, 200, WLH, "Total Exp Gained:")
  529.       self.contents.draw_text(x, @dy * 4, 200, WLH, "Total #{@gold_term} Gained:")
  530.       self.contents.draw_text(x, @dy * 5, 200, WLH, "Total #{@gold_term} Lost:")
  531.       x += 4; self.contents.font.color = system_color
  532.       self.contents.draw_text(x, @dy * 2, 320, WLH, @total_exp.to_s, 2)
  533.       self.contents.draw_text(x, @dy * 4, 320, WLH, @total_gold.to_s, 2)
  534.       self.contents.draw_text(x, @dy * 5, 320, WLH, @total_spent.to_s, 2)
  535.      
  536.     when 3 # Game Stats
  537.       x =  0
  538.       self.contents.draw_title(x, @dy * 0, COMMAND_LIST[3], 364, WLH, 1)
  539.       self.contents.draw_text(x, @dy * 2, 200, WLH, "Game Progress:")
  540.       self.contents.draw_text(x, @dy * 4, 200, WLH, "Chests Opened:")
  541.       self.contents.draw_text(x, @dy * 5, 200, WLH, "Doors Opened:")
  542.       self.contents.draw_text(x, @dy * 7, 200, WLH, "Secrets Unlocked:")
  543.       self.contents.draw_text(x, @dy * 9, 200, WLH, "Achievements:") if $imported["SojaBird_Achievements"]
  544.       x += 4; self.contents.font.color = system_color
  545.       self.contents.draw_text(x, @dy * 2, 320, WLH, @progress.to_s+"%", 2)
  546.       self.contents.draw_text(x, @dy * 4, 320, WLH, @chests.to_s, 2)
  547.       self.contents.draw_text(x, @dy * 5, 320, WLH, @doors.to_s, 2)
  548.       self.contents.draw_text(x, @dy * 7, 320, WLH, @secrets.to_s+"/"+TOTAL_SECRETS.to_s, 2)
  549.       self.contents.draw_text(x, @dy * 9, 320, WLH, "#{Achief.get_completed}/#{$game_system.achievements.size}", 2) if $imported["SojaBird_Achievements"]
  550.      
  551.     when 4 # Time/Date Stats
  552.       x = 0
  553.       self.contents.draw_title(x, @dy * 0, COMMAND_LIST[4], 364, WLH, 1)
  554.       self.contents.draw_text(x, @dy * 2, 200, WLH, "Time Played:")
  555.       self.contents.draw_text(x, @dy * 5, 200, WLH, "Current Date:")
  556.       self.contents.draw_text(x, @dy * 6, 200, WLH, "Current Time:")
  557.       get_time_date
  558.       x += 4; self.contents.font.color = system_color
  559.       self.contents.draw_text(x, @dy * 2, 320, WLH, @timeplayed.to_s, 2)
  560.       self.contents.draw_text(x, @dy * 5, 320, WLH, @cdate, 2)
  561.       self.contents.draw_text(x, @dy * 6, 320, WLH, @ctime, 2)
  562.      
  563.     when 5 # Map Stats
  564.       x = 0
  565.       self.contents.draw_title(x, @dy * 0, COMMAND_LIST[5], 364, WLH, 1)
  566.       self.contents.draw_text(x, @dy * 2, 200, WLH, "Map Location:")
  567.       self.contents.draw_text(x, @dy * 3, 200, WLH, "Player Coordinates:")
  568.       self.contents.draw_text(x, @dy * 5, 200, WLH, "Towns Visited:")
  569.       x += 4; self.contents.font.color = system_color
  570.       self.contents.draw_text(x, @dy * 2, 320, WLH, $game_map.name, 2)
  571.       draw_player_coords(x, @dy * 3, 320, WLH, 2)
  572.       self.contents.draw_text(x, @dy * 5, 320, WLH, @towns.to_s, 2)
  573.      
  574.     when 6 # Shop Stats
  575.       x = 0
  576.       self.contents.draw_title(x, @dy * 0, COMMAND_LIST[6], 364, WLH, 1)
  577.       self.contents.draw_text(x, @dy * 2, 200, WLH, "Number of Shop Visits:")
  578.       self.contents.draw_text(x, @dy * 4, 200, WLH, "Total #{@gold_term} Gained (Sold):")
  579.       self.contents.draw_text(x, @dy * 5, 200, WLH, "Total #{@gold_term} Spent (Bought):")
  580.       x += 4; self.contents.font.color = system_color
  581.       self.contents.draw_text(x, @dy * 2, 320, WLH, @shops.to_s, 2)
  582.       self.contents.draw_text(x, @dy * 4, 320, WLH, "Not implemented",  2)
  583.       self.contents.draw_text(x, @dy * 5, 320, WLH, "Not implemented", 2)
  584.      
  585.     when 7 # Party Stats
  586.       x = 0
  587.       self.contents.draw_title(x, @dy * 0, COMMAND_LIST[7], 364, WLH, 1)
  588. #~   #--------------------------------------------------------------------------
  589. #~   # * Draw Party Characters
  590. #~   #     x : Draw spot X coordinate
  591. #~   #     y : Draw spot Y coordinate
  592. #~   #--------------------------------------------------------------------------
  593.       self.contents.draw_text(x, @dy * 3, 200, WLH, "Number of Party Members:")
  594.       self.contents.draw_text(x, @dy * 4, 200, WLH, "Party Leader:")
  595.       x += 4; self.contents.font.color = system_color
  596.       self.contents.draw_text(x, @dy * 3, 320, WLH, @party.to_s, 2)
  597.       self.contents.draw_text(x, @dy * 4, 320, WLH, @leader.to_s, 2)
  598.     end
  599.     if SHOW_PICTURES && idx >= 0
  600.       self.contents.draw_picture(COMMAND_LIST[idx], 0, 216) rescue return
  601.     end
  602.   end
  603.   #--------------------------------------------------------------------------
  604.   # * Get System Time and Date
  605.   #--------------------------------------------------------------------------
  606.   def get_time_date
  607.     t = Time.new
  608.     @total_sec = Graphics.frame_count / Graphics.frame_rate
  609.     hour = @total_sec / 60 / 60
  610.     min = @total_sec / 60 % 60
  611.     sec = @total_sec % 60
  612.     @timeplayed = sprintf("%02d:%02d:%02d", hour, min, sec)
  613.     @cdate = t.strftime("%a, %d %b, %Y")
  614.     @ctime = t.strftime("%I:%M:%S %p")
  615.   end
  616.   #--------------------------------------------------------------------------
  617.   # * Frame Update
  618.   #--------------------------------------------------------------------------
  619.   def update
  620.     super
  621.     refresh
  622.   end
  623. end
  624.  
  625. class Game_Temp
  626.   #--------------------------------------------------------------------------
  627.   # * Public Instance Variables
  628.   #--------------------------------------------------------------------------
  629.   attr_accessor :stats_menu_flag
  630.   #--------------------------------------------------------------------------
  631.   # * Object Initialization
  632.   #--------------------------------------------------------------------------
  633.   alias cwxs_gmtmp_initialize initialize
  634.   def initialize
  635.     cwxs_gmtmp_initialize
  636.     @stats_menu_flag = false
  637.   end
  638. end
  639.  
  640. #==============================================================================
  641. # ** Game_Enemy
  642. #==============================================================================
  643. class Game_Enemy < Game_Battler
  644.   #--------------------------------------------------------------------------
  645.   # This adds the "Kill Counter" for each monster defeated      |--ALIASED--|
  646.   #--------------------------------------------------------------------------
  647.   alias cwexs_perform_collapse perform_collapse
  648.   def perform_collapse
  649.     cwexs_perform_collapse
  650.     # Check number of enemies
  651.     $game_stats.kill_count = {} if $game_stats.kill_count == nil
  652.     if $game_stats.kill_count == nil
  653.       $game_stats.kill_count = 0
  654.     end
  655.     # Add to "Kill Count" per monster
  656.     $game_stats.kill_count += 1
  657.   end
  658. end
  659.  
  660. #==============================================================================
  661. # ** Game_Map
  662. #==============================================================================
  663. class Game_Map
  664.   #--------------------------------------------------------------------------
  665.   # * Public Instance Variables                                   |--ADDED--|
  666.   #--------------------------------------------------------------------------
  667.   attr_accessor :from_map                 # Set game map flag
  668.   attr_accessor :from_shop
  669.   #--------------------------------------------------------------------------
  670.   # * Object Initialization                                     |--ALIASED--|
  671.   #--------------------------------------------------------------------------
  672.   alias cwexs_gmap_initialize initialize
  673.   def initialize
  674.     cwexs_gmap_initialize
  675.     @from_map = false
  676.     @from_shop = false
  677.   end
  678.   #--------------------------------------------------------------------------
  679.   # * Map Name                                                    |--ADDED--|
  680.   #--------------------------------------------------------------------------
  681.   def name
  682.     map_data = load_data("Data/MapInfos.rvdata")
  683.     return map_data[$game_map.map_id].name
  684.   end
  685. end
  686.  
  687. #==============================================================================
  688. # ** Game_Interpreter
  689. #==============================================================================
  690. class Game_Interpreter
  691.   include EXTRA_STATS_CONFIG
  692.   #--------------------------------------------------------------------------
  693.   # * Change EXP                                            |--OVERWRITTEN--|
  694.   #--------------------------------------------------------------------------
  695.   def command_315
  696.     value = operate_value(@params[1], @params[2], @params[3])
  697.     iterate_actor_id(@params[0]) do |actor|
  698.       actor.change_exp(actor.exp + value, @params[4])
  699.     $game_stats.total_exp_count += value
  700.     end
  701.     return true
  702.   end
  703.   #--------------------------------------------------------------------------
  704.   # * Change Gold
  705.   #--------------------------------------------------------------------------
  706.   def command_125
  707.     value = operate_value(@params[0], @params[1], @params[2])
  708.     $game_party.gain_gold(value)
  709.     $game_stats.total_gold_count += value unless $game_map.from_shop
  710.     p($game_map.from_shop)
  711.     return true
  712.   end
  713. end
  714.  
  715. #==============================================================================
  716. # ** Window_Base
  717. #==============================================================================
  718. class Window_Base < Window
  719.   #--------------------------------------------------------------------------
  720.   # * Draw Player Coordinates
  721.   #     x     : Draw x-coordinate
  722.   #     y     : Draw y-coordinate
  723.   #     w     : Content width
  724.   #     h     : Content height
  725.   #     a     : Text alignment
  726.   #--------------------------------------------------------------------------
  727.   def draw_player_coords(x, y, w, h, a = 1)
  728.     @player_x, @player_y = $game_player.x, $game_player.y
  729.     text = "X: "+@player_x.to_s+", Y: "+@player_y.to_s
  730.     self.contents.draw_text(x, y, w, h, text, a)
  731.   end
  732. end
  733.  
  734. #==============================================================================
  735. # ** Scene_Title
  736. #==============================================================================
  737. class Scene_Title < Scene_Base
  738.   #--------------------------------------------------------------------------
  739.   # * Start processing
  740.   #--------------------------------------------------------------------------
  741.   alias cwxstat_start start
  742.   def start
  743.     cwxstat_start
  744.     $game_stats.start
  745.   end
  746.   #--------------------------------------------------------------------------
  747.   # * Create Game Objects
  748.   #--------------------------------------------------------------------------
  749.   alias cwxstat_create_objects create_game_objects
  750.   def create_game_objects
  751.     cwxstat_create_objects
  752.     $game_stats         = Game_Stats.new
  753.   end
  754. end
  755.  
  756. #==============================================================================
  757. # ** Scene_Menu
  758. #==============================================================================
  759. class Scene_Menu < Scene_Base
  760.   include EXTRA_STATS_CONFIG
  761.   #--------------------------------------------------------------------------
  762.   # * Create Command Window                                 |--OVERWRITTEN--|
  763.   #--------------------------------------------------------------------------
  764.   def create_command_window
  765.     command_list = [Vocab::item, Vocab::skill, Vocab::equip, Vocab::status,
  766.       Vocab::save, Vocab::game_end]
  767.     if EXTRA_STATS
  768.       commands = command_list.first(4)
  769.       commands.push STATS_MENU_TEXT
  770.       2.times do |cmd| commands.push command_list.last(2)[cmd] end
  771.     else
  772.       commands = command_list
  773.     end
  774.     @command_window = Window_Command.new(160, commands)
  775.     @command_window.index = @menu_index
  776.     if $game_party.members.size == 0          # If number of party members is 0
  777.       @command_window.draw_item(0, false)     # Disable item
  778.       @command_window.draw_item(1, false)     # Disable skill
  779.       @command_window.draw_item(2, false)     # Disable equipment
  780.       @command_window.draw_item(3, false)     # Disable status
  781.     end
  782.     if $game_system.save_disabled             # If save is forbidden
  783.       @command_window.draw_item(4, false)     # Disable save
  784.     end
  785.   end
  786.   #--------------------------------------------------------------------------
  787.   # * Update Command Selection                              |--OVERWRITTEN--|
  788.   #--------------------------------------------------------------------------
  789.   def update_command_selection
  790.     if Input.trigger?(Input::B)
  791.       Sound.play_cancel
  792.       $scene = Scene_Map.new
  793.     elsif Input.trigger?(Input::C)
  794.       if $game_party.members.size == 0 and @command_window.index < 4
  795.         Sound.play_buzzer
  796.         return
  797.       elsif $game_system.save_disabled and @command_window.index == 4
  798.         Sound.play_buzzer
  799.         return
  800.       end
  801.       Sound.play_decision
  802.       case @command_window.index
  803.       when 0      # Item
  804.         $scene = Scene_Item.new
  805.       when 1,2,3  # Skill, equipment, status
  806.         start_actor_selection
  807.       when 4      # Extra Stats/Save
  808.         if EXTRA_STATS
  809.             $scene = Scene_Stats.new
  810.         else $scene = Scene_File.new(true, false, false)
  811.         end
  812.       when 5      # Save/End Game
  813.         if EXTRA_STATS; $scene = Scene_File.new(true, false, false)
  814.         else $scene = Scene_End.new
  815.         end
  816.       when 6
  817.         if EXTRA_STATS; $scene = Scene_End.new; end
  818.       end
  819.     end
  820.   end
  821. end
  822.  
  823. #==============================================================================
  824. # ** Window_Title
  825. #------------------------------------------------------------------------------
  826. #  This is the window for displaying the Extra Stats title.
  827. #==============================================================================
  828. class Window_Title < Window_Base
  829.   include EXTRA_STATS_CONFIG
  830.   #--------------------------------------------------------------------------
  831.   # * Object Initialization
  832.   #--------------------------------------------------------------------------
  833.   def initialize(x = 0, y = 0)
  834.     super(x, y, 544, WLH + 32)
  835.     refresh
  836.   end
  837.   #--------------------------------------------------------------------------
  838.   # * Refresh
  839.   #--------------------------------------------------------------------------
  840.   def refresh
  841.     self.contents.clear
  842.     self.contents.draw_title(0, 0, STATS_MENU_TEXT, 544, WLH, 1, false)
  843.   end
  844. end
  845.  
  846. #==============================================================================
  847. # ** Scene_Map
  848. #==============================================================================
  849. class Scene_Map < Scene_Base
  850.   include EXTRA_STATS_CONFIG
  851.   #--------------------------------------------------------------------------
  852.   # * Frame Update                                              |--ALIASED--|
  853.   #--------------------------------------------------------------------------
  854.   alias cwexs_scnmap_update update
  855.   def update
  856.     cwexs_scnmap_update
  857.     if EXTRA_STATS_KEYPRESS
  858.       if Input.press?(EXTRA_STATS_KEY)
  859.         $game_map.from_map = true
  860.         $scene = Scene_Stats.new
  861.       end
  862.     end
  863.   end
  864. end
  865.  
  866. #==============================================================================
  867. # ** Scene_Battle
  868. #==============================================================================
  869. class Scene_Battle
  870.   #--------------------------------------------------------------------------
  871.   # * Process Start Battle                                      |--ALIASED--|
  872.   #--------------------------------------------------------------------------
  873.   alias cwexsbai_scnbtl_procbtlstrt process_battle_start
  874.   def process_battle_start(*args)
  875.     # Add to battle counter
  876.     $game_stats.battle_count += 1
  877.     # Run Original Method
  878.     cwexsbai_scnbtl_procbtlstrt(*args)
  879.   end
  880.   #--------------------------------------------------------------------------
  881.   # This adds to the "Escape Counter" for each successful escape|--ALIASED--|
  882.   #--------------------------------------------------------------------------
  883.   alias cw_process_escape process_escape
  884.   def process_escape
  885.     cw_process_escape
  886.     if $game_troop.preemptive
  887.       success = true
  888.     else
  889.       success = (rand(100) < @escape_ratio)
  890.     end
  891.     Sound.play_escape
  892.     if success
  893.       wait_for_message
  894.       battle_end(1)
  895.       $game_stats.escape_count += 1
  896.     else
  897.       @escape_ratio += 10
  898.       $game_message.texts.push('\.' + Vocab::EscapeFailure)
  899.       wait_for_message
  900.       $game_party.clear_actions
  901.       start_main
  902.     end
  903.   end
  904.   #--------------------------------------------------------------------------
  905.   # This adds to the "Victory Counter" for each combat won      |--ALIASED--|
  906.   #--------------------------------------------------------------------------
  907.   alias cw_process_victory process_victory
  908.   def process_victory
  909.     cw_process_victory
  910.     $game_stats.victory_count += 1
  911.   end
  912.   #--------------------------------------------------------------------------
  913.   # * Display Gained Experience and Gold                    |--OVERWRITTEN--|
  914.   #--------------------------------------------------------------------------
  915.   def display_exp_and_gold
  916.     exp = $game_troop.exp_total
  917.     gold = $game_troop.gold_total
  918.     $game_party.gain_gold(gold)
  919.     $game_stats.total_gold_count += gold
  920.     $game_stats.total_exp_count += exp
  921.     text = sprintf(Vocab::Victory, $game_party.name)
  922.     $game_message.texts.push('\|' + text)
  923.     if exp > 0
  924.       text = sprintf(Vocab::ObtainExp, exp)
  925.       $game_message.texts.push('\.' + text)
  926.     end
  927.     if gold > 0
  928.       text = sprintf(Vocab::ObtainGold, gold, Vocab::gold)
  929.       $game_message.texts.push('\.' + text)
  930.     end
  931.     wait_for_message
  932.   end
  933. end
  934.  
  935. #==============================================================================
  936. # ** Scene_Shop
  937. #==============================================================================
  938. class Scene_Shop < Scene_Base
  939.   #--------------------------------------------------------------------------
  940.   # * Confirm Number Input
  941.   #--------------------------------------------------------------------------
  942.   alias cwexs_scnshop_decide_number decide_number_input
  943.   def decide_number_input
  944.     cwexs_scnshop_decide_number
  945.     case @command_window.index
  946.     when 0
  947.       $game_stats.total_gold_spent += (@number_window.number * @item.price)
  948.     when 1
  949.       $game_stats.total_gold_count += $game_party.gain_gold((@item.price / 2))
  950.     end
  951.   end
  952.   #--------------------------------------------------------------------------
  953.   # * Dispose of Command Window
  954.   #--------------------------------------------------------------------------
  955.   alias cwexs_scnshop_dispose_cmd dispose_command_window
  956.   def dispose_command_window
  957.     cwexs_scnshop_dispose_cmd
  958.     $game_map.from_shop = true
  959.     $game_stats.shop_count += 1
  960.   end
  961. end
  962.  
  963. #==============================================================================
  964. # ** Scene_File
  965. #==============================================================================
  966. class Scene_File < Scene_Base
  967.   #--------------------------------------------------------------------------
  968.   # * Write Save Data
  969.   #     file : write file object (opened)
  970.   #--------------------------------------------------------------------------
  971.   alias cwess_scnfl_write_save write_save_data
  972.   def write_save_data(file)
  973.     cwess_scnfl_write_save(file)
  974.     Marshal.dump($game_stats,          file)
  975.   end
  976.   #--------------------------------------------------------------------------
  977.   # * Read Save Data
  978.   #     file : file object for reading (opened)
  979.   #--------------------------------------------------------------------------
  980.   alias cwess_scnfl_read_save read_save_data
  981.   def read_save_data(file)
  982.     cwess_scnfl_read_save(file)
  983.     $game_stats          = Marshal.load(file)
  984.   end
  985. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement