Esempio n. 1
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                Help(p); return;
            }
            if (!MessageCmd.CanSpeak(p, name))
            {
                return;
            }

            string[] args = message.SplitSpaces(2);
            string   rank = args.Length == 1 ? p.group.name : args[0];
            string   text = args[args.Length - 1];
            Group    grp  = Group.FindMatches(p, rank);

            if (grp == null)
            {
                return;
            }

            Chat.MessageWhere("{3}<{2}>{0}: &f{1}", pl => pl.group == grp || pl == p,
                              p.ColoredName, text.Trim(), grp.trueName, grp.color);
            p.CheckForMessageSpam();
        }
Esempio n. 2
0
        public override void Use(Player p, string message)
        {
            string[] parts = message.SplitSpaces(2);
            if (message == "" || parts.Length == 1)
            {
                Help(p); return;
            }
            if (!MessageCmd.CanSpeak(p, name))
            {
                return;
            }

            string receiverName = PlayerInfo.FindMatchesPreferOnline(p, parts[0]);

            if (receiverName == null)
            {
                return;
            }
            string senderName = p == null ? "(console)" : p.name;
            string senderNick = p == null ? "(console)" : p.ColoredName;

            message = parts[1];
            //DB
            if (message.Length >= 256 && Database.Backend.EnforcesTextLength)
            {
                Player.Message(p, "Message was too long. It has been trimmed to:");
                Player.Message(p, message.Substring(0, 255));
                message = message.Substring(0, 255);
            }

            Database.Backend.CreateTable("Inbox" + receiverName, createInbox);
            Database.Backend.AddRow("Inbox" + receiverName, "PlayerFrom, TimeSent, Contents",
                                    senderName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), message);

            Player receiver = PlayerInfo.FindExact(receiverName);

            Player.Message(p, "Message sent to {0}%S.",
                           PlayerInfo.GetColoredName(p, receiverName));
            if (receiver == null)
            {
                return;
            }

            if (Player.IsSuper(p))
            {
                receiver.SendMessage("Message recieved from " + senderNick + "%S.");
            }
            else
            {
                p.MessageTo(receiver, "Message recieved from " + senderNick + "%S.");
            }
        }