Esempio n. 1
0
 private void IgniteKeg(BattlefieldContext context)
 {
     if (!context.IsKegIgnited)
     {
         Lua.DoString(IgniteKeg_LuaCommand);
     }
 }
Esempio n. 2
0
        public override void OnStart()
        {
            var         questId = GetQuestId();
            PlayerQuest quest   = StyxWoW.Me.QuestLog.GetQuestById((uint)questId);

            if ((questId != 0) && (quest == null))
            {
                QBCLog.Error("This behavior has been associated with QuestId({0}), but the quest is not in our log", questId);
                IsAttributeProblem = true;
            }

            // If the needed item is not in my inventory, report problem...
            if (!Me.BagItems.Any(i => ItemId_BlindingRageTrap == (int)i.Entry))
            {
                QBCLog.Error("The behavior requires \"Blind Rage Trap\"(ItemId: {0}) to be in our bags; however, it cannot be located)",
                             ItemId_BlindingRageTrap);
                IsAttributeProblem = true;
            }


            // Let QuestBehaviorBase do basic initialization of the behavior, deal with bad or deprecated attributes,
            // capture configuration state, install BT hooks, etc.  This will also update the goal text.
            var isBehaviorShouldRun = OnStart_QuestBehaviorCore();

            // 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 (isBehaviorShouldRun)
            {
                // 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;
                CharacterSettings.Instance.NinjaSkin       = false;
                CharacterSettings.Instance.SkinMobs        = false;
                // don't pull anything unless we absolutely must
                LevelBot.BehaviorFlags &= ~BehaviorFlags.Pull;

                _combatContext = new BattlefieldContext(ItemId_BlindingRageTrap, GameObjectId_BlindingRageTrap);
                this.UpdateGoalText(GetQuestId(), "Looting and Harvesting are disabled while behavior in progress");
            }
        }
Esempio n. 3
0
        private void ChooseTarget(BattlefieldContext context)
        {
            // Prefer to take out Treelaunchers first...
            int targetId = (!IsQuestObjectiveComplete(QuestId, QuestObjectiveIndex_OsulTreelauncher)
                            ? MobId_OsulTreelauncher
                            : MobId_OsulInvader);

            var viableTargets =
                from unit in ObjectManager.GetObjectsOfType <WoWUnit>(true, false)
                where
                unit.IsValid && unit.IsAlive && !Blacklist.Contains(unit, BlacklistFlags.Combat) &&
                (unit.Entry == targetId)
                orderby unit.Distance
                select unit;

            context.SelectedTarget = viableTargets.FirstOrDefault();
            if (context.SelectedTarget != null)
            {
                context.SelectedTarget.Target();
            }
        }
Esempio n. 4
0
        public override void OnStart()
        {
            PlayerQuest quest = StyxWoW.Me.QuestLog.GetQuestById((uint)QuestId);

            if ((QuestId != 0) && (quest == null))
            {
                QBCLog.Error("This behavior has been associated with QuestId({0}), but the quest is not in our log", QuestId);
                IsAttributeProblem = true;
            }

            // 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;
                CharacterSettings.Instance.NinjaSkin       = false;
                CharacterSettings.Instance.SkinMobs        = false;
                CharacterSettings.Instance.PullDistance    = 1; // don't pull anything unless we absolutely must

                _combatContext = new BattlefieldContext(MobId_KegBomb, MobId_KegBombVehicle);

                _behaviorTreeHook_Combat = CreateCombatBehavior();
                TreeHooks.Instance.InsertHook("Combat_Main", 0, _behaviorTreeHook_Combat);

                this.UpdateGoalText(QuestId);
            }
        }