public Brewfest_RamRidingQuests(Dictionary <string, string> args) : base(args) { try { // NB: Core attributes are parsed by QuestBehaviorBase parent (e.g., QuestId, NonCompeteDistance, etc) // QuestBehaviorBase will handle QuestId, but we re-acquire here because it is 'required'... GetAttributeAsNullable <int>("QuestId", true, ConstrainAs.QuestId(this), null); TerminationChecksQuestProgress = false; // RidingPath processing... RidingPath = HuntingGroundsType.GetOrCreate(Element, "RidingPath"); IsAttributeProblem |= RidingPath.IsAttributeProblem; } catch (Exception except) { // Maintenance problems occur for a number of reasons. The primary two are... // * Changes were made to the behavior, and boundary conditions weren't properly tested. // * The Honorbuddy core was changed, and the behavior wasn't adjusted for the new changes. // In any case, we pinpoint the source of the problem area here, and hopefully it can be quickly // resolved. QBCLog.Exception(except); IsAttributeProblem = true; } }
public override async Task <bool> Execute(HuntingGroundsType ridingPath) { // Trot gait (for 8 seconds)... if (!Me.IsQuestObjectiveComplete(QuestId, 1)) { AdjustRamSpeed(RamGaitType.Trot); MoveToNextGoal(ridingPath); return(true); } // Canter gait (for 8 seconds)... if (!Me.IsQuestObjectiveComplete(QuestId, 2)) { AdjustRamSpeed(RamGaitType.Canter); MoveToNextGoal(ridingPath); return(true); } // Gallop gate (for 8 seconds)... if (!Me.IsQuestObjectiveComplete(QuestId, 3)) { AdjustRamSpeed(RamGaitType.Gallop); MoveToNextGoal(ridingPath); return(true); } return(false); }
// Empty, for now #endregion #region Overrides of CustomForcedBehavior public override void OnStart() { // Hunting ground processing... // NB: We had to defer this processing from the constructor, because XElement isn't available // to parse child XML nodes until OnStart() is called. HuntingGrounds = HuntingGroundsType.GetOrCreate(Element, "HuntingGrounds", HuntingGroundCenter); IsAttributeProblem |= HuntingGrounds.IsAttributeProblem; // Let QuestBehaviorBase do basic initializaion of the behavior, deal with bad or deprecated attributes, // capture configuration state, install BT hooks, etc. This will also update the goal text. OnStart_QuestBehaviorCore( string.Format("Using {0} on {1}", GetItemNameFromId(ItemId), string.Join(", ", MobIds.Select(m => GetMobNameFromId(m)).Distinct()))); // If the quest is complete, this behavior is already done... // So we don't want to falsely inform the user of things that will be skipped. if (!IsDone) { ItemToUse = Me.CarriedItems.FirstOrDefault(i => (i.Entry == ItemId)); if (ItemToUse == null) { LogError("[PROFILE ERROR] Unable to locate in our bags", GetItemNameFromId(ItemId)); TreeRoot.Stop(); BehaviorDone(); } CurrentHuntingGroundWaypoint = HuntingGrounds.FindFirstWaypoint(Me.Location); } }
public static async Task <bool> MoveTo( HuntingGroundsType huntingGrounds, MovementByType movementBy = MovementByType.FlightorPreferred) { Contract.Requires(huntingGrounds != null, context => "huntingGrounds may not be null"); var destination = huntingGrounds.CurrentWaypoint().Location; var destinationName = String.Format("hunting ground waypoint '{0}'", huntingGrounds.CurrentWaypoint().Name); return(await MoveTo(destination, destinationName, movementBy)); }
public KillUntilComplete(Dictionary <string, string> args) : base(args) { QBCLog.BehaviorLoggingContext = this; try { // Primary attributes... MobIds = (GetAttributeAsArray <int>("MobIds", false, ConstrainAs.MobId, new[] { "NpcIds" }, null) ?? new int[0]) .Concat(GetNumberedAttributesAsArray <int>("MobId", 0, ConstrainAs.MobId, new[] { "NpcId" }) ?? new int[0]) .ToArray(); HuntingGroundCenter = GetAttributeAsNullable <Vector3>("", false, ConstrainAs.Vector3NonEmpty, null) ?? Me.Location; // Tunables... WaitForNpcs = GetAttributeAsNullable <bool>("WaitForNpcs", false, null, null) ?? true; ImmediatelySwitchToHighestPriorityTarget = GetAttributeAsNullable <bool>("ImmediatelySwitchToHighestPriorityTarget", false, null, null) ?? true; double?forcedTolerance = null; if (MovementBy == MovementByType.FlightorPreferred) { forcedTolerance = 3f; } // Hunting ground processing... HuntingGrounds = HuntingGroundsType.GetOrCreate( Element, "HuntingGrounds", new WaypointType(HuntingGroundCenter, "hunting ground center"), forcedTolerance); IsAttributeProblem |= HuntingGrounds.IsAttributeProblem; AddMobIdsToPersueList(MobIds, PursuitList); } catch (Exception except) { // Maintenance problems occur for a number of reasons. The primary two are... // * Changes were made to the behavior, and boundary conditions weren't properly tested. // * The Honorbuddy core was changed, and the behavior wasn't adjusted for the new changes. // In any case, we pinpoint the source of the problem area here, and hopefully it // can be quickly resolved. QBCLog.Exception(except); IsAttributeProblem = true; } }
public TargetAndMoveToMob(Dictionary <string, string> args) : base(args) { try { // NB: Core attributes are parsed by QuestBehaviorBase parent (e.g., QuestId, NonCompeteDistance, etc) // Primary attributes... MobIds = GetNumberedAttributesAsArray <int>("MobId", 1, ConstrainAs.MobId, null); // Qualifiers TargetOnlyIfHealthPercentAbove = GetAttributeAsNullable <double>("TargetOnlyIfHealthPercentAbove", false, ConstrainAs.Percent, null) ?? 0.0; TargetOnlyIfHealthPercentBelow = GetAttributeAsNullable <double>("TargetOnlyIfHealthPercentBelow", false, ConstrainAs.Percent, null) ?? 100.0; TargetOnlyIfMobHasAuraId = GetNumberedAttributesAsArray <int>("TargetOnlyIfMobHasAuraId", 0, ConstrainAs.AuraId, null); TargetOnlyIfMobMissingAuraId = GetNumberedAttributesAsArray <int>("TargetOnlyIfMobMissingAuraId", 0, ConstrainAs.AuraId, null); // Tunables... HuntingGroundCenter = GetAttributeAsNullable <WoWPoint>("", false, ConstrainAs.WoWPointNonEmpty, null) ?? Me.Location; IgnoreLoSToTarget = GetAttributeAsNullable <bool>("IgnoreLoSToTarget", false, null, null) ?? false; MoveWithinMaxRangeOfMob = GetAttributeAsNullable <double>("MoveWithinMaxRangeOfMob", false, null, null) ?? 30.0; WaitForNpcs = GetAttributeAsNullable <bool>("WaitForNpcs", false, null, null) ?? true; // Hunting ground processing... HuntingGrounds = HuntingGroundsType.GetOrCreate(Element, "HuntingGrounds", new WaypointType(HuntingGroundCenter, "hunting ground center")); IsAttributeProblem |= HuntingGrounds.IsAttributeProblem; } catch (Exception except) { // Maintenance problems occur for a number of reasons. The primary two are... // * Changes were made to the behavior, and boundary conditions weren't properly tested. // * The Honorbuddy core was changed, and the behavior wasn't adjusted for the new changes. // In any case, we pinpoint the source of the problem area here, and hopefully it // can be quickly resolved. QBCLog.Exception(except); IsAttributeProblem = true; } }
public FlyTo(Dictionary <string, string> args) : base(args) { QBCLog.BehaviorLoggingContext = this; try { DefaultAllowedVariance = GetAttributeAsNullable <double>("AllowedVariance", false, new ConstrainTo.Domain <double>(0.0, 50.0), null) ?? 0.0; DefaultArrivalTolerance = GetAttributeAsNullable <double>("ArrivalTolerance", false, new ConstrainTo.Domain <double>(1.5, 30.0), new string[] { "Distance" }) ?? 3; DefaultDestination = GetAttributeAsNullable <Vector3>("", false, ConstrainAs.Vector3NonEmpty, null); DefaultDestinationName = GetAttributeAs <string>("DestName", false, ConstrainAs.StringNonEmpty, new[] { "Name" }) ?? ((DefaultDestination != null) ? DefaultDestination.ToString() : string.Empty); IgnoreIndoors = GetAttributeAsNullable <bool>("IgnoreIndoors", false, null, null) ?? false; Land = GetAttributeAsNullable <bool>("Land", false, null, null) ?? false; MinHeight = GetAttributeAsNullable("MinHeight", false, new ConstrainTo.Domain <float>(0, 200), null); // 'Destination choices' processing... PotentialDestinations = HuntingGroundsType.GetOrCreate(Element, "DestinationChoices", DefaultDestination.HasValue ? new WaypointType(DefaultDestination.Value, DefaultDestinationName, DefaultAllowedVariance, DefaultArrivalTolerance) : null, DefaultArrivalTolerance); IsAttributeProblem |= PotentialDestinations.IsAttributeProblem; } catch (Exception except) { // Maintenance problems occur for a number of reasons. The primary two are... // * Changes were made to the behavior, and boundary conditions weren't properly tested. // * The Honorbuddy core was changed, and the behavior wasn't adjusted for the new changes. // In any case, we pinpoint the source of the problem area here, and hopefully it // can be quickly resolved. QBCLog.Exception(except); IsAttributeProblem = true; } }
public override async Task <bool> Execute(HuntingGroundsType ridingPath) { // Calculate fatigue, and apply hysteresis recovery... var fatigueAura = Me.GetAuraById(AuraId_RamFatigue); // Ram fatigued? if ((fatigueAura != null) && (fatigueAura.StackCount > _stackCountFatigued)) { _inFatigueRecovery = true; } // Ram fatigue recovered? if ((fatigueAura == null) || (fatigueAura.StackCount < _stackCountFatigueRecovered)) { _inFatigueRecovery = false; } // Stay in "Trot" until fatigue recovered... AdjustRamSpeed(_inFatigueRecovery ? RamGaitType.Trot : _maxSpeedWanted); MoveToNextGoal(ridingPath); return(true); }
protected bool MoveToNextGoal(HuntingGroundsType ridingPath) { if (!IsMountedOnRam()) { return(false); } var activeMover = WoWMovement.ActiveMover; var currentWaypoint = ridingPath.CurrentWaypoint(); var moveResult = Navigator.MoveTo(currentWaypoint.Location); if (Navigator.GetRunStatusFromMoveResult(moveResult) == RunStatus.Success) { return(true); } QBCLog.DeveloperInfo( "Navigator unable to move from {0} to destination({1}, {2}) on ground.", activeMover.Location, currentWaypoint.Name, currentWaypoint.Location.ToString()); return(false); }
public override async Task <bool> Execute(HuntingGroundsType ridingPath) { AdjustRamSpeed(_speedWanted); MoveToNextGoal(ridingPath); return(true); }
// Methods concrete classes must implement... public abstract Task <bool> Execute(HuntingGroundsType ridingPath);
public CombatUseItemOnV2(Dictionary <string, string> args) : base(args) { try { // NB: Core attributes are parsed by QuestBehaviorBase parent (e.g., QuestId, NonCompeteDistance, etc) // Primary attributes... ItemId = GetAttributeAsNullable <int>("ItemId", true, ConstrainAs.ItemId, null) ?? 0; string itemUseAlwaysSucceeds = GetAttributeAs <string>("ItemAppliesAuraId", false, ConstrainAs.StringNonEmpty, null) ?? string.Empty; if (itemUseAlwaysSucceeds == "AssumeItemUseAlwaysSucceeds") { ItemAppliesAuraId = 0; } else { ItemAppliesAuraId = GetAttributeAsNullable <int>("ItemAppliesAuraId", false, ConstrainAs.AuraId, null) ?? 0; } MobIds = GetNumberedAttributesAsArray <int>("MobId", 1, ConstrainAs.MobId, null); UseWhenMeHasAuraId = GetAttributeAsNullable <int>("UseWhenMeHasAuraId", false, ConstrainAs.AuraId, null) ?? 0; UseWhenMeMissingAuraId = GetAttributeAsNullable <int>("UseWhenMeMissingAuraId", false, ConstrainAs.AuraId, null) ?? 0; UseWhenMobCastingSpellId = GetAttributeAsNullable <int>("UseWhenMobCastingSpellId", false, ConstrainAs.SpellId, null) ?? 0; UseWhenMobHasAuraId = GetAttributeAsNullable <int>("UseWhenMobHasAuraId", false, ConstrainAs.AuraId, null) ?? 0; UseWhenMobMissingAuraId = GetAttributeAsNullable <int>("UseWhenMobMissingAuraId", false, ConstrainAs.AuraId, null) ?? 0; UseWhenMobHasHealthPercent = GetAttributeAsNullable <double>("UseWhenMobHasHealthPercent", false, ConstrainAs.Percent, null) ?? 0; // Either HuntingGroundCenter or <HuntingGrounds> subelement must be provided... // The sanity check for this is done in OnStart() since that's where we must do // all sub-element processing due to the way CustomForcedBehavior is architected. HuntingGroundCenter = GetAttributeAsNullable <Vector3>("", false, ConstrainAs.Vector3NonEmpty, null); // Tunables... CollectionDistance = GetAttributeAsNullable <double>("CollectionDistance", false, ConstrainAs.Range, null) ?? 100; InteractBlacklistTimeInSeconds = GetAttributeAsNullable <int>("InteractBlacklistTimeInSeconds", false, ConstrainAs.CollectionCount, null) ?? 180; MaxRangeToUseItem = GetAttributeAsNullable <double>("MaxRangeToUseItem", false, ConstrainAs.Range, null) ?? 25.0; NumOfTimes = GetAttributeAsNullable <int>("NumOfTimesToUseItem", false, ConstrainAs.RepeatCount, null) ?? 1; RecallPetAtMobPercentHealth = GetAttributeAsNullable <double>("RecallPetAtMobPercentHealth", false, ConstrainAs.Percent, null) ?? UseWhenMobHasHealthPercent; UseItemStrategy = GetAttributeAsNullable <UseItemStrategyType>("UseItemStrategy", false, null, null) ?? UseItemStrategyType.UseItemOncePerTarget; WaitTimeAfterItemUse = GetAttributeAsNullable <int>("WaitTimeAfterItemUse", false, ConstrainAs.Milliseconds, null) ?? 0; // Hunting ground processing... HuntingGrounds = HuntingGroundsType.GetOrCreate(Element, "HuntingGrounds", (HuntingGroundCenter.HasValue ? new WaypointType(HuntingGroundCenter.Value, "hunting ground center") : null)); IsAttributeProblem |= HuntingGrounds.IsAttributeProblem; } catch (Exception except) { // Maintenance problems occur for a number of reasons. The primary two are... // * Changes were made to the behavior, and boundary conditions weren't properly tested. // * The Honorbuddy core was changed, and the behavior wasn't adjusted for the new changes. // In any case, we pinpoint the source of the problem area here, and hopefully it // can be quickly resolved. QBCLog.Exception(except); IsAttributeProblem = true; } }