# HG changeset patch # User James D. Callahan III # Date 1336062044 18000 # Node ID 62b0fb4281cd9e18811c28ac7532e728f7f46670 # Parent 27c153c3a1ed36703775d386b740a8ec734a28fd 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. diff -r 27c153c3a1ed -r 62b0fb4281cd Main.lua --- a/Main.lua Thu May 03 10:43:18 2012 -0500 +++ b/Main.lua Thu May 03 11:20:44 2012 -0500 @@ -277,15 +277,11 @@ local LOOT_VERIFY_FUNCS = { [AF.NPC] = function() - local fishing_loot = _G.IsFishingLoot() - - if not fishing_loot and _G.UnitExists("target") and not _G.UnitIsFriend("player", "target") and _G.UnitIsDead("target") then - if _G.UnitIsPlayer("target") or _G.UnitPlayerControlled("target") then - return false - end - local unit_type, id_num = WDP:ParseGUID(_G.UnitGUID("target")) - action_data.id_num = id_num + if _G.IsFishingLoot() or not _G.UnitExists("target") or _G.UnitIsFriend("player", "target") or _G.UnitIsPlayer("target") or _G.UnitPlayerControlled("target") then + return false end + local unit_type, id_num = WDP:ParseGUID(_G.UnitGUID("target")) + action_data.id_num = id_num return true end, [AF.OBJECT] = true, @@ -295,6 +291,10 @@ local LOOT_UPDATE_FUNCS = { [AF.NPC] = function() local npc = UnitEntry("npcs", action_data.id_num) + + if not npc then + return + end local loot_type = action_data.loot_type or "drops" npc[loot_type] = npc[loot_type] or {}