Warframe Wiki
Advertisement

Dokumentacja dla tego modułu może zostać utworzona pod nazwą Moduł:I/opis

local moduleIcon = {}

local IData = mw.loadData( 'Moduł:I/data' )

function createIcon(icon, link, text, size)
    if( text == nil or text == '' ) then
        return '[[File:'..icon..'|'..size..'px|link='..link..']]'
    else 
        return '[[File:'..icon..'|'..size..'px|link='..link..']] [['..link..'|'..text..']]'
    end
end

function moduleIcon.Icon(frame)

    local iconName = frame.args[1]
    local text = frame.args[2]
    local size = frame.args.size
    local color = frame.args.color
    local image

    if( IData[iconName] == nil ) then
        return "<span style='color: red;'>Ikona <span style='font-weight:900;'>".. iconName .."</span> nie istnieje</span>[[Kategoria:Nieistniejąca ikona]]"
    end
    
    if( color == nil or color == '' ) then
        color = black;
    end
    
    if( type(IData[iconName].image) == table ) then
        if( IData[iconName].image[color] == nil ) then
            return "<span style='color: red;'>Kolor <span style='font-weight:900;'>".. color .."</span> nie istnieje</span>[[Kategoria:Nieistniejąca ikona]]"
        else 
            image = IData[iconName].image[color]
        end
    else 
        image = IData[iconName].image
    end

    if( size == nil or size == '' ) then
        size = IData[iconName].size
    end

    return createIcon(IData[iconName].image, IData[iconName].link, text, size)

end

function moduleIcon.Przedmiot(frame)
    local iname = frame.args[1]
    local textExist = frame.args[2]
    local link
    local icon
    local size = frame.args.size
    
    if IData['Przedmiot'][iname] == nil then
        return "<span style='color:red;'>Niepoprawna nazwa "..iname.."</span>"
    else
        icon = IData['Przedmiot'][iname]['image']
        link = IData['Przedmiot'][iname]['link']
        if (size == nil or size == '') then
            size = 'x28'
        end
        if (textExist == nil or textExist == '') then
            return '[[File:'..icon..'|'..size..'px|link='..link..']]'
        elseif (textExist == 'text' or textExist == 'Text') then
            return '[[File:'..icon..'|link='..link..'|'..size..'px]] [['..link..'|'..iname..']]'
        else 
            return '[[File:'..icon..'|'..size..'px|link='..link..']] [['..link..'|'..textExist..']]'
        end
    end
end

function moduleIcon.Ryba( frame )
    local iname = frame.args[1]        
    local textExist = frame.args[2]
    local link
    local icon
    local size = frame.args.size

    if IData['Ryba'][iname] == nil then
        return "<span style='color:red;'>Niepoprawna nazwa "..iname.."</span>"
    else
        icon = IData["Ryba"][iname]["image"]
        link = IData["Ryba"][iname]["link"]
        if (size == nil or size == '') then
            size = 'x28'                                 
        end
        if (textExist == nil or textExist == '') then
            return '[[File:'..icon..'|'..size..'px|link='..link..']]'
        elseif (textExist == 'text' or textExist == 'Text') then
            return '[[File:'..icon..'|link='..link..'|'..size..'px]] [['..link..'|'..iname..']]'
        else 
            return '[[File:'..icon..'|'..size..'px|link='..link..']] [['..link..'|'..textExist..']]'
        end
    end
end

function moduleIcon.Surowiec(frame)
    local iname = frame.args[1]
    local textExist = frame.args[2]
    local link
    local icon
    local size = frame.args.size
    
    if IData['Surowiec'][iname] == nil then
        return ""
    else
        icon = IData['Surowiec'][iname]['icon']
        link = IData['Surowiec'][iname]['link']
        if(size == nil or size == '') then
            size = 'x25'
        end
        if (textExist == nil or textExist == '') then
            return '[[File:'..icon..'|'..size..'px|link='..link..']]'
        elseif (textExist == 'text' or textExist == 'Text') then
            return '[[File:'..icon..'|link='..link..'|'..size..'px]] [['..link..'|'..iname..']]'
        else 
            return '[[File:'..icon..'|'..size..'px|link='..link..']] [['..link..'|'..textExist..']]'
        end
    end
end

function moduleIcon.WF(frame)
    local iname = frame.args[1]
    local textExist = frame.args[2]
    local link
    local icon
    local size = frame.args.size
    
    if IData['WF'][iname] == nil then
        return ""
    else
        icon = IData['WF'][iname]['icon']
        link = IData['WF'][iname]['link']
        if(size == nil or size == '') then
            size = 'x20'
        end
        if (textExist == nil or textExist == '') then
            return '[[File:'..icon..'|'..size..'px|link='..link..']]'
        elseif (textExist == 'text' or textExist == 'Text') then
            return '[[File:'..icon..'|link='..link..'|'..size..'px]] [['..link..'|'..iname..']]'
        else 
            return '[[File:'..icon..'|'..size..'px|link='..link..']] [['..link..'|'..textExist..']]'
        end
    end
end

function moduleIcon.WPN(frame)
    local iname = frame.args[1]
    local textExist = frame.args[2]
    local link
    local icon
    local size = frame.args.size
    
    if IData['WPN'][iname] == nil then
        return ""
    else
        icon = IData['WPN'][iname]['icon']
        link = IData['WPN'][iname]['link']
        if(size == nil or size == '') then
            size = 'x20'
        end
        if (textExist == nil or textExist == '') then
            return '[[File:'..icon..'|'..size..'px|link='..link..']]'
        elseif (textExist == 'text' or textExist == 'Text') then
            return '[[File:'..icon..'|link='..link..'|'..size..'px]] [['..link..'|'..iname..']]'
        else 
            return '[[File:'..icon..'|'..size..'px|link='..link..']] [['..link..'|'..textExist..']]'
        end
    end
end

function moduleIcon.Przycisk(frame)
    local iname = frame.args[1]
    local textExist = frame.args[2]
    local link
    local icon
    local size = frame.args.size
    
    if IData['Przycisk'][iname] == nil then
        return ""
    else
        icon = IData['Przycisk'][iname]['icon']
        link = IData['Przycisk'][iname]['link']
        if(size == nil or size == '') then
            size = 'x18'
        end
        if (textExist == nil or textExist == '') then
            return '[[File:'..icon..'|'..size..'px|link='..link..']]'
        elseif (textExist == 'text' or textExist == 'Text') then
            return '[[File:'..icon..'|link='..link..'|'..size..'px]] [['..link..'|'..iname..']]'
        else 
            return '[[File:'..icon..'|'..size..'px|link='..link..']] [['..link..'|'..textExist..']]'
        end
    end
end

function moduleIcon.Planeta(frame)
    local iname = frame.args[1]
    local textExist = frame.args[2]
    local link
    local icon
    local size = frame.args.size
    
    if IData['Planeta'][iname] == nil then
        return ""
    else
        icon = IData['Planeta'][iname]['icon']
        link = IData['Planeta'][iname]['link']
        if(size == nil or size == '') then
            size = 'x20'
        end
        if (textExist == nil or textExist == '') then
            return '[[File:'..icon..'|'..size..'px|link='..link..']]'
        elseif (textExist == 'text' or textExist == 'Text') then
            return '[[File:'..icon..'|link='..link..'|'..size..'px]] [['..link..'|'..iname..']]'
        else 
            return '[[File:'..icon..'|'..size..'px|link='..link..']] [['..link..'|'..textExist..']]'
        end
    end
end

function moduleIcon.Proc(frame)
    local iname = frame.args[1]
    local textExist = frame.args[2]
    local color = frame.args[3]
    local size = frame.args.size
    
    return moduleIcon.proc(iname, textExist, color, size)
end

function moduleIcon.proc(iname, textExist, color, size)
    local link = ''
    local text = ''
    local textColor = ''
    local fr = iname:sub(1,1)
 
if (fr == 'M' or fr == 'W' or fr == 'T' or fr == 'P') then
       fr = mw.ustring.sub(iname,1,3)
    end
    
    if string.byte(fr,1) == 197 then
        fr = '197' 
    end
    
    if IData['Proc'][fr] == nil then
        return "<span style='color:red;'>Niepoprawna nazwa "..fr.."</span>"
    else 
        link = IData['Proc'][fr]['link']
        if color == 'white' then
            image = IData['Proc'][fr]['image'][2]
        else
            image = IData['Proc'][fr]['image'][1]
        end
        if (size == nil or size == '') then
            size = 'x18'
        end
        if (textExist =='text' or textExist == 'Text') then
            textColor = IData['Proc'][fr]['color']
            text = iname
            return '[[File:'..image..'|link='..link..'|'..size..'px]] [['..link..'|<span style=\"color:'..textColor..';\">'..text..'</span>]]'
        end
        return '[[File:'..image..'|link='..link..'|'..size..'px]]'
    end
end

function moduleIcon.Pol(frame)
    local iname = frame.args[1]
    local size = frame.args.size
    
    return moduleIcon.pol(iname, size)
end

 function moduleIcon.pol(iname, size)
    if IData['Pol'][iname] == nil then
        return "<span style='color:red;'>Niepoprawna nazwa "..iname.."</span>"
    else
        if(size == nil or size == '') then
            size = 'x20'
        end
        return '[[File:'..IData['Pol'][iname]..'|link=Polaryzacja|'..size..'px]]'
    end
end

function moduleIcon.Frakcja(frame)
    local iname = frame.args[1]
    local size = frame.args.size
    local textExist = frame.args[2]
    local name = mw.ustring.sub(iname,1,1)
    local link
    local color = frame.args[3]
    local icon
    
    if( name == 'S' ) then
        name = mw.ustring.sub(iname,1,2)
    end
    
    if IData['Frakcja'][name] == nil then
        return "<span style='color:red;'>Niepoprawna nazwa "..name.."</span>"
    else
        if(color == nil or color == '') then
            icon = IData['Frakcja'][name]['icon'][1]
        else
            icon = IData['Frakcja'][name]['icon'][2]
        end
        link = IData['Frakcja'][name]['link']
        if(size == nil or size == '') then
            size = 'x20'
        end
        if(textExist == 'text' or textExist == 'Text') then
            return '[[File:'..icon..'|link='..link..'|'..size..'px]] [['..link..'|'..iname..']]'
        else
            return '[[File:'..icon..'|link='..link..'|'..size..'px]]'
        end
    end
end

function moduleIcon.Fokus(frame)
    local iname = frame.args[1]
    local size = frame.args.size
    local textExist = frame.args[2]
    local color = frame.args[3]
    local typeOf = frame.args.typ
    local icon
    
    if( IData['Fokus'][iname] == nil) then
        return "<span style='color:red;'>Niepoprawna nazwa "..iname.."</span>"
    else 
        if(color == nil or color =='' ) then
            color = false
        else
            color = true
        end
        if(typeOf == nil or typeOf == '') then
            typeOf = false
        else
            typeOf = true
        end
        if(typeOf) then
            if(color) then
                icon = IData['Fokus'][iname]['pattern'][2]
            else
                icon = IData['Fokus'][iname]['pattern'][1]
            end
        else
            if(color) then
                icon = IData['Fokus'][iname]['icon'][2]
            else
                icon = IData['Fokus'][iname]['icon'][1]
            end
        end
        if(size == nil or size == '') then
            size = 'x20'
        end
        if(textExist == 'text' or textExist == 'Text') then
            return '[[File:'..icon..'|link=Fokus|'..size..'px]] [[Fokus|'..iname..']]'
        else 
            return '[[File:'..icon..'|link=Fokus|'..size..'px]]'
        end
    end
end

return moduleIcon
Advertisement