Module:Bluetext

From Wiki of Loathing
Jump to navigation Jump to search
Template-noinfo.svg Documentation
This template has no documentation. If you know how to use this template, please add some.

local p = {} 

local function docat( s )
	local cat = ""
	if (string.find( s, "[Aa]pply.*[bB]leed") or string.find( s, "[Ii]nflict.*[bB]leed") or string.find( s, "[Cc]ause.*[bB]leed") ) then
		cat = cat .. "[[Category:Shadows over Loathing bleeding]]"
	end
	if (string.find( s, "[Ss]et.*[Oo]n [Ff]ire") ) then
		cat = cat .. "[[Category:Shadows over Loathing on fire]]"
	end
	if (string.find( s, "[Pp]oison.*an enemy") ) then
		cat = cat .. "[[Category:Shadows over Loathing poison]]"
	end
	if (string.find( s, "[Cc]ure.*[Bb]leed") or string.find( s, "[Rr]emove.*[Bb]leed") ) then
		cat = cat .. "[[Category:Shadows over Loathing cure on fire]]"
	end
	if (string.find( s, "[Cc]ure.*[Oo]n [Ff]ire") or string.find( s, "[Rr]emove.*[Oo]n [Ff]ire") or string.find( s, "[Pp]ut out.*[Oo]n [Ff]ire") ) then
		cat = cat .. "[[Category:Shadows over Loathing cure on fire]]"
	end
	if (string.find( s, "[Cc]ure.*[Pp]oison") ) then
		cat = cat .. "[[Category:Shadows over Loathing cure poison]]"
	end
	if (string.find( s, "[Dd]eal.*Damage") or string.find( s, "[Dd]o.*Damage") or string.find( s, "Chuck it at an enemy for") or string.find( s, "Hurl it at an enemy for") ) then
		cat = cat .. "[[Category:Shadows over Loathing cold damage]]"
		if (string.find( s, "Cold Damage") ) then
			cat = cat .. "[[Category:Shadows over Loathing cold damage]]"
		end
		if (string.find( s, "Hot Damage") ) then
			cat = cat .. "[[Category:Shadows over Loathing hot damage]]"
		end
		if (string.find( s, "Sleaze Damage") ) then
			cat = cat .. "[[Category:Shadows over Loathing sleaze damage]]"
		end
		if (string.find( s, "Spooky Damage") ) then
			cat = cat .. "[[Category:Shadows over Loathing spooky damage]]"
		end
		if (string.find( s, "Stench Damage") ) then
			cat = cat .. "[[Category:Shadows over Loathing stench damage]]"
		end
		if (string.find( s, "Physical Damage") ) then
			cat = cat .. "[[Category:Shadows over Loathing physical damage]]"
		end
	end
    return cat
end

function p.autocat( frame )
	local cat = ""
	-- Sometimes the bluetext gives a list of skills, but this is distinguished by a comma preceding the word "and"
	if (string.find( frame.args[1],", and") ) then
		cat = docate(frame.args[1])
	else
		local ss = mw.text.split(frame.args[1]," and ",true)
		for i = 1, #ss do 
			cat = cat .. docate(ss[i])
		end
	end
end
return p