Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -1,173 +1,179 @@
|
|||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Multis;
|
||||
using System.Collections.Generic;
|
||||
using Server.ContextMenus;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Multis;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class HouseTeleporter : Item, ISecurable
|
||||
{
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Item Target { get; set; }
|
||||
public class HouseTeleporter : Item, ISecurable
|
||||
{
|
||||
[Constructible]
|
||||
public HouseTeleporter(int itemID) : this(itemID, null)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public SecureLevel Level { get; set; }
|
||||
public HouseTeleporter(int itemID, Item target) : base(itemID)
|
||||
{
|
||||
Movable = false;
|
||||
|
||||
[Constructible]
|
||||
public HouseTeleporter( int itemID ) : this( itemID, null )
|
||||
{
|
||||
}
|
||||
Level = SecureLevel.Anyone;
|
||||
|
||||
public HouseTeleporter( int itemID, Item target ) : base( itemID )
|
||||
{
|
||||
Movable = false;
|
||||
Target = target;
|
||||
}
|
||||
|
||||
Level = SecureLevel.Anyone;
|
||||
public HouseTeleporter(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
Target = target;
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Item Target{ get; set; }
|
||||
|
||||
public bool CheckAccess( Mobile m )
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt( this );
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public SecureLevel Level{ get; set; }
|
||||
|
||||
if ( house != null && (house.Public ? house.IsBanned( m ) : !house.HasAccess( m )) )
|
||||
return false;
|
||||
public bool CheckAccess(Mobile m)
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt(this);
|
||||
|
||||
return ( house != null && house.HasSecureAccess( m, Level ) );
|
||||
}
|
||||
if (house != null && (house.Public ? house.IsBanned(m) : !house.HasAccess(m)))
|
||||
return false;
|
||||
|
||||
public override bool OnMoveOver( Mobile m )
|
||||
{
|
||||
if ( Target != null && !Target.Deleted )
|
||||
{
|
||||
if ( CheckAccess( m ) )
|
||||
{
|
||||
if ( !m.Hidden || m.AccessLevel == AccessLevel.Player )
|
||||
new EffectTimer( Location, Map, 2023, 0x1F0, TimeSpan.FromSeconds( 0.4 ) ).Start();
|
||||
return house != null && house.HasSecureAccess(m, Level);
|
||||
}
|
||||
|
||||
new DelayTimer( this, m ).Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendLocalizedMessage( 1061637 ); // You are not allowed to access this.
|
||||
}
|
||||
}
|
||||
public override bool OnMoveOver(Mobile m)
|
||||
{
|
||||
if (Target != null && !Target.Deleted)
|
||||
{
|
||||
if (CheckAccess(m))
|
||||
{
|
||||
if (!m.Hidden || m.AccessLevel == AccessLevel.Player)
|
||||
new EffectTimer(Location, Map, 2023, 0x1F0, TimeSpan.FromSeconds(0.4)).Start();
|
||||
|
||||
return true;
|
||||
}
|
||||
new DelayTimer(this, m).Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendLocalizedMessage(1061637); // You are not allowed to access this.
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
|
||||
{
|
||||
base.GetContextMenuEntries( from, list );
|
||||
SetSecureLevelEntry.AddTo( from, this, list );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public HouseTeleporter( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
{
|
||||
base.GetContextMenuEntries(from, list);
|
||||
SetSecureLevelEntry.AddTo(from, this, list);
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
writer.Write(1); // version
|
||||
|
||||
writer.Write( (int) Level );
|
||||
writer.Write((int)Level);
|
||||
|
||||
writer.Write( (Item) Target );
|
||||
}
|
||||
writer.Write(Target);
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
Level = (SecureLevel)reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
Target = reader.ReadItem();
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
Level = (SecureLevel)reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
Target = reader.ReadItem();
|
||||
|
||||
if ( version < 0 )
|
||||
Level = SecureLevel.Anyone;
|
||||
if (version < 0)
|
||||
Level = SecureLevel.Anyone;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class EffectTimer : Timer
|
||||
{
|
||||
private Point3D m_Location;
|
||||
private Map m_Map;
|
||||
private int m_EffectID;
|
||||
private int m_SoundID;
|
||||
private class EffectTimer : Timer
|
||||
{
|
||||
private int m_EffectID;
|
||||
private Point3D m_Location;
|
||||
private Map m_Map;
|
||||
private int m_SoundID;
|
||||
|
||||
public EffectTimer( Point3D p, Map map, int effectID, int soundID, TimeSpan delay ) : base( delay )
|
||||
{
|
||||
m_Location = p;
|
||||
m_Map = map;
|
||||
m_EffectID = effectID;
|
||||
m_SoundID = soundID;
|
||||
}
|
||||
public EffectTimer(Point3D p, Map map, int effectID, int soundID, TimeSpan delay) : base(delay)
|
||||
{
|
||||
m_Location = p;
|
||||
m_Map = map;
|
||||
m_EffectID = effectID;
|
||||
m_SoundID = soundID;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
Effects.SendLocationParticles( EffectItem.Create( m_Location, m_Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, m_EffectID, 0 );
|
||||
protected override void OnTick()
|
||||
{
|
||||
Effects.SendLocationParticles(EffectItem.Create(m_Location, m_Map, EffectItem.DefaultDuration), 0x3728, 10,
|
||||
10, m_EffectID, 0);
|
||||
|
||||
if ( m_SoundID != -1 )
|
||||
Effects.PlaySound( m_Location, m_Map, m_SoundID );
|
||||
}
|
||||
}
|
||||
if (m_SoundID != -1)
|
||||
Effects.PlaySound(m_Location, m_Map, m_SoundID);
|
||||
}
|
||||
}
|
||||
|
||||
private class DelayTimer : Timer
|
||||
{
|
||||
private HouseTeleporter m_Teleporter;
|
||||
private Mobile m_Mobile;
|
||||
private class DelayTimer : Timer
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private HouseTeleporter m_Teleporter;
|
||||
|
||||
public DelayTimer( HouseTeleporter tp, Mobile m ) : base( TimeSpan.FromSeconds( 1.0 ) )
|
||||
{
|
||||
m_Teleporter = tp;
|
||||
m_Mobile = m;
|
||||
}
|
||||
public DelayTimer(HouseTeleporter tp, Mobile m) : base(TimeSpan.FromSeconds(1.0))
|
||||
{
|
||||
m_Teleporter = tp;
|
||||
m_Mobile = m;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
Item target = m_Teleporter.Target;
|
||||
protected override void OnTick()
|
||||
{
|
||||
Item target = m_Teleporter.Target;
|
||||
|
||||
if ( target != null && !target.Deleted )
|
||||
{
|
||||
Mobile m = m_Mobile;
|
||||
if (target != null && !target.Deleted)
|
||||
{
|
||||
Mobile m = m_Mobile;
|
||||
|
||||
if ( m.Location == m_Teleporter.Location && m.Map == m_Teleporter.Map )
|
||||
{
|
||||
Point3D p = target.GetWorldTop();
|
||||
Map map = target.Map;
|
||||
if (m.Location == m_Teleporter.Location && m.Map == m_Teleporter.Map)
|
||||
{
|
||||
Point3D p = target.GetWorldTop();
|
||||
Map map = target.Map;
|
||||
|
||||
Mobiles.BaseCreature.TeleportPets( m, p, map );
|
||||
BaseCreature.TeleportPets(m, p, map);
|
||||
|
||||
m.MoveToWorld( p, map );
|
||||
m.MoveToWorld(p, map);
|
||||
|
||||
if ( !m.Hidden || m.AccessLevel == AccessLevel.Player )
|
||||
{
|
||||
Effects.PlaySound( target.Location, target.Map, 0x1FE );
|
||||
if (!m.Hidden || m.AccessLevel == AccessLevel.Player)
|
||||
{
|
||||
Effects.PlaySound(target.Location, target.Map, 0x1FE);
|
||||
|
||||
Effects.SendLocationParticles( EffectItem.Create( m_Teleporter.Location, m_Teleporter.Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 2023, 0 );
|
||||
Effects.SendLocationParticles( EffectItem.Create( target.Location, target.Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 5023, 0 );
|
||||
Effects.SendLocationParticles(
|
||||
EffectItem.Create(m_Teleporter.Location, m_Teleporter.Map, EffectItem.DefaultDuration),
|
||||
0x3728, 10, 10, 2023, 0);
|
||||
Effects.SendLocationParticles(
|
||||
EffectItem.Create(target.Location, target.Map, EffectItem.DefaultDuration), 0x3728, 10, 10,
|
||||
5023, 0);
|
||||
|
||||
new EffectTimer( target.Location, target.Map, 2023, -1, TimeSpan.FromSeconds( 0.4 ) ).Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
new EffectTimer(target.Location, target.Map, 2023, -1, TimeSpan.FromSeconds(0.4)).Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue