changeset 281:495108578530

Added an NPC ID mapping table for the rare oddities such as Garalon (two different IDs, one used exclusively for LFR).
author James D. Callahan III <jcallahan@curse.com>
date Mon, 01 Apr 2013 11:14:15 -0500
parents 5ccdd6498c16
children 69ed3a28c7e6
files Main.lua
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Main.lua	Mon Apr 01 10:30:14 2013 -0500
+++ b/Main.lua	Mon Apr 01 11:14:15 2013 -0500
@@ -392,6 +392,11 @@
     local UNIT_TYPES = private.UNIT_TYPES
     local UNIT_TYPE_BITMASK = 0x007
 
+    local NPC_ID_MAPPING = {
+        [62164] = 63191, -- Garalon
+    }
+
+
     function ParseGUID(guid)
         if not guid then
             return
@@ -404,7 +409,13 @@
         local unit_type = _G.bit.band(bitfield, UNIT_TYPE_BITMASK)
 
         if unit_type ~= UNIT_TYPES.PLAYER and unit_type ~= UNIT_TYPES.PET then
-            return unit_type, tonumber(guid:sub(6, 10), 16)
+            local unit_idnum = tonumber(guid:sub(6, 10), 16)
+            local id_mapping = NPC_ID_MAPPING[unit_idnum]
+
+            if id_mapping and UnitTypeIsNPC(unit_type) then
+                unit_idnum = id_mapping
+            end
+            return unit_type, unit_idnum
         end
         return unit_type
     end