Beispiel #1
0
        /// <summary>
        /// Find targets based on notoriety
        /// </summary>
        /// <param name="args"></param>
        /// <param name="closest"></param>
        /// <param name="random"></param>
        /// <param name="next"></param>
        private static void FindTargetNotoriety(Argument[] args, bool closest, bool random, bool next)
        {
            string[] notoList = args[1].AsString().Split(',');

            List <int> notoTypes = new List <int>();

            foreach (string noto in notoList)
            {
                Targeting.TargetType type = (Targeting.TargetType)Enum.Parse(typeof(Targeting.TargetType), noto, true);

                /*NonFriendly, //Attackable, Criminal, Enemy, Murderer
                 * Friendly, //Innocent, Guild/Ally
                 * Red, //Murderer
                 * Blue, //Innocent
                 * Gray, //Attackable, Criminal
                 * Grey, //Attackable, Criminal
                 * Green, //GuildAlly
                 * Guild, //GuildAlly*/

                switch (type)
                {
                case Targeting.TargetType.Friendly:
                    notoTypes.Add((int)Targeting.TargetType.Innocent);
                    notoTypes.Add((int)Targeting.TargetType.GuildAlly);
                    break;

                case Targeting.TargetType.NonFriendly:
                    notoTypes.Add((int)Targeting.TargetType.Attackable);
                    notoTypes.Add((int)Targeting.TargetType.Criminal);
                    notoTypes.Add((int)Targeting.TargetType.Enemy);
                    notoTypes.Add((int)Targeting.TargetType.Murderer);
                    break;

                case Targeting.TargetType.Red:
                    notoTypes.Add((int)Targeting.TargetType.Murderer);
                    break;

                case Targeting.TargetType.Blue:
                    notoTypes.Add((int)Targeting.TargetType.Innocent);
                    break;

                case Targeting.TargetType.Gray:
                case Targeting.TargetType.Grey:
                    notoTypes.Add((int)Targeting.TargetType.Attackable);
                    notoTypes.Add((int)Targeting.TargetType.Criminal);
                    break;

                case Targeting.TargetType.Green:
                case Targeting.TargetType.Guild:
                    notoTypes.Add((int)Targeting.TargetType.GuildAlly);
                    break;

                default:
                    notoTypes.Add((int)type);
                    break;
                }
            }

            if (args.Length == 3)
            {
                if (args[2].AsString().IndexOf("human", StringComparison.InvariantCultureIgnoreCase) != -1)
                {
                    if (closest)
                    {
                        Targeting.ClosestHumanoidTarget(notoTypes.ToArray());
                    }
                    else if (random)
                    {
                        Targeting.RandomHumanoidTarget(notoTypes.ToArray());
                    }
                    else if (next)
                    {
                        Targeting.NextPrevTargetNotorietyHumanoid(true, notoTypes.ToArray());
                    }
                    else
                    {
                        Targeting.NextPrevTargetNotorietyHumanoid(false, notoTypes.ToArray());
                    }
                }
                else if (args[2].AsString().IndexOf("monster", StringComparison.InvariantCultureIgnoreCase) != -1)
                {
                    if (closest)
                    {
                        Targeting.ClosestMonsterTarget(notoTypes.ToArray());
                    }
                    else if (random)
                    {
                        Targeting.RandomMonsterTarget(notoTypes.ToArray());
                    }
                    else if (next)
                    {
                        Targeting.NextPrevTargetNotorietyMonster(true, notoTypes.ToArray());
                    }
                    else
                    {
                        Targeting.NextPrevTargetNotorietyMonster(false, notoTypes.ToArray());
                    }
                }
            }
            else
            {
                if (closest)
                {
                    Targeting.ClosestTarget(notoTypes.ToArray());
                }
                else if (random)
                {
                    Targeting.RandomTarget(notoTypes.ToArray());
                }
                else if (next)
                {
                    Targeting.NextPrevTargetNotoriety(true, notoTypes.ToArray());
                }
                else
                {
                    Targeting.NextPrevTargetNotoriety(false, notoTypes.ToArray());
                }
            }
        }