Kekskruemel
Member
- Joined
 - Jan 15, 2010
 
- Messages
 - 236
 
- Reaction score
 - 0
 
Hi,
since the changes to the new major honorbuddy version my modified unszuck plugin doesn't work (get errors during hb startup)
Can someone help me pls to fix this.
	
	
	
		
	
	
	
		
				
			since the changes to the new major honorbuddy version my modified unszuck plugin doesn't work (get errors during hb startup)
Can someone help me pls to fix this.
		Code:
	
	[09:11:42.145 N] Compiler Error: C:\Users\Egis\Desktop\Miauz\Plugins\NoMoveDetector\NoMoveDetector.cs(97,33) : error CS0246: The type or namespace name 'StuckHandler' could not be found (are you missing a using directive or an assembly reference?)
[09:11:42.145 N] Compiler Error: C:\Users\Egis\Desktop\Miauz\Plugins\NoMoveDetector\NoMoveDetector.cs(87,32) : error CS0535: 'NoMoveDetectorRezzRezz.NoMover' does not implement interface member 'IPlayerMover.MoveTowards(Vector3)'
[09:11:42.145 N] Compiler Error: C:\Users\Egis\Desktop\Miauz\Plugins\NoMoveDetector\NoMoveDetector.cs(101,34) : error CS0246: The type or namespace name 'StuckHandler' could not be found (are you missing a using directive or an assembly reference?)
[09:11:42.145 N] Compiler Error: C:\Users\Egis\Desktop\Miauz\Plugins\NoMoveDetector\NoMoveDetector.cs(103,34) : error CS0115: 'NoMoveDetectorRezzRezz.NoUnstuck.IsStuck()': no suitable method found to override
[09:11:42.145 N] Compiler Error: C:\Users\Egis\Desktop\Miauz\Plugins\NoMoveDetector\NoMoveDetector.cs(104,34) : error CS0115: 'NoMoveDetectorRezzRezz.NoUnstuck.Reset()': no suitable method found to override
[09:11:42.145 N] Compiler Error: C:\Users\Egis\Desktop\Miauz\Plugins\NoMoveDetector\NoMoveDetector.cs(105,34) : error CS0115: 'NoMoveDetectorRezzRezz.NoUnstuck.Unstick()': no suitable method found to override
	
		Code:
	
	using Styx.CommonBot;
using Styx.Common;
using Styx.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using Styx.Common;
using Styx.Common.Helpers;
using Styx.CommonBot;
using Styx.CommonBot.Inventory;
using Styx.Plugins;
using Styx.WoWInternals;
using Styx.WoWInternals.WoWObjects;
using Styx.WoWInternals.WoWObjects;
using Styx.WoWInternals;
using Styx.Pathing;
using Styx;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;
using System.Xml.Linq;
using System;
namespace HB.Plugins.NoMoveDetectorRezzRezz
{
    class NoMoveDetectorRezzRezz : HBPlugin
    {
        #region Overrides of HBPlugin
        public override void OnEnable()
        {
            Styx.CommonBot.BotEvents.OnBotStarted += _OnBotStart;
            _init();
        }
        public override void OnDisable()
        {
            Styx.CommonBot.BotEvents.OnBotStarted -= _OnBotStart;
        }
        public override string ButtonText { get { return "---"; } }
        public override bool WantButton { get { return false; } }
        public override void OnButtonPress(){}
        public override void Pulse(){_MainPulseProc();}
        public override string Name { get { return "No Move Detector Rezz"; } }
        public override string Author { get { return "cls15"; } }
        public override Version Version { get { return new Version(1, 2, 0); } }
        #endregion
        private Stopwatch LastOK ;
        private WoWPoint LastLoc;
        private int nBotRestart;
        private static Thread RestartThread;
        private static void _RestartThread()
        {
            TreeRoot.Stop();
            Thread.Sleep(2000);
            TreeRoot.Start();
        }
        private void _OnBotStart(EventArgs args)
        {
            Logging.Write(@"[NoMoveDetectorRezz] Bot started");
            LastLoc = StyxWoW.Me.Location;
            LastOK.Restart();
            RestartThread = new Thread(new ThreadStart(_RestartThread));
        }
        private void _init()
        {
            Logging.Write(@"[NoMoveDetectorRezz] init");
            LastOK = new Stopwatch();
            nBotRestart = 0;
        }
        
        public class NoMover : IPlayerMover
        {
            public void Move(WoWMovement.MovementDirection direction) { }
            public void MoveStop() { }
            public void MoveTowards(WoWPoint location)
            {
                int a = 4;
            }
        }
        private static readonly StuckHandler OriginalUnstuckHandler = Navigator.NavigationProvider.StuckHandler;
        #region Embedded Type - NoUnstuck
        public class NoUnstuck : StuckHandler
        {
            public override bool IsStuck() { return false; }
            public override void Reset() { }
            public override void Unstick() { }
        }
                #endregion
        
        private void _MainPulseProc()
        {
            // Must we go futher anyway?
            if (!TreeRoot.IsRunning)
            {
                if (LastOK.ElapsedMilliseconds > 1000 * 30)
                {
                    Logging.Write(@"[NoMoveDetectorRezz] LastPosition reseted, bot is not running (but pulse is called ???)");
                    LastOK.Restart();
                }
                return;
            } 
            
            WoWPlayer Me = StyxWoW.Me;
            //Cancel timer if move > 10 yards is detected
            if (LastLoc.Distance(Me.Location) > 10f)
            {
                if (LastOK.ElapsedMilliseconds > 1000 * 30)  Logging.Write(@"[NoMoveDetectorRezz] Move detected. LastPosition reseted");
                LastOK.Restart();
                LastLoc = Me.Location;
                return;
            }
           /* if (LastOK.ElapsedMilliseconds > 1000 * 5 && !StyxWoW.Me.HasAura("Food"))
            { 
                // BestFood detection correct
                ulong nCurrentFood = CharacterSettings.Instance.DrinkName.ToUInt32();
                WoWItem tp = ObjectManager.GetObjectByGuid<WoWItem>(nCurrentFood);
                if (nCurrentFood == 0)
                {
                    
                }
            } */
            if (LastOK.ElapsedMilliseconds > 1000*60*6)
            {
                if (Styx.CommonBot.Frames.AuctionFrame.Instance.IsVisible || Styx.CommonBot.Frames.MailFrame.Instance.IsVisible)
                {
                    Logging.Write(@"[NoMoveDetector] not mooving last {0} min but has open frame.  LastPosition reseted", nBotRestart * 5);
                    LastOK.Restart();
                    LastLoc = Me.Location;
                    return;
                }
                if (Me.HasAura("Resurrection Sickness"))
                {
                    LastOK.Restart();
                    return;
                }
                if (nBotRestart > 1) // Not mooving for 15 min, hope you have a reloger...
                {
                    Logging.Write(@"[NoMoveDetector] not mooving last 15 min : Stopping Wow...");
                                                        WoWMovement.MoveStop();
                Navigator.PlayerMover = new NoMover();
                Navigator.NavigationProvider.StuckHandler = new NoUnstuck();
                Thread.Sleep(1000);
                    Lua.DoString("UseItemByName(6948)");
                    Thread.Sleep(15000);
                                                        Navigator.PlayerMover = new ClickToMoveMover();
                Navigator.NavigationProvider.StuckHandler = OriginalUnstuckHandler;
                    Lua.DoString(@"ForceQuit()");
                }
                else
                {
                    nBotRestart++;
                    Logging.Write(@"[NoMoveDetector] not mooving last {0} min : Restarting bot...",nBotRestart*5);
                    LastOK.Restart();
                                    WoWMovement.MoveStop();
                Navigator.PlayerMover = new NoMover();
                Navigator.NavigationProvider.StuckHandler = new NoUnstuck();
                Thread.Sleep(1000);
                    Lua.DoString("UseItemByName(6948)");
                    Thread.Sleep(15000);
                                    Navigator.PlayerMover = new ClickToMoveMover();
                Navigator.NavigationProvider.StuckHandler = OriginalUnstuckHandler;
                    RestartThread.Start();
                }
                
            }
        }
    }
}
	





