Ejemplo n.º 1
1
        internal static void StaffChat( Player player, Command cmd ) {
            if( player.Info.IsMuted ) {
                player.MutedMessage();
                return;
            }

            if( DateTime.UtcNow < player.Info.MutedUntil ) {
                player.Message( "You are muted for another {0:0} seconds.",
                                player.Info.MutedUntil.Subtract( DateTime.UtcNow ).TotalSeconds );
                return;
            }


            Player[] plist = Server.PlayerList;

            if( plist.Length > 0 ) player.Info.LinesWritten++;

            string message = cmd.NextAll();
            if( message != null && message.Trim().Length > 0 ) {
                message = message.Trim();
                if( player.Can( Permission.UseColorCodes ) && message.Contains( "%" ) ) {
                    message = Color.ReplacePercentCodes( message );
                }
                for( int i = 0; i < plist.Length; i++ ) {
                    if( (plist[i].Can( Permission.ReadStaffChat ) || plist[i] == player) && !plist[i].IsIgnoring( player.Info ) ) {
                        plist[i].Message( "{0}(staff){1}{0}: {2}", Color.PM, player.GetClassyName(), message );
                    }
                }
            }
        }
Ejemplo n.º 2
0
        internal static void Say(Player player, Command cmd)
        {
            if (player.Info.IsMuted)
            {
                player.MutedMessage();
                return;
            }

            if (player.Can(Permission.Say))
            {
                string msg = cmd.NextAll();
                if (player.Can(Permission.UseColorCodes) && msg.Contains("%"))
                {
                    msg = Color.ReplacePercentCodes(msg);
                }
                if (msg != null && msg.Trim().Length > 0)
                {
                    player.Info.LinesWritten++;
                    Server.SendToAllExceptIgnored(player, "&Y{0}", null, msg.Trim());
                    IRC.SendAction(String.Format("&Y{0}", msg.Trim()));
                }
                else
                {
                    cdSay.PrintUsage(player);
                }
            }
            else
            {
                player.NoAccessMessage(Permission.Say);
            }
        }
Ejemplo n.º 3
0
        internal static void StaffChat(Player player, Command cmd)
        {
            if (player.Info.IsMuted)
            {
                player.MutedMessage();
                return;
            }

            if (DateTime.UtcNow < player.Info.MutedUntil)
            {
                player.Message("You are muted for another {0:0} seconds.",
                               player.Info.MutedUntil.Subtract(DateTime.UtcNow).TotalSeconds);
                return;
            }


            Player[] plist = Server.PlayerList;

            if (plist.Length > 0)
            {
                player.Info.LinesWritten++;
            }

            string message = cmd.NextAll();

            if (message != null && message.Trim().Length > 0)
            {
                message = message.Trim();
                if (player.Can(Permission.UseColorCodes) && message.Contains("%"))
                {
                    message = Color.ReplacePercentCodes(message);
                }
                for (int i = 0; i < plist.Length; i++)
                {
                    if ((plist[i].Can(Permission.ReadStaffChat) || plist[i] == player) && !plist[i].IsIgnoring(player.Info))
                    {
                        plist[i].Message("{0}(staff){1}{0}: {2}", Color.PM, player.GetClassyName(), message);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        internal static void Me(Player player, Command cmd)
        {
            if (player.Info.IsMuted)
            {
                player.MutedMessage();
                return;
            }

            string msg = cmd.NextAll().Trim();

            if (msg.Length > 0)
            {
                player.Info.LinesWritten++;
                if (player.Can(Permission.UseColorCodes) && msg.Contains("%"))
                {
                    msg = Color.ReplacePercentCodes(msg);
                }
                string message = String.Format("{0}*{1} {2}", Color.Me, player.Name, msg);
                Server.SendToAll(message);
                IRC.SendChannelMessage(message);
            }
        }
Ejemplo n.º 5
0
        internal static void Say( Player player, Command cmd ) {
            if( player.Info.IsMuted ) {
                player.MutedMessage();
                return;
            }

            if( player.Can( Permission.Say ) ) {
                string msg = cmd.NextAll();
                if( player.Can( Permission.UseColorCodes ) && msg.Contains( "%" ) ) {
                    msg = Color.ReplacePercentCodes( msg );
                }
                if( msg != null && msg.Trim().Length > 0 ) {
                    player.Info.LinesWritten++;
                    Server.SendToAllExceptIgnored( player, "&Y{0}", null, msg.Trim() );
                    IRC.SendAction( String.Format( "&Y{0}", msg.Trim() ) );
                } else {
                    cdSay.PrintUsage( player );
                }
            } else {
                player.NoAccessMessage( Permission.Say );
            }
        }
Ejemplo n.º 6
0
        internal static void Roll(Player player, Command cmd)
        {
            if (player.Info.IsMuted)
            {
                player.MutedMessage();
                return;
            }

            Random rand = new Random();
            int    min = 1, max = 100, t1;

            if (cmd.NextInt(out t1))
            {
                int t2;
                if (cmd.NextInt(out t2))
                {
                    if (t2 < t1)
                    {
                        min = t2;
                        max = t1;
                    }
                    else
                    {
                        min = t1;
                        max = t2;
                    }
                }
                else if (t1 >= 1)
                {
                    max = t1;
                }
            }
            int num = rand.Next(min, max + 1);

            Server.SendToAll("{0}{1} rolled {2} ({3}...{4})",
                             player.GetClassyName(), Color.Silver, num, min, max);
        }
Ejemplo n.º 7
0
        internal static void Roll( Player player, Command cmd ) {
            if( player.Info.IsMuted ) {
                player.MutedMessage();
                return;
            }

            Random rand = new Random();
            int min = 1, max = 100, t1;
            if( cmd.NextInt( out t1 ) ) {
                int t2;
                if( cmd.NextInt( out t2 ) ) {
                    if( t2 < t1 ) {
                        min = t2;
                        max = t1;
                    } else {
                        min = t1;
                        max = t2;
                    }
                } else if( t1 >= 1 ) {
                    max = t1;
                }
            }
            int num = rand.Next( min, max + 1 );
            Server.SendToAll( "{0}{1} rolled {2} ({3}...{4})",
                              player.GetClassyName(), Color.Silver, num, min, max );
        }
Ejemplo n.º 8
0
        internal static void Me( Player player, Command cmd ) {
            if( player.Info.IsMuted ) {
                player.MutedMessage();
                return;
            }

            string msg = cmd.NextAll().Trim();
            if( msg.Length > 0 ) {
                player.Info.LinesWritten++;
                if( player.Can( Permission.UseColorCodes ) && msg.Contains( "%" ) ) {
                    msg = Color.ReplacePercentCodes( msg );
                }
                string message = String.Format( "{0}*{1} {2}", Color.Me, player.Name, msg );
                Server.SendToAll( message );
                IRC.SendChannelMessage( message );
            }
        }