Пример #1
0
        public TrChest4() : base(0xE43)
        {
            int rndm = Utility.Random(21);

            if (rndm < 6)
            {
                TrLvl = TreasureLevel.Level1;
            }
            else if (rndm < 11)
            {
                TrLvl = TreasureLevel.Level2;
            }
            else if (rndm < 15)
            {
                TrLvl = TreasureLevel.Level3;
            }
            else if (rndm < 18)
            {
                TrLvl = TreasureLevel.Level4;
            }
            else if (rndm < 20)
            {
                TrLvl = TreasureLevel.Level5;
            }
            else
            {
                TrLvl = TreasureLevel.Level6;
            }

            this.Level = TrLvl;
            SetLockLevel();
            GenerateTreasure();
        }
Пример #2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_IsTrapable = reader.ReadBool();
                m_TrapChance = reader.ReadInt();
                goto case 0;
            }

            case 0:
            {
                m_TreasureLevel = (TreasureLevel)reader.ReadByte();
                m_MinSpawnTime  = reader.ReadShort();
                m_MaxSpawnTime  = reader.ReadShort();
                break;
            }
            }

            StartResetTimer();
        }
		public BaseTreasureChest( int itemID, TreasureLevel level ) : base( itemID )
		{
			m_TreasureLevel = level;
			Locked = true;
			Movable = false;

			SetLockLevel();
			GenerateTreasure();
		}
Пример #4
0
        public BaseTreasureChest(int itemID, TreasureLevel level) : base(itemID)
        {
            this.m_TreasureLevel = level;
            this.Locked          = true;
            this.Movable         = false;

            this.SetLockLevel();
            this.GenerateTreasure();
        }
Пример #5
0
        public BaseTreasureChest(int itemID, TreasureLevel level) : base(itemID)
        {
            m_TreasureLevel = level;
            Locked          = true;
            Movable         = false;

            SetLockLevel();
            GenerateTreasure();
        }
Пример #6
0
        public BaseTreasureChest(int itemID, TreasureLevel level)
            : base(itemID)
        {
            this.m_TreasureLevel = level;
            this.Locked = true;
            this.Movable = false;

            this.SetLockLevel();
            this.GenerateTreasure();
        }
Пример #7
0
        public BaseTreasureChest( int itemID )
            : base(itemID)
        {
            m_TreasureLevel = TreasureLevel.Level2;
            Locked = true;
            Movable = false;
            SetLockedName();

            SetLockLevel();
            GenerateTreasure();
        }
        public BaseTreasureChest(int itemID) : base(itemID)
        {
            m_TreasureLevel = TreasureLevel.Level2;
            Locked          = true;
            Movable         = false;
            SetLockedName();
            Enabled = true;

            SetLockLevel();
            GenerateTreasure();
        }
Пример #9
0
    public BaseTreasureChest(int itemID, TreasureLevel level = TreasureLevel.Level2) : base(itemID)
    {
        _level        = level;
        _minSpawnTime = TimeSpan.FromMinutes(10);
        _maxSpawnTime = TimeSpan.FromMinutes(60);

        Locked  = true;
        Movable = false;

        SetLockLevel();
        GenerateTreasure();
    }
Пример #10
0
        public BaseTreasureChest( int itemID )
            : base(itemID)
        {
            m_TreasureLevel = TreasureLevel.Level2;
            Locked = true;
            Movable = false;

            Key key = (Key)FindItemByType( typeof(Key) );

            if( key != null )
                key.Delete();

            SetLockLevel();
            GenerateTreasure();
        }
Пример #11
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            m_TreasureLevel = (TreasureLevel)reader.ReadByte();
            m_MinSpawnTime  = reader.ReadShort();
            m_MaxSpawnTime  = reader.ReadShort();

            if (!Locked)
            {
                StartResetTimer();
            }
        }
Пример #12
0
        public BaseTreasureChest(int itemID) : base(itemID)
        {
            m_TreasureLevel = TreasureLevel.Level2;
            Locked          = true;
            Movable         = false;

            Key key = (Key)FindItemByType(typeof(Key));

            if (key != null)
            {
                key.Delete();
            }

            SetLockLevel();
            GenerateTreasure();
        }
Пример #13
0
        public TrChest3() : base(0xE41)
        {
            int rndm = Utility.Random(3);

            if (rndm < 2)
            {
                TrLvl = TreasureLevel.Level5;
            }
            else
            {
                TrLvl = TreasureLevel.Level6;
            }

            this.Level = TrLvl;
            SetLockLevel();
            GenerateTreasure();
        }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            //Version 1
            if (version >= 1)
            {
                m_TreasureLevel = (TreasureLevel)reader.ReadByte();
                m_MinSpawnTime  = Math.Max(reader.ReadShort(), (short)s_AbsoluteMinSpawntime);
                m_MaxSpawnTime  = reader.ReadShort();
            }

            if (!Locked)
            {
                StartResetTimer();
            }
        }
Пример #15
0
        public BaseTreasureChest(int itemID) : base(itemID)
        {
            m_TreasureLevel = TreasureLevel.Level2;
            Locked          = true;
            Movable         = false;
            SetLockedName();

            Key key = (Key)FindItemByType(typeof(Key));

            if (key != null)
            {
                key.Delete();
            }

            if (this is WoodenTreasureChest || this is MetalTreasureChest || this is MetalGoldenTreasureChest)
            {
                SetLockLevel();
                GenerateTreasure();
            }
        }
Пример #16
0
        public TrChest2() : base(0x9AB)
        {
            int rndm = Utility.Random(6);

            if (rndm < 3)
            {
                TrLvl = TreasureLevel.Level3;
            }
            else if (rndm < 5)
            {
                TrLvl = TreasureLevel.Level4;
            }
            else
            {
                TrLvl = TreasureLevel.Level5;
            }

            this.Level = TrLvl;
            SetLockLevel();
            GenerateTreasure();
        }
Пример #17
0
		public SpawnTreasureChest( int itemID, TreasureLevel level ) : base( typeof( BaseTreasureChest ) )
		{
			m_ItemID = itemID;
			m_Level = level;
		}
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			m_TreasureLevel = (TreasureLevel)reader.ReadByte();
			m_MinSpawnTime = reader.ReadShort();
			m_MaxSpawnTime = reader.ReadShort();

			if( !Locked )
				StartResetTimer();
		}
Пример #19
0
        public static SpawnDefinition GetSpawnDefinition(XmlElement xml)
        {
            switch (xml.Name)
            {
            case "object":
            {
                Type type = null;
                if (!Region.ReadType(xml, "type", ref type))
                {
                    return(null);
                }

                if (typeof(Mobile).IsAssignableFrom(type))
                {
                    return(SpawnMobile.Get(type));
                }
                else if (typeof(Item).IsAssignableFrom(type))
                {
                    return(SpawnItem.Get(type));
                }
                else
                {
                    Console.WriteLine("Invalid type '{0}' in a SpawnDefinition", type.FullName);
                    return(null);
                }
            }

            case "group":
            {
                string group = null;
                if (!Region.ReadString(xml, "name", ref group))
                {
                    return(null);
                }

                SpawnDefinition def = (SpawnDefinition)SpawnGroup.Table[group];

                if (def == null)
                {
                    Console.WriteLine("Could not find group '{0}' in a SpawnDefinition", group);
                    return(null);
                }
                else
                {
                    return(def);
                }
            }

            case "treasureChest":
            {
                int itemID = 0xE43;
                Region.ReadInt32(xml, "itemID", ref itemID, false);

                TreasureLevel level = TreasureLevel.Level2;

                Region.ReadEnum(xml, "level", ref level, false);

                return(new SpawnTreasureChest(itemID, level));
            }

            default:
            {
                return(null);
            }
            }
        }
Пример #20
0
 public SpawnTreasureChest(int itemID, TreasureLevel level) : base(typeof(BaseTreasureChest))
 {
     m_ItemID = itemID;
     m_Level  = level;
 }
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 1:
                {
                    m_IsTrapable = reader.ReadBool();
                    m_TrapChance = reader.ReadInt();
                    goto case 0;
                }
                case 0:
                {
                    m_TreasureLevel = (TreasureLevel)reader.ReadByte();
                    m_MinSpawnTime = reader.ReadShort();
                    m_MaxSpawnTime = reader.ReadShort();
                    break;
                }
            }

            StartResetTimer();
        }