#W# Initial Commit: Avatars Conquest
This commit is contained in:
commit
5df497787a
7510 changed files with 416048 additions and 0 deletions
81
Scripts/Regions/DungeonRegion.cs
Normal file
81
Scripts/Regions/DungeonRegion.cs
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
using System;
|
||||
using System.Xml;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Regions
|
||||
{
|
||||
public class DungeonRegion : BaseRegion
|
||||
{
|
||||
public DungeonRegion( XmlElement xml, Map map, Region parent ) : base( xml, map, parent )
|
||||
{
|
||||
}
|
||||
|
||||
public override bool AllowHousing( Mobile from, Point3D p )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool NoMounts( Mobile from, Point3D p )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void AlterLightLevel( Mobile m, ref int global, ref int personal )
|
||||
{
|
||||
global = LightCycle.DungeonLevel;
|
||||
}
|
||||
|
||||
public override bool CanUseStuckMenu( Mobile m )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnEnter( Mobile m )
|
||||
{
|
||||
base.OnEnter( m );
|
||||
if ( m is PlayerMobile )
|
||||
m.SendMessage( "You have entered " + this.Name + "." );
|
||||
}
|
||||
|
||||
public override void OnExit(Mobile m)
|
||||
{
|
||||
base.OnExit( m );
|
||||
if ( m is PlayerMobile )
|
||||
{
|
||||
if ( !PlayersLeftInRegion( m, this ) )
|
||||
{
|
||||
foreach ( Mobile creature in World.Mobiles.Values )
|
||||
if ( creature.Region == this && creature is BaseCreature )
|
||||
{
|
||||
BaseCreature dweller = (BaseCreature)creature;
|
||||
Point3D loc = dweller.Home;
|
||||
if ( loc.X > 0 && dweller.RangeHome < 10 && dweller.SummonMaster == null && dweller.ControlMaster == null )
|
||||
{
|
||||
dweller.Location = dweller.Home;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool PlayersLeftInRegion( Mobile from, Region region )
|
||||
{
|
||||
bool occupied = false;
|
||||
|
||||
foreach ( NetState state in NetState.Instances )
|
||||
{
|
||||
Mobile m = state.Mobile;
|
||||
|
||||
if ( m != null && m != from && m.Region == region )
|
||||
{
|
||||
occupied = true;
|
||||
}
|
||||
}
|
||||
|
||||
return occupied;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue