예제 #1
0
파일: Room.cs 프로젝트: diogoriba/Kroz
 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);
     }
 }
예제 #2
0
 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));
     }
 }
예제 #3
0
 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));
     }
 }
예제 #4
0
파일: Door.cs 프로젝트: diogoriba/Kroz
        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;
        }
예제 #5
0
파일: Key.cs 프로젝트: diogoriba/Kroz
 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));
     }
 }
예제 #6
0
파일: Server.cs 프로젝트: diogoriba/Kroz
    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");
    }