Пример #1
0
        static void Main(string[] args)
        {
            ObjectOptions.ToolTipDelay = 500;

            Self.Backpack.DoubleClick();

            Stealth.Client.Wait(1000);

            Stealth.Client.AddItemToContainer += OnAdd;
            Stealth.Client.ClilocSpeech       += OnClilocSpeech;
            Stealth.Client.Speech             += OnSpeech;

            ConsoleMessage("Target loot bag");

            LootBag = RequestTarget();
            LootBag.DoubleClick();

            Stealth.Client.Wait(1000);

            List <Item> _backpackItems = new List <Item>();
            List <uint> _findList      = new List <uint>();

            Stealth.Client.FindTypeEx(0xFFFF, 0xFFFF, Self.Backpack.Serial.Value, true);
            if (!(Stealth.Client.GetFindCount() == 0))
            {
                _findList = Stealth.Client.GetFindList();
            }

            foreach (uint _item in _findList)
            {
                Stealth.Client.Ignore(_item);
                Scanner.Ignore(_item);
            }

            ConsoleMessage("starting loot routine...", ConsoleColor.DarkYellow);
            Looting      = true;
            LootingItems = false;

            Scanner.Initialize();

            Scanner.Range         = 5;
            Scanner.VerticalRange = 5;

            Stealth.Client.SetFindDistance(5);
            Stealth.Client.SetFindVertical(5);
            Stealth.Client.SetMoveThroughNPC(0);

            var _virtuehelper = VirtueHelper.GetVirtues();
            var _targethelper = TargetHelper.GetTarget();

            while (Stealth.Client.GetConnectedStatus())
            {
                try
                {
                    #region Combat
                    Stealth.Client.ClearBadLocationList();

                    var _monster = Item.Find(typeof(FanDancer), 0x0, false).OrderBy(x => x.Distance).ToList();

                    //ConsoleMessage("{0},{1}", Self.Location.X, Self.Location.Y);

                    _virtuehelper.Request();

                    /*
                     * If current target is dead, find a new target
                     * if new target is 100% hp, honor target
                     * else follow current target until it's dead if we're not looting
                     *
                     */

                    if (CurrentTarget == null || CurrentTarget.Dead || !CurrentTarget.Valid)
                    {
                        if (_monster.Any())
                        {
                            CurrentTarget = _monster.First().Cast <Mobile>();
                            ConsoleMessage("Current target set to: {0}", ConsoleColor.Magenta, CurrentTarget.Serial.Value.ToString());

                            Stealth.Client.UseVirtue(Virtue.Honor);
                            Stealth.Client.WaitTargetObject(CurrentTarget.Serial.Value);

                            Self.Attack(CurrentTarget.Serial);
                        }
                    }

                    //entrance room

                    /*if (((ushort)CurrentTarget.Location.X >= 79 && (ushort)CurrentTarget.Location.X <= 97)
                     *  && ((ushort)CurrentTarget.Location.Y >= 326 && (ushort)CurrentTarget.Location.Y <= 344))*/


                    //bloody room

                    /*if (((ushort)CurrentTarget.Location.X >= 104 && (ushort)CurrentTarget.Location.X <= 115)
                    *   && ((ushort)CurrentTarget.Location.Y >= 640 && (ushort)CurrentTarget.Location.Y <= 660))*/


                    if (((ushort)CurrentTarget.Location.X >= 79 && (ushort)CurrentTarget.Location.X <= 97) &&
                        ((ushort)CurrentTarget.Location.Y >= 326 && (ushort)CurrentTarget.Location.Y <= 344))
                    {
                        Self.Movement.newMoveXY((ushort)CurrentTarget.Location.X, (ushort)CurrentTarget.Location.Y, true, 0, true);
                        Self.Attack(CurrentTarget.Serial);
                    }

                    /* For leafblade
                     * if (Self.Mana > 35 && Self.HealthPercent > 70)
                     *  Self.UseSecondaryAbility();
                     * else if (Self.Mana > 35 && Self.HealthPercent < 70)
                     *  Self.UsePrimaryAbility();
                     */

                    if (Self.Mana > 35)
                    {
                        Self.UsePrimaryAbility();
                    }

                    //if (Self.HealthPercent < 50)
                    //Self.Cast("Evasion");
                    //if (Self.HealthPercent < 80 && !Confidence)
                    //Self.Cast("Confidence");

                    #endregion

                    #region Loot
                    var _corpses = Item.Find(typeof(Corpse), 0x0, false).OrderBy(x => x.Distance).ToList();

                    if (_corpses.Count > 0)
                    {
                        foreach (Corpse _corpse in _corpses)
                        {
                            if (_corpse.Distance < 3)
                            {
                                LootCorpse(_corpse);
                                Scanner.Ignore(_corpse.Serial);
                            }
                            else
                            {/*
                              * if (((ushort)_corpse.Location.X >= 79 && (ushort)_corpse.Location.X <= 97)
                              * && ((ushort)_corpse.Location.Y >= 326 && (ushort)_corpse.Location.Y <= 344))*/
                             //Bloody room

                                /*if (((ushort)_corpse.Location.X >= 104 && (ushort)_corpse.Location.X <= 115)
                                *   && ((ushort)_corpse.Location.Y >= 640 && (ushort)_corpse.Location.Y <= 660))*/
                                if (((ushort)_corpse.Location.X >= 79 && (ushort)_corpse.Location.X <= 97) &&
                                    ((ushort)_corpse.Location.Y >= 326 && (ushort)_corpse.Location.Y <= 344))
                                {
                                    Self.Movement.MoveXYZ((ushort)_corpse.Location.X, (ushort)_corpse.Location.Y, (sbyte)_corpse.Location.Z, 1, 1, true);
                                    LootCorpse(_corpse);
                                    Scanner.Ignore(_corpse.Serial);
                                }
                            }
                        }
                    }
                    #endregion

                    Thread.Sleep(2000);
                }
                catch (Exception ex)
                {
                    ConsoleMessage("Error in main routine: {0}", ex.StackTrace);
                }
            }
        }