Warframe Wiki
Advertisement
Warframe Wiki

Có thể viết tài liệu về mô đun này tại Mô đun:Icon/tài liệu.

local p = {}

local IconData = mw.loadData( 'Module:Icon/data' )

function p.Item(frame)
	local iconname = frame.args[1]
	local textexist = frame.args[2]
	local imagesize = frame.args.imgsize
	local link = ''
	if IconData["Items"][iconname] == nil then          
		return "<span style=\"color:red;\">Invalid</span>"  
	else
		link = IconData["Items"][iconname]["link"]
                iconname = IconData["Items"][iconname]["icon"]
		if (imagesize == nil or imagesize == '') then
			imagesize = 'x26'                                 
		end
		if textexist == 'text' then                           
			return '[[File:'..iconname..'|'..imagesize..'px|link='..link..']]'..' '..'[['..link..'|'..frame.args[1]..']]'
		end
		return '[[File:'..iconname..'|'..imagesize..'px|link='..link..']]'
	end
end

function p.Pol( frame )
        local iconname = frame.args[1]
        local imagesize = frame.args.imgsize
        if IconData["Polarities"][iconname] == nil then          
              return "<span style=\"color:red;\">Invalid</span>"  
        else
           iconname = IconData["Polarities"][iconname]
           if (imagesize == nil or imagesize == '') then
              imagesize = 'x20'                                 
           end
	   return '[[File:'..iconname..'|'..imagesize..'px|link=Polarity]]'
        end
end

function p.Faction( frame )
        local iconname = frame.args[1]        
	local textexist = frame.args[2]          
        local color = frame.args[3]
        local imagesize = frame.args.imgsize
        local link = ''
        if IconData["Factions"][iconname] == nil then          
              return "<span style=\"color:red;\">Invalid</span>"  
        else
           link = IconData["Factions"][iconname]["link"]
           if color == 'white' then
              iconname = IconData["Factions"][iconname]["icon"][2]   --white icon
           else
	      iconname = IconData["Factions"][iconname]["icon"][1]   --black icon
	   end
           if (imagesize == nil or imagesize == '') then
              imagesize = 'x20'                                 
           end
	   if textexist == 'text' then                           
              return '[[File:'..iconname..'|'..imagesize..'px|link='..link..']]'..'[['..link..']]'
           end
	   return '[[File:'..iconname..'|'..imagesize..'px|link='..link..']]'
        end
end

function p.Syndicate( frame )
        local iconname = frame.args[1]        
	local textexist = frame.args[2]          
        local color = frame.args[3]
        local imagesize = frame.args.imgsize
        local link = ''
        if IconData["Syndicates"][iconname] == nil then          
              return "<span style=\"color:red;\">Invalid</span>"  
        else
           link = IconData["Syndicates"][iconname]["link"]
           if color == 'white' then
              iconname = IconData["Syndicates"][iconname]["icon"][2]   --white icon
           else
	      iconname = IconData["Syndicates"][iconname]["icon"][1]   --black icon
	   end
           if (imagesize == nil or imagesize == '') then
              imagesize = 'x32'                                 
           end
	   if textexist == 'text' then                           
              return '[[File:'..iconname..'|'..imagesize..'px|link='..link..']]'..'[['..link..']]'                         
           end
	   return '[[File:'..iconname..'|'..imagesize..'px|link='..link..']]'
        end
end

function p.Prime( frame ) 
        local primename = string.gsub(" "..string.lower( frame.args[1] ), "%W%l", string.upper):sub(2) 
	local partname = frame.args[2]
        local imagesize = frame.args.imgsize
        local link = ''
        if IconData["Primes"][primename] == nil then          
              return "Unconfirmed Item"  
        else
           link = IconData["Primes"][primename]["link"]
           iconname = IconData["Primes"][primename]["icon"]
           if (imagesize == nil or imagesize == '') then
              imagesize = 'x32'                                 
           end
	   if partname ~= nil then 
              partname = string.gsub(" "..string.lower( frame.args[2] ), "%W%l", string.upper):sub(2)                          
              return '[[File:'..iconname..'|'..imagesize..'px|link='..link..']]'..' '..'[['..link..'#Acquisition|'..primename..' Prime '..partname..']]'                         
           end
	   return '[[File:'..iconname..'|'..imagesize..'px|link='..link..']]'
        end
end

function p.Resource( frame )
        local iconname = frame.args[1]        
	local textexist = frame.args[2]
        local imagesize = frame.args.imgsize
        local link = ''
        if IconData["Resources"][iconname] == nil then          
              return "<span style=\"color:red;\">Invalid</span>"  
        else
           link = IconData["Resources"][iconname]["link"]
           iconname = IconData["Resources"][iconname]["icon"]
           if (imagesize == nil or imagesize == '') then
              imagesize = 'x32'                                 
           end
	   if textexist == 'text' then                           
              return '[[File:'..iconname..'|'..imagesize..'px|link='..link..']]'..' '..'[['..link..'|'..frame.args[1]..']]'                         
           end
	   return '[[File:'..iconname..'|'..imagesize..'px|link='..link..']]'
        end
end

function p.Proc( frame )
        local iconname = frame.args[1]        
	local textexist = frame.args[2]          
        local color = frame.args[3]
        local imagesize = frame.args.imgsize
        local link = ''
        local textcolor = ''
        if IconData["Procs"][iconname] == nil then          
              return "<span style=\"color:red;\">Invalid</span>"  
        else
           link = IconData["Procs"][iconname]["link"] 
           if color == 'white' then
              iconname = IconData["Procs"][iconname]["icon"][2]   --white icon
           else
	      iconname = IconData["Procs"][iconname]["icon"][1]   --black icon
	   end
           if (imagesize == nil or imagesize == '') then
              imagesize = 'x18'                                 
           end
	   if textexist == 'text' then  
              textcolor = IconData["Procs"][frame.args[1]]["color"]                 
              return '[[File:'..iconname..'|'..imagesize..'px|link='..link..']]'..' '..'[['..link..'|<span style=\"color:'..textcolor..';\">'..frame.args[1]..'</span>]]'                      
           end
	   return '[[File:'..iconname..'|'..imagesize..'px|link='..link..']]'
        end
end

function p.Flag( frame )
        local iconname = frame.args[1]
        local countryname = frame.args[2]
        local dest = frame.args[3]
        if IconData["Flags"][iconname] == nil then          
              return "<span style=\"color:red;\">Invalid</span>"  
        else
           iconname = IconData["Flags"][iconname]
           if countryname == nil then
              countryname = ''
           end
           if dest == nil then
              dest = ''
           end
	   return '[[File:'..iconname..'|'..countryname..'|link='..dest..']]'
        end
end
 
return p
Advertisement