Module:UIText

--Get Required Modules local getArgs = require('Module:Arguments').getArgs local string = require('Module:String') local table = require('Module:Table') local lu = require('Module:LibraryUtil') local yesno = require('Module:Yesno') local statAliases = require('Module:Statname/aliases') --Begin Exports local p = {}

local characters = { ['health'] = '❤', ['defense'] = '❈', ['strength'] = '❁', ['speed'] = '✦', ['crit chance'] = '☣', ['crit damage'] = '☠', ['intelligence'] = '✎', ['sea creature chance'] = '∞', ['magic find'] = '✯', ['pet luck'] = '♣', ['true defense'] = '❂', ['attack speed'] = '⚔', ['ferocity'] = '⫽', ['ability damage'] = '✹', ['mining speed'] = '⛏', ['mining fortune'] = '☘', ['farming fortune'] = '☘', ['foraging fortune'] = '☘', }

local colors = { ['health'] = 'red', ['defense'] = 'green', ['strength'] = 'red', ['speed'] = 'white', ['crit chance'] = 'blue', ['crit damage'] = 'blue', ['intelligence'] = 'light aqua', ['sea creature chance'] = 'aqua', ['magic find'] = 'light aqua', ['pet luck'] = 'light purple', ['true defense'] = 'white', ['attack speed'] = 'yellow', ['ferocity'] = 'red', ['ability damage'] = 'red', ['mining speed'] = 'gold', ['mining fortune'] = 'gold', ['farming fortune'] = 'gold', ['foraging fortune'] = 'gold', }

local conversions = { ['black'] = 0, ['dark_blue'] = 1, ['dark_green'] = 2, ['dark_aqua'] = 3, ['dark_red'] = 4, ['dark_purple'] = 5, ['gold'] = 6, ['gray'] = 7, ['dark_gray'] = 8, ['blue'] = 9, ['green'] = 'a', ['aqua'] = 'b', ['red'] = 'c', ['light_purple'] = 'd', ['yellow'] = 'e', ['white'] = 'f', ['minecoin_gold'] = 'g', }

- -- Temlate: UIText -- -- Makes making UI's alot easier - function p.main(frame) local args = getArgs(frame, { trim=false }) local val = args[1] or args["t"] or args["text"]

return string.pcall(p._main, val) end - -- Template: UIText Module access point - function p._main(val) checkType('_main', 1, val, 'string') return (string.unicodeConvert(val)		:gsub('\\stat%{(.+)%}', function(statname) stat = statAliases[statname:lower:gsub('%s', ' ')] or formattedError('Invalid stat escape "\\stat{%s}"', 4, statname) return ('&%s%s %s&r'):format(conversions[colors[stat]], characters[stat], string.ucfirst(stat)) end)		:gsub('/', '\\/')		:gsub('\n', '/')		:gsub('\\n', '/')) end --Finish Module/Exports return p