MUDServer.Player.PerformLook C# (CSharp) Method

PerformLook() private method

private PerformLook ( string words ) : void
words string
return void
        private void PerformLook(string[] words)
        {
            if ((words != null) && (words.Length > 1)) {
                // Look at

                string name = String.Join(" ", words, 1, words.Length - 1);
                IEntity at = Location.ResolveName(name);
                if (at == this) {
                    SendMessage("You look fabulous!");
                } else if (at != null) {
                    SendMessage("You see {0} {1}.", at.Name, at.State ?? "standing nearby");
                    if (at is CombatEntity) {
                        var ce = (CombatEntity)at;
                        SendMessage(
                            "{0} has {1} health points remaining{2}",
                            at.Name, ce.CurrentHealth, ce.InCombat ? " and is currently engaged in battle." : "."
                        );
                    }
                } else {
                    SendMessage("You don't see '{0}' around here.", name);
                }
            } else {
                // Look around

                if (Location.Description != null)
                    SendMessage(Location.Description);

                if (Location.Exits.Count != 0) {
                    SendMessage("Exits from this location:");
                    for (int i = 0; i < Location.Exits.Count; i++) {
                        SendMessage("{0}: {1}", Location.Exits[i].Name, Location.Exits[i].Description);
                    }
                }

                foreach (var e in this.Location.Entities) {
                    if (e.Value != this)
                        SendMessage("{0} is {1}.", e.Value.Description, e.Value.State ?? "standing nearby");
                }
            }
        }