comparison Main.lua @ 159:75cf16f95ad0 1.0.17

Hard-code NPC IDs for Sha of Anger and Galleon to see if they're simply not being recognized as NPCs.
author James D. Callahan III <jcallahan@curse.com>
date Fri, 05 Oct 2012 22:31:14 -0500
parents d16d4848f059
children 7c01f8f3b709
comparison
equal deleted inserted replaced
158:ff86944a6bda 159:75cf16f95ad0
163 return 163 return
164 end 164 end
165 _G.print(...) 165 _G.print(...)
166 end 166 end
167 167
168 local SHA_OF_ANGER_ID = 60491
169 local GALLEON_ID = 62346
170
171 local function IsHardCodedNPC(unit_id)
172 return unit_id == SHA_OF_ANGER_ID or unit_id == GALLEON_ID
173 end
174
168 175
169 local ActualCopperCost 176 local ActualCopperCost
170 do 177 do
171 local BARTERING_SPELL_ID = 83964 178 local BARTERING_SPELL_ID = 83964
172 179
682 local func = EVENT_MAPPING[event_name] 689 local func = EVENT_MAPPING[event_name]
683 690
684 if _G.type(func) == "boolean" then 691 if _G.type(func) == "boolean" then
685 self[event_name](self, ...) 692 self[event_name](self, ...)
686 elseif _G.type(func) == "function" then 693 elseif _G.type(func) == "function" then
687 self[EVENT_MAPPING[event_name]](self, ...) 694 self[func](self, ...)
688 end 695 end
689 end 696 end
690 697
691 698
692 function WDP:OnEnable() 699 function WDP:OnEnable()
797 current_target_id = nil 804 current_target_id = nil
798 return 805 return
799 end 806 end
800 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("target")) 807 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("target"))
801 808
802 if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then 809 if not unit_idnum or (unit_type ~= private.UNIT_TYPES.NPC and not IsHardCodedNPC(unit_idnum)) then
803 return 810 return
804 end 811 end
805 current_target_id = unit_idnum 812 current_target_id = unit_idnum
806 813
807 local npc = NPCEntry(unit_idnum) 814 local npc = NPCEntry(unit_idnum)
984 if not spell_id then 991 if not spell_id then
985 return 992 return
986 end 993 end
987 local source_type, source_id = ParseGUID(source_guid) 994 local source_type, source_id = ParseGUID(source_guid)
988 995
989 if not source_id or source_type ~= private.UNIT_TYPES.NPC then 996 if not source_id or (source_type ~= private.UNIT_TYPES.NPC and not IsHardCodedNPC(source_id)) then
990 return 997 return
991 end 998 end
992 999
993 if bit.band(FLAGS_NPC_CONTROL, source_flags) == FLAGS_NPC_CONTROL and bit.band(FLAGS_NPC, source_flags) ~= 0 then 1000 if bit.band(FLAGS_NPC_CONTROL, source_flags) == FLAGS_NPC_CONTROL and bit.band(FLAGS_NPC, source_flags) ~= 0 then
994 local encounter_data = NPCEntry(source_id).encounter_data[InstanceDifficultyToken()] 1001 local encounter_data = NPCEntry(source_id).encounter_data[InstanceDifficultyToken()]