Esempio n. 1
0
        public MudObject AddScenery(String Description, params String[] Nouns)
        {
            var scenery = new MudObject();

            scenery.SetProperty("scenery?", true);
            scenery.SetProperty("long", Description);
            foreach (var noun in Nouns)
            {
                scenery.AddNoun(noun.ToUpper());
            }
            AddScenery(scenery);
            return(scenery);
        }
Esempio n. 2
0
        internal static ClientAcceptanceStatus ClientConnected(NetworkClient Client)
        {
            var ban = ProscriptionList.IsBanned(Client.IPString);

            if (ban.Banned)
            {
                Core.LogError("Rejected connection from " + Client.IPString + ". Matched ban " + ban.SourceBan.Glob + " Reason: " + ban.SourceBan.Reason);
                return(ClientAcceptanceStatus.Rejected);
            }

            ClientLock.WaitOne();

            var dummyPlayer = new MudObject();

            dummyPlayer.Actor();
            dummyPlayer.SetProperty("command handler", new LoginCommandHandler());
            Core.TiePlayerToClient(Client, dummyPlayer);

            Core.SendMessage(Client, Core.SettingsObject.Banner);
            Core.SendMessage(Client, Core.SettingsObject.MessageOfTheDay);

            ConnectedClients.Add(Client);

            Core.SendPendingMessages();

            ClientLock.ReleaseMutex();

            return(ClientAcceptanceStatus.Accepted);
        }
Esempio n. 3
0
        public static List <MudObject> InitializeConversationTopics(this MudObject To)
        {
            if (!To.HasProperty("conversation-topics"))
            {
                To.SetProperty("conversation-topics", new List <MudObject>());
            }

            return(To.GetProperty <List <MudObject> >("conversation-topics"));
        }
Esempio n. 4
0
 public MudObject AddScenery(String Description, params String[] Nouns)
 {
     var scenery = new MudObject();
     scenery.SetProperty("scenery?", true);
     scenery.Long = Description;
     foreach (var noun in Nouns)
         scenery.Nouns.Add(noun.ToUpper());
     AddScenery(scenery);
     return scenery;
 }
Esempio n. 5
0
        public void OpenLink(Direction Direction, String Destination, MudObject Portal = null)
        {
            if (RemoveAll(thing => thing.GetProperty <Direction>("link direction") == Direction && thing.GetProperty <bool>("portal?")) > 0)
            {
                Core.LogWarning("Opened duplicate link in " + Path);
            }

            if (Portal == null)
            {
                Portal = new MudObject();
                Portal.SetProperty("link anonymous?", true);
                Portal.SetProperty("short", "link " + Direction + " to " + Destination);
            }

            Portal.SetProperty("portal?", true);
            Portal.SetProperty("link direction", Direction);
            Portal.SetProperty("link destination", Destination);
            Portal.Location = this;
            Add(Portal, RelativeLocations.CONTENTS);
        }
Esempio n. 6
0
 public static void OfferQuest(this MudObject This, MudObject Actor, MudObject Quest)
 {
     if (Actor != null)
     {
         Core.SendMessage(Actor, "[To accept this quest, enter the command 'accept quest'.]");
         if (Actor.GetProperty <MudObject>("active-quest") != null)
         {
             Core.SendMessage(Actor, "[Accepting this quest will abandon your active quest.]");
         }
         Actor.SetProperty("offered-quest", Quest);
     }
 }
Esempio n. 7
0
 private static void RememberActor(MudObject Player, MudObject Actor)
 {
     if (String.IsNullOrEmpty(Actor.Path))
     {
         return;                                   // Don't remember unimportant mobs.
     }
     if (!Player.HasProperty("introduction memory"))
     {
         Player.SetProperty("introduction memory", new Dictionary <string, bool>());
     }
     Player.GetProperty <Dictionary <String, bool> >("introduction memory").Upsert(Actor.Path, true);
 }
Esempio n. 8
0
        public void OpenLink(Direction Direction, String Destination, MudObject Portal = null)
        {
            if (RemoveAll(thing => thing.GetPropertyOrDefault<Direction>("link direction", RMUD.Direction.NOWHERE) == Direction && thing.GetPropertyOrDefault<bool>("portal?", false)) > 0)
                Core.LogWarning("Opened duplicate link in " + Path);

            if (Portal == null)
            {
                Portal = new MudObject();
                Portal.SetProperty("link anonymous?", true);
                Portal.Short = "link " + Direction + " to " + Destination;
            }

            Portal.SetProperty("portal?", true);
            Portal.SetProperty("link direction", Direction);
            Portal.SetProperty("link destination", Destination);
            Portal.Location = this;
            Add(Portal, RelativeLocations.Contents);
        }
Esempio n. 9
0
        public void OpenLink(Direction Direction, String Destination, MudObject Portal = null)
        {
            if (RemoveAll(thing => thing.GetPropertyOrDefault <Direction>("link direction", RMUD.Direction.NOWHERE) == Direction && thing.GetPropertyOrDefault <bool>("portal?", false)) > 0)
            {
                Core.LogWarning("Opened duplicate link in " + Path);
            }

            if (Portal == null)
            {
                Portal = new MudObject();
                Portal.SetProperty("link anonymous?", true);
                Portal.Short = "link " + Direction + " to " + Destination;
            }

            Portal.SetProperty("portal?", true);
            Portal.SetProperty("link direction", Direction);
            Portal.SetProperty("link destination", Destination);
            Portal.Location = this;
            Add(Portal, RelativeLocations.Contents);
        }
Esempio n. 10
0
 public static void RemovePlayer(MudObject Actor)
 {
     GlobalRules.ConsiderPerformRule("player left", Actor);
     Actor.SetProperty("client", null);
     Move(Actor, null);
 }
Esempio n. 11
0
 public static void AddPlayer(MudObject Actor)
 {
     Actor.SetProperty("rank", 500);
     GlobalRules.ConsiderPerformRule("player joined", Actor);
 }
Esempio n. 12
0
 public static void TiePlayerToClient(Client Client, MudObject Actor)
 {
     Client.Player = Actor;
     Actor.SetProperty("client", Client);
 }
Esempio n. 13
0
 public void AddScenery(MudObject Scenery)
 {
     Scenery.SetProperty("scenery?", true);
     Add(Scenery, RelativeLocations.Contents);
     Scenery.Location = this;
 }
Esempio n. 14
0
 public void AddScenery(MudObject Scenery)
 {
     Scenery.SetProperty("scenery?", true);
     Add(Scenery, RelativeLocations.Contents);
     Scenery.Location = this;
 }