Advertisement
Cavitt

Untitled

Feb 14th, 2012
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | None | 0 0
  1. Self.GetStorage = function()
  2.     local temp = {}
  3.     local slots = {Self.Head, Self.Armor, Self.Legs, Self.Feet, Self.Amulet, Self.Weapon, Self.Ring, Self.Shield, Self.Ammo}
  4.     for i = 1, #slots do -- count slots
  5.         local slot = slots[i]()
  6.         if(slot.id > 0)then
  7.             if not(temp[slot.id])then
  8.                 temp[slot.id] = 0
  9.             end
  10.             temp[slot.id] = temp[slot.id] + math.max((slot.count), 1)
  11.         end
  12.     end
  13.    
  14.     local cont = Container.GetFirst()
  15.     while (cont:isOpen()) do
  16.         for spot = 0, cont:ItemCount() - 1 do -- loop through all the items in loot backpack
  17.             local item = cont:GetItemData(spot)
  18.             if not(temp[item.id])then
  19.                 temp[item.id] = 0
  20.             end
  21.             temp[item.id] = temp[item.id] + math.max((item.count), 1)
  22.         end
  23.         cont = cont:GetNext()
  24.     end
  25.  
  26.     return temp
  27. end
  28.  
  29. print(table.serialize(Self.GetStorage()))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement