Advertisement
Skymagnum

Untitled

May 18th, 2013
452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.53 KB | None | 0 0
  1. function getHand(player)
  2.  
  3. local _ALLOWEDS = {} -- example {2723, 8329, 8921}
  4. local slotRight = getPlayerSlotItem(player, 5)
  5. local slotLeft = getPlayerSlotItem(player, 6)
  6.  
  7.     if isInArray(_ALLOWEDS, slotRight.itemid) then
  8.         return "right"
  9.     elseif isInArray(_ALLOWEDS, slotLeft.itemid) then
  10.        return "left"
  11.     end
  12.  
  13.     return nil
  14. end
  15.  
  16. function getWandDmg(itemId)
  17.  
  18. local file = io.open("data/weapons/weapons.xml", "r")
  19.    
  20.     for info in string.gmatch(file:read("*a"), "<weapons(.-)</weapons>") do
  21.         if info:match("wand id=\"(.-)\"") == itemId then
  22.             local min = info:match("min=(.-)")
  23.             local max = info:match("max=(.-)")
  24.             return math.random(min, max)
  25.         end
  26.     end
  27.    
  28.     file:close()
  29.     return nil
  30. end
  31.  
  32. function getWandDmgType(itemId)
  33.  
  34. local file = io.open("data/weapons/weapons.xml", "r")
  35.    
  36.     for info in string.gmatch(file:read("*a"), "<weapons(.-)</weapons>") do
  37.         if info:match("wand id=\"(.-)\"") == itemId then
  38.             local type = info:match("type=(.-)")
  39.             return tostring(type)
  40.         end
  41.     end
  42.    
  43.     file:close()
  44.     return nil
  45. end
  46.  
  47. function setWandExtraDmg(wand, extra)
  48.  
  49.     local value = tonumber(getWandExtraDmg(wand))
  50.  
  51.     return doSetItemAttribute(wand.uid, "extraDmg", value + extra)
  52. end
  53.  
  54. function getWandExtraDmg(wand)
  55.  
  56.     if getItemAttribute(wand.uid, "extraDmg") == nil then
  57.         doSetItemAttribute(wand.uid, "extraDmg", 0)
  58.     end
  59.  
  60.     return getItemAttribute(wand.uid, "extraDmg")
  61. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement