- Future ML craftables added to the special repair list until the craft system is updated.

- Items can now be repaired while wearing them.
- Items can now be fortified while wearing them.
- Fixed repair deed messages not sending.
- Sound effect added to powder of fortifying.
- Map issue for fishing and SOSs fixed, where it would not allow fishing in empty resource banks when not on the target SOS map.
- Added proximity spawner.
- Improved spawner mouseover menu, now also shows types set on the spawner which are not yet spawned.
- Fixed spawners only deleting half of their spawned objects when deleted.
- Added the ability to set TextDefinition objects in the props gump.
- WaitTeleporters now round delays to nearest in the remaining time messages.
- Updated TextDefinition to be more usable; made it parsable from string and added safe serialization/deserialization methods.
- Improved checking whether a mobile can flee.
- Monsters that give ML minor artifacts will no longer flee when low on hits (like paragons).
- Monsters that give ML minor artifacts will no longer spawn as paragon.
- Fixed issue with pets not eating certain foods.
- AI and targeting fixes for Red Death, Pyre and Swoop.
- Fame and karma added to Rend.
- Swoop corrected to have 0 karma.
- Stat and skill tweaks for Putrefier.
- Changelings will no longer show their fame title when morphed.
- Added travel restrictions for ML dungeons.
- Fixed issue of travel restriction message displaying twice.
- Monster teleporting is no longer affected by region travel restrictions.
This commit is contained in:
eos 2012-03-07 18:59:52 +00:00
parent 4bcde77cc2
commit a0e13d5007
25 changed files with 432 additions and 140 deletions

View file

@ -0,0 +1,176 @@
using System;
using System.Collections.Generic;
using Server;
namespace Server.Mobiles
{
public class ProximitySpawner : Spawner
{
private int m_TriggerRange;
private TextDefinition m_SpawnMessage;
private bool m_InstantFlag;
[CommandProperty( AccessLevel.GameMaster )]
public int TriggerRange
{
get { return m_TriggerRange; }
set { m_TriggerRange = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public TextDefinition SpawnMessage
{
get { return m_SpawnMessage; }
set { m_SpawnMessage = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public bool InstantFlag
{
get { return m_InstantFlag; }
set { m_InstantFlag = value; }
}
[Constructable]
public ProximitySpawner()
{
}
[Constructable]
public ProximitySpawner( string spawnName )
: base( spawnName )
{
}
[Constructable]
public ProximitySpawner( int amount, int minDelay, int maxDelay, int team, int homeRange, string spawnName )
: base( amount, minDelay, maxDelay, team, homeRange, spawnName )
{
}
[Constructable]
public ProximitySpawner( int amount, int minDelay, int maxDelay, int team, int homeRange, string spawnName, int triggerRange, string spawnMessage, bool instantFlag )
: base( amount, minDelay, maxDelay, team, homeRange, spawnName )
{
m_TriggerRange = triggerRange;
m_SpawnMessage = TextDefinition.Parse( spawnMessage );
m_InstantFlag = instantFlag;
}
public ProximitySpawner( int amount, TimeSpan minDelay, TimeSpan maxDelay, int team, int homeRange, List<string> spawnNames )
: base( amount, minDelay, maxDelay, team, homeRange, spawnNames )
{
}
public ProximitySpawner( int amount, TimeSpan minDelay, TimeSpan maxDelay, int team, int homeRange, List<string> spawnNames, int triggerRange, TextDefinition spawnMessage, bool instantFlag )
: base( amount, minDelay, maxDelay, team, homeRange, spawnNames )
{
m_TriggerRange = triggerRange;
m_SpawnMessage = spawnMessage;
m_InstantFlag = instantFlag;
}
public override string DefaultName
{
get { return "Proximity Spawner"; }
}
public override void DoTimer( TimeSpan delay )
{
if ( !Running )
return;
End = DateTime.Now + delay;
}
public override void Respawn()
{
RemoveSpawned();
End = DateTime.Now;
}
public override void Spawn()
{
for ( int i = 0; i < SpawnNamesCount; ++i )
{
for ( int j = 0; j < Count; ++j )
Spawn( i );
}
}
public override bool CheckSpawnCount()
{
return true;
}
public override bool HandlesOnMovement { get { return true; } }
public virtual bool ValidTrigger( Mobile m )
{
if ( m is BaseCreature )
{
BaseCreature bc = (BaseCreature)m;
if ( !bc.Controlled && !bc.Summoned )
return false;
}
else if ( !m.Player )
{
return false;
}
return ( m.Alive && !m.IsDeadBondedPet && m.CanBeDamaged() && !m.Hidden );
}
public override void OnMovement( Mobile m, Point3D oldLocation )
{
if ( !Running )
return;
if ( IsEmpty && End <= DateTime.Now && m.InRange( GetWorldLocation(), m_TriggerRange ) && m.Location != oldLocation && ValidTrigger( m ) )
{
TextDefinition.SendMessageTo( m, m_SpawnMessage );
DoTimer();
Spawn();
if ( m_InstantFlag )
{
foreach ( ISpawnable spawned in Spawned )
{
if ( spawned is Mobile )
((Mobile)spawned).Combatant = m;
}
}
}
}
public ProximitySpawner( Serial serial )
: base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( m_TriggerRange );
TextDefinition.Serialize( writer, m_SpawnMessage );
writer.Write( m_InstantFlag );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
m_TriggerRange = reader.ReadInt();
m_SpawnMessage = TextDefinition.Deserialize( reader );
m_InstantFlag = reader.ReadBool();
}
}
}

View file

@ -28,7 +28,8 @@ namespace Server.Mobiles
private bool m_Group;
private WayPoint m_WayPoint;
public bool IsFull{ get{ return ( m_Spawned != null && m_Spawned.Count >= m_Count ); } }
public bool IsFull{ get{ return ( m_Spawned.Count >= m_Count ); } }
public bool IsEmpty{ get{ return ( m_Spawned.Count == 0 ); } }
public List<string> SpawnNames
{
@ -43,6 +44,11 @@ namespace Server.Mobiles
}
}
public List<ISpawnable> Spawned
{
get { return m_Spawned; }
}
public virtual int SpawnNamesCount { get { return m_SpawnNames.Count; } }
public override void OnAfterDuped( Item newItem )
@ -126,6 +132,12 @@ namespace Server.Mobiles
set { m_MaxDelay = value; InvalidateProperties(); }
}
public DateTime End
{
get { return m_End; }
set { m_End = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan NextSpawn
{
@ -231,7 +243,7 @@ namespace Server.Mobiles
list.Add( 1060660, "team\t{0}", m_Team ); // ~1_val~: ~2_val~
list.Add( 1060661, "speed\t{0} to {1}", m_MinDelay, m_MaxDelay ); // ~1_val~: ~2_val~
if ( m_Spawned.Count != 0 )
if ( m_SpawnNames.Count != 0 )
list.Add( SpawnedStats() );
}
else
@ -266,7 +278,9 @@ namespace Server.Mobiles
{
if ( m_Running )
{
m_Timer.Stop();
if ( m_Timer != null )
m_Timer.Stop();
m_Running = false;
}
}
@ -356,7 +370,7 @@ namespace Server.Mobiles
}
}
public void Respawn()
public virtual void Respawn()
{
RemoveSpawned();
@ -364,7 +378,7 @@ namespace Server.Mobiles
Spawn();
}
public void Spawn()
public virtual void Spawn()
{
if ( SpawnNamesCount > 0 )
Spawn( Utility.Random( SpawnNamesCount ) );
@ -511,6 +525,11 @@ namespace Server.Mobiles
public Point3D HomeLocation { get { return this.Location; } }
public virtual bool CheckSpawnCount()
{
return ( m_Spawned.Count >= m_Count );
}
public void Spawn( int index )
{
Map map = Map;
@ -520,7 +539,7 @@ namespace Server.Mobiles
Defrag();
if ( m_Spawned.Count >= m_Count )
if ( !CheckSpawnCount() )
return;
ISpawnable spawned = CreateSpawnedObject( index );
@ -555,7 +574,7 @@ namespace Server.Mobiles
bc.Home = this.HomeLocation;
}
}
}
public Point3D GetSpawnPosition()
{
@ -600,7 +619,7 @@ namespace Server.Mobiles
DoTimer( delay );
}
public void DoTimer( TimeSpan delay )
public virtual void DoTimer( TimeSpan delay )
{
if ( !m_Running )
return;
@ -640,7 +659,18 @@ namespace Server.Mobiles
{
Defrag();
Dictionary<string, int> counts = new Dictionary<string, int>();
Dictionary<string, int> counts = new Dictionary<string, int>( StringComparer.OrdinalIgnoreCase );
foreach ( string entry in m_SpawnNames )
{
string name = ParseType( entry );
Type type = ScriptCompiler.FindTypeByName( name );
if ( type == null )
counts[name] = 0;
else
counts[type.Name] = 0;
}
foreach ( ISpawnable spawned in m_Spawned )
{
@ -695,7 +725,7 @@ namespace Server.Mobiles
{
Defrag();
for ( int i = 0; i < m_Spawned.Count; ++i )
for ( int i = m_Spawned.Count - 1; i >= 0; --i )
m_Spawned[i].Delete();
InvalidateProperties();