Пример #1
0
        private void GenerathPathAsync()
        {
            float x = 0, xt;
            float y = 0, yt;
            float z = 0, zt;
            //float dist;

            Position dest = new Position();

            using (var detour = new Detour())
            {
                bool oneMove = true;
                List <MapCLI.Point> resultPath;
                var result = detour.FindPath(player.X, player.Y, player.Z,
                                             target.X, target.Y, target.Z,
                                             (int)player.MapID, out resultPath);
                //ClickToMove(resultPath[0].X, resultPath[0].Y, resultPath[0].Z);
                for (int i = 0; i < resultPath.Count; i++)
                {
                    if (oneMove)
                    {
                        ClickToMove(resultPath[i].X, resultPath[i].Y, resultPath[i].Z);
                    }
                    else
                    {
                        oneMove = false;
                    }

                    x = write.ReadFloat((uint)(player.BaseAddress + ObjectOffsets.Pos_X));
                    y = write.ReadFloat((uint)(player.BaseAddress + ObjectOffsets.Pos_Y));
                    z = write.ReadFloat((uint)(player.BaseAddress + ObjectOffsets.Pos_Z));

                    /*xt = write.ReadFloat((uint)(target.BaseAddress + ObjectOffsets.Pos_X));
                    *  yt = write.ReadFloat((uint)(target.BaseAddress + ObjectOffsets.Pos_Y));
                    *  zt = write.ReadFloat((uint)(target.BaseAddress + ObjectOffsets.Pos_Z));*/
                    player.SetPosition(x, y, z);
                    //dest.SetPosition(target.XPos, target.YPos, target.ZPos);

                    var dist = target.Direction - player.Direction;

                    /*if (dist.Length < 6f)
                     * {
                     *  new KeySim().KeyDown((int)Keys.Down);
                     *  new KeySim().KeyUp((int)Keys.Down);
                     *  break;
                     * }
                     * else*/if (x > resultPath[i].X - 0.5F && x <resultPath[i].X + 0.5F && y> resultPath[i].Y - 0.5f && y < resultPath[i].Y + 0.5f)
                    {
                        ClickToMove(resultPath[i].X, resultPath[i].Y, resultPath[i].Z);
                    }
                    else
                    {
                        i--;
                    }

                    //Thread.Sleep(100);
                }
            }
        }
Пример #2
0
 private void getcoordmousse(MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         MouseX              = Memory.ReadFloat(0xb0d558);
         MouseZ              = Memory.ReadFloat(0xB0d560);
         MouseY              = Memory.ReadFloat(0xB0d55C);
         MxBots.Hook.cliked -= new MxBots.Hook.MouseTransfertEvent(getcoordmousse);
         Thread bizarlethread = new Thread(new ThreadStart(this.bizzarerie));
         bizarlethread.Start();
     }
     else if (e.Button == MouseButtons.Right)
     {
         Memory.WriteInt(TrucVert1, 0);
         Thread.Sleep(20);
         Memory.WriteInt(TrucVert2, 0);
         MxBots.Hook.cliked -= new MxBots.Hook.MouseTransfertEvent(getcoordmousse);
     }
 }
Пример #3
0
        /// <summary>
        /// Get our active Corpse position
        /// </summary>
        /// <returns>corpse position</returns>
        public static Vector3 GetCorpsePosition()
        {
            Vector3 corpsePosition = new Vector3
                                     (
                BlackMagic.ReadFloat(Offsets.corpseX),
                BlackMagic.ReadFloat(Offsets.corpseY),
                BlackMagic.ReadFloat(Offsets.corpseZ)
                                     );

            AmeisenLogger.Instance.Log(LogLevel.VERBOSE, $"Getting Corpse Position [{corpsePosition.X},{corpsePosition.Y},{corpsePosition.Z}]", "AmeisenCore");
            return(corpsePosition);
        }
Пример #4
0
        public bool WalkToPoint(float targetX, float targetY, float targetZ, bool value, float currentX, float currentY, float currentZ)
        {
            float bodyx = magic.ReadFloat((uint)TbcOffsets.General.PlayerCorpseX);
            float bodyy = 0;
            float bodyz = 0;

            dead = false;
            if (bodyx != 0)
            {
                bodyy = magic.ReadFloat((uint)TbcOffsets.General.PlayerCorpseY);
                bodyz = magic.ReadFloat((uint)TbcOffsets.General.PlayerCorpseZ);
                dead  = true;
            }

            float startingX = currentX;
            float startingY = currentY;
            float startingZ = currentZ;
            bool  inCombat  = value;
            float dX        = targetX - startingX;
            float dY        = targetY - startingY;
            float dZ        = targetZ - startingZ;
            float rotation  = (float)Math.Atan2(targetY - startingY, targetX - startingX);

            if (rotation < 0)
            {
                rotation = rotation + (2f * (float)Math.PI);
            }
            float myRotation = magic.ReadFloat((uint)TbcOffsets.General.PlayerRotation);

            myRotation = float.Parse(myRotation.ToString("0.0"));
            rotation   = float.Parse(rotation.ToString("0.0"));
            float angle1;
            float angle2;
            float distance = (float)Math.Sqrt(dX * dX + dY * dY + dZ * dZ);

            while ((distance > 3f && distance <= 100f) && !halt)
            {
                if ((!settings.IgnoreMobs || !settings.IgnorePlayers) && (!inCombat || magic.ReadUInt(magic.ReadUInt((uint)TbcOffsets.General.PlayerBase) + (uint)TbcOffsets.General.CombatStateOffset) == (int)TbcOffsets.CombatState.InCombat && magic.ReadUInt64((uint)TbcOffsets.General.TargetGuid) != 0))
                {
                    if (inCombat)
                    {
                        inCombat = bot.GetCombat.CombatMode();
                    }
                    else
                    {
                        inCombat = bot.GetCombat.CombatMode();
                        if (inCombat)
                        {
                            return(true);
                        }
                    }
                }
                int playerHealth = objectManager.GetPlayer().Health;
                if (playerHealth <= 0 && profile.IsGhostSet)
                {
                    bot.GetOther.ReleaseScript();
                    dead = true;
                    Thread.Sleep(1000);
                    return(true);
                }
                else if (playerHealth <= 0 && !profile.IsGhostSet)
                {
                    bot.Halt();
                }

                if (dead)
                {
                    float gX = bodyx - startingX;
                    float gY = bodyy - startingY;
                    float gZ = bodyz - startingZ;
                    if ((float)Math.Sqrt(gX * gX + gY * gY + gZ * gZ) < 30)
                    {
                        keyboardSim.KeyUp(walk);
                        keyboardSim.KeyUp(turnleft);
                        keyboardSim.KeyUp(turnright);
                        while (magic.ReadFloat((uint)TbcOffsets.General.PlayerCorpseX) != 0)
                        {
                            bot.GetOther.RetrieveScript();
                        }

                        bot.GetOther.Rebuff();
                        dead = false;
                        break;
                    }
                }
                if (!profile.IgnoreZ && startingZ > targetZ)
                {
                    if (startingZ - targetZ > 0.3f)
                    {
                        keyboardSim.KeyDown(godown);
                    }
                    else
                    {
                        keyboardSim.KeyUp(godown);
                    }
                }
                else if (!profile.IgnoreZ && startingZ < targetZ)
                {
                    if (targetZ - startingZ > 0.3f)
                    {
                        keyboardSim.KeyDown(goup);
                    }
                    else
                    {
                        keyboardSim.KeyUp(goup);
                    }
                }

                if (myRotation != rotation)
                {
                    if (myRotation >= rotation)
                    {
                        angle1 = myRotation - rotation;
                        angle2 = rotation + (2 * (float)Math.PI - myRotation);
                        if (angle1 < angle2)
                        {
                            if (angle1 > 0.3)
                            {
                                keyboardSim.KeyDown(turnright);
                                keyboardSim.KeyUp(turnleft);
                            }
                            else
                            {
                                keyboardSim.KeyUp(turnleft);
                                keyboardSim.KeyUp(turnright);
                            }

                            if (angle1 < Math.PI / 2 && distance > 3)
                            {
                                keyboardSim.KeyDown(walk);
                            }
                        }
                        else
                        {
                            if (angle2 > 0.3)
                            {
                                keyboardSim.KeyDown(turnleft);
                                keyboardSim.KeyUp(turnright);
                            }
                            else
                            {
                                keyboardSim.KeyUp(turnleft);
                                keyboardSim.KeyUp(turnright);
                            }

                            if (angle2 < Math.PI / 2 && distance > 3)
                            {
                                keyboardSim.KeyDown(walk);
                            }
                        }
                    }
                    else if (myRotation < rotation)
                    {
                        angle1 = rotation - myRotation;
                        angle2 = myRotation + (2 * (float)Math.PI - rotation);
                        if (angle1 < angle2)
                        {
                            if (angle1 > 0.3)
                            {
                                keyboardSim.KeyDown(turnleft);
                                keyboardSim.KeyUp(turnright);
                            }
                            else
                            {
                                keyboardSim.KeyUp(turnleft);
                                keyboardSim.KeyUp(turnright);
                            }

                            if (angle1 < Math.PI / 2 && distance > 3)
                            {
                                keyboardSim.KeyDown(walk);
                            }
                        }
                        else
                        {
                            if (angle2 > 0.3)
                            {
                                keyboardSim.KeyDown(turnright);
                                keyboardSim.KeyUp(turnleft);
                            }
                            else
                            {
                                keyboardSim.KeyUp(turnleft);
                                keyboardSim.KeyUp(turnright);
                            }

                            if (angle2 < Math.PI / 2 && distance > 3)
                            {
                                keyboardSim.KeyDown(walk);
                            }
                        }
                    }
                }

                else
                {
                    keyboardSim.KeyDown(walk);
                    keyboardSim.KeyUp(turnleft);
                    keyboardSim.KeyUp(turnright);
                    Random random = new Random();
                    if (random.Next(10) == 0)
                    {
                        keyboardSim.KeyDown(goup);
                        keyboardSim.KeyUp(goup);
                    }
                }
                startingX  = magic.ReadFloat((uint)TbcOffsets.General.PlayerX);
                startingY  = magic.ReadFloat((uint)TbcOffsets.General.PlayerY);
                startingZ  = magic.ReadFloat((uint)TbcOffsets.General.PlayerZ);
                dX         = targetX - startingX;
                dY         = targetY - startingY;
                dZ         = targetZ - startingZ;
                myRotation = magic.ReadFloat((uint)TbcOffsets.General.PlayerRotation);
                rotation   = (float)Math.Atan2(targetY - startingY, targetX - startingX);
                if (rotation < 0)
                {
                    rotation = rotation + (2f * (float)Math.PI);
                }
                myRotation = float.Parse(myRotation.ToString("0.0"));
                rotation   = float.Parse(rotation.ToString("0.0"));
                float temp = distance;
                distance = (float)Math.Sqrt(dX * dX + dY * dY + dZ * dZ);
                if (temp - distance == 0)
                {
                    Antistuck();
                }
            }
            keyboardSim.KeyUp(walk);
            keyboardSim.KeyUp(turnleft);
            keyboardSim.KeyUp(turnright);
            return(false);
        }
Пример #5
0
        public void Search(float startingX, float startingY, float startingZ)
        {
            float targetX, targetY, targetZ, dX, dY, dZ, distance;

            if (settings.Mining || settings.Herbing)
            {
                objectManager.PopulateList();
                foreach (WorkWork.Memory.Object obj in objectManager.GetObjects())
                {
                    if (obj.Type == 5)
                    {
                        string name = magic.ReadASCIIString(magic.ReadUInt(magic.ReadUInt(obj.BaseAddress + (uint)TbcOffsets.ObjectOffsets.GameObjectNameOffset1) + (uint)TbcOffsets.ObjectOffsets.GameObjectNameOffset2), 40);
                        if (settings.Herbing)
                        {
                            foreach (string herb in Herbs)
                            {
                                if (name.ToLower().Contains(herb))
                                {
                                    targetX  = magic.ReadFloat(magic.ReadUInt(obj.BaseAddress + (uint)TbcOffsets.ObjectOffsets.GameObjectOffset) + (uint)TbcOffsets.ObjectOffsets.GameObjectOffsetX);
                                    targetY  = magic.ReadFloat(magic.ReadUInt(obj.BaseAddress + (uint)TbcOffsets.ObjectOffsets.GameObjectOffset) + (uint)TbcOffsets.ObjectOffsets.GameObjectOffsetY);
                                    targetZ  = magic.ReadFloat(magic.ReadUInt(obj.BaseAddress + (uint)TbcOffsets.ObjectOffsets.GameObjectOffset) + (uint)TbcOffsets.ObjectOffsets.GameObjectOffsetZ);
                                    dX       = targetX - startingX;
                                    dY       = targetY - startingY;
                                    dZ       = targetZ - startingZ;
                                    distance = (float)Math.Sqrt(dX * dX + dY * dY + dZ * dZ);
                                    if (distance <= 30)
                                    {
                                        bot.GetPathing.WalkToPoint(targetX, targetY, targetZ, true, startingX, startingY, startingZ);
                                        bot.GetOther.Interact();
                                        bot.GetPathing.WalkToPoint(startingX, startingY, startingZ, true, targetX, targetY, targetZ);
                                        return;
                                    }
                                }
                            }
                        }
                        if (settings.Mining)
                        {
                            foreach (string node in Nodes)
                            {
                                if (name.Contains(node))
                                {
                                    targetX  = magic.ReadFloat(magic.ReadUInt(obj.BaseAddress + (uint)TbcOffsets.ObjectOffsets.GameObjectOffset) + (uint)TbcOffsets.ObjectOffsets.GameObjectOffsetX);
                                    targetY  = magic.ReadFloat(magic.ReadUInt(obj.BaseAddress + (uint)TbcOffsets.ObjectOffsets.GameObjectOffset) + (uint)TbcOffsets.ObjectOffsets.GameObjectOffsetY);
                                    targetZ  = magic.ReadFloat(magic.ReadUInt(obj.BaseAddress + (uint)TbcOffsets.ObjectOffsets.GameObjectOffset) + (uint)TbcOffsets.ObjectOffsets.GameObjectOffsetZ);
                                    dX       = targetX - startingX;
                                    dY       = targetY - startingY;
                                    dZ       = targetZ - startingZ;
                                    distance = (float)Math.Sqrt(dX * dX + dY * dY + dZ * dZ);
                                    if (distance <= 30)
                                    {
                                        bot.GetPathing.WalkToPoint(targetX, targetY, targetZ, true, startingX, startingY, startingZ);
                                        bot.GetOther.Interact();
                                        bot.GetPathing.WalkToPoint(startingX, startingY, startingZ, true, targetX, targetY, targetZ);
                                        return;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #6
0
        public void DoWork()
        {
            objectManager.PopulateList();
            while (!halt)
            {
                if (pathing.Dead || magic.ReadFloat((uint)TbcOffsets.General.PlayerCorpseX) != 0)//Dead
                {
                    if (profile.IsGhostSet)
                    {
                        timesDied++;
                        statistics.Changed = true;
                        if (!FirstPoint(ghostPoints, 1))
                        {
                            endGhostPoints = FirstPoint(wayPoints, 2);
                        }
                        while (!halt && pathing.Dead)
                        {
                            if (!endGhostPoints)
                            {
                                endGhostPoints = NextPoint(ghostPoints, 1);
                            }
                            else
                            {
                                NextPoint(wayPoints, 2);
                            }
                        }
                    }
                    else
                    {
                        Halt();
                    }
                }
                else //Alive
                {
                    endGhostPoints = false;
                    if (profile.IsWaySet)
                    {
                        other.Regen();
                        if (!FirstPoint(wayPoints, 0))
                        {
                            Halt();
                        }
                        bool combat = false;
                        while (!halt && !pathing.Dead)
                        {
                            if (sell > 0 && profile.IsSellSet)
                            {
                                FirstPoint(sellPoints, 0);
                                while (sell > 0 && !pathing.Dead && !halt)
                                {
                                    NextPoint(sellPoints, 3);
                                    if (point == sellPoints.Count - 1)
                                    {
                                        other.Interact();
                                    }
                                }
                            }
                            else
                            {
                                other.Regen();
                                if (combat && !pathing.Dead && settings.Linear)
                                {
                                    NextPoint(wayPoints, 3);
                                    combat = false;
                                }
                                else if (combat && !pathing.Dead)
                                {
                                    FirstPoint(wayPoints, 0);
                                    combat = false;
                                }
                                else if (!combat && !pathing.Dead)
                                {
                                    combat = NextPoint(wayPoints, 0);
                                }
                            }
                        }
                    }

                    else
                    {
                        Halt();
                    }
                }
            }

            keyboardSim.KeyUp(walk);
            keyboardSim.KeyUp(turnleft);
            keyboardSim.KeyUp(turnright);
        }
Пример #7
0
        public Player ScanPlayer()
        {
            Player player = new Player();

            player.Guid        = LocalPlayer.Guid;
            player.BaseAddress = GetObjectBaseByGuid(LocalPlayer.Guid);

            /*player.XPos = WowReader.ReadFloat((uint)(LocalPlayer.BaseAddress + ObjectOffsets.Pos_X));
            *  player.YPos = WowReader.ReadFloat((uint)(LocalPlayer.BaseAddress + ObjectOffsets.Pos_Y));
            *  player.ZPos = WowReader.ReadFloat((uint)(LocalPlayer.BaseAddress + ObjectOffsets.Pos_Z));*/
            player.Rotation          = WowReader.ReadFloat((uint)(player.BaseAddress + ObjectOffsets.Rot));
            player.UnitFieldsAddress = WowReader.ReadUInt((uint)(player.BaseAddress + ObjectOffsets.UnitFields));
            player.CurrentHealth     = WowReader.ReadUInt((uint)(player.UnitFieldsAddress + UnitOffsets.Health));
            player.CurrentEnergy     = WowReader.ReadUInt((uint)(player.UnitFieldsAddress + UnitOffsets.Energy));
            player.MaxHealth         = WowReader.ReadUInt((uint)(player.UnitFieldsAddress + UnitOffsets.MaxHealth));
            player.Level             = WowReader.ReadUInt((uint)(player.UnitFieldsAddress + UnitOffsets.Level));
            player.MaxEnergy         = WowReader.ReadUInt((uint)(player.UnitFieldsAddress + UnitOffsets.MaxEnergy));
            player.MapID             = (int)WowReader.ReadUInt((uint)ObjectOffsets.mapId);
            player.Name = PlayerNameFromGuid(LocalPlayer.Guid);
            player.Set(WowReader.ReadFloat((uint)(player.BaseAddress + ObjectOffsets.Pos_X)), WowReader.ReadFloat((uint)(player.BaseAddress + ObjectOffsets.Pos_Y)), WowReader.ReadFloat((uint)(player.BaseAddress + ObjectOffsets.Pos_Z)));
            //player.majPosition();
            if (player.CurrentHealth <= 0)
            {
                player.isDead = true;
            }

            return(player);
        }
Пример #8
0
        public static Structs.PatternList FindPatternList(Structs.PatternList patternList)
        {
            Structs.PatternList newPatternList = new Structs.PatternList();
            newPatternList.processName = patternList.processName;
            uint baseModule = 0;

            BlackMagic memread = new BlackMagic();

            if (memread.OpenProcessAndThread(SProcess.GetProcessFromProcessName(patternList.processName)))
            {
                try
                {
                    // Dump module
                    ProcessModuleCollection modules = Process.GetProcessById(memread.ProcessId).Modules;
                    foreach (ProcessModule o in modules)
                    {
                        Structs.ModuleList m = new Structs.ModuleList();
                        m.Name           = o.ModuleName;
                        m.baseAddressDec = (int)o.BaseAddress;
                        m.baseAddressHex = (o.BaseAddress).ToString("X");
                        patternList.Modules.Add(m);

                        // Check module base if exist.
                        if (patternList.baseModuleName != "")
                        {
                            if (patternList.baseModuleName.ToLower() == o.ModuleName.ToLower())
                            {
                                baseModule = (uint)o.BaseAddress;
                            }
                        }
                    }
                }
                catch { }

                foreach (Structs.Pattern p in patternList.Patterns)
                {
                    try
                    {
                        uint dwCodeLoc = memread.FindPattern(p.pattern, p.mask);
                        uint offset    = memread.ReadUInt((uint)((int)dwCodeLoc + p.offsetLocation));
                        if (offset > 0)
                        {
                            offset    = offset - baseModule;
                            dwCodeLoc = dwCodeLoc - baseModule;
                        }


                        if (offset > 0)
                        {
                            // Dump offset
                            p.offset          = offset.ToString("X");
                            p.offsetDec       = offset;
                            p.offsetUsedAtDec = (uint)((int)dwCodeLoc + p.offsetLocation);
                            p.offsetUsedAt    = ((int)dwCodeLoc + p.offsetLocation).ToString("X");
                            try
                            {
                                switch (p.type)
                                {
                                case "int64":
                                    p.value = Convert.ToString(memread.ReadUInt64(p.offsetDec));
                                    break;

                                case "int":
                                    p.value = Convert.ToString(memread.ReadInt(p.offsetDec));
                                    break;

                                case "float":
                                    p.value = Convert.ToString(memread.ReadFloat(p.offsetDec));
                                    break;

                                case "string":
                                    p.value = Convert.ToString(memread.ReadASCIIString(p.offsetDec, 30));
                                    break;
                                }
                            }
                            catch { p.value = "No Found"; }
                        }
                        else
                        {
                            p.offset = "No Found";
                        }
                    }
                    catch
                    { p.offset = "No Found"; }
                    newPatternList.Patterns.Add(p);
                }
                memread.Close();
            }
            else
            {
                MessageBox.Show("Process no found.");
            }
            return(patternList);
        }
Пример #9
0
        public void Read()
        {
            try
            {
                try
                {
                    playerbase = wow.ReadUInt(wow.ReadUInt(wow.ReadUInt((uint)Globals.s_PlayerBase) + 0x34) + 0x24);
                    if (playerbase != 0)
                    {
                        Online = true;
                    }
                    else
                    {
                        Online = false;
                    }
                } //this is the player base
                catch (Exception) { Online = false; }
                BgStatus  = wow.ReadUInt((uint)Globals.BGStatus);
                IsIndoors = wow.ReadUInt((uint)Globals.IsIndoors);
                LastError = ReadRealName(wow.ReadBytes((uint)Globals.LastError, 120));
                BattlefieldInstanceExpiration = 0;                //wow.ReadUInt(0xC55A24) & 1;
                Combopoints = Convert.ToInt16(wow.ReadByte((uint)Globals.s_ComboPoint));
                CharCount   = Convert.ToInt16(wow.ReadByte((uint)Globals.CharCount));
                CharNo      = Convert.ToInt16(wow.ReadByte((uint)Globals.CharNo));
                String WOWBuild = ReadRealName(wow.ReadBytes(0x00A30BE6, 10));
                byte[] TT       = wow.ReadBytes(0x00A30BE6, 10);
                LoginState   = wow.ReadASCIIString(0xB6A9E0, 40);
                RealmName    = ReadRealName(wow.ReadBytes((uint)Globals.s_RealmName, 120));
                LoadingState = (int)wow.ReadUInt((uint)Globals.s_IsLoadingOrConnecting);
                WowControl.CheckLastError(LastError);
                ObjectInfo Target     = new ObjectInfo();
                byte[]     UnitFields = wow.ReadBytes(wow.ReadUInt(playerbase + 0x8) + (0x17 * 4), 4);
                PlayerForm = Convert.ToInt32(UnitFields[3]);
                Objects.Clear();
                IsMounted  = wow.ReadUInt(playerbase + 0x9C0);// &1;
                Temp       = new ObjectInfo();
                Temp.Auras = getAuras(playerbase);
                WowControl.PlayerBuffs.Clear();
                for (int i = 0; i < Temp.Auras.Count; i++)
                {
                    WowControl.PlayerBuffs.Add(Temp.Auras[i].auraId);
                }
                Temp.Name   = ReadRealName(wow.ReadBytes((uint)Globals.s_PlayerName, 120));
                Temp.Level  = wow.ReadUInt(wow.ReadUInt(playerbase + 0x8) + (0x36 * 4)); // Reads players level
                Temp.Health = wow.ReadUInt(wow.ReadUInt(playerbase + 0x8) + (0x18 * 4)); // Reads players health
                PowerList.Clear();
                Temp.Power     = GetUnitPower(playerbase);
                Temp.MaxHealth = wow.ReadUInt(wow.ReadUInt(playerbase + 0x8) + (0x20 * 4)); // Reads players maxhealth
                if ((Location != null) & (Location != ""))
                {
                    if (Location != ReadRealName(wow.ReadBytes(wow.ReadUInt((uint)Globals.LocationName), 60)))
                    {
                        WowControl.LocationChangeTime = DateTime.Now;
                        Location = ReadRealName(wow.ReadBytes(wow.ReadUInt((uint)Globals.LocationName), 60));
                        WowControl.BadObjects.Clear();
                        if (BgStatus == 3)
                        {
                            WowControl.WaitTime = DateTime.Now.AddSeconds(20);
                        }
                        else
                        {
                            WowControl.WaitTime = DateTime.Now.AddSeconds(1);
                        }
                        return;
                    }
                }
                else
                {
                    Location = ReadRealName(wow.ReadBytes(wow.ReadUInt((uint)Globals.LocationName), 60));
                }
                Temp.X = wow.ReadFloat(playerbase + 0x798); // Read players xlocation
                Temp.Y = wow.ReadFloat(playerbase + 0x79C); // Read players ylocation
                Temp.Z = wow.ReadFloat(playerbase + 0x7A0); // Read players zlocation
                double Time = (DateTime.Now - LastRead).TotalMilliseconds;
                Speed           = WowControl.CheckPoint(Temp.X, Temp.Y, Temp.Z, X, Y, Z) / Time;
                X               = Temp.X;
                Y               = Temp.Y;
                Z               = Temp.Z;
                Temp.R          = wow.ReadFloat(playerbase + 0x7A8);                                     // Read players rotation
                Temp.IsInCombat = (wow.ReadUInt(wow.ReadUInt(playerbase + 208) + 212) >> 19) & 1;
                Temp.Faction    = GetFaction(wow.ReadUInt(wow.ReadUInt(playerbase + 0x8) + (0x37 * 4))); //Faction
                Temp.Type       = 4;
                Temp.GUID       = wow.ReadUInt64(playerbase + 0x30);
                Objects.Add(Temp);
                LastRead = DateTime.Now;
                uint   s_curMgr   = wow.ReadUInt(wow.ReadUInt((uint)ObjectManager.CurMgrPointer) + (uint)ObjectManager.CurMgrOffset);
                uint   curObj     = wow.ReadUInt(s_curMgr + 0xAC);
                uint   nextObj    = curObj;
                UInt64 playerGUID = wow.ReadUInt64((uint)Globals.PlayerGUID);
                UInt64 targetGUID = wow.ReadUInt64((uint)Globals.TargetGUID);
                UInt64 localGUID  = wow.ReadUInt64(s_curMgr + 0xC0);
                while (curObj != 0 && (curObj & 1) == 0)
                {
                    UInt64 type  = wow.ReadUInt(curObj + 0x14);
                    UInt64 cGUID = wow.ReadUInt64(curObj + 0x30);
                    Temp.Type = Convert.ToUInt32(type);
                    if (Temp.Type == 7)
                    {
                        Temp.Type = 7;
                    }
                    Temp.GUID = cGUID;
                    switch (type)
                    {
                    case 3:
                        Temp.IsInCombat = (wow.ReadUInt(wow.ReadUInt(curObj + 208) + 212) >> 19) & 1;
                        Temp.IsPlayer   = false;
                        Temp.IsTarget   = false;
                        Temp.Name       = "Unit";
                        if (cGUID == targetGUID)
                        {
                            Temp.IsTarget = true;
                        }
                        Temp.X          = wow.ReadFloat(curObj + 0x7D4);
                        Temp.Y          = wow.ReadFloat(curObj + 0x7D8);
                        Temp.Z          = wow.ReadFloat(curObj + 0x7DC);
                        Temp.R          = wow.ReadFloat(curObj + 0x7A8);
                        Temp.Health     = wow.ReadUInt(wow.ReadUInt(curObj + 0x8) + (0x18 * 4)); // Reads health
                        Temp.MaxHealth  = wow.ReadUInt(wow.ReadUInt(curObj + 0x8) + (0x20 * 4)); // Reads maxhealth
                        Temp.Level      = wow.ReadUInt(wow.ReadUInt(curObj + 0x8) + (0x36 * 4)); // Reads level
                        Temp.Name       = ReadRealName(wow.ReadBytes(wow.ReadUInt(wow.ReadUInt(curObj + 0x964) + 0x5c), 60));
                        Temp.Faction    = "Mob";
                        Temp.IsLootable = wow.ReadUInt(wow.ReadUInt(curObj + 0x8) + (0x4F * 4));
                        Temp.Auras      = getAuras(curObj);
                        Temp.Power      = GetUnitPower(curObj);
                        if (cGUID == targetGUID)
                        {
                            Temp.IsTarget = true;
                            Target        = Temp;
                            Target.Auras  = getAuras(curObj);
                        }
                        Objects.Add(Temp);
                        break;

                    case 4:
                        Temp.IsInCombat = (wow.ReadUInt(wow.ReadUInt(curObj + 208) + 212) >> 19) & 1;
                        Temp.IsTarget   = false;
                        Temp.IsPlayer   = false;
                        Temp.Name       = GetPlayerNameByGuid(cGUID);
                        Temp.X          = wow.ReadFloat(curObj + 0x7D4);
                        Temp.Y          = wow.ReadFloat(curObj + 0x7D8);
                        Temp.Z          = wow.ReadFloat(curObj + 0x7DC);
                        Temp.R          = wow.ReadFloat(curObj + 0x7A8);
                        Temp.Health     = wow.ReadUInt(wow.ReadUInt(curObj + 0x8) + (0x18 * 4));             // Reads health
                        Temp.MaxHealth  = wow.ReadUInt(wow.ReadUInt(curObj + 0x8) + (0x20 * 4));             // Reads maxhealth
                        Temp.Level      = wow.ReadUInt(wow.ReadUInt(curObj + 0x8) + (0x36 * 4));             // Reads level
                        Temp.Faction    = GetFaction(wow.ReadUInt(wow.ReadUInt(curObj + 0x8) + (0x37 * 4))); //Faction
                        Temp.Auras      = getAuras(curObj);
                        Temp.Power      = GetUnitPower(curObj);
                        if (cGUID == targetGUID)
                        {
                            Temp.IsTarget = true;
                            Target        = Temp;
                            Target.Auras  = getAuras(curObj);
                        }
                        else if (cGUID == playerGUID)
                        {
                            break;
                        }
                        if (Objects[0].GUID != Temp.GUID)
                        {
                            Objects.Add(Temp);
                        }
                        break;

                    case 5:
                        Temp.Faction    = "Object";
                        Temp.IsInCombat = 0;
                        Temp.Name       = "";
                        Temp.IsPlayer   = false;
                        Temp.IsTarget   = false;
                        if (cGUID == targetGUID)
                        {
                            Temp.IsTarget = true;
                        }
                        Temp.Level     = 0;
                        Temp.Health    = 0;
                        Temp.MaxHealth = 0;
                        Temp.X         = wow.ReadFloat(curObj + 0xE8);
                        Temp.Y         = wow.ReadFloat(curObj + 0xEC);
                        Temp.Z         = wow.ReadFloat(curObj + 0xF0);
                        Temp.R         = wow.ReadFloat(curObj + 0x7A8);
                        Temp.Name      = ReadRealName(wow.ReadBytes(wow.ReadUInt(wow.ReadUInt(curObj + 0x1A4) + 0x90), 60));
                        Temp.Power     = GetUnitPower(curObj);
                        Objects.Add(Temp);
                        break;
                    }
                    nextObj = wow.ReadUInt(curObj + 0x3C);
                    if (nextObj == curObj)
                    {
                        break;
                    }
                    else
                    {
                        curObj = nextObj;
                    }
                }
                Objects.Add(Target);
                WowControl.TargetBuffs.Clear();
                if (Target.Auras != null)
                {
                    for (int i = 0; i < Target.Auras.Count; i++)
                    {
                        WowControl.TargetBuffs.Add(Target.Auras[i].auraId);
                    }
                }
                if (LastError == "Нет места.")
                {
                    WowControl.FullBag = true;
                }
            }
            catch (Exception)
            {
                //WowControl.UpdateStatus("Error. " + E.Message);
                InitMemory();
            }
        }
Пример #10
0
        public void DoWork()
        {
            while (!_halt)
            {
                if (!_halt && _isWayPoints)
                {
                    _startingX = _magic.ReadFloat((uint)TbcOffsets.General.PlayerX);
                    _startingY = _magic.ReadFloat((uint)TbcOffsets.General.PlayerY);
                    _startingZ = _magic.ReadFloat((uint)TbcOffsets.General.PlayerZ);
                    _profile.AddWayPoint(_startingX, _startingY, _startingZ);
                    if (_richTextBox.InvokeRequired)
                    {
                        _richTextBox.Invoke(new MethodInvoker(delegate { _richTextBox.AppendText("Added waypoint at x: " + _startingX + ", y: " + _startingY + ", z: " + _startingZ + Environment.NewLine); }));
                    }

                    _currentX = _startingX;
                    _currentY = _startingY;
                    _currentZ = _startingZ;
                    _deltaX   = 0;
                    _deltaY   = 0;
                    _deltaZ   = 0;
                    while (!_halt && _isWayPoints)
                    {
                        while (!_halt && (float)Math.Sqrt(_deltaX * _deltaX + _deltaY * _deltaY + _deltaZ * _deltaZ) < 15 && _isWayPoints)
                        {
                            _currentX = _magic.ReadFloat((uint)TbcOffsets.General.PlayerX);
                            _currentY = _magic.ReadFloat((uint)TbcOffsets.General.PlayerY);
                            _currentZ = _magic.ReadFloat((uint)TbcOffsets.General.PlayerZ);
                            _deltaX   = _currentX - _startingX;
                            _deltaY   = _currentY - _startingY;
                            _deltaZ   = _currentZ - _startingZ;
                        }
                        _profile.AddWayPoint(_currentX, _currentY, _currentZ);
                        _startingX = _currentX;
                        _startingY = _currentY;
                        _startingZ = _currentZ;
                        if (_richTextBox.InvokeRequired)
                        {
                            _richTextBox.Invoke(new MethodInvoker(delegate { _richTextBox.AppendText("Added waypoint at x: " + _startingX + ", y: " + _startingY + ", z: " + _startingZ + Environment.NewLine); }));
                        }
                        _deltaX = 0;
                        _deltaY = 0;
                        _deltaZ = 0;
                    }
                }
                else if (!_halt && _isGhostPoints)
                {
                    _startingX = _magic.ReadFloat((uint)TbcOffsets.General.PlayerX);
                    _startingY = _magic.ReadFloat((uint)TbcOffsets.General.PlayerY);
                    _startingZ = _magic.ReadFloat((uint)TbcOffsets.General.PlayerZ);
                    _profile.AddGhostPoint(_startingX, _startingY, _startingZ);
                    if (_richTextBox.InvokeRequired)
                    {
                        _richTextBox.Invoke(new MethodInvoker(delegate { _richTextBox.AppendText("Added ghostpoint at x: " + _startingX + ", y: " + _startingY + ", z: " + _startingZ + Environment.NewLine); }));
                    }
                    _currentX = _startingX;
                    _currentY = _startingY;
                    _currentZ = _startingZ;
                    _deltaX   = 0;
                    _deltaY   = 0;
                    _deltaZ   = 0;
                    while (!_halt && _isGhostPoints)
                    {
                        while (!_halt && (float)Math.Sqrt(_deltaX * _deltaX + _deltaY * _deltaY + _deltaZ * _deltaZ) < 15 && _isGhostPoints)
                        {
                            _currentX = _magic.ReadFloat((uint)TbcOffsets.General.PlayerX);
                            _currentY = _magic.ReadFloat((uint)TbcOffsets.General.PlayerY);
                            _currentZ = _magic.ReadFloat((uint)TbcOffsets.General.PlayerZ);
                            _deltaX   = _currentX - _startingX;
                            _deltaY   = _currentY - _startingY;
                            _deltaZ   = _currentZ - _startingZ;
                        }
                        _profile.AddGhostPoint(_currentX, _currentY, _currentZ);
                        _startingX = _currentX;
                        _startingY = _currentY;
                        _startingZ = _currentZ;
                        if (_richTextBox.InvokeRequired)
                        {
                            _richTextBox.Invoke(new MethodInvoker(delegate { _richTextBox.AppendText("Added ghostpoint at x: " + _startingX + ", y: " + _startingY + ", z: " + _startingZ + Environment.NewLine); }));
                        }
                        _deltaX = 0;
                        _deltaY = 0;
                        _deltaZ = 0;
                    }
                }
                else if (!_halt && _isSellPoints)
                {
                    _startingX = _magic.ReadFloat((uint)TbcOffsets.General.PlayerX);
                    _startingY = _magic.ReadFloat((uint)TbcOffsets.General.PlayerY);
                    _startingZ = _magic.ReadFloat((uint)TbcOffsets.General.PlayerZ);
                    _profile.AddSellPoint(_startingX, _startingY, _startingZ);
                    if (_richTextBox.InvokeRequired)
                    {
                        _richTextBox.Invoke(new MethodInvoker(delegate { _richTextBox.AppendText("Added sellpoint at x: " + _startingX + ", y: " + _startingY + ", z: " + _startingZ + Environment.NewLine); }));
                    }
                    _currentX = _startingX;
                    _currentY = _startingY;
                    _currentZ = _startingZ;
                    _deltaX   = 0;
                    _deltaY   = 0;
                    _deltaZ   = 0;
                    while (!_halt && _isSellPoints)
                    {
                        while (!_halt && (float)Math.Sqrt(_deltaX * _deltaX + _deltaY * _deltaY + _deltaZ * _deltaZ) < 15 && _isSellPoints)
                        {
                            _currentX = _magic.ReadFloat((uint)TbcOffsets.General.PlayerX);
                            _currentY = _magic.ReadFloat((uint)TbcOffsets.General.PlayerY);
                            _currentZ = _magic.ReadFloat((uint)TbcOffsets.General.PlayerZ);
                            _deltaX   = _currentX - _startingX;
                            _deltaY   = _currentY - _startingY;
                            _deltaZ   = _currentZ - _startingZ;
                        }
                        _profile.AddSellPoint(_currentX, _currentY, _currentZ);
                        _startingX = _currentX;
                        _startingY = _currentY;
                        _startingZ = _currentZ;
                        if (_richTextBox.InvokeRequired)
                        {
                            _richTextBox.Invoke(new MethodInvoker(delegate { _richTextBox.AppendText("Added sellpoint at x: " + _startingX + ", y: " + _startingY + ", z: " + _startingZ + Environment.NewLine); }));
                        }
                        _deltaX = 0;
                        _deltaY = 0;
                        _deltaZ = 0;
                    }
                }
            }
        }
Пример #11
0
        public bool CombatMode()
        {
            ulong target = magic.ReadUInt64((uint)TbcOffsets.General.TargetGuid);
            bool  stuck  = false;
            //Investigate
            bool combatSuccessful = false;

            if (target == 0)
            {
                keyboardSim.KeyDown(targetKey);

                keyboardSim.KeyUp(targetKey);
            }
            else
            {
                objectManager.PopulateList();
                List <WorkWork.Memory.Object> objs = objectManager.GetObjects();
                for (int i = 0; i < objs.Count; i++)
                {
                    WorkWork.Memory.Object obj = objs[i];
                    int type = obj.Type;
                    if ((type == 4 && !settings.IgnorePlayers) || (type == 3 && !settings.IgnoreMobs))
                    {
                        ulong guid = obj.Guid;
                        if (target == guid && obj.Health > 0 && !stuck)
                        {
                            if (type == 3)
                            {
                                string name = obj.Name;
                                foreach (String ignoredMob in profile.GetIgnoredMobs())
                                {
                                    if (name == ignoredMob)
                                    {
                                        stuck = true;
                                        keyboardSim.KeyDown(targetKey);

                                        keyboardSim.KeyUp(targetKey);
                                    }
                                }
                            }
                            foreach (WorkWork.Memory.Object ignoredObjects in ignoredMobs)
                            {
                                if (ignoredObjects.Guid == guid)
                                {
                                    stuck = true;
                                    keyboardSim.KeyDown(targetKey);

                                    keyboardSim.KeyUp(targetKey);
                                }
                                else
                                {
                                    foreach (ulong ignoredMobGuid in profile.getIgnoredMobsGuid)
                                    {
                                        if (guid == ignoredMobGuid)
                                        {
                                            stuck = true;
                                            keyboardSim.KeyDown(targetKey);

                                            keyboardSim.KeyUp(targetKey);
                                        }
                                    }
                                }
                            }

                            var watch        = Stopwatch.StartNew();
                            int startingHP   = objectManager.GetPlayer().Health;
                            int startingMP   = objectManager.GetPlayer().Mana;
                            int currentCombo = 0;
                            while (obj.Health > 0 && !halt && !stuck)
                            {
                                currentCombo = DpsRotation(obj, currentCombo);
                                if (AutoAttack() && objectManager.GetPlayer().Health > 0)
                                {
                                    bot.GetPathing.WalkToMob(obj, 5);
                                }
                                if (watch.ElapsedMilliseconds > averageTime * 3 && averageTime > 0)
                                {
                                    ignoredMobs.Add(obj);
                                    stuck = true;
                                }
                                if (halt || (objectManager.GetPlayer().Health <= 0) || bot.GetPathing.Dead || magic.ReadFloat((uint)TbcOffsets.General.PlayerCorpseX) != 0)
                                {
                                    stuck = true;
                                }
                            }
                            watch.Stop();
                            if (!stuck)
                            {
                                int counter;
                                int endingHP = objectManager.GetPlayer().Health;
                                if (endingHP < startingHP)
                                {
                                    endingHP  = startingHP - endingHP;
                                    endingHP += endingHP / 2;
                                    healthPerMob[hpCounter] = endingHP;
                                    hpCounter++;
                                    if (hpCounter == 10)
                                    {
                                        hpCounter = 0;
                                    }
                                    counter           = 0;
                                    bot.AverageHealth = 0;
                                    foreach (int hp in healthPerMob)
                                    {
                                        if (hp > 0)
                                        {
                                            counter++;
                                            bot.AverageHealth += hp;
                                        }
                                    }
                                    if (counter > 0)
                                    {
                                        bot.AverageHealth /= counter;
                                    }
                                }
                                if (objectManager.GetPlayer().MaxMana > 0)
                                {
                                    int endingMP = objectManager.GetPlayer().Mana;
                                    if (endingMP < startingMP)
                                    {
                                        endingMP  = startingMP - endingMP;
                                        endingMP += endingMP / 2;
                                        manaPerMob[mpCounter] = endingMP;
                                        mpCounter++;
                                        if (mpCounter == 10)
                                        {
                                            mpCounter = 0;
                                        }
                                        counter         = 0;
                                        bot.AverageMana = 0;
                                        foreach (int mp in manaPerMob)
                                        {
                                            if (mp > 0)
                                            {
                                                counter++;
                                                bot.AverageMana += mp;
                                            }
                                        }
                                        if (counter > 0)
                                        {
                                            bot.AverageMana /= counter;
                                        }
                                    }
                                }
                                if (magic.ReadUInt(magic.ReadUInt((uint)TbcOffsets.General.PlayerBase) + (uint)TbcOffsets.General.CombatStateOffset) == (int)TbcOffsets.CombatState.InCombat && magic.ReadUInt64((uint)TbcOffsets.General.TargetGuid) != 0)
                                {
                                    CombatMode();
                                }

                                timePerMob[timeCounter] = watch.ElapsedMilliseconds;
                                timeCounter++;
                                if (timeCounter == 10)
                                {
                                    timeCounter = 0;
                                }
                                averageTime = 0;
                                counter     = 0;
                                foreach (long temp in timePerMob)
                                {
                                    if (temp > 0)
                                    {
                                        counter++;
                                        averageTime += temp;
                                    }
                                }
                                if (counter > 0)
                                {
                                    averageTime /= counter;
                                }
                                if (objectManager.GetPlayer().Health > 0)
                                {
                                    if (settings.Looting)
                                    {
                                        bot.GetPathing.WalkToMob(obj, 3);
                                        bot.GetOther.Interact();
                                        if (settings.Skinning)
                                        {
                                            bot.GetOther.Interact();
                                        }
                                    }
                                    combatSuccessful = true;
                                    bot.MobsKilled++;
                                    statistics.Changed = true;
                                    bot.GetOther.Regen();
                                    afterCombatSpells(currentCombo, "aftercombat");
                                }
                            }
                            break;
                        }
                        else if (target == guid && obj.Health <= 0)
                        {
                            keyboardSim.KeyDown(targetKey);
                            keyboardSim.KeyUp(targetKey);
                            break;
                        }
                    }
                }
            }


            return(combatSuccessful);
        }
Пример #12
0
 public float ReadFloat(uint dwAddress)
 {
     return(D3.ReadFloat(dwAddress, false, buffer));
 }