Wiki SurvivorVD
Sem resumo de edição
Sem resumo de edição
Linha 5: Linha 5:
 
function c.main(frame)
 
function c.main(frame)
 
parent = frame:getParent();
 
parent = frame:getParent();
genero = parent.args['girl'];
+
genero = parent.args['gender'];
 
 
 
season = {
 
season = {

Edição das 12h22min de 2 de março de 2020

A documentação para este módulo pode ser criada em Módulo:Sprint/Sweet/doc

--<pre>
local c = {}
t = 0;

function c.main(frame)
    parent = frame:getParent();
    genero = parent.args['gender'];
    
    season = {
    parent.args['season'],
    parent.args['season2'],
    parent.args['season3'],
    parent.args['season4']
    };
    
    place = {
        parent.args['place'],
        parent.args['place2'],
        parent.args['place3'],
        parent.args['place4']
    };

    votes = {
        tonumber(parent.args['votesagainst']),
        tonumber(parent.args['votesagainst2']),
        tonumber(parent.args['votesagainst3']),
        tonumber(parent.args['votesagainst4'])
    };

    if season[1] ~= nil then t=t+1; end;
    if season[2] ~= nil then t=t+1; end;
    if season[3] ~= nil then t=t+1; end;
    if season[4] ~= nil then t=t+1; end;

    chamada = frame.args[1];
    if chamada == 'sprint' then return sprint();
    elseif chamada == 'sprinti' then return sprinti();
    elseif chamada == 'sweet' then return sweet();
    elseif chamada == 'sweeti' then return sweeti();
    end;
   
end

function sprint(retorno)
    local sprint,g,cc = 0,nil,'';
    if genero == 'a' then g = 'a' else g = ''; end;
    if retorno ~= nil then retorno = true; end;
    
    for i=1,t,1 do
        s = sfy(season[i]);
        p = tonumber(string.match(place[i], "(%d+)/"));
        v = votes[i];
        
        if s == 'Grécia' and p==1 then sprint=sprint+1;
        elseif s == 'Havaí' and p==1 then sprint=sprint+1;
        elseif s == 'Sibéria' and p==1 then sprint=sprint+1;
        elseif s == 'Brasil' and p==5 then sprint=sprint+1;
        elseif s == 'Galápagos' and p==1 then sprint=sprint+1;
        elseif s == 'Egito' and p==4 then sprint=sprint+1;
        elseif s == 'Vietnã' and p==1 then sprint=sprint+1;
        elseif s == 'Estados Unidos' and p==1 then sprint=sprint+1;
        elseif s == 'França' and p==1 then sprint=sprint+1;
        elseif s == 'Nova Zelândia' and p==6 then sprint=sprint+1;
        elseif s == 'Uganda' and p==1 then sprint=sprint+1;
        elseif s == 'Cuba' and p==1 then sprint=sprint+1;
        elseif s == 'Irlanda' and p==4 then sprint=sprint+1;
        elseif s == 'Alemanhas' and p==7 then sprint=sprint+1;
        elseif s == 'Gobi' and p==4 then sprint=sprint+1;
        elseif s == 'Tuvalu' and p==1 then sprint=sprint+1;
        elseif s == 'Mumbai' and p==1 then sprint=sprint+1;
        elseif s == 'Coreias' and p==9 then sprint=sprint+1;
        elseif s == 'Amazonas' and p==5 then sprint=sprint+1;
        elseif s == 'México' and p==12 then sprint=sprint+1;
        elseif s == 'Serra Leoa' and p==5 then sprint=sprint+1;
        elseif s == 'Romênia' and p==5 then sprint=sprint+1;
        elseif s == 'Bali' and p==1 then sprint=sprint+1;
        elseif s == 'Tortuga' and p==4 then sprint=sprint+1;
        end;
    end;

    if retorno == true then return sprint; end;
    
    if sprint<1 then return; end;
    
    cc = cc .. '[[Categoria:Sprint]]';
    
    if sprint==1 then
    return cc .. '<span class=\"badge\">[[Image:Badge_sprint.png|link=Categoria:Sprint]]</span> <p>Jogador'..g..' da Temporada</p>'

    else
    cc = cc .. '[[Categoria:Múltiplas indicações a Sprint]][[Categoria:'..sprint..'x Sprint]]';
    return cc .. '<span class=\"badge\">[[Image:Badge_sprint_'..sprint..'x.png|link=Categoria:Sprint]]</span> <p>' .. sprint .. 'x Jogador'..g..' da Temporada</p>' 
    end;

end

function sprinti()
    local sprinti,g,cc = 0,nil,'';
    if genero == 'a' then g = 'a' else g = 'o'; end;
    for i=1,t,1 do
        s = sfy(season[i]);
        p = tonumber(string.match(place[i], "(%d+)/"));
        v = votes[i];
 
        if s == 'Grécia' and (p==2 or p==4) then sprinti=sprinti+1;
        elseif s == 'Havaí' and (p==2 or p==3) then sprinti=sprinti+1;
        elseif s == 'Sibéria' and (p==2 or p==5) then sprinti=sprinti+1;
        elseif s == 'Brasil' and (p==2 or p==4) then sprinti=sprinti+1;
        elseif s == 'Galápagos' and (p==2 or p==10) then sprinti=sprinti+1;
        elseif s == 'Egito' and (p==1 or p==2 and v==2) then sprinti=sprinti+1;
        elseif s == 'Vietnã' and (p==3 or p==4) then sprinti=sprinti+1;
        elseif s == 'Estados Unidos' and (p==2 or p==6) then sprinti=sprinti+1;
        elseif s == 'França' and (p==2 or p==3) then sprinti=sprinti+1;
        elseif s == 'Nova Zelândia' and (p==1 or p==2 or p==5 or p==7) then sprinti=sprinti+1;
        elseif s == 'Uganda' and (p==5 or p==8 or p==9) then sprinti=sprinti+1;
        elseif s == 'Cuba' and (p==2 or p==3 or p==7) then sprinti=sprinti+1;
        elseif s == 'Irlanda' and (p==1 or p==3 or p==10) then sprinti=sprinti+1;
        elseif s == 'Alemanhas' and (p==3 or p==6 or p==8) then sprinti=sprinti+1;
        elseif s == 'Gobi' and (p==1 or p==3 or p==6 or p==10 or p==11) then sprinti=sprinti+1;
        elseif s == 'Tuvalu' and (p==2 or p==4 or p==5 or p==7) then sprinti=sprinti+1;
        elseif s == 'Mumbai' and (p==2 or p==3 or p==4) then sprinti=sprinti+1;
        elseif s == 'Coreias' and (p==1 or p==2 or p==6 or p==7) then sprinti=sprinti+1;
        elseif s == 'Amazonas' and ((p==2 and v==0) or p==4 or p==6 or p==7) then sprinti=sprinti+1;
        elseif s == 'México' and (p==2 or p==5 or p==8 or p==9 or p==11) then sprinti=sprinti+1;
        elseif s == 'Serra Leoa' and (p==1 or p==3 or p==8 or p==13) then sprinti=sprinti+1;
        elseif s == 'Romênia' and (p==7 or p==8 or p==9 or p==10) then sprinti=sprinti+1;
        elseif s == 'Bali' and (p==2 or p==5 or p==6 or p==7) then sprinti=sprinti+1;
        elseif s == 'Tortuga' and (p==5 or p==7 or (p==2 and v==11)) then sprinti=sprinti+1;
        end;
    end;

    sprint = sprint(true);
    
    if sprinti<1 then return; end;
    
    cc = cc .. '[[Categoria:Indicados a Sprint]]';
    
    if sprint>0 then cc = cc .. '[[Categoria:Múltiplas indicações a Sprint]][[Categoria: Indicados a Sprint que já venceram]]';
    else cc = cc .. '[[Categoria: Indicados a Sprint que não venceram]]';
    end;
 
    if sprinti<2 then cc = cc .. '<span class="badge">[[Image:Badge_sprint_i.png|link=Categoria:Indicados a Sprint]]</span> <p>Indicad'..g..' a Sprint Player</p>';
 
    else cc = cc .. '[[Categoria:Múltiplas indicações a Sprint]]';
        if sprint == 0 then cc = cc .. '[[Categoria:Múltiplas indicações a Sprint sem vencer]]'; end;
 
    return cc .. '<span class="badge">[[Image:Badge_sprint_i_'..sprinti..'x.png|link=Categoria:Indicados a Sprint]]</span> <p>Indicad'..g..' a Sprint Player ('..sprinti..'x)</p>';
    end;

    return cc;

end

function sweet(retorno)
    local sweet,g,cc = 0,nil,'';
    if genero == 'a' then g = 'a' else g = ''; end;
    if retorno ~= nil then retorno = true; end;
        
    for i=1,t,1 do
        s = sfy(season[i]);
        p = tonumber(string.match(place[i], "(%d+)/"));
        v = votes[i];
        
        if s == 'Grécia' and p==8 then sweet=sweet+1;
        elseif s == 'Havaí' and p==4 then sweet=sweet+1;
        elseif s == 'Sibéria' and p==9 then sweet=sweet+1;
        elseif s == 'Brasil' and p==1 then sweet=sweet+1;
        elseif s == 'Galápagos' and p==5 then sweet=sweet+1;
        elseif s == 'Egito' and p==5 then sweet=sweet+1;
        elseif s == 'Vietnã' and p==5 then sweet=sweet+1;
        elseif s == 'Estados Unidos' and p==5 then sweet=sweet+1;
        elseif s == 'França' and (p==3 or p==5) then sweet=sweet+1;
        elseif s == 'Nova Zelândia' and p==13 then sweet=sweet+1;
        elseif s == 'Uganda' and p==12 then sweet=sweet+1;
        elseif s == 'Cuba' and p==6 then sweet=sweet+1;
        elseif s == 'Irlanda' and p==9 then sweet=sweet+1;
        elseif s == 'Alemanhas' and p==5 then sweet=sweet+1;
        elseif s == 'Gobi' and p==9 then sweet=sweet+1;
        elseif s == 'Tuvalu' and p==2 then sweet=sweet+1;
        elseif s == 'Mumbai' and p==6 then sweet=sweet+1;
        elseif s == 'Coreias' and p==9 then sweet=sweet+1;
        elseif s == 'Amazonas' and p==6 then sweet=sweet+1;
        elseif s == 'México' and p==5 then sweet=sweet+1;
        elseif s == 'Serra Leoa' and p==6 then sweet=sweet+1;
        elseif s == 'Romênia' and p==4 then sweet=sweet+1;
        elseif s == 'Bali' and p==5 then sweet=sweet+1;
        elseif s == 'Tortuga' and p==5 then sweet=sweet+1;
        end;
    end;

    if retorno == true then return sweet; end;
    
    if sweet<1 then return; end;
    
    cc = cc .. "[[Categoria:Sweethearts]]";
    
    if sweet==1 then
    return cc .. '<span class=\"badge\">[[Image:Badge_sweet.png|link=Categoria:Sweethearts]]</span> <p>Sweet Player da Temporada</p>';
 
    else cc = cc .. '[[Categoria:'..sweet..'x Sweethearts]][[Categoria:Múltiplas indicações a Sweet]]';
    return cc .. '<span class="badge">[[Image:Badge_sweet_'..sweet..'x.png|link=Categoria:Sweethearts]]</span> <p>'..sweet..'x Sweet Player da Temporada</p>'
    end;

end

function sweeti()
        local sweeti,g,cc = 0,nil,'';
    if genero == 'a' then g = 'a' else g = 'o'; end;
    for i=1,t,1 do
        s = sfy(season[i]);
        p = tonumber(string.match(place[i], "(%d+)/"));
        v = votes[i];
 
        if s == 'Grécia' and (p==5 or p==6) then sweeti=sweeti+1;
        elseif s == 'Havaí' and (p==6 or p==10) then sweeti=sweeti+1;
        elseif s == 'Sibéria' and (p==3 or p==11) then sweeti=sweeti+1;
        elseif s == 'Brasil' and (p==7 or p==9) then sweeti=sweeti+1;
        elseif s == 'Galápagos' and (p==8 or p==9) then sweeti=sweeti+1;
        elseif s == 'Egito' and (p==4 or p==8) then sweeti=sweeti+1;
        elseif s == 'Vietnã' and (p==9 or p==20) then sweeti=sweeti+1;
        elseif s == 'Estados Unidos' and (p==4 or p==8) then sweeti=sweeti+1;
        elseif s == 'França' and (p==1 or p==6 or p==11 or p==16) then sweeti=sweeti+1;
        elseif s == 'Nova Zelândia' and (p==12 or p==14) then sweeti=sweeti+1;
        elseif s == 'Uganda' and (p==7 or p==8 or p==19) then sweeti=sweeti+1;
        elseif s == 'Cuba' and (p==4 or p==8) then sweeti=sweeti+1;
        elseif s == 'Irlanda' and (p==2 or p==5 or p==15 or p==20) then sweeti=sweeti+1;
        elseif s == 'Alemanhas' and (p==1 or p==14 or p==19) then sweeti=sweeti+1;
        elseif s == 'Gobi' and (p==1 or p==5 or p==14) then sweeti=sweeti+1;
        elseif s == 'Tuvalu' and (p==6 or p==8 or p==13 or p==18) then sweeti=sweeti+1;
        elseif s == 'Mumbai' and (p==9 or p==10) then sweeti=sweeti+1;
        elseif s == 'Coreias' and (p==1 or p==2 or p==4 or p==10) then sweeti=sweeti+1;
        elseif s == 'Amazonas' and ((p==2 and v==6) or p==4 or p==7 or p==11) then sweeti=sweeti+1;
        elseif s == 'México' and (p==2 or p==4 or p==6 or p==15 or p==18) then sweeti=sweeti+1;
        elseif s == 'Serra Leoa' and (p==2 or p==3 or p==9 or p==10) then sweeti=sweeti+1;
        elseif s == 'Romênia' and (p==1 or p==5 or p==9 or p==12) then sweeti=sweeti+1;
        elseif s == 'Bali' and (p==3 or p==4 or p==7 or p==10) then sweeti=sweeti+1;
        elseif s == 'Tortuga' and (p==1 or p==6 or p==9) then sweeti=sweeti+1;
        end;
    end;

    sweet = sweet(true);
    
    if sweeti<1 then return; end;
    
    cc = cc .. '[[Categoria:Indicados a Sweet]]';
    
    if sweet>0 then cc = cc .. '[[Categoria:Múltiplas indicações a Sweet]][[Categoria: Indicados a Sweet que já venceram]]';
    else cc = cc .. '[[Categoria: Indicados a Sweet que não venceram]]';
    end;
 
    if sweeti<2 then cc = cc .. '<span class="badge">[[Image:Badge_sweet_i.png|link=Categoria:Indicados a Sweet]]</span> <p>Indicad'..g..' a Sweet Player</p>';
 
    else cc = cc .. '[[Categoria:Múltiplas indicações a Sweet]]';
        if sweet == 0 then cc = cc .. '[[Categoria:Múltiplas indicações a Sweet sem vencer]]'; end;
 
    return cc .. '<span class="badge">[[Image:Badge_sweet_i_'..sweeti..'x.png|link=Categoria:Indicados a Sweet]]</span> <p>Indicad'..g..' a Sweet Player ('..sweeti..'x)</p>';
    end;
 
    return cc;
    
end

function sfy(s)
    s = string.match(s, "VD:%s?([^%]]+)");
    if string.match(s, '(.*)%s?-') 
    then s = string.match(s, '(.-)%s?-'); end;
    return s;
end

return c;
--</pre>