Ejemplo n.º 1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 3:
            {
                m_LightLevel = reader.ReadInt();
                goto case 2;
            }

            case 2:
            {
                m_Music = (MusicName)reader.ReadInt();
                goto case 1;
            }

            case 1:
            {
                Coords              = ReadRect2DArray(reader);
                m_Priority          = (CustomRegionPriority)reader.ReadInt();
                m_PlayerLogoutDelay = reader.ReadTimeSpan();

                m_RestrictedSpells = ReadBitArray(reader);
                m_RestrictedSkills = ReadBitArray(reader);

                m_Flags = (RegionFlag)reader.ReadInt();

                m_RegionName = reader.ReadString();
                break;
            }

            case 0:
            {
                Coords = new ArrayList();

                Coords.Add(reader.ReadRect2D());
                m_RestrictedSpells = ReadBitArray(reader);
                m_RestrictedSkills = ReadBitArray(reader);

                m_Flags = (RegionFlag)reader.ReadInt();

                m_RegionName = reader.ReadString();
                break;
            }
            }

            UpdateRegion();
        }
Ejemplo n.º 2
0
        public RegionControl() : base(5609)
        {
            Visible      = false;
            Movable      = false;
            Name         = "Region Controller";
            m_RegionName = "Custom Region";
            m_Priority   = CustomRegionPriority.HighPriority;

            m_RestrictedSpells = new BitArray(SpellRegistry.Types.Length);
            m_RestrictedSkills = new BitArray(SkillInfo.Table.Length);

            Coords = new ArrayList();
            UpdateRegion();
        }
Ejemplo n.º 3
0
        public RegionControl(Rectangle2D rect)
            : base(3026)
        {
            Coords          = new ArrayList();
            InnBounds       = new ArrayList();
            RestrictedTypes = new ArrayList();

            Coords.Add(rect);

            m_RestrictedSpells = new BitArray(SpellRegistry.Types.Length);
            m_RestrictedSkills = new BitArray(SkillInfo.Table.Length);

            Visible              = false;
            Movable              = false;
            Enabled              = true;
            Name                 = "Region Controller";
            m_RegionName         = "Custom Region";
            m_RestrictedMagicMsg = null;
            m_Priority           = CustomRegionPriority.HighPriority;
            m_Music              = MusicName.Invalid;
            UpdateRegion();
        }
Ejemplo n.º 4
0
        public void CloneFromRegionObject(Region r, bool loadedFromXML)
        {
            if (r != null)
            {
                //Clear flags before copy
                m_Flags = RegionFlag.None;

                // if we have a custom region, get this special bits
                if (r is CustomRegion)
                {
                    DupeCustomBits(r);
                }

                if (r.Coords != null && r.Coords.Count > 0)
                {
                    m_Coords.Clear();
                    ArrayList c = r.Coords;

                    for (int i = 0; i < c.Count; i++)
                    {
                        if (c[i] is Rectangle2D)
                        {
                            m_Coords.Add((Rectangle2D)c[i]);
                        }
                        //plasma: add missing 3d rects lol!
                        if (c[i] is Rectangle3D)
                        {
                            m_Coords.Add((Rectangle3D)c[i]);
                        }
                    }
                }

                if (r.InnBounds != null && r.InnBounds.Count > 0)
                {
                    m_InnBounds.Clear();
                    ArrayList c = r.InnBounds;

                    for (int i = 0; i < c.Count; i++)
                    {
                        if (c[i] is Rectangle2D)
                        {
                            m_InnBounds.Add((Rectangle2D)c[i]);
                        }
                        if (c[i] is Rectangle3D)
                        {
                            m_InnBounds.Add((Rectangle3D)c[i]);
                        }
                    }
                }

                //default these to true for non custom regions
                this.SetFlag(RegionFlag.CanUsePotions, true);
                this.SetFlag(RegionFlag.CanRessurect, true);
                this.SetFlag(RegionFlag.CanUseStuckMenu, true);
                this.SetFlag(RegionFlag.IsHouseRegion, r is HouseRegion);
                this.SetFlag(RegionFlag.AllowTravelSpellsInRegion, !IsFeluccaDungeon(r, loadedFromXML) && !(r is AngelIsland || r.Name.Equals("AngelIsland")));
                //set guards and murder zone
                this.SetFlag(RegionFlag.IsGuarded, IsGuardedRegion(r, loadedFromXML));
                this.SetFlag(RegionFlag.NoMurderCounts, r.IsNoMurderZone);
                //Non custom regions only have a static InnLogoutDelay
                this.m_InnLogoutDelay = Region.InnLogoutDelay;
                //Blank the restricted spells / skills
                this.m_RestrictedSpells = new BitArray(SpellRegistry.Types.Length);
                this.m_RestrictedSkills = new BitArray(SkillInfo.Table.Length);

                //Assign generic props
                this.m_Priority = MapPriority(r.Priority);
                this.m_Music    = r.Music;
                this.SetFlag(RegionFlag.Music, (r.Music != MusicName.Invalid));
                this.m_RegionName = r.Name;
                this.m_TargetMap  = r.Map;

                // LightLevel - defualts to 0, use -1 for region to inherit and use light level/cycle across the world.
                if (this.m_LightLevel <= 0)
                {
                    this.m_LightLevel = -1;
                }

                // Dungeon - Setting to True will set the regions light level to that of the dungon light level, has no other effects.
                this.SetFlag(RegionFlag.IsDungeon, IsFeluccaDungeon(r, loadedFromXML));
                this.m_GoLocation = r.GoLocation;
                this.m_MaxZ       = r.MaxZ;
                this.m_MinZ       = r.MinZ;

                //Plasma:  Felucca dungeons and AI need recall and gate OFF!
                if (IsFeluccaDungeon(r, loadedFromXML) || r is AngelIsland || r.Name.Equals("AngelIsland"))
                {
                    NoGateInto   = true;
                    NoRecallInto = true;
                }

                UpdateRegion();
                this.SendMessage(String.Format("Region cloned from '" + r.Name + "'."));
            }
            else
            {
                this.SendMessage(String.Format("No region by the name '" + r.Name + "' found."));
            }
        }
Ejemplo n.º 5
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 14:
            {
                //version 14
                m_Coords    = ReadRect3DArray(reader);
                m_InnBounds = ReadRect3DArray(reader);
                goto case 13;
            }

            case 13:
            {
                m_TargetMap  = reader.ReadMap();
                m_GoLocation = reader.ReadPoint3D();
                m_MinZ       = reader.ReadInt();
                m_MaxZ       = reader.ReadInt();
                goto case 12;
            }

            case 12:
            {
                m_Enabled = reader.ReadBool();
                goto case 11;
            }

            case 11:
            {
                int size = reader.ReadInt();
                m_Types = new ArrayList(size);

                for (int i = 0; i < size; ++i)
                {
                    string typeName = reader.ReadString();
                    m_Types.Add(typeName);
                }
                goto case 10;
            }

            case 10:
            {
                m_MaxFollowers = reader.ReadInt();
                goto case 9;
            }

            case 9:
            {
                m_RestrictedMagicMsg = reader.ReadString();
                goto case 8;
            }

            case 8:
            {
                m_Music = (MusicName)reader.ReadInt();
                goto case 7;
            }

            case 7:
            {
                if (m_InnBounds == null)
                {
                    m_InnBounds = ReadRect2DArray(reader);
                }
                else
                {
                    m_InnBounds.AddRange(ReadRect2DArray(reader));
                }
                m_InnLogoutDelay = reader.ReadTimeSpan();

                goto case 6;
            }

            case 6:
            {
                m_PlayerLogoutDelay = reader.ReadTimeSpan();
                goto case 5;
            }

            case 5:
            {
                if (version < 13)
                {                                       // converted to a flag
                    bool m_IsDungeon = (bool)reader.ReadBool();
                    IsDungeon = m_IsDungeon;
                }
                goto case 4;
            }

            case 4:
            {
                m_IOBAlignment = (IOBAlignment)reader.ReadInt();
                goto case 3;
            }

            case 3:
            {
                m_LightLevel = reader.ReadInt();
                goto case 2;
            }

            case 2:
            {
                goto case 1;
            }

            case 1:
            {
                if (Coords == null)
                {
                    Coords = ReadRect2DArray(reader);
                }
                else
                {
                    Coords.AddRange(ReadRect2DArray(reader));
                }
                m_Priority = (CustomRegionPriority)reader.ReadInt();

                m_RestrictedSpells = ReadBitArray(reader);
                m_RestrictedSkills = ReadBitArray(reader);

                m_Flags = (RegionFlag)reader.ReadInt();

                m_RegionName = reader.ReadString();
                break;
            }

            case 0:
            {
                Coords = new ArrayList();

                Coords.Add(reader.ReadRect2D());
                m_RestrictedSpells = ReadBitArray(reader);
                m_RestrictedSkills = ReadBitArray(reader);

                m_Flags = (RegionFlag)reader.ReadInt();

                m_RegionName = reader.ReadString();
                break;
            }
            }
            if (version < 12)
            {
                m_Enabled = true;
            }

            if (version < 11)
            {
                m_Types = new ArrayList();
            }

            if (version < 8)
            {
                m_Music = MusicName.Invalid;
            }

            // fixup this table if Skills have been added or removed.
            if (SkillInfo.Table.Length != m_RestrictedSkills.Count)
            {
                BitArray temp          = new BitArray(SkillInfo.Table.Length);
                int      MaxIterations = Math.Min(temp.Length, m_RestrictedSkills.Count);
                for (int ix = 0; ix < MaxIterations; ix++)
                {
                    temp[ix] = m_RestrictedSkills[ix];
                }

                m_RestrictedSkills = temp;
            }

            // fixup this table if Spells have been added or removed.
            if (SpellRegistry.Types.Length != m_RestrictedSpells.Count)
            {
                BitArray temp          = new BitArray(SpellRegistry.Types.Length);
                int      MaxIterations = Math.Min(temp.Length, m_RestrictedSpells.Count);
                for (int ix = 0; ix < MaxIterations; ix++)
                {
                    temp[ix] = m_RestrictedSpells[ix];
                }

                m_RestrictedSkills = temp;
            }

            UpdateRegion();
        }
Ejemplo n.º 6
0
		public void CloneFromRegionObject(Region r, bool loadedFromXML)
		{
			if (r != null)
			{
				//Clear flags before copy
				m_Flags = RegionFlag.None;

				// if we have a custom region, get this special bits
				if (r is CustomRegion)
					DupeCustomBits(r);

				if (r.Coords != null && r.Coords.Count > 0)
				{
					m_Coords.Clear();
					ArrayList c = r.Coords;

					for (int i = 0; i < c.Count; i++)
					{
						if (c[i] is Rectangle2D)
							m_Coords.Add((Rectangle2D)c[i]);
						//plasma: add missing 3d rects lol!
						if (c[i] is Rectangle3D)
							m_Coords.Add((Rectangle3D)c[i]);
					}
				}

				if (r.InnBounds != null && r.InnBounds.Count > 0)
				{
					m_InnBounds.Clear();
					ArrayList c = r.InnBounds;

					for (int i = 0; i < c.Count; i++)
					{
						if (c[i] is Rectangle2D)
							m_InnBounds.Add((Rectangle2D)c[i]);
						if (c[i] is Rectangle3D)
							m_InnBounds.Add((Rectangle3D)c[i]);
					}
				}

				//default these to true for non custom regions
				this.SetFlag(RegionFlag.CanUsePotions, true);
				this.SetFlag(RegionFlag.CanRessurect, true);
				this.SetFlag(RegionFlag.CanUseStuckMenu, true);
				this.SetFlag(RegionFlag.IsHouseRegion, r is HouseRegion);
				this.SetFlag(RegionFlag.AllowTravelSpellsInRegion, !IsFeluccaDungeon(r,loadedFromXML) && !(r is AngelIsland || r.Name.Equals("AngelIsland"))) ;
				//set guards and murder zone
				this.SetFlag(RegionFlag.IsGuarded, IsGuardedRegion(r,loadedFromXML));
				this.SetFlag(RegionFlag.NoMurderCounts, r.IsNoMurderZone);
				//Non custom regions only have a static InnLogoutDelay
				this.m_InnLogoutDelay = Region.InnLogoutDelay;
				//Blank the restricted spells / skills
				this.m_RestrictedSpells = new BitArray(SpellRegistry.Types.Length);
				this.m_RestrictedSkills = new BitArray(SkillInfo.Table.Length);

				//Assign generic props						
				this.m_Priority = MapPriority(r.Priority);
				this.m_Music = r.Music;
				this.SetFlag(RegionFlag.Music, (r.Music != MusicName.Invalid));
				this.m_RegionName = r.Name;
				this.m_TargetMap = r.Map;

				// LightLevel - defualts to 0, use -1 for region to inherit and use light level/cycle across the world.            
				if (this.m_LightLevel <= 0)
					this.m_LightLevel = -1;

				// Dungeon - Setting to True will set the regions light level to that of the dungon light level, has no other effects.
				this.SetFlag(RegionFlag.IsDungeon, IsFeluccaDungeon(r,loadedFromXML));
				this.m_GoLocation = r.GoLocation;
				this.m_MaxZ = r.MaxZ;
				this.m_MinZ = r.MinZ;

				//Plasma:  Felucca dungeons and AI need recall and gate OFF!
				if (IsFeluccaDungeon(r, loadedFromXML) || r is AngelIsland || r.Name.Equals("AngelIsland"))
				{
					NoGateInto = true;
					NoRecallInto = true;
				}

				UpdateRegion();
				this.SendMessage(String.Format("Region cloned from '" + r.Name + "'."));
			}
			else
			{
				this.SendMessage(String.Format("No region by the name '" + r.Name + "' found."));
			}
		}
Ejemplo n.º 7
0
		public RegionControl(Rectangle2D rect)
			: base(3026)
		{
			Coords = new ArrayList();
			InnBounds = new ArrayList();
			RestrictedTypes = new ArrayList();

			Coords.Add(rect);

			m_RestrictedSpells = new BitArray(SpellRegistry.Types.Length);
			m_RestrictedSkills = new BitArray(SkillInfo.Table.Length);

			Visible = false;
			Movable = false;
			Enabled = true;
			Name = "Region Controller";
			m_RegionName = "Custom Region";
			m_RestrictedMagicMsg = null;
			m_Priority = CustomRegionPriority.HighPriority;
			m_Music = MusicName.Invalid;
			UpdateRegion();
		}
Ejemplo n.º 8
0
		public override void Deserialize(GenericReader reader)
		{
			base.Deserialize(reader);

			int version = reader.ReadInt();

			switch (version)
			{
				case 14:
					{
						//version 14
						m_Coords=ReadRect3DArray(reader);
						m_InnBounds=ReadRect3DArray(reader);
						goto case 13;
					}
				case 13:
					{
						m_TargetMap = reader.ReadMap();
						m_GoLocation = reader.ReadPoint3D();
						m_MinZ = reader.ReadInt();
						m_MaxZ = reader.ReadInt();
						goto case 12;
					}
				case 12:
					{
						m_Enabled = reader.ReadBool();
						goto case 11;
					}
				case 11:
					{
						int size = reader.ReadInt();
						m_Types = new ArrayList(size);

						for (int i = 0; i < size; ++i)
						{
							string typeName = reader.ReadString();
							m_Types.Add(typeName);

						}
						goto case 10;
					}

				case 10:
					{
						m_MaxFollowers = reader.ReadInt();
						goto case 9;
					}
				case 9:
					{
						m_RestrictedMagicMsg = reader.ReadString();
						goto case 8;
					}
				case 8:
					{
						m_Music = (MusicName)reader.ReadInt();
						goto case 7;
					}

				case 7:
					{
						if (m_InnBounds == null)
						{
							m_InnBounds = ReadRect2DArray(reader);
						}
						else
						{
							m_InnBounds.AddRange(ReadRect2DArray(reader));
						}
						m_InnLogoutDelay = reader.ReadTimeSpan();

						goto case 6;
					}
				case 6:
					{
						m_PlayerLogoutDelay = reader.ReadTimeSpan();
						goto case 5;
					}
				case 5:
					{
						if (version < 13)
						{	// converted to a flag
							bool m_IsDungeon = (bool)reader.ReadBool();
							IsDungeon = m_IsDungeon;
						}
						goto case 4;
					}
				case 4:
					{
						m_IOBAlignment = (IOBAlignment)reader.ReadInt();
						goto case 3;
					}

				case 3:
					{
						m_LightLevel = reader.ReadInt();
						goto case 2;
					}
				case 2:
					{
						goto case 1;
					}
				case 1:
					{
						if (Coords == null)
						{
							Coords = ReadRect2DArray(reader);
						}
						else
						{
							Coords.AddRange(ReadRect2DArray(reader));
						}
						m_Priority = (CustomRegionPriority)reader.ReadInt();

						m_RestrictedSpells = ReadBitArray(reader);
						m_RestrictedSkills = ReadBitArray(reader);

						m_Flags = (RegionFlag)reader.ReadInt();

						m_RegionName = reader.ReadString();
						break;
					}
				case 0:
					{
						Coords = new ArrayList();

						Coords.Add(reader.ReadRect2D());
						m_RestrictedSpells = ReadBitArray(reader);
						m_RestrictedSkills = ReadBitArray(reader);

						m_Flags = (RegionFlag)reader.ReadInt();

						m_RegionName = reader.ReadString();
						break;
					}
			}
			if (version < 12)
			{
				m_Enabled = true;
			}

			if (version < 11)
			{
				m_Types = new ArrayList();
			}

			if (version < 8)
			{
				m_Music = MusicName.Invalid;
			}

			// fixup this table if Skills have been added or removed.
			if (SkillInfo.Table.Length != m_RestrictedSkills.Count)
			{
				BitArray temp = new BitArray(SkillInfo.Table.Length);
				int MaxIterations = Math.Min(temp.Length, m_RestrictedSkills.Count);
				for (int ix = 0; ix < MaxIterations; ix++)
					temp[ix] = m_RestrictedSkills[ix];

				m_RestrictedSkills = temp;
			}

			// fixup this table if Spells have been added or removed.
			if (SpellRegistry.Types.Length != m_RestrictedSpells.Count)
			{
				BitArray temp = new BitArray(SpellRegistry.Types.Length);
				int MaxIterations = Math.Min(temp.Length, m_RestrictedSpells.Count);
				for (int ix = 0; ix < MaxIterations; ix++)
					temp[ix] = m_RestrictedSpells[ix];

				m_RestrictedSkills = temp;
			}

			UpdateRegion();

		}
Ejemplo n.º 9
0
        public RegionControl( Rectangle2D rect )
            : base(5609)
        {
            Coords = new ArrayList();

            Coords.Add( rect );

            m_RestrictedSpells = new BitArray( SpellRegistry.Types.Length );
            m_RestrictedSkills = new BitArray( SkillInfo.Table.Length );

            Visible = false;
            Movable = false;
            Name = "Region Controller";
            m_RegionName = "Custom Region";
            m_Priority = CustomRegionPriority.HighPriority;

            UpdateRegion();
        }
Ejemplo n.º 10
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 3:
                {
                    m_LightLevel = reader.ReadInt();
                    goto case 2;
                }
                case 2:
                {
                    m_Music = (MusicName)reader.ReadInt();
                    goto case 1;
                }
                case 1:
                {
                    Coords = ReadRect2DArray( reader );
                    m_Priority = (CustomRegionPriority) reader.ReadInt();
                    m_PlayerLogoutDelay = reader.ReadTimeSpan();

                    m_RestrictedSpells = ReadBitArray( reader );
                    m_RestrictedSkills = ReadBitArray( reader );

                    m_Flags = (RegionFlag)reader.ReadInt();

                    m_RegionName = reader.ReadString();
                    break;
                }
                case 0:
                {
                    Coords = new ArrayList();

                    Coords.Add( reader.ReadRect2D() );
                    m_RestrictedSpells = ReadBitArray( reader );
                    m_RestrictedSkills = ReadBitArray( reader );

                    m_Flags = (RegionFlag)reader.ReadInt();

                    m_RegionName = reader.ReadString();
                    break;
                }
            }

            UpdateRegion();
        }
Ejemplo n.º 11
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
            m_LogoutMoveMap = Map.Internal;

			int version = reader.ReadInt();

			switch ( version )
			{
                case 7:
                {
                    m_CastWithoutReagents=reader.ReadBool();
                    goto case 6;
                }
                case 6:
                {
                    m_LogoutMoveLocation = reader.ReadPoint3D();
                    m_LogoutMoveMap = reader.ReadMap();
                    goto case 5;
                }
                case 5:
                {
                    m_AlwaysGrey = reader.ReadBool();
                    m_CannotTrade = reader.ReadBool();
                    goto case 4;
                }
                case 4:
                {
                    m_NoFameKarma = reader.ReadBool();
                    m_NoPvPPoints = reader.ReadBool();
                    m_NoMurderCounts = reader.ReadBool();
                    m_NoFactionEffects = reader.ReadBool();
                    m_CannotTakeRewards = reader.ReadBool();
                    goto case 3;
                }
                case 3:
				{
					m_LightLevel = reader.ReadInt();
					goto case 2;
				}
				case 2:
				{
					m_Music = (MusicName)reader.ReadInt();
					goto case 1;
				}
				case 1:
				{
					Coords = ReadRect2DArray( reader );
					m_Priority = (CustomRegionPriority) reader.ReadInt();
					m_PlayerLogoutDelay = reader.ReadTimeSpan();

					m_RestrictedSpells = ReadBitArray( reader );
					m_RestrictedSkills = ReadBitArray( reader );

					m_Flags = (RegionFlag)reader.ReadInt();

					m_RegionName = reader.ReadString();
					break;
				}
				case 0:
				{
					Coords = new ArrayList();

					Coords.Add( reader.ReadRect2D() );
					m_RestrictedSpells = ReadBitArray( reader );
					m_RestrictedSkills = ReadBitArray( reader );

					m_Flags = (RegionFlag)reader.ReadInt();

					m_RegionName = reader.ReadString();
					break;
				}
			}

			UpdateRegion();

		}
Ejemplo n.º 12
0
		public RegionControl() : base ( 5609 )
		{
			Visible = false;
			Movable = false;
			Name = "Region Controller";
			m_RegionName = "Custom Region";
			m_Priority = CustomRegionPriority.HighPriority;

			m_RestrictedSpells = new BitArray( SpellRegistry.Types.Length );
			m_RestrictedSkills = new BitArray( SkillInfo.Table.Length );

            //Some defaults to avoid mistakes
            CannotEnter = true;
            m_RestrictedSpells[GetRegistryNumber(typeof(Spells.Sixth.MarkSpell))] = true;

			Coords = new ArrayList();
			UpdateRegion();
		}