Source: TextManager.js

TextManager.js

//-----------------------------------------------------------------------------
// TextManager
//
// The static class that handles terms and messages.
/**
 * The static class that handles terms and messages.
 *
 * @namespace
 * @property {string} level - The basic level term
 * @property {string} levelA - The basic level abbreviated term
 * @property {string} hp - The basic HP term
 * @property {string} hpA - The basic HP abbreviated term
 * @property {string} mp - The basic MP term
 * @property {string} mpA - The basic MP abbreviated term
 * @property {string} tp - The basic TP term
 * @property {string} tpA - The basic TP abbreviated term
 * @property {string} exp - The basic EXP term
 * @property {string} expA - The basic EXP abbreviated term
 * @property {string} fight - The command Fight term
 * @property {string} escape - The command Escape term
 * @property {string} attack - The command Attack term
 * @property {string} guard - The command Guard term
 * @property {string} item - The command Item term
 * @property {string} skill - The command Skill term
 * @property {string} equip - The command Equip term
 * @property {string} status - The command Status term
 * @property {string} formation - The command Formation term
 * @property {string} options - The command Options term
 * @property {string} save - The command Save term
 * @property {string} gameEnd - The command Game End term
 * @property {string} weapon - The command Weapon term
 * @property {string} armor - The command Armor term
 * @property {string} keyItem - The command Key Item term
 * @property {string} equip2 - The command Second Equip term
 * @property {string} Optimize - The command Optimize term
 * @property {string} clear - The command Clear term
 * @property {string} buy - The command Buy term
 * @property {string} sell - The command Sell term
 * @property {string} newGame - The command New Game term
 * @property {string} continue - The command Continue term
 * @property {string} toTitle - The command To Title term
 * @property {string} cancel - The command Cancel term
 * @property {string} alwaysDash - The message term for Always Dash
 * @property {string} commandRemember - The message term for Command Remember
 * @property {string} touchUI: - The message term for Touch UI
 * @property {string} bgmVolume - The message term for BGM Volume
 * @property {string} bgsVolume - The message term for BGS Volume
 * @property {string} meVolume - The message term for ME Volume
 * @property {string} seVolume - The message term for SE Volume
 * @property {string} possession - The message term for Possession
 * @property {string} expTotal - The message term for EXP Total
 * @property {string} expNext - The message term for EXP Next
 * @property {string} saveMessage - The message term for Save Message
 * @property {string} loadMessage - The message term for Load Message
 * @property {string} file - The message term for File
 * @property {string} autosave - The message term for Autosave
 * @property {string} partyName - The message term for Party Name
 * @property {string} emerge - The message term for Emerge
 * @property {string} preemptive - The message term for Preemptive
 * @property {string} surprise - The message term for Surprise
 * @property {string} escapeStart - The message term for Escape Start
 * @property {string} escapeFailure - The message term for Escape Failure
 * @property {string} victory - The message term for Victory
 * @property {string} defeat - The message term for Defeat
 * @property {string} obtainExp - The message term for Obtain EXP
 * @property {string} obtainGold - The message term for Obtain Gold
 * @property {string} obtainItem - The message term for Obtain Item
 * @property {string} levelUp - The message term for Level Up
 * @property {string} obtainSkill - The message term for Obtain Skill
 * @property {string} useItem - The message term for Use Item
 * @property {string} criticalToEnemy - The message term for Critical To Enemy
 * @property {string} criticalToActor - The message term for Critical To Actor
 * @property {string} actorDamage - The message term for Actor Damage
 * @property {string} actorRecovery: - The message term for Actor Recovery
 * @property {string} actorGain - The message term for Actor Gain
 * @property {string} actorLoss - The message term for Actor Loss
 * @property {string} actorDrain - The message term for Actor Drain
 * @property {string} actorNoDamage - The message term for Actor No Damage
 * @property {string} actorNoHit - The message term for Actor No Hit
 * @property {string} enemyDamage - The message term for Enemy Damage
 * @property {string} enemyRecovery - The message term for Enemy Recovery
 * @property {string} enemyGain - The message term for Enemy Gain
 * @property {string} enemyLoss - The message term for Enemy Loss
 * @property {string} enemyDrain - The message term for Enemy Drain
 * @property {string} enemyNoDamage - The message term for Enemy No Damage
 * @property {string} enemyNoHit - The message term for Enemy No Hit
 * @property {string} evasion - The message term for Evasion
 * @property {string} magicEvasion - The message term for Magic Evasion
 * @property {string} magicReflection - The message term for Magic Reflection
 * @property {string} counterAttack - The message term for Counter Attack
 * @property {string} substitute - The message term for Substitute
 * @property {string} buffAdd - The message term for Buff Add
 * @property {string} debuffAdd - The message term for Debuff Add
 * @property {string} buffRemove - The message term for Buff Remove
 * @property {string} actionFailure - The message term for Action Failure
 */
function TextManager() {
    throw new Error("This is a static class");
}

/**
 * Gets the basic term at given position
 *
 * @static
 * @param {number} basicId - The index of the basic term
 * @return {string} The term at given index in $dataSystem.terms.basic
 */
TextManager.basic = function(basicId) {
    return $dataSystem.terms.basic[basicId] || "";
};

/**
 * Gets the param term at given position
 *
 * @static
 * @param {number} paramId - The index of the param term
 * @return {string} The term at given index in $dataSystem.terms.params
 */
TextManager.param = function(paramId) {
    return $dataSystem.terms.params[paramId] || "";
};

/**
 * Gets the command term at given position
 *
 * @static
 * @param {number} commandId - The index of the command term
 * @return {string} The term at given index in $dataSystem.terms.commands
 */
TextManager.command = function(commandId) {
    return $dataSystem.terms.commands[commandId] || "";
};

/**
 * Gets the message term for the given id
 *
 * @static
 * @param {string} messageId - The id of the message term
 * @return {string} The term for the given id in $dataSystem.terms.messages
 */
TextManager.message = function(messageId) {
    return $dataSystem.terms.messages[messageId] || "";
};

/**
 * Generic getter for the various term types
 *
 * @static
 * @param {string} method - The function name to call
 * @param {number|string} param - The index or id of the term
 * @return {string} The term at given index
 */
TextManager.getter = function(method, param) {
    return {
        get: function() {
            return this[method](param);
        },
        configurable: true
    };
};

/**
 * The Currency Unit
 *
 * @type string
 * @readonly
 * @static
 * @name TextManager.currencyUnit
 */
Object.defineProperty(TextManager, "currencyUnit", {
    get: function() {
        return $dataSystem.currencyUnit;
    },
    configurable: true
});

Object.defineProperties(TextManager, {
    level: TextManager.getter("basic", 0),
    levelA: TextManager.getter("basic", 1),
    hp: TextManager.getter("basic", 2),
    hpA: TextManager.getter("basic", 3),
    mp: TextManager.getter("basic", 4),
    mpA: TextManager.getter("basic", 5),
    tp: TextManager.getter("basic", 6),
    tpA: TextManager.getter("basic", 7),
    exp: TextManager.getter("basic", 8),
    expA: TextManager.getter("basic", 9),
    fight: TextManager.getter("command", 0),
    escape: TextManager.getter("command", 1),
    attack: TextManager.getter("command", 2),
    guard: TextManager.getter("command", 3),
    item: TextManager.getter("command", 4),
    skill: TextManager.getter("command", 5),
    equip: TextManager.getter("command", 6),
    status: TextManager.getter("command", 7),
    formation: TextManager.getter("command", 8),
    save: TextManager.getter("command", 9),
    gameEnd: TextManager.getter("command", 10),
    options: TextManager.getter("command", 11),
    weapon: TextManager.getter("command", 12),
    armor: TextManager.getter("command", 13),
    keyItem: TextManager.getter("command", 14),
    equip2: TextManager.getter("command", 15),
    optimize: TextManager.getter("command", 16),
    clear: TextManager.getter("command", 17),
    newGame: TextManager.getter("command", 18),
    continue_: TextManager.getter("command", 19),
    toTitle: TextManager.getter("command", 21),
    cancel: TextManager.getter("command", 22),
    buy: TextManager.getter("command", 24),
    sell: TextManager.getter("command", 25),
    alwaysDash: TextManager.getter("message", "alwaysDash"),
    commandRemember: TextManager.getter("message", "commandRemember"),
    touchUI: TextManager.getter("message", "touchUI"),
    bgmVolume: TextManager.getter("message", "bgmVolume"),
    bgsVolume: TextManager.getter("message", "bgsVolume"),
    meVolume: TextManager.getter("message", "meVolume"),
    seVolume: TextManager.getter("message", "seVolume"),
    possession: TextManager.getter("message", "possession"),
    expTotal: TextManager.getter("message", "expTotal"),
    expNext: TextManager.getter("message", "expNext"),
    saveMessage: TextManager.getter("message", "saveMessage"),
    loadMessage: TextManager.getter("message", "loadMessage"),
    file: TextManager.getter("message", "file"),
    autosave: TextManager.getter("message", "autosave"),
    partyName: TextManager.getter("message", "partyName"),
    emerge: TextManager.getter("message", "emerge"),
    preemptive: TextManager.getter("message", "preemptive"),
    surprise: TextManager.getter("message", "surprise"),
    escapeStart: TextManager.getter("message", "escapeStart"),
    escapeFailure: TextManager.getter("message", "escapeFailure"),
    victory: TextManager.getter("message", "victory"),
    defeat: TextManager.getter("message", "defeat"),
    obtainExp: TextManager.getter("message", "obtainExp"),
    obtainGold: TextManager.getter("message", "obtainGold"),
    obtainItem: TextManager.getter("message", "obtainItem"),
    levelUp: TextManager.getter("message", "levelUp"),
    obtainSkill: TextManager.getter("message", "obtainSkill"),
    useItem: TextManager.getter("message", "useItem"),
    criticalToEnemy: TextManager.getter("message", "criticalToEnemy"),
    criticalToActor: TextManager.getter("message", "criticalToActor"),
    actorDamage: TextManager.getter("message", "actorDamage"),
    actorRecovery: TextManager.getter("message", "actorRecovery"),
    actorGain: TextManager.getter("message", "actorGain"),
    actorLoss: TextManager.getter("message", "actorLoss"),
    actorDrain: TextManager.getter("message", "actorDrain"),
    actorNoDamage: TextManager.getter("message", "actorNoDamage"),
    actorNoHit: TextManager.getter("message", "actorNoHit"),
    enemyDamage: TextManager.getter("message", "enemyDamage"),
    enemyRecovery: TextManager.getter("message", "enemyRecovery"),
    enemyGain: TextManager.getter("message", "enemyGain"),
    enemyLoss: TextManager.getter("message", "enemyLoss"),
    enemyDrain: TextManager.getter("message", "enemyDrain"),
    enemyNoDamage: TextManager.getter("message", "enemyNoDamage"),
    enemyNoHit: TextManager.getter("message", "enemyNoHit"),
    evasion: TextManager.getter("message", "evasion"),
    magicEvasion: TextManager.getter("message", "magicEvasion"),
    magicReflection: TextManager.getter("message", "magicReflection"),
    counterAttack: TextManager.getter("message", "counterAttack"),
    substitute: TextManager.getter("message", "substitute"),
    buffAdd: TextManager.getter("message", "buffAdd"),
    debuffAdd: TextManager.getter("message", "debuffAdd"),
    buffRemove: TextManager.getter("message", "buffRemove"),
    actionFailure: TextManager.getter("message", "actionFailure")
});