Exemplo n.º 1
0
 private void RightClickQuestgiver(WowObject obj)
 {
     if (obj.GetType() == typeof(WowGameobject))
     {
         WowInterface.HookManager.WowObjectRightClick(obj);
     }
     else if (obj.GetType() == typeof(WowUnit))
     {
         WowInterface.HookManager.WowUnitRightClick((WowUnit)obj);
     }
 }
Exemplo n.º 2
0
        public WowObject ProcessObject(IntPtr ptr)
        {
            if (WowInterface.XMemory.Read(IntPtr.Add(ptr, WowInterface.OffsetList.WowObjectType.ToInt32()), out WowObjectType type) &&
                WowInterface.XMemory.Read(IntPtr.Add(ptr, WowInterface.OffsetList.WowObjectDescriptor.ToInt32()), out IntPtr descriptorAddress))
            {
                WowObject obj = type switch
                {
                    WowObjectType.Container => new WowContainer(ptr, type, descriptorAddress),
                    WowObjectType.Corpse => new WowCorpse(ptr, type, descriptorAddress),
                    WowObjectType.Item => new WowItem(ptr, type, descriptorAddress),
                    WowObjectType.Dynobject => new WowDynobject(ptr, type, descriptorAddress),
                    WowObjectType.Gameobject => new WowGameobject(ptr, type, descriptorAddress),
                    WowObjectType.Player => new WowPlayer(ptr, type, descriptorAddress),
                    WowObjectType.Unit => new WowUnit(ptr, type, descriptorAddress),
                    _ => new WowObject(ptr, type, descriptorAddress),
                };

                obj.Update();

                if (obj != null && (type == WowObjectType.Unit || type == WowObjectType.Player))
                {
                    if (obj.Guid == PlayerGuid)
                    {
                        PlayerGuidIsVehicle = obj.GetType() != typeof(WowPlayer);

                        if (!PlayerGuidIsVehicle)
                        {
                            if (WowInterface.XMemory.Read(WowInterface.OffsetList.ComboPoints, out byte comboPoints))
                            {
                                ((WowPlayer)obj).ComboPoints = comboPoints;
                            }

                            Player  = (WowPlayer)obj;
                            Vehicle = null;
                        }
                        else
                        {
                            Vehicle = (WowUnit)obj;
                        }
                    }

                    if (obj.Guid == TargetGuid)
                    {
                        Target = (WowUnit)obj;
                    }
                    if (obj.Guid == PetGuid)
                    {
                        Pet = (WowUnit)obj;
                    }
                    if (obj.Guid == LastTargetGuid)
                    {
                        LastTarget = (WowUnit)obj;
                    }
                    if (obj.Guid == PartyleaderGuid)
                    {
                        Partyleader = (WowUnit)obj;
                    }
                }

                return(obj);
            }

            return(null);
        }