heinzskies
Member
- Joined
- Sep 7, 2014
- Messages
- 57
So a ny update on this how do we "hard code" it to make it move upwards? I'd love to be able to queue it up.
Warning, you have to find a way to blacklist the non fate mob yourself or else it will work or not I don't know.
The code below is experimental. It works but there might be some bugs.
Code:
using System;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Media;
using Buddy.Coroutines;
using Clio.Utilities;
using ff14bot;
using ff14bot.AClasses;
using ff14bot.Behavior;
using ff14bot.BotBases;
using ff14bot.Helpers;
using ff14bot.Managers;
using ff14bot.Navigation;
using TreeSharp;
namespace ChainIt
{
public class ChainIt : BotPlugin
{
public override string Author { get { return "Heinzskies"; } }
public override Version Version { get { return new Version(0, 0, 1); } }
public override string Name { get { return "ChainIt"; } }
public override string Description { get { return "Allow you to do chain quest without going back."; } }
public override bool WantButton
{
get { return false; }
}
public new bool Equals(BotPlugin other)
{
throw new NotImplementedException();
}
bool _lastFateChainActive = false;
FateIdleAction _userAction = FateIdleAction.Nothing;
private Composite _action;
public override void OnPulse()
{
uint[] fatesChain = { 643, 644, 645, 646 };
foreach (var fateChain in from fateChain in fatesChain let fateSearch = FateManager.ActiveFates.Count(fate => fate.Id == fateChain) where fateSearch != 0 select fateChain)
{
ActiveChain();
if (fatesChain.Last() == fateChain)
{
_lastFateChainActive = true;
}
FatebotSettings.Instance.ThisFateOnly = FateManager.GetFateById(fateChain).Name;
}
if (FateManager.ActiveFates.Count(fate => fate.Id == fatesChain.Last()) == 0 && _lastFateChainActive)
{
_lastFateChainActive = false;
FatebotSettings.Instance.ThisFateOnly = "";
FatebotSettings.Instance.IdleAction = _userAction;
}
}
private void ActiveChain()
{
if (FatebotSettings.Instance.IdleAction != FateIdleAction.Nothing)
{
_userAction = FatebotSettings.Instance.IdleAction;
}
FatebotSettings.Instance.IdleAction = FateIdleAction.Nothing;
}
public override void OnInitialize()
{
_action = new Decorator(r =>
Core.Player.Location.Distance(new Vector3("252.831238, 25, 4.66978")) > 15 &&
(
FatebotSettings.Instance.ThisFateOnly == "Dark Devices - The Plea" ||
FatebotSettings.Instance.ThisFateOnly == "Dark Devices - The Bait" ||
FatebotSettings.Instance.ThisFateOnly == "Dark Devices - The End" ||
FatebotSettings.Instance.ThisFateOnly == "Dark Devices - The Switch"
)
, new ActionRunCoroutine(p => DoIt()));
}
public override void OnShutdown()
{
TreeRoot.OnStart -= OnBotStart;
TreeRoot.OnStop -= OnBotStop;
TreeHooks.Instance.OnHooksCleared -= OnOnHooksCleared;
RemoveHooks();
}
private void AddHooks()
{
TreeHooks.Instance.InsertHook("TreeStart", 0, _action);
}
private void RemoveHooks()
{
TreeHooks.Instance.RemoveHook("TreeStart", _action);
}
public override void OnEnabled()
{
TreeRoot.OnStart += OnBotStart;
TreeRoot.OnStop += OnBotStop;
TreeHooks.Instance.OnHooksCleared += OnOnHooksCleared;
if (TreeRoot.IsRunning)
{
AddHooks();
}
Logging.Write(Colors.SkyBlue, "[ChainIt] v" + Version + " Enabled");
}
private static async Task<bool> DoIt()
{
Poi.Clear("Moving to fate hotspot location");
Navigator.MoveTo(new Vector3("252.831238, 25, 4.66978"));
return true;
}
public override void OnDisabled()
{
TreeRoot.OnStart -= OnBotStart;
TreeRoot.OnStop -= OnBotStop;
TreeHooks.Instance.OnHooksCleared -= OnOnHooksCleared;
RemoveHooks();
}
#region Event Handlers
private void OnBotStop(BotBase bot)
{
RemoveHooks();
}
private void OnBotStart(BotBase bot)
{
AddHooks();
}
private void OnOnHooksCleared(object sender, EventArgs e)
{
AddHooks();
}
#endregion
}
}