예제 #1
0
        public override void Pulse()
        {
            // Check for the elixir aura:
            if (!Me.HasAura("Elixir of Shadows"))
            {
                foreach (WoWItem item in ObjectManager.GetObjectsOfType <WoWItem>())
                {
                    if (item.Entry == 32446)
                    {
                        Logging.Write(_messageColor, "[Sha'tari Helper]: Using {0} we have {1}", item.Name, item.StackCount);
                        Lua.DoString("UseItemByName(&quot;item:\"" + item.Name + "\"&quot;)");
                    }
                }
            }
            else
            {
                // Styx.Helpers.Logging.Write(Color.FromName("DarkRed"), "[Sha'tari Helper]: Already have required aura.");
            }

            // Check if a skull pile is nearby
            ObjectManager.Update();
            List <WoWGameObject> objList = ObjectManager.GetObjectsOfType <WoWGameObject>()
                                           .Where(o => (o.Distance <= LootTargeting.LootRadius && o.Entry == 185913))
                                           .OrderBy(o => o.Distance).ToList();

            foreach (WoWGameObject o in objList)
            {
                if (NumOfItemsInBag(32620) >= 10)
                {
                    Logging.Write(_messageColor, "[Sha'tari Helper]: Activating Skull-Pile");
                    movetoLoc(o.Location);
                    if (inCombat)
                    {
                        if (Me.Mounted)
                        {
                            Mount.Dismount();
                        }
                        return;
                    }
                    o.Interact();
                    Thread.Sleep(GetPing * 5 + 50);
                    numClaws  = NumOfItemsInBag(32716);
                    numTalons = NumOfItemsInBag(32715);
                    numSpines = NumOfItemsInBag(32717);
                    numScales = NumOfItemsInBag(32718);
                    //Styx.Helpers.Logging.Write(Color.FromName("DarkRed"), "[Sha'tari Helper]: {0} claws {1} talons {2} spines {3} scales", numClaws, numTalons, numSpines, numScales);
                    if (numClaws < numTalons || numClaws < numSpines || numClaws < numScales)
                    {
                        Logging.Write(_messageColor, "[Sha'tari Helper]: Activating Gezzarak for Claws.");
                        Thread.Sleep(GetPing * 5 + 50);
                        Lua.DoString("SelectGossipOption(\"1\")");
                        Thread.Sleep(GetPing * 5 + 50);
                        Lua.DoString("CloseGossip()");
                        Logging.Write(_messageColor, "[Sha'tari Helper]: Waiting for spawn.");
                        Thread.Sleep(7000);
                        break;
                    }
                    if (numTalons < numClaws || numTalons < numSpines || numTalons < numScales)
                    {
                        Logging.Write(_messageColor, "[Sha'tari Helper]: Activating Akkarai for Talons.");
                        Thread.Sleep(GetPing * 5 + 50);
                        Lua.DoString("SelectGossipOption(\"2\")");
                        Thread.Sleep(GetPing * 5 + 50);
                        Lua.DoString("CloseGossip()");
                        Logging.Write(_messageColor, "[Sha'tari Helper]: Waiting for spawn.");
                        Thread.Sleep(7000);
                        break;
                    }
                    if (numSpines < numClaws || numSpines < numTalons || numSpines < numScales)
                    {
                        Logging.Write(_messageColor, "[Sha'tari Helper]: Activating Karrog for Spine.");
                        Thread.Sleep(GetPing * 5 + 50);
                        Lua.DoString("SelectGossipOption(\"3\")");
                        Thread.Sleep(GetPing * 5 + 50);
                        Lua.DoString("CloseGossip()");
                        Logging.Write(_messageColor, "[Sha'tari Helper]: Waiting for spawn.");
                        Thread.Sleep(7000);
                        break;
                    }
                    if (numScales < numClaws || numScales < numTalons || numScales < numSpines)
                    {
                        Logging.Write(_messageColor, "[Sha'tari Helper]: Activating Vakkiz for Scales.");
                        Thread.Sleep(GetPing * 5 + 50);
                        Lua.DoString("SelectGossipOption(\"4\")");
                        Thread.Sleep(GetPing * 5 + 50);
                        Lua.DoString("CloseGossip()");
                        Logging.Write(_messageColor, "[Sha'tari Helper]: Waiting for spawn.");
                        Thread.Sleep(7000);
                        break;
                    }
                    if (numClaws == numTalons && numClaws == numSpines && numClaws == numScales)
                    {
                        Logging.Write(_messageColor, "[Sha'tari Helper]: Activating Gezzarak for Claws (start loop).");
                        Thread.Sleep(GetPing * 5 + 50);
                        Lua.DoString("SelectGossipOption(\"1\")");
                        Thread.Sleep(GetPing * 5 + 50);
                        Lua.DoString("CloseGossip()");
                        Logging.Write(_messageColor, "[Sha'tari Helper]: Waiting for spawn.");
                        Thread.Sleep(7000);
                        break;
                    }
                }
            }
        }
예제 #2
0
 protected override RunStatus Run(object context)
 {
     Mount.Dismount();
     return(RunStatus.Failure);
 }
예제 #3
0
 protected override Composite CreateBehavior()
 {
     return(_root ?? (_root =
                          new PrioritySelector(
                              new Decorator(
                                  ret => !_wasOnWaitLocation,
                                  new PrioritySelector(
                                      new Decorator(
                                          ret => WaitAtLocation.Distance(Me.Location) > 2,
                                          new Sequence(
                                              new Action(ret => TreeRoot.StatusText = "Moving to wait location"),
                                              new Action(ret => Navigator.MoveTo(WaitAtLocation)))),
                                      new Sequence(
                                          new Action(ret => Navigator.PlayerMover.MoveStop()),
                                          new Action(ret => Mount.Dismount()),
                                          new Action(ret => _wasOnWaitLocation = true),
                                          new Action(ret => TreeRoot.StatusText = "Waiting for transport")))),
                              new Decorator(
                                  ret => TransportLocation != WoWPoint.Empty && TransportLocation.Distance(EndLocation) < .2 && _usedTransport,
                                  new PrioritySelector(
                                      new Decorator(
                                          ret => Me.Location.Distance(GetOffLocation) > 2,
                                          new Sequence(
                                              new Action(ret => TreeRoot.StatusText = "Moving out of transport"),
                                              new Action(ret => Navigator.PlayerMover.MoveTowards(GetOffLocation)),
                                              new Action(ret => StyxWoW.SleepForLagDuration()),
                                              new DecoratorContinue(
                                                  ret => Me.IsOnTransport,
                                                  new Action(ret => WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend, TimeSpan.FromMilliseconds(50)))))),
                                      new Action(ret => _isBehaviorDone = true))),
                              new Decorator(
                                  ret => Me.IsOnTransport && StandLocation != WoWPoint.Empty && !_usedTransport,
                                  new PrioritySelector(
                                      new Decorator(
                                          ret => Me.Location.Distance2D(StandLocation) > 2,
                                          new Sequence(
                                              new Action(ret => TreeRoot.StatusText = "Moving to stand location"),
                                              new Action(ret => Navigator.PlayerMover.MoveTowards(StandLocation)))),
                                      new Sequence(
                                          new Action(ret => _usedTransport = true),
                                          new Action(ret => Navigator.PlayerMover.MoveStop()),
                                          new Action(ret => TreeRoot.StatusText = "Waiting for the end location"))
                                      )),
                              new Decorator(
                                  ret => TransportLocation != WoWPoint.Empty && TransportLocation.Distance(StartLocation) < .2 && !_usedTransport,
                                  new PrioritySelector(
                                      new Decorator(
                                          ret => Me.Location.Distance2D(TransportLocation) > 2,
                                          new Sequence(
                                              new Action(ret => TreeRoot.StatusText = "Moving inside transport"),
                                              new Action(ret => Navigator.PlayerMover.MoveTowards(TransportLocation)),
                                              new Action(ret => StyxWoW.SleepForLagDuration()),
                                              new DecoratorContinue(
                                                  ret => !Me.IsOnTransport,
                                                  new Action(ret => WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend, TimeSpan.FromMilliseconds(50)))))),
                                      new Sequence(
                                          new Action(ret => _usedTransport = true),
                                          new Action(ret => Navigator.PlayerMover.MoveStop()),
                                          new Action(ret => TreeRoot.StatusText = "Waiting for the end location"))))
                              )));
 }
예제 #4
0
        protected override Composite CreateBehavior()
        {
            return(_root ?? (_root = new PrioritySelector(
                                 // if not in a turret than move to one and interact with it
                                 new Decorator(ret => !InVehicle,
                                               new Sequence(ctx => GetMustang(), // set Turret as context
                                                            new DecoratorContinue(ctx => ctx != null && ((WoWUnit)ctx).DistanceSqr > 5 * 5,
                                                                                  new Action(ctx =>
            {
                Navigator.MoveTo(((WoWUnit)ctx).Location);
                TreeRoot.StatusText = "Moving To Mustang";
            })),
                                                            new DecoratorContinue(ctx => ctx != null && ((WoWUnit)ctx).DistanceSqr <= 5 * 5,
                                                                                  new Action(ctx =>
            {
                Logging.Write("Interacting with Mustang");
                if (Me.Mounted)
                {
                    Mount.Dismount();
                }
                ((WoWUnit)ctx).Interact();
            })))),
                                 // Find the nearest spider
                                 new PrioritySelector(ctx => ObjectManager.GetObjectsOfType <WoWUnit>().Where(u => u.IsAlive && !_blackList.Contains(u.Guid) && u.Entry == 44284).OrderBy(u => u.DistanceSqr).FirstOrDefault(),
                                                      new Decorator(ctx => ctx == null, new Action(ctx => Navigator.MoveTo(_spiderLocation))),
                                                      new Decorator(ctx => ctx != null,

                                                                    new Sequence(
                                                                        new Action(ctx => TreeRoot.StatusText = "Scaring spider towards lumber mill"),

                                                                        new Action(ctx =>
            {
                var unit = ctx as WoWUnit;
                if (unit != null && unit.IsValid && unit.IsAlive)
                {
                    // move to a point that places the spider between player and lumber mill
                    var movetoPoint = WoWMathHelper.CalculatePointFrom(_lumberMillLocation, unit.Location, -5);
                    // blacklist spider if its not moving
                    if (DateTime.Now - _stuckTimeStamp > TimeSpan.FromSeconds(6))
                    {
                        _stuckTimeStamp = DateTime.Now;
                        if (movetoPoint.DistanceSqr(_lastMovetoPoint) < 2 * 2)
                        {
                            Logging.Write("Blacklisting spider");
                            _blackList.Add(unit.Guid);
                            return RunStatus.Failure;
                        }
                        _lastMovetoPoint = movetoPoint;
                    }

                    if (movetoPoint.DistanceSqr(Me.Location) > 6 * 6)
                    {
                        Navigator.MoveTo(movetoPoint);
                    }
                    else
                    {
                        using (new FrameLock())
                        {
                            //WoWMovement.MoveStop();
                            //Me.SetFacing(_lumberMillLocation);
                            Lua.DoString("CastSpellByID(83605)");
                        }
                    }
                    return RunStatus.Running;
                }
                return RunStatus.Failure;
            })))))));
        }
예제 #5
0
        private static bool DetectStuck()
        {
            WoWPoint myPoint = new WoWPoint(Me.X, Me.Y, Me.Z);

            if (myPoint.Distance(lastPoint) > StuckDistance)
            {
                lastPoint = myPoint;
                restartStandingStillTimer.Reset();
                unstuckStandingStillTimer.Reset();
                return(false);
            }

            if (!restartStandingStillTimer.IsRunning)
            {
                restartStandingStillTimer.Start();
            }

            if (!unstuckStandingStillTimer.IsRunning)
            {
                unstuckStandingStillTimer.Start();
            }

            if (!archBuddyFixTimer.IsRunning && Me.IsFlying && Me.Combat)
            {
                archBuddyFixTimer.Start();
            }
            else if (archBuddyFixTimer.IsRunning && (!Me.IsFlying || !Me.Combat))
            {
                archBuddyFixTimer.Reset();
            }

            if (!swimFixTimer.IsRunning && Me.IsSwimming)
            {
                swimFixTimer.Start();
            }
            else if (swimFixTimer.IsRunning && !Me.IsSwimming)
            {
                swimFixTimer.Reset();
            }

            if (!mountFixTimer.IsRunning && Me.Mounted && !Me.IsFlying && !Me.HasAura("Preparation"))
            {
                mountFixTimer.Start();
            }
            else if (mountFixTimer.IsRunning && (!Me.Mounted || Me.IsFlying || Me.HasAura("Preparation")))
            {
                mountFixTimer.Reset();
            }

            if (RestartStuckMinutes != 0 && restartStandingStillTimer.Elapsed.TotalMinutes > RestartStuckMinutes)
            {
                restartStandingStillTimer.Reset();

                if (restartIntervalThread != null && restartIntervalThread.IsAlive)
                {
                    restartIntervalThread.Abort();
                }
                if (restartWhenStuckThread != null && restartWhenStuckThread.IsAlive)
                {
                    restartWhenStuckThread.Abort();
                }

                restartWhenStuckThread = new Thread(new ThreadStart(RestartWhenStuckThread));
                restartWhenStuckThread.Start();
                return(true);
            }

            if (UnstuckRoutineMinutes > 0 && unstuckStandingStillTimer.Elapsed.TotalMinutes > UnstuckRoutineMinutes)
            {
                swimFixTimer.Reset();
                unstuckStandingStillTimer.Reset();
                UnstuckRoutine();
                return(true);
            }

            if (PoolFisherFixMinutes != 0 && swimFixTimer.Elapsed.TotalMinutes > PoolFisherFixMinutes)
            {
                swimFixTimer.Reset();
                unstuckStandingStillTimer.Reset();
                UnstuckRoutine();
                return(true);
            }

            if (ArchBuddyFixMinutes != 0 && archBuddyFixTimer.Elapsed.TotalMinutes > ArchBuddyFixMinutes)
            {
                Log("Dismounting while flying");
                archBuddyFixTimer.Reset();
                Mount.Dismount();
                return(true);
            }

            if (MountFixMinutes != 0 && mountFixTimer.Elapsed.TotalMinutes > MountFixMinutes)
            {
                Log("Dismounting to unstuck");
                mountFixTimer.Reset();
                Mount.Dismount();
                return(true);
            }

            return(false);
        }
예제 #6
0
        internal static bool GatherFishNode(PGameObject node)
        {
            if (_reLure == null)
            {
                _reLure = new Ticker(600000);
                _reLure.ForceReady();
            }
            FlyingEngine.Navigator.Stop();
            var combat = new StateCombat();
            int nearestIndexInPositionList =
                Location.GetClosestPositionInList(FlyingEngine.CurrentProfile.WaypointsNormal, node.Location);
            Location position = FlyingEngine.CurrentProfile.WaypointsNormal[nearestIndexInPositionList];

            if (!ApproachPosFlying.Approach(position, 5))
            {
                return(false);
            }
            node.Location.Face();
            if (Bobber() != null)
            {
                Logging.Write("Someone is fishing, break");
                return(false);
            }
            if (!CheckMobs(node))
            {
                return(false);
            }
            if (FlyingBlackList.IsBlacklisted(node))
            {
                ToldAboutNode.TellAbout("is blacklisted", node);
                return(false);
            }
            DescentToSchool(node);
            Mount.Dismount();
            var timeout      = new Ticker((FlyingSettings.MaxTimeAtSchool * 60) * 1000);
            var checkIfValid = new Ticker(8000);

            while (node.IsValid)
            {
                while (combat.NeedToRun)
                {
                    combat.DoWork();
                    timeout.Reset();
                }
                if (checkIfValid.IsReady)
                {
                    if (ObjectManager.GetObjects.FirstOrDefault(u => u.BaseAddress == node.BaseAddress) == null)
                    {
                        break;
                    }
                    checkIfValid.Reset();
                }
                if (FlyingSettings.Lure && _reLure.IsReady)
                {
                    KeyHelper.SendKey("Lure");
                    Thread.Sleep(3500);
                    _reLure.Reset();
                }
                if (timeout.IsReady)
                {
                    return(false);
                }
                if (ObjectManager.MyPlayer.IsSwimming)
                {
                    MoveHelper.Jump(1500);
                    Thread.Sleep(1000);
                    KeyHelper.SendKey("Waterwalk");
                    Thread.Sleep(2000);
                    MoveHelper.Jump(1500);
                    Thread.Sleep(1500);
                    if (ObjectManager.MyPlayer.IsSwimming)
                    {
                        return(false);
                    }
                }
                node.Location.Face();
                var timeout3 = new Ticker(4000);
                while (!timeout3.IsReady && (node.Location.DistanceToSelf2D < 14))
                {
                    MoveHelper.Backwards(true);
                    Thread.Sleep(20);
                }
                MoveHelper.ReleaseKeys();
                timeout3.Reset();
                node.Location.Face();
                while (!timeout3.IsReady && (node.Location.DistanceToSelf2D > 16))
                {
                    MoveHelper.Forwards(true);
                    Thread.Sleep(20);
                }
                MoveHelper.ReleaseKeys();
                KeyHelper.SendKey("Fishing");
                Thread.Sleep(1500);
                Fishing.FindBobberAndClick(FlyingSettings.WaitForLoot);
                Thread.Sleep(100);
            }
            return(true);
        }
예제 #7
0
        static public void findAndPickup(int pickupRange)
        {
            ObjectManager.Update();
            List <WoWGameObject> objectList = ObjectManager.GetObjectsOfType <WoWGameObject>().Where(o => o.Entry == 6948).ToList();

            // Filling the objectList with whatever it is we're looking for.
            if (Me.ZoneId == 4922)                               // We're in Twilight Highlands
            {
                if (HasQuest(28861) && !IsQuestCompleted(28861)) // We still need kegs!
                {
                    objectList.AddRange(ObjectManager.GetObjectsOfType <WoWGameObject>()
                                        .Where(o => o.Entry == 206195)
                                        .OrderBy(o => o.Distance));
                }
                if (HasQuest(28862) && !IsQuestCompleted(28862)) // We still need food!
                {
                    objectList.AddRange(ObjectManager.GetObjectsOfType <WoWGameObject>()
                                        .Where(o => ((o.Entry == 206289) ||     // Wildhammer Food Stores
                                                     (o.Entry == 206291) ||     // Wildhammer Food Stores
                                                     (o.Entry == 206290)))      // Wildhammer Food Stores
                                        .OrderBy(o => o.Distance).ToList());
                }
            }
            else if (Me.ZoneId == 5389)                                                                             // We're in Tol Barad
            {
                if ((HasQuest(27922) && !IsQuestCompleted(27992)) || (HasQuest(28692) && !IsQuestCompleted(28692))) // We're doing the Scrap quest
                {
                    objectList.AddRange(ObjectManager.GetObjectsOfType <WoWGameObject>()
                                        .Where(o => ((o.Entry == 206644) || // Siege Scrap
                                                     (o.Entry == 206652) ||
                                                     (o.Entry == 206651)))
                                        .OrderBy(o => o.Distance).ToList());
                }
            }
            else if (Me.ZoneId == 5042)                          // We're in Deepholme
            {
                if (HasQuest(27050) && !IsQuestCompleted(27050)) // We're doing the Shroom quest
                {
                    objectList.AddRange(ObjectManager.GetObjectsOfType <WoWGameObject>()
                                        .Where(o => ((o.Entry == 205151) || // Shrooms
                                                     (o.Entry == 205152) ||
                                                     (o.Entry == 205146) ||
                                                     (o.Entry == 205147)))
                                        .OrderBy(o => o.Distance).ToList());
                }
            }

            // Picking up all selected objects
            foreach (WoWGameObject o in objectList)
            {
                if (o.Entry != 6948)
                {
                    if (o.Location.Distance(Me.Location) < pickupRange)
                    {
                        movetoLoc(o.Location);
                        if (inCombat)
                        {
                            return;
                        }
                        if (Me.Mounted)
                        {
                            Mount.Dismount();
                        }
                        Thread.Sleep(2000);
                        o.Interact();
                        Thread.Sleep(3000);
                    }
                }
            }
        }
예제 #8
0
        private void PoisonKnives()
        {
            LocalPlayer Me         = ObjectManager.Me;
            bool        needpoison = false;
            WoWItem     mainhand   = Me.Inventory.Equipped.MainHand;
            WoWItem     offhand    = Me.Inventory.Equipped.OffHand;

            // If you're not at least level 10, you can't poison knives anyway.
            if (Me.Level < 10)
            {
                return;
            }

            // Leave early if neither weapon needs poison.
            if (mainhand != null && mainhand.TemporaryEnchantment.Id == 0)
            {
                needpoison = true;
            }
            if (offhand != null && offhand.TemporaryEnchantment.Id == 0)
            {
                needpoison = true;
            }
            if (needpoison == false)
            {
                return;
            }

            // Get the poisons available
            String mainhandpoison = FirstAvailableItem(mainhandpoisons);
            String offhandpoison  = FirstAvailableItem(offhandpoisons);

            // Leave early if no poison is available
            if (mainhandpoison == null)
            {
                log(Color.Red, "Out of main hand poison! Buy more.");
            }
            if (offhandpoison == null)
            {
                log(Color.Red, "Out of off hand poison! Buy more.");
            }
            if (mainhandpoison == null && offhandpoison == null)
            {
                return;
            }

            // Stop moving
            WoWMovement.MoveStop();
            StyxWoW.SleepForLagDuration();

            // Get off horse
            if (Me.Mounted)
            {
                Mount.Dismount();
                StyxWoW.SleepForLagDuration();
            }

            // Apply poison to main weapon
            if (mainhandpoison != null)
            {
                ApplyMainPoison(mainhandpoison);
            }

            // Apply poison to offhand weapon
            if (offhandpoison != null)
            {
                ApplyOffhandPoison(offhandpoison);
            }
        }
예제 #9
0
        /// <summary>
        /// Command list for the game
        /// </summary>
        /// <param name="commandOptions">Everything after the 1st occurance of a space</param>
        /// <param name="commandKey">The string before the 1st occurance of a space</param>
        /// <param name="playerData">Player Data</param>
        /// <param name="room">Current room</param>
        /// <returns>Returns Dictionary of commands</returns>
        public static void Commands(string commandOptions, string commandKey, PlayerSetup.Player playerData, Room.Room room)
        {
            var context = HubContext.Instance;

            switch (commandKey)
            {
            case "north":
                Movement.Move(playerData, room, "North");
                break;

            case "east":
                Movement.Move(playerData, room, "East");
                break;

            case "south":
                Movement.Move(playerData, room, "South");
                break;

            case "west":
                Movement.Move(playerData, room, "West");
                break;

            case "up":
                Movement.Move(playerData, room, "Up");
                break;

            case "down":
                Movement.Move(playerData, room, "Down");
                break;

            case "look":
            case "look at":
            case "l at":
            case "search":
                LoadRoom.ReturnRoom(playerData, room, commandOptions, "look");
                break;

            case "l in":
            case "search in":
                LoadRoom.ReturnRoom(playerData, room, commandOptions, "look in");
                break;

            case "examine":
                LoadRoom.ReturnRoom(playerData, room, commandOptions, "examine");
                break;

            case "touch":
                LoadRoom.ReturnRoom(playerData, room, commandOptions, "touch");
                break;

            case "smell":
                LoadRoom.ReturnRoom(playerData, room, commandOptions, "smell");
                break;

            case "taste":
                LoadRoom.ReturnRoom(playerData, room, commandOptions, "taste");
                break;

            case "score":
                Score.ReturnScore(playerData);
                break;

            case "inventory":
                Inventory.ReturnInventory(playerData.Inventory, playerData);
                break;

            case "eq":
            case "equip":
            case "equipment":
            case "garb":
                Equipment.ShowEquipment(playerData);
                break;

            case "loot":
            case "get":
            case "take":
                ManipulateObject.GetItem(room, playerData, commandOptions, commandKey, "item");
                break;

            case "plunder":
                ManipulateObject.GetItem(room, playerData, "all " + commandOptions, commandKey, "item");
                break;

            case "drop":
            case "put":
                ManipulateObject.DropItem(room, playerData, commandOptions, commandKey);
                break;

            case "give":
                ManipulateObject.GiveItem(room, playerData, commandOptions, commandKey, "killable");
                break;

            case "save":
                Save.SavePlayer(playerData);
                break;

            case "say":
            case "'":
                Communicate.Say(commandOptions, playerData, room);
                break;

            case "sayto":
            case ">":
                Communicate.SayTo(commandOptions, room, playerData);
                break;

            case "newbie":
                Communicate.NewbieChannel(commandOptions, playerData);
                break;

            case "gossip":
                Communicate.GossipChannel(commandOptions, playerData);
                break;

            case "ooc":
                Communicate.OocChannel(commandOptions, playerData);
                break;

            case "yes":
                Communicate.Say("Yes", playerData, room);
                break;

            case "no":
                Communicate.Say("No", playerData, room);
                break;

            case "yell":
                Communicate.Yell(commandOptions, room, playerData);
                break;

            case "talkto":
                Talk.TalkTo(commandOptions, room, playerData);
                break;

            case "emote":
                Emote.EmoteActionToRoom(commandOptions, playerData);
                break;

            case "use":
            case "wear":
            case "wield":
                Equipment.WearItem(playerData, commandOptions);
                break;

            case "remove":
            case "doff":
            case "unwield":
                Equipment.RemoveItem(playerData, commandOptions);
                break;

            case "hit":
            case "kill":
            case "attack":
                Fight2.PerpareToFight(playerData, room, commandOptions);
                break;

            case "flee":
                Flee.fleeCombat(playerData, room);
                break;

            case "sacrifice":
            case "harvest":
                Harvest.Body(playerData, room, commandOptions);
                break;

            case "peek":
                Peak.DoPeak(context, playerData, room, commandOptions);
                break;

            case "steal":
                Steal.DoSteal(context, playerData, room, commandOptions);
                break;

            case "pick":
                LockPick.DoLockPick(context, playerData, room, commandOptions);
                break;

            case "c magic missile":
            case "cast magic missile":
                MagicMissile.StartMagicMissile(playerData, room, commandOptions);
                break;

            case "c armour":
            case "cast armour":
            case "c armor":
            case "cast armor":
                new Armour().StartArmour(playerData, room, commandOptions);
                break;

            case "c continual light":
            case "cast continual light":
                ContinualLight.StarContinualLight(playerData, room, commandOptions);
                break;

            case "c invis":
            case "cast invis":
                Invis.StartInvis(playerData, room, commandOptions);
                break;

            case "c weaken":
            case "cast weaken":
                Weaken.StartWeaken(playerData, room, commandOptions);
                break;

            case "c chill touch":
            case "cast chill touch":
                ChillTouch.StartChillTouch(playerData, room, commandOptions);
                break;

            case "c fly":
            case "cast fly":
                Fly.StartFly(playerData, room, commandOptions);
                break;

            case "c refresh":
            case "cast refresh":
                Refresh.StartRefresh(playerData, room, commandOptions);
                break;

            case "c faerie fire":
            case "cast faerie fire":
                FaerieFire.StartFaerieFire(playerData, room, commandOptions);
                break;

            case "c teleport":
            case "cast teleport":
                Teleport.StartTeleport(playerData, room);
                break;

            case "c blindness":
            case "cast blindness":
                Blindness.StartBlind(playerData, room, commandOptions);
                break;

            case "c haste":
            case "cast haste":
                Haste.StartHaste(playerData, room, commandOptions);
                break;

            case "c create spring":
            case "cast create spring":
                CreateSpring.StartCreateSpring(playerData, room);
                break;

            case "c shocking grasp":
            case "cast shocking grasp":
                new ShockingGrasp().StartShockingGrasp(playerData, room, commandOptions);
                break;

            case "c cause light":
            case "cast cause light":
                new CauseLight().StartCauseLight(context, playerData, room, commandOptions);
                break;

            case "c cure light":
            case "cast cure light":
                new CureLight().StartCureLight(context, playerData, room, commandOptions);
                break;

            case "c cure blindness":
                new CureBlindness().StartCureBlindness(context, playerData, room, commandOptions);
                break;

            case "c detect invis":
            case "cast detect invis":
                DetectInvis.DoDetectInvis(context, playerData, room);
                break;

            case "forage":
                new Foraging().StartForaging(playerData, room);
                break;

            case "fish":
            case "angle":
            case "line":
            case "trawl":
            case "lure":
                new Fishing().StartFishing(playerData, room);
                break;

            case "reel":
                Fishing.GetFish(playerData, room);
                break;

            case "dirt kick":
                new DirtKick().StartDirtKick(context, playerData, room, commandOptions);
                break;

            case "bash":
                new Bash().StartBash(context, playerData, room, commandOptions);
                break;

            case "shield bash":
                new ShieldBash().StartBash(context, playerData, room, commandOptions);
                break;

            case "punch":
                Punch.StartPunch(playerData, room);
                break;

            case "kick":
                new Kick().StartKick(context, playerData, room, commandOptions);
                break;

            case "spin kick":
                new SpinKick().StartKick(context, playerData, room, commandOptions);
                break;

            case "rescue":
                new Rescue().StartRescue(context, playerData, room, commandOptions);
                break;

            case "lunge":
                new Lunge().StartLunge(context, playerData, room, commandOptions);
                break;

            case "disarm":
                new Disarm().StartDisarm(context, playerData, room);
                break;

            case "backstab":
                new Backstab().StartBackstab(context, playerData, room, commandOptions);
                break;

            case "feint":
                new Feint().StartFeint(context, playerData, room, commandOptions);
                break;

            case "mount":
            case "ride":
                Mount.StartMount(playerData, room, commandOptions);
                break;

            case "dismount":
                Mount.Dismount(playerData, room, commandOptions);
                break;

            case "trip":
                new Trip().StartTrip(context, playerData, room, commandOptions);
                break;

            case "sneak":
                Sneak.DoSneak(context, playerData);
                break;

            case "hide":
                Hide.DoHide(context, playerData);
                break;

            case "lore":
                Lore.DoLore(context, playerData, commandOptions);
                break;

            case "unlock":
                ManipulateObject.UnlockItem(room, playerData, commandOptions, commandKey);
                break;

            case "lock":
                ManipulateObject.LockItem(room, playerData, commandOptions, commandKey);
                break;

            case "close":
            case "shut":
                ManipulateObject.Close(room, playerData, commandOptions, commandKey);
                break;

            case "drink":
                ManipulateObject.Drink(room, playerData, commandOptions, commandKey);
                break;

            case "help":
            case "/help":
            case "?":
            case "commands":
                Help.ShowHelp(commandOptions, playerData);
                break;

            case "time":
            case "clock":
                Update.Time.ShowTime();
                break;

            case "skills":
            case "spells":
            case "skills all":
                ShowSkills.ShowPlayerSkills(playerData, commandOptions);
                break;

            case "practice":
                Trainer.Practice(playerData, room, commandOptions);
                break;

            case "list":
                Shop.listItems(playerData, room);
                break;

            case "buy":
                Shop.buyItems(playerData, room, commandOptions);
                break;

            case "sell":
                Shop.sellItems(playerData, room, commandOptions);
                break;

            case "quest log":
            case "qlog":
                Quest.QuestLog(playerData);
                break;

            case "wake":
                Status.WakePlayer(context, playerData, room);
                break;

            case "sleep":
                Status.SleepPlayer(context, playerData, room);
                break;

            case "rest":
            case "sit":
                Status.RestPlayer(context, playerData, room);
                break;

            case "stand":
                Status.StandPlayer(context, playerData, room);
                break;

            case "greet":
                Greet.GreetMob(playerData, room, commandOptions);
                break;

            case "who":
                Who.Connected(playerData);
                break;

            case "affects":
                Effect.Show(playerData);
                break;

            case "follow":
                Follow.FollowThing(playerData, room, commandOptions);
                break;

            case "nofollow":
                Follow.FollowThing(playerData, room, "noFollow");
                break;

            case "quit":
                HubContext.Instance.Quit(playerData.HubGuid, room);
                break;

            case "craft":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Craft);
                break;

            case "chop":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Chop);
                break;

            case "cook":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Cook);
                break;

            case "brew":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Brew);
                break;

            case "forge":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Forge);
                break;

            case "carve":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Carve);
                break;

            case "knit":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Knitting);
                break;

            case "make":
            case "build":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Craft);
                break;

            case "show crafts":
            case "craftlist":
                Craft.CraftList(playerData);
                break;

            case "set up camp":
                Camp.SetUpCamp(playerData, room);
                break;

            case "repair":
                Events.Repair.RepairItem(playerData, room, commandOptions);
                break;

            case "/debug":
                PlayerSetup.Player.DebugPlayer(playerData);
                break;

            case "/setGold":
                PlayerSetup.Player.SetGold(playerData, commandOptions);
                break;

            case "/setAc":
                PlayerSetup.Player.SetAC(playerData, commandOptions);
                break;

            case "/map":
                SigmaMap.DrawMap(playerData.HubGuid);     //not what you think it does
                break;

            default:
                HubContext.Instance.SendToClient("Sorry you can't do that. Try help commands or ask on the discord channel.", playerData.HubGuid);
                var log = new Error.Error
                {
                    Date         = DateTime.Now,
                    ErrorMessage = commandKey + " " + commandOptions,
                    MethodName   = "Wrong command"
                };

                Save.LogError(log);
                break;
            }
        }
예제 #10
0
        /// <summary>
        ///   Creates a behavior to cast a spell by name, with special requirements, on a specific unit. Returns
        ///   RunStatus.Success if successful, RunStatus.Failure otherwise.
        /// </summary>
        /// <remarks>
        ///   Created 5/2/2011.
        /// </remarks>
        /// <param name = "name">The name.</param>
        /// <param name="checkMovement"></param>
        /// <param name = "onUnit">The on unit.</param>
        /// <param name = "requirements">The requirements.</param>
        /// <returns>.</returns>
        public static Composite Cast(string name, SimpleBooleanDelegate checkMovement, UnitSelectionDelegate onUnit, SimpleBooleanDelegate requirements)
        {
            return(new Decorator(
                       ret =>
            {
                //Logger.WriteDebug("Casting spell: " + name);
                //Logger.WriteDebug("Requirements: " + requirements(ret));
                //Logger.WriteDebug("OnUnit: " + onUnit(ret));
                //Logger.WriteDebug("CanCast: " + SpellManager.CanCast(name, onUnit(ret), false));

                var minReqs = requirements != null && onUnit != null && requirements(ret) && onUnit(ret) != null;
                var canCast = false;
                var inRange = false;
                if (minReqs)
                {
                    canCast = SpellManager.CanCast(name, onUnit(ret), false, checkMovement(ret));

                    if (canCast)
                    {
                        var target = onUnit(ret);
                        // We're always in range of ourselves. So just ignore this bit if we're casting it on us
                        if (target.IsMe)
                        {
                            inRange = true;
                        }
                        else
                        {
                            WoWSpell spell;
                            if (SpellManager.Spells.TryGetValue(name, out spell))
                            {
                                var rangeId = spell.InternalInfo.SpellRangeId;
                                var minRange = spell.MinRange;
                                var maxRange = spell.MaxRange;
                                var targetDistance = target.Distance;
                                // RangeId 1 is "Self Only". This should make life easier for people to use self-buffs, or stuff like Starfall where you cast it as a pseudo-buff.
                                if (rangeId == 1)
                                {
                                    inRange = true;
                                }
                                // RangeId 2 is melee range. Huzzah :)
                                else if (rangeId == 2)
                                {
                                    inRange = targetDistance < MeleeRange;
                                }
                                else
                                {
                                    inRange = targetDistance <maxRange &&
                                                              targetDistance> (minRange == 0 ? minRange : minRange + 3);
                                }
                            }
                        }
                    }
                }

                return minReqs && canCast && inRange;
            },
                       new Action(
                           ret =>
            {
                if (StyxWoW.Me.Mounted && !name.Contains("Aura") && !name.Contains("Presence") && !name.Contains("Stance"))
                {
                    Mount.Dismount("Casting spell");
                }

                Logger.Write("Casting " + name + " on " + onUnit(ret).SafeName());
                SpellManager.Cast(name, onUnit(ret));

                WoWSpell spell;
                if (SpellManager.Spells.TryGetValue(name, out spell))
                {
                    // This is here to prevent cancelling funneled and channeled spells right after the cast. /raphus
                    if (spell.IsFunnel || spell.IsChanneled)
                    {
                        Thread.Sleep(500);
                    }
                }
            })
                       ));
        }
예제 #11
0
        public static void DoDestroyJunk()
        {
            if (LastUpdate + 2000 < (uint)Environment.TickCount)
            {
                LastUpdate = (uint)Environment.TickCount;
            }
            else
            {
                return;
            }

            WoWSpell mount = null;
            uint     FNBS  = Me.FreeNormalBagSlots;

//            Logging.Write("SpellManager.HasSpell(61425):" + SpellManager.HasSpell(61425));
            if (Mount.CanMount() && ((uint)Environment.TickCount - LastSellTry > 30000) && (FNBS <= 2))
            {
                if (Me.Mounted)         // optional
                {
                    Mount.Dismount();
                    Thread.Sleep(4400); // Gnimo does not disappear instantly
                }
//                if () // Sell to mamoth
                {
                    mount = WoWSpell.FromId(61425);
                    mount.Cast();
                    Thread.Sleep(500);
                    if (Me.IsCasting)
                    {
                        Thread.Sleep(2500);
                        ObjectManager.Update();
                    }
                }
                LastSellTry = (uint)Environment.TickCount;
                if (Me.Mounted)
                {
                    // todo: debug sell procedure
                    IsDone = false; SellDone = false;
                    while (!SellDone && ((uint)Environment.TickCount - LastSellTry < 8000))
                    {
                        Logging.Write("attempting trade..." + (uint)Environment.TickCount);
                        SellDone = InteractAndSell(32639, SellItemActionType.Whites, 0, 0);  // SellItemActionType.Whites
                        Thread.Sleep(1000);
                    }
                }
            }
            else
            {
                List <WoWItem> targetItems = ObjectManager.Me.BagItems;

                uint TotalCount = 0;
                for (int a = targetItems.Count - 1; a >= 0; a--)
                {
                    if (targetItems[a] != null && targetItems[a].IsValid)
                    {
                        ItemInfo       info    = ItemInfo.FromId(targetItems[a].Entry);
                        WoWItemQuality quality = targetItems[a].Quality;

                        if (!ProtectedItems.Contains(targetItems[a].Entry) && (quality == WoWItemQuality.Uncommon && (info.Level < 290) || quality == WoWItemQuality.Common || quality == WoWItemQuality.Poor))
                        {
                            WoWMovement.MoveStop();
                            Logging.Write("[Allrounder] Destroying " + targetItems[a].Entry + " \"" + targetItems[a].Name + "\"...");
                            Lua.DoString("UseItemByName(\"" + targetItems[a].Name + "\")");
//                                Lua.DoString("UseContainerItem({0}, {1})", targetItems[a].BagIndex + 1, targetItems[a].BagSlot + 1);
                            Lua.DoString("PickupContainerItem({0}, {1})", targetItems[a].BagIndex + 1, targetItems[a].BagSlot + 1);
                            Thread.Sleep(900);
                            Lua.DoString("DeleteCursorItem();");
                        }
                    }
                }
            }
        }
예제 #12
0
        protected override Composite CreateMainBehavior()
        {
            return(new PrioritySelector(

                       // Update information for this BT visit...
                       new Action(context =>
            {
                Mob_ToAvoid = FindUnitsFromIds(ToEnumerable <int>(MobIdToAvoid)).FirstOrDefault();
                Mob_ToMoveNear = FindUnitsFromIds(ToEnumerable <int>(MobIdToMoveNear)).FirstOrDefault();
                return RunStatus.Failure;      // fall thru
            }),


                       // If quest is done, behavior is done...
                       new Decorator(context => IsDone,
                                     new Action(context => { State_MainBehavior = StateType_MainBehavior.BehaviorDone; })),


                       // Stateful Operation:
                       new Switch <StateType_MainBehavior>(context => State_MainBehavior,
                                                           #region State: DEFAULT
                                                           new Action(context => // default case
            {
                LogMaintenanceError("StateType_MainBehavior({0}) is unhandled", State_MainBehavior);
                TreeRoot.Stop();
                State_MainBehavior = StateType_MainBehavior.BehaviorDone;
            }),
                                                           #endregion


                                                           #region State: Moving to Safespot
                                                           new SwitchArgument <StateType_MainBehavior>(StateType_MainBehavior.MovingToSafespot,
                                                                                                       new PrioritySelector(
                                                                                                           // If a "Move Near" mob was specified, move to it...
                                                                                                           new Decorator(context => MobIdToMoveNear != 0,
                                                                                                                         new PrioritySelector(
                                                                                                                             new Decorator(context => Mob_ToMoveNear != null,
                                                                                                                                           new PrioritySelector(
                                                                                                                                               // Target the MoveToNpc, as feedback to the user...
                                                                                                                                               new Decorator(context => Me.CurrentTarget != Mob_ToMoveNear,
                                                                                                                                                             new Action(context => { Mob_ToMoveNear.Target(); })),

                                                                                                                                               // Move to mob...
                                                                                                                                               UtilityBehaviorPS_MoveTo(context => Mob_ToMoveNear.Location, context => Mob_ToMoveNear.Name)
                                                                                                                                               )),

                                                                                                                             // Need to wait for Mob to respawn...
                                                                                                                             new Decorator(context => Mob_ToMoveNear == null,
                                                                                                                                           new Action(context =>
            {
                TreeRoot.StatusText = string.Format("Waiting for {0} to respawn", GetMobNameFromId(MobIdToMoveNear));
            }))
                                                                                                                             )),

                                                                                                           // No "Move Near" mob, so use the provided Safe spot coordinates...
                                                                                                           new Decorator(context => MobIdToMoveNear == 0,
                                                                                                                         UtilityBehaviorPS_MoveTo(context => SafespotLocation, context => "to safespot")),

                                                                                                           // Dismount once we've arrived at mob...
                                                                                                           new Decorator(context => Me.Mounted,
                                                                                                                         new Action(context => { Mount.Dismount(); })),

                                                                                                           // At safe spot, now wait for mob...
                                                                                                           new Action(context =>
            {
                TreeRoot.StatusText = string.Empty;
                State_MainBehavior = StateType_MainBehavior.WaitingForMobToClear;
            })
                                                                                                           )),
                                                           #endregion


                                                           #region State: Waiting for Mob to Clear
                                                           new SwitchArgument <StateType_MainBehavior>(StateType_MainBehavior.WaitingForMobToClear,
                                                                                                       new PrioritySelector(
                                                                                                           // If AvoidNpc is not around,
                                                                                                           // or if AvoidNpc is prescribed distance away, and facing away from us,
                                                                                                           // we're done...
                                                                                                           new Decorator(context => IsSafeToMoveToDestination(Mob_ToAvoid),
                                                                                                                         new Action(context =>
            {
                Me.ClearTarget();
                Path_Ingress = null;
                Path_Egress = null;
                State_MainBehavior = StateType_MainBehavior.FollowingPathToDestination;
            })),

                                                                                                           // Target and Face the AvoidNpc, as feedback to the user...
                                                                                                           new Decorator(context => Me.CurrentTarget != Mob_ToAvoid,
                                                                                                                         new Action(context => { Mob_ToAvoid.Target(); })),
                                                                                                           new Decorator(context => !Me.IsSafelyFacing(Mob_ToAvoid),
                                                                                                                         new Action(context => { Mob_ToAvoid.Face(); })),

                                                                                                           // Tell user what we're up to...
                                                                                                           new CompositeThrottle(ThrottleUserStatusUpdate,
                                                                                                                                 new Action(context =>
            {
                TreeRoot.StatusText = string.Format(
                    "Waiting for '{0}' (dist: {1:F1}) to move {2:F1} yards away, and pathing away from us.",
                    Mob_ToAvoid.Name,
                    Mob_ToAvoid.Distance,
                    AvoidDistance);
            }))
                                                                                                           )),
                                                           #endregion


                                                           #region State: Following Path to Destination
                                                           new SwitchArgument <StateType_MainBehavior>(StateType_MainBehavior.FollowingPathToDestination,
                                                                                                       new PrioritySelector(
                                                                                                           // The "Follow Path to Destination" logic is handled in a Combat_Main hook.
                                                                                                           // If we get into a fight, and need to back out, we want to be certain we drag the mobs
                                                                                                           // back to the safespot before engaging them.  That cannot be done in the normal (non-combat)
                                                                                                           // main behavior, here.
                                                                                                           )),
                                                           #endregion


                                                           #region State: Behavior Done
                                                           new SwitchArgument <StateType_MainBehavior>(StateType_MainBehavior.BehaviorDone,
                                                                                                       new PrioritySelector(
                                                                                                           new Action(context =>
            {
                Me.ClearTarget();
                BehaviorDone();
            })
                                                                                                           ))
                                                           #endregion

                                                           )));
        }
예제 #13
0
        protected override RunStatus Run(object context)
        {
            WoWGameObject pool = null;

            if (_me.Mounted)
            {
                Mount.Dismount("Fishing");
            }
            if (_me.IsMoving || _me.IsFalling)
            {
                WoWMovement.MoveStop();
                if (!_me.HasAura("Levitate"))
                {
                    return(RunStatus.Success);
                }
            }
            if (BotPoi.Current != null && BotPoi.Current.Type == PoiType.Harvest)
            {
                pool = (WoWGameObject)BotPoi.Current.AsObject;
                if (pool == null || !pool.IsValid)
                {
                    BotPoi.Current = null;
                    return(RunStatus.Failure);
                }
                if (pool.Guid != _lastPoolGuid)
                {
                    _lastPoolGuid = pool.Guid;
                    _timeAtPoolSW.Reset();
                    _timeAtPoolSW.Start();
                }
                // safety check. if spending more than 5 mins at pool than black list it.
                if (_timeAtPoolSW.ElapsedMilliseconds >= AutoAngler.Instance.MySettings.MaxTimeAtPool * 60000)
                {
                    Utils.BlacklistPool(pool, TimeSpan.FromMinutes(10), "Spend too much time at pool");
                    return(RunStatus.Failure);
                }
                // Blacklist pool if we have too many failed casts
                if (_castCounter >= AutoAngler.Instance.MySettings.MaxFailedCasts)
                {
                    AutoAngler.Instance.Log("Moving to a new fishing location since we have {0} failed casts",
                                            _castCounter);
                    _castCounter = 0;
                    MoveToPoolAction.PoolPoints.RemoveAt(0);
                    return(RunStatus.Success);
                }

                // face pool if not facing it already.
                if (!IsFacing2D(_me.Location, _me.Rotation, pool.Location, WoWMathHelper.DegreesToRadians(5)))
                {
                    LineRecastSW.Reset();
                    LineRecastSW.Start();
                    _me.SetFacing(pool.Location);
                    // SetFacing doesn't really update my angle in game.. still tries to fish using prev angle. so I need to move to update in-game angle
                    WoWMovement.Move(WoWMovement.MovementDirection.ForwardBackMovement);
                    WoWMovement.MoveStop(WoWMovement.MovementDirection.ForwardBackMovement);
                    return(RunStatus.Success);
                }
            }
            if (_me.IsCasting)
            {
                WoWGameObject bobber = null;
                try
                {
                    var b = ObjectManager.GetObjectsOfType <WoWGameObject>().FirstOrDefault(o => o != null && o.IsValid && o.CreatedByGuid == _me.Guid);

                    bobber = ObjectManager.GetObjectsOfType <WoWGameObject>()
                             .FirstOrDefault(o => o.IsValid && o.SubType == WoWGameObjectType.FishingNode &&
                                             o.CreatedBy.Guid == _me.Guid);
                }
                catch (Exception)
                {
                }
                if (bobber != null)
                {
                    // recast line if it's not close enough to pool
                    if (AutoAngler.Instance.MySettings.Poolfishing && pool != null &&
                        bobber.Location.Distance(pool.Location) > 3.6f)
                    {
                        CastLine();
                    }
                    // else lets see if there's a bite!
                    else if (bobber.AnimationState == 1)
                    {
                        _castCounter = 0;
                        (bobber.SubObj).Use();
                        LootAction.WaitingForLootSW.Reset();
                        LootAction.WaitingForLootSW.Start();
                    }
                }
                return(RunStatus.Success);
            }
            CastLine();
            return(RunStatus.Success);
        }