示例#1
0
            //---------------------------------------------------------------------------------------------

            public UOCharacter GetEnemy()
            {
                Serial      target = Aliases.GetObject("LastStatusManual");//Aliases.GetObject("LastStatusManualMobs");
                UOCharacter enemy  = new UOCharacter(target);

                if (!enemy.ExistCust())
                {
                    enemy = new UOCharacter(Aliases.LastAttack);//new UOCharacter(Aliases.GetObject("LastAttackMobs"));
                }
                if (!enemy.ExistCust())
                {
                    enemy = new Targeting().SearchNearestEnemy(this.Mob.GetPosition());
                }
                else
                {
                    enemy = new UOCharacter(target);
                }

                if (enemy.ExistCust() && String.IsNullOrEmpty(enemy.Name) && !enemy.RequestStatus(200))
                {
                    Game.PrintMessage("Vyprsel Timeout na zalozku enemyho");
                }

                return(enemy);
            }
示例#2
0
        //---------------------------------------------------------------------------------------------

        public static CastResultInfo CastBishopGreaterHeal(bool useScrool, Serial target, bool silence)
        {
            CastResultInfo info    = new CastResultInfo();
            UOItem         scrools = World.Player.Backpack.AllItems.FindType(Magery.SpellScrool[StandardSpell.GreaterHeal]);

            info.Spell = StandardSpell.GreaterHeal;

            if (useScrool && scrools.Exist)
            {
                Journal.Clear();
                scrools.Use();
                if (Journal.WaitForText(true, 250, "You activated KVM", "You can't cast this spell yet"))
                {
                    if (!Journal.Contains(true, "You activated KVM"))
                    {
                        UOCharacter ch  = new UOCharacter(target);
                        double      dmg = ch.MaxHits - ch.Hits;

                        if (ch.ExistCust() && dmg < 25)
                        {
                            info.Spell = StandardSpell.Heal;
                        }
                    }
                }
            }

            info = Magery.Current.CastSpell(info.Spell, target, false, false, silence, false);
            return(info);
        }
示例#3
0
        //---------------------------------------------------------------------------------------------

        public UOCharacter SelectNextTarget(int resetTimer, Notoriety[] notos)
        {
            UOCharacter ch = SearchNextTarget(World.Player.GetPosition(), notos, resetTimer, true);

            Aliases.LastAttack = ch.Serial;
            Aliases.SetObject("LastAttackMobs", ch.Serial);

            if (ch.ExistCust())
            {
                SelectNPCInClient(ch.Serial);
            }

            return(ch);
        }
示例#4
0
        public UOCharacter SearchNextTarget(IUOPosition center, Notoriety[] notorities, int resetTimer, bool useDoneList)
        {
            UOCharacter result  = new UOCharacter(Serial.Invalid);
            bool        isReset = false;

            if (resetTimer > 0 && (DateTime.Now - lastSearch).TotalMilliseconds >= resetTimer)
            {
                if (useDoneList)
                {
                    searchDoneList = new List <uint>();
                }
                isReset = true;
            }

            lastSearch = DateTime.Now;

            List <UOCharacter> list = new List <UOCharacter>();

            list.AddRange(World.Characters.Where(i =>
                                                 i.GetDistance() <= 25 &&
                                                 i.Serial != World.Player.Serial &&
                                                 (i.Notoriety == Notoriety.Murderer || i.Notoriety == Notoriety.Enemy) &&
                                                 notorities.Where(n => n == i.Notoriety).Count() > 0 &&
                                                 !Game.CurrentGame.IsAlie(i.Serial) &&
                                                 !Characters.IsSummon(i)).OrderBy(i => i.GetDistance(center)).ThenBy(i => i.Hits).ToList());

            list.AddRange(World.Characters.Where(i =>
                                                 i.GetDistance() <= 25 &&
                                                 i.Serial != World.Player.Serial &&
                                                 i.Notoriety == Notoriety.Neutral &&
                                                 notorities.Where(n => n == i.Notoriety).Count() > 0 &&
                                                 !Game.CurrentGame.IsAlie(i.Serial) &&
                                                 !Characters.IsSummon(i)).OrderBy(i => i.GetDistance(center)).ThenBy(i => i.Hits).ToList());

            list.AddRange(World.Characters.Where(i =>
                                                 i.GetDistance() <= 25 &&
                                                 i.Serial != World.Player.Serial &&
                                                 (i.Notoriety == Notoriety.Guild || i.Notoriety == Notoriety.Innocent) &&
                                                 notorities.Where(n => n == i.Notoriety).Count() > 0 &&
                                                 !Game.CurrentGame.IsAlie(i.Serial) &&
                                                 !Characters.IsSummon(i)).OrderBy(i => i.GetDistance(center)).ThenBy(i => i.Hits).ToList());


            if (useDoneList && list.Where(i => !searchDoneList.Contains(i.Serial)).ToList().Count > 0)
            {
                result = list.Where(i => !searchDoneList.Contains(i.Serial)).ToList()[0];
            }
            else
            {
                if (useDoneList)
                {
                    searchDoneList = new List <uint>();
                }

                isReset = true;

                if (list.Count > 0)
                {
                    result = list[0];
                }
            }

            if (useDoneList && result.ExistCust())
            {
                searchDoneList.Add(result.Serial);
            }

            if (list.Count > 1)
            {
                if (Game.Debug)
                {
                    for (int i = 1; i < Math.Min(3, list.Count); i++)
                    {
                        list[i].PrintHitsMessage("[" + i + "]");
                    }
                }
            }

            if (isReset && Game.Debug)
            {
                Game.PrintMessage("TargetNext - Reset");
            }

            return(result);
        }
示例#5
0
        public void MobKill(int resetTimer)
        {
            ResetTimerDefault = resetTimer;
            Game.CurrentGame.CurrentPlayer.EnsureWarMode();

            List <MobKillInfo> mobQueue = this.MobQueue;

            MobKillInfo current = null;
            MobKillInfo last    = null;

            int startIndex = 0;

            for (int i = 0; i < mobQueue.Count; i++)
            {
                MobKillInfo k = mobQueue[i];
                if (lastMob.IsValid && lastMob == k.Mob.Serial)
                {
                    //Game.PrintMessage("startIndex " + startIndex + " / " + Game.RenameSufix(k.Mob.Name), Game.Val_GreenBlue);
                    if (i < mobQueue.Count - 1)
                    {
                        startIndex = i + 1;
                        lastMob    = Serial.Invalid;
                    }
                    else
                    {
                        last = k;//new MobKillInfo(new UOCharacter(lastMob), resetTimer);
                    }
                }

                if (k.CommandCount == 0 && k.Mob.Serial != k.GetEnemyOrDefault().Serial)
                {
                    //Game.PrintMessage("New FOUND " + k.Mob.Name + " / " + i, Game.Val_GreenBlue);
                    current = mobQueue[i];
                    break;
                }
            }

            if (current == null)
            {
                for (int i = startIndex; i < mobQueue.Count; i++)
                {
                    MobKillInfo k = mobQueue[i];
                    if (k.NeedCommand())
                    {
                        //Game.PrintMessage("New OLD " + k.Mob.Name + " / " + i, Game.Val_GreenBlue);
                        current = k;
                        break;
                    }
                }
            }

            if (current == null && last != null && last.NeedCommand())
            {
                current = last;
            }

            //Game.PrintMessage("Mobs [" + mobQueue.Count + "]", Game.Val_GreenBlue);

            string  command  = null;
            UOColor sayColor = Game.Val_LightGreen;

            UOCharacter finalEnemy = new UOCharacter(Serial.Invalid);

            if (current != null)
            {
                command = current.Mob.Name + " kill";
                current.CommandCount++;
                current.LastCommandTime = DateTime.Now;
                sayColor = Game.GetAlieColorByHits(current.Mob.Serial);
                current.Mob.PrintMessage(Game.RenameSufix(current.Mob.Name) + (!String.IsNullOrEmpty(current.CommandReasonCode) && Game.Debug ? " [" + current.CommandReasonCode + "]" : ""), sayColor);//zatim pro debug

                if (!current.Enemy.ExistCust())
                {
                    current.Enemy = current.GetEnemy();
                }

                finalEnemy = current.Enemy;

                lastMob = current.Mob.Serial;
            }
            else if (mobQueue.Count == 0)
            {
                command = "all kill";
            }

            if (!String.IsNullOrEmpty(command) && finalEnemy.ExistCust() && finalEnemy.Distance < 22)
            {
                Targeting.ResetTarget();
                Game.RunScriptCheck(250);
                Game.Wait(50);
                UO.WaitTargetObject(finalEnemy);

                UO.Say(sayColor, command);
            }

            if (finalEnemy.ExistCust())
            {
                if (finalEnemy.Hits < 0)
                {
                    finalEnemy.RequestStatus(150);
                }



                finalEnemy.PrintMessage(String.Format(">>{0}/{1}<<", finalEnemy.Hits, finalEnemy.MaxHits), Game.GetEnemyColorByHits(finalEnemy.Serial));
                new StatusBar().Show(finalEnemy.Serial);
            }
        }
示例#6
0
        //---------------------------------------------------------------------------------------------

        private void UpdatePositionAndDirection()
        {
            if (this.StatusType != StatusType.Player)
            {
                string sufix    = "-";
                double distance = 0;

                if (mobile.ExistCust() && mobile.Hits > -1)
                {
                    lastPositon = mobile.GetPosition();
                }

                distance          = Robot.GetRealDistance(World.Player.GetPosition(), lastPositon);
                lastPositionAngle = Robot.GetAngle(World.Player.GetPosition(), lastPositon);

                MovementDirection direction = Robot.GetMovementDirection(lastPositionAngle);
                if (direction == MovementDirection.Up)
                {
                    sufix = "↑";
                }
                else if (direction == MovementDirection.UpRight)
                {
                    sufix = "↗";
                }
                else if (direction == MovementDirection.Right)
                {
                    sufix = "→";
                }
                else if (direction == MovementDirection.DownRight)
                {
                    sufix = "↘";
                }
                else if (direction == MovementDirection.Down)
                {
                    sufix = "↓";
                }
                else if (direction == MovementDirection.DownLeft)
                {
                    sufix = "↙";
                }
                else if (direction == MovementDirection.Left)
                {
                    sufix = "←";
                }
                else if (direction == MovementDirection.UpLeft)
                {
                    sufix = "↖";
                }

                Color c = Color.Transparent;

                if (distance <= 1)
                {
                    c = Color.FromArgb(0, 128, 255);
                }
                else if (distance <= 5)
                {
                    c = Color.FromArgb(0, 191, 255);
                }
                else if (distance <= 10)
                {
                    c = Color.FromArgb(0, 255, 255);
                }
                else if (distance <= 15)
                {
                    c = Color.FromArgb(0, 255, 191);
                }
                else if (distance > 15)
                {
                    c = Color.FromArgb(0, 255, 128);
                }


                this.runLabel.BackColor = c;

                if (distance > 99 || distance < 0)
                {
                    distance = 0;
                }

                //-/|\---↖↗↘↙↑← →↓
                string runLabelText = String.Format("{0:N0}", distance);
                runLabelText      += " " + sufix;
                this.runLabel.Text = runLabelText;
                this.runLabel.Invalidate();
            }
        }
示例#7
0
文件: Mount.cs 项目: caleb-dp/Phoenix
        public bool UseMount()
        {
            var currChars = World.Characters.Where(ch => ch.Serial != World.Player.Serial && ch.Distance <= 6).ToArray();
            var newChars  = World.Characters.Where(ch => ch.Serial != World.Player.Serial && ch.Distance <= 6).ToArray();
            var diff      = newChars.Where(ch => currChars.Count(cch => cch.Serial == ch.Serial) == 0).ToArray();

            UOItem currentMount  = World.Player.Layers[Layer.Mount];
            Serial originalMount = _Mount;

            bool dismount = currentMount.ExistCust();

            _Mount = Serial.Invalid;

            if (dismount)
            {
                UOColor currentColor = currentMount.Color;
                World.Player.Use();
                Game.Wait(100);

                newChars = World.Characters.Where(ch => ch.Serial != World.Player.Serial && ch.Distance <= 6).ToArray();
                diff     = newChars.Where(ch => currChars.Count(cch => cch.Serial == ch.Serial) == 0).ToArray();
                diff     = diff.OrderBy(ch => ch.Distance).ThenBy(ch => (ch.Color == currentColor ? 0 : 1)).ToArray();

                if (diff.Count() > 0)
                {
                    _Mount = diff.ToArray()[0].Serial;
                }
            }
            else
            {
                UOCharacter curr = new UOCharacter(originalMount);

                if (!curr.ExistCust())
                {
                    UOItem shrink = new UOItem(Serial.Invalid);
                    foreach (UOItem itm in World.Player.Backpack.AllItems)
                    {
                        if (ItemLibrary.ShrinkMountTypes.Count(uot => uot.Graphic == itm.Graphic) > 0)
                        {
                            shrink = itm;
                            break;
                        }
                    }

                    List <UOCharacter> m = new List <UOCharacter>();

                    if (HasHumanBody)//nemam haluze
                    {
                        m.AddRange(currChars.
                                   Where(ch => !denyMounts.Contains(ch.GetUniqueKey()) && !skipMounts.Contains(ch.GetUniqueKey()) && ItemLibrary.MountTypes.Count(mt => mt.Graphic == ch.Model) > 0).
                                   OrderBy(ch => (ch.Renamable ? 0 : 1)).
                                   ThenBy(ch => ch.Distance).ToArray());
                    }
                    else
                    {
                        m.AddRange(currChars.
                                   Where(ch => !denyMounts.Contains(ch.GetUniqueKey()) && !skipMounts.Contains(ch.GetUniqueKey())).
                                   OrderBy(ch => (ch.Renamable ? 0 : 1)).
                                   ThenBy(ch => ItemLibrary.MountTypes.Count(mt => mt.Graphic == ch.Model) > 0 ? 0 : 1).
                                   ThenBy(ch => ch.Distance).ToArray());
                    }

                    if (m.Count > 0)
                    {
                        _Mount = m[0].Serial;
                    }
                    else
                    {
                        if (shrink.Exist)
                        {
                            Game.CurrentGame.CurrentPlayer.SwitchWarmode();
                            shrink.Use();
                            Game.Wait(150);

                            newChars = World.Characters.Where(ch => ch.Serial != World.Player.Serial && ch.Distance <= 6).ToArray();
                            diff     = newChars.Where(ch => currChars.Count(cch => cch.Serial == ch.Serial) == 0).ToArray();
                            diff     = diff.OrderBy(ch => ch.Distance).ToArray();

                            if (diff.Count() > 0)
                            {
                                _Mount = diff.ToArray()[0].Serial;
                            }
                        }
                        skipMounts.Clear();
                    }
                }
                else
                {
                    _Mount = originalMount;
                }

                curr = new UOCharacter(_Mount);
                Journal.Clear();

                if (curr.ExistCust())
                {
                    curr.Use();

                    if (Journal.WaitForText(true, 150, "You dont own that horse"))
                    {
                        curr.PrintMessage("[ deny add ]");
                        denyMounts.Add(curr.GetUniqueKey());
                        _Mount = Serial.Invalid;
                    }
                    else if (!World.Player.Layers[Layer.Mount].ExistCust())
                    {
                        if (curr.Serial == originalMount && new UOCharacter(originalMount).Exist)
                        {
                            curr.PrintMessage("[ mount ]");
                        }
                        else
                        {
                            curr.PrintMessage("[ skip add ]");
                            skipMounts.Add(curr.GetUniqueKey());
                            _Mount = Serial.Invalid;
                        }
                    }
                }
                else
                {
                    World.Player.PrintMessage("[ neni mount ]");
                }
            }

            return(_Mount.IsValidCust());
        }