private List <Tuple <string, string> > BuildReplacementArguments()
        {
            var replacementArgs = new List <Tuple <string, string> >();

            QuestBehaviorBase.BuildReplacementArgs_QuestSpec(replacementArgs, QuestId, QuestRequirementComplete, QuestRequirementInLog);
            QuestBehaviorBase.BuildReplacementArg(replacementArgs, ItemId, "ItemId", 0);
            QuestBehaviorBase.BuildReplacementArgs_Ids(replacementArgs, "MobId", MobIds, true);

            QuestBehaviorBase.BuildReplacementArg(replacementArgs, CastingSpellId, "UseWhenMobCastingSpellId", 0);
            QuestBehaviorBase.BuildReplacementArg(replacementArgs, HasAuraId, "UseWhenMeHasAuraId", 0);
            QuestBehaviorBase.BuildReplacementArg(replacementArgs, MobHasAuraId, "UseWhenMobHasAuraId", 0);
            QuestBehaviorBase.BuildReplacementArg(replacementArgs, MobHpPercentLeft, "UseWhenMobHasHealthPercent", 0);

            var useItemStrategy =
                (UseOnce && !BlacklistMob) ? CombatUseItemOnV2.CombatUseItemOnV2.UseItemStrategyType.UseItemOncePerTarget
                : (UseOnce && BlacklistMob) ? CombatUseItemOnV2.CombatUseItemOnV2.UseItemStrategyType.UseItemOncePerTargetDontDefend
                : (!UseOnce && !BlacklistMob) ? CombatUseItemOnV2.CombatUseItemOnV2.UseItemStrategyType.UseItemContinuouslyOnTarget
                : CombatUseItemOnV2.CombatUseItemOnV2.UseItemStrategyType.UseItemContinuouslyOnTargetDontDefend;

            QuestBehaviorBase.BuildReplacementArg(replacementArgs, useItemStrategy, "UseItemStrategy",
                                                  CombatUseItemOnV2.CombatUseItemOnV2.UseItemStrategyType.UseItemOncePerTarget);

            QuestBehaviorBase.BuildReplacementArg(replacementArgs, NumOfTimes, "NumOfTimesToUseItem", 1);
            QuestBehaviorBase.BuildReplacementArg(replacementArgs, MaxRange, "MaxRangeToUseItem", 25.0);
            QuestBehaviorBase.BuildReplacementArg(replacementArgs, WaitTime, "WaitTimeAfterItemUse", 0);
            QuestBehaviorBase.BuildReplacementArg(replacementArgs, Location, "", Me.Location);

            return(replacementArgs);
        }
Ejemplo n.º 2
0
        // 11Apr2013-04:42UTC chinajade
        public static SafePathType GetOrCreate(XElement parentElement, string elementName, double defaultEgressDistance, WoWPoint?safespotLocation = null)
        {
            if (safespotLocation.HasValue &&
                ((safespotLocation.Value == WoWPoint.Empty) || safespotLocation.Value == WoWPoint.Zero))
            {
                safespotLocation = null;
            }

            var safePath = new SafePathType(parentElement
                                            .Elements()
                                            .DefaultIfEmpty(new XElement(elementName))
                                            .FirstOrDefault(elem => (elem.Name == elementName)),
                                            defaultEgressDistance);

            if (!safePath.IsAttributeProblem)
            {
                // If user didn't provide a HuntingGrounds, and he provided a default center point, add it...
                if (!safePath.Waypoints.Any() && safespotLocation.HasValue)
                {
                    safePath.AppendWaypoint(safespotLocation.Value, "safe spot", Navigator.PathPrecision);
                }

                if (!safePath.Waypoints.Any())
                {
                    QuestBehaviorBase.LogError("Neither the X/Y/Z attributes nor the <{0}> sub-element has been specified.",
                                               elementName);
                    safePath.IsAttributeProblem = true;
                }
            }

            return(safePath);
        }
        public override void OnStart()
        {
            QuestBehaviorBase.UsageCheck_ScheduledForDeprecation(this, "InteractWith");

            Lua.Events.AttachEvent("CONFIRM_BINDER", HandleConfirmBinder);

            this.UpdateGoalText(0, _goalText);
        }
        public override void OnStart()
        {
            // This reports problems, and stops BT processing if there was a problem with attributes...
            // We had to defer this action, as the 'profile line number' is not available during the element's
            // constructor call.
            OnStart_HandleAttributeProblem();

            // 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)
            {
                QuestBehaviorBase.DeprecationWarning_Behavior(Element, "BasicInteractWith", "InteractWith", BuildReplacementArguments());

                TreeRoot.GoalText = "Interacting with " + MobName;
            }
        }
        public CombatUseItemOn(Dictionary <string, string> args)
            : base(args)
        {
            QBCLog.BehaviorLoggingContext = this;

            try
            {
                CastingSpellId           = GetAttributeAsNullable <int>("CastingSpellId", false, ConstrainAs.SpellId, null) ?? 0;
                MaxRange                 = GetAttributeAsNullable <double>("MaxRange", false, ConstrainAs.Range, null) ?? 25;
                HasAuraId                = GetAttributeAsNullable <int>("HasAuraId", false, ConstrainAs.AuraId, new[] { "HasAura" }) ?? 0;
                ItemId                   = GetAttributeAsNullable <int>("ItemId", true, ConstrainAs.ItemId, null) ?? 0;
                Location                 = GetAttributeAsNullable <Vector3>("", false, ConstrainAs.Vector3NonEmpty, null) ?? Me.Location;
                MobIds                   = GetNumberedAttributesAsArray <int>("MobId", 1, ConstrainAs.MobId, new[] { "NpcId" });
                MobHasAuraId             = GetAttributeAsNullable <int>("MobHasAuraId", false, ConstrainAs.AuraId, new[] { "NpcHasAuraId", "NpcHasAura" }) ?? 0;
                MobHpPercentLeft         = GetAttributeAsNullable <double>("MobHpPercentLeft", false, ConstrainAs.Percent, new[] { "NpcHpLeft", "NpcHPLeft" }) ?? 0;
                NumOfTimes               = GetAttributeAsNullable <int>("NumOfTimes", false, ConstrainAs.RepeatCount, null) ?? 1;
                QuestId                  = GetAttributeAsNullable <int>("QuestId", false, ConstrainAs.QuestId(this), null) ?? 0;
                UseOnce                  = GetAttributeAsNullable <bool>("UseOnce", false, null, null) ?? true;
                BlacklistMob             = GetAttributeAsNullable <bool>("BlacklistMob", false, null, null) ?? false;
                WaitTime                 = GetAttributeAsNullable <int>("WaitTime", false, ConstrainAs.Milliseconds, null) ?? 500;
                QuestRequirementComplete = GetAttributeAsNullable <QuestCompleteRequirement>("QuestCompleteRequirement", false, null, null) ?? QuestCompleteRequirement.NotComplete;
                QuestRequirementInLog    = GetAttributeAsNullable <QuestInLogRequirement>("QuestInLogRequirement", false, null, null) ?? QuestInLogRequirement.InLog;

                // semantic coherency checks --
                if ((CastingSpellId == 0) && (HasAuraId == 0) && (MobHasAuraId == 0) && (MobHpPercentLeft == 0.0))
                {
                    QBCLog.Error("One or more of the following attributes must be specified:\n"
                                 + "CastingSpellId, HasAuraId, MobHasAuraId, MobHpPercentLeft");
                    IsAttributeProblem = true;
                }

                QuestBehaviorBase.DeprecationWarning_Behavior(this, "CombatUseItemOnV2", BuildReplacementArguments());
            }

            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;
            }
        }
Ejemplo n.º 6
0
        public override void OnStart()
        {
            // This reports problems, and stops BT processing if there was a problem with attributes...
            // We had to defer this action, as the 'profile line number' is not available during the element's
            // constructor call.
            OnStart_HandleAttributeProblem();

            // 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)
            {
                QuestBehaviorBase.DeprecationWarning_Behavior(Element, "BasicUseObject", "InteractWith", BuildReplacementArguments());

                PlayerQuest quest = StyxWoW.Me.QuestLog.GetQuestById((uint)QuestId);

                TreeRoot.GoalText = this.GetType().Name + ": " + ((quest != null) ? ("\"" + quest.Name + "\"") : "In Progress");
            }
        }
        public override void OnStart()
        {
            // This reports problems, and stops BT processing if there was a problem with attributes...
            // We had to defer this action, as the 'profile line number' is not available during the element's
            // constructor call.
            OnStart_HandleAttributeProblem();

            // 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)
            {
                TreeHooks.Instance.InsertHook("Combat_Main", 0, CreateBehavior_MainCombat());

                _auraIds_OccupiedVehicle = QuestBehaviorBase.GetOccupiedVehicleAuraIds();
                // Some CRs will attempt to summon pet (and fail) while riding the bird so lets disallow it.
                _summonPetOriginalState = RoutineManager.GetCapabilityState(CapabilityFlags.PetSummoning);
                RoutineManager.SetCapabilityState(CapabilityFlags.PetSummoning, CapabilityState.Disallowed);
                this.UpdateGoalText(QuestId);
            }
        }
        public HuntingGroundsType(XElement xElement)
            : base(xElement)
        {
            try
            {
                WaypointVisitStrategy = GetAttributeAsNullable <WaypointVisitStrategyType>("WaypointVisitStrategy", false, null, null) ?? WaypointVisitStrategyType.Random;

                Waypoints = new List <WaypointType>();

                int unnamedWaypointNumber = 0;
                foreach (XElement childElement in xElement.Elements().Where(elem => (elem.Name == "Hotspot")))
                {
                    var waypoint = new WaypointType(childElement);

                    if (!waypoint.IsAttributeProblem)
                    {
                        if (string.IsNullOrEmpty(waypoint.Name))
                        {
                            waypoint.Name = string.Format("UnnamedWaypoint{0}", ++unnamedWaypointNumber);
                        }
                        Waypoints.Add(waypoint);
                    }

                    IsAttributeProblem |= waypoint.IsAttributeProblem;
                }

                OnStart_HandleAttributeProblem();
            }

            catch (Exception except)
            {
                if (QuestBehaviorBase.IsExceptionReportingNeeded(except))
                {
                    QuestBehaviorBase.LogError("[PROFILE PROBLEM with \"{0}\"]: {1}\nFROM HERE ({2}):\n{3}\n",
                                               xElement.ToString(), except.Message, except.GetType().Name,
                                               except.StackTrace);
                }
                IsAttributeProblem = true;
            }
        }
Ejemplo n.º 9
0
        public SafePathType(XElement xElement, double defaultEgressDistance)
            : base(xElement)
        {
            try
            {
                DismissPet     = GetAttributeAsNullable <bool>("DismissPet", false, null, null) ?? false;
                EgressDistance = GetAttributeAsNullable <double>("EgressDistance", false, null, null)
                                 ?? defaultEgressDistance;
                Strategy = GetAttributeAsNullable <StrategyType>("Strategy", false, null, null)
                           ?? StrategyType.StalkMobAtAvoidDistance;

                Waypoints = new List <WaypointType>();
                foreach (XElement childElement in xElement.Elements().Where(elem => (elem.Name == "Hotspot")))
                {
                    var waypoint = new WaypointType(childElement);

                    if (!waypoint.IsAttributeProblem)
                    {
                        Waypoints.Add(waypoint);
                    }

                    IsAttributeProblem |= waypoint.IsAttributeProblem;
                }

                OnStart_HandleAttributeProblem();
            }

            catch (Exception except)
            {
                if (QuestBehaviorBase.IsExceptionReportingNeeded(except))
                {
                    QuestBehaviorBase.LogError("[PROFILE PROBLEM with \"{0}\"]: {1}\nFROM HERE ({2}):\n{3}\n",
                                               xElement.ToString(), except.Message, except.GetType().Name,
                                               except.StackTrace);
                }
                IsAttributeProblem = true;
            }
        }
Ejemplo n.º 10
0
        public WaypointType(XElement xElement)
            : base(xElement)
        {
            try
            {
                Location = GetAttributeAsNullable <WoWPoint>("", true, ConstrainAs.WoWPointNonEmpty, null) ?? WoWPoint.Empty;
                Name     = GetAttributeAs <string>("Name", false, ConstrainAs.StringNonEmpty, null) ?? string.Empty;
                Radius   = GetAttributeAsNullable <double>("Radius", false, ConstrainAs.Range, null) ?? 10.0;

                OnStart_HandleAttributeProblem();
            }

            catch (Exception except)
            {
                if (QuestBehaviorBase.IsExceptionReportingNeeded(except))
                {
                    QuestBehaviorBase.LogError("[PROFILE PROBLEM with \"{0}\"]: {1}\nFROM HERE ({2}):\n{3}\n",
                                               xElement.ToString(), except.Message, except.GetType().Name,
                                               except.StackTrace);
                }
                IsAttributeProblem = true;
            }
        }
Ejemplo n.º 11
0
        public override void OnStart()
        {
            QuestBehaviorBase.UsageCheck_ScheduledForDeprecation(this, "EscortGroup");

            // This reports problems, and stops BT processing if there was a problem with attributes...
            // We had to defer this action, as the 'profile line number' is not available during the element's
            // constructor call.
            OnStart_HandleAttributeProblem();

            // 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)
            {
                _configMemento = new ConfigMemento();

                // Disable any settings that may interfere with the escort --
                // When we escort, we don't want to be distracted by other things.
                // NOTE: these settings are restored to their normal values when the behavior completes
                // or the bot is stopped.
                CharacterSettings.Instance.HarvestHerbs    = false;
                CharacterSettings.Instance.HarvestMinerals = false;
                CharacterSettings.Instance.LootChests      = false;
                ProfileManager.CurrentProfile.LootMobs     = false;
                CharacterSettings.Instance.NinjaSkin       = false;
                CharacterSettings.Instance.SkinMobs        = false;

                var mobNames =
                    (from mob in ObjectManager.GetObjectsOfType <WoWUnit>()
                     where ObjectId.Contains((int)mob.Entry)
                     let mobName = Utility.GetObjectNameFromId((int)mob.Entry)
                                   orderby mobName
                                   select mobName)
                    .Distinct();

                this.UpdateGoalText(QuestId, string.Format("Escorting {0}", string.Join(", ", mobNames)));
            }
        }
        // 11Apr2013-04:42UTC chinajade
        public static HuntingGroundsType GetOrCreate(XElement parentElement, string elementName, WoWPoint?defaultHuntingGroundCenter = null)
        {
            var huntingGrounds = new HuntingGroundsType(parentElement
                                                        .Elements()
                                                        .DefaultIfEmpty(new XElement(elementName))
                                                        .FirstOrDefault(elem => (elem.Name == elementName)));

            if (!huntingGrounds.IsAttributeProblem)
            {
                // If user didn't provide a HuntingGrounds, and he provided a default center point, add it...
                if (!huntingGrounds.Waypoints.Any() && defaultHuntingGroundCenter.HasValue)
                {
                    huntingGrounds.AppendWaypoint(defaultHuntingGroundCenter.Value, "hunting ground center", Navigator.PathPrecision);
                }

                if (!huntingGrounds.Waypoints.Any())
                {
                    QuestBehaviorBase.LogError("Neither the X/Y/Z attributes nor the <{0}> sub-element has been specified.", elementName);
                    huntingGrounds.IsAttributeProblem = true;
                }
            }

            return(huntingGrounds);
        }
Ejemplo n.º 13
0
        public override void OnStart()
        {
            QuestBehaviorBase.UsageCheck_ScheduledForDeprecation(this, "EscortGroup");

            this.UpdateGoalText(_questId);
        }