public override void Go(string target, Player player) { target = target.ToLower(); if (neighbors.ContainsKey(target)) { if (!doors.ContainsKey(target) || !doors[target].Locked) { player.Scream(player, "", "deixa a sala pela saída " + target); player.Room = neighbors[target]; player.Scream(player, "", "entra na sala"); player.Room.Describe(player); } else { player.Talk(global::Server.Instance.ServerPlayer, doors[target].Description + " impede sua passagem"); } } else { player.Talk(global::Server.Instance.ServerPlayer, "Não há saída na direção " + target); } }
public override void Leave(Player player) { if (player.Items.Contains(this)) { player.Items.Remove(this); player.Room.Items.Add(this); player.Scream(player, Name, "largou"); } else { global::Server.Instance.LogWindow.Log(string.Format("{0} tentou largar um item {1} que ele não possui", player.Name, Name)); } }
public override void Take(Player player) { if (player.Items.Contains(this)) { player.Talk(global::Server.Instance.ServerPlayer, string.Format("Você já possui {0}", Name)); } else if (player.Room.Items.Contains(this)) { player.Room.Items.Remove(this); player.Items.Add(this); player.Scream(player, Name, "pegou"); } else { global::Server.Instance.LogWindow.Log(string.Format("{0} tentou pegar um item {1} que não está nem no inventário nem na sala", player.Name, Name)); } }
public override bool UseOn(Item source, Player player) { if (source.Name.Equals(KeyName)) { Locked = !Locked; string text; string action; if (Locked) { action = "fecha uma porta"; text = LockDescription; } else { action = "abre uma porta"; text = UnlockDescription; } player.Scream(player, text, action); return true; } return false; }
public override void Use(Command command, Player player) { string tail = string.Join("", command.Tail); Item targetItem = player.Find(tail) ?? player.Room.Find(tail); if (targetItem != null) { if (player.Items.Contains(this)) { player.Scream(player, "", "usa uma chave em " + tail); if (targetItem.UseOn(this, player) && Consumable) { player.Items.Remove(this); } } else { player.Talk(global::Server.Instance.ServerPlayer, string.Format("Do que você está falando? Não há nada chamado {0}", Name)); } } else { player.Talk(global::Server.Instance.ServerPlayer, string.Format("Do que você está falando? Não há nada chamado {0}", tail)); } }
void TellServerOurName(string name, NetworkMessageInfo info) { Player newEntry = new Player(name); newEntry.NetworkPlayer = info.sender; playerList.Add(newEntry); newEntry.Scream(newEntry, "", "se junta à aventura"); newEntry.Room = map.First(); newEntry.Room.Describe(newEntry); // initial description logWindow.Log(name + " joined the chat"); }