public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 2:
            {
                IsThemed = reader.ReadBool();
                m_type   = (ChestThemeType)reader.ReadInt();
                goto case 1;
            }

            case 1:
            {
                m_Owner = reader.ReadMobile();

                goto case 0;
            }

            case 0:
            {
                m_Level      = reader.ReadInt();
                m_DeleteTime = reader.ReadDeltaTime();
                m_Lifted     = reader.ReadItemList();

                m_Timer = new DeleteTimer(this, m_DeleteTime);
                m_Timer.Start();

                break;
            }
            }
        }
Example #2
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;
            }
Example #3
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_Themed = reader.ReadBool();
                m_type   = (ChestThemeType)reader.ReadInt();
                goto case 0;
            }

            case 0:
            {
                m_Level     = (int)reader.ReadInt();
                m_Completed = reader.ReadBool();
                m_Decoder   = reader.ReadMobile();
                m_Map       = reader.ReadMap();
                m_Location  = reader.ReadPoint2D();

                break;
            }
            }
            if (version < 1)
            {
                m_Themed = false;
                m_type   = ChestThemeType.None;
            }
        }
Example #4
0
        public TreasureMap(int level, Map map, bool themed, ChestThemeType type)
        {
            m_Level  = level;
            m_Map    = map;
            m_Themed = themed;
            m_type   = type;

            Setup();
        }
Example #5
0
        public TreasureMap(int level, Map map, bool themed, ChestThemeType type)
        {
            m_Level    = level;
            m_Map      = map;
            m_Location = GetRandomLocation();
            m_Themed   = themed;
            m_type     = type;

            Width  = 300;
            Height = 300;

            int width  = 600;
            int height = 600;

            int x1 = m_Location.X - Utility.RandomMinMax(width / 4, (width / 4) * 3);
            int y1 = m_Location.Y - Utility.RandomMinMax(height / 4, (height / 4) * 3);

            if (x1 < 0)
            {
                x1 = 0;
            }

            if (y1 < 0)
            {
                y1 = 0;
            }

            int x2 = x1 + width;
            int y2 = y1 + height;

            if (x2 >= 5120)
            {
                x2 = 5119;
            }

            if (y2 >= 4096)
            {
                y2 = 4095;
            }

            x1 = x2 - width;
            y1 = y2 - height;

            Bounds = new Rectangle2D(x1, y1, width, height);

            //if for ocllo hue map for pansy thunters :)
            //if( m_Location.X >= 3304 && m_Location.Y >= 2340 && m_Location.X < 3845 && m_Location.Y < 2977)
            //Hue = 0x90;

            Protected = true;

            AddWorldPin(m_Location.X, m_Location.Y);
        }
Example #6
0
 //returns string to send to player when chest is dug
 public static string GetThemeMessage(ChestThemeType type)
 {
     if ((int)type >= 0 && (int)type < ThemeMessages.Length)
     {
         try
         {
             return(ThemeMessages[(int)type]);
         }
         catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }
     }
     return(null);
 }
        public TreasureMapChest(Mobile owner, int level, bool themed, ChestThemeType type) : base(0xE41)
        {
            m_Owner      = owner;
            m_Level      = level;
            IsThemed     = themed;
            m_type       = type;
            m_DeleteTime = DateTime.Now + TimeSpan.FromHours(3.0);

            m_Timer = new DeleteTimer(this, m_DeleteTime);
            m_Timer.Start();

            Fill(this, level, IsThemed, type);
        }
Example #8
0
        //Begin Spawn mechanics based on level and if themed and theme type
        private static BaseCreature Spawn(int level, bool IsThemed, ChestThemeType theme, bool guardian)
        {
            //handle standered spawn levels based on chest level
            if (IsThemed == false && level >= 0 && level < StanderedTypes.Length)
            {
                try
                {
                    return((BaseCreature)Activator.CreateInstance(StanderedTypes[level][Utility.Random(StanderedTypes[level].Length)]));
                }
                catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }
            }

            //handle ThemeSpawns depending on themeType
            if (IsThemed == true && theme >= 0 && (int)theme < ThemeTypes.Length)
            {
                try
                {
                    //if not a special case chest spawn random creatures based on list
                    if (guardian == false)
                    {
                        return((BaseCreature)Activator.CreateInstance(ThemeTypes[(int)theme][Utility.Random(ThemeTypes[(int)theme].Length)]));
                    }
                    if (guardian == true)
                    {
                        //begin special case check for iob themed chests to not spawn level 5 mobs dureing initial guardian spawn.
                        if (theme == ChestThemeType.Undead)
                        {
                            return((BaseCreature)Activator.CreateInstance(ThemeTypes[(int)theme][Utility.RandomMinMax(2, 4)]));
                        }
                        if (theme == ChestThemeType.Pirate)
                        {
                            return((BaseCreature)Activator.CreateInstance(ThemeTypes[(int)theme][Utility.RandomMinMax(1, 3)]));
                        }
                    }
                    else
                    {
                        //if guardian is true but not of above type return random based monster
                        return((BaseCreature)Activator.CreateInstance(ThemeTypes[(int)theme][Utility.Random(ThemeTypes[(int)theme].Length)]));
                    }
                }
                catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }
            }
            return(null);
        }
Example #9
0
        //spawns strongest mob in given theme based on spot 0 in  creature list or 0/1 for undead theme
        public static BaseCreature SpawnHighestMob(ChestThemeType theme)
        {
            switch (theme)
            {
            default: break;

            case ChestThemeType.Undead:
            {
                int random = Utility.Random(1);
                return((BaseCreature)Activator.CreateInstance(ThemeTypes[(int)theme][random]));
            }

            case ChestThemeType.Pirate:
            {
                return((BaseCreature)Activator.CreateInstance(ThemeTypes[(int)theme][0]));
            }
            }
            return(null);
        }
Example #10
0
        public static int GetGuardianSpawn(bool IsThemed, ChestThemeType theme)
        {
            int NormalGuardians = 4;             // spawns 4 guardians as if a normal chest
            int ThemeGuardians;

            if (theme == ChestThemeType.Pirate || theme == ChestThemeType.Undead)
            {
                ThemeGuardians = 5;                 //spawns 5 guardians if is a themed chest of above type because special case of spawning 1 highlevel mob
            }
            else
            {
                ThemeGuardians = 6;
            }

            if (IsThemed == true)
            {
                return(ThemeGuardians);
            }
            return(NormalGuardians);
        }
Example #11
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 1:
 				{
 				m_Themed = reader.ReadBool();
 				m_type = (ChestThemeType)reader.ReadInt();
 				goto case 0;
 				}
	
				case 0:
				{
					m_Level = (int)reader.ReadInt();
					m_Completed = reader.ReadBool();
					m_Decoder = reader.ReadMobile();
					m_Map = reader.ReadMap();
					m_Location = reader.ReadPoint2D();

					break;
				}
			}
			if ( version < 1)
			{
 			m_Themed = false;
 			m_type = ChestThemeType.None;
 			}
		}
Example #12
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;
			}
Example #13
0
		public TreasureMap(int level, Map map, bool themed, ChestThemeType type) 
		{
			m_Level = level;
			m_Map = map;
			m_Location = GetRandomLocation();
			m_Themed = themed;
			m_type = type;

			Width = 300;
			Height = 300;

			int width = 600;
			int height = 600;

			int x1 = m_Location.X - Utility.RandomMinMax( width / 4, (width / 4) * 3 );
			int y1 = m_Location.Y - Utility.RandomMinMax( height / 4, (height / 4) * 3 );

			if ( x1 < 0 )
				x1 = 0;

			if ( y1 < 0 )
				y1 = 0;

			int x2 = x1 + width;
			int y2 = y1 + height;

			if ( x2 >= 5120 )
				x2 = 5119;

			if ( y2 >= 4096 )
				y2 = 4095;

			x1 = x2 - width;
			y1 = y2 - height;

			Bounds = new Rectangle2D( x1, y1, width, height );
			
			//if for ocllo hue map for pansy thunters :)
			//if( m_Location.X >= 3304 && m_Location.Y >= 2340 && m_Location.X < 3845 && m_Location.Y < 2977)
				//Hue = 0x90;
	
			Protected = true;

			AddWorldPin( m_Location.X, m_Location.Y );
		}
Example #14
0
		public TreasureMap( int level, Map map, ChestThemeType type) : this(level, map, true, type )
		{
		}
        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);
        }
        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
        }
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
                case 2:
                {
                    IsThemed = reader.ReadBool();
                    m_type = (ChestThemeType)reader.ReadInt();
                    goto case 1;
                }

				case 1:
				{
					m_Owner = reader.ReadMobile();

					goto case 0;
				}
				case 0:
				{
					m_Level = reader.ReadInt();
					m_DeleteTime = reader.ReadDeltaTime();
					m_Lifted = reader.ReadItemList();

					m_Timer = new DeleteTimer( this, m_DeleteTime );
					m_Timer.Start();

					break;
				}
			}
		}
Example #18
0
 public TreasureMap(int level, Map map, ChestThemeType type) : this(level, map, true, type)
 {
 }
Example #19
0
		//spawns strongest mob in given theme based on spot 0 in  creature list or 0/1 for undead theme
		public static BaseCreature SpawnHighestMob(ChestThemeType theme)
		{
			switch (theme)
			{
				default: break;
				case ChestThemeType.Undead:
				{
					int random = Utility.Random(1);
					return (BaseCreature)Activator.CreateInstance( ThemeTypes[(int)theme][random]); 
				}

				case ChestThemeType.Pirate:
				{
					return (BaseCreature)Activator.CreateInstance( ThemeTypes[(int)theme][0]);
				}
	
			}
			return null;
		}
		public TreasureMapChest( Mobile owner, int level, bool themed ,ChestThemeType type) : base( 0xE41 )
		{
			m_Owner = owner;
			m_Level = level;
			IsThemed = themed;
			m_type = type;
			m_DeleteTime = DateTime.Now + TimeSpan.FromHours( 3.0 );

			m_Timer = new DeleteTimer( this, m_DeleteTime );
			m_Timer.Start();

			Fill( this, level, IsThemed, type );
		}
Example #21
0
 public static bool IsOverlandTheme(ChestThemeType theme)
 {
     return((int)theme >= (int)ChestThemeType.Lizardmen && (int)theme <= (int)ChestThemeType.FrostTroll);
 }
		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);
		}
Example #23
0
		//returns string to send to player when chest is dug
		public static string GetThemeMessage(ChestThemeType type)
		{ 
			if ((int)type >= 0 && (int)type < ThemeMessages.Length ) 
			{
				try
				{
					return ThemeMessages[(int)type ];
				}
				catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }
			}
			return null;
		}
Example #24
0
		public static int GetGuardianSpawn(bool IsThemed, ChestThemeType theme)
		{
			int NormalGuardians = 4; // spawns 4 guardians as if a normal chest
			int ThemeGuardians;

			if(theme == ChestThemeType.Pirate || theme == ChestThemeType.Undead)
			{
				ThemeGuardians = 5; //spawns 5 guardians if is a themed chest of above type because special case of spawning 1 highlevel mob
			}
			else
				ThemeGuardians = 6;

			if (IsThemed == true) return  ThemeGuardians;
			return NormalGuardians;
		}
		public TreasureMapChest( int level, ChestThemeType type ) : this( null, level, true, type )
		{
		}
Example #26
0
		//Begin Spawn mechanics based on level and if themed and theme type
		private static BaseCreature Spawn( int level, bool IsThemed, ChestThemeType theme, bool guardian )
		{
			//handle standered spawn levels based on chest level
			if (IsThemed == false &&  level >= 0 && level < StanderedTypes.Length )
			{
				try
				{
					return (BaseCreature)Activator.CreateInstance( StanderedTypes[level][Utility.Random( StanderedTypes[level].Length )] );
				}
				catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }
			}

			//handle ThemeSpawns depending on themeType
			if (IsThemed == true &&  theme >= 0 && (int)theme < ThemeTypes.Length )
			{
				try
				{
					//if not a special case chest spawn random creatures based on list
					if(guardian == false)
					{ 
						return (BaseCreature)Activator.CreateInstance( ThemeTypes[(int)theme][Utility.Random( ThemeTypes[(int)theme].Length )] );
					}
					if(guardian == true)
					{
						//begin special case check for iob themed chests to not spawn level 5 mobs dureing initial guardian spawn.
						if(theme == ChestThemeType.Undead) return (BaseCreature)Activator.CreateInstance(ThemeTypes[(int)theme][Utility.RandomMinMax(2,4) ]) ;
						if(theme == ChestThemeType.Pirate) return (BaseCreature)Activator.CreateInstance(ThemeTypes[(int)theme][Utility.RandomMinMax(1,3) ]) ;
					}
					else
					{
						//if guardian is true but not of above type return random based monster
						return (BaseCreature)Activator.CreateInstance(ThemeTypes[(int)theme][Utility.Random(ThemeTypes[(int)theme].Length) ]) ;
					}
				}
				catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }
			}
			return null;
		}
		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

		}
Example #28
0
        //Main spawn generation function called from any item that needs to generate treasure type spawn.
        public static void Spawn(int level, Point3D p, Map map, Mobile target, bool IsThemed, ChestThemeType theme, bool guardian, bool guardian2)
        {
            //bool guardian is designator for if theme type has special spawn mechanics and thus does not spawn its highest mobs at random
            //guardian2 is second flag indicateing to spawn highest mob.
            if (map == null)
            {
                return;
            }
            BaseCreature c = null;

            if (guardian == false)
            {
                c = Spawn(level, IsThemed, theme, guardian);
            }
            if (guardian == true && guardian2 == false)
            {
                c = Spawn(level, IsThemed, theme, true);
            }
            if (guardian == true && guardian2 == true)
            {
                c = SpawnHighestMob(theme);
            }
            if (c != null)
            {
                c.Home      = p;
                c.RangeHome = 8;

                bool spawned = false;

                for (int i = 0; !spawned && i < 10; ++i)
                {
                    int x = p.X - 3 + Utility.Random(7);
                    int y = p.Y - 3 + Utility.Random(7);

                    if (map.CanSpawnMobile(x, y, p.Z))
                    {
                        c.MoveToWorld(new Point3D(x, y, p.Z), map);
                        spawned = true;
                    }
                    else
                    {
                        int z = map.GetAverageZ(x, y);

                        if (map.CanSpawnMobile(x, y, z))
                        {
                            c.MoveToWorld(new Point3D(x, y, z), map);
                            spawned = true;
                        }
                    }
                }

                if (!spawned)
                {
                    c.Delete();
                }
                else if (target != null)
                {
                    c.Combatant = target;
                }
            }
        }
Example #29
0
		//Main spawn generation function called from any item that needs to generate treasure type spawn.
		public static void Spawn( int level, Point3D p, Map map, Mobile target, bool IsThemed, ChestThemeType theme, bool guardian, bool guardian2)
		{
			//bool guardian is designator for if theme type has special spawn mechanics and thus does not spawn its highest mobs at random
			//guardian2 is second flag indicateing to spawn highest mob.
			if ( map == null )
				return;
			BaseCreature c = null;
			if(guardian == false) c = Spawn( level, IsThemed, theme, guardian ); 
			if(guardian == true && guardian2 == false) c = Spawn( level, IsThemed, theme, true ); 
			if(guardian == true && guardian2 == true) c = SpawnHighestMob(theme);
			if ( c != null )
			{
				c.Home = p;
				c.RangeHome = 8;

				bool spawned = false;

				for ( int i = 0; !spawned && i < 10; ++i )
				{
					int x = p.X - 3 + Utility.Random( 7 );
					int y = p.Y - 3 + Utility.Random( 7 );

					if ( map.CanSpawnMobile( x, y, p.Z ) )
					{
						c.MoveToWorld( new Point3D( x, y, p.Z ), map );
						spawned = true;
					}
					else
					{
						int z = map.GetAverageZ( x, y );

						if ( map.CanSpawnMobile( x, y, z ) )
						{
							c.MoveToWorld( new Point3D( x, y, z ), map );
							spawned = true;
						}
					}
				}

				if ( !spawned )
					c.Delete();
				else if ( target != null )
					c.Combatant = target;
			}
		}
Example #30
0
		public static bool IsOverlandTheme(ChestThemeType theme)
		{
			return ( (int)theme >= (int)ChestThemeType.Lizardmen && (int)theme <= (int)ChestThemeType.FrostTroll );
		}
 public TreasureMapChest(int level, ChestThemeType type) : this(null, level, true, type)
 {
 }