What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal
RebornBuddy Forums

Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Timer for Honorbuddy?

gregmaster25

New Member
Joined
Apr 30, 2010
Messages
11
Is there a way to get honor buddy to turn off after x amount of hours? Instead of basing it on level
 
Code:
namespace Styx.Bot.CustomClasses
{
/*
 * TimerLog v1.0
 *
 * Edit logout time: line 33 before you enable plugin
 *
 */

using Logic;
using System;
using Helpers;
using Logic.Pathing;
using System.Threading;
using System.Diagnostics;
using Logic.Common.Combat;
using Object_Dumping_Enumeration;
using CustomCombat.CombatInterface;
using Memory_Read_Write_Inject.Lua;
using Object_Dumping_Enumeration.WoWObjects;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Xml.Linq;
using System.Linq;
using System.Net;
using System.Windows.Forms;
using System.Drawing;
using Styx.Plugins.PluginClass;

  
    public class AutoLog : HBPlugin
    {
        static int logOutAfterMinutes = 1;
        bool useHearth = true;


        int logOutAfterMS = logOutAfterMinutes * 60000;
        private static Stopwatch timer = new Stopwatch();
        
        public override void Pulse()
        {
            //Logging.Write("Pulse");
            if (!timer.IsRunning)
            {
                //Logging.Write("Timer Start");
                timer.Reset();
                timer.Start();
            }
            if (timer.ElapsedMilliseconds > logOutAfterMS && !ObjectManager.Me.Dead && !ObjectManager.Me.Combat)
            {
                //Logging.Write("Timer Elapsed");
                if (useHearth)
                {
                    Logging.Write("Using Hearthstone");
                    Lua.DoString("UseItemByName(\"Hearthstone\")");
                    Thread.Sleep(20000);
                }
                if (!ObjectManager.Me.Dead && !ObjectManager.Me.Combat)
                {
                    timer.Stop();
                    Logging.Write("Quitting WoW!");
                    Lua.DoString("ForceQuit()");
                    System.Diagnostics.Process.Start("Shutdown", "-s -t 10");
                }
            }
        }

        public override string Name { get { return "TimerLog"; } }

        public override string Author { get { return "ski"; } }

        public override Version Version { get { return new Version(1, 0); } }

        public override bool WantButton { get { return false; } }

        public override void OnButtonPress()
        {
            if (timer.IsRunning)
            {
                timer.Stop();
                timer.Reset();
            }
        }

    }
}
 
That's for hb1 btw. Here it is as a straight plugin.
 

Attachments

Alright so I edited it in the Notepad, default was 60000 (which is 166 hours because it's in seconds) to something more manageable then as soon as I start the bot my toon just tries to hearth.
 
Alright so I edited it in the Notepad, default was 60000 (which is 166 hours because it's in seconds) to something more manageable then as soon as I start the bot my toon just tries to hearth.
60,000 seconds is 16.6 hours. not 166 hours.
 
Alright so I edited it in the Notepad, default was 60000 (which is 166 hours because it's in seconds) to something more manageable then as soon as I start the bot my toon just tries to hearth.

60000 is ms. You shouldn't be editing that line. 60000 = 60 seconds.

Edit the line;

static int logOutAfterMinutes = 1;

to be..

static int logOutAfterMinutes = 60; // for 1 hour
static int logOutAfterMinutes = 120; // for 2 hours

etc
 
Back
Top