FindRegular() public static méthode

public static FindRegular ( Server.Mobile from ) : Spellbook
from Server.Mobile
Résultat Spellbook
        public override void OnDoubleClick(Mobile from)
        {
            if (!from.InLOS(this.GetWorldLocation()))
            {
                from.SendLocalizedMessage(502800);                   // You can't see that.
                return;
            }

            if (from.GetDistanceToSqrt(this.GetWorldLocation()) > 4)
            {
                from.SendLocalizedMessage(500446);                   // That is too far away.
                return;
            }

            from.SendMessage("You have been given some supplies based on your skills.");

            //4 pouches
            for (int i = 0; i < 4; ++i)
            {
                Pouch p = new Pouch();
                p.TrapType  = TrapType.MagicTrap;
                p.TrapPower = 1;
                p.Hue       = 0x25;
                PackItem(from, p);
            }

            PackItem(from, new GreaterExplosionPotion());
            PackItem(from, new TotalRefreshPotion());
            PackItem(from, new GreaterCurePotion());
            GiveLeatherArmor(from);

            if (from.Skills[SkillName.Magery].Value >= 50.0)
            {
                PackItem(from, new BagOfReagents(100));
                Spellbook book = Spellbook.FindRegular(from);                  //Spellbook book = from.GetSpellbook( typeof( Spellbook ) ) as Spellbook;
                if (book != null)
                {
                    if (book.Content != ulong.MaxValue)
                    {
                        book.Content = ulong.MaxValue;
                    }
                }
                else
                {
                    book         = new Spellbook();
                    book.Content = ulong.MaxValue;                    //all spells
                    GiveItem(from, book);
                }
            }
            else
            {
                for (int i = 0; i < 3; i++)
                {
                    PackItem(from, new GreaterHealPotion());
                }
            }

            if (from.Skills[SkillName.Healing].Value >= 50.0)
            {
                PackItem(from, new Bandage(100));
            }

            if (from.Skills[SkillName.Fencing].Value >= 50.0)
            {
                PackItem(from, new ShortSpear());
                if (from.Skills[SkillName.Parry].Value >= 50.0)
                {
                    GiveItem(from, new Kryss());
                    GiveItem(from, new MetalKiteShield());
                }
                else
                {
                    GiveItem(from, new Spear());
                }
            }

            if (from.Skills[SkillName.Swords].Value >= 50.0)
            {
                if (from.Skills[SkillName.Parry].Value >= 50.0)
                {
                    GiveItem(from, new MetalKiteShield());
                }

                if (from.Skills[SkillName.Lumberjacking].Value >= 50.0)
                {
                    GiveItem(from, new Hatchet());
                    PackItem(from, new LargeBattleAxe());
                }

                PackItem(from, new Halberd());
                GiveItem(from, new Katana());
            }

            if (from.Skills[SkillName.Macing].Value >= 50.0)
            {
                if (from.Skills[SkillName.Parry].Value >= 50.0)
                {
                    GiveItem(from, new MetalKiteShield());
                }
                GiveItem(from, new WarAxe());
                PackItem(from, new WarHammer());
            }

            if (from.Skills[SkillName.Archery].Value >= 50.0)
            {
                GiveItem(from, new Bow());
                PackItem(from, new Crossbow());
                PackItem(from, new HeavyCrossbow());

                PackItem(from, new Bolt(100));
                PackItem(from, new Arrow(100));
            }

            if (from.Skills[SkillName.Tailoring].Value >= 50.0)
            {
                PackItem(from, new SewingKit());
                PackItem(from, new Cloth(25));
                PackItem(from, new Leather(100));
            }

            if (from.Skills[SkillName.Blacksmith].Value >= 50.0)
            {
                PackItem(from, new Tongs());
                PackItem(from, new IronIngot(300));
            }

            if (from.Skills[SkillName.Poisoning].Value >= 50.0)
            {
                for (int i = 0; i < 5; i++)
                {
                    PackItem(from, new GreaterPoisonPotion());
                }
            }
        }
Exemple #2
0
        public override void OnDoubleClick(Mobile from)
        {
            //Al:Unified checks and added pedantic visibility check.
            if (!from.InRange(GetWorldLocation(), 4))
            {
                from.SendLocalizedMessage(500446); // That is too far away.
                return;
            }
            else if ((!this.Visible) || !from.InLOS(this.GetWorldLocation()))
            {
                from.SendLocalizedMessage(502800); // You can't see that.
                return;
            }

            from.SendMessage("You have been given some supplies based on your skills.");

            // Ethereals
            // will just be given out, when GiveEthereals is true and the user does not have a GameEthereal nor is mounted.
            if (GiveEthereals)
            {
                Item eth = from.Backpack.FindItemByType(typeof(GameEthereal));
                if (eth == null && !from.Mounted)
                {
                    PackItem(from, new GameEthereal());
                }
            }

            //4 pouches
            for (int i = 0; i < 4; ++i)
            {
                Pouch p = new Pouch();
                //p.TrapType = TrapType.MagicTrap;
                //p.TrapPower = 1;
                //p.Hue = 0x25;
                PackItem(from, p);
            }

            //PackItem( from, new GreaterExplosionPotion() );
            //PackItem( from, new TotalRefreshPotion() );
            //PackItem( from, new GreaterCurePotion() );
            GiveLeatherArmor(from);

            Spellbook book = Spellbook.FindRegular(from);//Spellbook book = from.GetSpellbook( typeof( Spellbook ) ) as Spellbook;

            if (book != null)
            {
                if (book.Content != ulong.MaxValue)
                {
                    book.Content = ulong.MaxValue;
                }
            }
            else
            {
                book          = new Spellbook();
                book.Content  = ulong.MaxValue;//all spells
                book.LootType = LootType.Regular;
                book.Weight   = 11;
                PackItem(from, book);
            }

            if (from.Skills[SkillName.Magery].Value >= 50.0)
            {
                PackItem(from, new BagOfReagents(100));
                if (from.Skills[SkillName.Parry].Value >= 50.0)
                {
                    GiveItem(from, new MetalKiteShield());
                }
            }
            else
            {
                PackItem(from, new BagOfReagents(10));
                //for(int i=0;i<3;i++)
                //PackItem( from, new GreaterHealPotion() );
            }

            if (from.Skills[SkillName.Healing].Value >= 50.0)
            {
                PackItem(from, new Bandage(100));
            }

            if (from.Skills[SkillName.Fencing].Value >= 50.0)
            {
                PackItem(from, new Kryss());
                PackItem(from, new WarFork());
                PackItem(from, new ShortSpear());
                if (from.Skills[SkillName.Parry].Value >= 50.0)
                {
                    PackItem(from, new MetalKiteShield());
                }
                else
                {
                    GiveItem(from, new Spear());
                }
            }

            if (from.Skills[SkillName.Swords].Value >= 50.0)
            {
                if (from.Skills[SkillName.Parry].Value >= 50.0)
                {
                    GiveItem(from, new MetalKiteShield());
                }

                if (from.Skills[SkillName.Lumberjacking].Value >= 50.0)
                {
                    GiveItem(from, new Hatchet());
                    PackItem(from, new LargeBattleAxe());
                }

                PackItem(from, new Halberd());
                GiveItem(from, new Katana());
            }

            if (from.Skills[SkillName.Macing].Value >= 50.0)
            {
                if (from.Skills[SkillName.Parry].Value >= 50.0)
                {
                    GiveItem(from, new MetalKiteShield());
                }
                GiveItem(from, new QuarterStaff());
                PackItem(from, new WarHammer());
                PackItem(from, new WarAxe());
            }

            if (from.Skills[SkillName.Archery].Value >= 50.0)
            {
                GiveItem(from, new Bow());
                PackItem(from, new Crossbow());
                PackItem(from, new HeavyCrossbow());

                PackItem(from, new Bolt(100));
                PackItem(from, new Arrow(100));
            }

            if (from.Skills[SkillName.Tailoring].Value >= 50.0)
            {
                PackItem(from, new SewingKit());
                PackItem(from, new Cloth(25));
                PackItem(from, new Leather(100));
            }

            if (from.Skills[SkillName.Blacksmith].Value >= 50.0)
            {
                PackItem(from, new Tongs());
                PackItem(from, new IronIngot(300));
            }

            if (from.Skills[SkillName.Poisoning].Value >= 50.0)
            {
                for (int i = 0; i < 3; i++)
                {
                    PackItem(from, new GreaterPoisonPotion());
                }
            }
        }