aggixx

Untitled

Jan 23rd, 2013
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.60 KB | None | 0 0
  1. function events:LOOT_OPENED(...)
  2.     if addonEnabled() then
  3.         local loot = {} -- create a temporary table to organize the loot on the mob
  4.         for i=1,GetNumLootItems() do -- loop through all items in the window
  5.             local sourceInfo = {GetLootSourceInfo(i)}
  6.             for j=1,#sourceInfo/2 do
  7.                 local mobID = sourceInfo[j*2-1] -- retrieve GUID of the mob that holds the item
  8.                 for k=1,#hasBeenLooted do
  9.                     if hasBeenLooted[i] == mobID then
  10.                         mobID = nil
  11.                         break
  12.                     end
  13.                 end
  14.                 if mobID then
  15.                     if debugOn then
  16.                         DevTools_Dump(loot)
  17.                         DevTools_Dump(#loot)
  18.                     end
  19.                     local id
  20.                     for k=1,#loot do
  21.                         if loot[i][1] == mobID then -- line 1388
  22.                             id = i
  23.                             break
  24.                         end
  25.                     end
  26.                     if not id then
  27.                         table.insert(loot, {mobID}) -- create an entry in table for the mobID
  28.                         id = #loot
  29.                     end
  30.                    
  31.                     local link = GetLootSlotLink(i) -- retrieve link of item
  32.                     if link and checkFilters(link) then
  33.                         for l=1,sourceInfo[j*2] do -- repeat the insert if there is multiple of the item in that slot
  34.                             table.insert(loot[id], link)
  35.                         end
  36.                     end
  37.                 end
  38.             end
  39.         end
  40.        
  41.         for i=1,#loot do
  42.             FARaidTools:sendMessage("FA_RTreport", {addonVersion, loot[i]}, "RAID", nil, "BULK") -- send addon message to tell others to add this to their window
  43.  
  44.             local data = loot[i]
  45.             local mobID = table.remove(data, 1)
  46.            
  47.             for j=1, #data do
  48.                 if checkFilters(data[j]) then
  49.                     FARaidTools:cacheItem(data[j])
  50.                 end
  51.             end
  52.            
  53.             table.insert(hasBeenLooted, mobID)
  54.         end
  55.     end
  56. end
  57.  
  58. -- Example DevTools_Dump() output
  59. [10:59:18 PM] [1]={
  60. [10:59:18 PM]   [1]="0xF150F604000088E0",
  61. [10:59:18 PM]   [2]="|cffa335ee|Hitem:86203:0:0:0:0:0:0:12:1295524864:90:0:445|h[Articulated Legplates]|h|r"
  62. [10:59:18 PM] } -- DevTools_Dump(loot)
  63. [10:59:18 PM] 1 -- DevTools_Dump(#loot)
  64. -- Error
  65. Message: Interface\AddOns\FARaidTools\main.lua:1388: attempt to index field '?' (a nil value)
  66. Time: 01/23/13 00:02:21
  67. Count: 2
  68. Stack: [string "*:OnLoad"]:6: in function <[string "*:OnLoad"]:1>
  69. Interface\AddOns\Auctionator\AtrErrorInspector.lua:106: in function <Interface\AddOns\Auctionator\AtrErrorInspector.lua:51>
  70. [C]: ?
  71. Interface\AddOns\FARaidTools\main.lua:1388: in function `?'
  72. Interface\AddOns\FARaidTools\main.lua:1450: in function <Interface\AddOns\FARaidTools\main.lua:1449>
  73.  
  74. Locals: msg = nil
  75. self = <unnamed> {
  76. 0 = <userdata>
  77. origErrorHandler = <function> defined Interface\FrameXML\BasicControls.xml:<Scripts>:4
  78. errorHandler = <function> defined @Interface\AddOns\TradeSkillMaster\Util\ErrorHandler.lua:215
  79. handler = <function> defined *:OnLoad:1
  80. }
Advertisement
Add Comment
Please, Sign In to add comment