Exemplo n.º 1
0
        public void Render(IPlayer player)
        {
            currentPlayer = player;
            director      = player.Director;

            if (!player.Director.Server.Game.HideRoomNames)
            {
                player.SendMessage(player.Location.Name);
            }

            player.SendMessage(player.Location.Description);

            foreach (IDoor door in player.Location.GetDoorways())
            {
                player.SendMessage(door.FacingDirection.ToString() + ": " + door.Arrival.Name);
            }

            List <IPlayer> omit = new List <IPlayer>()
            {
                player
            };
            string message = string.Empty;

            if (player.Location.Occupants.Count == 2) //Only the player + 1 occupant, so we need a simpler message
            {
                foreach (IMob occupant in player.Location.Occupants)
                {
                    //We need it to say "Bob is here", but only to our player
                    if (occupant == player)
                    {
                        continue;
                    }

                    message = string.Format("{0} is here.", occupant.Name);
                    player.SendMessage(message);
                }
            }
            else if (player.Location.Occupants.Count > 2) //more than just the player and one other occupant.
            {
                // We need it to say "Bob, Sussie and Chris is here"
                foreach (IMob occupant in player.Location.Occupants)
                {
                    if (occupant == player)
                    {
                        continue;
                    }

                    if (occupant == player.Location.Occupants[player.Location.Occupants.Count - 1])
                    {
                        message += "and " + occupant.Name;
                    }
                    else
                    {
                        message += occupant.Name + ", ";
                    }
                }
                message += "is here.";
                player.SendMessage(message);
            }
        }
Exemplo n.º 2
0
        public void Render(IPlayer player)
        {
            currentPlayer = player;
            director = player.Director;

            if (!player.Director.Server.Game.HideRoomNames)
                player.SendMessage(player.Location.Name);

            player.SendMessage(player.Location.Description);

            foreach (IDoor door in player.Location.GetDoorways())
            {
                player.SendMessage(door.FacingDirection.ToString() + ": " + door.Arrival.Name);
            }

            List<IPlayer> omit = new List<IPlayer>() { player };
            string message = string.Empty;
            if (player.Location.Occupants.Count == 2) //Only the player + 1 occupant, so we need a simpler message
            {
                foreach (IMob occupant in player.Location.Occupants)
                {
                    //We need it to say "Bob is here", but only to our player
                    if (occupant == player)
                        continue;

                    message = string.Format("{0} is here.", occupant.Name);
                    player.SendMessage(message);
                }
            }
            else if (player.Location.Occupants.Count > 2) //more than just the player and one other occupant.
            {
                // We need it to say "Bob, Sussie and Chris is here"
                foreach (IMob occupant in player.Location.Occupants)
                {
                    if (occupant == player)
                        continue;

                    if (occupant == player.Location.Occupants[player.Location.Occupants.Count - 1])
                        message += "and " + occupant.Name;
                    else
                        message += occupant.Name + ", ";
                }
                message += "is here.";
                player.SendMessage(message);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes the player with a default state and provides its network connection for storage.
        /// </summary>
        /// <param name="initialState"></param>
        /// <param name="connection"></param>
        public virtual void Initialize(IState initialState, Socket connection, IServerDirector director)
        {
            this.Connection = connection;
            Director        = director;

            // Store reference to the initial state.
            CurrentState = initialState;

            // Call the login event.
            OnLoginEvent();

            // Render the state after the login event.  This allows scripts to replace the initialState
            // if they want with something custom and have the engine render it.

            if (CurrentState == null)
            {
                Log.Error(string.Format("Failed to locate the current state for character '{0}'", Name));
            }
            else
            {
                CurrentState.Render(this);
            }
        }
Exemplo n.º 4
0
 public void Render(IPlayer player)
 {
     connectedPlayer = player;
     director        = player.Director;
 }
Exemplo n.º 5
0
 public void Render(IPlayer player)
 {
     currentPlayer = player;
     director = player.Director;
     currentPlayer.SendMessage("Command: ", false);
 }
Exemplo n.º 6
0
        /// <summary>
        /// Initializes the player with a default state and provides its network connection for storage.
        /// </summary>
        /// <param name="initialState"></param>
        /// <param name="connection"></param>
        public virtual void Initialize(IState initialState, Socket connection, IServerDirector director)
        {
            this.Connection = connection;
            Director = director;

            // Store reference to the initial state.
            CurrentState = initialState;

            // Call the login event.
            OnLoginEvent();

            // Render the state after the login event.  This allows scripts to replace the initialState
            // if they want with something custom and have the engine render it.

            if (CurrentState == null)
            {
                Log.Error(string.Format("Failed to locate the current state for character '{0}'", Name));

            }
            else
                CurrentState.Render(this);
        }
Exemplo n.º 7
0
 public void Render(IPlayer player)
 {
     connectedPlayer = player;
     director = player.Director;
 }
Exemplo n.º 8
0
 public void Render(IPlayer player)
 {
     currentPlayer = player;
     director      = player.Director;
     currentPlayer.SendMessage("Command: ", false);
 }