CanScissor() public static méthode

public static CanScissor ( Mobile from, IScissorable obj ) : bool
from Mobile
obj IScissorable
Résultat bool
Exemple #1
0
        private void SalvageCloth(Mobile from)
        {
            Scissors scissors = from.Backpack.FindItemByType(typeof(Scissors)) as Scissors;

            if (scissors == null)
            {
                from.SendLocalizedMessage(1079823);   // You need scissors in order to salvage cloth.
                return;
            }

            int salvaged    = 0;
            int notSalvaged = 0;

            Container sBag = this;

            List <Item> scissorables = sBag.FindItemsByType <Item>();

            for (int i = scissorables.Count - 1; i >= 0; --i)
            {
                Item item = scissorables[i];

                if (item is IScissorable)
                {
                    IScissorable scissorable = (IScissorable)item;

                    if (Scissors.CanScissor(from, scissorable) && scissorable.Scissor(from, scissors))
                    {
                        ++salvaged;
                    }
                    else
                    {
                        ++notSalvaged;
                    }
                }
            }

            from.SendLocalizedMessage(1079974, String.Format("{0}\t{1}", salvaged, salvaged + notSalvaged));     // Salvaged: ~1_COUNT~/~2_NUM~ tailored items

            Container pack = from.Backpack;

            foreach (Item i in ((Container)this).FindItemsByType(typeof(Item), true))
            {
                if ((i is Leather) || (i is Cloth) || (i is SpinedLeather) || (i is HornedLeather) || (i is BarbedLeather) || (i is Bandage) || (i is Bone))
                {
                    from.AddToBackpack(i);
                }
            }
        }