Module:StatusEffectTooltip

---	StatusEffectTooltip create status effect tooltip. --	--	@module		statuseffecttooltip --	@alias		p --	@author		User:Thundermaker300 --	@attribution	All who helped to update status effect templates --	@require	Module:StatusEffect/Data --	@release	stable --	 local p = {}

local StatusData = mw.loadData('Module:StatusEffect/Data').StatusEffects

function getData(unfriendlyName) for _, entry in pairs(StatusData) do		if entry.InternalName == unfriendlyName then return entry end end return nil end

function p.Image(frame) local data = StatusData[frame.args[1]] or getData(frame.args[1]) if data == nil then return "" end return data.Image end

local tooltip_template = ' ' .. ' ' ..                             ' %s ' .. '' ..                           ' ' ..                            ' ' ..                              '%s%s (%s) %s  %s' .. ' ' ..                         ' '

---	Creates a status effect link. --	@function		p.StatusAffectLink --	@param			{table} frame Frame object --	@return			{string} Preprocessed wikitext of resultant link function p.Tooltip(frame) local data = StatusData[frame.args[1]] or getData(frame.args[1]) if data == nil then return error("StatusEffectTooltip.Tooltip(frame): Invalid status affect!") end local str = string.format(		tooltip_template,		data.Image and "" or "",		data.Expansion and "" or "",		data.Name,		((data.Type == "Debuff" and "hp") or (data.Type == "Buff" and "heal") and (data.Type == "Affix Buff" and "damage") or "white"),		data.Type,		data.EffectShort or "",		data.Effect or "Unknown"	) return frame:preprocess(str) end

return p