changeset 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 7fabca4270d5
files Main.lua
diffstat 1 files changed, 19 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Main.lua	Tue Oct 11 06:13:22 2016 -0400
+++ b/Main.lua	Thu Oct 13 10:18:31 2016 -0400
@@ -561,19 +561,32 @@
         end
 
         -- We might want to use some of this new information later, but leaving the returns alone for now
-        local unit_type_name, unk_id1, server_id, instance_id, unk_id2, unit_idnum, spawn_id = ("-"):split(guid)
+        local guid_pieces = { ("-"):split(guid) }
+        local unit_type_name, unk_field, server_id, instance_id, zone_uid, unit_id, spawn_uid, player_uid = guid_pieces[1]
 
         local unit_type = MatchUnitTypes(unit_type_name)
+        
+        -- Creatures, GameObjects, Vehicles, and Vignettes
         if unit_type ~= UNIT_TYPES.PLAYER and unit_type ~= UNIT_TYPES.PET and unit_type ~= UNIT_TYPES.ITEM then
-
-            local id_mapping = NPC_ID_MAPPING[unit_idnum]
+            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]
+
+            local id_mapping = NPC_ID_MAPPING[unit_id]
 
             if id_mapping and UnitTypeIsNPC(unit_type) then
-                unit_idnum = id_mapping
+                unit_id = id_mapping
             end
-            return unit_type, unit_idnum
+
+        -- Players
+        elseif unit_type == UNIT_TYPES.PLAYER then
+            server_id, player_uid = guid_pieces[2], guid_pieces[3]
+
+        -- Items
+        elseif unit_type == UNIT_TYPES.ITEM then
+            server_id, unk_field, spawn_uid = guid_pieces[2], guid_pieces[3], guid_pieces[4]
         end
-        return unit_type
+        
+        -- Pets and other (i.e. do nothing)
+        return unit_type, unit_id
     end
 
     private.ParseGUID = ParseGUID