Fixes code according to modern code style. Fixes a few expression bugs.

This commit is contained in:
Kamron Batman 2018-09-15 09:58:51 -07:00
parent 89eea25e5f
commit 970fd563b2
3324 changed files with 441118 additions and 433755 deletions

View file

@ -3,118 +3,114 @@ using Server.Regions;
namespace Server.Engines.Doom
{
public class LampRoomRegion : BaseRegion
{
private LeverPuzzleController Controller;
public class LampRoomRegion : BaseRegion
{
private LeverPuzzleController Controller;
public LampRoomRegion ( LeverPuzzleController controller )
: base( null, Map.Malas, Find( LeverPuzzleController.lr_Enter, Map.Malas ), LeverPuzzleController.lr_Rect )
{
Controller = controller;
Register();
}
public LampRoomRegion(LeverPuzzleController controller)
: base(null, Map.Malas, Find(LeverPuzzleController.lr_Enter, Map.Malas), LeverPuzzleController.lr_Rect)
{
Controller = controller;
Register();
}
public static void Initialize()
{
EventSink.Login += OnLogin;
}
public static void Initialize()
{
EventSink.Login += OnLogin;
}
public static void OnLogin( LoginEventArgs e )
{
Mobile m = e.Mobile;
Rectangle2D rect = LeverPuzzleController.lr_Rect;
if ( m.X >= rect.X && m.X <= (rect.X+10) && m.Y >= rect.Y && m.Y <= (rect.Y+10) && m.Map == Map.Internal )
{
Timer kick = new LeverPuzzleController.LampRoomKickTimer( m );
kick.Start();
}
}
public static void OnLogin(LoginEventArgs e)
{
Mobile m = e.Mobile;
Rectangle2D rect = LeverPuzzleController.lr_Rect;
if (m.X >= rect.X && m.X <= rect.X + 10 && m.Y >= rect.Y && m.Y <= rect.Y + 10 && m.Map == Map.Internal)
{
Timer kick = new LeverPuzzleController.LampRoomKickTimer(m);
kick.Start();
}
}
public override void OnEnter( Mobile m )
{
if ( m == null || m is WandererOfTheVoid )
return;
public override void OnEnter(Mobile m)
{
if (m == null || m is WandererOfTheVoid)
return;
if ( m.AccessLevel > AccessLevel.Player )
return;
if (m.AccessLevel > AccessLevel.Player)
return;
if ( Controller.Successful != null )
{
if ( m is PlayerMobile )
{
if ( m == Controller.Successful )
{
return;
}
}
else if (m is BaseCreature bc && ((bc.Controlled && bc.ControlMaster == Controller.Successful) ||
bc.Summoned))
return;
}
Timer kick = new LeverPuzzleController.LampRoomKickTimer( m );
kick.Start();
}
if (Controller.Successful != null)
{
if (m is PlayerMobile)
{
if (m == Controller.Successful) return;
}
else if (m is BaseCreature bc && (bc.Controlled && bc.ControlMaster == Controller.Successful ||
bc.Summoned))
{
return;
}
}
public override void OnExit( Mobile m )
{
if ( m != null && m == Controller.Successful )
Controller.RemoveSuccessful();
}
Timer kick = new LeverPuzzleController.LampRoomKickTimer(m);
kick.Start();
}
public override void OnDeath( Mobile m )
{
if ( m != null && !m.Deleted && !(m is WandererOfTheVoid) )
{
Timer kick = new LeverPuzzleController.LampRoomKickTimer( m );
kick.Start();
}
}
public override void OnExit(Mobile m)
{
if (m != null && m == Controller.Successful)
Controller.RemoveSuccessful();
}
public override bool OnSkillUse( Mobile m, int Skill ) /* just in case */
{
if (( Controller.Successful == null ) || ( m.AccessLevel == AccessLevel.Player && m != Controller.Successful ))
{
return false;
}
return true;
}
}
public override void OnDeath(Mobile m)
{
if (m != null && !m.Deleted && !(m is WandererOfTheVoid))
{
Timer kick = new LeverPuzzleController.LampRoomKickTimer(m);
kick.Start();
}
}
public class LeverPuzzleRegion : BaseRegion
{
private LeverPuzzleController Controller;
public Mobile m_Occupant;
public override bool OnSkillUse(Mobile m, int Skill) /* just in case */
{
if (Controller.Successful == null || m.AccessLevel == AccessLevel.Player && m != Controller.Successful)
return false;
return true;
}
}
[CommandProperty( AccessLevel.GameMaster )]
public Mobile Occupant
{
get
{
if ( m_Occupant != null && m_Occupant.Alive )
return m_Occupant;
return null;
}
}
public class LeverPuzzleRegion : BaseRegion
{
private LeverPuzzleController Controller;
public Mobile m_Occupant;
public LeverPuzzleRegion ( LeverPuzzleController controller, int[] loc )
: base( null, Map.Malas, Find( LeverPuzzleController.lr_Enter, Map.Malas ), new Rectangle2D(loc[0],loc[1],1,1) )
{
Controller = controller;
Register();
}
public LeverPuzzleRegion(LeverPuzzleController controller, int[] loc)
: base(null, Map.Malas, Find(LeverPuzzleController.lr_Enter, Map.Malas), new Rectangle2D(loc[0], loc[1], 1, 1))
{
Controller = controller;
Register();
}
public override void OnEnter( Mobile m )
{
if ( m != null && m_Occupant == null && m is PlayerMobile && m.Alive )
m_Occupant = m;
}
public override void OnExit( Mobile m )
{
if ( m != null && m == m_Occupant )
m_Occupant = null;
}
}
}
[CommandProperty(AccessLevel.GameMaster)]
public Mobile Occupant
{
get
{
if (m_Occupant != null && m_Occupant.Alive)
return m_Occupant;
return null;
}
}
public override void OnEnter(Mobile m)
{
if (m != null && m_Occupant == null && m is PlayerMobile && m.Alive)
m_Occupant = m;
}
public override void OnExit(Mobile m)
{
if (m != null && m == m_Occupant)
m_Occupant = null;
}
}
}