Upgrades spawners to have parameters/properties and optimized timers (#6)

Upgrades spawners to have:
- [X] Parameter support
- [X] Property support
- [X] Optimized timers
- [X] Support for Proximity Spawners
- [X] Probabilities
This commit is contained in:
Kamron Batman 2018-02-20 22:33:25 -08:00 • committed by GitHub
parent 20ae1b3989
commit 1030bb7675
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 1043 additions and 735 deletions

View file

@ -63,6 +63,7 @@ namespace Server
public abstract Rectangle3D ReadRect3D();
public abstract Map ReadMap();
public abstract IEntity ReadEntity();
public abstract Item ReadItem();
public abstract Mobile ReadMobile();
public abstract BaseGuild ReadGuild();
@ -134,6 +135,7 @@ namespace Server
public abstract void Write( Rectangle3D value );
public abstract void Write( Map value );
public abstract void WriteEntity( IEntity value );
public abstract void Write( Item value );
public abstract void Write( Mobile value );
public abstract void Write( BaseGuild value );
@ -189,7 +191,7 @@ namespace Server
public abstract void WriteGuildSet<T>( HashSet<T> set ) where T : BaseGuild;
public abstract void WriteGuildSet<T>( HashSet<T> set, bool tidy ) where T : BaseGuild;
// Compiler won't notice their 'where' to differentiate the generic methods.
// Compiler won't notice there 'where' to differentiate the generic methods.
}
public class BinaryFileWriter : GenericWriter
@ -591,6 +593,14 @@ namespace Server
Write( (byte)0xFF );
}
public override void WriteEntity( IEntity value )
{
if ( value == null || value.Deleted )
Write( Serial.MinusOne );
else
Write( value.Serial );
}
public override void Write( Item value )
{
if( value == null || value.Deleted )
@ -1126,6 +1136,16 @@ namespace Server
return Map.Maps[ReadByte()];
}
public override IEntity ReadEntity()
{
Serial serial = ReadInt();
IEntity entity = World.FindEntity( serial );
if ( entity == null )
return new Entity( serial, new Point3D( 0, 0, 0 ), Map.Internal );
else
return entity;
}
public override Item ReadItem()
{
return World.FindItem( ReadInt() );
@ -1725,6 +1745,14 @@ namespace Server
Write( (byte)0xFF );
}
public override void WriteEntity( IEntity value )
{
if ( value == null || value.Deleted )
Write( Serial.MinusOne );
else
Write( value.Serial );
}
public override void Write( Item value )
{
if( value == null || value.Deleted )