internal static Composite CreateKitingBehavior() { return (new Decorator( ctx => BelphegorSettings.Instance.Kiting.IsKitingActive, new Sequence( new Action(ctx => RegenerateCache(MinimumDistance, (CombatContext)ctx)), new PrioritySelector( new Decorator( ctx => CheckTimer.IsFinished && _currentTargetPoint == Vector3.Zero && NeedsToGetGround, new Action( ctx => { Log.Info("Kiting behavior started."); _currentTargetPoint = ((CombatContext)ctx).PlayerPosition. GeneratePossibleTargetPointsInHalfCircleFacingAwayFromTarget( (CombatContext)ctx, ((CombatContext)ctx).TargetPosition, MaximumDistance - MinimumDistance). FirstOrDefault( p => ((CombatContext)ctx).UnitPositions.CachedPositions.Any( cp => cp.Position.DistanceSqr(p) < BelphegorSettings.Instance.Kiting.AggroRange * BelphegorSettings.Instance.Kiting.AggroRange)); if (_currentTargetPoint == Vector3.Zero) { Log.Info("Kiting failed to find target spot."); CheckTimer.Reset(); return RunStatus.Success; } Log.Info("Kiting target position found."); return RunStatus.Failure; } ) ), new Decorator( ctx => (_currentTargetPoint != Vector3.Zero && (_currentTargetPoint.DistanceSqr(((CombatContext)ctx).PlayerPosition) < 4f * 4f || _currentTargetPoint.DistanceSqr(((CombatContext)ctx).PlayerPosition) > (MaximumDistance - MinimumDistance) * (MaximumDistance - MinimumDistance))) || ZetaDia.Me.Movement.StuckFlags.HasFlag(StuckFlags.WasStuck), new Action(ret => { _currentTargetPoint = Vector3.Zero; CheckTimer.Reset(); Log.Info("Kiting behavior finished."); }) ), new Decorator( ctx => _currentTargetPoint != Vector3.Zero, CommonBehaviors.MoveAndStop(ret => _currentTargetPoint, 4f, true, "Kiting Position") ) ) ) )); }
public static Composite CreateUseHealthWell() { return (new Decorator( ret => BelphegorSettings.Instance.UseHealthWell && ZetaDia.Me.HitpointsCurrentPct <= BelphegorSettings.Instance.HealthWellHP, new PrioritySelector(ctx => HealthWell, new Decorator(ctx => ctx != null, new PrioritySelector( new Decorator(ctx => ((DiaObject)ctx).Distance > 14f, CommonBehaviors.MoveAndStop( ctx => ((DiaObject)ctx).Position, 14f)), new Decorator(ctx => ((DiaObject)ctx).Distance <= 14f, new Action(ctx => { ((DiaObject)ctx).Interact(); Blacklist.Add( ((DiaObject)ctx). ACDGuid, BlacklistFlags.All, TimeSpan.FromMinutes(10)); } ) ) ) ) ) )); }
/// <summary> /// Tries to navigate to a given GameObject with the selected navigation mode. /// </summary> /// <param name="obj"></param> /// <returns></returns> private async Task <bool> PerformNavigation(GameObject obj) { if (Settings.BotBase.Instance.WaypointGenerationMode == WaypointGenerationMode.Offmesh) { Navigator.PlayerMover.MoveTowards(obj.Location); return(await Task.FromResult(true)); } if (Settings.BotBase.Instance.WaypointGenerationMode == WaypointGenerationMode.NavGraph) { if (!MovementManager.IsFlying && !MovementManager.IsDiving) { await CommonBehaviors.MoveAndStop( r => obj.Location, r => MoveToDistance, true, "Following selected target") .ExecuteCoroutine(); } else { Flightor.MoveTo(obj.Location); } return(await Task.FromResult(true)); } return(await Task.FromResult(false)); }
/// <summary> /// Tries to navigate to a given GameObject with the selected navigation mode. /// </summary> /// <param name="obj"></param> /// <returns></returns> private async Task <bool> PerformNavigation(GameObject obj) { if (!BotBase.Instance.UseNavGraph) { Navigator.PlayerMover.MoveTowards(obj.Location); return(await Task.FromResult(true)); } if (BotBase.Instance.UseNavGraph) { if (!MovementManager.IsFlying && !MovementManager.IsDiving) { await CommonBehaviors.MoveAndStop( r => obj.Location, r => BotBase.Instance.FollowDistance, true, "Following selected target") .ExecuteCoroutine(); } else { if (WaitHelper.Instance.IsDoneWaiting("FlightorWaitingTimer", TimeSpan.FromMilliseconds(500), true)) { Flightor.MoveTo(obj.Location); } } return(await Task.FromResult(true)); } return(await Task.FromResult(false)); }
public Composite CreateBasicCombat() { return(new PrioritySelector(ctx => Core.Player.CurrentTarget as BattleCharacter, new Decorator(ctx => ctx != null, new PrioritySelector( new Decorator(ctx => !RoutineManager.IsAnyDisallowed(CapabilityFlags.Movement), new PrioritySelector( CommonBehaviors.MoveToLos(ctx => ctx as GameObject), CommonBehaviors.MoveAndStop(ctx => (ctx as GameObject).Location, ctx => Core.Player.CombatReach + PullRange, true, "Moving to unit") )), //CombatBuffs Spell.Cast("Toad Oil", r => !Core.Me.HasAura("Toad Oil")), //Interrupt Spell.Cast("Flying Sardine", r => shouldFishSlap), //Basic Combat Spell.Cast("Triple Trident", r => Core.Me.HasAura("Tingling") && Core.Me.HasAura("Harmonized")), Spell.Cast("Whistle", r => ActionManager.LastSpell.Name == "Tingle"), Spell.Cast("Tingle", r => DataManager.GetSpellData(23264).Cooldown.TotalMilliseconds == 0 && Core.Me.CurrentTarget.CurrentHealthPercent > 30 && Core.Target.Distance2D(Core.Me) <= 6f), Spell.Cast("Lucid Dreaming", r => ActionManager.HasSpell("Lucid Dreaming") && Core.Player.CurrentManaPercent < 50), Spell.Cast("Blood Drain", r => Core.Player.CurrentManaPercent < 20), Spell.Cast("Off-guard", r => Core.Me.CurrentTarget.CurrentHealthPercent < 50), Spell.Cast("Bad Breath", r => ActionManager.LastSpell.Name != "Bad Breath" && Core.Me.IsFacing(Core.Target) && Core.Target.Distance2D(Core.Me) <= 8f && !Core.Target.HasAura("Poison") && Core.Me.CurrentTarget.CurrentHealthPercent > 40), Spell.Cast("Plaincracker", r => GameObjectManager.NumberOfAttackers >= 2 && Core.Target.Distance2D(Core.Me) <= 4f), Spell.Cast("Whistle", r => !Core.Me.HasAura("Boost") && !Core.Me.HasAura("Harmonized") && !Core.Target.HasAura("Off-guard") && ActionManager.HasSpell("Abyssal Transfixion")), Spell.Cast("Abyssal Transfixion", r => true), Spell.Cast("1000 Needles", r => Core.Me.CurrentTarget.CurrentHealthPercent > 75 && ActionManager.LastSpell.Name != "1000 Needles"), Spell.Cast("Water Cannon", r => true) )))); }
protected Composite Behavior() { return(new PrioritySelector( new Decorator(ret => QuestId != 0 && QuestLogManager.GetQuestById(QuestId).Step > StepId, new Action(r => { Poi.Clear("Exiting SmartMove tag"); _done = true; }) ), new Decorator(ret => Core.Me.Location.Distance(Position) <= Distance, new Action(ret => { MovementManager.MoveForwardStop(); Poi.Clear("Exiting SmartMove tag"); _done = true; } ) ), new Decorator(ret => Talk.DialogOpen, new Action(ret => Talk.Next()) ), new Decorator(ret => !UseMesh, new Action(ret => Navigator.PlayerMover.MoveTowards(Position)) ), new Decorator(ret => UseMesh, CommonBehaviors.MoveAndStop(ret => Position, Distance, stopInRange: true, destinationName: Name) ), new ActionAlwaysSucceed() )); }
// ), // new Decorator(ret => QuestId == 66633 && GameObjectManager.GetObjectByNPCId(2002522) != null && GameObjectManager.GetObjectByNPCId(2002522).IsVisible, // new PrioritySelector( // new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2002522).Location) <= 3, // new Action(r => // { // GameObjectManager.GetObjectByNPCId(2002522).Interact(); // }) // ), // CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2002522).Location, 3) // ) // ), // new Decorator(ret => QuestId == 66448 && GameObjectManager.GetObjectByNPCId(2002279) != null && GameObjectManager.GetObjectByNPCId(2002279).IsVisible, // new PrioritySelector( // new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2002279).Location) <= 3, // new Action(r => // { // GameObjectManager.GetObjectByNPCId(2002279).Interact(); // }) // ), // CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2002279).Location, 3) // ) // ), // new Decorator(ret => QuestId == 66057 && ((GameObjectManager.GetObjectByNPCId(2002428) != null && GameObjectManager.GetObjectByNPCId(2002428).IsVisible) || (GameObjectManager.GetObjectByNPCId(2002427) != null && GameObjectManager.GetObjectByNPCId(2002427).IsVisible)), // new PrioritySelector( //new Decorator(ret => GameObjectManager.GetObjectByNPCId(2002428) != null && GameObjectManager.GetObjectByNPCId(2002428).IsVisible, //new PrioritySelector( //new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2002428).Location) <= 3, //new Action(r => //{ //GameObjectManager.GetObjectByNPCId(2002428).Interact(); //}) //), //CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2002428).Location, 3) //) //), // new Decorator(ret => GameObjectManager.GetObjectByNPCId(2002427) != null && GameObjectManager.GetObjectByNPCId(2002427).IsVisible, // new PrioritySelector( // new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2002427).Location) <= 3, // new Action(r => // { // GameObjectManager.GetObjectByNPCId(2002427).Interact(); // }) // ), // CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2002427).Location, 3) // ) // ) // ) // ), // new Decorator(ret => QuestId == 66057 && ((GameObjectManager.GetObjectByNPCId(2094) != null && GameObjectManager.GetObjectByNPCId(2094).IsVisible) || (GameObjectManager.GetObjectByNPCId(1813) != null && GameObjectManager.GetObjectByNPCId(1813).IsVisible)), // new PrioritySelector( // new Decorator(ret => GameObjectManager.GetObjectByNPCId(2094) != null && GameObjectManager.GetObjectByNPCId(2094).IsVisible, // CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2094).Location, 3) // ), // new Decorator(ret => GameObjectManager.GetObjectByNPCId(1813) != null && GameObjectManager.GetObjectByNPCId(1813).IsVisible, // CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(1813).Location, 3) // ) // ) // ), // new Decorator(ret => QuestId == 66540 && Vector3.Distance(Core.Player.Location, ObjectXYZ) < InteractDistance, // new PrioritySelector( // new Decorator(ret => MovementManager.IsMoving, // new Action(r => // { // MovementManager.MoveForwardStop(); // }) // ), // new Decorator(ret => !didthething, // new Action(r => // { // var targetnpc = ff14bot.Managers.GameObjectManager.GetObjectByNPCId((uint)InteractNpcId); // foreach (ff14bot.Managers.BagSlot slot in ff14bot.Managers.InventoryManager.FilledSlots) // { // if (slot.RawItemId == 2000771) // { // slot.UseItem(targetnpc); // didthething = true; // } // } // }) // ) // ) // ), // new Decorator(ret => QuestId == 66638 && GameObjectManager.GetObjectByNPCId(1650) != null && !GameObjectManager.GetObjectByNPCId(1650).CanAttack, // new PrioritySelector( // new Decorator(ret => GameObjectManager.GetObjectByNPCId(1650) != null && GameObjectManager.GetObjectByNPCId(1650).IsVisible, // new PrioritySelector( // new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(1650).Location) <= 3, // new Action(r => // { // ff14bot.Managers.Actionmanager.DoAction(190, GameObjectManager.GetObjectByNPCId(1650)); // }) // ), // CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(1650).Location, 3) // ) // ) // ) // ), protected Composite Q67124() { // (67124) Heavensward - At the end of Our Hope Vector3 c1 = new Vector3(175.0911f, 130.9083f, -430.1f); Vector3 c2 = new Vector3(362.1796f, 137.2033f, -383.6978f); Vector3 c3 = new Vector3(444.7922f, 160.8083f, -566.6742f); return(new PrioritySelector( CommonBehaviors.HandleLoading, new Decorator(ret => QuestLogManager.InCutscene, new ActionAlwaysSucceed()), new Decorator(ret => QuestId == 67124 && GameObjectManager.GetObjectByNPCId(2005850) != null && GameObjectManager.GetObjectByNPCId(2005850).IsVisible&& !Core.Player.InCombat, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2005850).Location) <= 3, new Action(r => { GameObjectManager.GetObjectByNPCId(2005850).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2005850).Location, 3) ) ), new Decorator(ret => DutyManager.InInstance && QuestId == 67124 && !HasCheckPointReached(1) && Core.Me.Location.Distance(c1) < 5, new Action(a => { CheckPointReached(1); })), new Decorator(ret => DutyManager.InInstance && QuestId == 67124 && !HasCheckPointReached(1), CommonBehaviors.MoveAndStop(ret => c1, 3)), new Decorator(ret => DutyManager.InInstance && QuestId == 67124 && !HasCheckPointReached(2) && Core.Me.Location.Distance(c2) < 5, new Action(a => { CheckPointReached(2); })), new Decorator(ret => DutyManager.InInstance && QuestId == 67124 && !HasCheckPointReached(2), CommonBehaviors.MoveAndStop(ret => c2, 3)), new Decorator(ret => DutyManager.InInstance && QuestId == 67124 && !HasCheckPointReached(3) && Core.Me.Location.Distance(c3) < 3, new Action(a => { CheckPointReached(3); })), new Decorator(ret => DutyManager.InInstance && QuestId == 67124 && !HasCheckPointReached(3), CommonBehaviors.MoveAndStop(ret => c3, 3)), base.CreateBehavior() )); }
protected Composite Q68123() { // (68123) Stormblood - With Heart and Steel Vector3 c1 = new Vector3(-299.7701f, -116.947f, -343.4173f); Vector3 c2 = new Vector3(-300f, -74.1117f, -416.5f); return(new PrioritySelector( CommonBehaviors.HandleLoading, new Decorator(ret => QuestLogManager.InCutscene, new ActionAlwaysSucceed()), new Decorator(ret => QuestId == 68123 && GameObjectManager.GetObjectByNPCId(2007630) != null && GameObjectManager.GetObjectByNPCId(2007630).IsVisible, new PrioritySelector( CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2007630).Location, 1) ) ), new Decorator(ret => DutyManager.InInstance && QuestId == 68123 && HasCheckPointReached(1) && Core.Me.Location.Distance(c1) < 3, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(c1) < 3, new Action(r => { MovementManager.MoveForwardStart(); Thread.Sleep(3000); MovementManager.MoveForwardStop(); }) ) ) ), new Decorator(ret => DutyManager.InInstance && QuestId == 68123 && !HasCheckPointReached(1) && Core.Me.Location.Distance(c1) < 3, new Action(a => { CheckPointReached(1); })), new Decorator(ret => DutyManager.InInstance && !Core.Player.InCombat && QuestId == 68123 && !HasCheckPointReached(1), CommonBehaviors.MoveAndStop(ret => c1, 3)), new Decorator(ret => DutyManager.InInstance && QuestId == 68123 && !HasCheckPointReached(2) && Core.Me.Location.Distance(c2) < 5, new Action(a => { CheckPointReached(2); })), new Decorator(ret => DutyManager.InInstance && QuestId == 68123 && !HasCheckPointReached(2), CommonBehaviors.MoveAndStop(ret => c2, 3)), base.CreateBehavior() )); }
protected Composite Q67137() { // (67137) Heavensward - Keeping the Flame Alive return(new PrioritySelector( CommonBehaviors.HandleLoading, new Decorator(ret => QuestLogManager.InCutscene, new ActionAlwaysSucceed()), new Decorator(ret => QuestId == 67137 && GameObjectManager.GetObjectByNPCId(2005546) != null && GameObjectManager.GetObjectByNPCId(2005546).IsVisible&& !Core.Player.InCombat, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2005546).Location) <= 3, new Action(r => { GameObjectManager.GetObjectByNPCId(2005546).Interact(); CheckPointReached(1); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2005546).Location, 3) ) ), new Decorator(ret => QuestId == 67137 && GameObjectManager.GetObjectByNPCId(2006332) != null && GameObjectManager.GetObjectByNPCId(2006332).IsVisible&& !Core.Player.InCombat && HasCheckPointReached(1), new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2006332).Location) <= 3, new Action(r => { GameObjectManager.GetObjectByNPCId(2006332).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2006332).Location, 3) ) ), base.CreateBehavior() )); }
public static Composite CreateUsePoolOfReflection() { return (new Decorator( ret => BelphegorSettings.Instance.UsePoolOfReflection, new PrioritySelector(ctx => PoolOfReflection, new Decorator(ctx => ctx != null, new PrioritySelector( new Decorator(ctx => ((DiaObject)ctx).Distance > 14f, CommonBehaviors.MoveAndStop(ctx => ((DiaObject)ctx).Position, 14f)), new Decorator(ctx => ((DiaObject)ctx).Distance <= 14f, new Action(ctx => { Log.InfoFormat("Using {0}", ((DiaObject)ctx).Name); ((DiaObject)ctx).Interact(); Blacklist.Add(((DiaObject)ctx).ACDGuid, BlacklistFlags.All, TimeSpan.FromMinutes(10)); } ) ) ) ) ) )); }
protected override Composite CreateBehavior() { return(new PrioritySelector( new Decorator(ret => Talk.DialogOpen, new Action(ret => Talk.Next())), new Decorator(ret => SelectYesno.IsOpen, new Action(ret => SelectYesno.ClickYes())), CommonBehaviors.HandleLoading, new Decorator(ret => QuestLogManager.InCutscene, new ActionAlwaysSucceed()), new Decorator(ret => DutyManager.InInstance && Core.Player.IsVisible, new PrioritySelector( //r=> GuardianNPC, //new Decorator(ret => !initialized,new Action(ret => init())), // //new Decorator(r => NeedToMove && ((r as BattleCharacter) == null || !(r as BattleCharacter).IsValid || (r as BattleCharacter).Location.Distance2D(Core.Player.Location) <= 5), new Action(r => NeedToMove = false)), //new Decorator(r => NeedToMove, CommonBehaviors.MoveAndStop(r => (r as BattleCharacter).Location, 5f, true, "Moving back into guardian npc range")), //new Decorator(r => (r as BattleCharacter) != null && ((r as BattleCharacter).Location.DistanceSqr(Core.Player.Location) > LeashSquared), new ActionAlwaysFail()), new ActionRunCoroutine(r => DoControlLogic()), new Decorator(r => CombatTargeting.Instance.FirstUnit == null, new HookExecutor("HotspotPoi")), new HookExecutor("SetCombatPoi"), new ActionAlwaysSucceed() ) ), new Decorator(r => Chocobo.Summoned, new ActionRunCoroutine(r => Chocobo.DismissChocobo())), CommonBehaviors.MoveAndStop(r => XYZ, InteractDistance, true), CreateUseObject(), new ActionAlwaysSucceed() )); }
public Composite CreateBasicPull() { return(new PrioritySelector(ctx => Core.Player.CurrentTarget as BattleCharacter, new Decorator(ctx => ctx != null, new PrioritySelector( CommonBehaviors.MoveToLos(ctx => ctx as GameObject), CommonBehaviors.MoveAndStop(ctx => (ctx as GameObject).Location, ctx => Core.Player.CombatReach + PullRange + (ctx as GameObject).CombatReach, true, "Moving to unit"), Spell.PullCast("Shield Lob"), Spell.PullCast("Fast Blade") )))); }
public static Composite GetBehavior(AvoidanceContext context) { var reportUnknown = new Action(r => context.Capture.CaptureScreenshot(context)); var update = new Action(r => context.Update()); var move = CommonBehaviors.MoveAndStop(r => context.SafeLocation, 1f, true); var avoidCheck = new PrioritySelector(new Decorator(req => context.IsAvoiding, move), new Decorator(req => context.IsWaiting, new Action(r => RunStatus.Success))); return(new Sequence(update, avoidCheck)); }
protected override Composite CreateBehavior() { return (new PrioritySelector(ctx => Target, CustomLogic, new Decorator(ret => Hotspots.Count != 0 && Navigator.InPosition(Position, Core.Me.Location, 5f), new Action(ret => Hotspots.Next()) ), CommonBehaviors.MoveAndStop(ret => Position, 3f, true) )); }
public Composite CreateBasicPull() { return(new PrioritySelector(ctx => Core.Player.CurrentTarget as BattleCharacter, new Decorator(ctx => ctx != null, new PrioritySelector( new Decorator(ctx => !RoutineManager.IsAnyDisallowed(CapabilityFlags.Movement), new PrioritySelector( CommonBehaviors.MoveToLos(ctx => ctx as GameObject), CommonBehaviors.MoveAndStop(ctx => (ctx as GameObject).Location, ctx => Core.Player.CombatReach + PullRange + (ctx as GameObject).CombatReach, true, "Moving to unit") )), Spell.PullCast(r => "Sticky Tongue", r => ActionManager.LastSpell.Name != "Sticky Tongue" && Core.Target.Distance2D(Core.Me) >= 5f), Spell.PullCast(r => "Water Cannon", r => ActionManager.LastSpell.Name != "Water Cannon" && !ActionManager.HasSpell("Sticky Tongue")) )))); }
public static Composite SprintMove(ValueRetriever <Vector3> location) { var move = CommonBehaviors.MoveAndStop(location, 1f, true); var sprint = new Decorator(req => CanSprint, new Action(r => { Actionmanager.Sprint(); return(RunStatus.Failure); })); return(new PrioritySelector(sprint, move)); }
protected Composite Behavior() { return(new PrioritySelector( new Decorator(ret => Condition != null && !ConditionCheck(), new Action(ret => _done = true)), new Decorator(ret => QuestId != 0 && StepId != 0 && QuestLogManager.GetQuestById(QuestId).Step > StepId, new Action(r => { _done = true; }) ), new Decorator(ret => Core.Player.IsMounted, CommonBehaviors.Dismount() ), new Decorator(ret => Talk.DialogOpen, new Action(r => { Talk.Next(); }) ), new Decorator(ret => casted, new Sequence( new Sleep(3, 5), new Action(r => casted = false) ) ), new Decorator(ret => Core.Me.Location.Distance(Position) <= Distance && IsFinished, new Action(ret => _done = true)), new Decorator(ret => Core.Me.Location.Distance(Position) <= Distance && !casted, new Action(r => { Navigator.PlayerMover.MoveStop(); if (!Core.Player.IsCasting) { GameObjectManager.GetObjectByNPCId(NPC).Face(); if (ActionManager.DoAction(SpellID, GameObjectManager.GetObjectByNPCId(NPC))) { ActionManager.DoAction(SpellID, GameObjectManager.GetObjectByNPCId(NPC)); casted = true; } else { ActionManager.DoActionLocation(SpellID, Core.Player.Location); casted = true; } } }) ), CommonBehaviors.MoveAndStop(ret => Position, Distance, stopInRange: true, destinationName: Name), new ActionAlwaysSucceed() )); }
public static Composite CreateGetHealthGlobe() { return (new Decorator( ret => BelphegorSettings.Instance.GetHealthGlobe && ZetaDia.Me.HitpointsCurrentPct <= BelphegorSettings.Instance.HealthGlobeHP, new PrioritySelector(ctx => HealthGlobes, new Decorator(ctx => ctx != null, CommonBehaviors.MoveAndStop(ctx => ((DiaItem)ctx).Position, 1f, false, "Health Globe") )))); }
internal static Composite MovementComposite() { double pullRange = 3; if (Me.IsHealer() || (Me.IsRangedDps() && (Me.CurrentJob != ClassJobType.RedMage || Me.ClassLevel >= 2))) { pullRange = 20; } return(new PrioritySelector(ctx => Target as BattleCharacter, new Decorator(ctx => ctx != null, new PrioritySelector( CommonBehaviors.MoveToLos(target => Target), CommonBehaviors.MoveAndStop(target => Target.Location, Math.Max(Target.CombatReach, Me.CombatReach) + (float)pullRange, true))))); }
public static Composite CloseDistance(float range) { return(new Decorator(ret => !DefaultCombat.MovementDisabled && BuddyTor.Me.CurrentTarget != null, new PrioritySelector( new Decorator(ret => BuddyTor.Me.CurrentTarget.Distance < range, new Action(delegate { Navigator.MovementProvider.StopMovement(); return RunStatus.Failure; })), new Decorator(ret => BuddyTor.Me.CurrentTarget.Distance >= range, CommonBehaviors.MoveAndStop(location => BuddyTor.Me.CurrentTarget.Position, range, true)), new Action(delegate { return RunStatus.Failure; })))); }
protected override Composite CreateBehavior() { return(new PrioritySelector( CommonBehaviors.HandleLoading, new Decorator(r => WorldManager.ZoneId != startmap, new Action(r => _done = true)), new Decorator(ret => Navigator.InPosition(Core.Player.Location, Position, Distance), new ActionRunCoroutine(r => Destination())), new Decorator(r => UseMesh, CommonBehaviors.MoveAndStop(ret => Position, Distance, stopInRange: true, destinationName: Name)), new Decorator(r => !UseMesh, new Action(r => { Core.Player.Face(Position); MovementManager.MoveForwardStart(); })), new ActionAlwaysSucceed() )); }
protected override Composite CreateBehavior() { return(new PrioritySelector( new Decorator(ret => !ConditionCheck(), new Action(ret => _done = true)), new Decorator(ret => Talk.DialogOpen, new Action(r => { Talk.Next(); }) ), new Decorator(ret => casted, new Sequence( new Sleep(3, 5), new Action(r => casted = false) ) ), new Decorator(ret => Core.Me.Location.Distance(Position) <= Distance && IsFinished, new Action(ret => _done = true)), new Decorator(ret => Core.Me.Location.Distance(Position) <= Distance, new PrioritySelector( new Decorator(ret => ActionManager.InSpellInRangeLOS(1, GameObjectManager.GetObjectByNPCId(NPC)) == Enums.SpellRangeCheck.ErrorNotInLineOfSight, CommonBehaviors.MoveToLos(r => GameObjectManager.GetObjectByNPCId(NPC), true) ), new Decorator(ret => true, new Action(r => { if (Core.Player.IsMounted) { ActionManager.Dismount(); } Navigator.PlayerMover.MoveStop(); if (!Core.Player.IsCasting) { ActionManager.DoActionLocation(Enums.ActionType.KeyItem, ItemID, XYZ); casted = true; } }) ) ) ), CommonBehaviors.MoveAndStop(ret => Position, Distance, stopInRange: true, destinationName: Name) )); }
protected Composite Q65886() { // (65886) A Realm Reborn - The Threat Of Superiority return(new PrioritySelector( CommonBehaviors.HandleLoading, new Decorator(ret => QuestLogManager.InCutscene, new ActionAlwaysSucceed()), new Decorator(ret => QuestId == 65886 && GameObjectManager.GetObjectByNPCId(2001471) != null && GameObjectManager.GetObjectByNPCId(2001471).IsVisible&& !Core.Player.InCombat, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2001471).Location) <= 3, new Action(r => { GameObjectManager.GetObjectByNPCId(2001471).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2001471).Location, 3) ) ), base.CreateBehavior() )); }
protected override Composite CreateBehavior() { return(new PrioritySelector( ctx => NPC, new Decorator(r => SelectIconString.IsOpen, new Action(r => { if (DialogOption1 == -1) { TreeRoot.Stop("No DialogOption1 supplied, but found dialog window."); throw new ArgumentException("No DialogOption1 supplied, but found dialog window."); return RunStatus.Failure; } SelectIconString.ClickSlot((uint)DialogOption1); return RunStatus.Success; })), new Decorator(r => SelectString.IsOpen, new Action(r => { if (DialogOption2 == -1) { TreeRoot.Stop("No DialogOption2 supplied, but found dialog window."); throw new ArgumentException("No DialogOption2 supplied, but found dialog window."); return RunStatus.Failure; } SelectString.ClickSlot((uint)DialogOption2); return RunStatus.Success; })), new Decorator(r => dialogwasopen && !Core.Player.HasTarget, new Action(r => { DoneTalking = true; return RunStatus.Success; })), new Decorator(r => Talk.DialogOpen, new Action(r => { Talk.Next(); return RunStatus.Success; })), //new Action(r => { dialogwasopen = true; return RunStatus.Success; }) new Decorator(r => Shop.Open, new ActionRunCoroutine(ctx => BuyItems())), CommonBehaviors.MoveAndStop(ret => XYZ, ret => InteractDistance, true, ret => $"[{GetType().Name}] Moving to {XYZ} so we can buy {ItemNames} from {vendorName}"), new Decorator(ret => NPC == null, new Sequence(new SucceedLogger(r => $"Waiting at {Core.Player.Location} for {vendorName} to spawn so we can purchase {ItemNames}"), new WaitContinue(5, ret => NPC != null, new Action(ret => RunStatus.Failure)))), new Action(ret => NPC.Interact()) )); }
protected Composite Q67131() { // (67131) Heavensward - A Series of Unfortunate Events return(new PrioritySelector( CommonBehaviors.HandleLoading, new Decorator(ret => QuestLogManager.InCutscene, new ActionAlwaysSucceed()), new Decorator(ret => QuestId == 67131 && GameObjectManager.GetObjectByNPCId(4129) != null && GameObjectManager.GetObjectByNPCId(4129).IsVisible&& Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(4129).Location) > 20, CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(4129).Location, 15) ), new Decorator(ret => QuestId == 67131 && GameObjectManager.GetObjectByNPCId(2005710) != null && GameObjectManager.GetObjectByNPCId(2005710).IsVisible&& !Core.Player.InCombat, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2005710).Location) <= 3, new Action(r => { GameObjectManager.GetObjectByNPCId(2005710).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2005710).Location, 3) ) ), base.CreateBehavior() )); }
public Composite CreateBasicCombat() { return(new PrioritySelector(ctx => Core.Player.CurrentTarget as BattleCharacter, new Decorator(ctx => ctx != null, new PrioritySelector( CommonBehaviors.MoveToLos(ctx => ctx as BattleCharacter), CommonBehaviors.MoveAndStop(ctx => (ctx as BattleCharacter).Location, ctx => PullRange + (ctx as BattleCharacter).CombatReach, true, "Moving to unit"), Spell.Cast("Fight or Flight", r => Core.Player), Spell.Cast("Circle of Scorn", r => Core.Player), Spell.Cast("Goring Blade", r => ActionManager.LastSpell.Name == "Riot Blade" && !Core.Target.HasAura("Goring Blade", false)), Spell.Cast("Goring Blade", r => ActionManager.LastSpell.Name == "Riot Blade" && !Core.Target.HasAura("Goring Blade", true, 7000)), Spell.Cast("Royal Authority", r => ActionManager.LastSpell.Name == "Riot Blade"), //Check for mana level at higher level when theother combo action is avail Spell.Cast("Riot Blade", r => ActionManager.LastSpell.Name == "Fast Blade"), Spell.Cast("Fast Blade", r => true), Spell.Cast("Requiescat", r => true), Spell.Cast("Shield Swipe", r => true), Spell.Cast("Spirits Within", r => true), Spell.Cast(r => "Sheltron", r => ShieldSwipe.Cooldown.TotalSeconds <= 5, r => Core.Player) // r => ActionManager.LastSpellId == 0 || ActionManager.LastSpell.Name == "Full Thrust" ) )))); }
protected override Composite CreateBehavior() { return(new PrioritySelector( new Decorator(ret => ShouldStop(), new Action(r => OnDoneWhile())), new Decorator(ret => DateTime.Now > saveNow + TimeSpan.FromSeconds(_timeout) && currentstep == 0, new Action(r => OnTimeout())), // This one will run always kind of a pulse one new Sequence( new Action(r => CountDeath()), new Action(r => IsFateStillActive()), new Action(r => UpdateFateData()), new ActionAlwaysFail() //always fail that the rest of the tree is traveresd ), //Start fighting Fate Mobs but only when we are in close range to the fate position.TBD enhance this filter #region sync//level Sync new Decorator(r => currentfate != null && FateManager.WithinFate && currentfate.MaxLevel < Core.Player.ClassLevel && !Core.Me.IsLevelSynced, new ActionRunCoroutine(async r => { Logging.Write("Applying Level Sync."); ToDoList.LevelSync(); await Coroutine.Sleep(500); return false; }) ), #endregion sync//level Sync #region Movment new Decorator( ret => currentstep == 1 && Vector3.Distance(Core.Player.Location, Position) > (currentfate.Radius - 10), UseFlight ? new ActionRunCoroutine(obj => FlyTo(Position, true, true)) : CommonBehaviors.MoveAndStop(ret => Position, Distance, stopInRange: true, destinationName: "Moving to Fates.") ), #region Handin new Decorator(r => currentfate != null && FateManager.WithinFate && currentfate.Icon == FateIconType.KillHandIn && currentfate.TimeLeft.Minutes <= 8, new Sequence( new Action(r => { Poi.Clear("Handing in items."); Logging.Write("Hand-in Fate"); var npc = GameObjectManager .GetObjectsOfType <BattleCharacter>() .Where( b => b.IsFate && !b.CanAttack && b.FateId == currentfate.Id); var q = from s in npc group s by s into g orderby g.Count() descending select g.Key; if (q.LastOrDefault() == null) { Logging.Write("Could not find handin NPC. Something is wrong."); return; } tempProvider = CombatTargeting.Instance.Provider; CombatTargeting.Instance.Provider = new NullTargetingProvider(); MoveTo(q.LastOrDefault().Location); GameObjectManager.GetObjectByNPCId(q.LastOrDefault().NpcId).Interact(); Talk.Next(); InventoryManager.GetBagByInventoryBagId(InventoryBagId.KeyItems).FilledSlots.LastOrDefault().Handover(); Request.HandOver(); CombatTargeting.Instance.Provider = tempProvider; }), new ActionAlwaysFail() //always fail that the rest of the tree is traveresd )), new Decorator(ret => Talk.DialogOpen, new Action(r => { Talk.Next(); })), new Decorator(ret => Request.IsOpen, new Action(r => { GameObjectManager.GetObjectByNPCId(npc.NpcId).Interact(); InventoryManager.GetBagByInventoryBagId(InventoryBagId.KeyItems).FilledSlots.LastOrDefault().Handover(); Request.HandOver(); })), //Find fates #endregion Handin #endregion Movment #region escort new Decorator(r => currentfate != null && fateid != 0 && Poi.Current.Type != PoiType.Kill, new ActionRunCoroutine(async r => MoveToFocusedFate()) ), #endregion escort new Decorator(ret => currentfate == null && currentstep == 0, new Sequence( new Action(r => { getFates(); if (currentfate != null) { GoFate(); } else { GoHunting(); } } ) )), new ActionAlwaysSucceed() )); }
protected override Composite CreateBehavior() { return(new PrioritySelector( CommonBehaviors.HandleLoading, new Decorator(ret => QuestLogManager.InCutscene, new ActionAlwaysSucceed() ), new Decorator(ret => QuestId == 65801 && GameObjectManager.GetObjectByNPCId(1004142) != null && !GameObjectManager.GetObjectByNPCId(1004142).CanAttack, new PrioritySelector( new Decorator(ret => GameObjectManager.GetObjectByNPCId(1004142) != null && GameObjectManager.GetObjectByNPCId(1004142).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(1004142).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Handing over items to the Order of the Nald'thal Priest!"); ff14bot.Managers.GameObjectManager.GetObjectByNPCId(1004142).Interact(); Thread.Sleep(2000); ff14bot.RemoteWindows.Talk.Next(); Thread.Sleep(5000); foreach (ff14bot.Managers.BagSlot slot in ff14bot.Managers.InventoryManager.FilledSlots) { if (slot.RawItemId == 2000404) { slot.Handover(); } } Thread.Sleep(2000); foreach (ff14bot.Managers.BagSlot slot in ff14bot.Managers.InventoryManager.FilledSlots) { if (slot.RawItemId == 2000411) { slot.Handover(); } } Thread.Sleep(2000); if (ff14bot.RemoteWindows.Request.IsOpen) { ff14bot.RemoteWindows.Request.HandOver(); } Thread.Sleep(2000); if (ff14bot.RemoteWindows.SelectYesno.IsOpen) { ff14bot.RemoteWindows.SelectYesno.ClickYes(); } Thread.Sleep(2000); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(1004142).Location, 3) ) ) ) ), new Decorator(ret => QuestId == 65886 && !Core.Player.InCombat && GameObjectManager.GetObjectByNPCId(2001471) != null && GameObjectManager.GetObjectByNPCId(2001471).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2001471).Location) <= 3, new Action(r => { GameObjectManager.GetObjectByNPCId(2001471).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2001471).Location, 3) ) ), new Decorator(ret => QuestId == 65995 && GameObjectManager.GetObjectByNPCId(2002521) != null && GameObjectManager.GetObjectByNPCId(2002521).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2002521).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2002521!"); GameObjectManager.GetObjectByNPCId(2002521).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2002521).Location, 3) ) ), new Decorator(ret => QuestId == 66057 && ((GameObjectManager.GetObjectByNPCId(2002428) != null && GameObjectManager.GetObjectByNPCId(2002428).IsVisible) || (GameObjectManager.GetObjectByNPCId(2002427) != null && GameObjectManager.GetObjectByNPCId(2002427).IsVisible)), new PrioritySelector( new Decorator(ret => GameObjectManager.GetObjectByNPCId(2002428) != null && GameObjectManager.GetObjectByNPCId(2002428).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2002428).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with Rope Bond!"); GameObjectManager.GetObjectByNPCId(2002428).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2002428).Location, 3) ) ), new Decorator(ret => GameObjectManager.GetObjectByNPCId(2002427) != null && GameObjectManager.GetObjectByNPCId(2002427).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2002427).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with Rope Bond!"); GameObjectManager.GetObjectByNPCId(2002427).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2002427).Location, 3) ) ) ) ), new Decorator(ret => QuestId == 66448 && GameObjectManager.GetObjectByNPCId(2002279) != null && GameObjectManager.GetObjectByNPCId(2002279).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2002279).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with Draconian Rosary!"); GameObjectManager.GetObjectByNPCId(2002279).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2002279).Location, 3) ) ), new Decorator(ret => QuestId == 66540 && Vector3.Distance(Core.Player.Location, ObjectXYZ) < InteractDistance, new PrioritySelector( new Decorator(ret => MovementManager.IsMoving, new Action(r => { MovementManager.MoveForwardStop(); }) ), new Decorator(ret => !didthething, new Action(r => { var targetnpc = ff14bot.Managers.GameObjectManager.GetObjectByNPCId((uint)InteractNpcId); foreach (ff14bot.Managers.BagSlot slot in ff14bot.Managers.InventoryManager.FilledSlots) { if (slot.RawItemId == 2000771) { slot.UseItem(targetnpc); didthething = true; } } }) ) ) ), new Decorator(ret => QuestId == 66596 && GameObjectManager.GetObjectByNPCId(2002296) != null && GameObjectManager.GetObjectByNPCId(2002296).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2002296).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with Glowing Grimoire!"); GameObjectManager.GetObjectByNPCId(2002296).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2002296).Location, 3) ) ), new Decorator(ret => QuestId == 66633 && GameObjectManager.GetObjectByNPCId(2002522) != null && GameObjectManager.GetObjectByNPCId(2002522).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2002522).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2002522!"); GameObjectManager.GetObjectByNPCId(2002522).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2002522).Location, 3) ) ), new Decorator(ret => QuestId == 66638 && GameObjectManager.GetObjectByNPCId(1650) != null && !GameObjectManager.GetObjectByNPCId(1650).CanAttack, new PrioritySelector( new Decorator(ret => GameObjectManager.GetObjectByNPCId(1650) != null && GameObjectManager.GetObjectByNPCId(1650).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(1650).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Using spell 190 on NPC 1650 !"); ff14bot.Managers.Actionmanager.DoAction(190, GameObjectManager.GetObjectByNPCId(1650)); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(1650).Location, 3) ) ) ) ), new Decorator(ret => QuestId == 67212 && ((GameObjectManager.GetObjectByNPCId(2005846) != null && GameObjectManager.GetObjectByNPCId(2005846).IsVisible) || (GameObjectManager.GetObjectByNPCId(2005845) != null && GameObjectManager.GetObjectByNPCId(2005845).IsVisible) || (GameObjectManager.GetObjectByNPCId(2005844) != null && GameObjectManager.GetObjectByNPCId(2005844).IsVisible) || (GameObjectManager.GetObjectByNPCId(2005843) != null && GameObjectManager.GetObjectByNPCId(2005843).IsVisible)), new PrioritySelector( new Decorator(ret => GameObjectManager.GetObjectByNPCId(2005846) != null && GameObjectManager.GetObjectByNPCId(2005846).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2005846).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2005846!"); GameObjectManager.GetObjectByNPCId(2005846).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2005846).Location, 3) ) ), new Decorator(ret => GameObjectManager.GetObjectByNPCId(2005845) != null && GameObjectManager.GetObjectByNPCId(2005845).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2005845).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2005845!"); GameObjectManager.GetObjectByNPCId(2005845).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2005845).Location, 3) ) ), new Decorator(ret => GameObjectManager.GetObjectByNPCId(2005844) != null && GameObjectManager.GetObjectByNPCId(2005844).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2005844).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2005844!"); GameObjectManager.GetObjectByNPCId(2005844).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2005844).Location, 3) ) ), new Decorator(ret => GameObjectManager.GetObjectByNPCId(2005843) != null && GameObjectManager.GetObjectByNPCId(2005843).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2005843).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2005843!"); GameObjectManager.GetObjectByNPCId(2005843).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2005843).Location, 3) ) ) ) ), // Attacked by mobs when trying to use the object - need to attack the mobs first // new Decorator(ret => QuestId == 67224 && GameObjectManager.GetObjectByNPCId(2006084) != null && GameObjectManager.GetObjectByNPCId(2006084).IsVisible, // new PrioritySelector( // new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2006084).Location) <= 3, // new Action(r => // { // Logging.Write("[ExtendedDuty] Interacting with object 2006084!"); // GameObjectManager.GetObjectByNPCId(2006084).Interact(); // }) // ), // CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2006084).Location, 3) // ) // ), new Decorator(ret => QuestId == 67240 && ((GameObjectManager.GetObjectByNPCId(2006369) != null && GameObjectManager.GetObjectByNPCId(2006369).IsVisible) || (GameObjectManager.GetObjectByNPCId(2006370) != null && GameObjectManager.GetObjectByNPCId(2006370).IsVisible) || (GameObjectManager.GetObjectByNPCId(2005848) != null && GameObjectManager.GetObjectByNPCId(2005848).IsVisible) || (GameObjectManager.GetObjectByNPCId(2006175) != null && GameObjectManager.GetObjectByNPCId(2006175).IsVisible) || (GameObjectManager.GetObjectByNPCId(2005851) != null && GameObjectManager.GetObjectByNPCId(2005851).IsVisible)), new PrioritySelector( new Decorator(ret => GameObjectManager.GetObjectByNPCId(2006369) != null && GameObjectManager.GetObjectByNPCId(2006369).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2006369).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2006369!"); GameObjectManager.GetObjectByNPCId(2006369).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2006369).Location, 3) ) ), new Decorator(ret => GameObjectManager.GetObjectByNPCId(2006370) != null && GameObjectManager.GetObjectByNPCId(2006370).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2006370).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2006370!"); GameObjectManager.GetObjectByNPCId(2006370).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2006370).Location, 3) ) ), new Decorator(ret => GameObjectManager.GetObjectByNPCId(2005848) != null && GameObjectManager.GetObjectByNPCId(2005848).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2005848).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2005848!"); GameObjectManager.GetObjectByNPCId(2005848).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2005848).Location, 3) ) ), new Decorator(ret => GameObjectManager.GetObjectByNPCId(2006175) != null && GameObjectManager.GetObjectByNPCId(2006175).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2006175).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2006175!"); GameObjectManager.GetObjectByNPCId(2006175).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2006175).Location, 3) ) ), new Decorator(ret => GameObjectManager.GetObjectByNPCId(2005851) != null && GameObjectManager.GetObjectByNPCId(2005851).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2005851).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2005851!"); GameObjectManager.GetObjectByNPCId(2005851).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2005851).Location, 3) ) ) ) ), new Decorator(ret => QuestId == 67549 && !Core.Player.InCombat && GameObjectManager.GetObjectByNPCId(2005959) != null && GameObjectManager.GetObjectByNPCId(2005959).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2005959).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2005959!"); GameObjectManager.GetObjectByNPCId(2005959).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2005959).Location, 3) ) ), new Decorator(ret => QuestId == 67552 && ((GameObjectManager.GetObjectByNPCId(2005851) != null && GameObjectManager.GetObjectByNPCId(2005851).IsVisible) || (GameObjectManager.GetObjectByNPCId(2006044) != null && GameObjectManager.GetObjectByNPCId(2006044).IsVisible) || (GameObjectManager.GetObjectByNPCId(2006045) != null && GameObjectManager.GetObjectByNPCId(2006045).IsVisible)), new PrioritySelector( new Decorator(ret => GameObjectManager.GetObjectByNPCId(2005851) != null && GameObjectManager.GetObjectByNPCId(2005851).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2005851).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2005851!"); GameObjectManager.GetObjectByNPCId(2005851).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2005851).Location, 3) ) ), new Decorator(ret => GameObjectManager.GetObjectByNPCId(2006044) != null && GameObjectManager.GetObjectByNPCId(2006044).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2006044).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2006044!"); GameObjectManager.GetObjectByNPCId(2006044).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2006044).Location, 3) ) ), new Decorator(ret => GameObjectManager.GetObjectByNPCId(2006045) != null && GameObjectManager.GetObjectByNPCId(2006045).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2006045).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2006045!"); GameObjectManager.GetObjectByNPCId(2006045).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2006045).Location, 3) ) ) ) ), new Decorator(ret => QuestId == 67555 && GameObjectManager.GetObjectByNPCId(3861) != null && !GameObjectManager.GetObjectByNPCId(3861).CanAttack, new PrioritySelector( new Decorator(ret => GameObjectManager.GetObjectByNPCId(3861) != null && GameObjectManager.GetObjectByNPCId(3861).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(3861).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Using spell 3594 on NPC 3861!"); ff14bot.Managers.Actionmanager.DoAction(3594, GameObjectManager.GetObjectByNPCId(3861)); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(3861).Location, 3) ) ) ) ), new Decorator(ret => QuestId == 67555 && !Core.Player.InCombat && GameObjectManager.GetObjectByNPCId(2005632) != null && GameObjectManager.GetObjectByNPCId(2005632).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2005632).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2005632!"); GameObjectManager.GetObjectByNPCId(2005632).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2005632).Location, 3) ) ), new Decorator(ret => QuestId == 67592 && !Core.Player.InCombat && GameObjectManager.GetObjectByNPCId(2005823) != null && GameObjectManager.GetObjectByNPCId(2005823).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2005823).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2005823!"); GameObjectManager.GetObjectByNPCId(2005823).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2005823).Location, 3) ) ), new Decorator(ret => QuestId == 67593 && GameObjectManager.GetObjectByNPCId(2006340) != null && GameObjectManager.GetObjectByNPCId(2006340).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2006340).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2006340!"); GameObjectManager.GetObjectByNPCId(2006340).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2006340).Location, 3) ) ), new Decorator(ret => QuestId == 67640 && ((GameObjectManager.GetObjectByNPCId(2006281) != null && GameObjectManager.GetObjectByNPCId(2006281).IsVisible) || (GameObjectManager.GetObjectByNPCId(2006283) != null && GameObjectManager.GetObjectByNPCId(2006283).IsVisible) || (GameObjectManager.GetObjectByNPCId(2006285) != null && GameObjectManager.GetObjectByNPCId(2006285).IsVisible) || (GameObjectManager.GetObjectByNPCId(2006282) != null && GameObjectManager.GetObjectByNPCId(2006282).IsVisible) || (GameObjectManager.GetObjectByNPCId(2006284) != null && GameObjectManager.GetObjectByNPCId(2006284).IsVisible) || (GameObjectManager.GetObjectByNPCId(2006286) != null && GameObjectManager.GetObjectByNPCId(2006286).IsVisible)), new PrioritySelector( new Decorator(ret => GameObjectManager.GetObjectByNPCId(2006281) != null && GameObjectManager.GetObjectByNPCId(2006281).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2006281).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2006281!"); GameObjectManager.GetObjectByNPCId(2006281).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2006281).Location, 3) ) ), new Decorator(ret => GameObjectManager.GetObjectByNPCId(2006283) != null && GameObjectManager.GetObjectByNPCId(2006283).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2006283).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2006283!"); GameObjectManager.GetObjectByNPCId(2006283).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2006283).Location, 3) ) ), new Decorator(ret => GameObjectManager.GetObjectByNPCId(2006285) != null && GameObjectManager.GetObjectByNPCId(2006285).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2006285).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2006285!"); GameObjectManager.GetObjectByNPCId(2006285).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2006285).Location, 3) ) ), new Decorator(ret => GameObjectManager.GetObjectByNPCId(2006282) != null && GameObjectManager.GetObjectByNPCId(2006282).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2006282).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2006282!"); GameObjectManager.GetObjectByNPCId(2006282).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2006282).Location, 3) ) ), new Decorator(ret => GameObjectManager.GetObjectByNPCId(2006284) != null && GameObjectManager.GetObjectByNPCId(2006284).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2006284).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2006284!"); GameObjectManager.GetObjectByNPCId(2006284).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2006284).Location, 3) ) ), new Decorator(ret => GameObjectManager.GetObjectByNPCId(2006286) != null && GameObjectManager.GetObjectByNPCId(2006286).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2006286).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2006286!"); GameObjectManager.GetObjectByNPCId(2006286).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2006286).Location, 3) ) ) ) ), new Decorator(ret => QuestId == 67885 && Core.Player.InCombat && GameObjectManager.GetObjectByNPCId(2007454) != null && GameObjectManager.GetObjectByNPCId(2007454).IsVisible, new PrioritySelector( new Decorator(ret => Core.Me.Location.Distance(GameObjectManager.GetObjectByNPCId(2007454).Location) <= 3, new Action(r => { Logging.Write("[ExtendedDuty] Interacting with object 2007454!"); GameObjectManager.GetObjectByNPCId(2007454).Interact(); }) ), CommonBehaviors.MoveAndStop(ret => GameObjectManager.GetObjectByNPCId(2007454).Location, 3) ) ), base.CreateBehavior() )); }
protected override Composite CreateBehavior() { return(new PrioritySelector( CommonBehaviors.HandleLoading, new Decorator(ret => QuestLogManager.InCutscene, new ActionAlwaysSucceed() ), new Decorator(r => Request.IsOpen, new Action(r => { var items = InventoryManager.FilledInventoryAndArmory.ToArray(); for (int i = 0; i < ItemIds.Length; i++) { BagSlot item; item = items.FirstOrDefault(z => z.RawItemId == ItemIds[i] && !usedSlots.Contains(z)); if (item == null) { LogError($"We don't have any items with an id of {ItemIds[i]}."); } else { item.Handover(); usedSlots.Add(item); } } usedSlots.Clear(); Request.HandOver(); }) ), new Decorator(r => Core.Player.HasTarget && UseItem && !doneUseItem, new Action(r => { var targetNpc = GameObjectManager.GetObjectByNPCId(InteractNpcId); foreach (BagSlot slot in InventoryManager.FilledSlots) { if (slot.RawItemId == ItemIds.FirstOrDefault()) { Log($"Using {slot.EnglishName} on {targetNpc.EnglishName}."); slot.UseItem(targetNpc); } } if (Core.Player.IsCasting) { doneUseItem = true; } if (SelectYesno.IsOpen) { doneUseItem = true; } }) ), new Decorator(ret => HasInteractObjects && DutyManager.InInstance && !Core.Player.InCombat && InteractableTarget != null, new PrioritySelector( new Decorator(ret => Core.Player.Location.Distance(InteractableTarget.Location) <= 5, new Action(r => { InteractableTarget.Interact(); }) ), new Decorator(ret => Core.Player.Location.Distance(InteractableTarget.Location) > 5, CommonBehaviors.MoveAndStop(ret => InteractableTarget.Location, 3) ), new ActionAlwaysSucceed() ) ), new Decorator(ret => HasCheckpoints && DutyManager.InInstance, new PrioritySelector( new Decorator(ret => Core.Player.Location.Distance(CurrentCheckpoint) < 5, new Action(r => { Checkpoints.Remove(Checkpoints.First()); }) ), new Decorator(ret => Core.Player.Location.Distance(CurrentCheckpoint) > 5, CommonBehaviors.MoveAndStop(ret => CurrentCheckpoint, 3) ) ) ), base.CreateBehavior() )); }
protected Composite Behavior() { return(new PrioritySelector( // can tag execute? new Decorator(ret => !CanRepair(), new Action(r => { _done = true; }) ), new Decorator(ret => CraftingLog.IsOpen, new ActionRunCoroutine(ctx => StopCrafting()) ), // stage 1: Find the NPC new Decorator(ret => Poi.Current.Type == PoiType.None, new PrioritySelector( new Decorator(ret => GameObjectManager.GetObjectByNPCId(NpcId) != null, new Action(r => { NPC = GameObjectManager.GetObjectByNPCId(NpcId); Poi.Current = new Poi(NPC, PoiType.Vendor); }) ), new Decorator(ret => XYZ != null && Core.Player.Location.Distance(XYZ) > 20f, CommonBehaviors.MoveAndStop(ret => XYZ, 19f, true, null, RunStatus.Success) ), new Decorator(ret => NPC == null, new Action(r => { _done = true; }) ) ) ), // stage 2: go to NPC and Interact new Decorator(ret => Poi.Current.Type == PoiType.Vendor && !Repair.IsOpen, new PrioritySelector( new Decorator(ret => SelectIconString.IsOpen, new Action(r => { SelectIconString.ClickSlot(DialogOption); }) ), new Decorator(ret => Core.Player.Location.Distance(Poi.Current.Location) > 3f, CommonBehaviors.MoveAndStop(ret => Poi.Current.Location, 2f, true, null, RunStatus.Failure) ), new Decorator(ret => Poi.Current.Type == PoiType.Vendor, new Action(r => { Poi.Current.Unit.Interact(); }) ) )), // stage 3: repair new Decorator(ret => Repair.IsOpen, new PrioritySelector( new Decorator(ret => Repaired, new Action(r => { Repair.Close(); _done = true; }) ), new Decorator(ret => Repair.IsOpen && !RepairAllClicked, new Action(r => { RepairAllClicked = true; Repair.RepairAll(); }) ), new Decorator(ret => SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); Repaired = true; }) ) )) )); }