Module:Misc

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

--[[ Module for Miscellaneous smaller functions ]] p = {}

Arg1 = mw.getCurrentFrame().args[1] Arg2 = mw.getCurrentFrame().args[2] Arg3 = mw.getCurrentFrame().args[3] Arg4 = mw.getCurrentFrame().args[4]

function p.Rarity()

   rarities = {Unique = 'Red',
       Uncommon = 'Violet',
       Limited = 'rgb(220,0,0)',
       Crafted = 'DeepSkyBlue',
       Common = 'Lime'}
   longtxt = 
   if rarities[Arg1] == nil then
       Arg1 = 'Common'
   end
   spantag = mw.html.create( 'span' )
   spantag:css('color', rarities[Arg1])
   spantag:wikitext(Arg1)
   spantag = spantag:allDone()
   shorttxt = spantag
   if (Arg2 ~= nil and Arg2 ~= ) then
       if Arg1 == 'Unique' then
           longtxt = string.format('This is a %s item, found only once.', spantag)
       elseif Arg1 == 'Common' then
           longtxt = string.format('This is a %s item, a frequent drop or obtainable from merchants.', spantag)
       elseif Arg1 == 'Uncommon' then
           longtxt = string.format('This is an %s item, a rare drop or obtainable from faction specific merchants.', spantag)
       elseif Arg1 == 'Limited' then
           longtxt = string.format('This is a %s item that can only be obtained a set amount of times.', spantag)
       elseif Arg1 == 'Crafted' then
           longtxt = string.format('This is a %s item, obtainable as a rare drop or by the player interacting with certain NPCs.', spantag)
       end
       return longtxt
   end
   return shorttxt

end

return p