comparison Main.lua @ 162:ef88920c634b 1.0.18

Removed hard-coded NPC IDs.
author James D. Callahan III <jcallahan@curse.com>
date Sun, 07 Oct 2012 01:31:04 -0500
parents 7c01f8f3b709
children b5ced741f9e6
comparison
equal deleted inserted replaced
161:7c01f8f3b709 162:ef88920c634b
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
175 168
176 local ActualCopperCost 169 local ActualCopperCost
177 do 170 do
178 local BARTERING_SPELL_ID = 83964 171 local BARTERING_SPELL_ID = 83964
179 172
801 current_target_id = nil 794 current_target_id = nil
802 return 795 return
803 end 796 end
804 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("target")) 797 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("target"))
805 798
806 if not unit_idnum or (unit_type ~= private.UNIT_TYPES.NPC and not IsHardCodedNPC(unit_idnum)) then 799 if not unit_idnum or unit_type ~= private.UNIT_TYPES.NPC then
807 return 800 return
808 end 801 end
809 current_target_id = unit_idnum 802 current_target_id = unit_idnum
810 803
811 local npc = NPCEntry(unit_idnum) 804 local npc = NPCEntry(unit_idnum)
988 if not spell_id then 981 if not spell_id then
989 return 982 return
990 end 983 end
991 local source_type, source_id = ParseGUID(source_guid) 984 local source_type, source_id = ParseGUID(source_guid)
992 985
993 if not source_id or (source_type ~= private.UNIT_TYPES.NPC and not IsHardCodedNPC(source_id)) then 986 if not source_id or source_type ~= private.UNIT_TYPES.NPC then
994 return 987 return
995 end 988 end
996 989
997 if bit.band(FLAGS_NPC_CONTROL, source_flags) == FLAGS_NPC_CONTROL and bit.band(FLAGS_NPC, source_flags) ~= 0 then 990 if bit.band(FLAGS_NPC_CONTROL, source_flags) == FLAGS_NPC_CONTROL and bit.band(FLAGS_NPC, source_flags) ~= 0 then
998 local encounter_data = NPCEntry(source_id).encounter_data[InstanceDifficultyToken()] 991 local encounter_data = NPCEntry(source_id).encounter_data[InstanceDifficultyToken()]