Jump to content

Seminko

Members
  • Posts

    225
  • Joined

  • Last visited

Posts posted by Seminko

  1. 1 hour ago, Matenia said:

    You absolutely NEED to do this during on the OnFightLoop and cancel all other events.

    How do I cancel all other events?

    I tried cancelable.Cancel = true within my OnFightLoop and I'm not 100% convinced it cancelled my main fight loop.

    God damn, I'm totally lost :-D

    EDIT: the thing is, if we do this (WoWUnit mainTarget = attackers.Where(u => u.HealthPercent == attackers.Min(x => x.HealthPercent)).FirstOrDefault();) inside an OnFightLoop it will "forget" the poly target, won't it? Because it will get redefined everytime it loops...

  2. Well the way I understand it is that if you don't use OnFightLoop and you call InteractGameObject and it instantly switches back to the original target, the one bot decided to target.

    I can polymorph a mob but it will keep it targetted until it dies despite InteractGameObject switching to a different target.

    So if the bot targets MOB1 and you InteractGameObject with MOB2 and cast Poly, it might work. But if the bot targets MOB1 and you poly MOB1, it will keep switching between MOB2 and MOB1.

    I guess it could work if polytarget was NOT my original target.

  3. Right, so based on my previous experience with moving after frostnova I now know tha for something like this I will need FightEvents.OnFightLoop.

    The idea is simple, however with my limited knowledge of CSharp I was not able to make this work reliably and/or as smooth as I would like to.

    The scripting language I'm familiar with is AutoIt and if I was using that I would grab the attacking units, put them into an array, polymorph the second, make the script remember which mob index I polymorphed and go back to any other index. Or grab all the mobs attacking me into an array, polymorph any of them really, probably the one that I have targetted to make it simple, and then do a for loop to loop through them all and check for unit.HaveBuff("Polymorph"), find the first that doesn't have it and attack.

    I have tried several versions but I always hit a brick wall due to my CSharp ignorance.

    Here's my total pseudo code (don't laugh too hard, or do :-D ) that works but only somewhat. It correctly casts poly, switches target but unfortunately once the target is dead the bot doesn't start fighting with the polymorphed mob. Despite being in combat it considers itself not fighting and tries to move on. The worst scenario is when I have 'Pause if player nearby' selected, once I kill the non-poly mob and player is nearby, it stops, sits there and takes the punishment from the recently unpolymorphed mob.

    Spoiler
    
    		var unitsAffectingMyCombat = ObjectManager.GetUnitAttackPlayer();
    		if (unitsAffectingMyCombat.Count == 2) // if there are two attackers then do...
    		{	
    			Logging.Write("START COMBAT ROTATION FIRST IF STATEMENT");
    			
    			SpellManager.CastSpellByNameLUA("Polymorph"); // cast poly
    			
    			// wait until one mob has poly and set it as var unitsWithPoly
    			var unitsWithPoly = unitsAffectingMyCombat.Where(u => u != null && u.IsValid && u.HaveBuff("Polymorph")).ToList();
    			var unitToAttackPoly = unitsWithPoly.OrderBy(unitLow => unitLow.HealthPercent).FirstOrDefault();
    			while (unitsWithPoly.Count == 0)
    			{
    				unitsWithPoly = unitsAffectingMyCombat.Where(u => u != null && u.IsValid && u.HaveBuff("Polymorph")).ToList();
    				unitToAttackPoly = unitsWithPoly.OrderBy(unitLow => unitLow.HealthPercent).FirstOrDefault();
    				Thread.Sleep(1000);
    				Logging.Write("WAITING FOR POLY");
    			}
    			
    			int countWithPoly = unitsWithPoly.Count;
    			string countWithPolyString = countWithPoly.ToString();
    			Logging.Write("unitsWithPoly = " + countWithPolyString);
    			
    			// check how many mobs DO NOT have poly and pick one with lower HP
    			var unitsAttackMe = unitsAffectingMyCombat.Where(u => u != null && u.IsValid && !u.HaveBuff("Polymorph")).ToList();
    			var unitToAttack = unitsAttackMe.OrderBy(unitLow => unitLow.HealthPercent).FirstOrDefault();
    			
    			int countOrigo = unitsAttackMe.Count;
    			string countOrigoString = countOrigo.ToString();
    			Logging.Write("unitsAttackMe = " + countOrigoString);
    			
    			// at this point there is one mob with poly and one mob without poly
    			
    			FightEvents.OnFightLoop += (unit, cancelable) => {
    				Logging.Write("LOOP");
    				if (unitToAttack != null && unitToAttack.IsValid && unitToAttack.IsAlive && !unitToAttack.IsMyTarget) // if the mob without poly is not my target, switch to it
    				{
    					Interact.InteractGameObject(unitToAttack.GetBaseAddress, !ObjectManager.Me.GetMove);
    					cancelable.Cancel = true;
    				}
    				else if ((unitToAttack == null || !unitToAttack.IsValid || !unitToAttack.IsAlive) && unitToAttackPoly != null && unitToAttackPoly.IsValid && unitToAttackPoly.IsAlive  && !unitToAttackPoly.IsMyTarget) // if the mob without poly is dead and the mob with poly is alive start fighting with it.
    				{
    					Interact.InteractGameObject(unitToAttackPoly.GetBaseAddress, !ObjectManager.Me.GetMove);
    					Fight.StartFight(unitToAttackPoly.GetBaseAddress);
    					cancelable.Cancel = true;
    				}
    			};
    		}

     

    There must be a clean way to do this.

  4. Everytime I grind with my mage this error occurs. I go in, start casting and one of three things happens:

    1. I lock onto a target, start casting frostbolt and once it's in the air the bot switches targets. If there are no mobs within the frostbolt range, it's fine, bot switches targets back.
    2. I lock onto a target, start casting frostbolt and once it's in the air the bot switches targets. If a mob is within range, it doesn't switch back and pulls another mob.
    3. I lock onto a target, start casting frostbolt and even before it shoots the bot switches targets. If a mob is within range, it doesn't switch back and pulls another mob.

    I've googled and tried installing SlimDX. Didn't help.

    Is there a way to manually increase the time before the bot considers a mob bugged?

    Spoiler
    Quote

    22:18:21 - [Fight] Player Attack Zhevra Courser (lvl 20)
    [D] 22:18:31 - [Fight] Mob seem bugged
    22:18:31 - [Fight] Can't reach Zhevra Courser, blacklisting it.
    22:18:31 - [Fight] Player Attack Zhevra Courser (lvl 21)
    [D] 22:18:32 - [Fight] Player attacked by other unit, skip this fight.
    22:18:32 - [Fight] Player Attacked by Zhevra Courser (lvl 20)
    22:18:45 - [Regen] Started
    22:18:46 - [Regen] Use drink Conjured Purified Water
    22:19:03 - [Regen] Finished
    22:19:03 - [Security] Player Nearby(Rekah since 9 sec (total time near since bot started)), pause bot
    22:19:03 - [Pause] started
    22:19:19 - [Security] No Player Nearby, unpause bot
    22:19:19 - [Pause] Stoped
    22:19:20 - [Fight] Player Attack Zhevra Courser (lvl 21)
    22:19:43 - [Looting] Loot Zhevra Courser
    22:19:44 - [Fight] Player Attack Zhevra Courser (lvl 20)
    [D] 22:19:51 - [Fight] Mob seem bugged
    22:19:52 - [Fight] Can't reach Zhevra Courser, blacklisting it.
    22:19:52 - [Fight] Player Attack Thunderhead (lvl 21)
    [D] 22:19:53 - [Fight] Player attacked by other unit, skip this fight.
    22:19:53 - [Fight] Player Attacked by Zhevra Courser (lvl 20)
    22:20:09 - [Regen] Started
    22:20:10 - [Regen] Use food Conjured Bread
    22:20:11 - [Regen] Use drink Conjured Purified Water
    22:20:29 - [Regen] Finished
    22:20:29 - [Looting] Loot Zhevra Courser
    22:20:30 - [Fight] Player Attack Thunderhead (lvl 21)
    22:20:57 - [Looting] Loot Thunderhead
    22:20:58 - [Fight] Player Attack Zhevra Courser (lvl 21)
    22:21:21 - [Regen] Started
    22:21:22 - [Regen] Use drink Conjured Purified Water
    22:21:39 - [Regen] Finished
    22:21:39 - [Fight] Player Attack Thunderhead (lvl 21)
    22:22:05 - [Looting] Loot Thunderhead
    22:22:06 - [Fight] Player Attack Zhevra Courser (lvl 20)
    [D] 22:22:15 - [Fight] Mob seem bugged
    22:22:15 - [Fight] Can't reach Zhevra Courser, blacklisting it.
    22:22:15 - [Fight] Player Attack Zhevra Courser (lvl 20)
    [D] 22:22:16 - [Fight] Player attacked by other unit, skip this fight.
    22:22:16 - [Fight] Player Attacked by Zhevra Courser (lvl 20)
    22:22:27 - [Regen] Started
    22:22:28 - [Regen] Use food Conjured Bread
    22:22:29 - [Regen] Use drink Conjured Purified Water
    22:22:47 - [Regen] Finished
    22:22:47 - [Fight] Player Attack Zhevra Courser (lvl 20)
    [D] 22:22:55 - [Fight] Mob seem bugged
    22:22:55 - [Fight] Can't reach Zhevra Courser, blacklisting it.
    22:22:55 - [Fight] Player Attack Thunderhead (lvl 20)
    [D] 22:23:00 - [Fight] Player attacked by other unit, skip this fight.
    22:23:01 - [Fight] Player Attacked by Zhevra Courser (lvl 20)

     

     

  5. 19 minutes ago, Marsbar said:

    Try adding 

    
    FightEvents.OnFightLoop += (unit, cancelable) => {
                if (ObjectManager.Target.GetDistance < 8)
                {
                    
                    var xvector = (ObjectManager.Me.Position.X) - (ObjectManager.Target.Position.X);
                    var yvector = (ObjectManager.Me.Position.Y) - (ObjectManager.Target.Position.Y);
    
                    Vector3 newpos = new Vector3()
                    {
                        X = ObjectManager.Me.Position.X + (float)((xvector * (20 / ObjectManager.Target.GetDistance) - xvector)),
                        Y = ObjectManager.Me.Position.Y + (float)((yvector * (20 / ObjectManager.Target.GetDistance) - yvector)),
                        Z = ObjectManager.Me.Position.Z
                    };
                    MovementManager.Go(PathFinder.FindPath(newpos), false);
                    Thread.Sleep(1500);
                }
            };    

     

    GG WP! Yup that's it. Works both in my test blank fightclass as well as in the main one!

    Thank you very much @Marsbar.

    Also thank you @Matenia and @Apexx ! I apreciate the help guys!

    This will definitely help me with my rogue fightclass as well. The only thing missing from perfection is moving to a spot without mobs. But that is way above my knowledge of coding :-D

     

    23 minutes ago, Apexx said:

    Not sure if you have seen this post -> move back if... add code in fightclass editor

    You know what the funny part is? I've seen that post dozens of times when I was googling but since I didn't know what FightEvents.OnFightLoop was or even how to use it properly I didn't even attempted to fiddle with it. I was so close yet so far :-D

  6. 11 minutes ago, Marsbar said:

    Can you try targetting something (can be a friendly), running wrotation and running my code in the dev tools?

    Edit: I'm also in vanilla and it works running in dev tools, havent tried it in a fight class yet

    I don't know how to do that. However I tried with a custom profile and it worked nicely. But, keep in mind that simple wManager.Wow.Helpers.Move.StrafeLeft(Move.MoveAction.PressKey, 1000); also worked with a custom profile but got messed up once it was inside a Fightclass and my toon was in combat.

    EDIT: But since you mentioned it, how do you run code from within the dev tools? You just put it in and start WRotation? If so, that did nothing.

  7. 1 hour ago, Marsbar said:

    This took me a while, I had the help of my GF who did mathy things in school (unlike me) to be my human calculator;

    
    	var xvector = (ObjectManager.Me.Position.X) - (ObjectManager.Target.Position.X);
            var yvector = (ObjectManager.Me.Position.Y) - (ObjectManager.Target.Position.Y);
    
            Vector3 newpos = new Vector3()
            {
                X = ObjectManager.Me.Position.X + (float)((xvector * (20 / ObjectManager.Target.GetDistance)-xvector)),
                Y = ObjectManager.Me.Position.Y + (float)((yvector * (20 / ObjectManager.Target.GetDistance)-yvector)),
                Z = ObjectManager.Me.Position.Z
            };
            MovementManager.Go(PathFinder.FindPath(newpos), false);

    Currently this runs ~20 yards back away from the target using the pathfinder, you can change the 20 to be what you want and also add it to the onfightloop with an if condition. Let me know how it goes!

    Wow man, thanks for taking the time! And thanks to your girlfriend!

    It does what it's supposed to... but... bad news... still the same stuttering issue. :(

     

    Here is how I tested:

    1. made a blank Fightclass with only Frost Nova and your move. Tries to move but stutters = does not even move the full 20 yards.
      Spoiler
      
      using System;
      using System.Linq;
      using System.Threading;
      using System.Windows.Forms;
      using robotManager.Helpful;
      using robotManager.Products;
      using wManager.Wow.Class;
      using wManager.Wow.Enums;
      using wManager.Events;
      using wManager.Wow.Helpers;
      using wManager.Wow.ObjectManager;
      using System.Configuration;
      using System.ComponentModel;
      using System.IO;
      using robotManager;
      using System.Collections.Generic;
      using Timer = robotManager.Helpful.Timer;
      
      public class Main : ICustomClass
      {
          public float Range { get { return 29f; } }
          private bool iMageLaunched;
      
          public void Initialize() // When product started, initialize and launch Fightclass
          {
              iMageLaunched = true;
              Logging.Write("iMage initialized.");
              Start();
          }
      
          public void Dispose() // When product stopped
          {
              iMageLaunched = false;
              Logging.Write("iMage stopped.");
          }
      
          public void ShowConfiguration() // When use click on Fight class settings
          {
              iMageSettings.Load();
              iMageSettings.CurrentSetting.ToForm();
              iMageSettings.CurrentSetting.Save();
          }
      	
          // SPELLS:
          public Spell FrostBolt = new Spell("Frostbolt");
      
      
          private void CombatRotation()
      	{
      		if (ObjectManager.Target.GetDistance <= 6 && !ObjectManager.Target.HaveBuff("Frost Nova") && !ObjectManager.Target.HaveBuff("Frostbite") && ObjectManager.Target.HealthPercent >= 25) // && ObjectManager.Target.GetDistance >= 6 
      		{
      			SpellManager.CastSpellByNameLUA("Frost Nova");
      			return;
      		}
      		else if ((ObjectManager.Target.HaveBuff("Frost Nova") || ObjectManager.Target.HaveBuff("Frostbite")) && ObjectManager.Target.GetDistance <= 6)
      		{
      			while (ObjectManager.Target.GetDistance <= 6)
      			{
      				var xvector = (ObjectManager.Me.Position.X) - (ObjectManager.Target.Position.X);
      				var yvector = (ObjectManager.Me.Position.Y) - (ObjectManager.Target.Position.Y);
      
      				Vector3 newpos = new Vector3()
      				{
      					X = ObjectManager.Me.Position.X + (float)((xvector * (20 / ObjectManager.Target.GetDistance)-xvector)),
      					Y = ObjectManager.Me.Position.Y + (float)((yvector * (20 / ObjectManager.Target.GetDistance)-yvector)),
      					Z = ObjectManager.Me.Position.Z
      				};
      				MovementManager.Go(PathFinder.FindPath(newpos), false);
      			}
      			return;
      		}
      	}
      
          public void Start()
          {
              
              Logging.Write("iMage Loaded");
              while (iMageLaunched)
              {
                  if (!Products.InPause)
                      {
                          if (!ObjectManager.Me.IsDeadMe)
                          {
                              if (Fight.InFight && ObjectManager.Me.Target > 0)
                              {
                                  CombatRotation();
                              }
                          }
                      }
                  Thread.Sleep(50);
              }
              Logging.Write("iMage is now stopped.");
          }
      
          [Serializable]
          public class iMageSettings : Settings
          {
              public iMageSettings()
              {
                  ConfigWinForm(new System.Drawing.Point(400, 400), "iMage" + Translate.Get("Settings"));
              }
      
              public static iMageSettings CurrentSetting { get; set; }
      
              public bool Save()
              {
                  try
                  {
                      return Save(AdviserFilePathAndName("iMage-Mage", ObjectManager.Me.Name + "." + Usefuls.RealmName));
                  }
                  catch (Exception e)
                  {
                      Logging.WriteError("iMageSettings > Save(): " + e);
                      return false;
                  }
              }
      
              public static bool Load()
              {
                  try
                  {
                      if (File.Exists(AdviserFilePathAndName("iMage-Mage", ObjectManager.Me.Name + "." + Usefuls.RealmName)))
                      {
                          CurrentSetting =
                              Load<iMageSettings>(AdviserFilePathAndName("iMage-Mage",
                                                                          ObjectManager.Me.Name + "." + Usefuls.RealmName));
                          return true;
                      }
                      CurrentSetting = new iMageSettings();
                  }
                  catch (Exception e)
                  {
                      Logging.WriteError("iMageSettings > Load(): " + e);
                  }
                  return false;
              }
          }
      }

       

       

    2. I tried adding the MoveEvents but with those, the bot doesn't move at all.

    3. Also tried making a Fightclass with movement only so I can record and show it you all. Here's the code:

      Spoiler
      
      using System;
      using System.Linq;
      using System.Threading;
      using System.Windows.Forms;
      using robotManager.Helpful;
      using robotManager.Products;
      using wManager.Wow.Class;
      using wManager.Wow.Enums;
      using wManager.Events;
      using wManager.Wow.Helpers;
      using wManager.Wow.ObjectManager;
      using System.Configuration;
      using System.ComponentModel;
      using System.IO;
      using robotManager;
      using System.Collections.Generic;
      using Timer = robotManager.Helpful.Timer;
      
      public class Main : ICustomClass
      {
          public float Range { get { return 29f; } }
          private bool iMageLaunched;
      
          public void Initialize() // When product started, initialize and launch Fightclass
          {
              iMageLaunched = true;
              Logging.Write("iMage initialized.");
              Start();
          }
      
          public void Dispose() // When product stopped
          {
              iMageLaunched = false;
              Logging.Write("iMage stopped.");
          }
      
          public void ShowConfiguration() // When use click on Fight class settings
          {
              iMageSettings.Load();
              iMageSettings.CurrentSetting.ToForm();
              iMageSettings.CurrentSetting.Save();
          }
      	
          // SPELLS:
          public Spell FrostBolt = new Spell("Frostbolt");
      
      
          private void CombatRotation()
      	{
      		if (ObjectManager.Target.GetDistance <= 6)
      		{
      			while (ObjectManager.Target.GetDistance <= 20)
      			{
      				var xvector = (ObjectManager.Me.Position.X) - (ObjectManager.Target.Position.X);
      				var yvector = (ObjectManager.Me.Position.Y) - (ObjectManager.Target.Position.Y);
      
      				Vector3 newpos = new Vector3()
      				{
      					X = ObjectManager.Me.Position.X + (float)((xvector * (20 / ObjectManager.Target.GetDistance)-xvector)),
      					Y = ObjectManager.Me.Position.Y + (float)((yvector * (20 / ObjectManager.Target.GetDistance)-yvector)),
      					Z = ObjectManager.Me.Position.Z
      				};
      				MovementManager.Go(PathFinder.FindPath(newpos), false);
      			}
      			return;
      		}
      	}
      
          public void Start()
          {
              
              Logging.Write("iMage Loaded");
              while (iMageLaunched)
              {
                  if (!Products.InPause)
                      {
                          if (!ObjectManager.Me.IsDeadMe)
                          {
                              if (Fight.InFight && ObjectManager.Me.Target > 0)
                              {
                                  CombatRotation();
                              }
                          }
                      }
                  Thread.Sleep(50);
              }
              Logging.Write("iMage is now stopped.");
          }
      
          [Serializable]
          public class iMageSettings : Settings
          {
              public iMageSettings()
              {
                  ConfigWinForm(new System.Drawing.Point(400, 400), "iMage" + Translate.Get("Settings"));
              }
      
              public static iMageSettings CurrentSetting { get; set; }
      
              public bool Save()
              {
                  try
                  {
                      return Save(AdviserFilePathAndName("iMage-Mage", ObjectManager.Me.Name + "." + Usefuls.RealmName));
                  }
                  catch (Exception e)
                  {
                      Logging.WriteError("iMageSettings > Save(): " + e);
                      return false;
                  }
              }
      
              public static bool Load()
              {
                  try
                  {
                      if (File.Exists(AdviserFilePathAndName("iMage-Mage", ObjectManager.Me.Name + "." + Usefuls.RealmName)))
                      {
                          CurrentSetting =
                              Load<iMageSettings>(AdviserFilePathAndName("iMage-Mage",
                                                                          ObjectManager.Me.Name + "." + Usefuls.RealmName));
                          return true;
                      }
                      CurrentSetting = new iMageSettings();
                  }
                  catch (Exception e)
                  {
                      Logging.WriteError("iMageSettings > Load(): " + e);
                  }
                  return false;
              }
          }
      }

       

       

    Here's the video of above code in action: https://www.youtube.com/watch?v=B9ANAEQ0rSg

     

    I googled a bit and found an example where a while loop with sleep is used until the movement stops. I thought that makes sense so I tried and logged the loops to see what's going on.

    			while (ObjectManager.Target.GetDistance <= 20)
    			{
    				var xvector = (ObjectManager.Me.Position.X) - (ObjectManager.Target.Position.X);
    				var yvector = (ObjectManager.Me.Position.Y) - (ObjectManager.Target.Position.Y);
    
    				Vector3 newpos = new Vector3()
    				{
    					X = ObjectManager.Me.Position.X + (float)((xvector * (20 / ObjectManager.Target.GetDistance)-xvector)),
    					Y = ObjectManager.Me.Position.Y + (float)((yvector * (20 / ObjectManager.Target.GetDistance)-yvector)),
    					Z = ObjectManager.Me.Position.Z
    				};
    				MovementManager.Go(PathFinder.FindPath(newpos), false);
    				Logging.Write("STARTED MOVING");
    				while (MovementManager.InMovement && Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause)
    				{
    					Thread.Sleep(1000);
    					Logging.Write("STILL MOVING");
    				}
    			}

    Didn't have any effect at all. Here is the result from the log. It looks like how I though it would look. It doesn't perform the move, it performs dozens of small little tiny moves for some reason, hence the stuttering.

    Quote

    22:26:49 - STARTED MOVING
    22:26:50 - STILL MOVING
    22:26:50 - STARTED MOVING
    22:26:51 - STILL MOVING
    22:26:51 - STARTED MOVING
    22:26:52 - STILL MOVING
    22:26:52 - STARTED MOVING
    22:26:53 - STILL MOVING
    22:26:53 - STARTED MOVING
    22:26:54 - STILL MOVING
    22:26:54 - STARTED MOVING
    22:26:55 - STILL MOVING
    22:26:56 - STARTED MOVING
    22:26:57 - STILL MOVING
    22:26:57 - STARTED MOVING
    22:26:58 - STILL MOVING
    22:26:58 - STARTED MOVING

     

  8. 8 minutes ago, sjb211 said:

    Vanilla can also work properly, you can try attachments(trial version)
    good luck

    Well, iMage-Pro is a paid FightClass. I appreciate you wanting to help me but I would advise to delete the file immediately. Mr. @Jasabi surely spent couple of hours on this and wouldn't apprecite you spreading it around.

    Thanks for participating in this, though!

  9. 9 minutes ago, Apexx said:

    Short Video Demonstration

    
    // Debuff 20549 = War Stomp | 19975 = Entangling Roots
    while (ObjectManager.Target.IsValid &&
        (ObjectManager.Target.HaveBuff(20549) || ObjectManager.Target.HaveBuff(19975)) &&   
        Vector3.Distance(ObjectManager.Me.Position, ObjectManager.Target.Position) < 6)
    {
        Move.StrafeLeft(Move.MoveAction.PressKey, 1500);
        MovementManager.Face(ObjectManager.Target);
    }

     

    Thanks for that, I appreciate it! But as per my previous post, for some reason it doesn't work for me. Are you using WRobot for Vanilla?

    EDIT: Also, do you use Pathfinder (General Settings --> Path-finding)? What are your Class / Fight Class settings?

  10. So I did some testing.

    I put together a complete vanilla Fightclass and a Custom profile.

     

    Custom Profile: 

    moves flawlessly both in and out of combat both backward and strafe (doesn't attack though, duh)

    Spoiler
    
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Threading;
    
    using robotManager.Helpful;
    using robotManager.Products;
    
    using wManager.Wow.Helpers;
    using wManager.Wow.ObjectManager;
    
    public class CustomProfile : Custom_Profile.ICustomProfile
    {
        public void Pulse()
        {
    		try
            {
                while (wManager.Wow.Helpers.Conditions.ProductIsStarted)
    			{
    				if (wManager.Wow.Helpers.Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause)
    				{
    					Buffer.Pulse();
    				}
    				Thread.Sleep(Usefuls.Latency + 1000);
    			}
            }
            catch (Exception e)
            {
                Logging.WriteError("CustomProfile > Pulse(): " + e);
            }
        }
    
        public void Dispose()
        {
            try
            {
                Buffer.Dispose();
            }
            catch (Exception e)
            {
                Logging.WriteError("CustomProfile > Dispose(): " + e);
            }
        }
    }
    
    internal static class Buffer
    {
    	public static bool Pulse()
    	{
    		try
    		{
    			wManager.Wow.Helpers.Move.StrafeLeft(Move.MoveAction.PressKey, 1000);
    			return true;
    		}
    		catch (Exception e)
    		{
    			try
    			{
    				Dispose();
    			}
    			catch
    			{
    			}
    			Logging.WriteError("Buffer > Pulse(): " + e);
    			Products.ProductStop();
    			return false;
    		}
    	}
    	public static void Dispose()
        {
            Logging.Write("Stop Buffer.");
        }
    }

     

     

    Fightclass:

    Is set it up to shoot frost bolts if distance > 6, if the distance is smaller it should go backwards. And despite it being vanilla and converted from XML, it does the same stutter as shown in the video. So now we know the issue is not with my code but rather it's something in wrobot handling combat, not just Grinder. I tried using Party mode and aggroing a mob and same thing. @Apexx what wow version do you use wrobot for? Not sure if the wrobot versions are different or not but I cannot see any other reason why the code would work for you and not for me.

    Spoiler
    
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Configuration;
    using System.IO;
    using System.Linq;
    using System.Threading;
    using robotManager;
    using robotManager.FiniteStateMachine;
    using robotManager.Helpful;
    using wManager.Wow.Class;
    using wManager.Wow.Helpers;
    using wManager.Wow.ObjectManager;
    using wManager.Wow.Bot.States;
    using Timer = robotManager.Helpful.Timer;
    using wManager.Wow.Enums;
    
    public class Main : ICustomClass
    {
        public float Range { get { return 5; } }
    
        private bool _usePet = false;
        private Engine _engine;
        public void Initialize()
        {
            FightconfignameSettings.Load();
            _engine = new Engine(false)
            {
                States = new List<State>
                            {
                                 new SpellState("Frostbolt", 2, context => ObjectManager.Target.GetDistance > 6, false, true, false, false, true, true, true, true, 0, false, false, false, false, false, false, wManager.Wow.Helpers.FightClassCreator.YesNoAuto.Auto, "", "none", true, true, false),
                                 new SpellState("wManager.Wow.Helpers.Move.Backward(Move.MoveAction.PressKey, 1000);", 1, context => ObjectManager.Target.GetDistance < 6, false, true, false, false, true, true, true, true, 0, false, false, false, false, false, false, wManager.Wow.Helpers.FightClassCreator.YesNoAuto.Auto, "", "none", true, true, true),
    
                            }
            };
    
            if (_usePet)
                _engine.States.Add(new PetManager { Priority = int.MaxValue });
    
            _engine.States.Sort();
            _engine.StartEngine(10, "_FightClass", true);
        }
    
        public void Dispose()
        {
            if (_engine != null)
            {
                _engine.StopEngine();
                _engine.States.Clear();
            }
        }
    
        public void ShowConfiguration()
        {
            FightconfignameSettings.Load();
            FightconfignameSettings.CurrentSetting.ToForm();
            FightconfignameSettings.CurrentSetting.Save();
        }
    
        class PetManager : State
        {
            public override string DisplayName
            {
                get { return "Pet Manager"; }
            }
            Timer _petTimer = new Timer(-1);
            bool _petFistTime = true;
            public override bool NeedToRun
            {
                get
                {
                    if (!_petTimer.IsReady)
                        return false;
    
                    if (ObjectManager.Me.IsDeadMe || ObjectManager.Me.IsMounted || !Conditions.InGameAndConnected)
                    {
                        _petFistTime = false;
                        _petTimer = new Timer(1000 * 3);
                        return false;
                    }
                    if (!ObjectManager.Pet.IsValid || ObjectManager.Pet.IsDead) {
                        if (_petFistTime) { return true; }
                        else { _petFistTime = true; }
                    }
                    return false;
                }
            }
    
            private readonly Spell _revivePet = new Spell("Revive Pet");
            private readonly Spell _callPet = new Spell("Call Pet 1");
    
            public override void Run()
            {
                if (!ObjectManager.Pet.IsValid)
                {
                    _callPet.Launch(true);
                    Thread.Sleep(Usefuls.Latency + 1000);
                }
                if (!ObjectManager.Pet.IsValid || ObjectManager.Pet.IsDead)
                    _revivePet.Launch(true);
    
                _petTimer = new Timer(1000 * 2);
            }
        }
    
    
    
    }
    
    /*
     * SETTINGS
    */
    
    [Serializable]
    public class FightconfignameSettings : Settings
    {
    
    
    
        private FightconfignameSettings()
        {
            ConfigWinForm(new System.Drawing.Point(400, 400), "Fightconfigname " + Translate.Get("Settings"));
        }
    
        public static FightconfignameSettings CurrentSetting { get; set; }
    
        public bool Save()
        {
            try
            {
                return Save(AdviserFilePathAndName("CustomClass-Fightconfigname", ObjectManager.Me.Name + "." + Usefuls.RealmName));
            }
            catch (Exception e)
            {
                Logging.WriteError("FightconfignameSettings > Save(): " + e);
                return false;
            }
        }
    
        public static bool Load()
        {
            try
            {
                if (File.Exists(AdviserFilePathAndName("CustomClass-Fightconfigname", ObjectManager.Me.Name + "." + Usefuls.RealmName)))
                {
                    CurrentSetting =
                        Load<FightconfignameSettings>(AdviserFilePathAndName("CustomClass-Fightconfigname",
                                                                     ObjectManager.Me.Name + "." + Usefuls.RealmName));
                    return true;
                }
                CurrentSetting = new FightconfignameSettings();
            }
            catch (Exception e)
            {
                Logging.WriteError("FightconfignameSettings > Load(): " + e);
            }
            return false;
        }
    }

     

     

    @Droidz / @iMod, guys would you be willing to take a look? I'm going crazy already.

  11. 49 minutes ago, Apexx said:

    I think back pedaling is somewhat a moot point. Even when I play my hunter using my actual fingers :tongue: I back pedal. The video behavior would be more suspicious imo.
    I could maybe find some time at some point to modify the code and test. I just don't know when I will be able to at the current moment.

    Would you be willing to post your code, Apexx? I would like to check the differences.

  12. 2 minutes ago, Marsbar said:

    Ignoring the Helpers.Move for a second, could you not do something like;

    
    MovementManager.Go(PathFinder.FindPath("Vector3 of the place you want to go"), false);

    Bear in mind, you'll need to do some math to find the vector3 that is like 20yards behind where your char is currently facing.

    I wanted to avoid this as much as possible because I have NO IDEA how to do that but if you or someone is willing to help me with that I guess it would be a good solution if it worked.

  13. I'm begining to give up, honestly...

    So first issue, when I stop the fight and then start it again, the bot log says I started to fight the mob I was targetting before. BUT... it doesn't do anything, it just stares at the mob... But that's irrelevant since it doesn't solve the movement issue at all, still running in circles...

    Second thing. There seems to be an inconsistency between presskey and downkey. Both of them make the bot run in circles, however when I do:

    • wManager.Wow.Helpers.Move.StrafeLeft(Move.MoveAction.PressKey, 1000); - it does only a small movement, maybe trully 1second and then stops (still circling though)
    • wManager.Wow.Helpers.Move.StrafeLeft(Move.MoveAction.DownKey, 1000); - it does circles for a VERY long time, maybe 30 seconds... doesn't DownKey require an UpKey somewhere?
    • wManager.Wow.Helpers.Move.Backward(Move.MoveAction.PressKey, 1000); - does the chopping movement I showed in the vid
    • wManager.Wow.Helpers.Move.Backward(Move.MoveAction.DownKey, 1000); - actually moves back but there is still slight choppiness, it doesn't look like someone pressed a button and held it pressed, it looks like someone was mashing the key repeatedly in milisecond increments, look very bot like

    I also tried removing the MovementEvents and it didn't have any effect on how the bot acted...

×
×
  • Create New...