-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathMrTS_CurrencyName.js
60 lines (54 loc) · 2.15 KB
/
MrTS_CurrencyName.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//=============================================================================
// MrTS_CurrencyName.js
//=============================================================================
/*:
* @plugindesc Allows to change how currency is called midgame.
* @author Mr. Trivel
*
* @help
* --------------------------------------------------------------------------------
* Terms of Use
* --------------------------------------------------------------------------------
* Don't remove the header or claim that you wrote this plugin.
* Credit Mr. Trivel if using this plugin in your project.
* Free for commercial and non-commercial projects.
* --------------------------------------------------------------------------------
* Version 1.0
* --------------------------------------------------------------------------------
*
* --------------------------------------------------------------------------------
* Plugin Commands
* --------------------------------------------------------------------------------
* SetCurrency [NAME] - sets currency to [NAME]
* Example:
* SetCurrency Glasses
* --------------------------------------------------------------------------------
*
* --------------------------------------------------------------------------------
* Version History
* --------------------------------------------------------------------------------
* 1.0 - Release
*/
(function() {
//--------------------------------------------------------------------------
// Game_Interpreter
//
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if (command.toLowerCase() === "setcurrency") {
$gameSystem.setCurrencyUnit(args[0]);
}
};
Object.defineProperty(TextManager, 'currencyUnit', {
get: function() { return $gameSystem.getCurrencyUnit(); },
configurable: true
});
Game_System.prototype.getCurrencyUnit = function() {
if (!this._currencyUnit) return $dataSystem.currencyUnit;
return this._currencyUnit;
};
Game_System.prototype.setCurrencyUnit = function(currency) {
this._currencyUnit = currency;
};
})();