コード例 #1
0
ファイル: Key.cs プロジェクト: alucardxlx/Casiopia
        public bool UseOn(Mobile from, ILockable o)
        {
            if (o.KeyValue == this.KeyValue)
            {
                if (o is BaseDoor && !((BaseDoor)o).UseLocks())
                {
                    return(false);
                }
                else
                {
                    o.Locked = !o.Locked;

                    if (o is LockableContainer)
                    {
                        LockableContainer cont = (LockableContainer)o;

                        if (cont.LockLevel == -255)
                        {
                            cont.LockLevel = cont.RequiredSkill - 10;
                        }
                    }

                    if (o is Item)
                    {
                        Item item = (Item)o;

                        if (o.Locked)
                        {
                            item.SendLocalizedMessageTo(from, 1048000);                               // You lock it.
                        }
                        else
                        {
                            item.SendLocalizedMessageTo(from, 1048001);                               // You unlock it.
                        }
                        if (item is LockableContainer)
                        {
                            LockableContainer cont = (LockableContainer)item;

                            if (cont.TrapType != TrapType.None && cont.TrapOnLockpick)
                            {
                                if (o.Locked)
                                {
                                    item.SendLocalizedMessageTo(from, 501673);                                       // You re-enable the trap.
                                }
                                else
                                {
                                    item.SendLocalizedMessageTo(from, 501672);                                       // You disable the trap temporarily.  Lock it again to re-enable it.
                                }
                            }
                        }
                    }

                    return(true);
                }
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
ファイル: MagicLock.cs プロジェクト: FreeReign/Rebirth-Repack
        public void Target( LockableContainer targ )
        {
            if ( targ.Locked || targ.LockLevel == 0 || targ.MaxLockLevel == 0 )
            {
                Caster.SendLocalizedMessage( 501762 ); // Target must be an unlocked chest.
            }
            else if ( targ.MaxLockLevel > 65 )
            {
                Caster.SendAsciiMessage( "This chest cannot be magically locked." );
            }
            else if ( CheckSequence() )
            {
                SpellHelper.Turn( Caster, targ );

                Point3D loc = targ.GetWorldLocation();

                Effects.SendLocationParticles(
                    EffectItem.Create( loc, targ.Map, EffectItem.DefaultDuration ),
                    0x376A, 9, 32, 5020 );

                Effects.PlaySound( loc, targ.Map, 0x1FA );

                // The chest is now locked!
                Caster.LocalOverheadMessage( MessageType.Regular, 0x3B2, 501763 );

                targ.LockLevel = -255; // signal magic lock
                targ.Locked = true;
            }

            FinishSequence();
        }
コード例 #3
0
        protected override void OnTarget(Mobile from, object target)           // Override the protected OnTarget() for our feature
        {
            if (m_Deed.Deleted)
            {
                return;
            }

            if (target is LockableContainer)
            {
                LockableContainer item = (LockableContainer)target;

                if (item.TrapType != TrapType.None)                   // Check if its already trapped
                {
                    from.SendAsciiMessage("You can only place one trap on an object at a time.");
                }
                else if (item.Locked != false)
                {
                    from.SendAsciiMessage("You can only trap an unlocked object.");
                }
                else
                {
                    item.TrapType      = m_Deed.TrapType;
                    item.TrapPower     = m_Deed.TrapPower;
                    item.PlayerTrapped = true;
                    from.SendAsciiMessage("You successfully trap the container.");

                    m_Deed.Delete();                     // Delete the deed
                }
            }
            else
            {
                from.SendAsciiMessage("You can only trap lockable chests.");
            }
        }
コード例 #4
0
        public static void Fill(LockableContainer cont)
        {
            // Gold, about 100K
            for (int ix = 0; ix < 100; ix++)
            {
                cont.DropItem(new Gold(Utility.RandomMinMax(900, 1100)));
            }

            // plus about 20 chances for magic jewelry and/or clothing
            for (int ix = 0; ix < 20; ix++)
            {
                PackMagicItem(cont, 3, 3, 0.20);
                PackMagicItem(cont, 3, 3, 0.10);
                PackMagicItem(cont, 3, 3, 0.05);
            }

            // drop some scrolls and weapons/armor
            for (int ix = 0; ix < 25; ++ix)
            {
                int  level = 5;
                Item item;
                item = Loot.RandomArmorOrShieldOrWeapon();
                item = Loot.ImbueWeaponOrArmor(item, level, 0.05, false);

                // erl: SDrop chance
                // ..
                if (Server.Engines.SDrop.SDropTest(item, CoreAI.EScrollChance))
                {
                    // Drop a scroll instead
                    EnchantedScroll escroll = Loot.GenEScroll((object)item);

                    // Delete the original item
                    item.Delete();

                    // Re-reference item to escroll and continue
                    item = (Item)escroll;
                }
                // ..

                cont.DropItem(item);
            }

            // drop a few nice maps
            for (int ix = 0; ix < 5; ix++)
            {
                TreasureMap map = new TreasureMap(5, Map.Felucca);
                cont.DropItem(map);
            }

            // drop a few single-color leather dye tubs with 100 charges
            for (int ix = 0; ix < 25; ix++)
            {
                LeatherArmorDyeTub tub = new LeatherArmorDyeTub();
                cont.DropItem(tub);
            }

            // pack some other goodies
            TreasureMapChest.PackRegs(cont, 300);
            TreasureMapChest.PackGems(cont, 300);
        }
コード例 #5
0
        public static void PackMagicItem(LockableContainer cont, int minLevel, int maxLevel, double chance)
        {
            if (chance <= Utility.RandomDouble())
            {
                return;
            }

            Item item = Loot.RandomClothingOrJewelry();

            if (item == null)
            {
                return;
            }

            if (item is BaseClothing)
            {
                ((BaseClothing)item).SetRandomMagicEffect(minLevel, maxLevel);
            }
            else if (item is BaseJewel)
            {
                ((BaseJewel)item).SetRandomMagicEffect(minLevel, maxLevel);
            }

            cont.DropItem(item);
        }
コード例 #6
0
ファイル: MagicLock.cs プロジェクト: justdanofficial/khaeros
        public void Target( LockableContainer targ )
        {
            if ( Multis.BaseHouse.CheckLockedDownOrSecured( targ ) )
            {
                // You cannot cast this on a locked down item.
                Caster.LocalOverheadMessage( MessageType.Regular, 0x22, 501761 );
            }
            else if ( targ.Locked || targ.LockLevel == 0 || targ is ParagonChest )
            {
                // Target must be an unlocked chest.
                Caster.SendLocalizedMessage( 501762 );
            }
            else if ( CheckSequence() )
            {
                SpellHelper.Turn( Caster, targ );

                Point3D loc = targ.GetWorldLocation();

                Effects.SendLocationParticles(
                    EffectItem.Create( loc, targ.Map, EffectItem.DefaultDuration ),
                    0x376A, 9, 32, 5020 );

                Effects.PlaySound( loc, targ.Map, 0x1FA );

                // The chest is now locked!
                Caster.LocalOverheadMessage( MessageType.Regular, 0x3B2, 501763 );

                targ.LockLevel = -255; // signal magic lock
                targ.Locked = true;
            }

            FinishSequence();
        }
コード例 #7
0
        public virtual void OnTrap_OnTarget(Mobile from, object obj)
        {
            if (Deleted)
            {
                return;
            }

            if (obj is LockableContainer)
            {
                LockableContainer cont = (LockableContainer)obj;

                if (cont.TrapType != TrapType.None)
                {
                    from.SendMessage("That container is already trapped.");
                }
                else if (!cont.Locked)
                {
                    from.SendMessage("The container must be locked to trap it.");
                }
                else
                {
                    SetContainerTrap(from, cont);

                    from.SendMessage("You successfully trapped the container.");
                    from.PlaySound(from.Female ? 794 : 1066);

                    this.Consume();
                }
            }
            else
            {
                from.SendMessage("You cannot trap this.");
            }
        }
コード例 #8
0
        public static void Fill(LockableContainer cont, int level)
        {
            cont.Movable = false;
            cont.Locked  = true;

            // TODO: Update to correct loot table based on map level
            // LootGenerator.MakeLoot(cont, LootTable.Table2, 1, 1);
        }
コード例 #9
0
        public override void SetContainerTrap(Mobile from, LockableContainer cont)
        {
            cont.TrapType  = TrapType.ExplosionTrap;
            cont.TrapPower = 35 + Utility.Random(15);

            if ((from.Skills.Tinkering.Base / 175.0) >= Utility.RandomDouble())
            {
                cont.TrapPower += 25 + Utility.Random(20);
            }
        }
コード例 #10
0
        public override bool OnAugment(Mobile from, object target)
        {
            if (from == null || target == null || UsesRemaining == 0)
            {
                return(false);
            }

            if (target is BaseDoor)
            {
                BaseDoor d = target as BaseDoor;

                // open the door
                d.Open = true;

                if (OpenSound > 0)
                {
                    from.PlaySound(OpenSound);
                }

                // and add a fresh socket attachment to the door
                XmlAttach.AttachTo(d, new XmlSockets(1, false));

                // decrement the uses
                if (UsesRemaining > 0)
                {
                    UsesRemaining--;
                }

                return(true);
            }
            else
            if (target is LockableContainer)
            {
                LockableContainer d = target as LockableContainer;

                // open the container
                d.Locked = false;

                if (OpenSound > 0)
                {
                    from.PlaySound(OpenSound);
                }

                // decrement the uses
                if (UsesRemaining > 0)
                {
                    UsesRemaining--;
                }

                return(true);
            }


            return(false);
        }
コード例 #11
0
        public override void SetContainerTrap(Mobile from, LockableContainer cont)
        {
            cont.TrapType  = TrapType.PoisonTrap;
            cont.TrapLevel = 4;             //Deadly Poison
            cont.TrapPower = 50;

            if (0.3333 >= Utility.RandomDouble())
            {
                cont.TrapPower += 20 + Utility.Random(5);
            }
        }
コード例 #12
0
ファイル: Unlock.cs プロジェクト: zerodowned/angelisland
		public void Target( LockableContainer targ )
		{
			if ( Multis.BaseHouse.CheckSecured( targ ) )
			{
				// You cannot cast this on a secure item.
				Caster.SendLocalizedMessage( 503098 );
			}
			else if ( CheckSequence() )
			{
				SpellHelper.Turn( Caster, targ );

				Point3D loc = targ.GetWorldLocation();

				Effects.SendLocationParticles(
					EffectItem.Create( loc, targ.Map, EffectItem.DefaultDuration ),
					0x376A, 9, 32, 5024 );

				Effects.PlaySound( loc, targ.Map, 0x1FF );

				if ( targ.Locked && targ.LockLevel != 0 )
				{
					double magery = Caster.Skills[SkillName.Magery].Value;
					int level = (int)(magery * 0.8) - 4;

					if ( targ.LockLevel == -255 )
					{
						targ.Locked = false;
						FinishSequence();
						return;
					}
					if ( level >= targ.RequiredSkill && !(targ is TreasureMapChest && ((TreasureMapChest)targ).Level > 2) )
					{
						targ.Locked = false;

						

						if ( targ.LockLevel == 0 )
							targ.LockLevel = -1;
					}
					else
					{
						// My spell does not seem to have an effect on that lock.
						Caster.LocalOverheadMessage( MessageType.Regular, 0x3B2, 503099 );
					}
				}
				else
				{
					// That did not need to be unlocked.
					Caster.LocalOverheadMessage( MessageType.Regular, 0x3B2, 503101 );
				}
			}

			FinishSequence();
		}
コード例 #13
0
        public static void PackRegs(LockableContainer cont, int count)
        {
            ClearAmounts(TreasureMapChest.m_Regs);

            for (int i = 0; i < count; ++i)
            {
                m_Regs[Utility.Random(TreasureMapChest.m_Regs.Length)]++;
            }

            AddItems(cont, TreasureMapChest.m_Regs, TreasureMapChest.m_RegTypes);
        }
コード例 #14
0
        public override void SetContainerTrap(Mobile from, LockableContainer cont)
        {
            cont.TrapType  = TrapType.PoisonTrap;
            cont.TrapLevel = 2;             //Regular Poison
            cont.TrapPower = 25;

            if ((from.Skills.Tinkering.Base / 175.0) >= Utility.RandomDouble())
            {
                cont.TrapLevel += 1;
                cont.TrapPower += 10 + Utility.Random(5);
            }
        }
コード例 #15
0
        public override void SetContainerTrap(Mobile from, LockableContainer cont)
        {
            cont.TrapType  = TrapType.PoisonTrap;
            cont.TrapLevel = 3;             //Greater Poison
            cont.TrapPower = 40;

            if ((from.Skills.Tinkering.Base / 250.0) >= Utility.RandomDouble())
            {
                cont.TrapLevel += 1;
                cont.TrapPower += 20 + Utility.Random(5);
            }
        }
コード例 #16
0
        public static void Fill(LockableContainer cont, int level)
        {
            cont.Movable     = false;
            cont.TrapEnabled = false;
            cont.Locked      = false;

            int bandies = CoreAI.SpiritDepotBandies;
            int ghpots  = CoreAI.SpiritDepotGHPots;
            int regs    = CoreAI.SpiritDepotReagents;
            int trpots  = CoreAI.SpiritDepotTRPots;

            Item item = null;

            // add a couple lesser explosion potions
            //	these are for batteling hiders in the cave and not for damage
            for (int ix = 0; ix < 2; ix++)
            {
                item = new LesserExplosionPotion();
                cont.DropItem(item);
            }

            // add bandages
            item = new Bandage(bandies);
            cont.DropItem(item);

            // add greater heal potions
            for (int ix = 0; ix < ghpots; ix++)
            {
                item = new GreaterHealPotion();
                cont.DropItem(item);
            }

            // add total refresh potions
            for (int ix = 0; ix < trpots; ix++)
            {
                item = new TotalRefreshPotion();
                cont.DropItem(item);
            }
            // drop reagents
            cont.DropItem(new BagOfReagents(regs));

            // drop res scroll
            cont.DropItem(new ResurrectionScroll());

            return;
        }
コード例 #17
0
ファイル: Unlock.cs プロジェクト: FreeReign/Rebirth-Repack
        public void Target( LockableContainer targ )
        {
            if ( CheckSequence() )
            {
                SpellHelper.Turn( Caster, targ );

                Point3D loc = targ.GetWorldLocation();

                Effects.SendLocationParticles(
                    EffectItem.Create( loc, targ.Map, EffectItem.DefaultDuration ),
                    0x376A, 9, 32, 5024 );

                Effects.PlaySound( loc, targ.Map, 0x1FF );

                if ( targ.Locked )
                {
                    if ( targ.LockLevel != 0 && ( targ.LockLevel == -255 || ( targ.MaxLockLevel <= 50 && Caster.Skills[SkillName.Magery].Value > targ.RequiredSkill ) ) )
                    {
                        targ.Locked = false;

                        if ( targ.LockLevel == -255 )
                        {
                            targ.LockLevel = targ.MaxLockLevel - 30;

                            if ( targ.RequiredSkill < targ.LockLevel )
                                targ.LockLevel = targ.RequiredSkill;

                            if ( targ.LockLevel < 1 )
                                targ.LockLevel = 1;
                        }
                    }
                    else
                    {
                        // My spell does not seem to have an effect on that lock.
                        Caster.LocalOverheadMessage( MessageType.Regular, 0x3B2, 503099 );
                    }
                }
                else
                {
                    // That did not need to be unlocked.
                    Caster.LocalOverheadMessage( MessageType.Regular, 0x3B2, 503101 );
                }
            }

            FinishSequence();
        }
コード例 #18
0
ファイル: Key.cs プロジェクト: BackupTheBerlios/sunuo-svn
            protected override void OnTarget(Mobile from, object targeted)
            {
                int number;

                if (targeted == m_Key)
                {
                    number = 501665;                     // Enter a description for this key.

                    from.Prompt = new RenamePrompt(m_Key);
                }
                else if (targeted is ILockable)
                {
                    number = -1;

                    ILockable o = (ILockable)targeted;

                    if (o.KeyValue == m_Key.KeyValue)
                    {
                        if (o is BaseDoor && !((BaseDoor)o).UseLocks())
                        {
                            number = 501668;                             // This key doesn't seem to unlock that.
                        }
                        else
                        {
                            o.Locked = !o.Locked;

                            if (o is LockableContainer)
                            {
                                LockableContainer cont = (LockableContainer)o;

                                if (cont.LockLevel == -255)
                                {
                                    cont.LockLevel = cont.RequiredSkill - 10;
                                }
                            }

                            if (targeted is Item)
                            {
                                Item item = (Item)targeted;

                                if (o.Locked)
                                {
                                    item.SendLocalizedMessageTo(from, 1048000);
                                }
                                else
                                {
                                    item.SendLocalizedMessageTo(from, 1048001);
                                }
                            }
                        }
                    }
                    else
                    {
                        number = 501668;                         // This key doesn't seem to unlock that.
                    }
                }
                else
                {
                    number = 501666;                     // You can't unlock that!
                }

                if (number != -1)
                {
                    from.SendLocalizedMessage(number);
                }
            }
コード例 #19
0
        public static void Fill(LockableContainer cont, int level)
        {
            cont.Movable = false;
            cont.Locked = true;

            cont.TrapType = TrapType.ExplosionTrap;
            cont.TrapPower = level * 25;

            switch ( level )
            {
                case 0: cont.RequiredSkill = 1; break;
                case 1: cont.RequiredSkill = 36; break;
                case 2: cont.RequiredSkill = 76; break;
                case 3: cont.RequiredSkill = 84; break;
                case 4: cont.RequiredSkill = 92; break;
                case 5: cont.RequiredSkill = 100; break;
            }

            cont.LockLevel = cont.RequiredSkill - 10;
            cont.MaxLockLevel = cont.RequiredSkill + 40;

            double maskChance = 0.1 * level;

            if ( Utility.RandomDouble() < maskChance )
            {
                Item mask = null;
                switch ( Utility.Random( 4 ) )
                {
                    case 0: mask = new OrcishKinMask(); break;
                    case 1: mask = new TribalMask(); break;
                    case 2: mask = new DeerMask(); break;
                    case 3:
                    default:mask = new BearMask(); break;
                }

                cont.DropItem( mask );
            }

            //int gold = 1000 * level;
            //cont.DropItem( new Gold( gold ) );

            for ( int i = 0; i < level * 5; ++i )
                cont.DropItem( Loot.RandomScroll( 0, 63, SpellbookType.Regular ) );

            /*for (int i = 0; i < level * 2; i++)
            {
                cont.DropItem(new Gold(Utility.RandomMinMax(100, 600)));

                // this give magic weapons over 25% of the time with a 15% chance for a vanq even at level 1. That is insane.
                Item item = Loot.RandomArmorOrShieldOrWeapon();

                if (item is BaseWeapon)
                {
                    BaseWeapon weapon = (BaseWeapon)item;

                    weapon.DamageLevel = (WeaponDamageLevel)Utility.Random(6);
                    weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random(6);
                    weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(6);

                    cont.DropItem(item);
                }
                else if (item is BaseArmor)
                {
                    BaseArmor armor = (BaseArmor)item;

                    armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6);
                    armor.Durability = (ArmorDurabilityLevel)Utility.Random(6);

                    cont.DropItem(item);
                }
            }*/

            for ( int i = 0; i < level; ++i )
            {
                // This is much more sane.
                LootPack.OldSuperBoss.Generate( cont );
            }

            int reagents;
            if ( level == 0 )
                reagents = 12;
            else
                reagents = level * 3;

            for ( int i = 0; i < reagents; i++ )
            {
                Item item = Loot.RandomPossibleReagent();
                item.Amount = Utility.RandomMinMax( 20, 60 );
                cont.DropItem( item );
            }

            int gems;
            if ( level == 0 )
                gems = 2;
            else
                gems = level * 3;

            for ( int i = 0; i < gems; i++ )
            {
                Item item = Loot.RandomGem();
                cont.DropItem( item );
            }
        }
コード例 #20
0
ファイル: Key.cs プロジェクト: zerodowned/angelisland
            protected override void OnTarget(Mobile from, object targeted)
            {
                int number;

                // rename the key
                if (targeted == m_Key)
                {                       // cannot rename magic keys
                    if (m_Key.Type != KeyType.Magic)
                    {
                        number      = 501665;                    // Enter a description for this key.
                        from.Prompt = new RenamePrompt(m_Key);
                    }
                    else
                    {
                        return;
                    }
                }
                else if (targeted is ILockable)
                {
                    number = -1;

                    ILockable o = (ILockable)targeted;

                    if (o.KeyValue == m_Key.KeyValue)
                    {
                        if (o is BaseDoor && !((BaseDoor)o).UseLocks())
                        {
                            number = 501668;                             // This key doesn't seem to unlock that.
                        }
                        else if (o is BaseDoor && !(m_Key.IsChildOf(from.Backpack)))
                        {
                            from.SendLocalizedMessage(1042001);                               // That must be in your pack for you to use it.
                        }
                        else
                        {
                            if (o is BaseHouseDoor)
                            {
                                BaseHouse home;
                                home = ((BaseHouseDoor)o).FindHouse();

                                /*if (home.Public == true)
                                 * {
                                 *      if (o.Locked != true)
                                 *      from.SendMessage("You cannot lock a public house.");
                                 *      o.Locked = false;
                                 *      return;
                                 * }*/
                            }
                            o.Locked = !o.Locked;

                            if (o is LockableContainer)
                            {
                                LockableContainer cont = (LockableContainer)o;

                                if (cont.TinkerMadeTrap)
                                {
                                    if (cont.Locked)
                                    {
                                        cont.TrapEnabled = true;
                                        if (cont.TrapType != TrapType.None)
                                        {
                                            from.SendMessage("You enable the trap.");
                                        }
                                    }
                                    else
                                    {
                                        cont.TrapEnabled = false;
                                        if (cont.TrapType != TrapType.None)
                                        {
                                            from.SendMessage("You disable the trap.");
                                        }
                                    }
                                }
                                if (cont.LockLevel == -255)
                                {
                                    cont.LockLevel = cont.RequiredSkill - 10;
                                }
                            }

                            if (targeted is Item)
                            {
                                Item item = (Item)targeted;

                                if (o.Locked)
                                {
                                    item.SendLocalizedMessageTo(from, 1048000);
                                }
                                else
                                {
                                    item.SendLocalizedMessageTo(from, 1048001);
                                }
                            }
                        }
                    }
                    else
                    {
                        number = 501668;                         // This key doesn't seem to unlock that.
                    }
                }
                else
                {
                    number = 501666;                     // You can't unlock that!
                }

                if (number != -1)
                {
                    from.SendLocalizedMessage(number);
                }
            }
コード例 #21
0
		public static void Fill( LockableContainer cont, int level )
		{
			cont.Movable = false;
			cont.TrapEnabled = false;
			cont.Locked = false;

			int bandies = CoreAI.SpiritDepotBandies;
			int ghpots = CoreAI.SpiritDepotGHPots;
			int regs = CoreAI.SpiritDepotReagents;
			int trpots = CoreAI.SpiritDepotTRPots;

			Item item = null;

			// add a couple lesser explosion potions
			//	these are for batteling hiders in the cave and not for damage
			for( int ix=0; ix < 2; ix++ )
			{
				item = new LesserExplosionPotion();
				cont.DropItem(item);
			}

			// add bandages
			item = new Bandage(bandies);
			cont.DropItem(item);

			// add greater heal potions
			for( int ix=0; ix < ghpots; ix++ )
			{
				item = new GreaterHealPotion();
				cont.DropItem(item);
			}

			// add total refresh potions
			for( int ix=0; ix < trpots; ix++ )
			{
				item = new TotalRefreshPotion();
				cont.DropItem(item);
			}
			// drop reagents
			cont.DropItem( new BagOfReagents( regs ) );

			// drop res scroll
			cont.DropItem( new ResurrectionScroll() ); 

			return;
		}
コード例 #22
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (!m_Key.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1060640);                       // The item must be in your backpack to use it.
                }
                else if (targeted == m_Key)
                {
                    from.SendMessage("This key is to unlock almost any container.");
                }
                else if (targeted is BaseHouseDoor)                    // house door check
                {
                    from.SendMessage("This key is to unlock almost any container.");
                }
                else if (targeted is BookBox)                    // cursed box of books
                {
                    from.SendMessage("This key can never unlock this cursed box.");
                }
                else if (targeted is UnidentifiedArtifact || targeted is UnidentifiedItem || targeted is CurseItem)
                {
                    from.SendMessage("This key is to unlock almost any container.");
                }
                else if (targeted is BaseDoor)
                {
                    if (Server.Items.DoorType.IsSpaceshipDoor((BaseDoor)targeted) && m_Key.ItemID != 0x3A75)
                    {
                        from.SendMessage("This doesn't have a key hole, but it does have a card slot.");
                    }
                    else if (!(Server.Items.DoorType.IsSpaceshipDoor((BaseDoor)targeted)) && m_Key.ItemID == 0x3A75)
                    {
                        from.SendMessage("This doesn't have a card slot, but it does have a key hole.");
                    }
                    else if (Server.Items.DoorType.IsSpaceshipDoor((BaseDoor)targeted) && m_Key.ItemID == 0x3A75)
                    {
                        if (((BaseDoor)targeted).Locked == false)
                        {
                            from.SendMessage("That does not need to be unlocked.");
                        }

                        else
                        {
                            ((BaseDoor)targeted).Locked = false;
                            Server.Items.DoorType.UnlockDoors((BaseDoor)targeted);
                            from.RevealingAction();
                            from.PlaySound(0x54B);
                            m_Key.Consume();
                        }
                    }
                    else if (Server.Items.DoorType.IsDungeonDoor((BaseDoor)targeted) && m_Key.ItemID != 0x3A75)
                    {
                        if (((BaseDoor)targeted).Locked == false)
                        {
                            from.SendMessage("That does not need to be unlocked.");
                        }

                        else
                        {
                            ((BaseDoor)targeted).Locked = false;
                            Server.Items.DoorType.UnlockDoors((BaseDoor)targeted);
                            from.RevealingAction();
                            from.PlaySound(0x241);
                            m_Key.Consume();
                        }
                    }
                    else
                    {
                        from.SendMessage("That does not need to be unlocked.");
                    }
                }
                else if (targeted is ILockable)
                {
                    ILockable         o     = (ILockable)targeted;
                    LockableContainer cont2 = (LockableContainer)o;

                    if (Multis.BaseHouse.CheckSecured(cont2))
                    {
                        from.SendLocalizedMessage(503098);                           // You cannot cast this on a secure item.
                    }
                    else if (!cont2.Locked)
                    {
                        from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101);                           // That did not need to be unlocked.
                    }
                    else if (cont2.LockLevel == 0)
                    {
                        from.SendLocalizedMessage(501666);                           // You can't unlock that!
                    }
                    else if (o.Locked)
                    {
                        if (o is BaseDoor && !((BaseDoor)o).UseLocks())                            // this seems to check house doors also
                        {
                            from.SendMessage("This key is to unlock any container.");
                        }
                        else if (Server.Misc.ContainerFunctions.IsSpaceCrate(((Item)o).ItemID) && ((ILockpickable)targeted).Locked && m_Key.ItemID != 0x3A75)
                        {
                            from.SendMessage("This doesn't have a key hole, but it does have a card slot.");
                        }
                        else if (!(Server.Misc.ContainerFunctions.IsSpaceCrate(((Item)o).ItemID)) && ((ILockpickable)targeted).Locked && m_Key.ItemID == 0x3A75)
                        {
                            from.SendMessage("This doesn't have a card slot, but it does have a key hole.");
                        }
                        else if (Server.Misc.ContainerFunctions.IsSpaceCrate(((Item)o).ItemID) && o.Locked && m_Key.ItemID == 0x3A75)
                        {
                            o.Locked = false;

                            if (o is LockableContainer)
                            {
                                LockableContainer cont = (LockableContainer)o;
                                if (cont.LockLevel == -255)
                                {
                                    cont.LockLevel = cont.RequiredSkill - 10;
                                    if (cont.LockLevel == 0)
                                    {
                                        cont.LockLevel = -1;
                                    }
                                }

                                cont.Picker = from;                                  // sets "lockpicker" to the user.
                            }

                            if (targeted is Item)
                            {
                                Item item = (Item)targeted;
                                from.SendMessage("You swipe the key card to open the lock, but also wearing it out from further use.");
                            }

                            from.RevealingAction();
                            from.PlaySound(0x54B);
                            m_Key.Consume();
                        }
                        else if (o.Locked && m_Key.ItemID != 0x3A75)
                        {
                            o.Locked = false;

                            if (o is LockableContainer)
                            {
                                LockableContainer cont = (LockableContainer)o;
                                if (cont.LockLevel == -255)
                                {
                                    cont.LockLevel = cont.RequiredSkill - 10;
                                    if (cont.LockLevel == 0)
                                    {
                                        cont.LockLevel = -1;
                                    }
                                }

                                cont.Picker = from;                                  // sets "lockpicker" to the user.
                            }

                            if (targeted is Item)
                            {
                                Item item = (Item)targeted;
                                from.SendMessage("The key opens the lock, wearing the key out from further use.");
                            }

                            from.RevealingAction();
                            from.PlaySound(0x241);
                            m_Key.Consume();
                        }
                    }
                    else
                    {
                        from.SendMessage("You don't need to use this key on that.");
                    }
                }
                else
                {
                    from.SendMessage("This key is to unlock any container.");
                }
            }
コード例 #23
0
        public static void Fill(LockableContainer cont, int level, Expansion e)
        {
            cont.Movable = false;
            cont.Locked  = true;
            int numberItems;

            if (level == 0)
            {
                cont.LockLevel = 0;                                    // Can't be unlocked

                cont.DropItem(new Gold(Utility.RandomMinMax(25, 50))); // reduced from 50 100

                if (Utility.RandomDouble() < 0.75)
                {
                    cont.DropItem(new TreasureMap(0, Map.Felucca));
                }
            }
            else
            {
                cont.TrapType  = TrapType.ExplosionTrap;
                cont.TrapPower = level * 25;
                cont.TrapLevel = level;

                switch (level)
                {
                case 1:
                    cont.RequiredSkill = 36;
                    break;

                case 2:
                    cont.RequiredSkill = 76;
                    break;

                case 3:
                    cont.RequiredSkill = 84;
                    break;

                case 4:
                    cont.RequiredSkill = 92;
                    break;

                case 5:
                    cont.RequiredSkill = 95;
                    break;

                case 6:
                    cont.RequiredSkill = 95;
                    break;
                }

                cont.LockLevel    = cont.RequiredSkill - 10;
                cont.MaxLockLevel = cont.RequiredSkill + 40;

                cont.DropItem(new Gold(level * 1000, level * 2000));

                for (int i = 0; i < level * 5; ++i)
                {
                    cont.DropItem(Loot.RandomScroll(0, 63, SpellbookType.Regular));
                }

                if (e >= Expansion.SE)
                {
                    switch (level)
                    {
                    case 1:
                        numberItems = 2;
                        break;

                    case 2:
                        numberItems = 4;
                        break;

                    case 3:
                        numberItems = 7;
                        break;

                    case 4:
                        numberItems = 10;
                        break;

                    case 5:
                        numberItems = 20;
                        break;

                    case 6:
                        numberItems = 30;
                        break;

                    default:
                        numberItems = 0;
                        break;
                    }
                }
                else
                {
                    numberItems = level * 6;
                }

                for (int i = 0; i < numberItems; ++i)
                {
                    Item item = Loot.RandomArmorOrShieldOrWeapon();

                    if (item is BaseWeapon)
                    {
                        var weapon = (BaseWeapon)item;

                        int damageLevel = PseudoSeerStone.GetDamageLevel(level);

                        if (PseudoSeerStone.HighestDamageLevelSpawn < damageLevel)
                        {
                            if (damageLevel == 5 && PseudoSeerStone.ReplaceVanqWithSkillScrolls)
                            {
                                cont.DropItem(PuzzleChest.CreateRandomSkillScroll());
                            }

                            int platAmount = PseudoSeerStone.PlatinumPerMissedDamageLevel *
                                             (damageLevel - PseudoSeerStone.Instance._HighestDamageLevelSpawn);

                            if (platAmount > 0)
                            {
                                cont.DropItem(new Platinum(platAmount));
                            }

                            damageLevel = PseudoSeerStone.Instance._HighestDamageLevelSpawn;
                        }

                        weapon.DamageLevel     = (WeaponDamageLevel)damageLevel;
                        weapon.DurabilityLevel = (WeaponDurabilityLevel)PseudoSeerStone.GetDurabilityLevel(level);
                        weapon.AccuracyLevel   = (WeaponAccuracyLevel)PseudoSeerStone.GetAccuracyLevel(level);

                        if (0.02 * level >= Utility.RandomDouble())
                        {
                            weapon.Slayer = (SlayerName)Utility.Random(28);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseArmor)
                    {
                        var armor = (BaseArmor)item;

                        armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6);
                        armor.Durability      = (ArmorDurabilityLevel)Utility.Random(6);

                        cont.DropItem(item);
                    }
                    else if (item is BaseHat || item is BaseJewel)
                    {
                        cont.DropItem(item);
                    }
                }
            }

            int reagents;

            if (level == 0)
            {
                reagents = 12;
            }
            else
            {
                reagents = level * 3;
            }

            for (int i = 0; i < reagents; i++)
            {
                Item item = Loot.RandomPossibleReagent(e);
                item.Amount = Utility.RandomMinMax(40, 60);
                cont.DropItem(item);
            }

            int gems;

            if (level == 0)
            {
                gems = 2;
            }
            else
            {
                gems = level * 3;
            }

            for (int i = 0; i < gems; i++)
            {
                Item item = Loot.RandomGem();
                cont.DropItem(item);
            }

            if (level == 6 && cont.EraAOS)
            {
                cont.DropItem((Item)Activator.CreateInstance(m_Artifacts[Utility.Random(m_Artifacts.Length)]));
            }
        }
コード例 #24
0
ファイル: TreasureMapChest.cs プロジェクト: Godkong/Origins
 public static void Fill( LockableContainer cont, int level )
 {
 }
コード例 #25
0
		private static void PackScroll( LockableContainer cont, int circle )
		{
			int min = (circle - 1) * 8;

			cont.DropItem( Loot.RandomScroll( min, min + 7, SpellbookType.Regular ) );
		}
コード例 #26
0
		private static void AddThemeLoot (LockableContainer cont, int level, ChestThemeType type)
		{
			MonsterStatuette mx = null;

			//switch to add in theme treasures
			switch ( type )
			{
				case ChestThemeType.Solen:
				{

					//drop are special weapon
					QuarterStaff special = new QuarterStaff();
					special.Name = "Chitanous Staff";
					cont.DropItem(Loot.ImbueWeaponOrArmor(special, 6, 0, true));

					//go into dropping normal loot

					int onlyonedrop = Utility.RandomMinMax(0,1);

					if(onlyonedrop ==0 )cont.DropItem(new Seed(PlantType.Hedge,0,false)); //new solen seed
					if(onlyonedrop ==1 )cont.DropItem(new WaterBucket() ); //new waterbucket

					if (Utility.RandomDouble() <= 0.30 ) //30% chance to drop a statue
					{
						int whichone = Utility.RandomMinMax(0,1);
						if(whichone == 0)mx = new MonsterStatuette (m_Monster[0]);
						if(whichone == 1)mx = new MonsterStatuette (m_Monster[1]);
						mx.LootType = LootType.Regular;		// not blessed
						cont.DropItem( mx );			// drop it baby!
					}
					break;
				}

				case ChestThemeType.Brigand:
				{
					//drop are special weapon
					Katana special = new Katana();
					special.Name = "Bandit's Blade";
					cont.DropItem(Loot.ImbueWeaponOrArmor(special, 6, 0, true));

					int onlyonedrop = Utility.RandomMinMax(0,1);

					if(onlyonedrop ==0 )cont.DropItem(new Brazier(true)); //new movable brazier
					if(onlyonedrop ==1 )cont.DropItem(new DecorativeBow(Utility.RandomMinMax(0,3))); //random decorative bow type

					for ( int i = 0; i < level * 5; ++i )
					{
						cont.DropItem (new PowderOfTranslocation() );  //drop powder of translocation
					}

					if (Utility.RandomDouble() <= 0.30 ) //30% chance to drop a statue
					{
						int whichone = Utility.RandomMinMax(0,1);
						if(whichone == 0)mx = new MonsterStatuette (m_Monster[2]);
						if(whichone == 1)mx = new MonsterStatuette (m_Monster[3]);
						mx.LootType = LootType.Regular;		// not blessed
						cont.DropItem( mx );			// drop it baby!
					}
					break;
				}

				case ChestThemeType.Savage:
				{
					//drop are special weapon
					ShortSpear special = new ShortSpear();
					special.Name = "Ornate Ritual Spear";
					cont.DropItem(Loot.ImbueWeaponOrArmor(special, 6, 0, true));

					int rug = Utility.RandomMinMax(0,1);
					int onlyonedrop = Utility.RandomMinMax(0,1);

					if(onlyonedrop ==0 )cont.DropItem(new SkullPole() ); //new skull pole

					if(onlyonedrop ==1 )
					{
						if(rug == 0) cont.DropItem(new BrownBearRugEastDeed() ); //new rug east
						if(rug == 1) cont.DropItem(new BrownBearRugSouthDeed() ); //new rug south
					}

					if (Utility.RandomDouble() <= .30 ) //30% chance to drop a statue
					{
						int whichone = Utility.RandomMinMax(0,1);
						if(whichone == 0)mx = new MonsterStatuette (m_Monster[4]);
						if(whichone == 1)mx = new MonsterStatuette (m_Monster[5]);
						mx.LootType = LootType.Regular;			// not blessed
						cont.DropItem( mx );				// drop it baby!
					}
					break;
				}

				case ChestThemeType.Undead:
				{
					Halberd special = new Halberd();
					special.Name = "Soul Reaver";
					cont.DropItem(Loot.ImbueWeaponOrArmor(special, 6, 0, true));

					int onlyonedrop = Utility.RandomMinMax(0,1);
					if(onlyonedrop ==0 )cont.DropItem(new BoneContainer(Utility.RandomMinMax(0,2))); //new bone container 3 differnt types 0-2
					int stone = Utility.RandomMinMax(0,3); // get random gravestone type to drop

					if(onlyonedrop ==1 )
					{
						if(stone == 0) cont.DropItem(new GraveStone1());
						if(stone == 1) cont.DropItem(new GraveStone2());
						if(stone == 2) cont.DropItem(new GraveStone3());
						if(stone == 3) cont.DropItem(new GraveStone4());
					}

					for ( int i = 0; i < level * 5; ++i )
					{
						cont.DropItem(new Moonstone()); //drop moonstones
					}

					if (Utility.RandomDouble() <= 0.30 ) //30% chance to drop a statue
					{
						int whichone = Utility.RandomMinMax(0,1);
						if(whichone == 0)mx = new MonsterStatuette (m_Monster[6]);
						if(whichone == 1)mx = new MonsterStatuette (m_Monster[7]);
						mx.LootType = LootType.Regular;			// not blessed
						cont.DropItem( mx );				// drop it baby!
					}
					break;
				}

				case ChestThemeType.Pirate:
				{

					Bow special = new Bow();
					special.Name = "Bow of the Buccaneer";
					cont.DropItem(Loot.ImbueWeaponOrArmor(special, 6, 0, true));

					int onlyonedrop = Utility.RandomMinMax(0,1);
					PirateHat hat = new PirateHat();
					hat.Hue = 0x1;
					int oars = Utility.RandomMinMax(0,1); //2 oar types

					if(onlyonedrop ==0 )
					{
						if(oars == 0) cont.DropItem(new Oars1());
						if(oars == 1) cont.DropItem(new Oars2());
					}

					if(onlyonedrop == 1 )cont.DropItem(new GenieBottle(false) ); //lamp currently disabled genie not done
					if (Utility.RandomDouble() <= 0.50 )cont.DropItem(hat); // 50% chance at black piratehat

					if (Utility.RandomDouble() <= 0.30 ) //30% chance to drop a statue
					{
						int whichone = Utility.RandomMinMax(0,1);
						if(whichone == 0)mx = new MonsterStatuette (m_Monster[8]);
						if(whichone == 1) mx = new MonsterStatuette (m_Monster[9]);
						mx.LootType = LootType.Regular;					// not blessed
						cont.DropItem( mx );						// drop it baby!
					}
					break;
				}

				case ChestThemeType.Dragon:
				{
					WarFork special = new WarFork();
					special.Name = "Claw of the Dragon";
					cont.DropItem(Loot.ImbueWeaponOrArmor(special, 6, 0, true));

					int onlyonedrop = Utility.RandomMinMax(0,1);
					//new dragonhead trophydeed type
					if(onlyonedrop ==0 ) cont.DropItem(new TrophyDeed(8757, 8756, "a dragon head trophy", "a dragon head trophy", 10 ));
					int armor = Utility.RandomMinMax(0,2); // drop 1 piece of dragonarmor

					if(onlyonedrop == 1 )
					{
						if(armor == 0) cont.DropItem(new HangingDragonChest());
						if(armor == 1) cont.DropItem(new HangingDragonLegs());
						if(armor == 2) cont.DropItem(new HangingDragonArms());
					}

					if (Utility.RandomDouble() <= 0.30 ) //30% chance to drop a statue
					{
						int whichone = Utility.RandomMinMax(0,1);
						if(whichone == 0)mx = new MonsterStatuette (m_Monster[10]);
						if(whichone == 1)mx = new MonsterStatuette (m_Monster[11]);
						mx.LootType = LootType.Regular;			// not blessed
						cont.DropItem( mx );				// drop it baby!
					}
					break;
				}

				case ChestThemeType.Lizardmen: 
				{
					if (Utility.RandomBool())
						cont.DropItem( new LizardmansStaff() ); 
					else
						cont.DropItem( new LizardmansMace() ); 
				}
					break;
				
				case ChestThemeType.Ettin:
				{
					cont.DropItem( new EttinHammer() ); 
				}
					break;
				
				case ChestThemeType.Ogre: 
				{
					cont.DropItem( new OgresClub() ); 
				}
					break;

				case ChestThemeType.Ophidian:
				{
					cont.DropItem( new OphidianBardiche() ); 
				}
					break;
				
				case ChestThemeType.Skeleton:
				{
					switch (Utility.Random(3))
					{
						case 0: cont.DropItem( new SkeletonScimitar() ); break;
						case 1: cont.DropItem( new SkeletonAxe() ); break;
						case 2: cont.DropItem( new BoneMageStaff() ); break;
					}
				}
					break;

				case ChestThemeType.Ratmen:
				{
					if (Utility.RandomBool())
						cont.DropItem( new RatmanSword() ); 
					else
						cont.DropItem( new RatmanAxe() ); 
				}
					break;

				case ChestThemeType.Orc:
				{
					switch (Utility.Random(3))
					{
						case 0: cont.DropItem( new OrcClub() ); break;
						case 1: cont.DropItem( new OrcMageStaff() ); break;
						case 2: cont.DropItem( new OrcLordBattleaxe() ); break;
					}
				}
					break;

				case ChestThemeType.Terathan:
				{
					switch (Utility.Random(3))
					{
						case 0: cont.DropItem( new TerathanStaff() ); break;
						case 1: cont.DropItem( new TerathanSpear() ); break;
						case 2: cont.DropItem( new TerathanMace() ); break;
					}
				}
					break;

				case ChestThemeType.FrostTroll:
				{
					switch (Utility.Random(3))
					{
						case 0: cont.DropItem( new FrostTrollClub() ); break;
						case 1: cont.DropItem( new TrollAxe() ); break;
						case 2: cont.DropItem( new TrollMaul() ); break;
					}
				}
					break;

			}//end switch

		}
コード例 #27
0
        public static void Fill(LockableContainer cont, int level)
        {
            cont.Movable = false;
            cont.Locked  = true;
            int numberItems;

            if (level == 0)
            {
                cont.LockLevel = 0;                 // Can't be unlocked

                cont.DropItem(new Gold(Utility.RandomMinMax(50, 100)));

                if (Utility.RandomDouble() < 0.75)
                {
                    cont.DropItem(new TreasureMap(0, Map.Trammel));
                }
            }
            else
            {
                cont.TrapType  = TrapType.ExplosionTrap;
                cont.TrapPower = level * 25;
                cont.TrapLevel = level;

                switch (level)
                {
                case 1: cont.RequiredSkill = 36; break;

                case 2: cont.RequiredSkill = 76; break;

                case 3: cont.RequiredSkill = 84; break;

                case 4: cont.RequiredSkill = 92; break;

                case 5: cont.RequiredSkill = 100; break;

                case 6: cont.RequiredSkill = 100; break;
                }

                cont.LockLevel    = cont.RequiredSkill - 10;
                cont.MaxLockLevel = cont.RequiredSkill + 40;

                //Publish 67 gold change
                //if ( Core.SA )
                //	cont.DropItem( new Gold( level * 5000 ) );
                //else
                cont.DropItem(new Gold(level * 1000));

                for (int i = 0; i < level * 5; ++i)
                {
                    cont.DropItem(Loot.RandomScroll(0, 63, SpellbookType.Regular));
                }

                if (Core.SE)
                {
                    switch (level)
                    {
                    case 1: numberItems = 5; break;

                    case 2: numberItems = 10; break;

                    case 3: numberItems = 15; break;

                    case 4: numberItems = 38; break;

                    case 5: numberItems = 50; break;

                    case 6: numberItems = 60; break;

                    default: numberItems = 0; break;
                    }
                    ;
                }
                else
                {
                    numberItems = level * 6;
                }

                for (int i = 0; i < numberItems; ++i)
                {
                    Item item;

                    if (Core.AOS)
                    {
                        item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
                    }
                    else
                    {
                        item = Loot.RandomArmorOrShieldOrWeapon();
                    }

                    if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(weapon, attributeCount, min, max);
                        }
                        else
                        {
                            weapon.DamageLevel     = (WeaponDamageLevel)Utility.Random(6);
                            weapon.AccuracyLevel   = (WeaponAccuracyLevel)Utility.Random(6);
                            weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(6);
                        }

                        item.ItemValue = GearScore.GetItemValue(item);
                        cont.DropItem(item);
                    }
                    else if (item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max);
                        }
                        else
                        {
                            armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6);
                            armor.Durability      = (ArmorDurabilityLevel)Utility.Random(6);
                        }

                        item.ItemValue = GearScore.GetItemValue(item);
                        cont.DropItem(item);
                    }
                    else if (item is BaseHat)
                    {
                        BaseHat hat = (BaseHat)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(hat, attributeCount, min, max);
                        }

                        item.ItemValue = GearScore.GetItemValue(item);
                        cont.DropItem(item);
                    }
                    else if (item is BaseJewel)
                    {
                        int attributeCount;
                        int min, max;

                        GetRandomAOSStats(out attributeCount, out min, out max);

                        BaseRunicTool.ApplyAttributesTo((BaseJewel)item, attributeCount, min, max);

                        item.ItemValue = GearScore.GetItemValue(item);
                        cont.DropItem(item);
                    }
                }
            }

            int reagents;

            if (level == 0)
            {
                reagents = 12;
            }
            else
            {
                reagents = level * 3;
            }

            for (int i = 0; i < reagents; i++)
            {
                Item item = Loot.RandomPossibleReagent();
                item.Amount = Utility.RandomMinMax(40, 60);
                cont.DropItem(item);
            }

            int gems;

            if (level == 0)
            {
                gems = 2;
            }
            else
            {
                gems = level * 3;
            }

            for (int i = 0; i < gems; i++)
            {
                Item item = Loot.RandomGem();
                cont.DropItem(item);
            }

            int bonus = level * 2;

            if (level > 0 && Utility.Random(100) < 15 + bonus)
            {
                switch (Utility.Random(6))
                {
                case 1: cont.DropItem(BaseReward.FletcherRecipe()); break;

                case 2: cont.DropItem(BaseReward.TailorRecipe()); break;

                case 3: cont.DropItem(BaseReward.SmithRecipe()); break;

                case 4: cont.DropItem(BaseReward.TinkerRecipe()); break;

                case 5: cont.DropItem(BaseReward.CarpRecipe()); break;

                case 6: cont.DropItem(new RecipeScroll(Utility.RandomMinMax(10001, 10001))); break;
                }
            }

            if (level == 6 && Core.AOS)
            {
                cont.DropItem((Item)Activator.CreateInstance(m_Artifacts[Utility.Random(m_Artifacts.Length)]));
            }
        }
コード例 #28
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (!m_Key.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1060640);                       // The item must be in your backpack to use it.
                }
                else if (targeted == m_Key)
                {
                    from.SendMessage("This acid is to dissolve locks and traps on most chests.");
                }
                else if (targeted is BaseHouseDoor)                    // house door check
                {
                    from.SendMessage("This acid is to dissolve locks and traps on most chests.");
                }
                else if (targeted is BookBox)                    // cursed box of books
                {
                    from.SendMessage("This acid can never penetrate the magic of this cursed box.");
                }
                else if (targeted is UnidentifiedArtifact || targeted is UnidentifiedItem || targeted is CurseItem)
                {
                    from.SendMessage("This acid is to dissolve locks and traps on most chests.");
                }
                else if (targeted is BaseDoor)
                {
                    if (Server.Items.DoorType.IsDungeonDoor((BaseDoor)targeted))
                    {
                        if (((BaseDoor)targeted).Locked == false)
                        {
                            from.SendMessage("That does not need to be unlocked.");
                        }

                        else
                        {
                            ((BaseDoor)targeted).Locked = false;
                            Server.Items.DoorType.UnlockDoors((BaseDoor)targeted);
                            from.RevealingAction();
                            from.PlaySound(0x231);
                            if (m_Key.ItemID == 0x1007)
                            {
                                from.AddToBackpack(new Jar());
                            }
                            else
                            {
                                from.AddToBackpack(new Bottle());
                            }
                            m_Key.Consume();
                        }
                    }
                    else
                    {
                        from.SendMessage("That does not need to be unlocked.");
                    }
                }
                else if (targeted is Head)
                {
                    if (((Item)targeted).ItemID == 7584 || ((Item)targeted).ItemID == 7393)
                    {
                        from.RevealingAction();
                        from.PlaySound(0x231);
                        if (m_Key.ItemID == 0x1007)
                        {
                            from.AddToBackpack(new Jar());
                        }
                        else
                        {
                            from.AddToBackpack(new Bottle());
                        }
                        m_Key.Consume();
                        ((Item)targeted).ItemID = 0x1AE0;
                        if ((((Item)targeted).Name).Contains(" head "))
                        {
                            (((Item)targeted).Name) = (((Item)targeted).Name).Replace(" head ", " skull ");
                        }
                        from.SendMessage("The acid melts the skin away, leaving only a skull.");
                    }
                    else
                    {
                        from.SendMessage("Someone already used acid to melt the skin away.");
                    }
                }
                else if (targeted is ILockable)
                {
                    ILockable         o     = (ILockable)targeted;
                    LockableContainer cont2 = (LockableContainer)o;
                    TrapableContainer cont3 = (TrapableContainer)o;

                    if ((o.Locked) || (cont3.TrapType != TrapType.None))
                    {
                        if (o is BaseDoor && !((BaseDoor)o).UseLocks())                            // this seems to check house doors also
                        {
                            from.SendMessage("This acid is to dissolve locks and traps on most chests.");
                        }
                        else if (targeted is TreasureMapChest)
                        {
                            from.SendMessage("The acid seems to have done nothing to the mechanism inside.");
                            m_Key.Consume();
                        }
                        else if (100 >= cont2.RequiredSkill)
                        {
                            o.Locked = false;

                            if (o is LockableContainer)
                            {
                                LockableContainer cont = (LockableContainer)o;
                                if (cont.LockLevel == -255)
                                {
                                    cont.LockLevel = cont.RequiredSkill - 10;
                                    if (cont.LockLevel == 0)
                                    {
                                        cont.LockLevel = -1;
                                    }
                                }

                                cont.Picker = from;                                  // sets "lockpicker" to the user.
                            }

                            if (o is TrapableContainer)
                            {
                                TrapableContainer cont = (TrapableContainer)o;

                                if (cont.TrapType != TrapType.None)
                                {
                                    cont.TrapType = TrapType.None;
                                }
                            }

                            if (targeted is Item)
                            {
                                Item item = (Item)targeted;
                                from.SendMessage("The acid seems to have eaten away at the mechanism inside.");
                            }

                            from.RevealingAction();
                            from.PlaySound(0x231);
                            if (m_Key.ItemID == 0x1007)
                            {
                                from.AddToBackpack(new Jar());
                            }
                            else
                            {
                                from.AddToBackpack(new Bottle());
                            }
                            m_Key.Consume();
                        }
                        else if ((cont3.TrapType != TrapType.None) && (cont3.TrapLevel > 0))
                        {
                            if (o is TrapableContainer)
                            {
                                TrapableContainer cont = (TrapableContainer)o;

                                if (cont.TrapType != TrapType.None)
                                {
                                    cont.TrapType = TrapType.None;
                                }
                            }

                            if (targeted is Item)
                            {
                                Item item = (Item)targeted;
                                from.SendMessage("The acid seems to have eaten away at the mechanism inside.");
                            }

                            from.RevealingAction();
                            from.PlaySound(0x231);
                            if (m_Key.ItemID == 0x1007)
                            {
                                from.AddToBackpack(new Jar());
                            }
                            else
                            {
                                from.AddToBackpack(new Bottle());
                            }
                            m_Key.Consume();
                        }
                        else
                        {
                            from.SendMessage("The acid seems to have done nothing to the mechanism inside.");
                            m_Key.Consume();
                        }
                    }
                    else
                    {
                        from.SendMessage("You don't need to use acid on that.");
                    }
                }
                else
                {
                    from.SendMessage("This acid is to dissolve locks and traps on most chests.");
                }
            }
コード例 #29
0
ファイル: DefTinkering.cs プロジェクト: Godkong/RunUO
        private int Verify( LockableContainer container )
        {
            if (container == null || container.KeyValue == 0)
            {
                From.SendAsciiMessage("You can only trap lockable chests.");
                return 1005638; // You can only trap lockable chests.
            }
            if (From.Map != container.Map || !From.InRange(container.GetWorldLocation(), 2))
            {
                int OldHue = From.SpeechHue;
                From.SpeechHue = 0;
                From.SayTo(From, true, "I can't reach that.");
                From.SpeechHue = OldHue;
                return 500446; // That is too far away.
            }
            if (!container.Movable)
            {
                return 502944; // You cannot trap this item because it is locked down.
            }
            if (!container.IsAccessibleTo(From))
            {
                From.SendAsciiMessage("That belongs to someone else.");
                return 502946; // That belongs to someone else.
            }
            if (container.Locked)
            {
                From.SendAsciiMessage("You can only trap an unlocked object.");
                return 502943; // You can only trap an unlocked object.
            }
            if (container.TrapType != TrapType.None)
            {
                From.SendAsciiMessage("You can only place one trap on an object at a time.");
                return 502945; // You can only place one trap on an object at a time.
            }

            return 0;
        }
コード例 #30
0
ファイル: TreasureMapChest.cs プロジェクト: Ravenwolfe/xrunuo
        public static void Fill( LockableContainer cont, int level, Map map )
        {
            cont.Movable = false;
            cont.Locked = true;

            #region Lock & Trap
            cont.TrapType = TrapType.ExplosionTrap;
            cont.TrapPower = level * 25;
            cont.TrapLevel = level;
            cont.TrapEnabled = true;

            switch ( level )
            {
                case 1:
                    cont.RequiredSkill = 36;
                    break;
                case 2:
                    cont.RequiredSkill = 76;
                    break;
                case 3:
                    cont.RequiredSkill = 84;
                    break;
                case 4:
                    cont.RequiredSkill = 92;
                    break;
                case 5:
                    cont.RequiredSkill = 100;
                    break;
                case 6:
                    cont.RequiredSkill = 100;
                    break;
            }

            cont.LockLevel = cont.RequiredSkill - 10;
            cont.MaxLockLevel = cont.RequiredSkill + 40;
            #endregion

            #region Gold
            cont.DropItem( new Gold( level * 5000 ) );
            #endregion

            #region Reagents
            int reagentStackCount = level + 3;

            for ( int i = 0; i < reagentStackCount; i++ )
            {
                Item item = Loot.RandomPossibleReagent();
                item.Amount = Utility.RandomMinMax( 40, 60 );
                cont.DropItem( item );
            }
            #endregion

            #region Magic Items
            int magicItemCount = 24 + ( 8 * level );

            for ( int i = 0; i < magicItemCount; ++i )
            {
                Item item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();

                if ( item is BaseWeapon )
                {
                    BaseWeapon weapon = (BaseWeapon) item;

                    int attributeCount;
                    int min, max;

                    GetRandomAOSStats( out attributeCount, out min, out max );

                    BaseRunicTool.ApplyAttributesTo( weapon, attributeCount, min, max );

                    cont.DropItem( item );
                }
                else if ( item is BaseArmor )
                {
                    BaseArmor armor = (BaseArmor) item;

                    int attributeCount;
                    int min, max;

                    GetRandomAOSStats( out attributeCount, out min, out max );

                    BaseRunicTool.ApplyAttributesTo( armor, attributeCount, min, max );

                    cont.DropItem( item );
                }
                else if ( item is BaseJewel )
                {
                    int attributeCount;
                    int min, max;

                    GetRandomAOSStats( out attributeCount, out min, out max );

                    BaseRunicTool.ApplyAttributesTo( (BaseJewel) item, attributeCount, min, max );

                    cont.DropItem( item );
                }
            }
            #endregion

            #region Gems
            int gemCount = level * 3;

            for ( int i = 0; i < gemCount; i++ )
            {
                Item item = Loot.RandomGem();
                cont.DropItem( item );
            }
            #endregion

            #region Essences
            if ( level >= 2 )
            {
                int essenceCount = level;

                for ( int i = 0; i < essenceCount; i++ )
                {
                    Item item = Loot.RandomEssence();
                    cont.DropItem( item );
                }
            }
            #endregion

            #region Special loot
            if ( map == Map.Felucca && ( level * 0.15 ) > Utility.RandomDouble() )
            {
                Item item = ScrollOfTranscendence.CreateRandom( 5 );
                cont.DropItem( item );
            }

            if ( ( level * 0.1 ) > Utility.RandomDouble() )
                cont.DropItem( new TastyTreat() );

            if ( ( level * 0.05 ) > Utility.RandomDouble() )
                cont.DropItem( new CreepingVine() );

            if ( ( level * 0.05 ) > Utility.RandomDouble() )
                cont.DropItem( Server.Engines.Quests.BaseReward.RandomRecipe() );

            if ( 0.5 > Utility.RandomDouble() )
                cont.DropItem( new TreasureMap( level < 6 && 0.25 > Utility.RandomDouble() ? level + 1 : level ) );

            if ( 0.25 > Utility.RandomDouble() )
                cont.DropItem( new SkeletonKey() );

            if ( 0.2 > Utility.RandomDouble() )
                cont.DropItem( ScrollOfAlacrity.CreateRandom() );

            if ( 0.2 > Utility.RandomDouble() )
                cont.DropItem( new MessageInABottle() );

            if ( level >= 5 )
            {
                if ( 0.1 > Utility.RandomDouble() )
                    cont.DropItem( new ForgedPardon() );

                if ( 0.09 > Utility.RandomDouble() )
                    cont.DropItem( new ManaPhasingOrb() );

                if ( 0.09 > Utility.RandomDouble() )
                    cont.DropItem( new RunedSashOfWarding() );

                if ( 0.09 > Utility.RandomDouble() )
                    cont.DropItem( map == Map.TerMur ? new GargishSurgeShield() : new SurgeShield() );
            }
            #endregion

            #region Artifacts
            if ( level >= 6 )
            {
                Item item = (Item) Activator.CreateInstance( m_Artifacts[Utility.Random( m_Artifacts.Length )] );
                cont.DropItem( item );
            }
            #endregion
        }
コード例 #31
0
		private static void PackScroll( LockableContainer cont, int minCircle, int maxCircle )
		{
			PackScroll( cont, Utility.RandomMinMax( minCircle, maxCircle ) );
		}
コード例 #32
0
        public static void Fill( LockableContainer cont, int level )
        {
            cont.Movable = false;
            cont.Locked = true;

            if ( level == 0 )
            {
                cont.LockLevel = 0; // Can't be unlocked

                cont.DropItem( new Gold( Utility.RandomMinMax( 50, 100 ) ) );

            }
            else
            {
                cont.TrapType = TrapType.ExplosionTrap;
                cont.TrapPower = level * 25;
                cont.TrapLevel = level;

                switch ( level )
                {
                    case 1: cont.RequiredSkill = 36; break;
                    case 2: cont.RequiredSkill = 76; break;
                    case 3: cont.RequiredSkill = 84; break;
                    case 4: cont.RequiredSkill = 92; break;
                    case 5: cont.RequiredSkill = 100; break;
                    case 6: cont.RequiredSkill = 100; break;
                }

                cont.LockLevel = cont.RequiredSkill - 10;
                cont.MaxLockLevel = cont.RequiredSkill + 40;

                cont.DropItem( new Gold( level * 3000 ) );

            //Adding in a 10% chance for the same level map as your doing to spawn in the chest

                if ( 0.1 >= Utility.RandomDouble() && level == 1 )
                {
                    cont.DropItem( new TreasureMap( 1, Map.Felucca ) );
                }
                else if ( 0.1 >= Utility.RandomDouble() && level == 2 )
                {
                    cont.DropItem( new TreasureMap( 2, Map.Felucca ) );
                }
                else if ( 0.1 >= Utility.RandomDouble() && level == 3 )
                {
                    cont.DropItem( new TreasureMap( 3, Map.Felucca ) );
                }
                else if ( 0.1 >= Utility.RandomDouble() && level == 4 )
                {
                    cont.DropItem( new TreasureMap( 4, Map.Felucca ) );
                }
                else if ( 0.1 >= Utility.RandomDouble() && level == 5 )
                {
                    cont.DropItem( new TreasureMap( 5, Map.Felucca ) );
                }
                else if ( 0.1 >= Utility.RandomDouble() && level == 6 )
                {
                    cont.DropItem( new TreasureMap( 6, Map.Felucca ) );
                }
                else
                {
                }
            //end of add
                for ( int i = 0; i < level * 5; ++i )
                    cont.DropItem( Loot.RandomScroll( 0, 63, SpellbookType.Regular ) );

                for ( int i = 0; i < level * 6; ++i )
                {
                    Item item;

                    if ( Core.AOS )
                        item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
                    else
                        item = Loot.RandomArmorOrShieldOrWeapon();

                    if ( item is BaseWeapon )
                    {
                        BaseWeapon weapon = (BaseWeapon)item;

            //						if ( Core.AOS )
            //						{
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats( out attributeCount, out min, out max );

                            BaseRunicTool.ApplyAttributesTo( weapon, attributeCount, min, max );
            //						}
            //						else
            //						{
            //							weapon.DamageLevel = (WeaponDamageLevel)Utility.Random( 6 );
            //							weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random( 6 );
            //							weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random( 6 );
            //						}

                        cont.DropItem( item );
                    }
                    else if ( item is BaseArmor )
                    {
                        BaseArmor armor = (BaseArmor)item;

            //						if ( Core.AOS )
            //						{
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats( out attributeCount, out min, out max );

                            BaseRunicTool.ApplyAttributesTo( armor, attributeCount, min, max );
            //						}
            //						else
            //						{
            //							armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random( 6 );
            //							armor.Durability = (ArmorDurabilityLevel)Utility.Random( 6 );
            //						}

                        cont.DropItem( item );
                    }
                    else if( item is BaseHat )
                    {
                        BaseHat hat = (BaseHat)item;

                        if( Core.AOS )
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats( out attributeCount, out min, out  max );

                            BaseRunicTool.ApplyAttributesTo( hat, attributeCount, min, max );
                        }

                        cont.DropItem( item );
                    }
                    else if( item is BaseJewel )
                    {
                        int attributeCount;
                        int min, max;

                        GetRandomAOSStats( out attributeCount, out min, out max );

                        BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, attributeCount, min, max );

                        cont.DropItem( item );
                    }
                }
            }

            int reagents;
            if ( level == 0 )
                reagents = 12;
            else
                reagents = level * 3;

            for ( int i = 0; i < reagents; i++ )
            {
                Item item = Loot.RandomPossibleReagent();
                item.Amount = Utility.RandomMinMax( 80, 100 );
                cont.DropItem( item );
            }

            int gems;
            if ( level == 0 )
                gems = 2;
            else
                gems = level * 5;

            for ( int i = 0; i < gems; i++ )
            {
                Item item = Loot.RandomGem();
                cont.DropItem( item );
            }

            if ( level == 6 && Core.AOS )
                cont.DropItem( (Item)Activator.CreateInstance( m_Artifacts[Utility.Random(m_Artifacts.Length)] ) );
        }
コード例 #33
0
ファイル: KeyRing.cs プロジェクト: zerodowned/angelisland
            protected override void OnTarget(Mobile from, object targeted)
            {
                int number;

                if (targeted == m_KeyRing)
                {
                    number = -1;
                    //remove keys from keyring
                    Item[] keys = m_KeyRing.FindItemsByType(typeof(Key));
                    foreach (Item i in keys)
                    {
                        if (i is Key)                          //doublecheck!
                        {
                            if (from is PlayerMobile)
                            {
                                Container b = ((PlayerMobile)from).Backpack;
                                if (b != null)
                                {
                                    b.DropItem(i);
                                    i.Movable = true;
                                }
                            }
                        }
                    }
                    m_KeyRing.UpdateItemID();
                    from.SendMessage("You remove all the keys.");
                }
                else if (targeted is ILockable)
                {
                    number = -1;

                    ILockable o = (ILockable)targeted;

                    if (m_KeyRing.IsKeyOnRing(o.KeyValue) && o.KeyValue != 0)
                    {
                        if (o is BaseDoor && !((BaseDoor)o).UseLocks())
                        {
                            number = 501668;                             // This key doesn't seem to unlock that.
                        }
                        else if (o is BaseDoor && !(m_KeyRing.IsChildOf(from.Backpack)))
                        {
                            from.SendLocalizedMessage(1042001);                               // That must be in your pack for you to use it.
                        }
                        else
                        {
                            if (o is BaseHouseDoor)
                            {
                                BaseHouse home;
                                home = ((BaseHouseDoor)o).FindHouse();

                                /*if (home.Public == true)
                                 * {
                                 *      if (o.Locked != true)
                                 *      from.SendMessage("You cannot lock a public house.");
                                 *      o.Locked = false;
                                 *      return;
                                 * }*/
                            }

                            o.Locked = !o.Locked;

                            if (o is LockableContainer)
                            {
                                LockableContainer cont = (LockableContainer)o;

                                if (cont.TinkerMadeTrap)
                                {
                                    if (cont.TrapType != TrapType.None)
                                    {
                                        if (cont.TrapEnabled)
                                        {
                                            from.SendMessage("You leave the trap enabled.");
                                        }
                                        else
                                        {
                                            from.SendMessage("You leave the trap disabled.");
                                        }
                                    }
                                }

                                if (cont.LockLevel == -255)
                                {
                                    cont.LockLevel = cont.RequiredSkill - 10;
                                }
                            }

                            if (targeted is Item)
                            {
                                Item item = (Item)targeted;

                                if (o.Locked)
                                {
                                    item.SendLocalizedMessageTo(from, 1048000);
                                }
                                else
                                {
                                    item.SendLocalizedMessageTo(from, 1048001);
                                }
                            }
                        }
                    }
                    else
                    {
                        number = 501668;                         // This key doesn't seem to unlock that.
                    }
                }
                else
                {
                    number = 501666;                     // You can't unlock that!
                }

                if (number != -1)
                {
                    from.SendLocalizedMessage(number);
                }
            }
コード例 #34
0
		public void CalculatePoisonType(Mobile from, LockableContainer cont)
		{
			if (from == null || cont == null)
				return;

			int p;
			double skillvalue = from.Skills.Tinkering.Base;

			if ( skillvalue < 70.0 )
			{
				cont.TrapLevel = 2; //Regular Poison
				cont.TrapPower = 50;
			}
			else if ( skillvalue < 80.0 )
			{
				cont.TrapLevel = 3; //Greater Poison
				cont.TrapPower = 70;
			}
			else //if (skillvalue < 90)
			{
				cont.TrapLevel = 4; //Deadly Poison
				cont.TrapPower = 85;
			}

			if ( cont.TrapLevel < 4 )
			{
				if ( skillvalue >= Utility.RandomDouble() )
				{
					cont.TrapLevel += 1;
					cont.TrapPower = 100;
				}
			}
			else if ( skillvalue >= Utility.RandomDouble() )
				cont.TrapPower = 100;

			return;
		}
コード例 #35
0
        public static void Fill(LockableContainer cont, int level)
        {
            cont.Movable = false;
            cont.Locked  = true;
            int numberItems;

            if (level == 0)
            {
                cont.LockLevel = 0;                 // Can't be unlocked
            }
            else
            {
                cont.TrapType  = TrapType.ExplosionTrap;
                cont.TrapPower = level * 25;
                cont.TrapLevel = level;

                switch (level)
                {
                case 1: cont.RequiredSkill = 36; break;

                case 2: cont.RequiredSkill = 76; break;

                case 3: cont.RequiredSkill = 84; break;

                case 4: cont.RequiredSkill = 92; break;

                case 5: cont.RequiredSkill = 100; break;

                case 6: cont.RequiredSkill = 100; break;
                }

                cont.LockLevel    = cont.RequiredSkill - 10;
                cont.MaxLockLevel = cont.RequiredSkill + 40;

                if (Utility.RandomBool())
                {
                    cont.DropItem(new Gold(Utility.RandomMinMax(level * 10, (level * 10) + 10)));

                    int gems = level * 2;

                    for (int i = 0; i < gems; i++)
                    {
                        Item item = Loot.RandomGem();
                        cont.DropItem(item);
                    }
                }
                else
                {
                    numberItems = level * 3;

                    for (int i = 0; i < numberItems; ++i)
                    {
                        cont.DropItem(Loot.RandomArmorOrShieldOrWeaponOrJewelry());
                    }

                    int reagents = 6;

                    for (int i = 0; i < reagents; i++)
                    {
                        Item item = Loot.RandomPossibleReagent();
                        item.Amount = Utility.RandomMinMax(level + 1, (level + 1) * 3);
                        cont.DropItem(item);
                    }
                }
            }
        }
コード例 #36
0
		private bool Acquire( object target, out int message )
		{
			LockableContainer container = target as LockableContainer;

			message = Verify( container );

			if ( message > 0 )
			{
				return false;
			}
			else
			{
				m_Container = container;
				return true;
			}
		}
コード例 #37
0
		//override fill function to keep fishing and other scripts useing old fill function not needing updated.
		public static void Fill( LockableContainer cont, int level)
		{
			Fill( cont, level, false, ChestThemeType.None);
		}
コード例 #38
0
        public static void Fill(LockableContainer cont, int level)
        {
            cont.Movable = false;
            cont.Locked  = true;
            int numberItems;

            if (level == 0)
            {
                cont.LockLevel = 0;                 // Can't be unlocked

                cont.DropItem(new Gold(Utility.RandomMinMax(50, 100)));

                if (Utility.RandomDouble() < 0.75)
                {
                    cont.DropItem(new TreasureMap(0, Map.Felucca));
                }
            }
            else
            {
                cont.TrapType  = TrapType.ExplosionTrap;
                cont.TrapPower = level * 25;
                cont.TrapLevel = level;

                switch (level)
                {
                case 1: cont.RequiredSkill = 36; break;

                case 2: cont.RequiredSkill = 76; break;

                case 3: cont.RequiredSkill = 84; break;

                case 4: cont.RequiredSkill = 92; break;

                case 5: cont.RequiredSkill = 100; break;

                case 6: cont.RequiredSkill = 100; break;
                }

                cont.LockLevel    = cont.RequiredSkill - 10;
                cont.MaxLockLevel = cont.RequiredSkill + 40;

                //Publish 67 gold change
                //if ( Core.SA )
                //	cont.DropItem( new Gold( level * 5000 ) );
                //else
                cont.DropItem(new Gold(level * 1000));

                for (int i = 0; i < level * 5; ++i)
                {
                    cont.DropItem(Loot.RandomScroll(0, 63, SpellbookType.Regular));
                }

                numberItems = level * 6;

                for (int i = 0; i < numberItems; ++i)
                {
                    Item item = Loot.RandomArmorOrShieldOrWeapon();

                    if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;

                        weapon.DamageLevel     = (WeaponDamageLevel)Utility.Random(6);
                        weapon.AccuracyLevel   = (WeaponAccuracyLevel)Utility.Random(6);
                        weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(6);

                        cont.DropItem(item);
                    }
                    else if (item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)item;

                        armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6);
                        armor.Durability      = (ArmorDurabilityLevel)Utility.Random(6);

                        cont.DropItem(item);
                    }
                    else if (item is BaseHat)
                    {
                        BaseHat hat = (BaseHat)item;

                        cont.DropItem(item);
                    }
                    else if (item is BaseJewel)
                    {
                        int attributeCount;
                        int min, max;

                        GetRandomAOSStats(out attributeCount, out min, out max);

                        BaseRunicTool.ApplyAttributesTo(attributeCount);

                        cont.DropItem(item);
                    }
                }
            }

            int reagents;

            if (level == 0)
            {
                reagents = 12;
            }
            else
            {
                reagents = level * 3;
            }

            for (int i = 0; i < reagents; i++)
            {
                Item item = Loot.RandomPossibleReagent();
                item.Amount = Utility.RandomMinMax(40, 60);
                cont.DropItem(item);
            }

            int gems;

            if (level == 0)
            {
                gems = 2;
            }
            else
            {
                gems = level * 3;
            }

            for (int i = 0; i < gems; i++)
            {
                Item item = Loot.RandomGem();
                cont.DropItem(item);
            }
        }
コード例 #39
0
		public static void Fill(LockableContainer cont, int level, Expansion e)
		{
			cont.Movable = false;
			cont.Locked = true;
			int numberItems;

			if (level == 0)
			{
				cont.LockLevel = 0; // Can't be unlocked

				cont.DropItem(new Gold(Utility.RandomMinMax(25, 50))); // reduced from 50 100

				if (Utility.RandomDouble() < 0.75)
				{
					cont.DropItem(new TreasureMap(0, Map.Felucca));
				}
			}
			else
			{
				cont.TrapType = TrapType.ExplosionTrap;
				cont.TrapPower = level * 25;
				cont.TrapLevel = level;

				switch (level)
				{
					case 1:
						cont.RequiredSkill = 36;
						break;
					case 2:
						cont.RequiredSkill = 76;
						break;
					case 3:
						cont.RequiredSkill = 84;
						break;
					case 4:
						cont.RequiredSkill = 92;
						break;
					case 5:
						cont.RequiredSkill = 95;
						break;
					case 6:
						cont.RequiredSkill = 95;
						break;
				}

				cont.LockLevel = cont.RequiredSkill - 10;
				cont.MaxLockLevel = cont.RequiredSkill + 40;

				cont.DropItem(new Gold(level * 1000, level * 2000));

				for (int i = 0; i < level * 5; ++i)
				{
					cont.DropItem(Loot.RandomScroll(0, 63, SpellbookType.Regular));
				}

				if (e >= Expansion.SE)
				{
					switch (level)
					{
						case 1:
							numberItems = 2;
							break;
						case 2:
							numberItems = 4;
							break;
						case 3:
							numberItems = 7;
							break;
						case 4:
							numberItems = 10;
							break;
						case 5:
							numberItems = 20;
							break;
						case 6:
							numberItems = 30;
							break;
						default:
							numberItems = 0;
							break;
					}
				}
				else
				{
					numberItems = level * 6;
				}

				for (int i = 0; i < numberItems; ++i)
				{
					Item item = Loot.RandomArmorOrShieldOrWeapon();

					if (item is BaseWeapon)
					{
						var weapon = (BaseWeapon)item;

						int damageLevel = PseudoSeerStone.GetDamageLevel(level);

						if (PseudoSeerStone.HighestDamageLevelSpawn < damageLevel)
						{
							if (damageLevel == 5 && PseudoSeerStone.ReplaceVanqWithSkillScrolls)
							{
								cont.DropItem(PuzzleChest.CreateRandomSkillScroll());
							}

							int platAmount = PseudoSeerStone.PlatinumPerMissedDamageLevel *
											 (damageLevel - PseudoSeerStone.Instance._HighestDamageLevelSpawn);
							
							if (platAmount > 0)
							{
								cont.DropItem(new Platinum(platAmount));
							}

							damageLevel = PseudoSeerStone.Instance._HighestDamageLevelSpawn;
						}

						weapon.DamageLevel = (WeaponDamageLevel)damageLevel;
						weapon.DurabilityLevel = (WeaponDurabilityLevel)PseudoSeerStone.GetDurabilityLevel(level);
						weapon.AccuracyLevel = (WeaponAccuracyLevel)PseudoSeerStone.GetAccuracyLevel(level);

						if (0.02 * level >= Utility.RandomDouble())
						{
							weapon.Slayer = (SlayerName)Utility.Random(28);
						}

						cont.DropItem(item);
					}
					else if (item is BaseArmor)
					{
						var armor = (BaseArmor)item;

						armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6);
						armor.Durability = (ArmorDurabilityLevel)Utility.Random(6);

						cont.DropItem(item);
					}
					else if (item is BaseHat || item is BaseJewel)
					{
						cont.DropItem(item);
					}
				}
			}

			int reagents;

			if (level == 0)
			{
				reagents = 12;
			}
			else
			{
				reagents = level * 3;
			}

			for (int i = 0; i < reagents; i++)
			{
				Item item = Loot.RandomPossibleReagent(e);
				item.Amount = Utility.RandomMinMax(40, 60);
				cont.DropItem(item);
			}

			int gems;

			if (level == 0)
			{
				gems = 2;
			}
			else
			{
				gems = level * 3;
			}

			for (int i = 0; i < gems; i++)
			{
				Item item = Loot.RandomGem();
				cont.DropItem(item);
			}

			if (level == 6 && cont.EraAOS)
			{
				cont.DropItem((Item)Activator.CreateInstance(m_Artifacts[Utility.Random(m_Artifacts.Length)]));
			}
		}
コード例 #40
0
		public static void PackMagicItem( LockableContainer cont, int minLevel, int maxLevel, double chance )
		{
			if (chance <= Utility.RandomDouble())
				return;

			Item item = Loot.RandomClothingOrJewelry();

			if ( item == null )
				return;

			if ( item is BaseClothing )
				((BaseClothing)item).SetRandomMagicEffect( minLevel, maxLevel );
			else if ( item is BaseJewel )
				((BaseJewel)item).SetRandomMagicEffect( minLevel, maxLevel );

			cont.DropItem( item );
		}
コード例 #41
0
ファイル: TreasureMapChest.cs プロジェクト: mcarriere/ServUO
        public static void Fill(LockableContainer cont, int luck, int level, bool isSos)
        {
			// Apply Felucca luck bonus
			if (cont.Map == Map.Felucca)
				luck += Mobiles.RandomItemGenerator.FeluccaLuckBonus;

            cont.Movable = false;
            cont.Locked = true;
            int numberItems;

            if (level == 0)
            {
                cont.LockLevel = 0; // Can't be unlocked

                cont.DropItem(new Gold(Utility.RandomMinMax(50, 100)));

                if (Utility.RandomDouble() < 0.75)
                    cont.DropItem(new TreasureMap(0, Map.Trammel));
            }
            else
            {
                cont.TrapType = TrapType.ExplosionTrap;
                cont.TrapPower = level * 25;
                cont.TrapLevel = level;

                switch (level)
                {
                    case 1:
                        cont.RequiredSkill = 5;
                        break;
                    case 2:
                        cont.RequiredSkill = 45;
                        break;
                    case 3:
                        cont.RequiredSkill = 65;
                        break;
                    case 4:
                        cont.RequiredSkill = 75;
                        break;
                    case 5:
                        cont.RequiredSkill = 75;
                        break;
                    case 6:
                        cont.RequiredSkill = 80;
                        break;
					case 7:
                        cont.RequiredSkill = 80;
                        break;
                }

                cont.LockLevel = cont.RequiredSkill - 10;
                cont.MaxLockLevel = cont.RequiredSkill + 40;

                cont.DropItem(new Gold(level * 5000));

                for (int i = 0; i < level * 5; ++i)
                    cont.DropItem(Loot.RandomScroll(0, 63, SpellbookType.Regular));

				double propsScale = 1.0;
                if (Core.SE)
                {
                    switch (level)
                    {
                        case 1:
                            numberItems = 32;
							propsScale = 0.5625;
                            break;
                        case 2:
                            numberItems = 40;
							propsScale = 0.6875;
                            break;
                        case 3:
                            numberItems = 48;
							propsScale = 0.875;
                            break;
                        case 4:
                            numberItems = 56;
                            break;
                        case 5:
                            numberItems = 64;
                            break;
                        case 6:
                            numberItems = 72;
                            break;
                        case 7:
                            numberItems = 80;
                            break;
                        default:
                            numberItems = 0;
                            break;
                    }
                }
                else
                    numberItems = level * 6;

                for (int i = 0; i < numberItems; ++i)
                {
                    Item item;

                    if (Core.AOS)
                        item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
                    else
                        item = Loot.RandomArmorOrShieldOrWeapon();

                    if (item != null && Core.HS && RandomItemGenerator.Enabled)
                    {
                        int min, max;
                        GetRandomItemStat(out min, out max, propsScale);

                        RunicReforging.GenerateRandomItem(item, LootPack.GetLuckChance(luck), min, max);

                        cont.DropItem(item);
                    }
                    else if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(weapon, attributeCount, min, max);
                        }
                        else
                        {
                            weapon.DamageLevel = (WeaponDamageLevel)Utility.Random(6);
                            weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random(6);
                            weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(6);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max);
                        }
                        else
                        {
                            armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6);
                            armor.Durability = (ArmorDurabilityLevel)Utility.Random(6);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseHat)
                    {
                        BaseHat hat = (BaseHat)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(hat, attributeCount, min, max);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseJewel)
                    {
                        int attributeCount;
                        int min, max;

                        GetRandomAOSStats(out attributeCount, out min, out max);

                        BaseRunicTool.ApplyAttributesTo((BaseJewel)item, attributeCount, min, max);

                        cont.DropItem(item);
                    }
                }
            }

            int reagents;
            if (level == 0)
                reagents = 12;
            else
                reagents = level + 1;

            for (int i = 0; i < reagents; i++)
            {
                Item item = Loot.RandomPossibleReagent();
                item.Amount = Utility.RandomMinMax(40, 60);
                cont.DropItem(item);
            }

            int gems;
            if (level == 0)
                gems = 2;
            else
                gems = (level * 3) + 1;

            for (int i = 0; i < gems; i++)
            {
                Item item = Loot.RandomGem();
                cont.DropItem(item);
            }

            if (level > 1)
            {
                Item item = Loot.Construct(m_ImbuingIngreds[Utility.Random(m_ImbuingIngreds.Length)]);

                item.Amount = level;
                cont.DropItem(item);
            }

            Item arty = null;
            Item special = null;

            if (isSos)
            {
                if (0.004 * level > Utility.RandomDouble())
                    arty = Loot.Construct(m_SOSArtifacts);
                if (0.006 * level > Utility.RandomDouble())
                    special = Loot.Construct(m_SOSDecor);
                else if (0.009 * level > Utility.RandomDouble())
                    special = new TreasureMap(Utility.RandomMinMax(level, Math.Min(7, level + 1)), cont.Map);

            }
            else
            {
                if (level >= 7)
                {
                    if (0.025 > Utility.RandomDouble())
                        special = Loot.Construct(m_LevelSevenOnly);
                    else if (0.10 > Utility.RandomDouble())
                        special = Loot.Construct(m_LevelFiveToSeven);
                    else if (0.25 > Utility.RandomDouble())
                        special = GetRandomSpecial(level, cont.Map);

                    arty = Loot.Construct(m_Artifacts);
                }
                else if (level >= 6)
                {
                    if (0.025 > Utility.RandomDouble())
                        special = Loot.Construct(m_LevelFiveToSeven);
                    else if (0.10 > Utility.RandomDouble())
                        special = GetRandomSpecial(level, cont.Map);

                    arty = Loot.Construct(m_Artifacts);
                }
                else if (level >= 5)
                {
                    if (0.05 > Utility.RandomDouble())
                        special = Loot.Construct(m_LevelFiveToSeven);
                    else if (0.25 > Utility.RandomDouble())
                        special = GetRandomSpecial(level, cont.Map);
                }
                else if (.10 > Utility.RandomDouble())
                {
                    special = GetRandomSpecial(level, cont.Map);
                }
            }

            if (arty != null)
            {
                Container pack = new Backpack();
                pack.Hue = 1278;

                pack.DropItem(arty);
                cont.DropItem(pack);
            }

            if (special != null)
                cont.DropItem(special);
        }
コード例 #42
0
 public static void Fill(LockableContainer cont, int level)
 {
 }
コード例 #43
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (!m_Key.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1060640);                       // The item must be in your backpack to use it.
                }
                else if (targeted == m_Key)
                {
                    from.SendMessage("This torch is to melt locks and traps on most chests.");
                }
                else if (targeted is BaseHouseDoor)                    // house door check
                {
                    from.SendMessage("This torch is to melt locks and traps on most chests.");
                }
                else if (targeted is BookBox)                    // cursed box of books
                {
                    from.SendMessage("This torch can never penetrate the magic of this cursed box.");
                }
                else if (targeted is UnidentifiedArtifact || targeted is UnidentifiedItem || targeted is CurseItem)
                {
                    from.SendMessage("This torch is to melt locks and traps on most chests.");
                }
                else if (targeted is BaseDoor)
                {
                    if (Server.Items.DoorType.IsDungeonDoor((BaseDoor)targeted))
                    {
                        if (((BaseDoor)targeted).Locked == false)
                        {
                            from.SendMessage("That does not need to be unlocked.");
                        }

                        else
                        {
                            ((BaseDoor)targeted).Locked = false;
                            Server.Items.DoorType.UnlockDoors((BaseDoor)targeted);
                            from.RevealingAction();
                            from.PlaySound(0x227);
                            m_Key.Consume();
                        }
                    }
                    else
                    {
                        from.SendMessage("That does not need to be unlocked.");
                    }
                }
                else if (targeted is ILockable)
                {
                    ILockable         o     = (ILockable)targeted;
                    LockableContainer cont2 = (LockableContainer)o;
                    TrapableContainer cont3 = (TrapableContainer)o;

                    if ((o.Locked) || (cont3.TrapType != TrapType.None))
                    {
                        if (o is BaseDoor && !((BaseDoor)o).UseLocks())                            // this seems to check house doors also
                        {
                            from.SendMessage("This torch is to melt locks and traps on most chests.");
                        }
                        else if (targeted is TreasureMapChest)
                        {
                            from.SendMessage("The torch seems to have done nothing to the mechanism inside.");
                            m_Key.Consume();
                        }
                        else if (100 >= cont2.RequiredSkill)
                        {
                            o.Locked = false;

                            if (o is LockableContainer)
                            {
                                LockableContainer cont = (LockableContainer)o;
                                if (cont.LockLevel == -255)
                                {
                                    cont.LockLevel = cont.RequiredSkill - 10;
                                    if (cont.LockLevel == 0)
                                    {
                                        cont.LockLevel = -1;
                                    }
                                }

                                cont.Picker = from;                                  // sets "lockpicker" to the user.
                            }

                            if (o is TrapableContainer)
                            {
                                TrapableContainer cont = (TrapableContainer)o;

                                if (cont.TrapType != TrapType.None)
                                {
                                    cont.TrapType = TrapType.None;
                                }
                            }

                            if (targeted is Item)
                            {
                                Item item = (Item)targeted;
                                from.SendMessage("The torch seems to have melted the mechanism inside.");
                            }

                            from.RevealingAction();
                            from.PlaySound(0x227);
                            m_Key.Consume();
                        }
                        else if ((cont3.TrapType != TrapType.None) && (cont3.TrapLevel > 0))
                        {
                            if (o is TrapableContainer)
                            {
                                TrapableContainer cont = (TrapableContainer)o;

                                if (cont.TrapType != TrapType.None)
                                {
                                    cont.TrapType = TrapType.None;
                                }
                            }

                            if (targeted is Item)
                            {
                                Item item = (Item)targeted;
                                from.SendMessage("The torch seems to have melted the mechanism inside.");
                            }

                            from.RevealingAction();
                            from.PlaySound(0x227);
                            m_Key.Consume();
                        }
                        else
                        {
                            from.SendMessage("The torch seems to have done nothing to the mechanism inside.");
                            m_Key.Consume();
                        }
                    }
                    else
                    {
                        from.SendMessage("You don't need to use torch on that.");
                    }
                }
                else
                {
                    from.SendMessage("This torch is to melt locks and traps on most chests.");
                }
            }
コード例 #44
0
 public ContainerRelockTimer(LockableContainer target)
     : base(TimeSpan.FromSeconds(60))
 {
     this.target = target;
 }
コード例 #45
0
        public static void Fill(Mobile from, LockableContainer cont, int level, bool isSos)
        {
            var map  = from.Map;
            var luck = from is PlayerMobile ? ((PlayerMobile)from).RealLuck : from.Luck;

            cont.Movable = false;
            cont.Locked  = true;
            int count;

            if (level == 0)
            {
                cont.LockLevel = 0; // Can't be unlocked

                cont.DropItem(new Gold(Utility.RandomMinMax(50, 100)));

                if (Utility.RandomDouble() < 0.75)
                {
                    cont.DropItem(new TreasureMap(0, Map.Trammel));
                }
            }
            else
            {
                cont.TrapType  = TrapType.ExplosionTrap;
                cont.TrapPower = level * 25;
                cont.TrapLevel = level;

                switch (level)
                {
                case 1:
                    cont.RequiredSkill = 5;
                    break;

                case 2:
                    cont.RequiredSkill = 45;
                    break;

                case 3:
                    cont.RequiredSkill = 65;
                    break;

                case 4:
                    cont.RequiredSkill = 75;
                    break;

                case 5:
                    cont.RequiredSkill = 75;
                    break;

                case 6:
                    cont.RequiredSkill = 80;
                    break;

                case 7:
                    cont.RequiredSkill = 80;
                    break;
                }

                cont.LockLevel    = cont.RequiredSkill - 10;
                cont.MaxLockLevel = cont.RequiredSkill + 40;

                #region Gold
                cont.DropItem(new Gold(isSos ? level * 10000 : level * 5000));
                #endregion

                #region Scrolls
                if (isSos)
                {
                    switch (level)
                    {
                    default: count = 20; break;

                    case 0:
                    case 1: count = Utility.RandomMinMax(2, 5); break;

                    case 2: count = Utility.RandomMinMax(10, 15); break;
                    }
                }
                else
                {
                    count = level * 5;
                }

                for (int i = 0; i < count; ++i)
                {
                    cont.DropItem(Loot.RandomScroll(0, 63, SpellbookType.Regular));
                }
                #endregion

                #region Magical Items
                double propsScale = 1.0;

                switch (level)
                {
                case 1:
                    count      = isSos ? Utility.RandomMinMax(2, 6) : 32;
                    propsScale = 0.5625;
                    break;

                case 2:
                    count      = isSos ? Utility.RandomMinMax(10, 15) : 40;
                    propsScale = 0.6875;
                    break;

                case 3:
                    count      = isSos ? Utility.RandomMinMax(15, 20) : 48;
                    propsScale = 0.875;
                    break;

                case 4:
                    count = isSos ? Utility.RandomMinMax(15, 20) : 56;
                    break;

                case 5:
                    count = isSos ? Utility.RandomMinMax(15, 20) : 64;
                    break;

                case 6:
                    count = isSos ? Utility.RandomMinMax(15, 20) : 72;
                    break;

                case 7:
                    count = isSos ? Utility.RandomMinMax(15, 20) : 80;
                    break;

                default:
                    count = 0;
                    break;
                }

                for (int i = 0; i < count; ++i)
                {
                    Item item;

                    item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();

                    if (item != null && RandomItemGenerator.Enabled)
                    {
                        int min, max;
                        GetRandomItemStat(out min, out max, propsScale);

                        RunicReforging.GenerateRandomItem(item, luck, min, max, map);

                        cont.DropItem(item);
                    }
                    else if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;

                        int attributeCount;
                        int min, max;

                        GetRandomAOSStats(out attributeCount, out min, out max);

                        BaseRunicTool.ApplyAttributesTo(weapon, attributeCount, min, max);

                        cont.DropItem(item);
                    }
                    else if (item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)item;

                        int attributeCount;
                        int min, max;

                        GetRandomAOSStats(out attributeCount, out min, out max);

                        BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max);

                        cont.DropItem(item);
                    }
                    else if (item is BaseHat)
                    {
                        BaseHat hat = (BaseHat)item;

                        int attributeCount;
                        int min, max;

                        GetRandomAOSStats(out attributeCount, out min, out max);

                        BaseRunicTool.ApplyAttributesTo(hat, attributeCount, min, max);

                        cont.DropItem(item);
                    }
                    else if (item is BaseJewel)
                    {
                        int attributeCount;
                        int min, max;

                        GetRandomAOSStats(out attributeCount, out min, out max);

                        BaseRunicTool.ApplyAttributesTo((BaseJewel)item, attributeCount, min, max);

                        cont.DropItem(item);
                    }
                }
            }
            #endregion

            #region Reagents
            if (isSos)
            {
                switch (level)
                {
                default: count = Utility.RandomMinMax(45, 60); break;

                case 0:
                case 1: count = Utility.RandomMinMax(15, 20); break;

                case 2: count = Utility.RandomMinMax(25, 40); break;
                }
            }
            else
            {
                count = level == 0 ? 12 : Utility.RandomMinMax(40, 60) * (level + 1);
            }

            for (int i = 0; i < count; i++)
            {
                cont.DropItemStacked(Loot.RandomPossibleReagent());
            }
            #endregion

            #region Gems
            if (level == 0)
            {
                count = 2;
            }
            else
            {
                count = (level * 3) + 1;
            }

            for (int i = 0; i < count; i++)
            {
                cont.DropItem(Loot.RandomGem());
            }
            #endregion

            #region Imbuing Ingreds
            if (level > 1)
            {
                Item item = Loot.Construct(m_ImbuingIngreds[Utility.Random(m_ImbuingIngreds.Length)]);

                item.Amount = level;
                cont.DropItem(item);
            }
            #endregion

            Item arty    = null;
            Item special = null;

            if (isSos)
            {
                if (0.004 * level > Utility.RandomDouble())
                {
                    arty = Loot.Construct(m_SOSArtifacts);
                }
                if (0.006 * level > Utility.RandomDouble())
                {
                    special = Loot.Construct(m_SOSDecor);
                }
                else if (0.009 * level > Utility.RandomDouble())
                {
                    special = new TreasureMap(Utility.RandomMinMax(level, Math.Min(7, level + 1)), cont.Map);
                }
            }
            else
            {
                if (level >= 7)
                {
                    if (0.025 > Utility.RandomDouble())
                    {
                        special = Loot.Construct(m_LevelSevenOnly);
                    }
                    else if (0.10 > Utility.RandomDouble())
                    {
                        special = Loot.Construct(m_LevelFiveToSeven);
                    }
                    else if (0.25 > Utility.RandomDouble())
                    {
                        special = GetRandomSpecial(level, cont.Map);
                    }

                    arty = Loot.Construct(m_Artifacts);
                }
                else if (level >= 6)
                {
                    if (0.025 > Utility.RandomDouble())
                    {
                        special = Loot.Construct(m_LevelFiveToSeven);
                    }
                    else if (0.20 > Utility.RandomDouble())
                    {
                        special = GetRandomSpecial(level, cont.Map);
                    }

                    arty = Loot.Construct(m_Artifacts);
                }
                else if (level >= 5)
                {
                    if (0.005 > Utility.RandomDouble())
                    {
                        special = Loot.Construct(m_LevelFiveToSeven);
                    }
                    else if (0.15 > Utility.RandomDouble())
                    {
                        special = GetRandomSpecial(level, cont.Map);
                    }
                }
                else if (.10 > Utility.RandomDouble())
                {
                    special = GetRandomSpecial(level, cont.Map);
                }
            }

            if (arty != null)
            {
                Container pack = new Backpack();
                pack.Hue = 1278;

                pack.DropItem(arty);
                cont.DropItem(pack);
            }

            if (special != null)
            {
                cont.DropItem(special);
            }

            int rolls = 2;

            if (level >= 5)
            {
                rolls += level - 2;
            }

            RefinementComponent.Roll(cont, rolls, 0.10);
        }
コード例 #46
0
		public static void PackRegs(LockableContainer cont, int count)
		{
			ClearAmounts( TreasureMapChest.m_Regs );

			for ( int i = 0; i < count; ++i )
				m_Regs[Utility.Random( TreasureMapChest.m_Regs.Length )]++;

			AddItems( cont, TreasureMapChest.m_Regs, TreasureMapChest.m_RegTypes );
		}
コード例 #47
0
		public static void Fill( LockableContainer cont, int level, bool IsThemed, ChestThemeType type )
		{
			cont.Movable = false;

			// the speial Overland Treasure Hunter NPC 'unlocks' the chest for you!
			if (TreasureTheme.IsOverlandTheme(type) == false)
			{
                cont.TrapType = Utility.RandomBool() ? TrapType.PoisonTrap : TrapType.ExplosionTrap;
				cont.TrapPower = level * 25;
				cont.Locked = true;
			}

			switch ( level )
			{
				case 1: cont.RequiredSkill = 36; break;
				case 2: cont.RequiredSkill = 76; break;
				case 3: cont.RequiredSkill = 84; break;
				case 4: cont.RequiredSkill = 92; break;
				case 5: cont.RequiredSkill = 100; break;
			}

			cont.LockLevel = cont.RequiredSkill - 10;
			cont.MaxLockLevel = cont.RequiredSkill + 40;

			// add theme loot
			AddThemeLoot(cont, level, type);

			// now for the gold
		    cont.DropItem( new Gold( level * 1000 ) );

			//if not a undead or pirate chest add scrolls
			if(type !=ChestThemeType.Pirate || type != ChestThemeType.Undead)
			{
				// adam: Changed to drop scrolls appropriatre for the level.
				for ( int i = 0; i < level * 5; ++i )
				{
					int minCircle = level;
					int maxCircle = (level + 3);
					PackScroll( cont, minCircle, maxCircle );
				}

			}

			// magic armor and weapons
			int count = MagicArmsThrottle(level);		// calc amount of magic armor and weapons to drop
			if (IsThemed == true) count /= 2;			// adam: Less loot if a themed chest because they get other goodies.
			for ( int i = 0; i < count; ++i )
			{
				Item item;
				item = Loot.RandomArmorOrShieldOrWeapon();
				item = Loot.ImbueWeaponOrArmor (item, level, 0.05, false);

				// erl: SDrop chance
				// ..
				if( Server.Engines.SDrop.SDropTest( item, CoreAI.EScrollChance ) )
				{
					// Drop a scroll instead
					EnchantedScroll escroll = Loot.GenEScroll((object) item);

					// Delete the original item
					item.Delete();

					// Re-reference item to escroll and continue
					item = (Item) escroll;
				}
				// ..

				cont.DropItem( item );
			}

			PackRegs(cont, level * 20);
			PackGems(cont, level * 10);
		}
コード例 #48
0
ファイル: TreasureMapChest.cs プロジェクト: Ravenwolfe/xrunuo
        public static void FillOld( LockableContainer cont, int level )
        {
            cont.Movable = false;
            cont.Locked = true;

            cont.TrapType = TrapType.ExplosionTrap;
            cont.TrapPower = level * 25;
            cont.TrapLevel = level;
            cont.TrapEnabled = true;

            switch ( level )
            {
                case 1:
                    cont.RequiredSkill = 36;
                    break;
                case 2:
                    cont.RequiredSkill = 76;
                    break;
                case 3:
                    cont.RequiredSkill = 84;
                    break;
                case 4:
                    cont.RequiredSkill = 92;
                    break;
                case 5:
                    cont.RequiredSkill = 100;
                    break;
                case 6:
                    cont.RequiredSkill = 100;
                    break;
            }

            cont.LockLevel = cont.RequiredSkill - 10;
            cont.MaxLockLevel = cont.RequiredSkill + 40;

            cont.DropItem( new Gold( level * 1000 ) );

            for ( int i = 0; i < level * 5; ++i )
                cont.DropItem( Loot.RandomScroll( 0, 63, SpellbookType.Regular ) );

            for ( int i = 0; i < level * 6; ++i )
            {
                Item item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();

                if ( item is BaseWeapon )
                {
                    BaseWeapon weapon = (BaseWeapon) item;

                    int attributeCount;
                    int min, max;

                    GetRandomAOSStats( out attributeCount, out min, out max );

                    BaseRunicTool.ApplyAttributesTo( weapon, attributeCount, min, max );

                    cont.DropItem( item );
                }
                else if ( item is BaseArmor )
                {
                    BaseArmor armor = (BaseArmor) item;

                    int attributeCount;
                    int min, max;

                    GetRandomAOSStats( out attributeCount, out min, out max );

                    BaseRunicTool.ApplyAttributesTo( armor, attributeCount, min, max );

                    cont.DropItem( item );
                }
                else if ( item is BaseJewel )
                {
                    int attributeCount;
                    int min, max;

                    GetRandomAOSStats( out attributeCount, out min, out max );

                    BaseRunicTool.ApplyAttributesTo( (BaseJewel) item, attributeCount, min, max );

                    cont.DropItem( item );
                }
            }

            int reagents;
            if ( level == 0 )
                reagents = 12;
            else
                reagents = level * 3;

            for ( int i = 0; i < reagents; i++ )
            {
                Item item = Loot.RandomPossibleReagent();
                item.Amount = Utility.RandomMinMax( 40, 60 );
                cont.DropItem( item );
            }

            int gems;
            if ( level == 0 )
                gems = 2;
            else
                gems = level * 3;

            for ( int i = 0; i < gems; i++ )
            {
                Item item = Loot.RandomGem();
                cont.DropItem( item );
            }

            if ( level == 6 )
            {
                Item item = (Item) Activator.CreateInstance( m_Artifacts[Utility.Random( m_Artifacts.Length )] );
                cont.DropItem( item );
            }
        }
コード例 #49
0
		private int Verify( LockableContainer container )
		{
			if ( container == null || container.KeyValue == 0 )
				return 1005638; // You can only trap lockable chests.
			if ( From.Map != container.Map || !From.InRange( container.GetWorldLocation(), 2 ) )
				return 500446; // That is too far away.
			if ( !container.Movable )
				return 502944; // You cannot trap this item because it is locked down.
			if ( !container.IsAccessibleTo( From ) )
				return 502946; // That belongs to someone else.
			if ( container.Locked )
				return 502943; // You can only trap an unlocked object.
			if ( container.TrapType != TrapType.None )
				return 502945; // You can only place one trap on an object at a time.

			return 0;
		}
コード例 #50
0
		public static void Fill( LockableContainer cont, int level )
		{
			cont.Movable = false;
            cont.TrapType = Utility.RandomBool() ? TrapType.PoisonTrap : TrapType.ExplosionTrap;
			cont.TrapPower = level * 25;
			cont.Locked = true;

			switch ( level )
			{
					// Adam: add level 0 (trainer chests)
				case 0: cont.RequiredSkill = Utility.RandomMinMax (30, 37) ; break;
				case 1: cont.RequiredSkill = 36; break;
				case 2: cont.RequiredSkill = 76; break;
				case 3: cont.RequiredSkill = 84; break;
				case 4: cont.RequiredSkill = 92; break;
				case 5: cont.RequiredSkill = 100; break;
			}

			cont.LockLevel = cont.RequiredSkill - 10;
			cont.MaxLockLevel = cont.RequiredSkill + 40;

			// adam: change treasure map chest loot MIN-MAX so as to decrease daily take home
			if (level != 0)
				cont.DropItem( 
					new Gold( Utility.RandomMinMax( 
						(int)(((double)((level * 1000) / 3)) * .75), // min is 75% of MAX
						(level * 1000) / 3 ) ) );

            // skin tone creme for level 4 & 5 chests
            if (Utility.RandomDouble() < 0.05 && level > 3)
            {
                cont.DropItem(new SkinHueCreme());
            }

			// adam: scrolls * 3 and not 5
			for ( int i = 0; i < level * 3; ++i )
			{
				int minCircle = level;
				int maxCircle = (level + 3);
				PackScroll( cont, minCircle, maxCircle );
			}

			// plus "level chances" for magic jewelry & clothing
			switch (level)
			{
				case 0:	// Adam: trainer chest
				case 1:	// none
					break;	
				case 2:
					PackMagicItem( cont, 1, 1, 0.05 );
					break;
				case 3:
					PackMagicItem( cont, 1, 2, 0.10 );
					PackMagicItem( cont, 1, 2, 0.05 );
					break;
				case 4:
					PackMagicItem( cont, 2, 3, 0.10 );
					PackMagicItem( cont, 2, 3, 0.05 );
					PackMagicItem( cont, 2, 3, 0.02 );
					break;
				case 5:
                    PackMagicItem(cont, 3, 3, 0.10);
                    PackMagicItem(cont, 3, 3, 0.05);
                    PackMagicItem(cont, 3, 3, 0.02);
					break;
			}

			// TreasureMap( int level, Map map
			//	5% chance to get a treasure map
			//  Changed chance for tmap to 1%
			if (level != 0)
				if (Utility.RandomDouble() < 0.01)
				{
					int mlevel = level;

					//	20% chance to get a treasure map one level better than the level of this chest
					if (Utility.RandomDouble() < 0.20)
						mlevel += (level < 5) ? 1 : 0;	// bump up the map level by one

					TreasureMap map = new TreasureMap (mlevel, Map.Felucca);
					cont.DropItem( map );				// drop it baby!
				}

			// if You're doing a level 3, 4, or 5 chest you have a 1.5%, 2%, or 2.5% chance to get a monster statue
			double chance = 0.00 + (((double)level) * 0.005);
			if ( (level > 3) && (Utility.RandomDouble() < chance) )
			{
				int ndx = level - 3;
				MonsterStatuette mx =
					new MonsterStatuette(m_monsters[ndx][Utility.Random(m_monsters[ndx].Length)]);
				mx.LootType = LootType.Regular;					// not blessed
				cont.DropItem( mx );							// drop it baby!
			}

			TreasureMapChest.PackRegs(cont, level * 10);
			TreasureMapChest.PackGems(cont, level * 5);

		}
コード例 #51
0
        public static void Fill(LockableContainer cont, int level)
        {
            cont.Movable = false;
            cont.Locked  = true;

            if (level == 0)
            {
                cont.LockLevel = 0;                 // Can't be unlocked

                cont.DropItem(new Gold(Utility.RandomMinMax(50, 100)));

                if (Utility.RandomDouble() < 0.75)
                {
                    cont.DropItem(new TreasureMap(0, Map.Trammel));
                }
            }
            else
            {
                cont.TrapType  = TrapType.ExplosionTrap;
                cont.TrapPower = level * 25;
                cont.TrapLevel = level;

                switch (level)
                {
                case 1: cont.RequiredSkill = 36; break;

                case 2: cont.RequiredSkill = 76; break;

                case 3: cont.RequiredSkill = 84; break;

                case 4: cont.RequiredSkill = 92; break;

                case 5: cont.RequiredSkill = 100; break;

                case 6: cont.RequiredSkill = 100; break;
                }

                cont.LockLevel    = cont.RequiredSkill - 10;
                cont.MaxLockLevel = cont.RequiredSkill + 40;

                cont.DropItem(new Gold(level * 1000));

                for (int i = 0; i < level * 5; ++i)
                {
                    cont.DropItem(Loot.RandomScroll(0, 63, SpellbookType.Regular));
                }

                for (int i = 0; i < level * 6; ++i)
                {
                    Item item;

                    if (Core.AOS)
                    {
                        item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
                    }
                    else
                    {
                        item = Loot.RandomArmorOrShieldOrWeapon();
                    }

                    if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(weapon, attributeCount, min, max);
                        }
                        else
                        {
                            weapon.DamageLevel     = (WeaponDamageLevel)Utility.Random(6);
                            weapon.AccuracyLevel   = (WeaponAccuracyLevel)Utility.Random(6);
                            weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(6);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max);
                        }
                        else
                        {
                            armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6);
                            armor.Durability      = (ArmorDurabilityLevel)Utility.Random(6);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseJewel)
                    {
                        int attributeCount;
                        int min, max;

                        GetRandomAOSStats(out attributeCount, out min, out max);

                        BaseRunicTool.ApplyAttributesTo((BaseJewel)item, attributeCount, min, max);

                        cont.DropItem(item);
                    }
                }
            }

            int reagents;

            if (level == 0)
            {
                reagents = 12;
            }
            else
            {
                reagents = level * 3;
            }

            for (int i = 0; i < reagents; i++)
            {
                Item item = Loot.RandomPossibleReagent();
                item.Amount = Utility.RandomMinMax(40, 60);
                cont.DropItem(item);
            }

            int gems;

            if (level == 0)
            {
                gems = 2;
            }
            else
            {
                gems = level * 3;
            }

            for (int i = 0; i < gems; i++)
            {
                Item item = Loot.RandomGem();
                cont.DropItem(item);
            }

            if (level == 6 && Core.AOS)
            {
                cont.DropItem((Item)Activator.CreateInstance(m_Artifacts[Utility.Random(m_Artifacts.Length)]));
            }
        }
コード例 #52
0
ファイル: TreasureMapChest.cs プロジェクト: uodestiny/ServUO
        public static void Fill(LockableContainer cont, int luck, int level, bool isSos, Map map)
        {
            cont.Movable = false;
            cont.Locked  = true;
            int numberItems;

            if (level == 0)
            {
                cont.LockLevel = 0; // Can't be unlocked

                cont.DropItem(new Gold(Utility.RandomMinMax(50, 100)));

                if (Utility.RandomDouble() < 0.75)
                {
                    cont.DropItem(new TreasureMap(0, Map.Trammel));
                }
            }
            else
            {
                cont.TrapType  = TrapType.ExplosionTrap;
                cont.TrapPower = level * 25;
                cont.TrapLevel = level;

                switch (level)
                {
                case 1:
                    cont.RequiredSkill = 5;
                    break;

                case 2:
                    cont.RequiredSkill = 45;
                    break;

                case 3:
                    cont.RequiredSkill = 65;
                    break;

                case 4:
                    cont.RequiredSkill = 75;
                    break;

                case 5:
                    cont.RequiredSkill = 75;
                    break;

                case 6:
                    cont.RequiredSkill = 80;
                    break;

                case 7:
                    cont.RequiredSkill = 80;
                    break;
                }

                cont.LockLevel    = cont.RequiredSkill - 10;
                cont.MaxLockLevel = cont.RequiredSkill + 40;

                cont.DropItem(new Gold(level * 5000));

                for (int i = 0; i < level * 5; ++i)
                {
                    cont.DropItem(Loot.RandomScroll(0, 63, SpellbookType.Regular));
                }

                double propsScale = 1.0;
                if (Core.SE)
                {
                    switch (level)
                    {
                    case 1:
                        numberItems = 32;
                        propsScale  = 0.5625;
                        break;

                    case 2:
                        numberItems = 40;
                        propsScale  = 0.6875;
                        break;

                    case 3:
                        numberItems = 48;
                        propsScale  = 0.875;
                        break;

                    case 4:
                        numberItems = 56;
                        break;

                    case 5:
                        numberItems = 64;
                        break;

                    case 6:
                        numberItems = 72;
                        break;

                    case 7:
                        numberItems = 80;
                        break;

                    default:
                        numberItems = 0;
                        break;
                    }
                }
                else
                {
                    numberItems = level * 6;
                }

                for (int i = 0; i < numberItems; ++i)
                {
                    Item item;

                    if (Core.AOS)
                    {
                        item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
                    }
                    else
                    {
                        item = Loot.RandomArmorOrShieldOrWeapon();
                    }

                    if (item != null && Core.HS && RandomItemGenerator.Enabled)
                    {
                        int min, max;
                        GetRandomItemStat(out min, out max, propsScale);

                        RunicReforging.GenerateRandomItem(item, luck, min, max, map);

                        cont.DropItem(item);
                    }
                    else if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(weapon, attributeCount, min, max);
                        }
                        else
                        {
                            weapon.DamageLevel     = (WeaponDamageLevel)Utility.Random(6);
                            weapon.AccuracyLevel   = (WeaponAccuracyLevel)Utility.Random(6);
                            weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(6);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max);
                        }
                        else
                        {
                            armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6);
                            armor.Durability      = (ArmorDurabilityLevel)Utility.Random(6);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseHat)
                    {
                        BaseHat hat = (BaseHat)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(hat, attributeCount, min, max);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseJewel)
                    {
                        int attributeCount;
                        int min, max;

                        GetRandomAOSStats(out attributeCount, out min, out max);

                        BaseRunicTool.ApplyAttributesTo((BaseJewel)item, attributeCount, min, max);

                        cont.DropItem(item);
                    }
                }
            }

            int reagents;

            if (level == 0)
            {
                reagents = 12;
            }
            else
            {
                reagents = level + 1;
            }

            for (int i = 0; i < reagents; i++)
            {
                Item item = Loot.RandomPossibleReagent();
                item.Amount = Utility.RandomMinMax(40, 60);
                cont.DropItem(item);
            }

            int gems;

            if (level == 0)
            {
                gems = 2;
            }
            else
            {
                gems = (level * 3) + 1;
            }

            for (int i = 0; i < gems; i++)
            {
                Item item = Loot.RandomGem();
                cont.DropItem(item);
            }

            if (level > 1)
            {
                Item item = Loot.Construct(m_ImbuingIngreds[Utility.Random(m_ImbuingIngreds.Length)]);

                item.Amount = level;
                cont.DropItem(item);
            }

            Item arty    = null;
            Item special = null;

            if (isSos)
            {
                if (0.004 * level > Utility.RandomDouble())
                {
                    arty = Loot.Construct(m_SOSArtifacts);
                }
                if (0.006 * level > Utility.RandomDouble())
                {
                    special = Loot.Construct(m_SOSDecor);
                }
                else if (0.009 * level > Utility.RandomDouble())
                {
                    special = new TreasureMap(Utility.RandomMinMax(level, Math.Min(7, level + 1)), cont.Map);
                }
            }
            else
            {
                if (level >= 7)
                {
                    if (0.025 > Utility.RandomDouble())
                    {
                        special = Loot.Construct(m_LevelSevenOnly);
                    }
                    else if (0.10 > Utility.RandomDouble())
                    {
                        special = Loot.Construct(m_LevelFiveToSeven);
                    }
                    else if (0.25 > Utility.RandomDouble())
                    {
                        special = GetRandomSpecial(level, cont.Map);
                    }

                    arty = Loot.Construct(m_Artifacts);
                }
                else if (level >= 6)
                {
                    if (0.025 > Utility.RandomDouble())
                    {
                        special = Loot.Construct(m_LevelFiveToSeven);
                    }
                    else if (0.10 > Utility.RandomDouble())
                    {
                        special = GetRandomSpecial(level, cont.Map);
                    }

                    arty = Loot.Construct(m_Artifacts);
                }
                else if (level >= 5)
                {
                    if (0.05 > Utility.RandomDouble())
                    {
                        special = Loot.Construct(m_LevelFiveToSeven);
                    }
                    else if (0.25 > Utility.RandomDouble())
                    {
                        special = GetRandomSpecial(level, cont.Map);
                    }
                }
                else if (.10 > Utility.RandomDouble())
                {
                    special = GetRandomSpecial(level, cont.Map);
                }
            }

            if (arty != null)
            {
                Container pack = new Backpack();
                pack.Hue = 1278;

                pack.DropItem(arty);
                cont.DropItem(pack);
            }

            if (special != null)
            {
                cont.DropItem(special);
            }

            if (Core.SA)
            {
                int rolls = 2;

                if (level >= 5)
                {
                    rolls += level - 2;
                }

                RefinementComponent.Roll(cont, rolls, 0.10);
            }
        }
コード例 #53
0
		public static void Fill( LockableContainer cont )
		{
			// Gold, about 100K
			for (int ix=0; ix < 100; ix++)
				cont.DropItem( new Gold( Utility.RandomMinMax( 900, 1100 ) ) );
			
			// plus about 20 chances for magic jewelry and/or clothing
			for (int ix=0; ix < 20; ix++)
			{
				PackMagicItem( cont, 3, 3, 0.20 );
				PackMagicItem( cont, 3, 3, 0.10 );
				PackMagicItem( cont, 3, 3, 0.05 );
			}

			// drop some scrolls and weapons/armor
			for ( int ix = 0; ix < 25; ++ix )
			{
				int level = 5;
				Item item;
				item = Loot.RandomArmorOrShieldOrWeapon();
				item = Loot.ImbueWeaponOrArmor (item, level, 0.05, false);

				// erl: SDrop chance
				// ..
				if( Server.Engines.SDrop.SDropTest( item, CoreAI.EScrollChance ) )
				{
					// Drop a scroll instead
					EnchantedScroll escroll = Loot.GenEScroll((object) item);

					// Delete the original item
					item.Delete();

					// Re-reference item to escroll and continue
					item = (Item) escroll;
				}
				// ..

				cont.DropItem( item );
			}

			// drop a few nice maps
			for (int ix=0; ix < 5; ix++)
			{
				TreasureMap map = new TreasureMap (5, Map.Felucca);
				cont.DropItem( map );				
			}

			// drop a few single-color leather dye tubs with 100 charges
			for (int ix=0; ix < 25; ix++)
			{
				LeatherArmorDyeTub tub = new LeatherArmorDyeTub ();
				cont.DropItem( tub );				
			}
			
			// pack some other goodies
			TreasureMapChest.PackRegs(cont, 300);
			TreasureMapChest.PackGems(cont, 300);

		}
コード例 #54
0
ファイル: OrcCamp.cs プロジェクト: greeduomacro/UO-Forever
		public override void Deserialize(GenericReader reader)
		{
			base.Deserialize(reader);

			int version = reader.ReadInt();

			switch (version)
			{
				case 2:
					{
						m_Chest = reader.ReadItem<LockableContainer>();
						m_Crate = reader.ReadItem<LockableContainer>();
						m_Filled = reader.ReadBool();
					}
					goto case 1;
				case 1:
					m_Prisoner = reader.ReadMobile<BaseCreature>();
					goto case 0;
				case 0:
					break;
			}
		}
コード例 #55
0
 public abstract void SetContainerTrap(Mobile from, LockableContainer cont);
コード例 #56
0
		public static void Fill( LockableContainer cont, int level )
		{
			cont.Movable = false;
			cont.Locked = true;

			if( level == 0 )
			{
				cont.LockLevel = 0; // Can't be unlocked

				if( Utility.RandomDouble() < 0.75 )
					cont.DropItem( new TreasureMap( 0, Map.Backtrol ) );
			}
			else
			{
				cont.TrapType = TrapType.ExplosionTrap;
				cont.TrapPower = level * 25;
				cont.TrapLevel = level;

				switch( level )
				{
					case 1: cont.RequiredSkill = 36; break;
					case 2: cont.RequiredSkill = 76; break;
					case 3: cont.RequiredSkill = 84; break;
					case 4: cont.RequiredSkill = 92; break;
					case 5: cont.RequiredSkill = 100; break;
					case 6: cont.RequiredSkill = 100; break;
				}

				cont.LockLevel = cont.RequiredSkill - 10;
				cont.MaxLockLevel = cont.RequiredSkill + 40;

				for( int i = 0; i < level * 5; ++i )
					cont.DropItem( Loot.RandomScroll( 0, 63, SpellbookType.Regular ) );

				for( int i = 0; i < level * 6; ++i )
				{
					Item item;

					if( Core.AOS )
						item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
					else
						item = Loot.RandomArmorOrShieldOrWeapon();

					if( item is BaseWeapon )
					{
						BaseWeapon weapon = (BaseWeapon)item;

						if( Core.SE )
						{
							int attributeCount;
							int min, max;

							GetRandomAOSStats( out attributeCount, out min, out max );

							BaseRunicTool.ApplyAttributesTo( weapon, attributeCount, min, max );
						}
						else
						{
							weapon.DamageLevel = (WeaponDamageLevel)Utility.Random( 6 );
							weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random( 6 );
							weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random( 6 );
						}

						cont.DropItem( item );
					}
					else if( item is BaseArmor )
					{
						BaseArmor armor = (BaseArmor)item;

						if( Core.SE )
						{
							int attributeCount;
							int min, max;

							GetRandomAOSStats( out attributeCount, out min, out max );

							BaseRunicTool.ApplyAttributesTo( armor, attributeCount, min, max );
						}
						else
						{
							armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random( 6 );
							armor.Durability = (ArmorDurabilityLevel)Utility.Random( 6 );
						}

						cont.DropItem( item );
					}
					else if( item is BaseHat )
					{
						BaseHat hat = (BaseHat)item;

						if( Core.SE )
						{
							int attributeCount;
							int min, max;

							GetRandomAOSStats( out attributeCount, out min, out  max );

							BaseRunicTool.ApplyAttributesTo( hat, attributeCount, min, max );
						}

						cont.DropItem( item );
					}
					else if( item is BaseJewel )
					{
						int attributeCount;
						int min, max;

						GetRandomAOSStats( out attributeCount, out min, out max );

						BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, attributeCount, min, max );

						cont.DropItem( item );
					}
				}
			}

			int reagents;
			if( level == 0 )
				reagents = 12;
			else
				reagents = level * 3;

			for( int i = 0; i < reagents; i++ )
			{
				Item item = Loot.RandomPossibleReagent();
				item.Amount = Utility.RandomMinMax( 40, 60 );
				cont.DropItem( item );
			}

			int gems;
			if( level == 0 )
				gems = 2;
			else
				gems = level * 3;

			for( int i = 0; i < gems; i++ )
			{
				Item item = Loot.RandomGem();
				cont.DropItem( item );
			}
		}
コード例 #57
0
		public static void Fill( LockableContainer cont, int level )
		{
			cont.Movable = false;
			cont.Locked = true;
            int numberItems;

			if ( level == 0 )
			{
				cont.LockLevel = 0; // Can't be unlocked

				cont.DropItem( new Gold( Utility.RandomMinMax( 50, 100 ) ) );

				if ( Utility.RandomDouble() < 0.75 )
					cont.DropItem( new TreasureMap( 0, Map.Felucca ) );
			}
			else
			{
				cont.TrapType = TrapType.ExplosionTrap;
				cont.TrapPower = level * 25;
				cont.TrapLevel = level;

				switch ( level )
				{
					case 1: cont.RequiredSkill = 36; break;
					case 2: cont.RequiredSkill = 76; break;
					case 3: cont.RequiredSkill = 84; break;
					case 4: cont.RequiredSkill = 92; break;
					case 5: cont.RequiredSkill = 100; break;
					case 6: cont.RequiredSkill = 100; break;
				}

				cont.LockLevel = cont.RequiredSkill - 10;
				cont.MaxLockLevel = cont.RequiredSkill + 40;

                //Publish 67 gold change
                //if ( Core.SA )
                //	cont.DropItem( new Gold( level * 5000 ) );
                //else					
                cont.DropItem(new Gold(level * 1000));

				for ( int i = 0; i < level * 2; ++i )
					cont.DropItem( Loot.RandomScroll( 0, 63, SpellbookType.Regular ) );

				if ( Core.SE)
				{
					switch ( level )
					{
						case 1: numberItems = 5; break;
						case 2: numberItems = 10; break;
						case 3: numberItems = 15; break;
						case 4: numberItems = 38; break;
						case 5: numberItems = 50; break;
						case 6: numberItems = 60; break;
						default: numberItems = 0; break;
					};
				}
				else
					numberItems = level * 6;
				
				for ( int i = 0; i < numberItems; ++i )
				{
					Item item;

					if ( Core.AOS )
						item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
					else
						item = Loot.RandomArmorOrShieldOrWeapon();

					if ( item is BaseWeapon )
					{
						BaseWeapon weapon = (BaseWeapon)item;

						if ( Core.AOS )
						{
							int attributeCount;
							int min, max;

							GetRandomAOSStats( out attributeCount, out min, out max );

							BaseRunicTool.ApplyAttributesTo( weapon, attributeCount, min, max );
						}
						else
						{
							weapon.DamageLevel = (WeaponDamageLevel)Utility.Random( 6 );
							weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random( 6 );
							weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random( 6 );
						}

						cont.DropItem( item );
					}
					else if ( item is BaseArmor )
					{
						BaseArmor armor = (BaseArmor)item;

						if ( Core.AOS )
						{
							int attributeCount;
							int min, max;

							GetRandomAOSStats( out attributeCount, out min, out max );

							BaseRunicTool.ApplyAttributesTo( armor, attributeCount, min, max );
						}
						else
						{
							armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random( 6 );
							armor.Durability = (ArmorDurabilityLevel)Utility.Random( 6 );
						}

						cont.DropItem( item );
					}
					else if( item is BaseHat )
					{
						BaseHat hat = (BaseHat)item;

						if( Core.AOS )
						{
							int attributeCount;
							int min, max;

							GetRandomAOSStats( out attributeCount, out min, out  max );

							BaseRunicTool.ApplyAttributesTo( hat, attributeCount, min, max );
						}

						cont.DropItem( item );
					}
					else if( item is BaseJewel )
					{
						int attributeCount;
						int min, max;

						GetRandomAOSStats( out attributeCount, out min, out max );

						BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, attributeCount, min, max );

						cont.DropItem( item );
					}
				}
			}

			int reagents;
			if ( level == 0 )
				reagents = 12;
			else
				reagents = level * 3;

			for ( int i = 0; i < reagents; i++ )
			{
				Item item = Loot.RandomPossibleReagent();
				item.Amount = Utility.RandomMinMax( 40, 60 );
				cont.DropItem( item );
			}

			int gems;
			if ( level == 0 )
				gems = 2;
			else
				gems = level * 3;

			for ( int i = 0; i < gems; i++ )
			{
				Item item = Loot.RandomGem();
				cont.DropItem( item );
			}

			if ( level == 6 && Core.AOS )
				cont.DropItem( (Item)Activator.CreateInstance( m_Artifacts[Utility.Random(m_Artifacts.Length)] ) );
		}
コード例 #58
0
        public static void Fill(LockableContainer cont, int level, Map map)
        {
            cont.Movable = false;
            cont.Locked  = true;

            #region Lock & Trap
            cont.TrapType    = TrapType.ExplosionTrap;
            cont.TrapPower   = level * 25;
            cont.TrapLevel   = level;
            cont.TrapEnabled = true;

            switch (level)
            {
            case 1:
                cont.RequiredSkill = 36;
                break;

            case 2:
                cont.RequiredSkill = 76;
                break;

            case 3:
                cont.RequiredSkill = 84;
                break;

            case 4:
                cont.RequiredSkill = 92;
                break;

            case 5:
                cont.RequiredSkill = 100;
                break;

            case 6:
                cont.RequiredSkill = 100;
                break;
            }

            cont.LockLevel    = cont.RequiredSkill - 10;
            cont.MaxLockLevel = cont.RequiredSkill + 40;
            #endregion

            #region Gold
            cont.DropItem(new Gold(level * 5000));
            #endregion

            #region Reagents
            int reagentStackCount = level + 3;

            for (int i = 0; i < reagentStackCount; i++)
            {
                Item item = Loot.RandomPossibleReagent();
                item.Amount = Utility.RandomMinMax(40, 60);
                cont.DropItem(item);
            }
            #endregion

            #region Magic Items
            int magicItemCount = 24 + (8 * level);

            for (int i = 0; i < magicItemCount; ++i)
            {
                Item item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();

                if (item is BaseWeapon)
                {
                    BaseWeapon weapon = (BaseWeapon)item;

                    int attributeCount;
                    int min, max;

                    GetRandomAOSStats(out attributeCount, out min, out max);

                    BaseRunicTool.ApplyAttributesTo(weapon, attributeCount, min, max);

                    cont.DropItem(item);
                }
                else if (item is BaseArmor)
                {
                    BaseArmor armor = (BaseArmor)item;

                    int attributeCount;
                    int min, max;

                    GetRandomAOSStats(out attributeCount, out min, out max);

                    BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max);

                    cont.DropItem(item);
                }
                else if (item is BaseJewel)
                {
                    int attributeCount;
                    int min, max;

                    GetRandomAOSStats(out attributeCount, out min, out max);

                    BaseRunicTool.ApplyAttributesTo((BaseJewel)item, attributeCount, min, max);

                    cont.DropItem(item);
                }
            }
            #endregion

            #region Gems
            int gemCount = level * 3;

            for (int i = 0; i < gemCount; i++)
            {
                Item item = Loot.RandomGem();
                cont.DropItem(item);
            }
            #endregion

            #region Essences
            if (level >= 2)
            {
                int essenceCount = level;

                for (int i = 0; i < essenceCount; i++)
                {
                    Item item = Loot.RandomEssence();
                    cont.DropItem(item);
                }
            }
            #endregion

            #region Special loot
            if (map == Map.Felucca && (level * 0.15) > Utility.RandomDouble())
            {
                Item item = ScrollOfTranscendence.CreateRandom(5);
                cont.DropItem(item);
            }

            if ((level * 0.1) > Utility.RandomDouble())
            {
                cont.DropItem(new TastyTreat());
            }

            if ((level * 0.05) > Utility.RandomDouble())
            {
                cont.DropItem(new CreepingVine());
            }

            if ((level * 0.05) > Utility.RandomDouble())
            {
                cont.DropItem(Server.Engines.Quests.BaseReward.RandomRecipe());
            }

            if (0.5 > Utility.RandomDouble())
            {
                cont.DropItem(new TreasureMap(level < 6 && 0.25 > Utility.RandomDouble() ? level + 1 : level));
            }

            if (0.25 > Utility.RandomDouble())
            {
                cont.DropItem(new SkeletonKey());
            }

            if (0.2 > Utility.RandomDouble())
            {
                cont.DropItem(ScrollOfAlacrity.CreateRandom());
            }

            if (0.2 > Utility.RandomDouble())
            {
                cont.DropItem(new MessageInABottle());
            }

            if (level >= 5)
            {
                if (0.1 > Utility.RandomDouble())
                {
                    cont.DropItem(new ForgedPardon());
                }

                if (0.09 > Utility.RandomDouble())
                {
                    cont.DropItem(new ManaPhasingOrb());
                }

                if (0.09 > Utility.RandomDouble())
                {
                    cont.DropItem(new RunedSashOfWarding());
                }

                if (0.09 > Utility.RandomDouble())
                {
                    cont.DropItem(map == Map.TerMur ? new GargishSurgeShield() : new SurgeShield());
                }
            }
            #endregion

            #region Artifacts
            if (level >= 6)
            {
                Item item = (Item)Activator.CreateInstance(m_Artifacts[Utility.Random(m_Artifacts.Length)]);
                cont.DropItem(item);
            }
            #endregion
        }
コード例 #59
0
ファイル: OrcCamp.cs プロジェクト: greeduomacro/UO-Forever
		private void AddCampChests()
		{
			switch (Utility.Random(3))
			{
				case 0:
					m_Chest = new MetalChest();
					break;
				case 1:
					m_Chest = new MetalGoldenChest();
					break;
				default:
					m_Chest = new WoodenChest();
					break;
			}

			m_Chest.LiftOverride = true;

			AddItem(m_Chest, -2, 2, 0);

			switch (Utility.Random(4))
			{
				case 0:
					m_Crate = new SmallCrate();
					break;
				case 1:
					m_Crate = new MediumCrate();
					break;
				case 2:
					m_Crate = new LargeCrate();
					break;
				default:
					m_Crate = new LockableBarrel();
					break;
			}

			m_Crate.TrapType = TrapType.ExplosionTrap;
			m_Crate.TrapPower = Utility.RandomMinMax(30, 40);
			m_Crate.TrapLevel = 2;

			m_Crate.RequiredSkill = 76;
			m_Crate.LockLevel = 66;
			m_Crate.MaxLockLevel = 116;
			m_Crate.Locked = true;

			m_Crate.DropItem(new Gold(Utility.RandomMinMax(100, 400)));
			m_Crate.DropItem(new Arrow(10));
			m_Crate.DropItem(new Bolt(10));

			m_Crate.LiftOverride = true;

			if (Utility.RandomDouble() < 0.8)
			{
				switch (Utility.Random(4))
				{
					case 0:
						m_Crate.DropItem(new LesserCurePotion());
						break;
					case 1:
						m_Crate.DropItem(new LesserExplosionPotion());
						break;
					case 2:
						m_Crate.DropItem(new LesserHealPotion());
						break;
					default:
						m_Crate.DropItem(new LesserPoisonPotion());
						break;
				}
			}

			AddItem(m_Crate, 2, -2, 0);
		}
コード例 #60
0
        public static void FillOld(LockableContainer cont, int level)
        {
            cont.Movable = false;
            cont.Locked  = true;

            cont.TrapType    = TrapType.ExplosionTrap;
            cont.TrapPower   = level * 25;
            cont.TrapLevel   = level;
            cont.TrapEnabled = true;

            switch (level)
            {
            case 1:
                cont.RequiredSkill = 36;
                break;

            case 2:
                cont.RequiredSkill = 76;
                break;

            case 3:
                cont.RequiredSkill = 84;
                break;

            case 4:
                cont.RequiredSkill = 92;
                break;

            case 5:
                cont.RequiredSkill = 100;
                break;

            case 6:
                cont.RequiredSkill = 100;
                break;
            }

            cont.LockLevel    = cont.RequiredSkill - 10;
            cont.MaxLockLevel = cont.RequiredSkill + 40;

            cont.DropItem(new Gold(level * 1000));

            for (int i = 0; i < level * 5; ++i)
            {
                cont.DropItem(Loot.RandomScroll(0, 63, SpellbookType.Regular));
            }

            for (int i = 0; i < level * 6; ++i)
            {
                Item item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();

                if (item is BaseWeapon)
                {
                    BaseWeapon weapon = (BaseWeapon)item;

                    int attributeCount;
                    int min, max;

                    GetRandomAOSStats(out attributeCount, out min, out max);

                    BaseRunicTool.ApplyAttributesTo(weapon, attributeCount, min, max);

                    cont.DropItem(item);
                }
                else if (item is BaseArmor)
                {
                    BaseArmor armor = (BaseArmor)item;

                    int attributeCount;
                    int min, max;

                    GetRandomAOSStats(out attributeCount, out min, out max);

                    BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max);

                    cont.DropItem(item);
                }
                else if (item is BaseJewel)
                {
                    int attributeCount;
                    int min, max;

                    GetRandomAOSStats(out attributeCount, out min, out max);

                    BaseRunicTool.ApplyAttributesTo((BaseJewel)item, attributeCount, min, max);

                    cont.DropItem(item);
                }
            }

            int reagents;

            if (level == 0)
            {
                reagents = 12;
            }
            else
            {
                reagents = level * 3;
            }

            for (int i = 0; i < reagents; i++)
            {
                Item item = Loot.RandomPossibleReagent();
                item.Amount = Utility.RandomMinMax(40, 60);
                cont.DropItem(item);
            }

            int gems;

            if (level == 0)
            {
                gems = 2;
            }
            else
            {
                gems = level * 3;
            }

            for (int i = 0; i < gems; i++)
            {
                Item item = Loot.RandomGem();
                cont.DropItem(item);
            }

            if (level == 6)
            {
                Item item = (Item)Activator.CreateInstance(m_Artifacts[Utility.Random(m_Artifacts.Length)]);
                cont.DropItem(item);
            }
        }