Jump to content

reapler

Elite user
  • Posts

    288
  • Joined

  • Last visited

Posts posted by reapler

  1. @Droidz The "MountTask.OnGroundMount()" has a bug which is also connected with the dismount method but i'm not sure if any products will also use it(but i haven't seen anything on Grinder for example).

    All in all you have 16 usages of the dismount method but i think the dismount was used with a true stopmove parameter so the bug could be in "wManager.Wow.Bot.Tasks.MountTask(1)" or "wManager.Wow.Helpers.MovementManager(2)" because it happens also on grinder as well on party product so it could happen not on "ToTown" state for example.

    But it's just an assumption maybe there are also more false OnMount checks.

  2. A raw revision (i wasn't so fastidious):

    Spoiler
    
    using System;
    using robotManager.Helpful;
    using robotManager.Products;
    using wManager.Wow.Class;
    using wManager.Wow.Helpers;
    using wManager.Wow.ObjectManager;
    
    public class Main : ICustomClass
    {
        #region Variables
    
        public float Range { get { return 4.5f; } }
        private bool _isLaunched;
        private ulong _lastTarget;
    
        #endregion
    
    
    
    
        #region WRobot Methods
    
        public void Initialize() // When product started, initialize and launch Fightclass
        {
            _isLaunched = true;
            Logging.Write("Frost DK 7.2.5 initialized.");
            Rotation();
        }
    
        public void Dispose() // When product stopped
        {
            _isLaunched = false;
            Logging.Write("Frost DK 7.2.5 disposed.");
        }
    
        public void ShowConfiguration() // When use click on Fight class settings
        {
    
        }
    
        #endregion
    
    
    
    
        #region Spells
    
        // Buff:
        public Spell PillarofFrost = new Spell("Pillar of Frost");
        public Spell EmpowerRuneWeapon = new Spell("Empower Rune Weapon");
        public Spell HungeringRuneWeapon = new Spell("Hungering Rune Weapon");
        public Spell HornofWinter = new Spell("Horn of Winter");
        public Spell WraithWalk = new Spell("Wraith Walk");
        public Spell AntiMagicShell = new Spell("Anti-Magic Shell");
        public Spell Obliteration = new Spell("Obliteration");
        public Spell IceBoundFortitude = new Spell("Ice Bound Fortitude");
        // Racial Buff:
        public Spell DarkFlight = new Spell("Darkflight");
        public Spell ArcaneTorrent = new Spell("Arcane Torrent");
        public Spell Berserking = new Spell("Berserking");
        public Spell BloodFury = new Spell("Blood Fury");
        public Spell EscapeArtist = new Spell("Escape Artist");
        public Spell EveryManforHimself = new Spell("Every Man for Himself");
        public Spell GiftoftheNaaru = new Spell("Gift of the Naaru");
        public Spell Stoneform = new Spell("Stoneform");
        public Spell WarStomp = new Spell("War Stomp");
        public Spell WilloftheForsaken = new Spell("Will of the Forsaken");
        public Spell Shadowmeld = new Spell("Shadowmeld");
        // Pull:
        public Spell DeathGrip = new Spell("Death Grip");
        public Spell DarkCommand = new Spell("Dark Command");
        // Combat:
        public Spell RemorselessWinter = new Spell("Remorseless Winter");
        public Spell HowlingBlast = new Spell("Howling Blast");
        public Spell Obliterate = new Spell("Obliterate");
        public Spell FrostStrike = new Spell("Frost Strike");
        public Spell Frostscythe = new Spell("Frostscythe");
        public Spell BreathofSindragosa = new Spell("Breath of Sindragosa");
        public Spell SindragosasFury = new Spell("Sindragosa's Fury");
        public Spell GlacialAdvance = new Spell("Glacial Advance");
        public Spell DeathStrike = new Spell("DeathStrike");
    
        #endregion
    
    
    
    
        #region Behavior
    
        internal void Rotation()
        {
            Logging.Write("Frost DK 7.2.5 Rotation Started!");
            while (_isLaunched)
            {
                try
                {
                    if (!Products.InPause)
                    {
                        if (!ObjectManager.Me.IsDeadMe)
                        {
                            BuffRotation();
                            if (Fight.InFight && ObjectManager.Me.Target != 0)
                            {
                                Pull();
                                CombatRotation();
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    Logging.WriteError("Frost DK 7.2.5 Rotation Error:" + e);
                }
            }
        }
    
        internal void BuffRotation()
        {
            if (!ObjectManager.Me.IsMounted)
            {
                if (RemorselessWinter.IsSpellUsable && RemorselessWinter.KnownSpell && ObjectManager.Me.Runes >= 1)
                {
                    RemorselessWinter.Launch();
                }
            }
        }
    
        internal void Pull()
        {
            if (ObjectManager.Me.Target == _lastTarget)
                return;
            if (DarkCommand.KnownSpell && DarkCommand.IsSpellUsable && DarkCommand.IsDistanceGood)
            {
                DarkCommand.Launch();
                _lastTarget = ObjectManager.Me.Target;
            }
            if (DeathGrip.KnownSpell && DeathGrip.IsSpellUsable && DeathGrip.IsDistanceGood)
            {
                DeathGrip.Launch();
                _lastTarget = ObjectManager.Me.Target;
            }
        }
    
        internal void CombatRotation()
        {
            // DeathGrip:
            if (DeathGrip.IsSpellUsable 
                && DeathGrip.IsDistanceGood 
                && DeathGrip.KnownSpell 
                && ObjectManager.Me.IsInGroup)
            {
                DeathGrip.Launch();
            }
    
            // DarkCommand:
            if (DarkCommand.IsSpellUsable 
                && DarkCommand.IsDistanceGood 
                && DarkCommand.KnownSpell)
            {
                DarkCommand.Launch();
                return;
            }
    
            // RemorselessWinter:
            if (RemorselessWinter.IsSpellUsable 
                && RemorselessWinter.KnownSpell 
                && ObjectManager.Me.Runes >= 1)
            {
                RemorselessWinter.Launch();
                return;
            }
    
            // PillarofFrost:
            if (PillarofFrost.IsSpellUsable 
                && PillarofFrost.IsDistanceGood 
                && PillarofFrost.KnownSpell 
                && !BreathofSindragosa.IsSpellUsable)
            {
                PillarofFrost.Launch();
                return;
            }
    
            // PillarofFrost:
            if (PillarofFrost.IsSpellUsable 
                && PillarofFrost.IsDistanceGood 
                && PillarofFrost.KnownSpell 
                && !BreathofSindragosa.IsSpellUsable 
                && ObjectManager.Me.RunicPower == 100 && ObjectManager.Me.Runes == 6)
            {
                PillarofFrost.Launch();
                return;
            }
    
            // Sindragosa'sFury:
            if (SindragosasFury.IsSpellUsable 
                && SindragosasFury.IsDistanceGood 
                && ObjectManager.Me.IsFacing(ObjectManager.Me.TargetObject.Position) 
                && !PillarofFrost.IsSpellUsable 
                && PillarofFrost.HaveBuff
                && ObjectManager.Target.IsBoss)
            {
                SindragosasFury.Launch();
                return;
            }
    
            // BreathofSindragosa:
            if (BreathofSindragosa.IsSpellUsable 
                && BreathofSindragosa.IsDistanceGood 
                && BreathofSindragosa.KnownSpell 
                && ObjectManager.Me.HaveBuff("Pillar of Frost") 
                && ObjectManager.Me.RunicPower == 100 && ObjectManager.Me.Runes == 6)
            {
                BreathofSindragosa.Launch();
                return;
            }
    
            // HowlingBlast:
            if (HowlingBlast.IsSpellUsable 
                && HowlingBlast.IsDistanceGood 
                && HowlingBlast.KnownSpell 
                && ObjectManager.Me.HaveBuff("Breath of Sindragosa") 
                && ObjectManager.Target.HaveBuff("Rime") 
                && !ObjectManager.Me.HaveBuff("Hungering Rune Weapon") 
                && ObjectManager.Me.RunicPower >= 35)
            {
                HowlingBlast.Launch();
                return;
            }
    
            // HowlingBlast:
            if (HowlingBlast.IsSpellUsable 
                && HowlingBlast.IsDistanceGood 
                && HowlingBlast.KnownSpell 
                && ObjectManager.Me.HaveBuff("Rime") 
                && !ObjectManager.Me.HaveBuff("Hungering Rune Weapon") 
                && !ObjectManager.Me.HaveBuff("Breath of Sindragosa"))
            {
                HowlingBlast.Launch();
                return;
            }
    
            // HowlingBlast:
            if (HowlingBlast.IsSpellUsable 
                && HowlingBlast.IsDistanceGood 
                && HowlingBlast.KnownSpell 
                && !ObjectManager.Me.HaveBuff("Hungering Rune Weapon") 
                && !ObjectManager.Me.HaveBuff("Breath of Sindragosa") 
                && ObjectManager.Me.Runes >= 1 
                && !ObjectManager.Target.HaveBuff("Frost Fever"))
            {
                HowlingBlast.Launch();
                return;
            }
    
            // Obliterate:
            if (Obliterate.IsSpellUsable 
                && Obliterate.IsDistanceGood 
                && Obliterate.KnownSpell 
                && ObjectManager.Me.HaveBuff("Killing Machine") 
                && ObjectManager.Me.HaveBuff("Pillar of Frost") 
                && ObjectManager.Me.RunicPower != 100 
                && ObjectManager.Me.Runes != 6 
                && !ObjectManager.Me.HaveBuff("Breath of Sindragosa"))
            {
                Obliterate.Launch();
                return;
            }
    
            // Obliterate:
            if (Obliterate.IsSpellUsable 
                && Obliterate.IsDistanceGood 
                && Obliterate.KnownSpell 
                && ObjectManager.Me.RunicPower != 100 
                && ObjectManager.Me.Runes != 6)
            {
                Obliterate.Launch();
                return;
            }
    
            // HornofWinter:
            if (HornofWinter.IsSpellUsable 
                && HornofWinter.IsDistanceGood 
                && HornofWinter.KnownSpell 
                & ObjectManager.Me.RunicPower <= 80 
                && !HungeringRuneWeapon.HaveBuff
                && BreathofSindragosa.HaveBuff
                && BreathofSindragosa.BuffTimeLeft >= 10000)
            {
                HornofWinter.Launch();
                return;
            }
    
            // HornofWinter:
            if (HornofWinter.IsSpellUsable 
                && HornofWinter.IsDistanceGood 
                && HornofWinter.KnownSpell 
                && ObjectManager.Me.RunicPower <= 80
                && !HungeringRuneWeapon.HaveBuff
                && !BreathofSindragosa.HaveBuff
                && ObjectManager.Me.RunicPower <= 20 
                && ObjectManager.Me.Runes <= 2)
            {
                HornofWinter.Launch();
                return;
            }
    
            // HungeringRuneWeapon:
            if (HungeringRuneWeapon.IsSpellUsable 
                && HungeringRuneWeapon.IsDistanceGood 
                && HungeringRuneWeapon.KnownSpell 
                && ObjectManager.Me.RunicPower <= 35 
                && BreathofSindragosa.HaveBuff
                && !HungeringRuneWeapon.HaveBuff)
            {
                HungeringRuneWeapon.Launch();
                return;
            }
    
            // EmpoweringRuneWeapon:
            if (EmpowerRuneWeapon.IsSpellUsable 
                && EmpowerRuneWeapon.IsDistanceGood 
                && EmpowerRuneWeapon.KnownSpell 
                && ObjectManager.Me.RunicPower <= 35 
                && BreathofSindragosa.HaveBuff
                && !EmpowerRuneWeapon.HaveBuff)
            {
                EmpowerRuneWeapon.Launch();
                return;
            }
    
            // FrostStrike:
            if (FrostStrike.IsSpellUsable 
                && FrostStrike.IsDistanceGood 
                && FrostStrike.KnownSpell 
                && !BreathofSindragosa.HaveBuff
                && BreathofSindragosa.BuffTimeLeft >= 15000
                && ObjectManager.Me.RunicPower <= 75)
            {
                FrostStrike.Launch();
                return;
            }
    
            // IceBoundFortitude:
            if (IceBoundFortitude.IsSpellUsable 
                && IceBoundFortitude.IsDistanceGood 
                && IceBoundFortitude.KnownSpell 
                && ObjectManager.Me.HealthPercent <= 20)
            {
                IceBoundFortitude.Launch();
                return;
            }
    
            // DeathStrike:
            if (DeathStrike.IsSpellUsable 
                && DeathStrike.IsDistanceGood 
                && DeathStrike.KnownSpell 
                && ObjectManager.Me.RunicPower >= 45 
                && ObjectManager.Me.HealthPercent <= 50)
            {
                DeathStrike.Launch();
                return;
            }
    
            // Anti-MagicShell:
            if (AntiMagicShell.IsSpellUsable 
                && AntiMagicShell.IsDistanceGood 
                && AntiMagicShell.KnownSpell 
                && ObjectManager.Me.HealthPercent <= 60 
                && ObjectManager.Target.IsCast)
            {
                AntiMagicShell.Launch();
                return;
            }
    
            // WrathWalk:
            if (WraithWalk.IsSpellUsable && WraithWalk.IsDistanceGood && !ObjectManager.Me.InCombat && ObjectManager.Me.GetMove)
            {
                WraithWalk.Launch();
                return;
            }
    
            // Obliteration:
            if (Obliteration.IsSpellUsable 
                && Obliteration.IsDistanceGood 
                && ObjectManager.Me.HaveBuff("Pillar of Frost"))
            {
                Obliteration.Launch();
                return;
            }
    
            // Frostscythe:
            if (Frostscythe.IsSpellUsable 
                && Frostscythe.IsDistanceGood
                && ObjectManager.Me.IsFacing(ObjectManager.Me.TargetObject.Position)
                && ObjectManager.Me.Runes >= 1 
                //&& ObjectManager.GetWoWUnitHostile().Count(i => i.GetDistance < 8) >= 2
                && ObjectManager.Me.HaveBuff("Killing Machine"))
            {
                Frostscythe.Launch();
                return;
            }
    
            // GlacialAdvance:
            if (GlacialAdvance.IsSpellUsable 
                && GlacialAdvance.IsDistanceGood 
                && ObjectManager.Me.IsFacing(ObjectManager.Me.TargetObject.Position) 
                && ObjectManager.Me.Runes >= 1)
            {
                GlacialAdvance.Launch();
                return;
            }
    
            // DarkFlight:
            if (DarkFlight.IsSpellUsable 
                && DarkFlight.IsDistanceGood 
                && !ObjectManager.Me.InCombat 
                && ObjectManager.Me.GetMove 
                && !WraithWalk.IsSpellUsable)
            {
                DarkFlight.Launch();
                return;
            }
    
            // ArcaneTorrent:
            if (ArcaneTorrent.IsSpellUsable 
                && ArcaneTorrent.IsDistanceGood 
                && ObjectManager.Target.IsCast)
            {
                ArcaneTorrent.Launch();
                return;
            }
    
            // Berserking:
            if (Berserking.IsSpellUsable 
                && Berserking.IsDistanceGood 
                && ObjectManager.Me.InCombat)
            {
                Berserking.Launch();
                return;
            }
    
            // BloodFury:
            if (BloodFury.IsSpellUsable 
                && BloodFury.IsDistanceGood 
                && ObjectManager.Me.InCombat)
            {
                BloodFury.Launch();
                return;
            }
    
            // EscapeArtist:
            if (EscapeArtist.IsSpellUsable 
                && EscapeArtist.IsDistanceGood 
                && ObjectManager.Me.InCombat 
                && ObjectManager.Me.IsStunned)
            {
                EscapeArtist.Launch();
                return;
            }
    
            // EveryManforHimself:
            if (EveryManforHimself.IsSpellUsable 
                && EveryManforHimself.IsDistanceGood 
                && ObjectManager.Me.IsStunned 
                && ObjectManager.Me.InCombat)
            {
                EveryManforHimself.Launch();
                return;
            }
    
            // GiftoftheNaaru:
            if (GiftoftheNaaru.IsSpellUsable 
                && GiftoftheNaaru.IsDistanceGood 
                && ObjectManager.Me.HealthPercent <= 75)
            {
                GiftoftheNaaru.Launch();
                return;
            }
    
            // Stoneform:
            if (Stoneform.IsSpellUsable 
                && Stoneform.IsDistanceGood 
                && ObjectManager.Me.HealthPercent <= 75)
            {
                Stoneform.Launch();
                return;
            }
    
            // WarStomp:
            if (WarStomp.IsSpellUsable 
                && WarStomp.IsDistanceGood 
                && ObjectManager.Target.IsCast 
                && ObjectManager.Me.InCombat)
            {
                WarStomp.Launch();
                return;
            }
    
            // WilloftheForsaken:
            if (WilloftheForsaken.IsSpellUsable 
                && WilloftheForsaken.IsDistanceGood 
                && ObjectManager.Me.HealthPercent <= 100 
                && !ObjectManager.Me.InCombat 
                & ObjectManager.Target.Health == 0)
            {
                WilloftheForsaken.Launch();
                return;
            }
    
            // Shadowmeld:
            if (Shadowmeld.IsSpellUsable 
                && Shadowmeld.IsDistanceGood 
                && ObjectManager.Me.HealthPercent <= 20 
                && !ObjectManager.Me.GetMove 
                && ObjectManager.Me.InCombat)
            {
                Shadowmeld.Launch();
                return;
            }
    
    
        }
    
        #endregion
    
    }

     

     

  3. Hello, @King Smilie you can decompile the libraries from \WRobot\Bin.

    Here explained:

     

    This is how it looks like from dotpeek

    Spoiler

    decompiler.thumb.JPG.73941704556dd9f5c29906ff0b2a8f23.JPG

    You can also use every other .net decompiler mentioned in the other posts.

    I also recommend to use some extensions for Visual Studio(also in the posts) it has a free trial and it helped me alot to understand c#.

    Edit:

    I looked into your fightclass. You should use Visual Studio, if you are going to continue writing in c#.

    It can show you immediately what's wrong with your code while you are writing it and it has many many other features to assist you.

  4. Hello, you can use the event "UNIT_COMBAT" in conjunction with "wManager.Wow.Helpers.EventsLuaWithArgs.OnEventsLuaWithArgs":

                wManager.Wow.Helpers.EventsLuaWithArgs.OnEventsLuaWithArgs += delegate (LuaEventsId id, List<string> args)
                {
                    if (id == LuaEventsId.UNIT_COMBAT && args[0] == "TARGET" && args[1] == "WOUND")
                    {
                        //your code
                    }
                };

    I belive the arguments are right. You just need to setup timer & get actual attack speed.

  5. I belive you need to write some beloved c# code. You could add a spell in the fightclass editor & set it as c#:

            if (wManager.Statistics.RunningTimeInSec() < 2)
            {
                robotManager.Helpful.Logging.Write("Register OnFightStart");
                wManager.Events.FightEvents.OnFightStart += delegate(WoWUnit unit, CancelEventArgs cancelable)
                {
                    if ((int) unit.Reaction < 3)
                    {
                        cancelable.Cancel = true;
                    }
                };
                System.Threading.Thread.Sleep(2000);
            }

    it will cancel all starting fights if unit is unfriendly or hostile. But i'm not sure how it will work in bg.

  6. Hello again, i have to inform you that you unfortunately cannot access Automaton.Bot.AutomatonSetting. My first thought was, it would be like on the grinder bot which granted me access to profiles & everything else.

    The thread related code would work as well loading the different products.

    Under this circumstances you have a few options:

    -to use WRotation and a plugin to block the fightevents til you allow access (but you need to write the own behavior like to move on random vector3 & attack specific npcs)

    -use xml writer to override the settings which you need & reload the product while using the plugin to start & stop

     

    I think the second option would easier to implement. If i have time, i can look after the writer.

     

    Edit: This is how you can use the threadmanager & cachemanager(without xml writer) but a bit unclean

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Runtime.Caching;
    using robotManager.Helpful;
    using robotManager.Products;
    using wManager.Plugin;
    using wManager.Wow.Enums;
    using wManager.Wow.Helpers;
    using Timer = robotManager.Helpful.Timer;
    
    public class Main : IPlugin
    {
        #region Variables
    
        private ThreadManager _threadManager = new ThreadManager();
    
        #endregion
    
    
    
    
        #region Classes
    
        public class CacheManager
        {
            public static void SaveTocache(string cacheKey, object savedItem, DateTime absoluteExpiration)
            {
                if (!IsIncache(cacheKey))
                {
                    MemoryCache.Default.Add(cacheKey, savedItem, absoluteExpiration);
                }
                else
                {
                    MemoryCache.Default.Set(cacheKey, savedItem, absoluteExpiration);
                }
            }
    
            public static T GetFromCache<T>(string cacheKey) where T : class
            {
                return MemoryCache.Default[cacheKey] as T;
            }
    
            public static void RemoveFromCache(string cacheKey)
            {
                MemoryCache.Default.Remove(cacheKey);
            }
    
            public static bool IsIncache(string cacheKey)
            {
                return MemoryCache.Default[cacheKey] != null;
            }
    
            public static bool IsIncache(Action method)
            {
                return MemoryCache.Default[method.Method.Name] != null;
            }
        }
    
        public class ThreadManager
        {
            public int TableId = 1;
            Dictionary<string, Thread> _threads = new Dictionary<string, Thread>();
    
            /// <summary>
            /// Starts a thread
            /// </summary>
            /// <param name="method">The method to start on</param>
            /// <param name="threadName">Define thread name</param>
            /// <param name="cache">Write thread also to memory cache</param>
            /// <param name="cacheExpiration">when the cache expires in memory (not on current instance!)</param>
            public void Start(Action method, string threadName, bool cache = false, DateTime cacheExpiration = default(DateTime))
            {
                if (!cache)
                {
                    if (!_threads.ContainsKey(threadName))
                    {
                        Thread Thread = new Thread(() => method());
                        Thread.Name = Convert.ToString(TableId);
                        Thread.Start();
                        _threads.Add(threadName, Thread);
                        Logging.Write("Start Thread " + threadName + ".");
                    }
                    else
                    {
                        Logging.Write("Thread " + threadName + " already executed.");
                    }
                }
                else
                {
                    if (!CacheManager.IsIncache(threadName))
                    {
                        Thread Thread = new Thread(() => method());
                        Thread.Name = Convert.ToString(TableId);
                        Thread.Start();
                        if (cacheExpiration == default(DateTime))
                        {
                            CacheManager.SaveTocache(threadName, Thread, DateTime.Now.AddMinutes(30));
                            Logging.Write("Start Thread " + threadName + ".\nExpires at " + DateTime.Now.AddMinutes(30));
                        }
                        else
                        {
                            CacheManager.SaveTocache(threadName, Thread, cacheExpiration);
                            Logging.Write("Start Thread " + threadName + ".\nExpires at " + cacheExpiration);
                        }
                    }
                    else
                    {
                        Logging.Write("Thread " + threadName + " already executed.");
                    }
                }
            }
    
            /// <summary>
            /// Starts a thread
            /// </summary>
            /// <param name="method">The method to start on</param>
            /// <param name="cache">Write thread also to memory cache</param>
            /// <param name="cacheExpiration">when the cache expires in memory (not on current instance!)</param>
            public void Start(Action method, bool cache = false, DateTime cacheExpiration = default(DateTime))
            {
                if (!cache)
                {
                    if (!_threads.ContainsKey(method.Method.Name))
                    {
                        Thread Thread = new Thread(() => method());
                        Thread.Name = Convert.ToString(TableId);
                        Thread.Start();
                        _threads.Add(method.Method.Name, Thread);
                        Logging.Write("Start Thread " + method.Method.Name + ".");
                    }
                    else
                    {
                        Logging.Write("Thread " + method.Method.Name + " already executed.");
                    }
                }
                else
                {
                    if (!CacheManager.IsIncache(method.Method.Name))
                    {
                        Thread Thread = new Thread(() => method());
                        Thread.Name = Convert.ToString(TableId);
                        Thread.Start();
                        if (cacheExpiration == default(DateTime))
                        {
                            CacheManager.SaveTocache(method.Method.Name, Thread, DateTime.Now.AddMinutes(30));
                            Logging.Write("Start Thread " + method.Method.Name + ".\nExpires at " + DateTime.Now.AddMinutes(30));
                        }
                        else
                        {
                            CacheManager.SaveTocache(method.Method.Name, Thread, cacheExpiration);
                            Logging.Write("Start Thread " + method.Method.Name + ".\nExpires at " + cacheExpiration);
                        }
                    }
                    else
                    {
                        Logging.Write("Thread " + method.Method.Name + " already executed.");
                    }
                }
            }
    
            /// <summary>
            /// Aborts a thread
            /// </summary>
            /// <param name="threadName">Define thread name</param>
            /// <param name="cache">Determine whether if thread on cache</param>
            public void Abort(string threadName, bool cache = false)
            {
                if (!cache)
                {
                    if (_threads.ContainsKey(threadName))
                    {
                        _threads[threadName].Abort();
                        _threads.Remove(threadName);
                        Logging.Write("Abort Thread " + threadName + ".");
                    }
                }
                else
                {
                    if (CacheManager.IsIncache(threadName))
                    {
                        CacheManager.GetFromCache<Thread>(threadName).Abort();
                        CacheManager.RemoveFromCache(threadName);
                        Logging.Write("Abort Thread " + threadName + ".");
                    }
                    else
                    {
                        Logging.Write("Thread " + threadName + "could not be found in cache.");
                    }
                }
            }
    
            /// <summary>
            /// Aborts a thread
            /// </summary>
            /// <param name="method">The method which was associated with the thread</param>
            /// <param name="cache">Determine whether if thread on cache</param>
            public void Abort(Action method, bool cache = false)
            {
                if (!cache)
                {
                    if (_threads.ContainsKey(method.Method.Name))
                    {
                        _threads[method.Method.Name].Abort();
                        _threads.Remove(method.Method.Name);
                        Logging.Write("Abort Thread " + method.Method.Name + ".");
                    }
                }
                else
                {
                    if (CacheManager.IsIncache(method.Method.Name))
                    {
                        CacheManager.GetFromCache<Thread>(method.Method.Name).Abort();
                        CacheManager.RemoveFromCache(method.Method.Name);
                        Logging.Write("Abort Thread " + method.Method.Name + ".");
                    }
                    else
                    {
                        Logging.Write("Thread " + method.Method.Name + "could not be found in cache.");
                    }
                }
            }
        }
    
        #endregion
    
    
    
    
        #region WRobot Methods
    
        public void Initialize()
        {
    
        }
    
        public void Dispose()
        {
    
        }
    
        public void Settings()
        {
            if (!CacheManager.IsIncache("Thread1"))
            {
                _threadManager.Start(Thread1, true, DateTime.Now.AddMinutes(60));
                CacheManager.SaveTocache("EventsLuaWithArgsOnOnEventsLuaWithArgs", _handler, DateTime.Now.AddMinutes(60));
                EventsLuaWithArgs.OnEventsLuaWithArgs += CacheManager.GetFromCache<EventsLuaWithArgs.EventsLuaWithArgsHandler>("EventsLuaWithArgsOnOnEventsLuaWithArgs");
            }
            else
            {
                Logging.Write("Dispose");
                EventsLuaWithArgs.OnEventsLuaWithArgs -= CacheManager.GetFromCache<EventsLuaWithArgs.EventsLuaWithArgsHandler>("EventsLuaWithArgsOnOnEventsLuaWithArgs");
                CacheManager.RemoveFromCache("EventsLuaWithArgsOnOnEventsLuaWithArgs");
                _threadManager.Abort(Thread1, true);
            }
        }
    
        #endregion
    
    
    
    
        #region Handler
        
        private EventsLuaWithArgs.EventsLuaWithArgsHandler _handler = delegate (LuaEventsId id, List<string> args)
        {
            if (id == LuaEventsId.EXECUTE_CHAT_LINE)
            {
                Logging.Write(args[0]);
                if (args[0] == "/start")
                {
                    Products.LoadProducts("Automaton");
                    Products.ProductStart();
                }
                if (args[0] == "/stop")
                {
    
                    Products.ProductStop();
                    //need to resubscribe events
                    EventsLuaWithArgs.OnEventsLuaWithArgs -= CacheManager.GetFromCache<EventsLuaWithArgs.EventsLuaWithArgsHandler>("EventsLuaWithArgsOnOnEventsLuaWithArgs");
                    EventsLuaWithArgs.OnEventsLuaWithArgs += CacheManager.GetFromCache<EventsLuaWithArgs.EventsLuaWithArgsHandler>("EventsLuaWithArgsOnOnEventsLuaWithArgs");
                }
            }
        };
    
        #endregion
    
    
    
    
        #region Threads
    
        public void Thread1()
        {
            var timer = new Timer(1000);
            timer.ForceReady();
            Logging.Write("Initialized Thread1");
            while (true)
            {
                try
                {
                    if (timer.IsReady)
                    {
                        Logging.Write("Pulse");
                        timer.Reset();
                    }
                }
                catch (Exception e)
                {
                    Logging.WriteError(e.ToString());
                }
                Thread.Sleep(30);
            }
        }
    
        #endregion
    }

     

  7. A nice thought to use the automaton for this task. But i agree it would be much work to make it happen. By your plugin you could use "Automaton.Bot.AutomatonSetting.CurrentSetting.ObjectNpcHarvest" to add npcs(you must add new line for each name: \n). But at first you must load the product in order to access it. If you have written the names to the settings you must save them.

    So you could design the tool as plugin or maybe customprofile(start thread only from clicking on settings or even make a winform gui if you need to adjust something or add start/stop buttons).

     

    Stuff that may help you(doesn't include things what i've already mentioned on other posts):

     

    load/switch product: 

    https://wrobot.eu/forums/topic/5507-changing-botbase/

     

    execute macro & other relevant tasks: 

        public void Settings()
        {
    	//start thread1 with the classes i presented on the other post
        }
    
    
    
        public void Thread1
        {
    	//other things to initialize
    	EventsLuaWithArgs.OnEventsLuaWithArgs += EventsLuaWithArgsOnOnEventsLuaWithArgs; //don't forget to unsubscribe if you abort your thread (-=)
    
    
    	
    	//add here while loop if needed
    
        }
    
    
    
        private void EventsLuaWithArgsOnOnEventsLuaWithArgs(LuaEventsId id, List<string> args)
        {
            if (id == LuaEventsId.EXECUTE_CHAT_LINE)
            {
                robotManager.Helpful.Logging.Write(args[0]);//if a macro is pressed or something on chat line is printed
          
          
          
          		if (args[0] == "/add target")//   "/add target"  your macro ingame to add targets
          		{
          			//get npc name by "ObjectManager.Me.TargetObject.Name" and save string variable somewhere
          			//add new entries like this: namestokill + "\n" + newname
          			//load product, configure settings with your npcname, save
          		}
          
          		if (args[0] == "/clear targetlist")
          		{
          			//clears your string variable
          		}
          
          		if (args[0] == "/startfarm")
          		{
          			//load product, start product
          		}
          
    		
    		//you can also stop automatically the product if a certain condition is met on the while loop on thread1
                	if (args[0] == "/stopfarm")
          		{
          			//stop product
          			
          		}
          
            }
        }

     

  8. Hello, you could try this as c# code in your fightclass:

            if (wManager.Statistics.RunningTimeInSec() < 2)
            {
                robotManager.Helpful.Logging.Write("Register OnLootSuccessful");
                wManager.Events.LootingEvents.OnLootSuccessful += delegate(WoWUnit unit)
                {
                    //task because with thread sleep you would block the thread
                    Task.Run(async delegate
                    {
                        await System.Threading.Tasks.Task.Delay(2000);//your delay
                        wManager.Wow.Helpers.SpellManager.CastSpellByNameLUA("Prowl");
                    });
                };
                System.Threading.Thread.Sleep(2000);//to initialize event only once on startup
            }

    So it will cast prowl everytime after you have looted the unit. You can also extend it to do something other after loot if you want.

    But i think @eeny's solution would also work with less effort :) just want to show the other possibility.

  9. I would write a plugin & register a few events, so you can control your character & block actions from the bot itself or execute your own behavior.

    This is how it could look like (not tested):

        private bool _died;
    
        private List<string> _WaitonContinent = new List<string>
        {
            "Netherstorm",
            "otherzones"
        };
    
    
        public void Initialize()//method from WRobot's plugin interface
        {
            MovementEvents.OnMovementPulse += MovementEventsOnOnMovementPulse;
            EventsLua.AttachEventLua(LuaEventsId.PLAYER_DEAD, m => Event_PLAYER_DEAD());
            //...
        }
    
        public void Dispose()//method from WRobot's plugin interface
        {
            MovementEvents.OnMovementPulse -= MovementEventsOnOnMovementPulse;
        }
        
        private void MovementEventsOnOnMovementPulse(List<Vector3> points, CancelEventArgs cancelable)
        {
            if (_died && ObjectManager.Me.Position.DistanceZ(ObjectManager.Me.PositionCorpse) > 250)//use spirit healer if corpse has a z-distance over 250
            {
                wManagerSetting.CurrentSetting.UseSpiritHealer = true;
                if (_WaitonContinent.Contains(Usefuls.MapZoneName))//check if it is correct you can either use .SubMapZoneName
                {
                    robotManager.Helpful.Logging.Write("We are in zone "+Usefuls.MapZoneName + "\n=>Wait");
                    wManagerSetting.CurrentSetting.WaitResurrectionSickness = true;
                }
                cancelable.Cancel = true;
                _died = false;
            }
            if (wManager.Wow.ObjectManager.ObjectManager.Me.IsValid &&
                wManager.Wow.ObjectManager.ObjectManager.Me.IsAlive &&
                !wManager.Wow.ObjectManager.ObjectManager.Me.HaveBuff(15007) &&
                wManagerSetting.CurrentSetting.WaitResurrectionSickness)
            {
                Thread.Sleep(1000);
                wManagerSetting.CurrentSetting.WaitResurrectionSickness = false;
            }
        }
        
        public void Event_PLAYER_DEAD()
        {
            _died = true;
        }

     

  10. Hello it is possible, but you need to create an extra thread to run your plugin because if the product is stopped it will also dispose your plugin(you also need to write it to memorycache). So you could do different tasks while product is stopped like changing product or i guess even the profile and the other stuff you have mentioned. But it costs work :)

    You can find the thread & cache manager under this post:

    Usage:

    	//...
    	public void Initialize()//method from WRobot plugin interface
        {
            ThreadManager threadManager = new ThreadManager();
            if (!threadManager.CacheManager_.IsIncache("Pulse"))
            {
                new ThreadManager().Start(Pulse, true, DateTime.Now.AddMinutes(30));
            }
    	}
    	//...
    
    
        public void Pulse()
        {
            robotManager.Helpful.Logging.Write("Initialized");
    
            //...things you want to initialize
    
    
            var timer = new robotManager.Helpful.Timer(1000);
            timer.ForceReady();
            while (true)
            {
                try
                {
                    if (Conditions.ProductIsStartedNotInPause
                        && Conditions.InGameAndConnected
                        && timer.IsReady)
                    {
                        robotManager.Helpful.Logging.Write("Pulse");
    
                        //...on pulse
    
                        timer.Reset();
                    }
                }
                catch (Exception e)
                {
                    robotManager.Helpful.Logging.WriteError(e.ToString());
                }
                Thread.Sleep(30);
            }
        }
        
    

     

    Edit:

    Important: if the mentioned code will be used to change settings it can fail on specific products(automaton is known after some researches)

  11. Hello, for your two tasks you need the objectmanager.

    To talk and select a gossip you can use this in your runcode step:

                //single can be here used because it's unlikely happen that the picked npc is existing more than one time
                WoWUnit toTalk =
                    wManager.Wow.ObjectManager.ObjectManager.GetObjectWoWUnit()
                        .SingleOrDefault(i => i.Name == "YOURNPCNAME");
                if (toTalk != null)
                {
                    wManager.Wow.Bot.Tasks.GoToTask.ToPositionAndIntecractWithNpc(toTalk.Position, toTalk.Entry, 1);  //1=the gossip you want to select
                }

     

    For your second task you need to find the entry for your lever. You can use the Development tools which you find in WRobot window under the "Tools" tab.

    Now go close as possible to the lever and click "Dump all informations". A new tab in your browser opens with all wowobjects. Now you need to search for the closest WoWGameObject. If you have found it make sure it is that object: the distance should be under 5yrds & maybe a name is also printed like lever, trigger or something else.

     

    To use the object you can use this in your next step:

                WoWGameObject lever = wManager.Wow.ObjectManager.ObjectManager.GetObjectWoWGameObject().FirstOrDefault(i => i.Entry == YOURENTRY);
                if (lever != null)
                {
                    wManager.Wow.Helpers.Interact.InteractGameObject(lever.GetBaseAddress);
                }

     

    You may also look for some other dungeons profile if you haven't done yet.

    For reseting you can take a look there:

     

  12. @yesimbestworld So i trimmed the c# code everything worked fine on 3.3.5a dunno what's wrong on 5.4.8 but now it's more simpler to find the error if one will occure: mw.xml

    Try only '/cast Healing Sphere' in your macro(it will now only cast on target). If that method still fails, i'm not able to say what's not working exactly on your expansion.

    Otherwise you may disable addons, plugins or even backup & reset your settings in WRobot.

  13. Hello you can try this one: mw.xml

    I tested it on 3.3.5a but it should also work for 5.4. I've written an own method to cast on position.

    The result: you see the green circle almost never.

    There can be more improvements to this code, like to read the input string & check the content. But for this purpose it's enough.

     

    How the code look like:

                                
            if (wManager.Statistics.RunningTimeInSec() < 2)
            {
                robotManager.Helpful.Logging.Write("Register OnEventsLuaWithArgs");
                wManager.Wow.Helpers.EventsLuaWithArgs.OnEventsLuaWithArgs += delegate (wManager.Wow.Enums.LuaEventsId id, System.Collections.Generic.List<string> args)
                {
                    if (id == wManager.Wow.Enums.LuaEventsId.EXECUTE_CHAT_LINE)
                    {
                        string spellName = "Healing Sphere";
                        if (args[0].ToUpper().Equals(("/cast @player " + spellName).ToUpper()))
                        {
                            var t = System.Threading.Tasks.Task.Run(async delegate
                            {
                                System.Threading.Thread.Sleep(3);
                                wManager.Wow.Helpers.ClickOnTerrain.Pulse(wManager.Wow.ObjectManager.ObjectManager.Me.Position);
                                System.Threading.Thread.Sleep(2);
                                wManager.Wow.Helpers.ClickOnTerrain.Pulse(wManager.Wow.ObjectManager.ObjectManager.Me.Position);
                            });
                            wManager.Wow.Helpers.SpellManager.CastSpellByNameOn(spellName, "");
                        }
                        if (args[0].ToUpper().Equals(("/cast @target " + spellName).ToUpper()))
                        {
                            if (wManager.Wow.ObjectManager.ObjectManager.Me.Target != 0)
                            {
                                var t = System.Threading.Tasks.Task.Run(async delegate
                                {
                                    System.Threading.Thread.Sleep(3);
                                    wManager.Wow.Helpers.ClickOnTerrain.Pulse(wManager.Wow.ObjectManager.ObjectManager.Me.TargetObject.Position);
                                    System.Threading.Thread.Sleep(2);
                                    wManager.Wow.Helpers.ClickOnTerrain.Pulse(wManager.Wow.ObjectManager.ObjectManager.Me.TargetObject.Position);
                                });
                                wManager.Wow.Helpers.SpellManager.CastSpellByNameOn(spellName, "");
                            }
                        }
                        if (args[0].ToUpper().Equals(("/cast @focus " + spellName).ToUpper()))
                        {
                            if (wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid != 0)
                            {
                                var t = System.Threading.Tasks.Task.Run(async delegate
                                {
                                    System.Threading.Thread.Sleep(3);
                                    wManager.Wow.Helpers.ClickOnTerrain.Pulse(wManager.Wow.ObjectManager.ObjectManager.Me.FocusObj.Position);
                                    System.Threading.Thread.Sleep(2);
                                    wManager.Wow.Helpers.ClickOnTerrain.Pulse(wManager.Wow.ObjectManager.ObjectManager.Me.FocusObj.Position);
                                });
                                wManager.Wow.Helpers.SpellManager.CastSpellByNameOn(spellName, "");
                            }
                        }
                        if (args[0].ToUpper().Equals(("/cast @party1 " + spellName).ToUpper()))
                        {
                            string toParse =
                                wManager.Wow.Helpers.Lua.LuaDoString("guid = UnitGUID('party1')", "guid")
                                    .Replace("x", string.Empty);
                            ulong guid = ulong.Parse(toParse, System.Globalization.NumberStyles.HexNumber, null);
                            if (guid != 0)
                            {
                                Vector3 objPosition =
                                    wManager.Wow.ObjectManager.ObjectManager.GetObjectByGuid(guid).Position;
                                var t = System.Threading.Tasks.Task.Run(async delegate
                                {
                                    System.Threading.Thread.Sleep(3);
                                    wManager.Wow.Helpers.ClickOnTerrain.Pulse(objPosition);
                                    System.Threading.Thread.Sleep(2);
                                    wManager.Wow.Helpers.ClickOnTerrain.Pulse(objPosition);
                                });
                                wManager.Wow.Helpers.SpellManager.CastSpellByNameOn(spellName, "");
                            }
                        }
                        if (args[0].ToUpper().Equals(("/cast @party2 " + spellName).ToUpper()))
                        {
                            string toParse =
                                wManager.Wow.Helpers.Lua.LuaDoString("guid = UnitGUID('party2')", "guid")
                                    .Replace("x", string.Empty);
                            ulong guid = ulong.Parse(toParse, System.Globalization.NumberStyles.HexNumber, null);
                            if (guid != 0)
                            {
                                Vector3 objPosition =
                                    wManager.Wow.ObjectManager.ObjectManager.GetObjectByGuid(guid).Position;
                                var t = System.Threading.Tasks.Task.Run(async delegate
                                {
                                    System.Threading.Thread.Sleep(3);
                                    wManager.Wow.Helpers.ClickOnTerrain.Pulse(objPosition);
                                    System.Threading.Thread.Sleep(2);
                                    wManager.Wow.Helpers.ClickOnTerrain.Pulse(objPosition);
                                });
                                wManager.Wow.Helpers.SpellManager.CastSpellByNameOn(spellName, "");
                            }
                        }
                    }
                };
                System.Threading.Thread.Sleep(2000);
            }

     

     

    And in-game you just make a macro like this to use:

    macro.JPG.71024da4b4ee96a39c9642c3d18a799f.JPG

    You can also replace '@target' with

    '@player'

    '@focus'

    '@party1'

    '@party2'

     

    Edit: updated fightclass & @OP it did work after WRobot update if someone is interested

  14. @nate11I've researched a bit more i guess i need to lookup some more lua functions which are also used for some WRobot properties.

    In short: my fault was to belive that it really get the desired value from api ;)

    I looked a bit at the api documentation & the offsets should be ok in wManager. For example UnitInParty("unit") if used on player:

    Quote

    Observed in 2.0.3: UnitInParty("player") always returns true. Even when you are not in a party. Assumed reason being: you are always in your own party (of at least one, yourself.)

     

  15. @forerun the guids in tbc are in ulong = UInt64.

    But i recommend to override the focus guid like @Droidz mentioned in another post & write it back.

    I see no reason why not to use it while focus is still working(it's already built in every expansion in wManager.dll so you don't need to write offsets for each one).

    This is how it looks like:

        public bool CastSpell(string name, wManager.Wow.ObjectManager.WoWObject obj)
        {
            if (!string.IsNullOrWhiteSpace(name) && obj != null)
            {
                var tmp = wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid;
                wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid = obj.Guid;
                new wManager.Wow.Class.Spell(name).Launch(false, false, false, "focus");
                wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid = tmp;
                return true;
            }
            return false;
        }

    usage:

    //closest player
    CastSpell("Flash of Light", wManager.Wow.ObjectManager.ObjectManager.GetNearestWoWPlayer(wManager.Wow.ObjectManager.ObjectManager.GetObjectWoWPlayer()));
    
    //target
    CastSpell("Flash of Light", wManager.Wow.ObjectManager.ObjectManager.Me.TargetObject);

     

     

     

    For someone who also needs a method for getting the WoWObject by LuaUnitId (can be used then for other things):

    public WoWObject GetWoWObjectByLuaUnitId(string luaUnitId)
    {
        ulong guid;
        if (!string.IsNullOrWhiteSpace(luaUnitId) && ulong.TryParse(wManager.Wow.Helpers.Lua.LuaDoString("guid = UnitGUID('" + luaUnitId + "')", "guid").Replace("x", string.Empty), System.Globalization.NumberStyles.HexNumber, null, out guid))
        	return wManager.Wow.ObjectManager.ObjectManager.GetObjectByGuid(guid);
        return new wManager.Wow.ObjectManager.WoWObject(0);
    }

    usage:

    //can be used for any unit => http://wowwiki.wikia.com/wiki/UnitId
    //get target position from object
    Logging.Write(GetWoWObjectByLuaUnitId("target").Position.ToString());
    
    //get mouseover guid from object
    Logging.Write(GetWoWObjectByLuaUnitId("mouseover").Guid.ToString());
    
    //get arena1 maxlevel by descriptor field
    Logging.Write((GetWoWObjectByLuaUnitId("arena1") as wManager.Wow.ObjectManager.WoWPlayer)?.GetDescriptorAddress(Descriptors.PlayerFields.Maxlevel).ToString());

     

  16. Ok. I have setup everything for tbc: so far i can assume that raidmember or party methods / properties from wManager doesn't work correctly on 2.4.3(got raidmemberlist while not in raid, true on various party getter while not in party and so on) this is also the reason why the cast method doesn't work ;(

    I will maybe report it to the bugtracker while i rewrite it with more lua values hehe

    And thanks for your feedback.

     

    Edit: it seems like the one lua function itself returning different values from 2.4.3 to 3.3.5a

×
×
  • Create New...