Module:Attributes

From Exiled Kingdoms Wiki
Revision as of 19:33, 7 June 2017 by M3lkor (talk | contribs)

p = {} local Comp = require( "Module:ValComp" ) Compf = Comp.Compare Arg1 = mw.getCurrentFrame().args[1] Arg2 = mw.getCurrentFrame().args[2]

ArmAttr = {'Detection', 'Gossip', 'Stability', 'Stun Immunity', 'Tinkering', 'Wisdom', 'Shield'}

WpnAttr = {'Beast Slayer', 'Holy', 'Orc Slayer', 'Paralysis', 'Silver', 'Slow', 'Stun', 'Vicious'}

function p.Disp()

   txtout = 
   attribs = mw.text.split(Arg1,',',true)
   if (Arg2 == 'a') then
       for i, attr in pairs(attribs) do
           if (tonumber(attr) > 0) then
               if (txtout ~= ) then
                   if (i == 3 or i == 4 or i == 7) then
                       txtout = string.format('%s; %s', txtout, ArmAttr[i])
                   else
                       txtout = string.format('%s; %s %s', txtout, ArmAttr[i], attr)
                   end
               else
                   txtout = string.format('%s %s',ArmAttr[i], attr)
               end
           end
       end
   elseif (Arg2 == 'w') then
       for i, attr in pairs(attribs) do
           if (tonumber(attr) > 0) then
               if (txtout ~= ) then
                   if (i == 4 or i == 5 or i == 6 or i == 7) then
                       txtout = string.format('%s; %s', txtout, WpnAttr[i])
                   else
                       txtout = string.format('%s; %s %s', txtout, WpnAttr[i], attr)
                   end
               else
                   txtout = string.format('%s %s',WpnAttr[i], attr)
               end
           end
       end
   end
   return txtout

end

function Sel()

   hasattr = 0
   Arg3 = mw.getCurrentFrame().args[3]
   Arg4 = mw.getCurrentFrame().args[4]
   attribs = mw.text.split(Arg1,',',true)
   if (Arg3 == nil or Arg3 == ) then
       Arg3 = 'gt'
   end
   if (Arg4 == nil or Arg4 == ) then
       Arg4 = 0
   end
   if (Arg2 == 'a') then
       if Compf(1, Arg3, Arg4) == true then
           return 'it works'
       end
   elseif (Arg2 == 'w') then
       
   end
   return hasattr

end

return p