kaihaider
Community Developer
- Joined
- May 18, 2010
- Messages
- 1,325
Code:
if (BotManager.Current.Name == "Fate Bot" && (Poi.Current.Unit as BattleCharacter) != null && Poi.Current.Type == PoiType.Kill
&& ((Poi.Current.Unit as BattleCharacter).FateId == 0 || Poi.Current.Unit.IsFateGone)
&& !FateManager.WithinFate && AttemptPoiChange < DateTime.UtcNow.TimeOfDay)
{
Logging.Write(Colors.SkyBlue, "[Patrol] Searching for Fate");
AttemptPoiChange = DateTime.UtcNow.TimeOfDay + TimeSpan.FromSeconds(5);
var activeFates = FateManager.ActiveFates.Where(fate => fate.IsValid
&& (FatebotSettings.Instance.MonsterSlayingEnabled && fate.Icon == FateIconType.Battle
|| FatebotSettings.Instance.EscortEnabled && (fate.Icon == FateIconType.ProtectNPC || fate.Icon == FateIconType.ProtectNPC2)
|| FatebotSettings.Instance.BossEnabled && fate.Icon == FateIconType.Boss && FatebotSettings.Instance.BossPercentRequired < fate.Progress)
&& FatebotSettings.Instance.MinLevel <= fate.Level && fate.Level <= (Core.Me.ClassLevel +FatebotSettings.Instance.MaxLevel)).OrderBy(fate => Core.Me.Distance(fate.Location)) .Take(8).ToArray();
if (activeFates.Any())
{
var navReq = activeFates.Select(r => new CanFullyNavigateTarget { Id = r.Id, Position = r.Location });
var resultsArray = Navigator.NavigationProvider.CanFullyNavigateTo(navReq);
if (resultsArray != null)
{
var result = resultsArray.FirstOrDefault(r => r.CanNavigate == 1);
Poi.Current = new Poi(activeFates.FirstOrDefault(z => result != null && z.Id == result.Id), PoiType.Fate);
Logging.Write(Colors.SkyBlue, "[Patrol] Attempting to Set Fate");
AttemptPoiChange = DateTime.UtcNow.TimeOfDay + TimeSpan.FromSeconds(15);
}
}
}
typically it will attempt to set poi when a fate appears, fatebot will clear poi saying it's not valid then fatebot will set the new fate as poi
Please tell me what I'm doing wrong :S
btw, I also sometimes get memory read errors from the .FateId
Attachments
Last edited: