Mercurial > wow > wowdb-profiler
comparison Main.lua @ 497:c8a8231c2336
Updated ParseGUID to handle all of the different GUID types properly (except Pet, which we ignore on purpose).
author | MMOSimca <mmosimca@gmail.com> |
---|---|
date | Thu, 13 Oct 2016 10:18:31 -0400 |
parents | 3938b87cfcd3 |
children | b177416f7888 |
comparison
equal
deleted
inserted
replaced
496:3938b87cfcd3 | 497:c8a8231c2336 |
---|---|
559 if not guid then | 559 if not guid then |
560 return | 560 return |
561 end | 561 end |
562 | 562 |
563 -- We might want to use some of this new information later, but leaving the returns alone for now | 563 -- We might want to use some of this new information later, but leaving the returns alone for now |
564 local unit_type_name, unk_id1, server_id, instance_id, unk_id2, unit_idnum, spawn_id = ("-"):split(guid) | 564 local guid_pieces = { ("-"):split(guid) } |
565 local unit_type_name, unk_field, server_id, instance_id, zone_uid, unit_id, spawn_uid, player_uid = guid_pieces[1] | |
565 | 566 |
566 local unit_type = MatchUnitTypes(unit_type_name) | 567 local unit_type = MatchUnitTypes(unit_type_name) |
568 | |
569 -- Creatures, GameObjects, Vehicles, and Vignettes | |
567 if unit_type ~= UNIT_TYPES.PLAYER and unit_type ~= UNIT_TYPES.PET and unit_type ~= UNIT_TYPES.ITEM then | 570 if unit_type ~= UNIT_TYPES.PLAYER and unit_type ~= UNIT_TYPES.PET and unit_type ~= UNIT_TYPES.ITEM then |
568 | 571 unk_field, server_id, instance_id, zone_uid, unit_id, spawn_uid = guid_pieces[2], guid_pieces[3], guid_pieces[4], guid_pieces[5], guid_pieces[6], guid_pieces[7] |
569 local id_mapping = NPC_ID_MAPPING[unit_idnum] | 572 |
573 local id_mapping = NPC_ID_MAPPING[unit_id] | |
570 | 574 |
571 if id_mapping and UnitTypeIsNPC(unit_type) then | 575 if id_mapping and UnitTypeIsNPC(unit_type) then |
572 unit_idnum = id_mapping | 576 unit_id = id_mapping |
573 end | 577 end |
574 return unit_type, unit_idnum | 578 |
575 end | 579 -- Players |
576 return unit_type | 580 elseif unit_type == UNIT_TYPES.PLAYER then |
581 server_id, player_uid = guid_pieces[2], guid_pieces[3] | |
582 | |
583 -- Items | |
584 elseif unit_type == UNIT_TYPES.ITEM then | |
585 server_id, unk_field, spawn_uid = guid_pieces[2], guid_pieces[3], guid_pieces[4] | |
586 end | |
587 | |
588 -- Pets and other (i.e. do nothing) | |
589 return unit_type, unit_id | |
577 end | 590 end |
578 | 591 |
579 private.ParseGUID = ParseGUID | 592 private.ParseGUID = ParseGUID |
580 end -- do-block | 593 end -- do-block |
581 | 594 |