#W# Source and Scripts added. Added Scripts/Settings.cs to expose some basic tweak able settings.
This commit is contained in:
parent
b51c58f514
commit
3045c83799
3512 changed files with 627673 additions and 0 deletions
69
Scripts/Mobiles/Special/Wanderer.cs
Normal file
69
Scripts/Mobiles/Special/Wanderer.cs
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
public class Wanderer : Mobile
|
||||
{
|
||||
private Timer m_Timer;
|
||||
|
||||
[Constructable]
|
||||
public Wanderer()
|
||||
{
|
||||
this.Name = "Me";
|
||||
this.Body = 0x1;
|
||||
this.AccessLevel = AccessLevel.Counselor;
|
||||
|
||||
m_Timer = new InternalTimer( this );
|
||||
m_Timer.Start();
|
||||
}
|
||||
|
||||
public Wanderer( Serial serial ) : base( serial )
|
||||
{
|
||||
m_Timer = new InternalTimer( this );
|
||||
m_Timer.Start();
|
||||
}
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
m_Timer.Stop();
|
||||
|
||||
base.OnDelete();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private Wanderer m_Owner;
|
||||
private int m_Count = 0;
|
||||
|
||||
public InternalTimer( Wanderer owner ) : base( TimeSpan.FromSeconds( 0.1 ), TimeSpan.FromSeconds( 0.1 ) )
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if ( (m_Count++ & 0x3) == 0 )
|
||||
{
|
||||
m_Owner.Direction = (Direction)(Utility.Random( 8 ) | 0x80);
|
||||
}
|
||||
|
||||
m_Owner.Move( m_Owner.Direction );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue