Inheritance: Server.Items.LockableContainer
            public DigTimer(Mobile from, TreasureMap treasureMap, Point3D p, Map map, int z, ChestThemeType m_type) : base(TimeSpan.Zero, TimeSpan.FromSeconds(1.0))
            {
                m_From        = from;
                m_TreasureMap = treasureMap;
                m_Map         = map;
                m_Z           = z;
                type          = m_type;
                themed        = m_TreasureMap.m_Themed;

                if (themed == false)
                {
                    themed = TreasureTheme.GetIsThemed(m_TreasureMap.Level);
                }
                m_TreasureMap.m_Themed = themed;

                if (themed == true && type == ChestThemeType.None)
                {
                    type = (ChestThemeType)TreasureTheme.GetThemeType(m_TreasureMap.Level);
                }

                m_TreasureMap.m_type = type;
                m_Chest = new TreasureMapChest(from, m_TreasureMap.m_Level, themed, type);
                m_Chest.MoveToWorld(p, map);

                m_NextSkillTime  = from.NextSkillTime;
                m_NextSpellTime  = from.NextSpellTime;
                m_NextActionTime = from.NextActionTime;
                m_LastMoveTime   = from.LastMoveTime;
            }
Exemple #2
0
            public RemoveEntry(Mobile from, TreasureMapChest chest) : base(6149, 3)
            {
                m_From  = from;
                m_Chest = chest;

                Enabled = (from == chest.Owner);
            }
Exemple #3
0
            public RemoveGump(Mobile from, TreasureMapChest chest) : base(15, 15)
            {
                m_From  = from;
                m_Chest = chest;

                Closable   = false;
                Disposable = false;

                AddPage(0);

                AddBackground(30, 0, 240, 240, 2620);

                AddHtmlLocalized(
                    45,
                    15,
                    200,
                    80,
                    1048125,
                    0xFFFFFF
                    );                                                // When this treasure chest is removed, any items still inside of it will be lost.
                AddHtmlLocalized(45, 95, 200, 60, 1048126, 0xFFFFFF); // Are you certain you're ready to remove this chest?

                AddButton(40, 153, 4005, 4007, 1);
                AddHtmlLocalized(75, 155, 180, 40, 1048127, 0xFFFFFF); // Remove the Treasure Chest

                AddButton(40, 195, 4005, 4007, 2);
                AddHtmlLocalized(75, 197, 180, 35, 1006045, 0xFFFFFF); // Cancel
            }
Exemple #4
0
        public override void OnMapComplete(Mobile from, TreasureMapChest chest)
        {
            base.OnMapComplete(from, chest);

            if (chest != null)
            {
                chest.DropItem(new StasisChamberActivator());
            }
        }
        protected void AddLoot(Item item)
        {
            if (item == null)
            {
                return;
            }

            if (RandomItemGenerator.Enabled)
            {
                int min, max;
                TreasureMapChest.GetRandomItemStat(out min, out max);

                RunicReforging.GenerateRandomItem(item, 0, min, max);
            }

            DropItem(item);
        }
Exemple #6
0
 public ReturnToHomeTimer( TreasureMapChest chest )
     : base(TimeSpan.FromSeconds( 5.0 ), TimeSpan.FromSeconds( 5.0 ))
 {
     m_Chest = chest;
 }
			public RemoveGump( Mobile from, TreasureMapChest chest ) : base( 15, 15 )
			{
				m_From = from;
				m_Chest = chest;

				Closable = false;
				Disposable = false;

				AddPage( 0 );

				AddBackground( 30, 0, 240, 240, 2620 );

				AddHtmlLocalized( 45, 15, 200, 80, 1048125, 0xFFFFFF, false, false ); // When this treasure chest is removed, any items still inside of it will be lost.
				AddHtmlLocalized( 45, 95, 200, 60, 1048126, 0xFFFFFF, false, false ); // Are you certain you're ready to remove this chest?

				AddButton( 40, 153, 4005, 4007, 1, GumpButtonType.Reply, 0 );
				AddHtmlLocalized( 75, 155, 180, 40, 1048127, 0xFFFFFF, false, false ); // Remove the Treasure Chest

				AddButton( 40, 195, 4005, 4007, 2, GumpButtonType.Reply, 0 );
				AddHtmlLocalized( 75, 197, 180, 35, 1006045, 0xFFFFFF, false, false ); // Cancel
			}
			public RemoveEntry( Mobile from, TreasureMapChest chest ) : base( 6149, 3 )
			{
				m_From = from;
				m_Chest = chest;

				Enabled = ( from == chest.Owner );
			}
Exemple #9
0
            protected override void OnTick()
            {
                if (m_NextSkillTime != m_From.NextSkillTime || m_NextSpellTime != m_From.NextSpellTime || m_NextActionTime != m_From.NextActionTime)
                {
                    Terminate();
                    return;
                }

                if (m_LastMoveTime != m_From.LastMoveTime)
                {
                    m_From.SendLocalizedMessage(503023);                       // You cannot move around while digging up treasure. You will need to start digging anew.
                    Terminate();
                    return;
                }

                int z      = (m_Chest != null) ? m_Chest.Z + m_Chest.ItemData.Height : int.MinValue;
                int height = 16;

                if (z > m_Location.Z)
                {
                    height -= (z - m_Location.Z);
                }
                else
                {
                    z = m_Location.Z;
                }

                if (!m_Map.CanFit(m_Location.X, m_Location.Y, z, height, true, true, false))
                {
                    m_From.SendLocalizedMessage(503024);                       // You stop digging because something is directly on top of the treasure chest.
                    Terminate();
                    return;
                }

                m_Count++;

                m_From.RevealingAction();
                m_From.Direction = m_From.GetDirectionTo(m_Location);

                if (m_Count > 1 && m_Dirt1 == null)
                {
                    m_Dirt1 = new TreasureChestDirt();
                    m_Dirt1.MoveToWorld(m_Location, m_Map);

                    m_Dirt2 = new TreasureChestDirt();
                    m_Dirt2.MoveToWorld(new Point3D(m_Location.X, m_Location.Y - 1, m_Location.Z), m_Map);
                }

                if (m_Count == 5)
                {
                    m_Dirt1.Turn1();
                }
                else if (m_Count == 10)
                {
                    m_Dirt1.Turn2();
                    m_Dirt2.Turn2();
                }
                else if (m_Count > 10)
                {
                    if (m_Chest == null)
                    {
                        m_Chest = new TreasureMapChest(m_From, m_TreasureMap.Level, true, m_Map);
                        m_Chest.MoveToWorld(new Point3D(m_Location.X, m_Location.Y, m_Location.Z - 15), m_Map);
                    }
                    else
                    {
                        m_Chest.Z++;
                    }

                    Effects.PlaySound(m_Chest, m_Map, 0x33B);
                }

                if (m_Chest != null && m_Chest.Location.Z >= m_Location.Z)
                {
                    Stop();
                    m_From.EndAction(typeof(TreasureMap));

                    m_TreasureMap.Completed   = true;
                    m_TreasureMap.CompletedBy = m_From;

                    m_Chest.Temporary = false;

                    SpawnGuardians();
                }
                else
                {
                    if (m_From.Body.IsHuman && !m_From.Mounted)
                    {
                        m_From.Animate(11, 5, 1, true, false, 0);
                    }

                    new SoundTimer(m_From, 0x125 + (m_Count % 2)).Start();
                }
            }
Exemple #10
0
 public ReturnToHomeTimer(TreasureMapChest chest)
     : base(TimeSpan.FromSeconds(5.0), TimeSpan.FromSeconds(5.0))
 {
     m_Chest = chest;
 }
Exemple #11
0
			protected override void OnTick()
			{
				if ( m_NextSkillTime != m_From.NextSkillTime || m_NextSpellTime != m_From.NextSpellTime || m_NextActionTime != m_From.NextActionTime )
				{
					Terminate();
					return;
				}

				if ( m_LastMoveTime != m_From.LastMoveTime )
				{
					m_From.SendLocalizedMessage( 503023 ); // You cannot move around while digging up treasure. You will need to start digging anew.
					Terminate();
					return;
				}

				int z = ( m_Chest != null ) ? m_Chest.Z + m_Chest.ItemData.Height : int.MinValue;
				int height = 16;

				if ( z > m_Location.Z )
					height -= ( z - m_Location.Z );
				else
					z = m_Location.Z;

				if ( !m_Map.CanFit( m_Location.X, m_Location.Y, z, height, true, true, false ) )
				{
					m_From.SendLocalizedMessage( 503024 ); // You stop digging because something is directly on top of the treasure chest.
					Terminate();
					return;
				}

				m_Count++;

				m_From.RevealingAction();
				m_From.Direction = m_From.GetDirectionTo( m_Location );

				if ( m_Count > 1 && m_Dirt1 == null )
				{
					m_Dirt1 = new TreasureChestDirt();
					m_Dirt1.MoveToWorld( m_Location, m_Map );

					m_Dirt2 = new TreasureChestDirt();
					m_Dirt2.MoveToWorld( new Point3D( m_Location.X, m_Location.Y - 1, m_Location.Z ), m_Map );
				}

				if ( m_Count == 5 )
				{
					m_Dirt1.Turn1();
				}
				else if ( m_Count == 10 )
				{
					m_Dirt1.Turn2();
					m_Dirt2.Turn2();
				}
				else if ( m_Count > 10 )
				{
					if ( m_Chest == null )
					{
						m_Chest = new TreasureMapChest( m_From, m_TreasureMap.Level, true );
						m_Chest.MoveToWorld( new Point3D( m_Location.X, m_Location.Y, m_Location.Z - 15 ), m_Map );
					}
					else
					{
						m_Chest.Z++;
					}

					Effects.PlaySound( m_Chest, m_Map, 0x33B );
				}

				if ( m_Chest != null && m_Chest.Location.Z >= m_Location.Z )
				{
					Stop();
					m_From.EndAction( typeof( TreasureMap ) );

					m_Chest.Temporary = false;
					m_TreasureMap.Completed = true;
					m_TreasureMap.CompletedBy = m_From;

					int spawns;
					switch ( m_TreasureMap.Level )
					{
						case 0: spawns = 3; break;
						case 1: spawns = 0; break;
						default: spawns = 4; break;
					}

					for ( int i = 0; i < spawns; ++i )
					{
						BaseCreature bc = Spawn( m_TreasureMap.Level, m_Chest.Location, m_Chest.Map, null, true );

						if ( bc != null )
							m_Chest.Guardians.Add( bc );
					}
				}
				else
				{
					if ( m_From.Body.IsHuman && !m_From.Mounted )
						m_From.Animate( 11, 5, 1, true, false, 0 );

					new SoundTimer( m_From, 0x125 + (m_Count % 2) ).Start();
				}
			}
        protected virtual void FinishEffect(Point3D p, Map map, Mobile from)
        {
            from.RevealingAction();

            int spawncount = GetSpawnCount();
            int z          = p.Z;
            //Ghost ship Z, should be 10 lower than the spawn Z
            int gsZ = z - 30; //Set to -30 so it spawns under the sea and then emerges up
            //Spawn Z, needs to be 10 higher than ghost ship Z so they get on top of the boat
            int spawnZ = z - 20;

            //Create the ghost ship here
            GhostShip gs = new GhostShip();

            //Add treasure
            MetalChest tc = new MetalChest {
                ItemID = 0xE7C, LiftOverride = true
            };

            TreasureMapChest.Fill(tc, 5);

            //Now declare an area the same size as the ship, to look for items that might block
            Point2D     start = new Point2D(p.X - 10, p.Y - 7); //Starting location of the area
            Point2D     end   = new Point2D(p.X + 10, p.Y + 7); //Ending location of the area
            Rectangle2D rect  = new Rectangle2D(start, end);    //Declaring the entire area as a rectangle

            //Create a new list that will contain all items in the rectangle
            List <Item> list = new List <Item>();

            IPooledEnumerable eable = map.GetItemsInBounds(rect); //Get all items in the rectangle

            foreach (Item item in eable)                          //Add all items in the rectangle to the list
            {
                list.Add(item);
            }

            eable.Free();

            //While an item exists in the rectangle, move the spawnlocation of the boat/monsters
            while (list.Count > 0)
            {
                if (Utility.RandomDouble() < 0.5)
                {
                    p.X += 1;
                }
                else
                {
                    p.X -= 1;
                }

                if (Utility.RandomDouble() < 0.5)
                {
                    p.Y += 1;
                }
                else
                {
                    p.Y -= 1;
                }

                start = new Point2D(p.X - 10, p.Y - 7);
                end   = new Point2D(p.X + 10, p.Y + 7);
                rect  = new Rectangle2D(start, end);

                eable = map.GetItemsInBounds(rect);

                //Clear the list as we need to create a new one with the new location of the ship
                list.Clear();

                foreach (Item item in eable)
                {
                    list.Add(item); //Add the items (if any) in the new spawnlocation to the list
                }
                eable.Free();
            }

            //No items blocking, move the ship to the world
            p.Z = gsZ;
            gs.MoveToWorld(p, map);

            //Move the treasure chest to the world
            p.Z  = spawnZ + 2;
            p.X -= 9;
            tc.MoveToWorld(p, map);

            //Add the boat and all items inside the boat here
            gs.Itemlist.Add(gs);
            gs.Itemlist.Add(tc);

            //Add as many spawns as spawncount allows
            for (int i = 0; i < spawncount; ++i)
            {
                BaseCreature spawn;

                switch (Utility.Random(4))
                {
                default:
                    spawn = new LichLord();
                    break;

                case 1:
                    spawn = new AncientLich();
                    break;

                case 2:
                    spawn = new Lich();
                    break;

                case 3:
                    spawn = new SkeletalCaptain();
                    break;
                }

                p.Z = spawnZ;
                Spawn(p, map, spawn);

                spawn.Combatant = from;

                //Add the spawn to the list "spawns", needed for the boat decay timer and emerge timer
                gs.Spawnlist.Add(spawn);
            }

            //Start the emerge timer, so the boat doesn't just appear instantly on top of the water
            new EmergeTimer(gs.Itemlist, gs.Spawnlist).Start();

            Delete();
        }
Exemple #13
0
			public DigTimer( Mobile from, TreasureMap treasureMap, Point3D p, Map map, int z, ChestThemeType m_type) : base( TimeSpan.Zero, TimeSpan.FromSeconds( 1.0 ) )
			{
				
				m_From = from;
				m_TreasureMap = treasureMap;
				m_Map = map;
				m_Z = z;
				type = m_type;
				themed = m_TreasureMap.m_Themed;

				if (themed == false) themed = TreasureTheme.GetIsThemed(m_TreasureMap.Level);
					m_TreasureMap.m_Themed = themed;

				if(themed == true && type == ChestThemeType.None)
				{
					type = (ChestThemeType)TreasureTheme.GetThemeType(m_TreasureMap.Level); 
				}

				m_TreasureMap.m_type = type;
				m_Chest = new TreasureMapChest( from, m_TreasureMap.m_Level , themed, type );
				m_Chest.MoveToWorld( p, map );
				
				m_NextSkillTime = from.NextSkillTime;
				m_NextSpellTime = from.NextSpellTime;
				m_NextActionTime = from.NextActionTime;
				m_LastMoveTime = from.LastMoveTime;
			}
Exemple #14
0
        private void Fill(int level)
        {
            TrapType  = TrapType.ExplosionTrap;
            TrapPower = level * 25;
            TrapLevel = level;
            Locked    = true;

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

            case 2:
                RequiredSkill = 76;
                break;

            case 3:
                RequiredSkill = 84;
                break;

            case 4:
                RequiredSkill = 92;
                break;

            case 5:
                RequiredSkill = 100;
                break;

            case 6:
                RequiredSkill = 100;
                break;
            }

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

            DropItem(new Gold(level * 200));

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

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

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

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

                    RunicReforging.GenerateRandomItem(item, 0, min, max);

                    DropItem(item);
                    continue;
                }

                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);
                    }

                    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);
                    }

                    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);
                    }

                    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);

                    DropItem(item);
                }
            }

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

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

            DropItem(new TreasureMap(level + 1, (Siege.SiegeShard ?  Map.Felucca : Utility.RandomBool() ? Map.Felucca : Map.Trammel)));
        }
            protected override void OnTick()
            {
                m_Count++;

                m_From.RevealingAction();
                m_From.Direction = m_From.GetDirectionTo(m_Location);

                if (m_Count > 1 && m_Dirt1 == null)
                {
                    m_Dirt1 = new TreasureChestDirt();
                    m_Dirt1.MoveToWorld(m_Location, m_Map);

                    m_Dirt2 = new TreasureChestDirt();
                    m_Dirt2.MoveToWorld(new Point3D(m_Location.X, m_Location.Y - 1, m_Location.Z), m_Map);
                }

                if (m_Count == 3)
                {
                    m_Dirt1.Turn1();
                }
                else if (m_Count == 6)
                {
                    m_Dirt1.Turn2();
                    m_Dirt2.Turn2();
                }
                else if (m_Count > 6)
                {
                    if (m_Chest == null)
                    {
                        m_Chest = new TreasureMapChest(m_From, m_TreasureMap.Level, true);
                        m_Chest.MoveToWorld(new Point3D(m_Location.X, m_Location.Y, m_Location.Z - 15), m_Map);
                    }
                    else
                    {
                        m_Chest.Z++;
                    }

                    Effects.PlaySound(m_Chest, 0x33B);
                }

                if (m_Chest != null && m_Chest.Location.Z >= m_Location.Z)
                {
                    Stop();

                    m_Chest.Temporary = false;

                    int spawns;
                    switch (m_TreasureMap.Level)
                    {
                    case 0:
                        spawns = 3;
                        break;

                    case 1:
                        spawns = 0;
                        break;

                    default:
                        spawns = 4;
                        break;
                    }

                    m_From.SendAsciiMessage(0x44, "You unleash the treasure's guardians!");
                    m_From.SendAsciiMessage(0x44, "The chest will unlock when all guardians are destroyed.");

                    for (int i = 0; i < spawns; ++i)
                    {
                        BaseCreature bc = Spawn(m_TreasureMap.Level, m_Chest.Location, m_Chest.Map, null, true);

                        if (bc != null)
                        {
                            m_Chest.Guardians.Add(bc);
                        }
                    }

                    m_TreasureMap.Delete();
                }
                else
                {
                    new SoundTimer(m_From, 0x125 + m_Count % 2).Start();
                }
            }
Exemple #16
0
        public virtual void Fill()
        {
            List <Item> contains = new List <Item>(Items);

            foreach (Item i in contains)
            {
                i.Delete();
            }

            ColUtility.Free(contains);

            for (int i = 0; i < Utility.RandomMinMax(6, 12); i++)
            {
                DropItem(Loot.RandomGem());
            }

            DropItem(new Gold(Utility.RandomMinMax(800, 1100)));

            Item item = null;

            if (0.30 > Utility.RandomDouble())
            {
                switch (Utility.Random(7))
                {
                case 0:
                    item = new Bandage(Utility.Random(10, 30)); break;

                case 1:
                    item = new SmokeBomb(Utility.Random(3, 6));
                    break;

                case 2:
                    item = new InvisibilityPotion
                    {
                        Amount = Utility.Random(1, 3)
                    };
                    break;

                case 3:
                    item = new Lockpick(Utility.Random(1, 10)); break;

                case 4:
                    item = new DreadHornMane(Utility.Random(1, 2)); break;

                case 5:
                    item = new Corruption(Utility.Random(1, 2)); break;

                case 6:
                    item = new Taint(Utility.Random(1, 2)); break;
                }

                DropItem(item);
            }

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

            if (0.2 > Utility.RandomDouble())
            {
                switch (Utility.Random(3))
                {
                case 0:
                    item = new ZombiePainting(); break;

                case 1:
                    item = new SkeletonPortrait(); break;

                case 2:
                    item = new LichPainting(); break;
                }

                DropItem(item);
            }

            if (0.1 > Utility.RandomDouble())
            {
                item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(LootPackEntry.IsInTokuno(this), LootPackEntry.IsMondain(this), LootPackEntry.IsStygian(this));

                if (item != null)
                {
                    int min, max;

                    TreasureMapChest.GetRandomItemStat(out min, out max, 1.0);

                    RunicReforging.GenerateRandomItem(item, null, Utility.RandomMinMax(min, max), 0, ReforgedPrefix.None, ReforgedSuffix.Khaldun, Map);

                    DropItem(item);
                }
            }

            if (0.01 > Utility.RandomDouble())
            {
                switch (Utility.Random(4))
                {
                case 0:
                    item = new RelicOfHydros(); break;

                case 1:
                    item = new RelicOfLithos(); break;

                case 2:
                    item = new RelicOfPyros(); break;

                case 3:
                    item = new RelicOfStratos(); break;
                }

                DropItem(item);
            }
        }
Exemple #17
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.TrapLevel = level;
            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)
            {
                int amount = Utility.RandomMinMax(
                    (int)(((double)((level * 1000) / 3)) * .75),                             // min is 75% of MAX
                    (level * 1000) / 3);

                //int piles = level * 2;	// cool way but the players whined
                int piles = 1;                                          // sissy way

                // make several piles
                for (int ix = 0; ix < piles; ix++)
                {
                    cont.DropItem(new Gold(Utility.RandomMinMax(amount / piles - 10, amount / piles + 10)));
                }
            }


            // 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);
        }
Exemple #18
0
            protected override void OnTick()
            {
                if (this.m_NextSkillTime != this.m_From.NextSkillTime || this.m_NextSpellTime != this.m_From.NextSpellTime || this.m_NextActionTime != this.m_From.NextActionTime)
                {
                    this.Terminate();
                    return;
                }

                if (this.m_LastMoveTime != this.m_From.LastMoveTime)
                {
                    this.m_From.SendLocalizedMessage(503023); // You cannot move around while digging up treasure. You will need to start digging anew.
                    this.Terminate();
                    return;
                }

                int z      = (this.m_Chest != null) ? this.m_Chest.Z + this.m_Chest.ItemData.Height : int.MinValue;
                int height = 16;

                if (z > this.m_Location.Z)
                {
                    height -= (z - this.m_Location.Z);
                }
                else
                {
                    z = this.m_Location.Z;
                }

                if (!this.m_Map.CanFit(this.m_Location.X, this.m_Location.Y, z, height, true, true, false))
                {
                    this.m_From.SendLocalizedMessage(503024); // You stop digging because something is directly on top of the treasure chest.
                    this.Terminate();
                    return;
                }

                this.m_Count++;

                this.m_From.RevealingAction();
                this.m_From.Direction = this.m_From.GetDirectionTo(this.m_Location);

                if (this.m_Count > 1 && this.m_Dirt1 == null)
                {
                    this.m_Dirt1 = new TreasureChestDirt();
                    this.m_Dirt1.MoveToWorld(this.m_Location, this.m_Map);

                    this.m_Dirt2 = new TreasureChestDirt();
                    this.m_Dirt2.MoveToWorld(new Point3D(this.m_Location.X, this.m_Location.Y - 1, this.m_Location.Z), this.m_Map);
                }

                if (this.m_Count == 5)
                {
                    this.m_Dirt1.Turn1();
                }
                else if (this.m_Count == 10)
                {
                    this.m_Dirt1.Turn2();
                    this.m_Dirt2.Turn2();
                }
                else if (this.m_Count > 10)
                {
                    if (this.m_Chest == null)
                    {
                        this.m_Chest = new TreasureMapChest(this.m_From, this.m_TreasureMap.Level, true);
                        this.m_Chest.MoveToWorld(new Point3D(this.m_Location.X, this.m_Location.Y, this.m_Location.Z - 15), this.m_Map);
                    }
                    else
                    {
                        this.m_Chest.Z++;
                    }

                    Effects.PlaySound(this.m_Chest, this.m_Map, 0x33B);
                }

                if (this.m_Chest != null && this.m_Chest.Location.Z >= this.m_Location.Z)
                {
                    this.Stop();
                    this.m_From.EndAction(typeof(TreasureMap));

                    this.m_Chest.Temporary         = false;
                    this.m_TreasureMap.Completed   = true;
                    this.m_TreasureMap.CompletedBy = this.m_From;

                    int spawns;
                    switch (this.m_TreasureMap.Level)
                    {
                    case 0:
                        spawns = 3;
                        break;

                    case 1:
                        spawns = 0;
                        break;

                    default:
                        spawns = 4;
                        break;
                    }

                    for (int i = 0; i < spawns; ++i)
                    {
                        BaseCreature bc = Spawn(this.m_TreasureMap.Level, this.m_Chest.Location, this.m_Chest.Map, null, true);

                        if (bc != null)
                        {
                            this.m_Chest.Guardians.Add(bc);
                        }
                    }
                }
                else
                {
                    if (this.m_From.Body.IsHuman && !this.m_From.Mounted)
                    {
                        this.m_From.Animate(11, 5, 1, true, false, 0);
                    }

                    new SoundTimer(this.m_From, 0x125 + (this.m_Count % 2)).Start();
                }
            }
Exemple #19
0
        protected virtual void EndLockpick(object state)
        {
            object[]      objs         = (object[])state;
            ILockpickable lockpickable = objs[0] as ILockpickable;
            Mobile        from         = objs[1] as Mobile;

            Item item = (Item)lockpickable;

            if (!from.InRange(item.GetWorldLocation(), 1))
            {
                return;
            }

            if (lockpickable.LockLevel == 0 || lockpickable.LockLevel == -255)
            {
                // LockLevel of 0 means that the door can't be picklocked
                // LockLevel of -255 means it's magic locked
                item.SendLocalizedMessageTo(from, 502073); // This lock cannot be picked by normal means
                return;
            }

            if (from.Skills[SkillName.Lockpicking].Value < lockpickable.RequiredSkill - SkillBonus)
            {
                /*
                 * // Do some training to gain skills
                 * from.CheckSkill( SkillName.Lockpicking, 0, lockpickable.LockLevel );*/
                // The LockLevel is higher thant the LockPicking of the player
                item.SendLocalizedMessageTo(from, 502072); // You don't see how that lock can be manipulated.
                return;
            }

            int maxlevel = lockpickable.MaxLockLevel;
            int minLevel = lockpickable.LockLevel;

            if (lockpickable is Skeletonkey)
            {
                minLevel -= SkillBonus;
                maxlevel -= SkillBonus; //regulars subtract the bonus from the max level
            }

            if (this is MasterSkeletonKey || from.CheckTargetSkill(SkillName.Lockpicking, lockpickable, minLevel, maxlevel))
            {
                // Success! Pick the lock!
                OnUse();

                item.SendLocalizedMessageTo(from, 502076); // The lock quickly yields to your skill.
                from.PlaySound(0x4A);
                lockpickable.LockPick(from);
            }
            else
            {
                // The player failed to pick the lock
                BrokeLockPickTest(from);
                item.SendLocalizedMessageTo(from, 502075); // You are unable to pick the lock.

                if (item is TreasureMapChest)
                {
                    TreasureMapChest chest = (TreasureMapChest)item;

                    if (TreasureMapInfo.NewSystem)
                    {
                        if (!chest.FailedLockpick)
                        {
                            chest.FailedLockpick = true;
                        }
                    }
                    else if (chest.Items.Count > 0 && 0.25 > Utility.RandomDouble())
                    {
                        Item toBreak = chest.Items[Utility.Random(chest.Items.Count)];

                        if (!(toBreak is Container))
                        {
                            toBreak.Delete();
                            Effects.PlaySound(item.Location, item.Map, 0x1DE);
                            from.SendMessage(0x20, "The sound of gas escaping is heard from the chest.");
                        }
                    }
                }
            }
        }