Mercurial > wow > wowdb-profiler
comparison Main.lua @ 15:62b0fb4281cd
Minor logic cleanup. Don't favor dead NPCs - we want to record pick-pocket attempts. Make sure the NPC is not nil before attempting logic for loot.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Thu, 03 May 2012 11:20:44 -0500 |
parents | 27c153c3a1ed |
children | 9f314ea42267 |
comparison
equal
deleted
inserted
replaced
14:27c153c3a1ed | 15:62b0fb4281cd |
---|---|
275 end | 275 end |
276 | 276 |
277 | 277 |
278 local LOOT_VERIFY_FUNCS = { | 278 local LOOT_VERIFY_FUNCS = { |
279 [AF.NPC] = function() | 279 [AF.NPC] = function() |
280 local fishing_loot = _G.IsFishingLoot() | 280 if _G.IsFishingLoot() or not _G.UnitExists("target") or _G.UnitIsFriend("player", "target") or _G.UnitIsPlayer("target") or _G.UnitPlayerControlled("target") then |
281 | 281 return false |
282 if not fishing_loot and _G.UnitExists("target") and not _G.UnitIsFriend("player", "target") and _G.UnitIsDead("target") then | 282 end |
283 if _G.UnitIsPlayer("target") or _G.UnitPlayerControlled("target") then | 283 local unit_type, id_num = WDP:ParseGUID(_G.UnitGUID("target")) |
284 return false | 284 action_data.id_num = id_num |
285 end | |
286 local unit_type, id_num = WDP:ParseGUID(_G.UnitGUID("target")) | |
287 action_data.id_num = id_num | |
288 end | |
289 return true | 285 return true |
290 end, | 286 end, |
291 [AF.OBJECT] = true, | 287 [AF.OBJECT] = true, |
292 } | 288 } |
293 | 289 |
294 | 290 |
295 local LOOT_UPDATE_FUNCS = { | 291 local LOOT_UPDATE_FUNCS = { |
296 [AF.NPC] = function() | 292 [AF.NPC] = function() |
297 local npc = UnitEntry("npcs", action_data.id_num) | 293 local npc = UnitEntry("npcs", action_data.id_num) |
294 | |
295 if not npc then | |
296 return | |
297 end | |
298 local loot_type = action_data.loot_type or "drops" | 298 local loot_type = action_data.loot_type or "drops" |
299 npc[loot_type] = npc[loot_type] or {} | 299 npc[loot_type] = npc[loot_type] or {} |
300 | 300 |
301 for index = 1, #action_data.drops do | 301 for index = 1, #action_data.drops do |
302 table.insert(npc[loot_type], action_data.drops[index]) | 302 table.insert(npc[loot_type], action_data.drops[index]) |