コード例 #1
1
ファイル: VendorInventory.cs プロジェクト: nathanvy/runuo
        public VendorInventory( BaseHouse house, GenericReader reader )
        {
            m_House = house;

            int version = reader.ReadEncodedInt();

            m_Owner = reader.ReadMobile();
            m_VendorName = reader.ReadString();
            m_ShopName = reader.ReadString();

            m_Items = reader.ReadStrongItemList();
            m_Gold = reader.ReadInt();

            m_ExpireTime = reader.ReadDeltaTime();

            if ( m_Items.Count == 0 && m_Gold == 0 )
            {
                Timer.DelayCall( TimeSpan.Zero, new TimerCallback( Delete ) );
            }
            else
            {
                TimeSpan delay = m_ExpireTime - DateTime.UtcNow;
                m_ExpireTimer = new ExpireTimer( this, delay > TimeSpan.Zero ? delay : TimeSpan.Zero );
                m_ExpireTimer.Start();
            }
        }
コード例 #2
0
ファイル: DecayedCorpse.cs プロジェクト: Ravenwolfe/xrunuo
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 0:
                    {
                        BeginDecay( m_DefaultDecayTime );

                        break;
                    }
                case 1:
                    {
                        if ( reader.ReadBool() )
                        {
                            BeginDecay( reader.ReadDeltaTime() - DateTime.Now );
                        }

                        break;
                    }
            }
        }
コード例 #3
0
ファイル: AOE.cs プロジェクト: greeduomacro/dragonknights-uo
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 1:
                    {
                        m_Caster = (BaseCreature)reader.ReadMobile();

                        goto case 0;
                    }
                case 0:
                    {
                        m_End = reader.ReadDeltaTime();

                        m_Timer = new InternalTimer(this, TimeSpan.Zero, true, true);
                        m_Timer.Start();

                        break;
                    }
            }
        }
コード例 #4
0
ファイル: DuelWall.cs プロジェクト: cynricthehun/UOLegends
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            m_End = reader.ReadDeltaTime();

            m_From = reader.ReadMobile();
            m_To = reader.ReadMobile();

            m_Timer = new InternalTimer( this, m_End - DateTime.Now, m_From, m_To );
            m_Timer.Start();
        }
コード例 #5
0
ファイル: BountyHead.cs プロジェクト: greeduomacro/GoUO
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch( version )
			{
				case 0:
				{
					m_Owner = reader.ReadMobile();
					m_Killer = reader.ReadMobile();
					m_TimeOfDeath = reader.ReadDeltaTime();
					break;
				}
			}
		}
コード例 #6
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
            case 0:
                {
                    m_End = reader.ReadDeltaTime();

                    m_Timer = new InternalTimer( this, m_End - DateTime.Now );
                    m_Timer.Start();

                    break;
                }
            }
        }
コード例 #7
0
        public PlantSystem( PlantItem plant, GenericReader reader )
        {
            m_Plant = plant;

            int version = reader.ReadInt();

            m_FertileDirt = reader.ReadBool();

            if ( version >= 1 )
                m_NextGrowth = reader.ReadDateTime();
            else
                m_NextGrowth = reader.ReadDeltaTime();

            m_GrowthIndicator = (PlantGrowthIndicator)reader.ReadInt();

            m_Water = reader.ReadInt();

            m_Hits = reader.ReadInt();
            m_Infestation = reader.ReadInt();
            m_Fungus = reader.ReadInt();
            m_Poison = reader.ReadInt();
            m_Disease = reader.ReadInt();
            m_PoisonPotion = reader.ReadInt();
            m_CurePotion = reader.ReadInt();
            m_HealPotion = reader.ReadInt();
            m_StrengthPotion = reader.ReadInt();

            m_Pollinated = reader.ReadBool();
            m_SeedType = (PlantType)reader.ReadInt();
            m_SeedHue = (PlantHue)reader.ReadInt();
            m_AvailableSeeds = reader.ReadInt();
            m_LeftSeeds = reader.ReadInt();

            m_AvailableResources = reader.ReadInt();
            m_LeftResources = reader.ReadInt();
        }
コード例 #8
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 0:
                    {
                        m_Decays = reader.ReadBool();

                        if (m_Decays)
                        {
                            m_DecayTime = reader.ReadDeltaTime();

                            m_Timer = new InternalTimer(this, m_DecayTime);
                            m_Timer.Start();
                        }

                        break;
                    }
            }
        }
コード例 #9
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			bool newVendorSystem = false;

			switch ( version )
			{
				case 1:
				{
					newVendorSystem = reader.ReadBool();
					m_ShopName = reader.ReadString();
					m_NextPayTime = reader.ReadDeltaTime();
					House = (BaseHouse) reader.ReadItem();

					goto case 0;
				}
				case 0:
				{
					m_Owner = reader.ReadMobile();
					m_BankAccount = reader.ReadInt();
					m_HoldGold = reader.ReadInt();

					m_SellItems = new Hashtable();

					int count = reader.ReadInt();
					for ( int i = 0; i < count; i++ )
					{
						Item item = reader.ReadItem();

						int price = reader.ReadInt();
						if ( price > 100000000 )
							price = 100000000;

						string description = reader.ReadString();

						DateTime created = version < 1 ? DateTime.Now : reader.ReadDateTime();

						if ( item != null )
						{
							SetVendorItem( item, version < 1 && price <= 0 ? -1 : price, description, created );
						}
					}

					break;	
				}
			}

			bool newVendorSystemActivated = BaseHouse.NewVendorSystem && !newVendorSystem;

			if ( version < 1 || newVendorSystemActivated )
			{
				if ( version < 1 )
				{
					m_ShopName = "Shop Not Yet Named";
					Timer.DelayCall( TimeSpan.Zero, new TimerStateCallback( UpgradeFromVersion0 ), newVendorSystemActivated );
				}
				else
				{
					Timer.DelayCall( TimeSpan.Zero, new TimerCallback( FixDresswear ) );
				}

				m_NextPayTime = DateTime.Now + PayTimer.GetInterval();

				if ( newVendorSystemActivated )
				{
					m_HoldGold += m_BankAccount;
					m_BankAccount = 0;
				}
			}

			TimeSpan delay = m_NextPayTime - DateTime.Now;

			m_PayTimer = new PayTimer( this, delay > TimeSpan.Zero ? delay : TimeSpan.Zero );
			m_PayTimer.Start();

			Blessed = false;

			if ( Core.AOS && NameHue == 0x35 )
				NameHue = -1;
		}
コード例 #10
0
ファイル: XmlSpawner2.cs プロジェクト: greeduomacro/hubroot
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();
			bool haveproximityrange = false;
			bool hasnewobjectinfo = false;
			int tmpSpawnListSize = 0;
			ArrayList tmpSubGroup = null;
			ArrayList tmpSequentialResetTime = null;
			ArrayList tmpSequentialResetTo = null;
			ArrayList tmpKillsNeeded = null;
			ArrayList tmpRequireSurface = null;
			ArrayList tmpRestrictKillsToSubgroup = null;
			ArrayList tmpClearOnAdvance = null;
			ArrayList tmpMinDelay = null;
			ArrayList tmpMaxDelay = null;
			ArrayList tmpNextSpawn = null;
			ArrayList tmpDisableSpawn = null;
			ArrayList tmpPackRange = null;
			ArrayList tmpSpawnsPer = null;

			switch( version )
			{
				case 30:
					{
						m_AllowNPCTriggering = reader.ReadBool();
						goto case 29;
					}
				case 29:
					{
						tmpSpawnListSize = reader.ReadInt();
						tmpSpawnsPer = new ArrayList( tmpSpawnListSize );
						for( int i = 0; i < tmpSpawnListSize; ++i )
						{
							int spawnsper = reader.ReadInt();

							tmpSpawnsPer.Add( spawnsper );

						}
						goto case 28;
					}
				case 28:
					{
						if( version < 29 )
							tmpSpawnListSize = reader.ReadInt();

						tmpPackRange = new ArrayList( tmpSpawnListSize );
						for( int i = 0; i < tmpSpawnListSize; ++i )
						{
							int packrange = reader.ReadInt();

							tmpPackRange.Add( packrange );

						}
						goto case 27;
					}
				case 27:
					{
						if( version < 28 )
							tmpSpawnListSize = reader.ReadInt();

						tmpDisableSpawn = new ArrayList( tmpSpawnListSize );
						for( int i = 0; i < tmpSpawnListSize; ++i )
						{
							bool disablespawn = reader.ReadBool();

							tmpDisableSpawn.Add( disablespawn );

						}
						goto case 26;
					}
				case 26:
					{
						m_SpawnOnTrigger = reader.ReadBool();
						m_FirstModified = reader.ReadDateTime();
						m_LastModified = reader.ReadDateTime();
						goto case 25;
					}
				case 25:
					{
						goto case 24;
					}
				case 24:
					{
						if( version < 27 )
							tmpSpawnListSize = reader.ReadInt();
						tmpRestrictKillsToSubgroup = new ArrayList( tmpSpawnListSize );
						tmpClearOnAdvance = new ArrayList( tmpSpawnListSize );
						tmpMinDelay = new ArrayList( tmpSpawnListSize );
						tmpMaxDelay = new ArrayList( tmpSpawnListSize );
						tmpNextSpawn = new ArrayList( tmpSpawnListSize );
						for( int i = 0; i < tmpSpawnListSize; ++i )
						{
							bool restrictkills = reader.ReadBool();
							bool clearadvance = reader.ReadBool();
							double mind = reader.ReadDouble();
							double maxd = reader.ReadDouble();
							DateTime nextspawn = reader.ReadDeltaTime();

							tmpRestrictKillsToSubgroup.Add( restrictkills );
							tmpClearOnAdvance.Add( clearadvance );
							tmpMinDelay.Add( mind );
							tmpMaxDelay.Add( maxd );
							tmpNextSpawn.Add( nextspawn );
						}

						bool hasitems = reader.ReadBool();

						if( hasitems )
						{
							m_ShowBoundsItems = reader.ReadItemList();
						}
						goto case 23;
					}
				case 23:
					{
						IsInactivated = reader.ReadBool();
						SmartSpawning = reader.ReadBool();

						goto case 22;
					}
				case 22:
					{
						SkillTrigger = reader.ReadString();    // note this will also register the skill
						m_skill_that_triggered = (SkillName)reader.ReadInt();
						m_FreeRun = reader.ReadBool();
						m_mob_who_triggered = reader.ReadMobile();
						goto case 21;
					}
				case 21:
					{
						m_DespawnTime = reader.ReadTimeSpan();
						goto case 20;
					}
				case 20:
					{
						if( version < 24 )
							tmpSpawnListSize = reader.ReadInt();
						tmpRequireSurface = new ArrayList( tmpSpawnListSize );
						for( int i = 0; i < tmpSpawnListSize; ++i )
						{
							bool requiresurface = reader.ReadBool();
							tmpRequireSurface.Add( requiresurface );
						}
						goto case 19;
					}
				case 19:
					{
						m_ConfigFile = reader.ReadString();
						m_OnHold = reader.ReadBool();
						m_HoldSequence = reader.ReadBool();
						m_FirstModifiedBy = reader.ReadString();
						m_LastModifiedBy = reader.ReadString();
						// deserialize the keyword tag list
						int tagcount = reader.ReadInt();
						m_KeywordTagList = new ArrayList( tagcount );
						for( int i = 0; i < tagcount; i++ )
						{
							BaseXmlSpawner.KeywordTag tag = new BaseXmlSpawner.KeywordTag( null, this );
							tag.Deserialize( reader );
						}
						goto case 18;
					}
				case 18:
					{
						m_AllowGhostTriggering = reader.ReadBool();
						goto case 17;
					}
				case 17:
					{
						if( version < 25 )
						{
							// the textentrybooks are deleted on deserialization so no need to track them
							reader.ReadItem();
						}
						goto case 16;
					}
				case 16:
					{
						hasnewobjectinfo = true;
						m_SequentialSpawning = reader.ReadInt();
						TimeSpan seqdelay = reader.ReadTimeSpan();
						m_SeqEnd = DateTime.Now + seqdelay;
						if( version < 20 )
						{
							tmpSpawnListSize = reader.ReadInt();
						}
						tmpSubGroup = new ArrayList( tmpSpawnListSize );
						tmpSequentialResetTime = new ArrayList( tmpSpawnListSize );
						tmpSequentialResetTo = new ArrayList( tmpSpawnListSize );
						tmpKillsNeeded = new ArrayList( tmpSpawnListSize );
						for( int i = 0; i < tmpSpawnListSize; ++i )
						{
							int subgroup = reader.ReadInt();
							double resettime = reader.ReadDouble();
							int resetto = reader.ReadInt();
							int killsneeded = reader.ReadInt();
							tmpSubGroup.Add( subgroup );
							tmpSequentialResetTime.Add( resettime );
							tmpSequentialResetTo.Add( resetto );
							tmpKillsNeeded.Add( killsneeded );
						}
						m_RegionName = reader.ReadString();	// 2004.02.08 :: Omega Red
						goto case 15;
					}
				case 15:
					{
						m_ExternalTriggering = reader.ReadBool();
						m_ExternalTrigger = reader.ReadBool();
						goto case 14;
					}
				case 14:
					{
						m_NoItemTriggerName = reader.ReadString();
						goto case 13;
					}
				case 13:
					{
						m_GumpState = reader.ReadString();
						goto case 12;
					}
				case 12:
					{
						int todtype = reader.ReadInt();
						switch( todtype )
						{
							case (int)TODModeType.Gametime:
								m_TODMode = TODModeType.Gametime;
								break;
							case (int)TODModeType.Realtime:
								m_TODMode = TODModeType.Realtime;
								break;
						}
						goto case 11;
					}
				case 11:
					{
						m_KillReset = reader.ReadInt();
						m_skipped = reader.ReadBool();
						m_spawncheck = reader.ReadInt();
						goto case 10;
					}
				case 10:
					{
						m_SetPropertyItem = reader.ReadItem();
						goto case 9;
					}
				case 9:
					{
						m_TriggerProbability = reader.ReadDouble();
						goto case 8;
					}
				case 8:
					{
						m_MobPropertyName = reader.ReadString();
						m_MobTriggerName = reader.ReadString();
						m_PlayerPropertyName = reader.ReadString();
						goto case 7;
					}
				case 7:
					{
						m_SpeechTrigger = reader.ReadString();
						goto case 6;
					}
				case 6:
					{
						m_ItemTriggerName = reader.ReadString();
						goto case 5;
					}
				case 5:
					{
						m_ProximityTriggerMessage = reader.ReadString();
						m_ObjectPropertyItem = reader.ReadItem();
						m_ObjectPropertyName = reader.ReadString();
						m_killcount = reader.ReadInt();
						goto case 4;
					}
				case 4:
					{
						haveproximityrange = true;
						m_ProximityRange = reader.ReadInt();
						m_ProximityTriggerSound = reader.ReadInt();
						m_proximityActivated = reader.ReadBool();
						m_durActivated = reader.ReadBool();
						m_refractActivated = reader.ReadBool();
						m_StackAmount = reader.ReadInt();
						m_TODStart = reader.ReadTimeSpan();
						m_TODEnd = reader.ReadTimeSpan();
						m_MinRefractory = reader.ReadTimeSpan();
						m_MaxRefractory = reader.ReadTimeSpan();
						if( m_refractActivated == true )
						{
							TimeSpan delay = reader.ReadTimeSpan();
							DoTimer3( delay );
						}
						if( m_durActivated == true )
						{
							TimeSpan delay = reader.ReadTimeSpan();
							DoTimer2( delay );
						}
						goto case 3;
					}
				case 3:
					{
						m_ShowContainerStatic = reader.ReadItem() as Static;
						goto case 2;
					}
				case 2:
					{
						m_Duration = reader.ReadTimeSpan();
						goto case 1;
					}
				case 1:
					{
						m_UniqueId = reader.ReadString();
						m_HomeRangeIsRelative = reader.ReadBool();
						goto case 0;
					}
				case 0:
					{
						m_Name = reader.ReadString();
						// backward compatibility with old name storage
						if( m_Name != null && m_Name != String.Empty ) Name = m_Name;
						m_X = reader.ReadInt();
						m_Y = reader.ReadInt();
						m_Width = reader.ReadInt();
						m_Height = reader.ReadInt();
						if( m_Width == m_Height )
							m_SpawnRange = m_Width / 2;
						else
							m_SpawnRange = -1;
						if( !haveproximityrange )
						{
							m_ProximityRange = -1;
						}
						m_WayPoint = reader.ReadItem() as WayPoint;
						m_Group = reader.ReadBool();
						m_MinDelay = reader.ReadTimeSpan();
						m_MaxDelay = reader.ReadTimeSpan();
						m_Count = reader.ReadInt();
						m_Team = reader.ReadInt();
						m_HomeRange = reader.ReadInt();
						m_Running = reader.ReadBool();

						if( m_Running == true )
						{
							TimeSpan delay = reader.ReadTimeSpan();
							DoTimer( delay );
						}

						// Read in the size of the spawn object list
						int SpawnListSize = reader.ReadInt();
						m_SpawnObjects = new ArrayList( SpawnListSize );
						for( int i = 0; i < SpawnListSize; ++i )
						{
							string TypeName = reader.ReadString();
							int TypeMaxCount = reader.ReadInt();

							SpawnObject TheSpawnObject = new SpawnObject( TypeName, TypeMaxCount );

							m_SpawnObjects.Add( TheSpawnObject );

							string typeName = BaseXmlSpawner.ParseObjectType( TypeName );
							// does it have a substitution that might change its validity?
							// if so then let it go

							if( typeName == null || ((SpawnerType.GetType( typeName ) == null) &&
								(!BaseXmlSpawner.IsTypeOrItemKeyword( typeName ) && typeName.IndexOf( '{' ) == -1 && !typeName.StartsWith( "*" ) && !typeName.StartsWith( "#" ))) )
							{
								if( m_WarnTimer == null )
									m_WarnTimer = new WarnTimer2();

								m_WarnTimer.Add( Location, Map, TypeName );

								this.status_str = "invalid type: " + typeName;
							}

							// Read in the number of spawns already
							int SpawnedCount = reader.ReadInt();

							TheSpawnObject.SpawnedObjects = new ArrayList( SpawnedCount );

							for( int x = 0; x < SpawnedCount; ++x )
							{
								int serial = reader.ReadInt();
								if( serial < -1 )
								{
									// minusone is reserved for unknown types by default
									//  minustwo on is used for referencing keyword tags
									int tagserial = -1 * (serial + 2);
									// get the tag with that serial and add it
									BaseXmlSpawner.KeywordTag t = BaseXmlSpawner.GetFromTagList( this, tagserial );
									if( t != null )
									{
										TheSpawnObject.SpawnedObjects.Add( t );
									}
								}
								else
								{
									IEntity e = World.FindEntity( serial );

									if( e != null )
										TheSpawnObject.SpawnedObjects.Add( e );
								}
							}
						}
						// now have to reintegrate the later version spawnobject information into the earlier version desered objects
						if( hasnewobjectinfo && tmpSpawnListSize == SpawnListSize )
						{
							for( int i = 0; i < SpawnListSize; ++i )
							{
								SpawnObject so = (SpawnObject)m_SpawnObjects[i];

								so.SubGroup = (int)tmpSubGroup[i];
								so.SequentialResetTime = (double)tmpSequentialResetTime[i];
								so.SequentialResetTo = (int)tmpSequentialResetTo[i];
								so.KillsNeeded = (int)tmpKillsNeeded[i];
								if( version > 19 )
									so.RequireSurface = (bool)tmpRequireSurface[i];
								bool restrictkills = false;
								bool clearadvance = true;
								double mind = -1;
								double maxd = -1;
								DateTime nextspawn = DateTime.MinValue;
								if( version > 23 )
								{
									restrictkills = (bool)tmpRestrictKillsToSubgroup[i];
									clearadvance = (bool)tmpClearOnAdvance[i];
									mind = (double)tmpMinDelay[i];
									maxd = (double)tmpMaxDelay[i];
									nextspawn = (DateTime)tmpNextSpawn[i];
								}
								so.RestrictKillsToSubgroup = restrictkills;
								so.ClearOnAdvance = clearadvance;
								so.MinDelay = mind;
								so.MaxDelay = maxd;
								so.NextSpawn = nextspawn;

								bool disablespawn = false;
								if( version > 26 )
								{
									disablespawn = (bool)tmpDisableSpawn[i];
								}
								so.Disabled = disablespawn;

								int packrange = -1;
								if( version > 27 )
								{
									packrange = (int)tmpPackRange[i];
								}
								so.PackRange = packrange;

								int spawnsper = 1;
								if( version > 28 )
								{
									spawnsper = (int)tmpSpawnsPer[i];
								}
								so.SpawnsPerTick = spawnsper;

							}
						}

						break;
					}
			}
		}
コード例 #11
0
ファイル: BaseLight.cs プロジェクト: Ravenwolfe/xrunuo
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 0:
                    {
                        m_BurntOut = reader.ReadBool();
                        m_Burning = reader.ReadBool();
                        m_Duration = reader.ReadTimeSpan();
                        m_Protected = reader.ReadBool();

                        if ( m_Burning && m_Duration != TimeSpan.Zero )
                        {
                            DoTimer( reader.ReadDeltaTime() - DateTime.Now );
                        }

                        break;
                    }
            }
        }
コード例 #12
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            m_CurrentAI = (AIType)reader.ReadInt();
            m_DefaultAI = (AIType)reader.ReadInt();

            m_iRangePerception = reader.ReadInt();
            m_iRangeFight = reader.ReadInt();

            m_iTeam = reader.ReadInt();

            m_dActiveSpeed = reader.ReadDouble();
            m_dPassiveSpeed = reader.ReadDouble();
            m_dCurrentSpeed = reader.ReadDouble();

            double activeSpeed = m_dActiveSpeed;
            double passiveSpeed = m_dPassiveSpeed;

            SpeedInfo.GetSpeeds( this, ref activeSpeed, ref passiveSpeed );

            bool isStandardActive = false;
            for ( int i = 0; !isStandardActive && i < m_StandardActiveSpeeds.Length; ++i )
                isStandardActive = ( m_dActiveSpeed == m_StandardActiveSpeeds[i] );

            bool isStandardPassive = false;
            for ( int i = 0; !isStandardPassive && i < m_StandardPassiveSpeeds.Length; ++i )
                isStandardPassive = ( m_dPassiveSpeed == m_StandardPassiveSpeeds[i] );

            if ( isStandardActive && m_dCurrentSpeed == m_dActiveSpeed )
                m_dCurrentSpeed = activeSpeed;
            else if ( isStandardPassive && m_dCurrentSpeed == m_dPassiveSpeed )
                m_dCurrentSpeed = passiveSpeed;

            if ( isStandardActive )
                m_dActiveSpeed = activeSpeed;

            if ( isStandardPassive )
                m_dPassiveSpeed = passiveSpeed;

            if ( m_iRangePerception == OldRangePerception )
                m_iRangePerception = DefaultRangePerception;

            m_pHome.X = reader.ReadInt();
            m_pHome.Y = reader.ReadInt();
            m_pHome.Z = reader.ReadInt();

            if ( version >= 1 )
            {
                m_iRangeHome = reader.ReadInt();

                int i, iCount;

                iCount = reader.ReadInt();
                for ( i=0; i< iCount; i++ )
                {
                    string str = reader.ReadString();
                    Type type = Type.GetType( str );

                    if ( type != null )
                    {
                        m_arSpellAttack.Add( type );
                    }
                }

                iCount = reader.ReadInt();
                for ( i=0; i< iCount; i++ )
                {
                    string str = reader.ReadString();
                    Type type = Type.GetType( str );

                    if ( type != null )
                    {
                        m_arSpellDefense.Add( type );
                    }
                }
            }
            else
            {
                m_iRangeHome = 0;
            }

            if ( version >= 2 )
            {
                m_FightMode = ( FightMode )reader.ReadInt();

                m_bControled = reader.ReadBool();
                m_ControlMaster = reader.ReadMobile();
                m_ControlTarget = reader.ReadMobile();
                m_ControlDest = reader.ReadPoint3D();
                m_ControlOrder = (OrderType) reader.ReadInt();

                m_dMinTameSkill = reader.ReadDouble();

                if ( version < 9 )
                    reader.ReadDouble();

                m_bTamable = reader.ReadBool();
                m_bSummoned = reader.ReadBool();

                if ( m_bSummoned )
                {
                    m_SummonEnd = reader.ReadDeltaTime();
                    new UnsummonTimer( m_ControlMaster, this, m_SummonEnd - DateTime.Now ).Start();
                }

                m_iControlSlots = reader.ReadInt();
            }
            else
            {
                m_FightMode = FightMode.Closest;

                m_bControled = false;
                m_ControlMaster = null;
                m_ControlTarget = null;
                m_ControlOrder = OrderType.None;
            }

            if ( version >= 3 )
                m_Loyalty = (PetLoyalty)reader.ReadInt();
            else
                m_Loyalty = PetLoyalty.WonderfullyHappy;

            if ( version >= 4 )
                m_CurrentWayPoint = reader.ReadItem() as WayPoint;

            if ( version >= 5 )
                m_SummonMaster = reader.ReadMobile();

            if ( version >= 6 )
            {
                m_HitsMax = reader.ReadInt();
                m_StamMax = reader.ReadInt();
                m_ManaMax = reader.ReadInt();
                m_DamageMin = reader.ReadInt();
                m_DamageMax = reader.ReadInt();
            }

            if ( version >= 7 )
            {
                m_PhysicalResistance = reader.ReadInt();
                m_PhysicalDamage = reader.ReadInt();

                m_FireResistance = reader.ReadInt();
                m_FireDamage = reader.ReadInt();

                m_ColdResistance = reader.ReadInt();
                m_ColdDamage = reader.ReadInt();

                m_PoisonResistance = reader.ReadInt();
                m_PoisonDamage = reader.ReadInt();

                m_EnergyResistance = reader.ReadInt();
                m_EnergyDamage = reader.ReadInt();
            }

            if ( version >= 8 )
                m_Owners = reader.ReadMobileList();
            else
                m_Owners = new ArrayList();

            if ( version >= 10 )
            {
                m_IsDeadPet = reader.ReadBool();
                m_IsBonded = reader.ReadBool();
                m_BondingBegin = reader.ReadDateTime();
                m_OwnerAbandonTime = reader.ReadDateTime();
            }

            if ( version >= 11 )
                m_HasGeneratedLoot = reader.ReadBool();
            else
                m_HasGeneratedLoot = true;

                // temporary mod for conversion
                //reader.ReadTimeSpan();
                //m_Paragon = reader.ReadBool();

            if ( version >= 12 )
                m_Paragon = reader.ReadBool();
            else
                m_Paragon = false;

            if ( version >= 13 && reader.ReadBool() )
                m_Friends = reader.ReadMobileList();
            else if ( version < 13 && m_ControlOrder >= OrderType.Unfriend )
                ++m_ControlOrder;

            CheckStatTimers();

            ChangeAIType(m_CurrentAI);

            // ARTEGORDONMOD
            // PlayerRangeSensitiveMod
            if ( version >= 14 )
            {
                TimeSpan restartDeactivationdelay = reader.ReadTimeSpan();
                if(m_AI != null) {
                    m_AI.m_RestartDeactivationdelay = restartDeactivationdelay;
                }
            }

            if ( m_IsBonded == true )
                m_IsBonded = false;

            AddFollowers();

            if ( IsAnimatedDead )
                Spells.Necromancy.AnimateDeadSpell.Register( m_SummonMaster, this );
        }
コード例 #13
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 4:
                    {
                        m_WalkingRange = reader.ReadInt();
                        m_SpawnID = reader.ReadInt();
                        m_CountA = reader.ReadInt();
                        m_CountB = reader.ReadInt();
                        m_CountC = reader.ReadInt();
                        m_CountD = reader.ReadInt();
                        m_CountE = reader.ReadInt();

                        goto case 3;
                    }
                case 3:
                case 2:
                    {
                        m_WayPoint = reader.ReadItem() as WayPoint;

                        goto case 1;
                    }

                case 1:
                    {
                        m_Group = reader.ReadBool();

                        goto case 0;
                    }

                case 0:
                    {
                        m_MinDelay = reader.ReadTimeSpan();
                        m_MaxDelay = reader.ReadTimeSpan();
                        m_Count = reader.ReadInt();
                        m_Team = reader.ReadInt();
                        m_HomeRange = reader.ReadInt();
                        m_Running = reader.ReadBool();

                        TimeSpan ts = TimeSpan.Zero;

                        if (m_Running)
                            ts = reader.ReadDeltaTime() - DateTime.Now;

                        int size = reader.ReadInt();
                        m_CreaturesName = new List<string>(size);
                        for (int i = 0; i < size; ++i)
                        {
                            string creatureString = reader.ReadString();

                            m_CreaturesName.Add(creatureString);
                            string typeName = ParseType(creatureString);

                            if (ScriptCompiler.FindTypeByName(typeName) == null)
                            {
                                if (m_WarnTimer == null)
                                    m_WarnTimer = new WarnTimer();

                                m_WarnTimer.Add(Location, Map, typeName);
                            }
                        }

                        int sizeA = reader.ReadInt();
                        m_CreaturesNameA = new List<string>(sizeA);
                        for (int i = 0; i < sizeA; ++i)
                        {
                            string creatureString = reader.ReadString();

                            m_CreaturesNameA.Add(creatureString);
                            string typeName = ParseType(creatureString);

                            if (ScriptCompiler.FindTypeByName(typeName) == null)
                            {
                                if (m_WarnTimer == null)
                                    m_WarnTimer = new WarnTimer();

                                m_WarnTimer.Add(Location, Map, typeName);
                            }
                        }

                        int sizeB = reader.ReadInt();
                        m_CreaturesNameB = new List<string>(sizeB);
                        for (int i = 0; i < sizeB; ++i)
                        {
                            string creatureString = reader.ReadString();

                            m_CreaturesNameB.Add(creatureString);
                            string typeName = ParseType(creatureString);

                            if (ScriptCompiler.FindTypeByName(typeName) == null)
                            {
                                if (m_WarnTimer == null)
                                    m_WarnTimer = new WarnTimer();

                                m_WarnTimer.Add(Location, Map, typeName);
                            }
                        }

                        int sizeC = reader.ReadInt();
                        m_CreaturesNameC = new List<string>(sizeC);
                        for (int i = 0; i < sizeC; ++i)
                        {
                            string creatureString = reader.ReadString();

                            m_CreaturesNameC.Add(creatureString);
                            string typeName = ParseType(creatureString);

                            if (ScriptCompiler.FindTypeByName(typeName) == null)
                            {
                                if (m_WarnTimer == null)
                                    m_WarnTimer = new WarnTimer();

                                m_WarnTimer.Add(Location, Map, typeName);
                            }
                        }

                        int sizeD = reader.ReadInt();
                        m_CreaturesNameD = new List<string>(sizeD);
                        for (int i = 0; i < sizeD; ++i)
                        {
                            string creatureString = reader.ReadString();

                            m_CreaturesNameD.Add(creatureString);
                            string typeName = ParseType(creatureString);

                            if (ScriptCompiler.FindTypeByName(typeName) == null)
                            {
                                if (m_WarnTimer == null)
                                    m_WarnTimer = new WarnTimer();

                                m_WarnTimer.Add(Location, Map, typeName);
                            }
                        }

                        int sizeE = reader.ReadInt();
                        m_CreaturesNameE = new List<string>(sizeE);
                        for (int i = 0; i < sizeE; ++i)
                        {
                            string creatureString = reader.ReadString();

                            m_CreaturesNameE.Add(creatureString);
                            string typeName = ParseType(creatureString);

                            if (ScriptCompiler.FindTypeByName(typeName) == null)
                            {
                                if (m_WarnTimer == null)
                                    m_WarnTimer = new WarnTimer();

                                m_WarnTimer.Add(Location, Map, typeName);
                            }
                        }

                        int count = reader.ReadInt();
                        m_Creatures = new List<IEntity>(count);
                        for (int i = 0; i < count; ++i)
                        {
                            IEntity e = World.FindEntity(reader.ReadInt());

                            if (e != null)
                                m_Creatures.Add(e);
                        }

                        int countA = reader.ReadInt();
                        m_CreaturesA = new List<IEntity>(countA);
                        for (int i = 0; i < countA; ++i)
                        {
                            IEntity e = World.FindEntity(reader.ReadInt());

                            if (e != null)
                                m_CreaturesA.Add(e);
                        }

                        int countB = reader.ReadInt();
                        m_CreaturesB = new List<IEntity>(countB);
                        for (int i = 0; i < countB; ++i)
                        {
                            IEntity e = World.FindEntity(reader.ReadInt());

                            if (e != null)
                                m_CreaturesB.Add(e);
                        }

                        int countC = reader.ReadInt();
                        m_CreaturesC = new List<IEntity>(countC);
                        for (int i = 0; i < countC; ++i)
                        {
                            IEntity e = World.FindEntity(reader.ReadInt());

                            if (e != null)
                                m_CreaturesC.Add(e);
                        }

                        int countD = reader.ReadInt();
                        m_CreaturesD = new List<IEntity>(countD);
                        for (int i = 0; i < countD; ++i)
                        {
                            IEntity e = World.FindEntity(reader.ReadInt());

                            if (e != null)
                                m_CreaturesD.Add(e);
                        }

                        int countE = reader.ReadInt();
                        m_CreaturesE = new List<IEntity>(countE);
                        for (int i = 0; i < countE; ++i)
                        {
                            IEntity e = World.FindEntity(reader.ReadInt());

                            if (e != null)
                                m_CreaturesE.Add(e);
                        }

                        if (m_Running)
                            DoTimer(ts);

                        break;
                    }
            }

            if (version < 3 && Weight == 0)
                Weight = -1;
        }
コード例 #14
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            switch (version)
            {
                case 26:
                    {
                        #region GeNova: Mondain's Legacy
                        m_Quests = QuestReader.Quests(reader, this);
                        m_Chains = QuestReader.Chains(reader);

                        m_Collections = new Dictionary<Collection, int>();
                        m_CollectionTitles = new List<object>();

                        for (int i = reader.ReadInt(); i > 0; i--)
                            m_Collections.Add((Collection)reader.ReadInt(), reader.ReadInt());

                        for (int i = reader.ReadInt(); i > 0; i--)
                            m_CollectionTitles.Add(QuestReader.Object(reader));

                        m_SelectedTitle = reader.ReadInt();
                        m_Peaced = reader.ReadDateTime();
                        #endregion

                        goto case 25;
                    }
                case 25:
                    {
                        int recipeCount = reader.ReadInt();

                        if (recipeCount > 0)
                        {
                            m_AcquiredRecipes = new Dictionary<int, bool>();

                            for (int i = 0; i < recipeCount; i++)
                            {
                                int r = reader.ReadInt();
                                if (reader.ReadBool())	//Don't add in recipies which we haven't gotten or have been removed
                                    m_AcquiredRecipes.Add(r, true);
                            }
                        }
                        goto case 24;
                    }
                case 24:
                    {
                        m_LastHonorLoss = reader.ReadDeltaTime();
                        goto case 23;
                    }
                case 23:
                    {
                        m_ChampionTitles = new ChampionTitleInfo(reader);
                        goto case 22;
                    }
                case 22:
                    {
                        m_LastValorLoss = reader.ReadDateTime();
                        goto case 21;
                    }
                case 21:
                    {
                        m_ToTItemsTurnedIn = reader.ReadEncodedInt();
                        m_ToTTotalMonsterFame = reader.ReadInt();
                        goto case 20;
                    }
                case 20:
                    {
                        m_AllianceMessageHue = reader.ReadEncodedInt();
                        m_GuildMessageHue = reader.ReadEncodedInt();

                        goto case 19;
                    }
                case 19:
                    {
                        int rank = reader.ReadEncodedInt();
                        int maxRank = Guilds.RankDefinition.Ranks.Length - 1;
                        if (rank > maxRank)
                            rank = maxRank;

                        m_GuildRank = Guilds.RankDefinition.Ranks[rank];
                        m_LastOnline = reader.ReadDateTime();
                        goto case 18;
                    }
                case 18:
                    {
                        m_SolenFriendship = (SolenFriendship)reader.ReadEncodedInt();

                        goto case 17;
                    }
                case 17: // changed how DoneQuests is serialized
                case 16:
                    {
                        m_Quest = QuestSerializer.DeserializeQuest(reader);

                        if (m_Quest != null)
                            m_Quest.From = this;

                        int count = reader.ReadEncodedInt();

                        if (count > 0)
                        {
                            m_DoneQuests = new List<QuestRestartInfo>();

                            for (int i = 0; i < count; ++i)
                            {
                                Type questType = QuestSerializer.ReadType(QuestSystem.QuestTypes, reader);
                                DateTime restartTime;

                                if (version < 17)
                                    restartTime = DateTime.MaxValue;
                                else
                                    restartTime = reader.ReadDateTime();

                                m_DoneQuests.Add(new QuestRestartInfo(questType, restartTime));
                            }
                        }

                        m_Profession = reader.ReadEncodedInt();
                        goto case 15;
                    }
                case 15:
                    {
                        m_LastCompassionLoss = reader.ReadDeltaTime();
                        goto case 14;
                    }
                case 14:
                    {
                        m_CompassionGains = reader.ReadEncodedInt();

                        if (m_CompassionGains > 0)
                            m_NextCompassionDay = reader.ReadDeltaTime();

                        goto case 13;
                    }
                case 13: // just removed m_PayedInsurance list
                case 12:
                    {
                        m_BOBFilter = new Engines.BulkOrders.BOBFilter(reader);
                        goto case 11;
                    }
                case 11:
                    {
                        if (version < 13)
                        {
                            List<Item> payed = reader.ReadStrongItemList();

                            for (int i = 0; i < payed.Count; ++i)
                                payed[i].PayedInsurance = true;
                        }

                        goto case 10;
                    }
                case 10:
                    {
                        if (reader.ReadBool())
                        {
                            m_HairModID = reader.ReadInt();
                            m_HairModHue = reader.ReadInt();
                            m_BeardModID = reader.ReadInt();
                            m_BeardModHue = reader.ReadInt();

                            // We cannot call SetHairMods( -1, -1 ) here because the items have not yet loaded
                            Timer.DelayCall(TimeSpan.Zero, new TimerCallback(RevertHair));
                        }

                        goto case 9;
                    }
                case 9:
                    {
                        SavagePaintExpiration = reader.ReadTimeSpan();

                        if (SavagePaintExpiration > TimeSpan.Zero)
                        {
                            BodyMod = (Female ? 184 : 183);
                            HueMod = 0;
                        }

                        goto case 8;
                    }
                case 8:
                    {
                        m_NpcGuild = (NpcGuild)reader.ReadInt();
                        m_NpcGuildJoinTime = reader.ReadDateTime();
                        m_NpcGuildGameTime = reader.ReadTimeSpan();
                        goto case 7;
                    }
                case 7:
                    {
                        m_PermaFlags = reader.ReadStrongMobileList();
                        goto case 6;
                    }
                case 6:
                    {
                        NextTailorBulkOrder = reader.ReadTimeSpan();
                        goto case 5;
                    }
                case 5:
                    {
                        NextSmithBulkOrder = reader.ReadTimeSpan();
                        goto case 4;
                    }
                case 4:
                    {
                        m_LastJusticeLoss = reader.ReadDeltaTime();
                        m_JusticeProtectors = reader.ReadStrongMobileList();
                        goto case 3;
                    }
                case 3:
                    {
                        m_LastSacrificeGain = reader.ReadDeltaTime();
                        m_LastSacrificeLoss = reader.ReadDeltaTime();
                        m_AvailableResurrects = reader.ReadInt();
                        goto case 2;
                    }
                case 2:
                    {
                        m_Flags = (PlayerFlag)reader.ReadInt();
                        goto case 1;
                    }
                case 1:
                    {
                        m_LongTermElapse = reader.ReadTimeSpan();
                        m_ShortTermElapse = reader.ReadTimeSpan();
                        m_GameTime = reader.ReadTimeSpan();
                        goto case 0;
                    }
                case 0:
                    {
                        break;
                    }
            }

            #region GeNova: Mondain's Legacy
            if (m_Quests == null)
                m_Quests = new List<BaseQuest>();

            if (m_Chains == null)
                m_Chains = new Dictionary<QuestChain, BaseChain>();

            if (m_DoneQuests == null)
                m_DoneQuests = new List<QuestRestartInfo>();

            if (m_Collections == null)
                m_Collections = new Dictionary<Collection, int>();

            if (m_CollectionTitles == null)
                m_CollectionTitles = new List<object>();
            #endregion

            // Professions weren't verified on 1.0 RC0
            if (!CharacterCreation.VerifyProfession(m_Profession))
                m_Profession = 0;

            if (m_PermaFlags == null)
                m_PermaFlags = new List<Mobile>();

            if (m_JusticeProtectors == null)
                m_JusticeProtectors = new List<Mobile>();

            if (m_BOBFilter == null)
                m_BOBFilter = new Engines.BulkOrders.BOBFilter();

            if (m_GuildRank == null)
                m_GuildRank = Guilds.RankDefinition.Member;	//Default to member if going from older verstion to new version (only time it should be null)

            if (m_LastOnline == DateTime.MinValue && Account != null)
                m_LastOnline = ((Account)Account).LastLogin;

            if (m_ChampionTitles == null)
                m_ChampionTitles = new ChampionTitleInfo();

            List<Mobile> list = this.Stabled;

            for (int i = 0; i < list.Count; ++i)
            {
                BaseCreature bc = list[i] as BaseCreature;

                if (bc != null)
                    bc.IsStabled = true;
            }

            CheckAtrophies(this);


            if (Hidden)	//Hiding is the only buff where it has an effect that's serialized.
                AddBuff(new BuffInfo(BuffIcon.HidingAndOrStealth, 1075655));
        }
コード例 #15
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 2:
				{
					m_Guardians = reader.ReadStrongMobileList();
					m_Temporary = reader.ReadBool();

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

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

					if ( version < 2 )
						m_Guardians = new List<Mobile>();

					break;
				}
			}

			if ( !m_Temporary )
			{
				m_Timer = new DeleteTimer( this, m_DeleteTime );
				m_Timer.Start();
			}
			else
			{
				Delete();
			}
		}
コード例 #16
0
ファイル: BaseBoat.cs プロジェクト: PepeBiondi/runsa
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 3:
				{
					m_MapItem = (MapItem) reader.ReadItem();
					m_NextNavPoint = reader.ReadInt();

					goto case 2;
				}
				case 2:
				{
					m_Facing = (Direction)reader.ReadInt();

					goto case 1;
				}
				case 1:
				{
					m_DecayTime = reader.ReadDeltaTime();

					goto case 0;
				}
				case 0:
				{
					if ( version < 3 )
						m_NextNavPoint = -1;

					if ( version < 2 )
					{
						if ( ItemID == NorthID )
							m_Facing = Direction.North;
						else if ( ItemID == SouthID )
							m_Facing = Direction.South;
						else if ( ItemID == EastID )
							m_Facing = Direction.East;
						else if ( ItemID == WestID )
							m_Facing = Direction.West;
					}

					m_Owner = reader.ReadMobile();
					m_PPlank = reader.ReadItem() as Plank;
					m_SPlank = reader.ReadItem() as Plank;
					m_TillerMan = reader.ReadItem() as TillerMan;
					m_Hold = reader.ReadItem() as Hold;
					m_Anchored = reader.ReadBool();
					m_ShipName = reader.ReadString();

					if ( version < 1)
						Refresh();

					break;
				}
			}

			m_Instances.Add( this );
		}
コード例 #17
0
ファイル: MonsterHelper.cs プロジェクト: Ravenwolfe/xrunuo
            public override void Deserialize( GenericReader reader )
            {
                base.Deserialize( reader );

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

                m_Caster = reader.ReadMobile();
                m_End = reader.ReadDeltaTime();

                m_Timer = new InternalTimer( this );
                m_Timer.Start();
            }
コード例 #18
0
		public PuzzleChestSolutionAndTime( GenericReader reader ) : base( reader )
		{
			int version = reader.ReadEncodedInt();

			m_When = reader.ReadDeltaTime();
		}
コード例 #19
0
ファイル: Corpse.cs プロジェクト: Leodinas/uolite
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 11:
                    {
                        // Version 11, we move all bools to a CorpseFlag
                        m_Flags = (CorpseFlag)reader.ReadInt();

                        m_TimeOfDeath = reader.ReadDeltaTime();

                        int count = reader.ReadInt();

                        for( int i = 0; i < count; ++i )
                        {
                            Item item = reader.ReadItem();

                            if( reader.ReadBool() )
                                SetRestoreInfo( item, reader.ReadPoint3D() );
                            else if( item != null )
                                SetRestoreInfo( item, item.Location );
                        }

                        if( reader.ReadBool() )
                            BeginDecay( reader.ReadDeltaTime() - DateTime.Now );

                        m_Looters = reader.ReadStrongMobileList();
                        m_Killer = reader.ReadMobile();

                        m_Aggressors = reader.ReadStrongMobileList();
                        m_Owner = reader.ReadMobile();

                        m_CorpseName = reader.ReadString();

                        m_AccessLevel = (AccessLevel)reader.ReadInt();
                        reader.ReadInt(); // guild reserve
                        m_Kills = reader.ReadInt();

                        m_EquipItems = reader.ReadStrongItemList();
                        break;
                    }
                case 10:
                {
                    m_TimeOfDeath = reader.ReadDeltaTime();

                    goto case 9;
                }
                case 9:
                {
                    int count = reader.ReadInt();

                    for ( int i = 0; i < count; ++i )
                    {
                        Item item = reader.ReadItem();

                        if ( reader.ReadBool() )
                            SetRestoreInfo( item, reader.ReadPoint3D() );
                        else if ( item != null )
                            SetRestoreInfo( item, item.Location );
                    }

                    goto case 8;
                }
                case 8:
                {
                    SetFlag( CorpseFlag.VisitedByTaxidermist, reader.ReadBool() );

                    goto case 7;
                }
                case 7:
                {
                    if ( reader.ReadBool() )
                        BeginDecay( reader.ReadDeltaTime() - DateTime.Now );

                    goto case 6;
                }
                case 6:
                {
                    m_Looters = reader.ReadStrongMobileList();
                    m_Killer = reader.ReadMobile();

                    goto case 5;
                }
                case 5:
                {
                    SetFlag( CorpseFlag.Carved, reader.ReadBool() );

                    goto case 4;
                }
                case 4:
                {
                    m_Aggressors = reader.ReadStrongMobileList();

                    goto case 3;
                }
                case 3:
                {
                    m_Owner = reader.ReadMobile();

                    goto case 2;
                }
                case 2:
                {
                    SetFlag( CorpseFlag.NoBones, reader.ReadBool() );

                    goto case 1;
                }
                case 1:
                {
                    m_CorpseName = reader.ReadString();

                    goto case 0;
                }
                case 0:
                {
                    if ( version < 10 )
                        m_TimeOfDeath = DateTime.Now;

                    if ( version < 7 )
                        BeginDecay( m_DefaultDecayTime );

                    if ( version < 6 )
                        m_Looters = new List<Mobile>();

                    if ( version < 4 )
                        m_Aggressors = new List<Mobile>();

                    m_AccessLevel = (AccessLevel)reader.ReadInt();
                    reader.ReadInt(); // guild reserve
                    m_Kills = reader.ReadInt();
                    SetFlag( CorpseFlag.Criminal, reader.ReadBool() );

                    m_EquipItems = reader.ReadStrongItemList();

                    break;
                }
            }
        }
コード例 #20
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
            int version = reader.ReadInt();

            switch ( version )
            {
                case 18:
                {
                    m_NextBountyDecay = reader.ReadDateTime();
                    goto case 17;
                }
                case 17:
                {
                    m_LastUpdate = reader.ReadInt();
                    m_LastLogin = reader.ReadDateTime();

                    goto case 16;
                }
                case 16:
                {
                    m_NextNotoUp = reader.ReadDateTime();
                    m_Cohesion = reader.ReadInt();
                    m_LastCohesion = DateTime.Now - reader.ReadTimeSpan();
                    m_AssumeGhost = reader.ReadBool();

                    int skillCount = reader.ReadByte();
                    m_SkillUsageOrder = new byte[skillCount];
                    for(int i=0;i<skillCount;i++)
                        m_SkillUsageOrder[i] = reader.ReadByte();

                    goto case 15;
                }
                case 15:
                {
                    m_Bounty = reader.ReadInt();

                    goto case 14;
                }
                case 14:
                {
                    m_CompassionGains = reader.ReadEncodedInt();

                    if ( m_CompassionGains > 0 )
                        m_NextCompassionDay = reader.ReadDeltaTime();

                    goto case 13;
                }
                case 13: // just removed m_PayedInsurance list
                case 12:
                {
                    goto case 11;
                }
                case 11:
                {
                    if ( version < 13 )
                    {
                        ArrayList payed = reader.ReadItemList();

                        for ( int i = 0; i < payed.Count; ++i )
                            ((Item)payed[i]).PayedInsurance = true;
                    }

                    goto case 10;
                }
                case 10:
                {
                    if ( reader.ReadBool() )
                    {
                        m_HairModID = reader.ReadInt();
                        m_HairModHue = reader.ReadInt();
                        m_BeardModID = reader.ReadInt();
                        m_BeardModHue = reader.ReadInt();

                        // We cannot call SetHairMods( -1, -1 ) here because the items have not yet loaded
                        Timer.DelayCall( TimeSpan.Zero, new TimerCallback( RevertHair ) );
                    }

                    goto case 9;
                }
                case 9:
                {
                    SavagePaintExpiration = reader.ReadTimeSpan();

                    if ( SavagePaintExpiration > TimeSpan.Zero )
                    {
                        BodyMod = ( Female ? 184 : 183 );
                        HueMod = 0;
                    }

                    goto case 8;
                }
                case 8:
                {
                    m_NpcGuild = (NpcGuild)reader.ReadInt();
                    m_NpcGuildJoinTime = reader.ReadDateTime();
                    m_NpcGuildGameTime = reader.ReadTimeSpan();
                    goto case 7;
                }
                case 7:
                {
                    /*m_PermaFlags =*/ reader.ReadMobileList();
                    goto case 6;
                }
                case 6:
                {
                    NextTailorBulkOrder = reader.ReadTimeSpan();
                    goto case 5;
                }
                case 5:
                {
                    NextSmithBulkOrder = reader.ReadTimeSpan();
                    goto case 4;
                }
                case 4:
                {
                    m_LastJusticeLoss = reader.ReadDeltaTime();
                    m_JusticeProtectors = reader.ReadMobileList();
                    goto case 3;
                }
                case 3:
                {
                    m_LastSacrificeGain = reader.ReadDeltaTime();
                    m_LastSacrificeLoss = reader.ReadDeltaTime();
                    m_AvailableResurrects = reader.ReadInt();
                    goto case 2;
                }
                case 2:
                {
                    m_Flags = (PlayerFlag)reader.ReadInt();
                    goto case 1;
                }
                case 1:
                {
                    m_LongTermElapse = reader.ReadTimeSpan();
                    m_ShortTermElapse = reader.ReadTimeSpan();
                    m_GameTime = reader.ReadTimeSpan();
                    goto case 0;
                }
                case 0:
                {
                    break;
                }
            }

            if ( m_PermaFlags == null )
                m_PermaFlags = new ArrayList();

            if ( m_JusticeProtectors == null )
                m_JusticeProtectors = new ArrayList();

            List<Mobile> list = this.Stabled;

            for ( int i = 0; i < list.Count; ++i )
            {
                BaseCreature bc = list[i] as BaseCreature;

                if ( bc != null )
                    bc.IsStabled = true;
            }

            if ( m_NextBountyDecay == DateTime.MinValue )
            {
                if ( m_LastLogin != DateTime.MinValue )
                    m_NextBountyDecay = m_LastLogin + TimeSpan.FromDays( 1.0 );
            }

            while ( m_Bounty > 0 && m_NextBountyDecay < DateTime.Now )
            {
                m_Bounty -= 100;
                m_NextBountyDecay += TimeSpan.FromDays( 1.0 );
            }

            if ( m_Bounty <= 0 )
            {
                m_Bounty = 0;
                Kills = 0;
            }

            if ( m_Bounty > 0 && m_Bounty > BountyBoard.LowestBounty )
                BountyBoard.Update( this );

            if ( m_SkillUsageOrder == null )
            {
                m_SkillUsageOrder = new byte[PlayerMobile.SkillCount];
                for(int i=0;i<PlayerMobile.SkillCount;i++)
                    m_SkillUsageOrder[i] = (byte)i;
            }
        }
コード例 #21
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 1:
                {
                    m_Crafter = reader.ReadMobile();
                    m_Quality = (CraftQuality)reader.ReadEncodedInt();
                    m_Resource = (CraftResource)reader.ReadEncodedInt();
                    goto case 0;
                }
                case 0:
                {
                    m_BurntOut = reader.ReadBool();
                    m_Burning = reader.ReadBool();
                    m_Duration = reader.ReadTimeSpan();
                    m_Protected = reader.ReadBool();

                    if ( m_Burning && m_Duration != TimeSpan.Zero )
                        DoTimer( reader.ReadDeltaTime() - DateTime.Now );

                    break;
                }
            }

            if ( version < 1 )
            {
                m_Quality = CraftQuality.Regular;
                m_Resource = DefaultResource;
            }
        }
コード例 #22
0
ファイル: BaseCamp.cs プロジェクト: FreeReign/Rebirth-Repack
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 0:
                {
                    m_Items = reader.ReadItemList();
                    m_Mobiles = reader.ReadMobileList();
                    m_DecayTime = reader.ReadDeltaTime();

                    RefreshDecay( false );

                    break;
                }
            }
        }
コード例 #23
0
ファイル: Item.cs プロジェクト: BackupTheBerlios/sunuo-svn
        public virtual void Deserialize( GenericReader reader )
        {
            int version = reader.ReadInt();

            SetLastMoved();

            switch ( version )
            {
                case 7:
                case 6:
                {
                    SaveFlag flags = (SaveFlag)reader.ReadInt();

                    if ( version < 7 )
                    {
                        LastMoved = reader.ReadDeltaTime();
                    }
                    else
                    {
                        int minutes = reader.ReadEncodedInt();

                        try{ LastMoved = Core.Now - TimeSpan.FromMinutes( minutes ); }
                        catch{ LastMoved = Core.Now; }
                    }

                    if ( GetSaveFlag( flags, SaveFlag.Direction ) )
                        m_Direction = (Direction)reader.ReadByte();

                    if ( GetSaveFlag( flags, SaveFlag.Bounce ) )
                        m_Bounce = BounceInfo.Deserialize( reader );

                    if ( GetSaveFlag( flags, SaveFlag.LootType ) )
                        m_LootType = (LootType)reader.ReadByte();

                    int x = 0, y = 0, z = 0;

                    if ( GetSaveFlag( flags, SaveFlag.LocationFull ) )
                    {
                        x = reader.ReadEncodedInt();
                        y = reader.ReadEncodedInt();
                        z = reader.ReadEncodedInt();
                    }
                    else
                    {
                        if ( GetSaveFlag( flags, SaveFlag.LocationByteXY ) )
                        {
                            x = reader.ReadByte();
                            y = reader.ReadByte();
                        }
                        else if ( GetSaveFlag( flags, SaveFlag.LocationShortXY ) )
                        {
                            x = reader.ReadShort();
                            y = reader.ReadShort();
                        }

                        if ( GetSaveFlag( flags, SaveFlag.LocationSByteZ ) )
                            z = reader.ReadSByte();
                    }

                    m_Location = new Point3D( x, y, z );

                    if ( GetSaveFlag( flags, SaveFlag.ItemID ) )
                        m_ItemID = reader.ReadEncodedInt();

                    if ( GetSaveFlag( flags, SaveFlag.Hue ) )
                        m_Hue = reader.ReadEncodedInt();

                    if ( GetSaveFlag( flags, SaveFlag.Amount ) )
                        m_Amount = reader.ReadEncodedInt();
                    else
                        m_Amount = 1;

                    if ( GetSaveFlag( flags, SaveFlag.Layer ) )
                        m_Layer = (Layer)reader.ReadByte();

                    if ( GetSaveFlag( flags, SaveFlag.Name ) )
                        m_Name = string.Intern(reader.ReadString());

                    if ( GetSaveFlag( flags, SaveFlag.Parent ) )
                    {
                        Serial parent = reader.ReadInt();

                        if ( parent.IsMobile )
                            m_Parent = World.FindMobile( parent );
                        else if ( parent.IsItem )
                            m_Parent = World.FindItem( parent );
                        else
                            m_Parent = null;

                        if ( m_Parent == null && (parent.IsMobile || parent.IsItem) )
                            Delete();
                    }

                    if ( GetSaveFlag( flags, SaveFlag.Items ) )
                        m_Items = reader.ReadItemList();
                    //else
                    //	m_Items = new ArrayList( 1 );

                    if ( GetSaveFlag( flags, SaveFlag.IntWeight ) )
                        m_Weight = reader.ReadEncodedInt();
                    else if ( GetSaveFlag( flags, SaveFlag.WeightNot1or0 ) )
                        m_Weight = reader.ReadDouble();
                    else if ( GetSaveFlag( flags, SaveFlag.WeightIs0 ) )
                        m_Weight = 0.0;
                    else
                        m_Weight = 1.0;

                    if ( GetSaveFlag( flags, SaveFlag.Map ) )
                        m_Map = reader.ReadMap();
                    else
                        m_Map = Map.Internal;

                    if ( GetSaveFlag( flags, SaveFlag.Visible ) )
                        SetFlag( ImplFlag.Visible, reader.ReadBool() );
                    else
                        SetFlag( ImplFlag.Visible, true );

                    if ( GetSaveFlag( flags, SaveFlag.Movable ) )
                        SetFlag( ImplFlag.Movable, reader.ReadBool() );
                    else
                        SetFlag( ImplFlag.Movable, true );

                    if ( GetSaveFlag( flags, SaveFlag.Stackable ) )
                        SetFlag( ImplFlag.Stackable, reader.ReadBool() );

                    if ( GetSaveFlag( flags, SaveFlag.ImplFlags ) )
                        m_Flags = (ImplFlag)reader.ReadEncodedInt();

                    if ( GetSaveFlag( flags, SaveFlag.InsuredFor ) )
                        /*m_InsuredFor = */reader.ReadMobile();

                    if ( GetSaveFlag( flags, SaveFlag.BlessedFor ) )
                        m_BlessedFor = reader.ReadMobile();

                    if ( GetSaveFlag( flags, SaveFlag.HeldBy ) )
                        m_HeldBy = reader.ReadMobile();

                    if ( GetSaveFlag( flags, SaveFlag.SavedFlags ) )
                        m_SavedFlags = reader.ReadEncodedInt();

                    if ( m_Map != null && m_Parent == null )
                        m_Map.OnEnter( this );

                    break;
                }
                case 5:
                {
                    SaveFlag flags = (SaveFlag)reader.ReadInt();

                    LastMoved = reader.ReadDeltaTime();

                    if ( GetSaveFlag( flags, SaveFlag.Direction ) )
                        m_Direction = (Direction)reader.ReadByte();

                    if ( GetSaveFlag( flags, SaveFlag.Bounce ) )
                        m_Bounce = BounceInfo.Deserialize( reader );

                    if ( GetSaveFlag( flags, SaveFlag.LootType ) )
                        m_LootType = (LootType)reader.ReadByte();

                    if ( GetSaveFlag( flags, SaveFlag.LocationFull ) )
                        m_Location = reader.ReadPoint3D();

                    if ( GetSaveFlag( flags, SaveFlag.ItemID ) )
                        m_ItemID = reader.ReadInt();

                    if ( GetSaveFlag( flags, SaveFlag.Hue ) )
                        m_Hue = reader.ReadInt();

                    if ( GetSaveFlag( flags, SaveFlag.Amount ) )
                        m_Amount = reader.ReadInt();
                    else
                        m_Amount = 1;

                    if ( GetSaveFlag( flags, SaveFlag.Layer ) )
                        m_Layer = (Layer)reader.ReadByte();

                    if ( GetSaveFlag( flags, SaveFlag.Name ) )
                        m_Name = string.Intern(reader.ReadString());

                    if ( GetSaveFlag( flags, SaveFlag.Parent ) )
                    {
                        Serial parent = reader.ReadInt();

                        if ( parent.IsMobile )
                            m_Parent = World.FindMobile( parent );
                        else if ( parent.IsItem )
                            m_Parent = World.FindItem( parent );
                        else
                            m_Parent = null;

                        if ( m_Parent == null && (parent.IsMobile || parent.IsItem) )
                            Delete();
                    }

                    if ( GetSaveFlag( flags, SaveFlag.Items ) )
                        m_Items = reader.ReadItemList();
                    //else
                    //	m_Items = new ArrayList( 1 );

                    if ( GetSaveFlag( flags, SaveFlag.IntWeight ) )
                        m_Weight = reader.ReadEncodedInt();
                    else if ( GetSaveFlag( flags, SaveFlag.WeightNot1or0 ) )
                        m_Weight = reader.ReadDouble();
                    else if ( GetSaveFlag( flags, SaveFlag.WeightIs0 ) )
                        m_Weight = 0.0;
                    else
                        m_Weight = 1.0;

                    if ( GetSaveFlag( flags, SaveFlag.Map ) )
                        m_Map = reader.ReadMap();
                    else
                        m_Map = Map.Internal;

                    if ( GetSaveFlag( flags, SaveFlag.Visible ) )
                        SetFlag( ImplFlag.Visible, reader.ReadBool() );
                    else
                        SetFlag( ImplFlag.Visible, true );

                    if ( GetSaveFlag( flags, SaveFlag.Movable ) )
                        SetFlag( ImplFlag.Movable, reader.ReadBool() );
                    else
                        SetFlag( ImplFlag.Movable, true );

                    if ( GetSaveFlag( flags, SaveFlag.Stackable ) )
                        SetFlag( ImplFlag.Stackable, reader.ReadBool() );

                    if ( m_Map != null && m_Parent == null )
                        m_Map.OnEnter( this );

                    break;
                }
                case 4: // Just removed variables
                case 3:
                {
                    m_Direction = (Direction)reader.ReadInt();

                    goto case 2;
                }
                case 2:
                {
                    m_Bounce = BounceInfo.Deserialize( reader );
                    LastMoved = reader.ReadDeltaTime();

                    goto case 1;
                }
                case 1:
                {
                    m_LootType = (LootType) reader.ReadByte();//m_Newbied = reader.ReadBool();

                    goto case 0;
                }
                case 0:
                {
                    m_Location = reader.ReadPoint3D();
                    m_ItemID = reader.ReadInt();
                    m_Hue = reader.ReadInt();
                    m_Amount = reader.ReadInt();
                    m_Layer = (Layer) reader.ReadByte();
                    m_Name = reader.ReadString();
                    if (m_Name != null)
                        m_Name = string.Intern(m_Name);

                    Serial parent = reader.ReadInt();

                    if ( parent.IsMobile )
                        m_Parent = World.FindMobile( parent );
                    else if ( parent.IsItem )
                        m_Parent = World.FindItem( parent );
                    else
                        m_Parent = null;

                    if ( m_Parent == null && (parent.IsMobile || parent.IsItem) )
                        Delete();

                    int count = reader.ReadInt();

                    if ( count > 0 )
                    {
                        m_Items = new ArrayList( count );

                        for ( int i = 0; i < count; ++i )
                        {
                            Item item = reader.ReadItem();

                            if ( item != null )
                                m_Items.Add( item );
                        }
                    }

                    m_Weight = reader.ReadDouble();

                    if ( version <= 3 )
                    {
                        /*m_TotalItems =*/ reader.ReadInt();
                        /*m_TotalWeight =*/ reader.ReadInt();
                        /*m_TotalGold =*/ reader.ReadInt();
                    }

                    m_Map = reader.ReadMap();
                    SetFlag( ImplFlag.Visible, reader.ReadBool() );
                    SetFlag( ImplFlag.Movable, reader.ReadBool() );

                    if ( version <= 3 )
                        /*m_Deleted =*/ reader.ReadBool();

                    Stackable = reader.ReadBool();

                    if ( m_Map != null && m_Parent == null )
                        m_Map.OnEnter( this );

                    break;
                }
            }

            if ( m_HeldBy != null )
                Timer.DelayCall( TimeSpan.Zero, new TimerCallback( FixHolding_Sandbox ) );
        }
コード例 #24
0
ファイル: RentedVendor.cs プロジェクト: nathanvy/runuo
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadEncodedInt();

            int durationID = reader.ReadEncodedInt();
            if ( durationID < VendorRentalDuration.Instances.Length )
                m_RentalDuration = VendorRentalDuration.Instances[durationID];
            else
                m_RentalDuration = VendorRentalDuration.Instances[0];

            m_RentalPrice = reader.ReadInt();
            m_LandlordRenew = reader.ReadBool();
            m_RenterRenew = reader.ReadBool();
            m_RenewalPrice = reader.ReadInt();

            m_RentalGold = reader.ReadInt();

            m_RentalExpireTime = reader.ReadDeltaTime();

            TimeSpan delay = m_RentalExpireTime - DateTime.UtcNow;
            m_RentalExpireTimer = new RentalExpireTimer( this, delay > TimeSpan.Zero ? delay : TimeSpan.Zero );
            m_RentalExpireTimer.Start();
        }
コード例 #25
0
ファイル: Soldier.cs プロジェクト: justdanofficial/khaeros
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 0:
                    {
                        m_Armaments = (Armament)reader.ReadInt();
                        m_PayRate = reader.ReadInt();
                        m_speechInterval = reader.ReadDeltaTime();
                        m_Training = (Training)reader.ReadInt();
                        m_BaseName = reader.ReadString();

                        break;
                    }
            }

            if (Government != null && Government.Deleted && !Government.Employees.Contains(this))
                Government.Employees.Add(this);
        }
コード例 #26
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

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

            if ( reader.ReadBool() )
                m_DestinationString = reader.ReadString(); // NOTE: We cannot EDI.Find here, regions have not yet been loaded :-(

            if ( reader.ReadBool() )
            {
                m_DeleteTime = reader.ReadDeltaTime();
                m_DeleteTimer = new DeleteTimer( this, m_DeleteTime - DateTime.Now );
                m_DeleteTimer.Start();
            }
        }
コード例 #27
0
ファイル: ChampionSpawn.cs プロジェクト: PepeBiondi/runsa
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            m_DamageEntries = new Dictionary<Mobile, int>();

            int version = reader.ReadInt();

            switch (version)
            {
                case 5:
                    {
                        int entries = reader.ReadInt();
                        Mobile m;
                        int damage;
                        for (int i = 0; i < entries; ++i)
                        {
                            m = reader.ReadMobile();
                            damage = reader.ReadInt();

                            if (m == null)
                                continue;

                            m_DamageEntries.Add(m, damage);
                        }

                        goto case 4;
                    }
                case 4:
                    {
                        m_ConfinedRoaming = reader.ReadBool();
                        m_Idol = reader.ReadItem<IdolOfTheChampion>();
                        m_HasBeenAdvanced = reader.ReadBool();

                        goto case 3;
                    }
                case 3:
                    {
                        m_SpawnArea = reader.ReadRect2D();

                        goto case 2;
                    }
                case 2:
                    {
                        m_RandomizeType = reader.ReadBool();

                        goto case 1;
                    }
                case 1:
                    {
                        if (version < 3)
                        {
                            int oldRange = reader.ReadInt();

                            m_SpawnArea = new Rectangle2D(new Point2D(X - oldRange, Y - oldRange), new Point2D(X + oldRange, Y + oldRange));
                        }

                        m_Kills = reader.ReadInt();

                        goto case 0;
                    }
                case 0:
                    {
                        if (version < 1)
                            m_SpawnArea = new Rectangle2D(new Point2D(X - 24, Y - 24), new Point2D(X + 24, Y + 24));	//Default was 24

                        bool active = reader.ReadBool();
                        m_Type = (ChampionSpawnType)reader.ReadInt();
                        m_Creatures = reader.ReadStrongMobileList();
                        m_RedSkulls = reader.ReadStrongItemList();
                        m_WhiteSkulls = reader.ReadStrongItemList();
                        m_Platform = reader.ReadItem<ChampionPlatform>();
                        m_Altar = reader.ReadItem<ChampionAltar>();
                        m_ExpireDelay = reader.ReadTimeSpan();
                        m_ExpireTime = reader.ReadDeltaTime();
                        m_Champion = reader.ReadMobile();
                        m_RestartDelay = reader.ReadTimeSpan();

                        if (reader.ReadBool())
                        {
                            m_RestartTime = reader.ReadDeltaTime();
                            BeginRestart(m_RestartTime - DateTime.Now);
                        }

                        if (version < 4)
                        {
                            m_Idol = new IdolOfTheChampion(this);
                            m_Idol.MoveToWorld(new Point3D(X, Y, Z - 15), Map);
                        }

                        if (m_Platform == null || m_Altar == null || m_Idol == null)
                            Delete();
                        else if (active)
                            Start();

                        break;
                    }
            }

            Timer.DelayCall(TimeSpan.Zero, new TimerCallback(UpdateRegion));
        }
コード例 #28
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
                case 2:
				case 1:
				{
					key_KeyVal = reader.ReadUInt();
					key_Description = reader.ReadString();
					key_Max = reader.ReadInt();
					key_Delay = TimeSpan.Parse(reader.ReadString());
					i_Door = reader.ReadItem();

					goto case 0;
				}
				case 0:
				{
                    m_WalkingRange = reader.ReadInt();
					m_WayPoint = reader.ReadItem() as WayPoint;
					m_MinDelay = reader.ReadTimeSpan();
					m_MaxDelay = reader.ReadTimeSpan();
					m_Count = reader.ReadInt();
					m_Team = reader.ReadInt();
					m_HomeRange = reader.ReadInt();
					m_Running = reader.ReadBool();

                    if (version == 1)
                        m_WalkingRange = m_HomeRange;

					TimeSpan ts = TimeSpan.Zero;

					if ( m_Running )
						ts = reader.ReadDeltaTime() - DateTime.Now;
					
					int size = reader.ReadInt();

					m_CreaturesName = new ArrayList( size );

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

						m_CreaturesName.Add( typeName );

						if ( SpawnerType.GetType( typeName ) == null )
						{
							if ( m_WarnTimer == null )
								m_WarnTimer = new gWarnTimer();

							m_WarnTimer.Add( Location, Map, typeName );
						}
					}

					int count = reader.ReadInt();

					m_Creatures = new ArrayList( count );

					for ( int i = 0; i < count; ++i )
					{
						IEntity e = World.FindEntity( reader.ReadInt() );

						if ( e != null )
							m_Creatures.Add( e );
					}

					if ( m_Running )
						DoTimer( ts );

					break;
				}
			}
		}
コード例 #29
0
ファイル: PremiumSpawner.cs プロジェクト: greeduomacro/annox
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 3:
				{
					m_SpawnRange = reader.ReadInt();
					m_SpawnID = reader.ReadInt();
					m_DeSpawn = reader.ReadInt();
					m_PlayerRangeSensitive = reader.ReadInt();
					m_SubCountA = reader.ReadInt();
					m_SubCountB = reader.ReadInt();
					m_SubCountC = reader.ReadInt();
					m_SubCountD = reader.ReadInt();
					m_SubCountE = reader.ReadInt();

					goto case 2;
				}
				case 2:
				{
					m_WayPoint = reader.ReadItem() as WayPoint;

					goto case 1;
				}
				case 1:
				{
					m_Group = reader.ReadBool();

					goto case 0;
				}
				case 0:
				{
					m_MinDelay = reader.ReadTimeSpan();
					m_MaxDelay = reader.ReadTimeSpan();
					m_Count = reader.ReadInt();
					m_Team = reader.ReadInt();
					m_HomeRange = reader.ReadInt();
					m_Running = reader.ReadBool();
					TimeSpan ts = TimeSpan.Zero;
					if ( m_Running )
						ts = reader.ReadDeltaTime() - DateTime.Now;
 
					int size = reader.ReadInt();
					m_CreaturesName = new ArrayList( size );
					for ( int i = 0; i < size; ++i )
					{
						string typeName = reader.ReadString();
						m_CreaturesName.Add( typeName );
						if ( SpawnerType.GetType( typeName ) == null )
						{
							if ( m_WarnTimer == null )
								m_WarnTimer = new WarnTimer();
							m_WarnTimer.Add( Location, Map, typeName );
						}
					}

					int sizeA = reader.ReadInt();
					m_SubSpawnerA = new ArrayList( sizeA );
					for ( int i = 0; i < sizeA; ++i )
					{
						string typeNameA = reader.ReadString();
						m_SubSpawnerA.Add( typeNameA );
						if ( SpawnerType.GetType( typeNameA ) == null )
						{
							if ( m_WarnTimer == null )
								m_WarnTimer = new WarnTimer();
							m_WarnTimer.Add( Location, Map, typeNameA );
						}
					}

					int sizeB = reader.ReadInt();
					m_SubSpawnerB = new ArrayList( sizeB );
					for ( int i = 0; i < sizeB; ++i )
					{
						string typeNameB = reader.ReadString();
						m_SubSpawnerB.Add( typeNameB );
						if ( SpawnerType.GetType( typeNameB ) == null )
						{
							if ( m_WarnTimer == null )
								m_WarnTimer = new WarnTimer();
							m_WarnTimer.Add( Location, Map, typeNameB );
						}
					}

					int sizeC = reader.ReadInt();
					m_SubSpawnerC = new ArrayList( sizeC );
					for ( int i = 0; i < sizeC; ++i )
					{
						string typeNameC = reader.ReadString();
						m_SubSpawnerC.Add( typeNameC );
						if ( SpawnerType.GetType( typeNameC ) == null )
						{
							if ( m_WarnTimer == null )
								m_WarnTimer = new WarnTimer();
							m_WarnTimer.Add( Location, Map, typeNameC );
						}
					}

					int sizeD = reader.ReadInt();
					m_SubSpawnerD = new ArrayList( sizeD );
					for ( int i = 0; i < sizeD; ++i )
					{
						string typeNameD = reader.ReadString();
						m_SubSpawnerD.Add( typeNameD );
						if ( SpawnerType.GetType( typeNameD ) == null )
						{
							if ( m_WarnTimer == null )
								m_WarnTimer = new WarnTimer();
							m_WarnTimer.Add( Location, Map, typeNameD );
						}
					}

					int sizeE = reader.ReadInt();
					m_SubSpawnerE = new ArrayList( sizeE );
					for ( int i = 0; i < sizeE; ++i )
					{
						string typeNameE = reader.ReadString();
						m_SubSpawnerE.Add( typeNameE );
						if ( SpawnerType.GetType( typeNameE ) == null )
						{
							if ( m_WarnTimer == null )
								m_WarnTimer = new WarnTimer();
							m_WarnTimer.Add( Location, Map, typeNameE );
						}
					}

					int count = reader.ReadInt();
					m_Creatures = new ArrayList( count );
					for ( int i = 0; i < count; ++i )
					{
						IEntity e = World.FindEntity( reader.ReadInt() );
						if ( e != null )
							m_Creatures.Add( e );
					}

					int countA = reader.ReadInt();
					m_SubCreaturesA = new ArrayList( countA );
					for ( int i = 0; i < countA; ++i )
					{
						IEntity eA = World.FindEntity( reader.ReadInt() );
						if ( eA != null )
							m_SubCreaturesA.Add( eA );
					}

					int countB = reader.ReadInt();
					m_SubCreaturesB = new ArrayList( countB );
					for ( int i = 0; i < countB; ++i )
					{
						IEntity eB = World.FindEntity( reader.ReadInt() );
						if ( eB != null )
							m_SubCreaturesB.Add( eB );
					}

					int countC = reader.ReadInt();
					m_SubCreaturesC = new ArrayList( countC );
					for ( int i = 0; i < countC; ++i )
					{
						IEntity eC = World.FindEntity( reader.ReadInt() );
						if ( eC != null )
							m_SubCreaturesC.Add( eC );
					}

					int countD = reader.ReadInt();
					m_SubCreaturesD = new ArrayList( countD );
					for ( int i = 0; i < countD; ++i )
					{
						IEntity eD = World.FindEntity( reader.ReadInt() );
						if ( eD != null )
						m_SubCreaturesD.Add( eD );
					}

					int countE = reader.ReadInt();
					m_SubCreaturesE = new ArrayList( countE );
					for ( int i = 0; i < countE; ++i )
					{
						IEntity eE = World.FindEntity( reader.ReadInt() );
						if ( eE != null )
						m_SubCreaturesE.Add( eE );
					}

					if ( m_Running )
						DoTimer( ts );

					break;
				}
			}

			m_SpawnRange = ( version <= 2 ? m_HomeRange : m_SpawnRange );
		}
コード例 #30
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            m_CurrentAI = (AIType)reader.ReadInt();
            m_DefaultAI = (AIType)reader.ReadInt();

            m_iRangePerception = reader.ReadInt();
            m_iRangeFight = reader.ReadInt();

            m_iTeam = reader.ReadInt();

            m_dActiveSpeed = reader.ReadDouble();
            m_dPassiveSpeed = reader.ReadDouble();
            m_dCurrentSpeed = reader.ReadDouble();

            if ( m_iRangePerception == OldRangePerception )
                m_iRangePerception = DefaultRangePerception;

            m_pHome.X = reader.ReadInt();
            m_pHome.Y = reader.ReadInt();
            m_pHome.Z = reader.ReadInt();

            if ( version >= 1 )
            {
                m_iRangeHome = reader.ReadInt();

                int i, iCount;

                iCount = reader.ReadInt();
                for ( i=0; i< iCount; i++ )
                {
                    string str = reader.ReadString();
                    Type type = Type.GetType( str );

                    if ( type != null )
                    {
                        m_arSpellAttack.Add( type );
                    }
                }

                iCount = reader.ReadInt();
                for ( i=0; i< iCount; i++ )
                {
                    string str = reader.ReadString();
                    Type type = Type.GetType( str );

                    if ( type != null )
                    {
                        m_arSpellDefense.Add( type );
                    }
                }
            }
            else
            {
                m_iRangeHome = 0;
            }

            if ( version >= 2 )
            {
                m_FightMode = ( FightMode )reader.ReadInt();

                m_bControlled = reader.ReadBool();
                m_ControlMaster = reader.ReadMobile();
                m_ControlTarget = reader.ReadMobile();
                m_ControlDest = reader.ReadPoint3D();
                m_ControlOrder = (OrderType) reader.ReadInt();

                m_dMinTameSkill = reader.ReadDouble();

                if ( version < 9 )
                    reader.ReadDouble();

                m_bTamable = reader.ReadBool();
                m_bSummoned = reader.ReadBool();

                if ( m_bSummoned )
                {
                    m_SummonEnd = reader.ReadDeltaTime();
                    new UnsummonTimer( m_ControlMaster, this, m_SummonEnd - DateTime.Now ).Start();
                }

                m_iControlSlots = reader.ReadInt();
            }
            else
            {
                m_FightMode = FightMode.Closest;

                m_bControlled = false;
                m_ControlMaster = null;
                m_ControlTarget = null;
                m_ControlOrder = OrderType.None;
            }

            if ( version >= 3 )
                m_Loyalty = reader.ReadInt();
            else
                m_Loyalty = MaxLoyalty; // Wonderfully Happy

            if ( version >= 4 )
                m_CurrentWayPoint = reader.ReadItem() as WayPoint;

            if ( version >= 5 )
                m_SummonMaster = reader.ReadMobile();

            if ( version >= 6 )
            {
                m_HitsMax = reader.ReadInt();
                m_StamMax = reader.ReadInt();
                m_ManaMax = reader.ReadInt();
                m_DamageMin = reader.ReadInt();
                m_DamageMax = reader.ReadInt();
            }

            if ( version >= 7 )
            {
                m_PhysicalResistance = reader.ReadInt();
                m_PhysicalDamage = reader.ReadInt();

                m_FireResistance = reader.ReadInt();
                m_FireDamage = reader.ReadInt();

                m_ColdResistance = reader.ReadInt();
                m_ColdDamage = reader.ReadInt();

                m_PoisonResistance = reader.ReadInt();
                m_PoisonDamage = reader.ReadInt();

                m_EnergyResistance = reader.ReadInt();
                m_EnergyDamage = reader.ReadInt();
            }

            if ( version >= 8 )
                m_Owners = reader.ReadStrongMobileList();
            else
                m_Owners = new List<Mobile>();

            if ( version >= 10 )
            {
                m_IsDeadPet = reader.ReadBool();
                m_IsBonded = reader.ReadBool();
                m_BondingBegin = reader.ReadDateTime();
                m_OwnerAbandonTime = reader.ReadDateTime();
            }

            if ( version >= 11 )
                m_HasGeneratedLoot = reader.ReadBool();
            else
                m_HasGeneratedLoot = true;

            if ( version >= 12 )
                m_Paragon = reader.ReadBool();
            else
                m_Paragon = false;

            if ( version >= 13 && reader.ReadBool() )
                m_Friends = reader.ReadStrongMobileList();
            else if ( version < 13 && m_ControlOrder >= OrderType.Unfriend )
                ++m_ControlOrder;

            if ( version < 16 && Loyalty != MaxLoyalty )
                Loyalty *= 10;

            double activeSpeed = m_dActiveSpeed;
            double passiveSpeed = m_dPassiveSpeed;

            SpeedInfo.GetSpeeds( this, ref activeSpeed, ref passiveSpeed );

            bool isStandardActive = false;
            for ( int i = 0; !isStandardActive && i < m_StandardActiveSpeeds.Length; ++i )
                isStandardActive = ( m_dActiveSpeed == m_StandardActiveSpeeds[i] );

            bool isStandardPassive = false;
            for ( int i = 0; !isStandardPassive && i < m_StandardPassiveSpeeds.Length; ++i )
                isStandardPassive = ( m_dPassiveSpeed == m_StandardPassiveSpeeds[i] );

            if ( isStandardActive && m_dCurrentSpeed == m_dActiveSpeed )
                m_dCurrentSpeed = activeSpeed;
            else if ( isStandardPassive && m_dCurrentSpeed == m_dPassiveSpeed )
                m_dCurrentSpeed = passiveSpeed;

            if ( isStandardActive && !m_Paragon )
                m_dActiveSpeed = activeSpeed;

            if ( isStandardPassive && !m_Paragon )
                m_dPassiveSpeed = passiveSpeed;

            if ( version >= 14 )
            {
                m_RemoveIfUntamed = reader.ReadBool();
                m_RemoveStep = reader.ReadInt();
            }

            TimeSpan deleteTime = TimeSpan.Zero;

            if ( version >= 17 )
                deleteTime = reader.ReadTimeSpan();

            if ( deleteTime > TimeSpan.Zero || LastOwner != null && !Controlled && !IsStabled )
            {
                if ( deleteTime == TimeSpan.Zero )
                    deleteTime = TimeSpan.FromDays( 3.0 );

                m_DeleteTimer = new DeleteTimer( this, deleteTime );
                m_DeleteTimer.Start();
            }

            if( version <= 14 && m_Paragon && Hue == 0x31 )
            {
                Hue = Paragon.Hue; //Paragon hue fixed, should now be 0x501.
            }

            CheckStatTimers();

            ChangeAIType(m_CurrentAI);

            AddFollowers();

            if ( IsAnimatedDead )
                Spells.Necromancy.AnimateDeadSpell.Register( m_SummonMaster, this );
        }