public void StopDeleteTimer() { if ( m_DeleteTimer != null ) { m_DeleteTimer.Stop(); m_DeleteTimer = null; } }
public bool SetControlMaster( Mobile m ) { if ( m == null ) { ControlMaster = null; Controlled = false; ControlTarget = null; ControlOrder = OrderType.None; Guild = null; Delta( MobileDelta.Noto ); } else { ISpawner se = this.Spawner; if ( se != null && se.UnlinkOnTaming ) { this.Spawner.Remove( this ); this.Spawner = null; } if ( m.Followers + ControlSlots > m.FollowersMax ) { m.SendLocalizedMessage( 1049607 ); // You have too many followers to control that creature. return false; } CurrentWayPoint = null;//so tamed animals don't try to go back ControlMaster = m; Controlled = true; ControlTarget = null; ControlOrder = OrderType.Come; Guild = null; if ( m_DeleteTimer != null ) { m_DeleteTimer.Stop(); m_DeleteTimer = null; } Delta( MobileDelta.Noto ); } InvalidateProperties(); return true; }
public override void OnAfterDelete() { if ( m_AI != null ) { if ( m_AI.m_Timer != null ) m_AI.m_Timer.Stop(); m_AI = null; } if ( m_DeleteTimer != null ) { m_DeleteTimer.Stop(); m_DeleteTimer = null; } FocusMob = null; if ( IsAnimatedDead ) Spells.Necromancy.AnimateDeadSpell.Unregister( m_SummonMaster, this ); base.OnAfterDelete(); }
public void BeginDeleteTimer() { if ( !(this is BaseEscortable) && !Summoned && !Deleted && !IsStabled ) { StopDeleteTimer(); m_DeleteTimer = new DeleteTimer( this, TimeSpan.FromDays( 3.0 ) ); m_DeleteTimer.Start(); } }
public override void OnAfterDelete() { if( m_AI != null ) { if( m_AI.m_Timer != null ) m_AI.m_Timer.Stop(); m_AI = null; } if( m_DeleteTimer != null ) { m_DeleteTimer.Stop(); m_DeleteTimer = null; } FocusMob = null; base.OnAfterDelete(); }
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 ); }
//---------------------------------------------------------------------- // Initialize; this is the engine entry point (called by the core); //---------------------------------------------------------------------- public static void Initialize() { m_RegionHash = new Hashtable(); Console.Write( "Random Encounters: Initializing..." ); if( MaybeLoadXml() ) { //if (m_Debug) DumpAll(); string intervals = ""; for( int i = 0; i < m_Intervals.Length; i++ ) { if( i != 0 ) intervals += ":"; intervals += m_Intervals[i]; } //Dungeon Wilderness Guarded House Jail m_EncounterTimers = new EncounterTimer[m_Intervals.Length]; if( m_Intervals.Length >= 3 ) { m_EncounterTimers[0] = new EncounterTimer( "Dungeon", m_Intervals[0] ); m_EncounterTimers[1] = new EncounterTimer( "Wilderness", m_Intervals[1] ); m_EncounterTimers[2] = new EncounterTimer( "Guarded", m_Intervals[2] ); } if( m_Intervals.Length >= 4 ) { //m_EncounterTimers[3] = new EncounterTimer( "House", m_Intervals[3] ); Console.WriteLine( "RandomEncounters: WARNING, House Spawning not implemented yet." ); } if( m_Intervals.Length == 5 ) { //m_EncounterTimers[4] = new EncounterTimer( "Jail", m_Intervals[4] ); Console.WriteLine( "RandomEncounters: WARNING, Jail Spawning not implemented yet." ); } foreach( EncounterTimer timer in m_EncounterTimers ) timer.Start(); if( m_ReinitializeTimer == null ) { m_ReinitializeTimer = new ReinitializeTimer(); m_ReinitializeTimer.Start(); } // if (cleanupList.Count>0) // { // DeleteEncounterTimer deleter = new DeleteEncounterTimer( m_Cleanup, cleanupList ); // deleter.Start(); // } m_DeleteTimer = new DeleteTimer( Cleanup, Cleanup ); m_DeleteTimer.Start(); Console.WriteLine( "done" ); } else { Console.WriteLine( "failed!" ); } }
public override void Deserialize( GenericReader reader ) { base.Deserialize(reader); int version = reader.ReadInt(); switch( version ) { case 2: { alignment = (Alignment)reader.ReadInt(); goto case 1; } case 1: { TimeSpan deleteTime = TimeSpan.Zero; if( version >= 1 ) deleteTime = reader.ReadTimeSpan(); if( deleteTime > TimeSpan.Zero || LastOwner != null && !Controlled && !IsStabled ) { if( deleteTime <= TimeSpan.Zero || deleteTime > TimeSpan.FromDays(3.0) ) deleteTime = TimeSpan.FromDays(3.0); m_DeleteTimer = new DeleteTimer(this, deleteTime); m_DeleteTimer.Start(); } goto case 0; } case 0: { m_CurrentAI = (AIType)reader.ReadInt(); m_DefaultAI = (AIType)reader.ReadInt(); m_iRangePerception = reader.ReadInt(); m_iRangeFight = reader.ReadInt(); m_iRangeHome = 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(); 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); } } 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(); 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(); m_Loyalty = reader.ReadInt(); m_CurrentWayPoint = reader.ReadItem() as WayPoint; m_SummonMaster = reader.ReadMobile(); m_HitsMax = reader.ReadInt(); m_StamMax = reader.ReadInt(); m_ManaMax = reader.ReadInt(); m_DamageMin = reader.ReadInt(); m_DamageMax = reader.ReadInt(); 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(); m_Owners = reader.ReadStrongMobileList(); m_IsDeadPet = reader.ReadBool(); m_IsBonded = reader.ReadBool(); m_BondingBegin = reader.ReadDateTime(); m_OwnerAbandonTime = reader.ReadDateTime(); m_HasGeneratedLoot = reader.ReadBool(); bool hasFriends = reader.ReadBool(); if( hasFriends ) m_Friends = reader.ReadStrongMobileList(); else m_Friends = new List<Mobile>(); m_RemoveIfUntamed = reader.ReadBool(); m_RemoveStep = reader.ReadInt(); _spawner = reader.ReadItem(); _spawnerHome = reader.ReadPoint3D(); break; } } 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( Core.AOS && NameHue == 0x35 ) NameHue = -1; CheckStatTimers(); ChangeAIType(m_CurrentAI); AddFollowers(); }
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_Home.X = reader.ReadInt(); m_Home.Y = reader.ReadInt(); m_Home.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.UtcNow ).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(); if ( m_Paragon ) SolidHueOverride = Paragon.Hue; } 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_Corrupt) m_dActiveSpeed = activeSpeed; if (isStandardPassive && !m_Paragon && !m_Corrupt) 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 >= 18 ) m_StabledDate = reader.ReadDeltaTime(); /* if( version <= 14 && m_Paragon && Hue == 0x31 ) { Hue = Paragon.Hue; //Paragon hue fixed, should now be 0x501. } */ if ( version >= 19 ) m_HomeMap = reader.ReadMap(); if ( version >= 20 ) m_CorpseNameOverride = reader.ReadString(); if (version == 21 || version == 22) // NO LONGER USED! { m_KillCriminals = reader.ReadBool(); m_KillMurderers = reader.ReadBool(); m_InnocentDefault = reader.ReadBool(); m_Pseu_KeepKillCredit = reader.ReadBool(); m_PoisonCustomChance = reader.ReadDouble(); m_PoisonCustomImmune = Poison.GetPoison(reader.ReadInt()); m_PoisonCustomHit = Poison.GetPoison(reader.ReadInt()); m_CanBreathCustom = reader.ReadBool(); m_BreathDamageCustom = reader.ReadInt(); m_BreathCustomDelay = reader.ReadDouble(); m_Pseu_SpellDelay = reader.ReadTimeSpan(); m_BardImmuneCustom = reader.ReadBool(); m_Pseu_EQPlayerAllowed = reader.ReadBool(); m_Pseu_AllowFizzle = reader.ReadBool(); m_Pseu_AllowInterrupts = reader.ReadBool(); m_Pseu_CanBeHealed = reader.ReadBool(); m_WeaponDamage = reader.ReadBool(); m_TakesNormalDamage = reader.ReadBool(); m_PowerWords = reader.ReadBool(); m_ClearHandsOnCast = reader.ReadBool(); m_Pseu_ConsumeReagents = reader.ReadBool(); m_Pseu_SpellBookRequired = reader.ReadBool(); m_Speaks = reader.ReadBool(); } if (version == 22) // NO LONGER USED! { m_FreelyLootable = reader.ReadBool(); m_AutoDispelCustom = reader.ReadBool(); m_AutoDispelChanceCustom = reader.ReadDouble(); m_AlwaysMurdererCustom = reader.ReadBool(); m_IsScaryToPetsCustom = reader.ReadBool(); } if (version >= 23) { ExtSaveFlag flags = (ExtSaveFlag)reader.ReadInt(); if (GetExtSaveFlag(flags, ExtSaveFlag.KillCriminals)) m_KillCriminals = true; if (GetExtSaveFlag(flags, ExtSaveFlag.KillMurderers)) m_KillMurderers = true; if (GetExtSaveFlag(flags, ExtSaveFlag.InnocentDefault)) m_InnocentDefault = true; if (GetExtSaveFlag(flags, ExtSaveFlag.Pseu_KeepKillCredit)) m_Pseu_KeepKillCredit = true; if (GetExtSaveFlag(flags, ExtSaveFlag.CanBreathCustom)) m_CanBreathCustom = true; if (GetExtSaveFlag(flags, ExtSaveFlag.BardImmuneCustom)) m_BardImmuneCustom = true; if (GetExtSaveFlag(flags, ExtSaveFlag.Pseu_EQPlayerAllowed)) m_Pseu_EQPlayerAllowed = true; if (GetExtSaveFlag(flags, ExtSaveFlag.Pseu_AllowFizzle)) m_Pseu_AllowFizzle = false; if (GetExtSaveFlag(flags, ExtSaveFlag.Pseu_AllowInterrupts)) m_Pseu_AllowInterrupts = true; if (GetExtSaveFlag(flags, ExtSaveFlag.Pseu_CanBeHealed)) m_Pseu_CanBeHealed = false; if (GetExtSaveFlag(flags, ExtSaveFlag.Pseu_CanUseGates)) m_Pseu_CanUseGates = false; if (GetExtSaveFlag(flags, ExtSaveFlag.Pseu_CanUseRecall)) m_Pseu_CanUseRecall = false; if (GetExtSaveFlag(flags, ExtSaveFlag.Pseu_CanAttackInnocents)) m_Pseu_CanAttackInnocents = false; if (GetExtSaveFlag(flags, ExtSaveFlag.ReduceSpeedWithDamage)) m_ReduceSpeedWithDamageCustom = false; if (GetExtSaveFlag(flags, ExtSaveFlag.WeaponDamage)) m_WeaponDamage = true; if (GetExtSaveFlag(flags, ExtSaveFlag.TakesNormalDamage)) m_TakesNormalDamage = true; if (GetExtSaveFlag(flags, ExtSaveFlag.PowerWords)) m_PowerWords = true; if (GetExtSaveFlag(flags, ExtSaveFlag.ClearHandsOnCast)) m_ClearHandsOnCast = true; if (GetExtSaveFlag(flags, ExtSaveFlag.Pseu_ConsumeReagents)) m_Pseu_ConsumeReagents = true; if (GetExtSaveFlag(flags, ExtSaveFlag.Pseu_SpellBookRequired)) m_Pseu_SpellBookRequired = true; if (GetExtSaveFlag(flags, ExtSaveFlag.Speaks)) m_Speaks = false; if (GetExtSaveFlag(flags, ExtSaveFlag.FreelyLootable)) m_FreelyLootable = true; if (GetExtSaveFlag(flags, ExtSaveFlag.AutoDispelCustom)) m_AutoDispelCustom = true; if (GetExtSaveFlag(flags, ExtSaveFlag.AlwaysMurdererCustom)) m_AlwaysMurdererCustom = true; if (GetExtSaveFlag(flags, ExtSaveFlag.IsScaryToPetsCustom)) m_IsScaryToPetsCustom = true; m_PoisonCustomChance = reader.ReadDouble(); m_PoisonCustomImmune = Poison.GetPoison(reader.ReadInt()); m_PoisonCustomHit = Poison.GetPoison(reader.ReadInt()); m_BreathDamageCustom = reader.ReadInt(); m_BreathCustomDelay = reader.ReadDouble(); m_Pseu_SpellDelay = reader.ReadTimeSpan(); m_AutoDispelChanceCustom = reader.ReadDouble(); if (version >= 24) { if (GetExtSaveFlag(flags, ExtSaveFlag.Account)) { string username = reader.ReadString(); AccountDeserializateInfos.Add(new AccountDeserializeInfo(this, username)); } } if (version >= 25) { if (GetExtSaveFlag(flags, ExtSaveFlag.SkillGainMultiplier)) m_SkillGainMultiplier = reader.ReadDouble(); } if (version >= 26) { SpecialTitle = reader.ReadString(); TitleHue = reader.ReadInt(); } if (version >= 27) { Alignment = (Alignment)reader.ReadInt(); } if (version >= 28) { m_Corrupt = reader.ReadBool(); if (m_Corrupt) SolidHueOverride = HalloweenCorruption.Hue; } else m_Corrupt = false; } CheckStatTimers(); ChangeAIType(m_CurrentAI); AddFollowers(); }
//---------------------------------------------------------------------- // Initialize; this is the engine entry point (called by the core); //---------------------------------------------------------------------- public static void Initialize() { m_RegionHash = new Hashtable(); if (MaybeLoadXml()) { //if (m_Debug) DumpAll(); string intervals = ""; for( int i=0; i < m_Intervals.Length; i++ ) { if( i!=0 ) intervals += ":"; intervals += m_Intervals[i]; } Console.WriteLine( "RE: **WE'RE LIVE, BABY***..." ); Console.WriteLine( " [picker={0} language={1} skiphidden={2} delay={3} intervals={4} cleanup={5} grace={6} debug={7} animateDebug={8}]", m_Picker, m_Language, m_SkipHidden, m_Delay, intervals, m_Cleanup, m_CleanupGrace, m_Debug, m_DebugEffect ); //Dungeon Wilderness Guarded House Jail m_EncounterTimers = new EncounterTimer[m_Intervals.Length]; if( m_Intervals.Length >= 3 ) { m_EncounterTimers[0] = new EncounterTimer( "Dungeon", m_Intervals[0] ); m_EncounterTimers[1] = new EncounterTimer( "Wilderness", m_Intervals[1] ); m_EncounterTimers[2] = new EncounterTimer( "Guarded", m_Intervals[2] ); } if ( m_Intervals.Length >= 4 ) { //m_EncounterTimers[3] = new EncounterTimer( "House", m_Intervals[3] ); Console.WriteLine("RE: WARNING, House Spawning not implemented yet."); } if ( m_Intervals.Length == 5 ) { //m_EncounterTimers[4] = new EncounterTimer( "Jail", m_Intervals[4] ); Console.WriteLine("RE: WARNING, Jail Spawning not implemented yet."); } foreach( EncounterTimer timer in m_EncounterTimers ) timer.Start(); if( m_ReinitializeTimer==null ) { m_ReinitializeTimer = new ReinitializeTimer(); m_ReinitializeTimer.Start(); } // if (cleanupList.Count>0) // { // DeleteEncounterTimer deleter = new DeleteEncounterTimer( m_Cleanup, cleanupList ); // deleter.Start(); // } m_DeleteTimer = new DeleteTimer( Cleanup, Cleanup ); m_DeleteTimer.Start(); } else { Console.WriteLine("##### RE: ***FAILED INITIALIZATION***!"); } }
public void StopDeleteTimer() { if (this.m_DeleteTimer != null) { this.m_DeleteTimer.Stop(); this.m_DeleteTimer = null; } }
public override bool OnDragDrop(Mobile m, Item t) { if (m_Done) return false; Container pack = Backpack; if (t is BaseClothing) { Emote("*Puts the clothing on*"); pack.DropItem(t); AddItem(t); return true; } if (t is Food) { Emote("*Eats the food*"); PlaySound(Utility.Random(0x3A, 3)); pack.DropItem(t); AddItem(t); return true; } if (t is Gold) { if (CheckTeachingMatch(m)) { if (Teach(m_Teaching, m, t.Amount, true)) { t.Delete(); return true; } } pack.DropItem(t); // Karma gain is 1% of gold with max gain of 25 int newKarma = (t.Amount > 2500) ? 25 : (t.Amount / 100); Titles.AwardKarma(m, newKarma, true); Direction = GetDirectionTo(m.Location); Animate(32, 5, 1, true, false, 0); // Bow if (t.Amount < 50) Say("Thanks."); else if ((t.Amount >= 50) && (t.Amount < 100)) Say("Thank you for the gold!"); else if ((t.Amount >= 100) && (t.Amount < 500)) Say("Thank you! The pockets are nice and heavy now!"); else if ((t.Amount >= 500) && (t.Amount < 1000)) Say("What a generous sum of gold! Thank you!"); else if ((t.Amount >= 1000) && (t.Amount < 5000)) Say("I owe you my life! Without this money I could not feed or clothe my children!"); else Say("I am no longer a pauper!"); // t.Amount >= 5000 if (TotalGold > 5000) { DeleteTimer d = new DeleteTimer(this, m); d.Start(); } return true; } Say("eh? Whats this for?"); return false; }
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(); } m_IsMating = reader.ReadBool(); m_ABPoints = reader.ReadInt(); m_Exp = reader.ReadInt(); m_NextLevel = reader.ReadInt(); m_Level = reader.ReadInt(); m_MaxLevel = reader.ReadInt(); m_AllowMating = reader.ReadBool(); m_Evolves = reader.ReadBool(); m_Gen = reader.ReadInt(); m_MatingDelay = reader.ReadDateTime(); m_Form1 = reader.ReadInt(); m_Form2 = reader.ReadInt(); m_Form3 = reader.ReadInt(); m_Form4 = reader.ReadInt(); m_Form5 = reader.ReadInt(); m_Form6 = reader.ReadInt(); m_Form7 = reader.ReadInt(); m_Form8 = reader.ReadInt(); m_Form9 = reader.ReadInt(); m_Sound1 = reader.ReadInt(); m_Sound2 = reader.ReadInt(); m_Sound3 = reader.ReadInt(); m_Sound4 = reader.ReadInt(); m_Sound5 = reader.ReadInt(); m_Sound6 = reader.ReadInt(); m_Sound7 = reader.ReadInt(); m_Sound8 = reader.ReadInt(); m_Sound9 = reader.ReadInt(); m_UsesForm1 = reader.ReadBool(); m_UsesForm2 = reader.ReadBool(); m_UsesForm3 = reader.ReadBool(); m_UsesForm4 = reader.ReadBool(); m_UsesForm5 = reader.ReadBool(); m_UsesForm6 = reader.ReadBool(); m_UsesForm7 = reader.ReadBool(); m_UsesForm8 = reader.ReadBool(); m_UsesForm9 = reader.ReadBool(); m_F0 = reader.ReadBool(); m_F1 = reader.ReadBool(); m_F2 = reader.ReadBool(); m_F3 = reader.ReadBool(); m_F4 = reader.ReadBool(); m_F5 = reader.ReadBool(); m_F6 = reader.ReadBool(); m_F7 = reader.ReadBool(); m_F8 = reader.ReadBool(); m_F9 = reader.ReadBool(); m_RoarAttack = reader.ReadInt(); m_PetPoisonAttack = reader.ReadInt(); m_FireBreathAttack = reader.ReadInt(); if (version >= 18) { m_CanFlying = (bool)reader.ReadBool(); m_IsFlying = (bool)reader.ReadBool(); m_IsTakingOff = (bool)reader.ReadBool(); m_IsLanding = (bool)reader.ReadBool(); m_FlyingUp = (bool)reader.ReadBool(); m_FlyingDown = (bool)reader.ReadBool(); i_Ceiling = (int)reader.ReadInt(); i_Ground = (int)reader.ReadInt(); i_LeftSide = (int)reader.ReadInt(); i_RightSide = (int)reader.ReadInt(); i_TopSide = (int)reader.ReadInt(); i_BottomSide = (int)reader.ReadInt(); i_Direction = (int)reader.ReadInt(); i_FlyStam = (int)reader.ReadInt(); i_FlyStamMax = (int)reader.ReadInt(); i_FlyAnim = (int)reader.ReadInt(); i_FlyCnt = (int)reader.ReadInt(); } TimeSpan deleteTime = TimeSpan.Zero; if (version >= 18) deleteTime = reader.ReadTimeSpan(); if (deleteTime > TimeSpan.Zero || LastOwner != null && !Controlled && !IsStabled) { if (deleteTime <= TimeSpan.Zero || deleteTime > TimeSpan.FromDays(3.0))/////////////////////////////////////// deleteTime = TimeSpan.FromDays(3.0); m_DeleteTimer = new DeleteTimer(this, deleteTime); m_DeleteTimer.Start(); } #region Mondain's Legacy version 15 if (version >= 19) m_Allured = reader.ReadBool(); #endregion // Version 21, FSATS addon if (version >= 21) { m_IcyWindAttack = reader.ReadInt(); m_ShockAttack = reader.ReadInt(); } else { m_IcyWindAttack = 0; m_ShockAttack = 0; } 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); SetGhostDeletionTimer(true); }