private void firsttrain()
{
List<WoWUnit> WoWUnitList = ObjectManager.GetObjectsOfType<WoWUnit>();
foreach (WoWUnit nearby in WoWUnitList)
{
foreach (Trainer t in firsttrainer)
{
if ((t.ID == nearby.Entry) && (t.team.Equals(meteam) || t.team.Equals("b")))
{
Logging.Write("Running to Trainer");
while (ObjectManager.Me.Location.Distance(nearby.Location) > 25)
{
Styx.Logic.Pathing.Navigator.MoveTo(nearby.Location);
Thread.Sleep(100);
}
ObjectManager.Update();
nearby.Target();
Thread.Sleep(2000);
nearby.Interact();
Thread.Sleep(2000);
try
{
if (GossipFrame.Instance.IsVisible)
{
foreach (var option in GossipFrame.Instance.GossipOptionEntries)
{
if (option.Type == GossipEntry.GossipEntryType.Trainer)
{
GossipFrame.Instance.SelectGossipOption(option.Index);
break;
}
}
}
}
catch (Exception e) { Logging.Write(e.ToString()); }
Thread.Sleep(2000);
Logging.Write("Training First Aid");
Lua.DoString("BuyTrainerService(0)");
Thread.Sleep(5000);
Lua.DoString("CloseTrainer()");
}
}
}
}
private bool needtrain()
{
if (((_firstAid.MaxValue == 50) && (_firstAid.CurrentValue >= 40)) || ((_firstAid.MaxValue == 50) && (_firstAid.CurrentValue >= 50)) || ((_firstAid.MaxValue == 150) && (_firstAid.CurrentValue >= 80)) || ((_firstAid.MaxValue == 150) && (_firstAid.CurrentValue >= 115)) || ((_firstAid.MaxValue == 150) && (_firstAid.CurrentValue >= 150)) || ((_firstAid.MaxValue == 225) && (_firstAid.CurrentValue >= 180)) || ((_firstAid.MaxValue == 225) && (_firstAid.CurrentValue >= 210)) || ((_firstAid.MaxValue == 225) && (_firstAid.CurrentValue >= 225)) || ((_firstAid.MaxValue == 300) && (_firstAid.CurrentValue >= 240)) || ((_firstAid.MaxValue == 300) && (_firstAid.CurrentValue >= 275)) || ((_firstAid.MaxValue == 300) && (_firstAid.CurrentValue >= 290)) || ((_firstAid.MaxValue == 300) && (_firstAid.CurrentValue >= 300)))
{
return true;
}
return false;
}