Jump to content
  • Code doesnt stop fighting complete.


    TheSmokie
    • Product: WRobot General Type: Bug Status: Unconfirmed

    Hello @Droidz

    while i am making a fightclasses and using a EscapeProtocol, i found that this code doesnt completely stop the fight. it will still fight if attacked. i cant seem to get it to stop attack when attacked for a fightclass C#

    wManager.Wow.Helpers.Fight.StopFight();

     



    User Feedback

    Recommended Comments

    Droidz

    Posted

    Hello, this stop fight, but bot probably try to attack again target, to skip all combat you need to use code like:

            wManager.Events.FightEvents.OnFightStart += delegate(WoWUnit unit, CancelEventArgs cancelable)
                {
                    cancelable.Cancel = true;
                    if (unit.IsValid)
                        ObjectManager.BlackListGetUnitAttackPlayerGuidTime.Add(unit.Guid, DateTime.Now + TimeSpan.FromMinutes(10));
                };

     

    TheSmokie

    Posted

    On 5/1/2019 at 9:28 AM, Droidz said:

    Hello, this stop fight, but bot probably try to attack again target, to skip all combat you need to use code like:

    
            wManager.Events.FightEvents.OnFightStart += delegate(WoWUnit unit, CancelEventArgs cancelable)
                {
                    cancelable.Cancel = true;
                    if (unit.IsValid)
                        ObjectManager.BlackListGetUnitAttackPlayerGuidTime.Add(unit.Guid, DateTime.Now + TimeSpan.FromMinutes(10));
                };

     

    i know this is gonna sound like a stupid question but can you give some advice or some help with my code i am working on for my quester? i am trying to black list all mobs in a area for 5 mins

    Thread Water = new Thread(() =>
                {
                    
                    Logging.Write("[Water]: Water Search Initialized");
                    List<WoWUnit> attackers = ObjectManager.GetUnitAttackPlayer();
                    while (Conditions.ProductIsStarted || Conditions.ProductInPause)
                    {
                        var unit = ObjectManager.GetWoWUnitAttackables().Where(x => x.Position.DistanceTo(ObjectManager.Me.Position) <= 30);
                           
                        if (ObjectManager.Me.BreathTimerLeft <= 2000)
                        {
                            ObjectManager.BlackListGetUnitAttackPlayerGuidTime.Add(unit.ToArray(WoWUnit), DateTime.Now + TimeSpan.FromMinutes(5));
                            wManager.Wow.Helpers.Keybindings.PressKeybindings(wManager.Wow.Enums.Keybindings.JUMP, 5000);
                            
                        }
                        Thread.Sleep(12000);
                    } 
                    Logging.Write("[Water]: Water Search Disposed");
                });
                Water.Start();

     

    Droidz

    Posted

            Thread Water = new Thread(() =>
            {
                Logging.Write("[Water]: Water Search Initialized");
                while (Conditions.ProductIsStarted)
                {
                    try
                    {
                        if (!Conditions.ProductInPause && ObjectManager.Me.BreathTimerLeft <= 2000)
                        {
                            var unit = ObjectManager.GetWoWUnitAttackables().Where(x => x.Position.DistanceTo(ObjectManager.Me.Position) <= 30);
                            foreach (var u in unit)
                            {
                                if (!ObjectManager.BlackListGetUnitAttackPlayerGuidTime.ContainsKey(u.Guid))
                                    ObjectManager.BlackListGetUnitAttackPlayerGuidTime.Add(u.Guid, DateTime.Now + TimeSpan.FromMinutes(5));
                            }
                            wManager.Wow.Helpers.Keybindings.PressKeybindings(wManager.Wow.Enums.Keybindings.JUMP, 5000);
    
                        }
                    }
                    catch (Exception e)
                    {
                        Logging.WriteError("[Water] ERROR: " + e);
                    }
                    Thread.Sleep(12000);
                }
                Logging.Write("[Water]: Water Search Disposed");
            });
            Water.Start();

     

    TheSmokie

    Posted

    @Droidz Any advice on why my abort isnt working? trying to work on it so i can post it in the code snips as a call for using c# but i am gonna try to add a data base for flying, also if there a method to check if player is flying to?

        public class fly
        {
            public static void flying()
            {
                var zone = Lua.LuaDoString<string>("return GetZoneText()");
                Thread flying = new Thread(() =>
                {
                    Logging.Write("[Flight]: Has initialized");
    
                    while (Conditions.ProductIsStarted && zone != "Orgrimmar")
                    {
                        var position = new Vector3(-6810.2f, 841.704f, 49.66529f);
                        int npcEntryId = 15178;
                        var Zon= Lua.LuaDoString<string>("return GetZoneText()");
    
                        if (!ObjectManager.Me.IsOnTaxi && Zon != "Orgrimmar")
                        {
                            if (wManager.Wow.Bot.Tasks.GoToTask.ToPositionAndIntecractWithNpc(position, npcEntryId))
                            {
                                int node;
                                Usefuls.SelectGossipOption(GossipOptionsType.taxi);
    
                                node = wManager.Wow.Helpers.Lua.LuaDoString<int>("for i=0,30 do if string.find(TaxiNodeName(i),'Orgrimmar') then return i end end");
    
                                wManager.Wow.Helpers.Lua.LuaDoString("TakeTaxiNode(" + node + ")");
                            }
                        }
                        Thread.Sleep(1000);
                        
                    }
                    
                });
                if (zone != "Orgrimmar")
                {
                    flying.Start();
                }
                else
                if (zone == "Orgrimmar")
                {
                    Logging.Write("[Flight]: has disposed");
                    flying.Abort();
                }
    
            }
        }

     

    Droidz

    Posted

    When you want move you need to be in product thread

    TheSmokie

    Posted

    sorry, i dont follow. isnt using product thread as in while condition ?



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...