示例#1
0
        public int DpsRotation(WorkWork.Memory.Object obj, int currentCombo)
        {
            int    playerEnergy    = objectManager.GetPlayer().Energy;
            int    playerMana      = objectManager.GetPlayer().Mana;
            int    playerRage      = objectManager.GetPlayer().Rage / 10;
            double playerHealth    = objectManager.GetPlayer().Health;
            double playerMaxHealth = objectManager.GetPlayer().MaxHealth;
            double objHealth       = obj.Health;
            double objMaxHealth    = obj.MaxHealth;

            for (int i = 0; i < spells.SpellNames.Count; i++)
            {
                string name              = spells.SpellNames[i];
                int    cast              = spells.CastTime[i];
                int    health            = spells.Health[i];
                int    mana              = spells.Mana[i];
                int    range             = spells.Range[i];
                string type              = spells.Type[i];
                int    combo             = spells.Combo[i];
                int    minDistance       = spells.MinDistance[i];
                int    enemyHPPercentage = spells.EnemyHealth[i];
                if (name.ToLower().Contains("heal"))
                {
                    currentCombo = damageInDetail(obj, combo, minDistance, type, name, cast, health, mana, range, currentCombo, enemyHPPercentage, playerEnergy, playerMana, playerRage, playerHealth, playerMaxHealth, objHealth, objMaxHealth);
                }
                else if (name.ToLower().Contains("defensive"))
                {
                    currentCombo = damageInDetail(obj, combo, minDistance, type, name, cast, health, mana, range, currentCombo, enemyHPPercentage, playerEnergy, playerMana, playerRage, playerHealth, playerMaxHealth, objHealth, objMaxHealth);
                }
                else if (name.ToLower().Contains("charge"))
                {
                    currentCombo = damageInDetail(obj, combo, minDistance, type, name, cast, health, mana, range, currentCombo, enemyHPPercentage, playerEnergy, playerMana, playerRage, playerHealth, playerMaxHealth, objHealth, objMaxHealth);
                }
                else if (name.ToLower().Contains("execute"))
                {
                    currentCombo = damageInDetail(obj, combo, minDistance, type, name, cast, health, mana, range, currentCombo, enemyHPPercentage, playerEnergy, playerMana, playerRage, playerHealth, playerMaxHealth, objHealth, objMaxHealth);
                }
                else if (name.ToLower().Contains("combo"))
                {
                    currentCombo = damageInDetail(obj, combo, minDistance, type, name, cast, health, mana, range, currentCombo, enemyHPPercentage, playerEnergy, playerMana, playerRage, playerHealth, playerMaxHealth, objHealth, objMaxHealth);
                }
                else if (name.ToLower().Contains("spam"))
                {
                    currentCombo = damageInDetail(obj, combo, minDistance, type, name, cast, health, mana, range, currentCombo, enemyHPPercentage, playerEnergy, playerMana, playerRage, playerHealth, playerMaxHealth, objHealth, objMaxHealth);
                }
            }
            return(currentCombo);
        }
示例#2
0
        public void Rotate(WorkWork.Memory.Object obj)
        {
            float startingX = magic.ReadFloat((uint)TbcOffsets.General.PlayerX);
            float startingY = magic.ReadFloat((uint)TbcOffsets.General.PlayerY);
            float startingZ = magic.ReadFloat((uint)TbcOffsets.General.PlayerZ);

            float angle1;
            float angle2;
            float rotation = (float)Math.Atan2(obj.YPosition - startingY, obj.XPosition - 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"));
            if (myRotation != rotation)
            {
                if (myRotation > rotation)
                {
                    angle1 = myRotation - rotation;
                    angle2 = rotation + (2 * (float)Math.PI - myRotation);
                    if (angle1 < angle2)
                    {
                        if (angle1 > 0.1)
                        {
                            keyboardSim.KeyDown(turnright);
                            keyboardSim.KeyUp(turnleft);
                        }
                        else
                        {
                            keyboardSim.KeyUp(turnleft);
                            keyboardSim.KeyUp(turnright);
                        }
                    }
                    else
                    {
                        if (angle2 > 0.1)
                        {
                            keyboardSim.KeyDown(turnleft);
                            keyboardSim.KeyUp(turnright);
                        }
                        else
                        {
                            keyboardSim.KeyUp(turnleft);
                            keyboardSim.KeyUp(turnright);
                        }
                    }
                }
                else if (myRotation < rotation)
                {
                    angle1 = rotation - myRotation;
                    angle2 = myRotation + (2 * (float)Math.PI - rotation);
                    if (angle1 < angle2)
                    {
                        if (angle1 > 0.1)
                        {
                            keyboardSim.KeyDown(turnleft);
                            keyboardSim.KeyUp(turnright);
                        }
                        else
                        {
                            keyboardSim.KeyUp(turnleft);
                            keyboardSim.KeyUp(turnright);
                        }
                    }
                    else
                    {
                        if (angle2 > 0.1)
                        {
                            keyboardSim.KeyDown(turnright);
                            keyboardSim.KeyUp(turnleft);
                        }
                        else
                        {
                            keyboardSim.KeyUp(turnleft);
                            keyboardSim.KeyUp(turnright);
                        }
                    }
                }
            }
            else
            {
                keyboardSim.KeyUp(turnleft);
                keyboardSim.KeyUp(turnright);
            }
        }
示例#3
0
        public void WalkToMob(WorkWork.Memory.Object obj, int range)
        {
            float startingX = magic.ReadFloat((uint)TbcOffsets.General.PlayerX);
            float startingY = magic.ReadFloat((uint)TbcOffsets.General.PlayerY);
            float startingZ = magic.ReadFloat((uint)TbcOffsets.General.PlayerZ);
            float targetX   = obj.XPosition;
            float targetY   = obj.YPosition;
            float targetZ   = obj.ZPosition;
            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 > range - 1 && distance <= 100f) && !halt)
            {
                int playerHealth = objectManager.GetPlayer().Health;
                if (playerHealth <= 0 && profile.IsGhostSet)
                {
                    bot.GetOther.ReleaseScript();
                    dead = true;
                    Thread.Sleep(1000);
                    break;
                }
                else if (playerHealth <= 0 && !profile.IsGhostSet)
                {
                    bot.Halt();
                }
                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 > range - 1)
                            {
                                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 > range - 1)
                            {
                                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 > range - 1)
                            {
                                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 > range - 1)
                            {
                                keyboardSim.KeyDown(walk);
                            }
                        }
                    }
                }

                else
                {
                    keyboardSim.KeyDown(walk);
                    keyboardSim.KeyUp(turnleft);
                    keyboardSim.KeyUp(turnright);
                }
                startingX  = magic.ReadFloat((uint)TbcOffsets.General.PlayerX);
                startingY  = magic.ReadFloat((uint)TbcOffsets.General.PlayerY);
                startingZ  = magic.ReadFloat((uint)TbcOffsets.General.PlayerZ);
                targetX    = obj.XPosition;
                targetY    = obj.YPosition;
                targetZ    = obj.ZPosition;
                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"));
                dX         = targetX - startingX;
                dY         = targetY - startingY;
                dZ         = targetZ - startingZ;
                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);
        }
示例#4
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);
        }
示例#5
0
        public int damageInDetail(WorkWork.Memory.Object obj, int combo, int minDistance, string type, string name, int cast, int playerHPPercentage, int mana, int range, int currentCombo, int enemyHPPercentage, int playerEnergy, int playerMana, int playerRage, double playerHealth, double playerMaxHealth, double objHealth, double objMaxHealth)
        {
            float startingX = magic.ReadFloat((uint)TbcOffsets.General.PlayerX);
            float startingY = magic.ReadFloat((uint)TbcOffsets.General.PlayerY);
            float startingZ = magic.ReadFloat((uint)TbcOffsets.General.PlayerZ);
            float dX        = obj.XPosition - startingX;
            float dY        = obj.YPosition - startingY;
            float dZ        = obj.ZPosition - startingZ;

            bot.GetPathing.Rotate(obj);
            if ((float)Math.Sqrt(dX * dX + dY * dY + dZ * dZ) > minDistance)
            {
                if ((objHealth / objMaxHealth * 100) <= enemyHPPercentage)
                {
                    if (playerHealth / playerMaxHealth * 100 <= playerHPPercentage)
                    {
                        if (type == "energy")
                        {
                            if (playerEnergy >= mana)
                            {
                                if (currentCombo % combo == 0)
                                {
                                    if (range >= 0)
                                    {
                                        bot.GetPathing.WalkToMob(obj, range);
                                    }
                                    keyboardSim.KeyDown(spells.GetKey(name));
                                    keyboardSim.KeyUp(spells.GetKey(name));
                                    if (name.ToLower().Contains("spam"))
                                    {
                                        currentCombo++;
                                    }
                                    var watch = Stopwatch.StartNew();
                                    while (!halt && watch.ElapsedMilliseconds <= cast && (((float)Math.Sqrt(dX * dX + dY * dY + dZ * dZ) <= range && (float)Math.Sqrt(dX * dX + dY * dY + dZ * dZ) > minDistance && obj.Health > 0 && objectManager.GetPlayer().Health > 0) || range == -1))
                                    { //REALLY SMALL THREAD SLEEP HERE MAYBE
                                        startingX = magic.ReadFloat((uint)TbcOffsets.General.PlayerX);
                                        startingY = magic.ReadFloat((uint)TbcOffsets.General.PlayerY);
                                        startingZ = magic.ReadFloat((uint)TbcOffsets.General.PlayerZ);
                                        dX        = obj.XPosition - startingX;
                                        dY        = obj.YPosition - startingY;
                                        dZ        = obj.ZPosition - startingZ;
                                        bot.GetPathing.Rotate(obj);
                                    }
                                    watch.Stop();
                                }
                            }
                        }
                        else if (type == "mana")
                        {
                            if (playerMana >= mana)
                            {
                                if (currentCombo % combo == 0)
                                {
                                    if (range >= 0)
                                    {
                                        bot.GetPathing.WalkToMob(obj, range);
                                    }
                                    keyboardSim.KeyDown(spells.GetKey(name));
                                    keyboardSim.KeyUp(spells.GetKey(name));
                                    if (name.ToLower().Contains("spam"))
                                    {
                                        currentCombo++;
                                    }
                                    var watch = Stopwatch.StartNew();
                                    while (!halt && watch.ElapsedMilliseconds <= cast && (((float)Math.Sqrt(dX * dX + dY * dY + dZ * dZ) <= range && (float)Math.Sqrt(dX * dX + dY * dY + dZ * dZ) > minDistance && obj.Health > 0 && objectManager.GetPlayer().Health > 0) || range == -1))
                                    {
                                        startingX = magic.ReadFloat((uint)TbcOffsets.General.PlayerX);
                                        startingY = magic.ReadFloat((uint)TbcOffsets.General.PlayerY);
                                        startingZ = magic.ReadFloat((uint)TbcOffsets.General.PlayerZ);
                                        dX        = obj.XPosition - startingX;
                                        dY        = obj.YPosition - startingY;
                                        dZ        = obj.ZPosition - startingZ;
                                        bot.GetPathing.Rotate(obj);
                                    }
                                    watch.Stop();
                                }
                            }
                        }
                        else
                        {
                            if (playerRage >= mana)
                            {
                                if (currentCombo % combo == 0)
                                {
                                    if (range >= 0)
                                    {
                                        bot.GetPathing.WalkToMob(obj, range);
                                    }
                                    keyboardSim.KeyDown(spells.GetKey(name));
                                    keyboardSim.KeyUp(spells.GetKey(name));
                                    if (name.ToLower().Contains("spam"))
                                    {
                                        currentCombo++;
                                    }
                                    var watch = Stopwatch.StartNew();
                                    while (!halt && watch.ElapsedMilliseconds <= cast && (((float)Math.Sqrt(dX * dX + dY * dY + dZ * dZ) <= range && (float)Math.Sqrt(dX * dX + dY * dY + dZ * dZ) > minDistance && obj.Health > 0 && objectManager.GetPlayer().Health > 0) || range == -1))
                                    {
                                        startingX = magic.ReadFloat((uint)TbcOffsets.General.PlayerX);
                                        startingY = magic.ReadFloat((uint)TbcOffsets.General.PlayerY);
                                        startingZ = magic.ReadFloat((uint)TbcOffsets.General.PlayerZ);
                                        dX        = obj.XPosition - startingX;
                                        dY        = obj.YPosition - startingY;
                                        dZ        = obj.ZPosition - startingZ;
                                        bot.GetPathing.Rotate(obj);
                                    }
                                    watch.Stop();
                                }
                            }
                        }
                    }
                }
            }
            return(currentCombo);
        }