Module:Damage

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

p = {} resnm = {

   [1] = 'Fire', 
   [2] = 'Cold', 
   [3] = 'Shock', 
   [4] = 'Death', 
   [5] = 'Toxic', 
   [6] = 'Spirit'
   }

RawDmg = mw.getCurrentFrame().args[1] function p.Min()

   RawDmgs = mw.text.split(RawDmg,',',true)
   return RawDmgs[1]

end

function p.Max()

   RawDmgs = mw.text.split(RawDmg,',',true)
   return RawDmgs[2]

end

function p.Speed()

   RawDmgs = mw.text.split(RawDmg,',',true)
   return RawDmgs[6]

end

function p.Crit()

   RawDmgs = mw.text.split(RawDmg,',',true)
   return RawDmgs[7]

end

function p.Elen()

   RawDmgs = mw.text.split(RawDmg,',',true)
   return RawDmgs[4]

end

function p.EleDisp()

   RawDmgs = mw.text.split(RawDmg,',',true)
   if (RawDmgs[4] == 0) then
       return 
   end
   txtout = string.format("%s %s", getimg(RawDmgs[5]), RawDmgs[4])
   return txtout

end

function p.EleChk()

   vto = mw.getCurrentFrame().args[2]
   vval = mw.getCurrentFrame().args[3]
   gtles = mw.getCurrentFrame().args[4]
   RawDmgs = mw.text.split(RawDmg,',',true)
   if (vval == nil) then
       vval = 0
   end
   isele = 0
   vnum = RawDmgs[resnm[vto]]
   if (tonumber(vnum) > tonumber(vval)) then
       isele = 1
   end
   return isele

end

function p.FullDisp(RawDmg)

   RawDmgs = mw.text.split(RawDmg,',',true)
   txtout = string.format('%s %s', getimg(RawDmgs[3]), RawDmgs[1])
   if (tonumber(RawDmgs[2]) > 0) then
       txtout = string.format('%s-%s', txtout, RawDmgs[2])
   end
   if (tonumber(RawDmgs[4]) > 0) then
       txtout = string.format('%s +%s%s', txtout, getimg(RawDmgs[5]), RawDmgs[4])
   end
   return txtout

end

function getimg(elemn)

   txtrtn = 
   if (tonumber(elemn) == 0) then
       txtrtn = 'Sword.png'
   else
       txtrtn = string.format('File:%s.png', resnm[tonumber(elemn)], resnm[tonumber(elemn)])
   end
   return txtrtn

end

function DPS(RawDmg)

   RawDmgs = mw.text.split(RawDmg,',',true)
   

end


return p