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!

Quack! Log out timer.

the plugin that you provided does not teleport. It only stops the bot. Is there a way to fix that?


EDIT:

Some more info, my bot actually just starts running into the scenery of whatever I'm near and doesn't actually teleport.

2nd edit:

Got it to work by changing the way the bot logs out. Ill post the code snippet.

Quack.cs
Code:
using System.Diagnostics;
using System.Threading;
using ff14bot;
using ff14bot.Helpers;
using ff14bot.Interfaces;
using ff14bot.Managers;
using ff14bot.Objects;
using ff14bot.Behavior;
using Newtonsoft.Json;
using System;
using System.IO;
using Quack.Settings;
using System.Configuration;
using System.Runtime.InteropServices;

namespace Quack_
{
    public class Quack : IBotPlugin
    {
        #region Necessary Stuff
        public string Author { get { return "Exmortem"; } }
        public string Description { get { return "Logs out based on settings."; } }
        public Version Version { get { return new Version(0, 0, 1); } }
        public bool Equals(IBotPlugin other)
        {
            throw new NotImplementedException();
        }
        public void OnInitialize()
        {
            settings.Enabled = false;
        }
        public void OnShutdown()
        {
			Logging.Write("[Quack!] OnShutdown.");
        }
        public void OnEnabled()
        {
            settings.Enabled = false;
        }
        public void OnDisabled()		
        {
			Logging.Write("[Quack!] Disabled.");
        }
        public string Name
        {
            get { return "Quack!"; }
        }
        public bool WantButton
        {
            get { return true; }
        }
        public string ButtonText
        {
            get { return "Quack!"; }
        }
        public void OnButtonPress()
        {
            if (_form == null || _form.IsDisposed || _form.Disposing)
                _form = new frmMain();

            _form.ShowDialog();    
        }
        #endregion
        #region Variables
        public static QuackSettings settings = QuackSettings.Instance;
        private frmMain _form;
        #endregion

        public void OnPulse()
        {

            if (settings.Enabled)
            {
                if (System.DateTime.Now >= settings.TimeEnd)
                {
                    if (Core.Player.InCombat)
					{
						Logging.Write("[Quack!] Waiting for combat to end.");
                        return;

					}
					else
					{
						Logging.Write("[Quack!] Starting stop sequence");
						if (settings.Teleport)
						{
							if (Core.Player.IsMounted)
							{
								Logging.Write("[Quack!] Mounted, attempting dismount.");
								Thread.Sleep(1000);
								Actionmanager.Dismount();
								Thread.Sleep(1000);
							}
							CommonBehaviors.MoveStop();
							Logging.Write("[Quack!] Teleporting to {0}.",settings.TeleportLocation);
							CommonBehaviors.MoveStop();
							switch (settings.TeleportLocation)
							{
								case "New Gridania":
									CommonBehaviors.MoveStop();
									WorldManager.TeleportById(2);
									Thread.Sleep(20000);
									break;
								case "Limsa Lominsa":
									CommonBehaviors.MoveStop();
									WorldManager.TeleportById(8);
									Thread.Sleep(20000);
									break;
								case "Ul'dah":
									CommonBehaviors.MoveStop();
									WorldManager.TeleportById(9);
									Thread.Sleep(20000);
									break;
							}
							Thread.Sleep(20000);

						}
						
						Logging.Write("[Quack!] Stopping Bot!");
						TreeRoot.Stop();
						
						if (settings.Logout)
						{
			   
							Logging.Write("[Quack!] Closing FFXIV.");

							Process[] ffxiv = Process.GetProcessesByName("ffxiv");

							foreach (Process p in ffxiv)
								p.Kill();

						}
						
					}
                }
            }

        }
    } 
}

#region Settings
namespace Quack.Settings
{
    public class QuackSettings : JsonSettings
    {
        [JsonIgnore]
        private static QuackSettings _instance;
        public static QuackSettings Instance { get { return _instance ?? (_instance = new QuackSettings("QuackSettings")); } }
        public QuackSettings(string filename) : base(Path.Combine(CharacterSettingsDirectory, "Quack.json")) { }

        [Setting]
        public bool Enabled { get; set; }

        #region Time Settings
        [Setting]
        public int HoursElapsed { get; set; }
        [Setting]
        public int MinutesElapsed { get; set; }
        [Setting]
        public DateTime TimeEnd { get; set; }
        [Setting]
        public DateTime TimeStart { get; set; }
        #endregion
        #region Action Settings
        [Setting]
        public bool Teleport { get; set; }
        [Setting]
        public string TeleportLocation { get; set; }
        [Setting]
        public bool Logout { get; set; }
        #endregion
    }
}
#endregion

Edit 3:

I'm fully aware that my code is sloppy. But it works and all it's doing is logging out so I don't really care that I'm calling things probably more than I need to.
 
Still not working for me, even with the updated .cs work by FC, however I will actually do some testing tonight and figure out why this is (I believe it's just another condition that hasn't been tested yet - in my case, no space in inventory but the bot is still trying to gather. causing issues). I will update this post when I know more!

Edit: Please ignore this - my own W.I.P. Triad Card Game botbase was the one causing it not to function properly.
 
Last edited:
Back
Top