模块:SkillString

来自维阿百科
跳转至: 导航搜索

此模块的文档可以在模块:SkillString/doc创建

local p = {}

local target_icon_class = 
{
	["自身"] = 'nptarget nptar-self',
	["己方单体"] = 'nptarget nptar-friendly',
	["己方全体"] = 'nptarget nptar-friendly-all',
	["除自身外的己方全体"] = 'nptarget nptar-friendly-all-noself',
	["敌方单体"] = 'nptarget nptar-enemy',
	["敌方全体"] = 'nptarget nptar-enemy-all',
	["获得暴击星"] = 'nptarget nptar-stars'
}

function p.target_icon(frame)
	local args = (frame == mw.getCurrentFrame() and frame.args) or frame
	
	local str_des = (args.str_des or "")
	local target_type = (args.target or "")
	
	if target_type ~= "" then
		return frame:callParserFunction('#vardefine:currentclass', target_icon_class[target_type])
	end
	
	if string.find(str_des, "己方全体") ~= nil then return frame:callParserFunction('#vardefine:currentclass', target_icon_class["己方全体"]) end
	if string.find(str_des, "己方单体") ~= nil then return frame:callParserFunction('#vardefine:currentclass', target_icon_class["己方单体"]) end
	if string.find(str_des, "自身") ~= nil then return frame:callParserFunction('#vardefine:currentclass', target_icon_class["自身"]) end
	if string.find(str_des, "获得") ~= nil and string.find(str_des, "暴击星") ~= nil then return frame:callParserFunction('#vardefine:currentclass', target_icon_class["获得暴击星"]) end
	if string.find(str_des, "敌方全体") ~= nil then return frame:callParserFunction('#vardefine:currentclass', target_icon_class["敌方全体"]) end
	if string.find(str_des, "敌方单体") ~= nil then return frame:callParserFunction('#vardefine:currentclass', target_icon_class["敌方单体"]) end
	
	return ""
end

return p