SHOW:
|
|
- or go back to the newest paste.
| 1 | //============================================================================= | |
| 2 | // Trilobytes - Prestige Class Titles | |
| 3 | - | // TLB_PrestigeClassTitles.js |
| 3 | + | // TLB_PrestigeClassTitles_MV.js |
| 4 | //============================================================================= | |
| 5 | ||
| 6 | - | window.Imported ??= {};
|
| 6 | + | window.Imported = window.Imported || {};
|
| 7 | Imported.TLB_PrestigeClassTitles = true; | |
| 8 | ||
| 9 | - | window.TLB ??= {};
|
| 9 | + | window.TLB = window.TLB || {};
|
| 10 | - | TLB.PrestigeClassTitles ??= {};
|
| 10 | + | TLB.PrestigeClassTitles = TLB.PrestigeClassTitles || {};
|
| 11 | TLB.PrestigeClassTitles.version = 1.00; | |
| 12 | ||
| 13 | /*: | |
| 14 | - | * @target MZ |
| 14 | + | |
| 15 | * classes based on level. | |
| 16 | * @author John Clifford/Trihan | |
| 17 | * | |
| 18 | * @help | |
| 19 | * ============================================================================ | |
| 20 | * Introduction | |
| 21 | * ============================================================================ | |
| 22 | * | |
| 23 | * This plugin provides the developer the facility to have actor classes | |
| 24 | * automatically change their names as the actor possessing that class hits | |
| 25 | * defined level milestones. | |
| 26 | * | |
| 27 | * ============================================================================ | |
| 28 | * Notetags | |
| 29 | * ============================================================================ | |
| 30 | * | |
| 31 | * Use the following notetag in the notebox of your classes (indentation is | |
| 32 | * purely for ease of reading and is not necessary in the note itself): | |
| 33 | * | |
| 34 | * <NameList> | |
| 35 | * level:name | |
| 36 | * level2:name2 | |
| 37 | * level3:name3 | |
| 38 | * </NameList> | |
| 39 | * | |
| 40 | * Example (in the 'Black Mage' class): | |
| 41 | * | |
| 42 | * <NameList> | |
| 43 | * 5:Black Magus | |
| 44 | * 10:Black Sorcerer | |
| 45 | * 15:Sorcerer Supreme | |
| 46 | * </NameList> | |
| 47 | * | |
| 48 | * You can define as many level-name pairs as you wish. They should be in level | |
| 49 | * order; ordering them otherwise may cause the wrong name to be shown. The | |
| 50 | * original name of the class will be used at first unless you define a level 1 | |
| 51 | * pairing. | |
| 52 | * | |
| 53 | * As soon as the actor attains the level defined by a line, that is the name | |
| 54 | * that will be displayed for their class until the next one is reached. | |
| 55 | * | |
| 56 | * ============================================================================ | |
| 57 | * Plugin Parameters | |
| 58 | * ============================================================================ | |
| 59 | * | |
| 60 | * None | |
| 61 | * | |
| 62 | * ============================================================================ | |
| 63 | * Plugin Commands | |
| 64 | * ============================================================================ | |
| 65 | * | |
| 66 | * None | |
| 67 | * | |
| 68 | * ============================================================================ | |
| 69 | * Changelog | |
| 70 | * ============================================================================ | |
| 71 | * | |
| 72 | * Version 1.00: | |
| 73 | * - Finished plugin! | |
| 74 | * | |
| 75 | */ | |
| 76 | ||
| 77 | TLB.PrestigeClassTitles.DataManager_onLoad = DataManager.onLoad; | |
| 78 | DataManager.onLoad = function(object) {
| |
| 79 | TLB.PrestigeClassTitles.DataManager_onLoad.call(this, object); | |
| 80 | if (object === $dataClasses) {
| |
| 81 | this.loadTLBClassNameNotetags(); | |
| 82 | } | |
| 83 | }; | |
| 84 | ||
| 85 | DataManager.loadTLBClassNameNotetags = function() {
| |
| 86 | for (const classData of $dataClasses) | |
| 87 | {
| |
| 88 | if (!classData) continue; | |
| 89 | const note = classData.note; | |
| 90 | const nameList = note.match(/<NameList>((?:.|\n)*)<\/NameList>/); | |
| 91 | if (nameList) | |
| 92 | {
| |
| 93 | const rawNames = nameList[1].split("\n");
| |
| 94 | classData.tlbClassNames = classData.tlbClassNames || {};
| |
| 95 | - | classData.tlbClassNames ??= {};
|
| 95 | + | |
| 96 | for (const line of nameData) {
| |
| 97 | const lineData = line.split(":");
| |
| 98 | const level = lineData[0]; | |
| 99 | const name = lineData[1]; | |
| 100 | classData.tlbClassNames[level] = name; | |
| 101 | } | |
| 102 | } | |
| 103 | } | |
| 104 | } | |
| 105 | ||
| 106 | TLB.PrestigeClassTitles.Window_Base_drawActorClass = Window_Base.prototype.drawActorClass; | |
| 107 | - | TLB.PrestigeClassTitles.Window_StatusBase_drawActorClass = Window_StatusBase.prototype.drawActorClass; |
| 107 | + | Window_Base.prototype.drawActorClass = function(actor, x, y, width) {
|
| 108 | - | Window_StatusBase.prototype.drawActorClass = function(actor, x, y, width) {
|
| 108 | + | |
| 109 | if (classNames) {
| |
| 110 | const keys = Object.keys(classNames); | |
| 111 | const validKeys = keys.filter(key => key <= actor.level); | |
| 112 | const currentKey = validKeys[validKeys.length - 1]; | |
| 113 | if (currentKey) | |
| 114 | {
| |
| 115 | const name = classNames[currentKey]; | |
| 116 | width = width || 168; | |
| 117 | this.resetTextColor(); | |
| 118 | this.drawText(name, x, y, width); | |
| 119 | } else {
| |
| 120 | TLB.PrestigeClassTitles.Window_Base_drawActorClass.call(this, actor, x, y, width); | |
| 121 | - | TLB.PrestigeClassTitles.Window_StatusBase_drawActorClass.call(this, actor, x, y, width); |
| 121 | + | |
| 122 | } else {
| |
| 123 | TLB.PrestigeClassTitles.Window_Base_drawActorClass.call(this, actor, x, y, width); | |
| 124 | - | TLB.PrestigeClassTitles.Window_StatusBase_drawActorClass.call(this, actor, x, y, width); |
| 124 | + | |
| 125 | }; |