Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================================================
- // Trilobytes - Prestige Class Titles
- // TLB_PrestigeClassTitles_MV.js
- //=============================================================================
- window.Imported = window.Imported || {};
- Imported.TLB_PrestigeClassTitles = true;
- window.TLB = window.TLB || {};
- TLB.PrestigeClassTitles = TLB.PrestigeClassTitles || {};
- TLB.PrestigeClassTitles.version = 1.00;
- /*:
- * @plugindesc [v1.00] This plugin allows you to define different names for
- * classes based on level.
- * @author John Clifford/Trihan
- *
- * @help
- * ============================================================================
- * Introduction
- * ============================================================================
- *
- * This plugin provides the developer the facility to have actor classes
- * automatically change their names as the actor possessing that class hits
- * defined level milestones.
- *
- * ============================================================================
- * Notetags
- * ============================================================================
- *
- * Use the following notetag in the notebox of your classes (indentation is
- * purely for ease of reading and is not necessary in the note itself):
- *
- * <NameList>
- * level:name
- * level2:name2
- * level3:name3
- * </NameList>
- *
- * Example (in the 'Black Mage' class):
- *
- * <NameList>
- * 5:Black Magus
- * 10:Black Sorcerer
- * 15:Sorcerer Supreme
- * </NameList>
- *
- * You can define as many level-name pairs as you wish. They should be in level
- * order; ordering them otherwise may cause the wrong name to be shown. The
- * original name of the class will be used at first unless you define a level 1
- * pairing.
- *
- * As soon as the actor attains the level defined by a line, that is the name
- * that will be displayed for their class until the next one is reached.
- *
- * ============================================================================
- * Plugin Parameters
- * ============================================================================
- *
- * None
- *
- * ============================================================================
- * Plugin Commands
- * ============================================================================
- *
- * None
- *
- * ============================================================================
- * Changelog
- * ============================================================================
- *
- * Version 1.00:
- * - Finished plugin!
- *
- */
- TLB.PrestigeClassTitles.DataManager_onLoad = DataManager.onLoad;
- DataManager.onLoad = function(object) {
- TLB.PrestigeClassTitles.DataManager_onLoad.call(this, object);
- if (object === $dataClasses) {
- this.loadTLBClassNameNotetags();
- }
- };
- DataManager.loadTLBClassNameNotetags = function() {
- for (const classData of $dataClasses)
- {
- if (!classData) continue;
- const note = classData.note;
- const nameList = note.match(/<NameList>((?:.|\n)*)<\/NameList>/);
- if (nameList)
- {
- const rawNames = nameList[1].split("\n");
- classData.tlbClassNames = classData.tlbClassNames || {};
- const nameData = rawNames.filter(name => name.length > 0);
- for (const line of nameData) {
- const lineData = line.split(":");
- const level = lineData[0];
- const name = lineData[1];
- classData.tlbClassNames[level] = name;
- }
- }
- }
- }
- TLB.PrestigeClassTitles.Window_Base_drawActorClass = Window_Base.prototype.drawActorClass;
- Window_Base.prototype.drawActorClass = function(actor, x, y, width) {
- const classNames = actor.currentClass().tlbClassNames;
- if (classNames) {
- const keys = Object.keys(classNames);
- const validKeys = keys.filter(key => key <= actor.level);
- const currentKey = validKeys[validKeys.length - 1];
- if (currentKey)
- {
- const name = classNames[currentKey];
- width = width || 168;
- this.resetTextColor();
- this.drawText(name, x, y, width);
- } else {
- TLB.PrestigeClassTitles.Window_Base_drawActorClass.call(this, actor, x, y, width);
- }
- } else {
- TLB.PrestigeClassTitles.Window_Base_drawActorClass.call(this, actor, x, y, width);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement