- Updated to work with ScriptingEngine changes. MudEngine: - Game.PlayerCollection changed to a List<>. Server obtains a array version of it within Server.initialize() via players = pbs.ToArray(). - All BaseObject classes now require a reference to the Game and contain a property called ActiveGame. - Player.Game removed and now uses it's parent objects ActiveGame property. - Player.Role property added. Uses the new SecurityRoles enum that specifies what level of access the player has. - ScriptEngine now loads all libraries found within the specified ScriptsPath directory, instances the scripts and places them into a collection. - Custom character script instancing is now supported, but not fully implemented throughout the engine. They can be loaded, but not used during runtime at this time.
76 lines
2.2 KiB
C#
76 lines
2.2 KiB
C#
//Microsoft .NET Framework
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.IO;
|
|
using System.ComponentModel;
|
|
|
|
//MUD Engine
|
|
using MudEngine.FileSystem;
|
|
using MudEngine.GameObjects;
|
|
|
|
namespace MudEngine.GameObjects.Environment
|
|
{
|
|
public class Realm : BaseObject
|
|
{
|
|
|
|
[Category("Environment Information")]
|
|
[Description("A collection of Zones that are contained within this Realm. Players can traverse the world be traveling through Rooms that are contained within Zones. Note that it is not required to place a Zone into a Realm.")]
|
|
//[EditorAttribute(typeof(UIRealmEditor), typeof(System.Drawing.Design.UITypeEditor))]
|
|
public List<Zone> ZoneCollection { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Gets or Sets if this Realm is the starting realm for the game.
|
|
/// </summary>
|
|
public bool IsInitialRealm { get; set; }
|
|
|
|
/// <summary>
|
|
/// The Initial Starting Zone for this Realm.
|
|
/// </summary>
|
|
public Zone InitialZone { get; private set; }
|
|
|
|
public Realm(GameManagement.Game game) : base(game)
|
|
{
|
|
ZoneCollection = new List<Zone>();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns the requested Zone if the Zone exists within this Realm.
|
|
/// </summary>
|
|
/// <param name="zoneName"></param>
|
|
/// <returns></returns>
|
|
public Zone GetZone(string name)
|
|
{
|
|
foreach (Zone zone in ZoneCollection)
|
|
{
|
|
if (zone.Name == name)
|
|
return zone;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
public void AddZone(Zone zone)
|
|
{
|
|
if (zone.IsInitialZone)
|
|
{
|
|
foreach (Zone z in ZoneCollection)
|
|
{
|
|
if (z.IsInitialZone)
|
|
{
|
|
z.IsInitialZone = false;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
if (zone.IsInitialZone)
|
|
InitialZone = zone;
|
|
|
|
//TODO: Check fo duplicates
|
|
ZoneCollection.Add(zone);
|
|
}
|
|
}
|
|
}
|