comparison Main.lua @ 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 e1566483082c
children 69ed3a28c7e6
comparison
equal deleted inserted replaced
280:5ccdd6498c16 281:495108578530
390 local ParseGUID 390 local ParseGUID
391 do 391 do
392 local UNIT_TYPES = private.UNIT_TYPES 392 local UNIT_TYPES = private.UNIT_TYPES
393 local UNIT_TYPE_BITMASK = 0x007 393 local UNIT_TYPE_BITMASK = 0x007
394 394
395 local NPC_ID_MAPPING = {
396 [62164] = 63191, -- Garalon
397 }
398
399
395 function ParseGUID(guid) 400 function ParseGUID(guid)
396 if not guid then 401 if not guid then
397 return 402 return
398 end 403 end
399 local bitfield = tonumber(guid:sub(1, 5)) 404 local bitfield = tonumber(guid:sub(1, 5))
402 return UNIT_TYPES.UNKNOWN 407 return UNIT_TYPES.UNKNOWN
403 end 408 end
404 local unit_type = _G.bit.band(bitfield, UNIT_TYPE_BITMASK) 409 local unit_type = _G.bit.band(bitfield, UNIT_TYPE_BITMASK)
405 410
406 if unit_type ~= UNIT_TYPES.PLAYER and unit_type ~= UNIT_TYPES.PET then 411 if unit_type ~= UNIT_TYPES.PLAYER and unit_type ~= UNIT_TYPES.PET then
407 return unit_type, tonumber(guid:sub(6, 10), 16) 412 local unit_idnum = tonumber(guid:sub(6, 10), 16)
413 local id_mapping = NPC_ID_MAPPING[unit_idnum]
414
415 if id_mapping and UnitTypeIsNPC(unit_type) then
416 unit_idnum = id_mapping
417 end
418 return unit_type, unit_idnum
408 end 419 end
409 return unit_type 420 return unit_type
410 end 421 end
411 422
412 private.ParseGUID = ParseGUID 423 private.ParseGUID = ParseGUID