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!

help setting fate poi

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:
For the memory errors, your checking paramters on an object that might be invalid, so after making sure the object is null you need to make sure !obj.IsInvalid.

As for the poi stuff, its getting cleared due to internal code not currently exposed in the current version. Fatebot assumes a variable will be updated with the currentfate and since its not it clears the poi. Ill change this for next version.
 
For the memory errors, your checking paramters on an object that might be invalid, so after making sure the object is null you need to make sure !obj.IsInvalid.

As for the poi stuff, its getting cleared due to internal code not currently exposed in the current version. Fatebot assumes a variable will be updated with the currentfate and since its not it clears the poi. Ill change this for next version.

awesomeness on both counts, thanks ^_^
 
Back
Top