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

			int version = reader.ReadEncodedInt();
			
			switch ( version )
			{
				case 1:
				{
					m_Music = (MusicName) reader.ReadInt();
					break;
				}
			}
			
			if ( version == 0 ) // Music wasn't serialized in version 0, pick a new track of random rarity
			{
				DawnsMusicRarity rarity;
				double rand = Utility.RandomDouble();
				
				if ( rand < 0.025 )
					rarity = DawnsMusicRarity.Rare;
				else if ( rand < 0.225 )
					rarity = DawnsMusicRarity.Uncommon;
				else
					rarity = DawnsMusicRarity.Common;
				
				m_Music = DawnsMusicBox.RandomTrack( rarity );
			}
		}
Example #2
0
 public TrackInfo(int duration, int label, MusicName name, TrackRarity rarity)
 {
     this.m_Duration = duration;
     this.m_Label = label;
     this.m_Name = name;
     this.m_Rarity = rarity;
 }
Example #3
0
 public override void Deserialize(GenericReader reader)
 {
     base.Deserialize(reader);
     int version = reader.ReadInt();
     m_Track = reader.ReadInt();
     m_Song = (MusicName)reader.ReadInt();
 }
    private void Start()
    {
        // Find all music in user's level directory
        string[] musicFiles = Directory.GetFiles(CrossSceneData.LevelDir, "*.ogg", SearchOption.AllDirectories);

        // Return if no music was found
        if (musicFiles.Length == 0)
        {
            return;
        }

        // Random index
        int index = Random.Range(0, musicFiles.Length - 1);

        MusicName = Path.GetFileName(musicFiles[index]);
        MusicName = MusicName.Replace(".ogg", "");
        MusicDir  = musicFiles[index];

        // Play randomly chosen music
        string uri = "file://" + CrossSceneData.LevelDir + "/" + MusicName + "/" + MusicName + ".ogg";

        StartCoroutine(GetComponent <MusicLoader>().PlayMusic(MusicSource, uri));

        // Load meta data
        LevelDataPasser       levelDataPasser = GetComponent <LevelDataPasser>();
        string                fileLocation    = CrossSceneData.LevelDir + "/" + MusicName + "/" + MusicName;
        List <(float, float)> metaDataList    = levelDataPasser.LoadLevelDataFromDat(fileLocation);

        BpmValue    = metaDataList[0].Item1;
        OffsetValue = metaDataList[0].Item2;

        // Make logo beat to music
        StartCoroutine(OffsetBeatAnimation());
    }
Example #5
0
        public DawnsMusicGear(MusicName music)
            : base(0x1053)
        {
            m_Music = music;

            Weight = 1.0;
        }
Example #6
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            Music = (MusicName)reader.ReadInt();
        }
Example #7
0
        public DawnsMusicGear(MusicName music)
            : base(0x1053)
        {
            this.m_Music = music;

            this.Weight = 1.0;
        }
Example #8
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_Level = (SecureLevel)reader.ReadEncodedInt();
                goto case 0;
            }

            case 0:
            {
                m_Range    = reader.ReadInt();
                m_Music    = (MusicName)reader.ReadInt();
                m_HasTrack = new bool[SONGS];
                for (int x = 0; x < SONGS; x++)
                {
                    m_HasTrack[x] = reader.ReadBool();
                }
                break;
            }
            }
            Name = "MusicBox: Stopped.";
        }
Example #9
0
        public static Packet GetInstance(MusicName name)
        {
            if (name == MusicName.Invalid)
            {
                return(InvalidInstance);
            }

            var    v = (int)name;
            Packet p;

            if (v >= 0 && v < m_Instances.Length)
            {
                p = m_Instances[v];

                if (p == null)
                {
                    m_Instances[v] = p = SetStatic(new PlayMusic(name));
                }
            }
            else
            {
                p = new PlayMusic(name);
            }

            return(p);
        }
Example #10
0
        public MusicBoxGears(MusicName music) : base(0x1053)
        {
            m_Music = music;
            Weight  = 1.0;

            ItemValue = ItemValue.Rare;
        }
Example #11
0
        public DawnsMusicGear(MusicName music)
            : base(0x1053)
        {
            this.m_Music = music;

            this.Weight = 1.0;
        }
Example #12
0
 public TrackInfo(int duration, int label, MusicName name, TrackRarity rarity)
 {
     m_Duration = duration;
     m_Label    = label;
     m_Name     = name;
     m_Rarity   = rarity;
 }
Example #13
0
		public MusicBoxGears( MusicName music ) : base( 0x1053 )
		{
			m_Music = music;
			Weight = 1.0;

			ItemValue = ItemValue.Rare;
		}
Example #14
0
 /// <summary>
 /// 根据音乐名字播放音乐
 /// </summary>
 /// <param name="musicName">Music name.</param>
 public void PlayMusic(MusicName musicName)
 {
     if (GameData.Instance.GetAudioSetting() == 0)
     {
         return;
     }
     PlayMusic(musicName.ToString());
 }
Example #15
0
 public static Music GetMusic(MusicName musicName)
 {
     if (musics.Count == 0)
     {
         LoadMusic();
     }
     return(musics[musicName]);
 }
Example #16
0
        public static DawnsMusicInfo GetInfo(MusicName name)
        {
            if (m_Info.ContainsKey(name))
            {
                return(m_Info[name]);
            }

            return(null);
        }
Example #17
0
 public override void Format(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices services)
 {
     sw.Format(formatterContext, services)
     .CommentLine(MusicName.Get(_musicId))
     .StaticType(nameof(IMusicService))
     .Method(nameof(IMusicService.ChangeBattleMusic))
     .Enum(_musicId)
     .Comment(nameof(SETBATTLEMUSIC));
 }
Example #18
0
        public static DawnsMusicInfo GetInfo(MusicName name)
        {
            if (m_Info == null) // sanity
            {
                return(null);
            }

            m_Info.TryGetValue(name, out DawnsMusicInfo info);
            return(info);
        }
Example #19
0
 public DawnsMusicBox() : base( 0x2AF9 )
 {
     Weight = 1.0;
     
     m_Tracks = new List<MusicName>();
     m_ActualSong = MusicName.Invalid;
     
     while( Tracks.Count < 4 )
     	AddSong( TrackInfo.RandomSong( TrackRarity.Common ) );
 }
Example #20
0
        /// <summary>
        /// Because the original stop fonction is bugged
        /// This is a way to fix it
        /// </summary>
        /// <param name="song"></param>
        public void realStopMusic(MusicName song)
        {
            int i = (int)song;

            musicLoaded[i].Stop();
            musicLoaded[i].Dispose();
            musicLoaded[i]          = musics[i].CreateInstance();
            musicLoaded[i].Volume   = 0.60f;
            musicLoaded[i].IsLooped = true;
        }
Example #21
0
        private static void onLogin(LoginEventArgs args)
        {
            MusicName toPlay = Config.SingleMusic;

            if (Config.PlayRandomMusic)
            {
                toPlay = MusicList[Utility.Random(MusicList.Length)];
            }

            args.Mobile.Send(PlayMusic.GetInstance(toPlay));
        }
Example #22
0
    public void Play(MusicName name, bool isLoop = false)
    {
        if (!IsOpenMusic || name == MusicName.Noone)
        {
            return;
        }

        musicSource.clip = musicClips[name.ToString()];
        musicSource.loop = isLoop;
        musicSource.Play();
    }
Example #23
0
        public void TestPlayMusic(MusicName music)
        {
            var expected = new PlayMusic(music).Compile();

            using var ns = PacketTestUtilities.CreateTestNetState();
            ns.SendPlayMusic(music);

            var result = ns.SendPipe.Reader.TryRead();

            AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
        }
Example #24
0
        public DawnsMusicBox() : base(0x2AF9)
        {
            Weight = 1.0;

            m_Tracks     = new List <MusicName>();
            m_ActualSong = MusicName.Invalid;

            while (Tracks.Count < 4)
            {
                AddSong(TrackInfo.RandomSong(TrackRarity.Common));
            }
        }
Example #25
0
        public void TestPlayMusic(MusicName music)
        {
            var data = new PlayMusic(music).Compile();

            Span <byte> expectedData = stackalloc byte[3];
            var         pos          = 0;

            expectedData.Write(ref pos, (byte)0x6D);    // Packet ID
            expectedData.Write(ref pos, (ushort)music); // Flags

            AssertThat.Equal(data, expectedData);
        }
Example #26
0
        /// <summary>
        /// Static. Method to obtain a TrackInfo from a MusicName.
        /// </summary>
        /// <param name="name"></param> MusicName to retrieve its TrackInfo</param>
        /// <returns>a TrackInfo if name is valid; first TrackInfo in the list otherwise.</returns>
        public static TrackInfo GetInfo(MusicName name)
        {
            foreach (TrackInfo ti in m_Table)
            {
                if (ti.Name == name)
                {
                    return(ti);
                }
            }

            return(m_Table[0]);
        }
Example #27
0
 public bool AddSong(MusicName song)
 {
     if (m_Tracks.Contains(song))
     {
         return(false);
     }
     else
     {
         m_Tracks.Add(song);
         return(true);
     }
 }
Example #28
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();
        }
Example #29
0
 public MusicBoxComponent(int itemID)
     : base(itemID)
 {
     Name       = "MusicBox: Stopped.";
     m_HasTrack = new bool[SONGS];
     for (int x = 0; x < SONGS; x++)
     {
         m_HasTrack[x] = false;
     }
     AddTrack(new MusicBoxTrack(1075144));
     m_Music        = MusicName.Britain1;
     m_HasTrack[12] = true; //Default Song: Britain1
 }
Example #30
0
        public void PlayMusic(Mobile m, MusicName music)
        {
            if (m_Timer?.Running == true)
            {
                EndMusic(m);
            }
            else
            {
                m_ItemID = ItemID;
            }

            m.Send(new PlayMusic(music));
            m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5), 4, Animate);
        }
Example #31
0
        public void PlayMusic(Mobile m, MusicName music)
        {
            if (m_Timer != null && m_Timer.Running)
            {
                EndMusic(m);
            }
            else
            {
                m_ItemID = ItemID;
            }

            m.Send(new PlayMusic(music));
            m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5), 4, new TimerCallback(Animate));
        }
Example #32
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            m_Range    = reader.ReadInt();
            m_Music    = (MusicName)reader.ReadInt();
            m_HasTrack = new bool[SONGS];
            for (int x = 0; x < SONGS; x++)
            {
                m_HasTrack[x] = reader.ReadBool();
            }
            Name = "Dawn's MusicBox: Stopped";
        }
Example #33
0
        /// <summary>
        /// Play a music
        /// </summary>
        /// <param name="mus"></param>
        public void playMusic(MusicName mus)
        {
            try             // Catch exceptions in case the computer can't play songs (example: Travis)
            {
                musicNow.Pause();
                musicNow = musicLoaded[(int)mus];

                if (!musicmute)
                {
                    musicNow.Resume();
                }
            }
            catch { }
        }
Example #34
0
    private void AddToDicMusic(MusicName musicName, string fileName)
    {
        AudioClip ac = (AudioClip)Resources.Load(fileName);

        if (ac != null)
        {
            int i = SoundManager.PlayMusic(ac, 1.0f, true, true);
            dic_musicID.Add(musicName, i);
            SoundManager.GetMusicAudio(dic_musicID[musicName]).Stop();
        }
        else
        {
            Debug.LogError("Missing Musique " + fileName);
        }
    }
Example #35
0
        public override void Format(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices services)
        {
            var formatter = sw.Format(formatterContext, services);

            if (_musicId is IConstExpression expr)
            {
                formatter.CommentLine(MusicName.Get((MusicId)expr.Int32()));
            }

            formatter
            .StaticType(nameof(IMusicService))
            .Method(nameof(IMusicService.LoadFieldMusic))
            .Argument("musicId", _musicId)
            .Comment(nameof(MUSICLOAD));
        }
Example #36
0
        public DawnsMusicBox() : base(0x2AF9)
        {
            Weight = 1.0;

            Tracks = new List <MusicName>();

            while (Tracks.Count < 4)
            {
                MusicName name = RandomTrack(DawnsMusicRarity.Common);

                if (!Tracks.Contains(name))
                {
                    Tracks.Add(name);
                }
            }
        }
Example #37
0
		public Region( string name, Map map, Region parent, params Rectangle3D[] area )
		{
			m_Name = name;
			m_Map = map;
			m_Parent = parent;
			m_Area = area;
			m_Dynamic = true;
			m_Music = this.DefaultMusic;

			if ( m_Parent == null )
			{
				m_ChildLevel = 0;
				m_Priority = DefaultPriority;
			}
			else
			{
				m_ChildLevel = m_Parent.ChildLevel + 1;
				m_Priority = m_Parent.Priority;
			}
		}
Example #38
0
		public Region( XmlElement xml, Map map, Region parent )
		{
			m_Map = map;
			m_Parent = parent;
			m_Dynamic = false;

			if ( m_Parent == null )
			{
				m_ChildLevel = 0;
				m_Priority = DefaultPriority;
			}
			else
			{
				m_ChildLevel = m_Parent.ChildLevel + 1;
				m_Priority = m_Parent.Priority;
			}

			ReadString( xml, "name", ref m_Name, false );

			if ( parent == null )
				ReadInt32( xml, "priority", ref m_Priority, false );


			int minZ = MinZ;
			int maxZ = MaxZ;

			XmlElement zrange = xml["zrange"];
			ReadInt32( zrange, "min", ref minZ, false );
			ReadInt32( zrange, "max", ref maxZ, false );


			List<Rectangle3D> area = new List<Rectangle3D>();
			foreach ( XmlElement xmlRect in xml.SelectNodes( "rect" ) )
			{
				Rectangle3D rect = new Rectangle3D();
				if ( ReadRectangle3D( xmlRect, minZ, maxZ, ref rect ) )
					area.Add( rect );
			}

			m_Area = area.ToArray();

			if ( m_Area.Length == 0 )
				Console.WriteLine( "Empty area for region '{0}'", this );


			if ( !ReadPoint3D( xml["go"], map, ref m_GoLocation, false ) && m_Area.Length > 0 )
			{
				Point3D start = m_Area[0].Start;
				Point3D end = m_Area[0].End;

				int x = start.X + (end.X - start.X) / 2;
				int y = start.Y + (end.Y - start.Y) / 2;

				m_GoLocation = new Point3D( x, y, m_Map.GetAverageZ( x, y ) );
			}


			object oMusic = this.DefaultMusic;

			ReadEnum( xml["music"], "name", typeof( MusicName ), ref oMusic, false );

			m_Music = (MusicName) oMusic;
		}
Example #39
0
		public DawnsMusicGear( MusicName music ) : base( 0x1053 )
		{
			m_Music = music;

			Weight = 1.0;
		}
Example #40
0
 public MusicBoxGears(MusicName music)
     : base(0x1053)
 {
     this.m_Music = music;
     this.Weight = 1.0;
 }
Example #41
0
		public bool AddSong( MusicName song )
		{
			if( m_Tracks.Contains( song ) )
			{
				return false;
			}
			else
			{
				m_Tracks.Add( song );
				return true;
			}
		}
Example #42
0
		public override void Deserialize( GenericReader reader ) {
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch( version ) {
				case 6: {
						_minZ = reader.ReadInt();
						_maxZ = reader.ReadInt();

						goto case 5;
					}
				case 5: {
						m_EditAccessLevel = (AccessLevel)reader.ReadInt();

						goto case 4;
					}
				case 4: {
						m_RegionArea = ReadRect3DArray( reader );

						m_Flags = (RegionFlag)reader.ReadInt();

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

						m_Active = reader.ReadBool();

						m_RegionName = reader.ReadString();
						m_RegionPriority = reader.ReadInt();
						m_Music = (MusicName)reader.ReadInt();
						m_PlayerLogoutDelay = reader.ReadTimeSpan();
						m_LightLevel = reader.ReadInt();

						if( version <= 4 ) {
							reader.ReadMap();
							reader.ReadPoint3D();
							reader.ReadMap();
							reader.ReadPoint3D();
						}

						break;
					}
				case 3: //pre-RunUO 2.0
					{
						m_LightLevel = reader.ReadInt();
						goto case 2;
					}
				case 2: {
						m_Music = (MusicName)reader.ReadInt();
						goto case 1;
					}
				case 1: {
						List<Rectangle2D> rects2d = ReadRect2DArray( reader );
						foreach( Rectangle2D rect in rects2d ) {
							Rectangle3D newrect = Server.Region.ConvertTo3D( rect );
							DoChooseArea( null, this.Map, newrect.Start, newrect.End, this );
						}

						m_RegionPriority = 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: {
						List<Rectangle2D> rects2d = ReadRect2DArray( reader );
						foreach( Rectangle2D rect in rects2d ) {
							Rectangle3D newrect = Server.Region.ConvertTo3D( rect );
							DoChooseArea( null, this.Map, newrect.Start, newrect.End, this );
						}

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

						m_Flags = (RegionFlag)reader.ReadInt();

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

			m_AllControls.Add( this );

			if( RegionNameTaken( m_RegionName ) )
				m_RegionName = FindNewName( m_RegionName );

			UpdateRegion();
		}
Example #43
0
		public MusicBoxGears( MusicName music ) : base( 0x1053 )
		{
			m_Music = music;
			Weight = 1.0;
		}
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            this.m_MobFactionArea = new Rectangle3D[0];

            switch (version)
            {
                case 1:
                    {
                        this.m_EjectLocation = reader.ReadPoint3D();
                        string ejectmap = reader.ReadString();
                        try
                        {
                            this.m_EjectMap = Map.Parse(ejectmap);
                        }
                        catch
                        {
                        }

                        string factiontype = reader.ReadString();
                        try
                        {
                            this.m_FactionType = (XmlMobFactions.GroupTypes)Enum.Parse(typeof(XmlMobFactions.GroupTypes), factiontype);
                        }
                        catch
                        {
                        }
                        this.m_FactionLevel = reader.ReadInt();

                        goto case 0;
                    }
                case 0:
                    {
                        this.m_Music = (MusicName)reader.ReadInt();
                        this.m_MobFactionPriority = reader.ReadInt();
                        if (version < 1)
                        {
                            // old region area
                            reader.ReadRect2D();
                        }
                        this.m_MobFactionRegionName = reader.ReadString();
                        string mapname = reader.ReadString();
                        try
                        {
                            this.m_MobFactionMap = Map.Parse(mapname);
                        }
                        catch
                        {
                        }
                        this.m_CopiedRegion = reader.ReadString();
                        // do the coord list
                        int count = reader.ReadInt();
                        if (count > 0)
                        {
                            // the old version used 2D rectangles for the region area.  The new version uses 3D
                            if (version < 1)
                            {
                                Rectangle2D[] area = new Rectangle2D[count];
                                for (int i = 0; i < count; i++)
                                {
                                    area[i] = reader.ReadRect2D();
                                }
                                this.m_MobFactionArea = Region.ConvertTo3D(area);
                            }
                            else
                            {
                                this.m_MobFactionArea = new Rectangle3D[count];
                                for (int i = 0; i < count; i++)
                                {
                                    this.m_MobFactionArea[i] = new Rectangle3D(reader.ReadPoint3D(), reader.ReadPoint3D());
                                }
                            }
                        }

                        break;
                    }
            }

            // refresh the region
            Timer.DelayCall(TimeSpan.Zero, new TimerCallback(RefreshRegions));
        }
Example #45
0
 public PlayMusic( MusicName name )
     : base(0x6D, 3)
 {
     m_Stream.Write( (short)name );
 }
Example #46
0
		private void DupeCustomBits(Region r)
		{
			//pla: replicate custom region
			if (r is CustomRegion)
			{
				RegionControl rc = (r as CustomRegion).GetRegionControler();

				if (rc != null)
				{
					//copy all the flags and restricted stuff
					this.m_Flags = rc.m_Flags;
					this.m_RestrictedSpells = new BitArray(rc.m_RestrictedSpells);
					this.m_RestrictedSkills = new BitArray(rc.m_RestrictedSkills);
					this.m_RestrictedMagicMsg = rc.m_RestrictedMagicMsg;
					this.m_InnLogoutDelay = rc.InnLogoutDelay;
					this.m_IOBAlignment = rc.IOBAlign;
					this.m_MaxFollowers = rc.MaxFollowerSlots;
					this.m_Music = r.Music;
					this.SetFlag(RegionFlag.Music, (r.Music != MusicName.Invalid));

					if (rc.LightLevel > 0)
						this.m_LightLevel = rc.LightLevel;

					this.m_Types.Clear();
					if (rc.m_Types != null && rc.m_Types.Count > 0)
					{
						ArrayList t = rc.m_Types;
						for (int i = 0; i < rc.m_Types.Count; ++i)
							if (t[i] is string)
								this.m_Types.Add((string)t[i]);
					}
				}
				else
				{
					this.SendMessage(String.Format("Region controller for custom region '" + r.Name + "' could not be found.\n\rCustom properties and flags have not been cloned successfully"));
				}
			}
		}
Example #47
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."));
			}
		}
Example #48
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            this.m_ChallengeArea = new Rectangle3D[0];

            switch ( version )
            {
                case 2:
                case 1:
                    {
                        this.m_Disable = reader.ReadBool();
                        goto case 0;
                    }
                case 0:
                    {
                        this.m_Music = (MusicName)reader.ReadInt();
                        this.m_Priority = reader.ReadInt();
                        if (version < 2)
                        {
                            // old region area
                            reader.ReadRect2D();
                        }
                        this.m_ChallengeRegionName = reader.ReadString();
                        string mapname = reader.ReadString();
                        try
                        {
                            this.m_ChallengeMap = Map.Parse(mapname);
                        }
                        catch
                        {
                        }
                        this.m_CopiedRegion = reader.ReadString();

                        // do the coord list
                        int count = reader.ReadInt();
                        if (count > 0)
                        {
                            // the old version used 2D rectangles for the region area.  The new version uses 3D
                            if (version < 2)
                            {
                                Rectangle2D[] area = new Rectangle2D[count];
                                for (int i = 0; i < count; i++)
                                {
                                    area[i] = reader.ReadRect2D();
                                }
                                this.m_ChallengeArea = Region.ConvertTo3D(area);
                            }
                            else
                            {
                                this.m_ChallengeArea = new Rectangle3D[count];
                                for (int i = 0; i < count; i++)
                                {
                                    this.m_ChallengeArea[i] = new Rectangle3D(reader.ReadPoint3D(), reader.ReadPoint3D());
                                }
                            }
                        }
                        break;
                    }
            }

            // refresh the region
            Timer.DelayCall(TimeSpan.Zero, new TimerCallback(RefreshRegions));
        }
Example #49
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();
		}
Example #50
0
 public MusicBoxComponent(int itemID)
     : base(itemID)
 {
     Name = "MusicBox: Stopped.";
     m_HasTrack = new bool[SONGS];
     for (int x = 0; x < SONGS; x++)
     {
         m_HasTrack[x] = false;
     }
     AddTrack(new MusicBoxTrack(1075144));
     m_Music = MusicName.Britain1;
     m_HasTrack[12] = true; //Default Song: Britain1
 }
Example #51
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            /*int version = */
            reader.ReadInt();

            m_Music = (MusicName) reader.ReadInt();
        }
Example #52
0
		public override void Deserialize( GenericReader reader )
		{
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 20: //Loki edit
                    {
                        LokiPvP = reader.ReadBool();
                        goto case 19;
                    }
                case 19:
                    {
                        AllowBenefitPlayer = reader.ReadBool();
                        AllowHarmPlayer = reader.ReadBool();
                        AllowHousing = reader.ReadBool();
                        AllowSpawn = reader.ReadBool();
                        CanBeDamaged = reader.ReadBool();
                        CanHeal = reader.ReadBool();
                        CanRessurect = reader.ReadBool();
                        CanUseStuckMenu = reader.ReadBool();
                        ItemDecay = reader.ReadBool();
                        ShowEnterMessage = reader.ReadBool();
                        ShowExitMessage = reader.ReadBool();
                        AllowBenefitNPC = reader.ReadBool();
                        AllowHarmNPC = reader.ReadBool();
                        CanMountEthereal = reader.ReadBool();
                        CanEnter = reader.ReadBool();
                        CanLootPlayerCorpse = reader.ReadBool();
                        CanLootNPCCorpse = reader.ReadBool();
                        CanLootOwnCorpse = reader.ReadBool();
                        CanUsePotOthers = reader.ReadBool();
                        m_IsGuarded = reader.ReadBool();
                        EmptyNPCCorpse = reader.ReadBool();
                        EmptyPlayerCorpse = reader.ReadBool();
                        DeleteNPCCorpse = reader.ReadBool();
                        DeletePlayerCorpse = reader.ReadBool();
                        ResNPCOnDeath = reader.ReadBool();
                        ResPlayerOnDeath = reader.ReadBool();
                        m_MoveNPCOnDeath = reader.ReadBool();
                        m_MovePlayerOnDeath = reader.ReadBool();
                        NoPlayerItemDrop = reader.ReadBool();
                        NoNPCItemDrop = reader.ReadBool();
                        goto case 18;
                    }
                case 18:
                    {
                        FizzlePvP = reader.ReadBool();
                        goto case 17;
                    }
                case 17:
                    {
                        CanUsePotExplosion = reader.ReadBool();
                        IgnoreYoungProtection = reader.ReadBool();
                        goto case 16;
                    }
                case 16:
                    {
                        m_LogoutMap = reader.ReadMap();
                        goto case 15;
                    }
                case 15:
                    {
                        NoFameLoss = reader.ReadBool();
                        goto case 14;
                    }
                case 14:
                    {
                        BroadcastArriveMsg = reader.ReadBool();
                        goto case 13;
                    }
                case 13:
                    {
                        m_GoLocation = reader.ReadPoint3D();

                        goto case 12;
                    }
                case 12:
                    {
                        AllowSkillGain = reader.ReadBool();
                        goto case 11;
                    }
                case 11:
                    {
                        m_LogoutMove = reader.ReadBool();
                        m_LogoutLoc = reader.ReadPoint3D();
                        goto case 10;
                    }
                case 10:
                    {
                        AllowSpecialAttacks = reader.ReadBool();
                        goto case 9;
                    }
                case 9:
                    {
                        CanUnshrink = reader.ReadBool();
                        goto case 8;
                    }
                case 8:
                    {
                        CanPlaceVendors = reader.ReadBool();
                        goto case 7;
                    }
                case 7:
                    {
                        AllowPvP = reader.ReadBool();
                        goto case 6;
                    }
                case 6:
                    {
                        AllowTrade = reader.ReadBool();
                        goto case 5;
                    }
                case 5:
                    {
                        CanUsePotHeal = reader.ReadBool();
                        CanUsePotMana = reader.ReadBool();
                        CanUsePotStam = reader.ReadBool();
                        CanUsePotShrink = reader.ReadBool();
                        CanCutCorpse = reader.ReadBool();
                        HasAttackPenalty = reader.ReadBool();
                        goto case 4;
                    }
                // New RunUO 2.0 Version (case 4)
                case 4:
                {
                    m_RegionArea = ReadRect3DArray(reader);
                    
                    m_Flags = (RegionFlag)reader.ReadInt();

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

                    m_Active = reader.ReadBool();

                    m_RegionName = reader.ReadString();
                    m_RegionPriority = reader.ReadInt();
                    m_Music = (MusicName)reader.ReadInt();
                    m_PlayerLogoutDelay = reader.ReadTimeSpan();
                    m_LightLevel = reader.ReadInt();

                    m_MoveNPCToMap = reader.ReadMap();
                    m_MoveNPCToLoc = reader.ReadPoint3D();
                    m_MovePlayerToMap = reader.ReadMap();
                    m_MovePlayerToLoc = reader.ReadPoint3D();

                    break;
                }

                // Old RunUO 1.0 Version (cases 3-0)
                case 3:
                {
                    m_LightLevel = reader.ReadInt();
                    goto case 2;
                }
                case 2:
                {
                    m_Music = (MusicName)reader.ReadInt();
                    goto case 1;
                }
                case 1:
                {
                    List<Rectangle2D> rects2d = ReadRect2DArray(reader);
                    foreach (Rectangle2D rect in rects2d)
                    {
                        Rectangle3D newrect = Server.Region.ConvertTo3D(rect);
                        DoChooseArea(null, Map, newrect.Start, newrect.End, this);
                    }

                    m_RegionPriority = 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:
                {
                    List<Rectangle2D> rects2d = ReadRect2DArray(reader);
                    foreach (Rectangle2D rect in rects2d)
                    {
                        Rectangle3D newrect = Server.Region.ConvertTo3D(rect);
                        DoChooseArea(null, Map, newrect.Start, newrect.End, this);
                    }

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

                    m_Flags = (RegionFlag)reader.ReadInt();

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

            m_AllControls.Add(this);

            //if(RegionNameTaken(m_RegionName))
            //    m_RegionName = FindNewName(m_RegionName);

            if (version < 19)
            {
                AllowBenefitPlayer = GetFlag(RegionFlag.AllowBenefitPlayer);
                AllowHarmPlayer = GetFlag(RegionFlag.AllowHarmPlayer);
                AllowHousing = GetFlag(RegionFlag.AllowHousing);
                AllowSpawn = GetFlag(RegionFlag.AllowSpawn);
                CanBeDamaged = GetFlag(RegionFlag.CanBeDamaged);
                CanHeal = GetFlag(RegionFlag.CanHeal);
                CanRessurect = GetFlag(RegionFlag.CanRessurect);
                CanUseStuckMenu = GetFlag(RegionFlag.CanUseStuckMenu);
                ItemDecay = GetFlag(RegionFlag.ItemDecay);
                ShowEnterMessage = GetFlag(RegionFlag.ShowEnterMessage);
                ShowExitMessage = GetFlag(RegionFlag.ShowExitMessage);
                AllowBenefitNPC = GetFlag(RegionFlag.AllowBenefitNPC);
                AllowHarmNPC = GetFlag(RegionFlag.AllowHarmNPC);
                CanMountEthereal = GetFlag(RegionFlag.CanMountEthereal);
                CanEnter = GetFlag(RegionFlag.CanEnter);
                CanLootPlayerCorpse = GetFlag(RegionFlag.CanLootPlayerCorpse);
                CanLootNPCCorpse = GetFlag(RegionFlag.CanLootNPCCorpse);
                CanLootOwnCorpse = GetFlag(RegionFlag.CanLootOwnCorpse);
                CanUsePotOthers = GetFlag(RegionFlag.CanUsePotOthers);
                IsGuarded = GetFlag(RegionFlag.IsGuarded);
                EmptyNPCCorpse = GetFlag(RegionFlag.EmptyNPCCorpse);
                EmptyPlayerCorpse = GetFlag(RegionFlag.EmptyPlayerCorpse);
                DeleteNPCCorpse = GetFlag(RegionFlag.DeleteNPCCorpse);
                DeletePlayerCorpse = GetFlag(RegionFlag.DeletePlayerCorpse);
                ResNPCOnDeath = GetFlag(RegionFlag.ResNPCOnDeath);
                ResPlayerOnDeath = GetFlag(RegionFlag.ResPlayerOnDeath);
                MoveNPCOnDeath = GetFlag(RegionFlag.MoveNPCOnDeath);
                MovePlayerOnDeath = GetFlag(RegionFlag.MovePlayerOnDeath);
                NoPlayerItemDrop = GetFlag(RegionFlag.NoPlayerItemDrop);
                NoNPCItemDrop = GetFlag(RegionFlag.NoNPCItemDrop);
            }

            UpdateRegion();
		}
Example #53
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();

		}
Example #54
0
		public static DawnsMusicInfo GetInfo( MusicName name )
		{
			if ( m_Info.ContainsKey( name ) )
				return m_Info[ name ];

			return null;
		}
Example #55
0
        public static Packet GetInstance( MusicName name )
        {
            if ( name == MusicName.Invalid )
                return InvalidInstance;

            int v = (int)name;
            Packet p;

            if ( v >= 0 && v < m_Instances.Length )
            {
                p = m_Instances[v];

                if ( p == null )
                    m_Instances[v] = p = new PlayMusic( name );
            }
            else
            {
                p = new PlayMusic( name );
            }

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

            int version = reader.ReadInt();

            // Point3D customGoLoc = new Point3D(0,0,0); // REMOVED
            switch (version)
            {
                // New RunUO 2.0 Version (case 5 and 4)
                case 5:
                {
                    // customGoLoc = reader.ReadPoint3D(); // REMOVED
                    goto case 4;
                }
                case 4:
                {
                    m_RegionArea = ReadRect3DArray(reader);
                    
                    m_Flags = (RegionFlag)reader.ReadInt();

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

                    m_Active = reader.ReadBool();

                    m_RegionName = reader.ReadString();
                    m_RegionPriority = reader.ReadInt();
                    m_Music = (MusicName)reader.ReadInt();
                    m_PlayerLogoutDelay = reader.ReadTimeSpan();
                    m_LightLevel = reader.ReadInt();

                    m_MoveNPCToMap = reader.ReadMap();
                    m_MoveNPCToLoc = reader.ReadPoint3D();
                    m_MovePlayerToMap = reader.ReadMap();
                    m_MovePlayerToLoc = reader.ReadPoint3D();

                    break;
                }

                // Old RunUO 1.0 Version (cases 3-0)
                case 3:
                {
                    m_LightLevel = reader.ReadInt();
                    goto case 2;
                }
                case 2:
                {
                    m_Music = (MusicName)reader.ReadInt();
                    goto case 1;
                }
                case 1:
                {
                    List<Rectangle2D> rects2d = ReadRect2DArray(reader);
                    foreach (Rectangle2D rect in rects2d)
                    {
                        Rectangle3D newrect = Server.Region.ConvertTo3D(rect);
                        DoChooseArea(null, this.Map, newrect.Start, newrect.End, this);
                    }

                    m_RegionPriority = reader.ReadInt();
                    m_PlayerLogoutDelay = reader.ReadTimeSpan();

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

                    m_Flags = (RegionFlag)reader.ReadInt();
                    if (NoPlayerCorpses)
                    {
                        DeleteNPCCorpse = true;
                        DeletePlayerCorpse = true;                          
                    }
                    if (NoItemDrop)
                    {
                        NoPlayerItemDrop = true;
                        NoNPCItemDrop = true;
                    }
                    // Invert because of change from "Cannot" to "Can"
                    if (CanLootOwnCorpse)
                    {
                        CanLootOwnCorpse = false;
                    }
                    if (CanEnter)
                    {
                        CanEnter = false;
                    }

                    m_RegionName = reader.ReadString();
                    break;
                }
                case 0:
                {
                    List<Rectangle2D> rects2d = ReadRect2DArray(reader);
                    foreach (Rectangle2D rect in rects2d)
                    {
                        Rectangle3D newrect = Server.Region.ConvertTo3D(rect);
                        DoChooseArea(null, this.Map, newrect.Start, newrect.End, this);
                    }

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

                    m_Flags = (RegionFlag)reader.ReadInt();
                    if (NoPlayerCorpses)
                    {
                        DeleteNPCCorpse = true;
                        DeletePlayerCorpse = true;
                    }
                    if (NoItemDrop)
                    {
                        NoPlayerItemDrop = true;
                        NoNPCItemDrop = true;
                    }
                    // Invert because of change from "Cannot" to "Can"
                    if (CanLootOwnCorpse)
                    {
                        CanLootOwnCorpse = false;
                    }
                    if (CanEnter)
                    {
                        CanEnter = false;
                    }

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

            m_AllControls.Add(this);

            if(RegionNameTaken(m_RegionName))
                m_RegionName = FindNewName(m_RegionName);

            UpdateRegion();
           // m_CustomGoLocation = customGoLoc;  // REMOVED
           // CustomGoLocation = customGoLoc;   // REMOVED
            UpdateRegion();
		}
Example #57
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            Point3D customGoLoc = new Point3D(0,0,0);
            switch (version)
            {
            //---------------------------- Solaris Battlegrounds addition (3/3) begin ----------------------------------------------------

            /*  This allows region controllers to be used to define "battlegrounds" where player versus player combat is completely no-holds-barred.
            There is no notoriety problems like criminal/murder status, and is intended for PVP tourneys or all-around-PVP fun.

            */
                case 6:		//case 6 - added battlegrounds flag to serialized data
                {
                    _Battlegrounds = reader.ReadBool();
                    goto case 5;
                }
            //--------------------------- Solaris Battlegrounds addition (3/3) end ------------------------------------------------------
                // New RunUO 2.0 Version (case 5 and 4)
                case 5:
                {
                    customGoLoc = reader.ReadPoint3D();
                    goto case 4;
                }
                case 4:
                {
                    m_RegionArea = ReadRect3DArray(reader);

                    m_Flags = (RegionFlag)reader.ReadInt();

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

                    m_Active = reader.ReadBool();

                    m_RegionName = reader.ReadString();
                    m_RegionPriority = reader.ReadInt();
                    m_Music = (MusicName)reader.ReadInt();
                    m_PlayerLogoutDelay = reader.ReadTimeSpan();
                    m_LightLevel = reader.ReadInt();

                    m_MoveNPCToMap = reader.ReadMap();
                    m_MoveNPCToLoc = reader.ReadPoint3D();
                    m_MovePlayerToMap = reader.ReadMap();
                    m_MovePlayerToLoc = reader.ReadPoint3D();

                    break;
                }

                // Old RunUO 1.0 Version (cases 3-0)
                case 3:
                {
                    m_LightLevel = reader.ReadInt();
                    goto case 2;
                }
                case 2:
                {
                    m_Music = (MusicName)reader.ReadInt();
                    goto case 1;
                }
                case 1:
                {
                    List<Rectangle2D> rects2d = ReadRect2DArray(reader);
                    foreach (Rectangle2D rect in rects2d)
                    {
                        Rectangle3D newrect = Server.Region.ConvertTo3D(rect);
                        DoChooseArea(null, this.Map, newrect.Start, newrect.End, this);
                    }

                    m_RegionPriority = reader.ReadInt();
                    m_PlayerLogoutDelay = reader.ReadTimeSpan();

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

                    m_Flags = (RegionFlag)reader.ReadInt();
                    if (NoPlayerCorpses)
                    {
                        DeleteNPCCorpse = true;
                        DeletePlayerCorpse = true;
                    }
                    if (NoItemDrop)
                    {
                        NoPlayerItemDrop = true;
                        NoNPCItemDrop = true;
                    }
                    // Invert because of change from "Cannot" to "Can"
                    if (CanLootOwnCorpse)
                    {
                        CanLootOwnCorpse = false;
                    }
                    if (CanEnter)
                    {
                        CanEnter = false;
                    }

                    m_RegionName = reader.ReadString();
                    break;
                }
                case 0:
                {
                    List<Rectangle2D> rects2d = ReadRect2DArray(reader);
                    foreach (Rectangle2D rect in rects2d)
                    {
                        Rectangle3D newrect = Server.Region.ConvertTo3D(rect);
                        DoChooseArea(null, this.Map, newrect.Start, newrect.End, this);
                    }

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

                    m_Flags = (RegionFlag)reader.ReadInt();
                    if (NoPlayerCorpses)
                    {
                        DeleteNPCCorpse = true;
                        DeletePlayerCorpse = true;
                    }
                    if (NoItemDrop)
                    {
                        NoPlayerItemDrop = true;
                        NoNPCItemDrop = true;
                    }
                    // Invert because of change from "Cannot" to "Can"
                    if (CanLootOwnCorpse)
                    {
                        CanLootOwnCorpse = false;
                    }
                    if (CanEnter)
                    {
                        CanEnter = false;
                    }

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

            m_AllControls.Add(this);

            if(RegionNameTaken(m_RegionName))
                m_RegionName = FindNewName(m_RegionName);

            UpdateRegion();
            m_CustomGoLocation = customGoLoc;
            CustomGoLocation = customGoLoc;
            UpdateRegion();
        }
Example #58
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();
        }
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {

                case 0:
                {
                    m_Music = (MusicName)reader.ReadInt();
                    m_Priority = reader.ReadInt();
                    m_MobFactionArea = reader.ReadRect2D();
                    m_MobFactionRegionName = reader.ReadString();
                    string mapname = reader.ReadString();
                    try{
                       m_MobFactionMap = Map.Parse(mapname);
                    } catch {}
                    m_CopiedRegion = reader.ReadString();

                    m_MobFactionRegion = new MobFactionRegion(m_MobFactionRegionName, m_MobFactionMap);

                    // do the coord list
                    int count = reader.ReadInt();
                    m_MobFactionRegion.Coords = new ArrayList();
                    for(int i =0;i<count;i++)
                    {
                        m_MobFactionRegion.Coords.Add(reader.ReadRect2D());
                    }

                    m_MobFactionRegion.Priority = m_Priority;
                    m_MobFactionRegion.Music = m_Music;
                    m_MobFactionRegion.Map = m_MobFactionMap;

                    break;
                }
            }

            // refresh the region
            RefreshRegions();
        }
Example #60
0
		public void PlayMusic( Mobile m, MusicName music )
		{
			if ( m_Timer != null && m_Timer.Running )
				EndMusic( m );
			else
				m_ItemID = ItemID;

			m.Send( new PlayMusic( music ) );
			m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 0.5 ), TimeSpan.FromSeconds( 0.5 ), 4, new TimerCallback( Animate ) );
		}