Simple Gold
by Akumu Games (me)
Description:
This plugin lets you display currency as single tokens instead of numbers.
Useful for simplifying your currency system (visuals only).
It also allows the use of special Text Codes in the Gold Window!
Plugin:
Spoiler Code:
// ============================================================================ // Simple Gold by Akumu Games // ============================================================================ // For: RPGMAKER MZ // AG_SimpleGold.js // Version: 1.0.0 // Terms: Free to use for commercial and non-commercial projects with due credit. // // ============================================================================ /*: * @plugindesc This plugin lets you display currency as single tokens instead of numbers. * Useful for simplifying your currency system (visuals only). * It also allows the use of special Text Codes in the Gold Window! * * Dependencies: None * * @author Akumu Games * ============================================================================ * @help * ============================================================================ * Intructions * ============================================================================ * Plug & Play! * * Compatibility: Place the plugin somewhere below VisuMZ_CoreEngine in the list * * ============================================================================ * * @param goldToken * @text Token symbol for Gold * @desc A single letter or icon works best! * @type text * @default $ * * @param tokenValue * @text Token value in Gold units * @desc The amount of Gold a single Token represents (rounded up) * @type number * @min 1 * @default 1 * * @param prefix * @text Fixed text that shows before the tokens * @desc Apply your text formatting here! * @type text * @default \C[3] * */ var AG = AG || {}; AG.SimpleGold = AG.SimpleGold || {}; AG.SimpleGold.goldToken = String(PluginManager.parameters("AG_SimpleGold")["goldToken"]).trim(); AG.SimpleGold.tokenValue = Math.max(Number(PluginManager.parameters("AG_SimpleGold")["tokenValue"]),1); AG.SimpleGold.prefix = String(PluginManager.parameters("AG_SimpleGold")["prefix"]); (function() { //============================================================================= // Window_Base //============================================================================= //Overwrite Window_Base.prototype.drawCurrencyValue = function(value, unit, x, y, width) { const unitWidth = Math.min(80, this.textWidth(unit)); this.resetTextColor(); this.drawTextEx(this.goldToTokens(value), x, y, width - unitWidth - 6, "right"); this.changeTextColor(ColorManager.systemColor()); this.drawText(unit, x + width - unitWidth, y, unitWidth, "right"); } //New Window_Base.prototype.goldToTokens = function(value) { var string = ""; var tokens = Math.ceil(value / AG.SimpleGold.tokenValue); while(tokens > 0){ string += AG.SimpleGold.goldToken; tokens--; } return AG.SimpleGold.prefix + string; }; })(); 复制代码
(save as "AG_SimpleGold.js" in your plugins folder)
Credits: Akumu Games
I personally needed this in my game to make my life somewhat easier. I hope it can be useful to someone else as well
!
本贴来自国际rpgmaker官方论坛作者:Kyuukon处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/ag-simple-gold.141102/