Ejemplo n.º 1
0
Archivo: Room.cs Proyecto: stadham/LOVC
 public virtual void Command(Player player, string[] command, SayMode mode = SayMode.Normal)
 {
     if (command[0].ToLower() == "me" && command.Length > 1)
     {
         foreach (var pl in players)
         {
             if (pl.Value.id != player.id)
             {
                 pl.Value.connection.Invoke("PlayerSay", player.id, command[1], SayMode.Action);
             }
         }
     }
 }
Ejemplo n.º 2
0
Archivo: Room.cs Proyecto: stadham/LOVC
 public virtual void Chat(Player player, string message, SayMode mode)
 {
     Console.WriteLine("Player {0} say {1} ({2})", player.name, message, mode);
     if ((message.StartsWith("/") || message.StartsWith("!")) && message.Length > 1)
     {
         Command(player, message.Substring(1).Split(new[] { ' ' }, 2), mode);
         return;
     }
     foreach (var pl in players)
     {
         if (pl.Value.id != player.id)
         {
             pl.Value.connection.Invoke("PlayerSay", player.id, message, mode);
         }
     }
 }
Ejemplo n.º 3
0
        void G_SayTo(gentity_t ent, gentity_t other, SayMode mode, string color, string name, string message)
        {
            if (other == null || !other.inuse || other.client == null || other.client.pers.connected != clientConnected_t.CON_CONNECTED || (mode == SayMode.TEAM && !OnSameTeam(ent, other)))
                return;

            Server.Instance.SendServerCommand(Server.Instance.clients[other.client.clientIndex], string.Format("{0} \"{1}{2}{3}\"", (mode == SayMode.TEAM) ? "tchat" : "chat", name, "^" + color, message));
        }
Ejemplo n.º 4
0
        void G_Say(gentity_t ent, gentity_t target, SayMode mode, string chatText)
        {
            string name = null;
            string color = "";

            switch (mode)
            {
                default:
                case SayMode.ALL:
                    LogPrintf("say: {0}: {1}\n", ent.client.pers.netname, chatText);
                    name = string.Format("{0}{1}{2}: ", ent.client.pers.netname, "^7", (char)0x19);
                    color = "2";
                    break;
                case SayMode.TEAM:
                    LogPrintf("sayteam: {0}: {1}\n", ent.client.pers.netname, chatText);
                    name = string.Format("{0}({1}{2}{3}){4}: ", (char)0x19, ent.client.pers.netname, "^7", (char)0x19, (char)0x19);
                    color = "5";
                    break;
                case SayMode.TELL:
                    name = string.Format("{0}[{1}{2}{2}]{2}", (char)0x19, ent.client.pers.netname, "^7",(char)0x19,(char)0x19);
                    color = "6";
                    break;
            }

            if (target != null)
            {
                G_SayTo(ent, target, mode, color, name, chatText);
                return;
            }

            // send it to all the apropriate clients
            gentity_t other;
            for (int i = 0; i < level.maxclients; i++)
            {
                other = g_entities[i];
                G_SayTo(ent, other, mode, color, name, chatText);
            }
        }
Ejemplo n.º 5
0
        void Cmd_Say_f(gentity_t ent, SayMode mode, string[] tokens, bool arg0)
        {
            if (tokens.Length < 2 && !arg0)
                return;

            string p;
            if (arg0)
                p = CubeHags.client.common.Commands.ArgsFrom(tokens, 0);
            else
                p = CubeHags.client.common.Commands.ArgsFrom(tokens, 1);

            G_Say(ent, null, mode, p);
        }