#============================================================================== # # GaryCXJk - Class Extensions v1.03 # * Last Updated: 2012.01.01 # * Level: Normal # * Requires: YEA - Class System v1.10+ # * Optional: YEA - Class Specifics v1.00+ # #============================================================================== $imported = {} if $imported.nil? $imported["CXJ-ClassExtensions"] = true #============================================================================== # # Changelog: # #------------------------------------------------------------------------------ # 2013.01.01 - v1.03 # # * Fixed: Wrong calculation of class level # #------------------------------------------------------------------------------ # 2012.12.31 - v1.02 # # * Fixed: Player sprite not changing # #------------------------------------------------------------------------------ # 2012.12.31 - v1.01 # # * Added: Ability to hide classes that are unavailable for primary or subclass # (requires Class Specifics) # * Fixed: Some errors # #------------------------------------------------------------------------------ # 2012.12.31 - v1.00 # # * Initial release # #============================================================================== # # Yanfly's Class System is a very solid script, but it is missing a few small # things. This scripts adds just the little things it is missing. # #============================================================================== # # Installation: # # Make sure to put this below Materials, but above Main Process. # # This script overrides several methods. If you are sure no method that is # used by other scripts get overridden, you can place it anywhere, otherwise, # make sure this script is loaded first. Do know that there is a possibility # that this script will stop working due to that. # # This script adds aliases for several methods. If you are sure no method that # is used by other scripts get overridden, you can place it anywhere, # otherwise, make sure this script is loaded after any other script overriding # these methods, otherwise this script stops working. # # This script requires another script to run. Put this script after the # required scripts to make it work properly. # # This script has additional functionality and / or compatibility with other # scripts. In order to benifit the most out of it, it is advised to place this # script after the others. # #------------------------------------------------------------------------------ # Overridden methods: # # * class Game_Actor # - class_level(class_id) (from Class System) # * class Window_ClassList (from Class System) # - make_item_list # #------------------------------------------------------------------------------ # Aliased methods: # # * module DataManager # - load_database # * class Game_Actor # - change_exp(exp, show) # * class Window_ClassList (from Class System) # - set_item_colour # #============================================================================== # # Usage: # # There are various functionalities in this script. You can enable and disable # them by specifying it in the script. I'll go through them one at a time. # #------------------------------------------------------------------------------ # Class Level Limiter: # # This allows you to limit the class level cap. This means that classes will # never go over the level cap you specified. You can also specify a limit # for a specific class using notetags. # # # #------------------------------------------------------------------------------ # Class Graphics # # If you want classes to have generic appearances, or if you want an actor to # have a specific graphics set when using a certain class. # # You can set a generic class graphics set, which is a set of data which # specifies the default class graphic. You can specify multiple sets here. It # defaults to the "DEFAULT" set, but you can use a notetag on the actor to # specify a specific graphics set. # # # # Where x is the string defining the graphics set. # # By default, you can set all classes to either opt in or opt out. What this # means is that you can specify if actor uses the generic set or not, depending # on the settings. If an actor opts in, it means that it will use the generic # set, otherwise it doesn't. You can set the default settings in the script, # but using notetags you can also specify it per actor. # # # # # You can also set a class specific graphic for the actor itself. # # # # # x: the class id. # y: the character / face image. # z: the index. # # Finally, on the classes themselves you can specify a default graphic. # Depending on the script settings, these will have priority over the default # settings. # # # # # x: the character / face image. # y: the index. # #============================================================================== # # License: # # Creative Commons Attribution 3.0 Unported # # The complete license can be read here: # http://creativecommons.org/licenses/by/3.0/legalcode # # The license as it is described below can be read here: # http://creativecommons.org/licenses/by/3.0/deed # # You are free: # # to Share — to copy, distribute and transmit the work # to Remix — to adapt the work # to make commercial use of the work # # Under the following conditions: # # Attribution — You must attribute the work in the manner specified by the # author or licensor (but not in any way that suggests that they endorse you or # your use of the work). # # With the understanding that: # # Waiver — Any of the above conditions can be waived if you get permission from # the copyright holder. # # Public Domain — Where the work or any of its elements is in the public domain # under applicable law, that status is in no way affected by the license. # # Other Rights — In no way are any of the following rights affected by the # license: # # * Your fair dealing or fair use rights, or other applicable copyright # exceptions and limitations; # * The author's moral rights; # * Rights other persons may have either in the work itself or in how the work # is used, such as publicity or privacy rights. # # Notice — For any reuse or distribution, you must make clear to others the # license terms of this work. The best way to do this is with a link to this # web page. # #------------------------------------------------------------------------------ # Extra notes: # # Despite what the license tells you, I will not hunt down anybody who doesn't # follow the license in regards to giving credits. However, as it is common # courtesy to actually do give credits, it is recommended that you do. # # As I picked this license, you are free to share this script through any # means, which includes hosting it on your own website, selling it on eBay and # hang it in the bathroom as toilet paper. Well, not selling it on eBay, that's # a dick move, but you are still free to redistribute the work. # # Yes, this license means that you can use it for both non-commercial as well # as commercial software. # # You are free to pick the following names when you give credit: # # * GaryCXJk # * Gary A.M. Kertopermono # * G.A.M. Kertopermono # * GARYCXJK # # Personally, when used in commercial games, I prefer you would use the second # option. Not only will it actually give me more name recognition in real # life, which also works well for my portfolio, it will also look more # professional. Also, do note that I actually care about capitalization if you # decide to use my username, meaning, capital C, capital X, capital J, lower # case k. Yes, it might seem stupid, but it's one thing I absolutely care # about. # # Finally, if you want my endorsement for your product, if it's good enough # and I have the game in my posession, I might endorse it. Do note that if you # give me the game for free, it will not affect my opinion of the game. It # would be nice, but if I really did care for the game I'd actually purchase # it. Remember, the best way to get any satisfaction is if you get people to # purchase the game, so in a way, I prefer it if you don't actually give me # a free copy. # # This script was originally hosted on: # http://area91.multiverseworks.com # # Don't forget to include the credits of the original script as well. # #============================================================================== # # The code below defines the settings of this script, and are there to be # modified. # #============================================================================== module CXJ module CLASS_EXTENSIONS #------------------------------------------------------------------------ # Class Level Limiter #------------------------------------------------------------------------ ENABLE_CLASS_LEVEL_LIMITER = true # Defines if you want to limit # class levels DEFAULT_MAX_LEV = 99 # Defines the max level STOP_GAINING_EXP_AFTER_MAX = true # Stops experience gain after # hitting the level cap STOP_LEVELING_AFTER_CLASS_MAX = true # Stops leveling main character # after hitting the experience # cap. #------------------------------------------------------------------------ # Generic Class Graphics #------------------------------------------------------------------------ # When you set these, all characters will use this list as their initial # graphics. You can pick between an opt-in or opt-out. When you pick # opt-in, characters won't use these generic class graphics unless they # chose to, otherwise they will always use these generic class graphics # unless either the character has set their custom graphics or they opt # out. # # Also, notetags specified in the database have priority over this list, # meaning that any class that has a custom class graphic set in the # notetags will have that as the generic class graphic. You can however # change it below to have generic class graphics have priority instead. # # Finally, when the graphics for a certain class isn't set here, it will # always default to the default character graphics. #------------------------------------------------------------------------ ENABLE_CLASS_SPECIFIC_GRAPHICS = true # Defines whether to use class # specific graphics. OPT_IN_CLASS_GRAPHICS = false # Defines if you want to opt in. CLASS_SPECIFIED_HAS_PRIORITY = true # Graphics defined in class # notetags have priority. GENERIC_CLASS_GRAPHICS = {} GENERIC_CLASS_GRAPHICS["DEFAULT"] = { # ClassID => [ CharacterName, CharacterIndex, FaceName, FaceIndex ], 1 => [ "Actor1", 0, "Actor1", 0 ], 3 => [ "Actor4", 2, "Actor4", 2 ], } #------------------------------------------------------------------------ # Miscellaneous #------------------------------------------------------------------------ CLASS_HIDE_MODE = 2 # Set the class hiding mode for the class list # window. Requires the Class Specifics addon. # 0: Original # 1: Hide unavailable # 2: Grey out selected in other type end end #============================================================================== # # The code below should not be altered unless you know what you're doing. # #============================================================================== if $imported["YEA-ClassSystem"] module CXJ module REGEXP module CLASS MAX_LEVEL = /<(?:MAX_LEVEL|max level):\s*(\d+)>/i CHARSET = /<(?:CHARACTER_SET|CHARSET|character set|charset):\s*(.+?)\s*,\s*(\d+)>/i FACESET = /<(?:FACE_SET|FACESET|face set|faceset):\s*(.+?)\s*,\s*(\d+)>/i end module ACTOR OPT_IN = /<(?:GRAPHICS_OPT_IN|graphics opt) (in|out)>/i GENERICSET = /<(?:GENERIC_SET|generic set):\s*(.+?)>/i CHARSET = /<(?:CHARACTER_SET|CHARSET|character set|charset):\s*(\d+)\s*,\s*(.+?)\s*,\s*(\d+)>/i FACESET = /<(?:FACE_SET|FACESET|face set|faceset):\s*(\d+)\s*,\s*(.+?)\s*,\s*(\d+)>/i end end end #============================================================================ # ** DataManager #---------------------------------------------------------------------------- # This module manages the database and game objects. Almost all of the # global variables used by the game are initialized by this module. #============================================================================ module DataManager #------------------------------------------------------------------------ # Alias: load_database #------------------------------------------------------------------------ class < -1 maxExp = self.class.exp_for_level(maxLevel) if !CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_LEVEL_LIMITER game_actor_change_exp_cxj_ce(exp, show) elsif CXJ::CLASS_EXTENSIONS::STOP_GAINING_EXP_AFTER_MAX game_actor_change_exp_cxj_ce([exp, maxExp].min, show) elsif CXJ::CLASS_EXTENSIONS::STOP_LEVELING_AFTER_CLASS_MAX @exp[@class_id] = [exp, 0].max last_level = @level last_skills = skills level_up while !max_level? && self.exp >= next_level_exp && self.exp <= maxExp level_down while self.exp < current_level_exp display_level_up(skills - last_skills) if show && @level > last_level refresh else game_actor_change_exp_cxj_ce(exp, show) end end #------------------------------------------------------------------------ # Override: New: class_level Edited by DisturbedInside #------------------------------------------------------------------------ def class_level(class_id) return @level if YEA::CLASS_SYSTEM::MAINTAIN_LEVELS maxLevel = CXJ::CLASS_EXTENSIONS::DEFAULT_MAX_LEV maxLevel = self.class.max_level if self.class.max_level > -1 maxLevel = max_level if !CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_LEVEL_LIMITER current_class = $data_classes[class_id] maxExp = current_class.exp_for_level(maxLevel) @exp[class_id] = 0 if @exp[class_id].nil? n = 1 loop do break if maxExp <= current_class.exp_for_level(n) break if @exp[class_id] < current_class.exp_for_level(n) n+= 1 end return n end end #============================================================================== # ** Game_Player #------------------------------------------------------------------------------ # This class handles the player. It includes event starting determinants and # map scrolling functions. The instance of this class is referenced by # $game_player. #============================================================================== class Game_Player < Game_Character #------------------------------------------------------------------------ # New: character_name #------------------------------------------------------------------------ def character_name if CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_SPECIFIC_GRAPHICS cname = actor.character_name return cname if cname != actor.real_character_name end @character_name end #------------------------------------------------------------------------ # New: character_index #------------------------------------------------------------------------ def character_index if CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_SPECIFIC_GRAPHICS cname = actor.character_name return actor.character_index if cname != actor.real_character_name end @character_index end #------------------------------------------------------------------------ # New: face_name #------------------------------------------------------------------------ def face_name if CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_SPECIFIC_GRAPHICS fname = actor.face_name return fname if fname != actor.real_face_name end @face_name end #------------------------------------------------------------------------ # New: face_index #------------------------------------------------------------------------ def face_index if CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_SPECIFIC_GRAPHICS fname = actor.face_name return actor.face_index if fname != actor.real_face_name end @face_index end end if $imported["YEA-ClassSpecifics"] #========================================================================== # ** Window_ClassList #-------------------------------------------------------------------------- # This class handles the class list window #========================================================================== class Window_ClassList < Window_Selectable #---------------------------------------------------------------------- # Override: make_item_list #---------------------------------------------------------------------- def make_item_list @data = [] for class_id in YEA::CLASS_SYSTEM::CLASS_ORDER next if $data_classes[class_id].nil? item = $data_classes[class_id] next if CXJ::CLASS_EXTENSIONS::CLASS_HIDE_MODE == 1 && available?(item) @data.push(item) if include?(item) end end #---------------------------------------------------------------------- # New: Check if available #---------------------------------------------------------------------- def available?(item) case @command_window.current_symbol when :primary return false if item.subclass_only when :subclass return false if item.primary_only return @actor.subclass_to?(item.id) if item.subclass_to != [] end return true end #---------------------------------------------------------------------- # Alias: set_item_colour #---------------------------------------------------------------------- alias window_classlist_set_item_color set_item_colour def set_item_colour(item) if CXJ::CLASS_EXTENSIONS::CLASS_HIDE_MODE == 2 primary_enable = (@command_window.current_symbol == :primary ? item == @actor.class : enable?(item)) subclass_enable = (@command_window.current_symbol == :subclass ? item == @actor.subclass : enable?(item)) if item == @actor.class change_color(text_color(YEA::CLASS_SYSTEM::CURRENT_CLASS_COLOUR), primary_enable) elsif item == @actor.subclass change_color(text_color(YEA::CLASS_SYSTEM::SUBCLASS_COLOUR), subclass_enable) else change_color(normal_color, enable?(item)) end else window_classlist_set_item_color(item) end end end end end