using System;
using System.Linq;
using Styx;
using Styx.Common;
using Styx.Plugins;
using Styx.WoWInternals;
using Styx.WoWInternals.WoWObjects;
namespace Plugins
{
internal class FlagReturn : HBPlugin
{
private static string _flagName = String.Empty;
public static string FlagName
{
get { return _flagName; }
set { _flagName = value; }
}
private static LocalPlayer Me
{
get { return StyxWoW.Me; }
}
public override string Name
{
get { return "FlagReturn"; }
}
public override string Author
{
get { return "Pookie"; }
}
public override Version Version
{
get { return new Version(1, 0, 0, 0); }
}
public override void Pulse()
{
if (!StyxWoW.IsInWorld || !Battlegrounds.IsInsideBattleground)
{
return;
}
if (FlagName == String.Empty)
{
if (Me.IsHorde)
{
FlagName = "Horde Flag";
}
if (Me.IsAlliance)
{
FlagName = "Alliance Flag";
}
}
foreach (
WoWGameObject gameObj in
ObjectManager.GetObjectsOfType<WoWGameObject>()
.Where(gameObj => gameObj.Name == FlagName && gameObj.WithinInteractRange))
{
Logging.Write("Interacting With {0}", gameObj.Name);
gameObj.Interact();
}
}
}
}