Beispiel #1
0
        private void HandleDuelRequest(DuelRequest command)
        {
            if (InvokeRequired)
            {
                Invoke(new Action<DuelRequest>(HandleDuelRequest), command);
                return;
            }

            if (Program.Config.RefuseDuelRequests || IgnoreList.Items.Contains(command.username.ToLower()))
            {
                Program.ChatServer.SendPacket(DevServerPackets.RefuseDuel);
                return;
            }

            RoomInfos info = RoomInfos.FromName(command.duelformatstring);
            var request = new DuelRequestFrm(
                command.username
                + Program.LanguageManager.Translation.DuelReqestMessage
                + Environment.NewLine
                + Program.LanguageManager.Translation.DuelRequestMode
                + RoomInfos.GameMode(info.mode)
                + Program.LanguageManager.Translation.DuelRequestRules
                + RoomInfos.GameRule(info.rule)
                + Program.LanguageManager.Translation.DuelRequestBanlist
                + LauncherHelper.GetBanListFromInt(info.banListType));

            if (request.ShowDialog() == DialogResult.Yes)
            {
                WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "You accepted " + command.username + " duel request."));
                Program.ChatServer.SendPacket(DevServerPackets.AcceptDuel);
            }
            else
            {
                WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "You refused " + command.username + " duel request."));
                Program.ChatServer.SendPacket(DevServerPackets.RefuseDuel);
            }
        }
        public void OnMatchFound(string matchnumber)
        {
            var form = new DuelRequestFrm(
            "Found a Match, are you ready?",true);

            if (Program.Config.EnableLauncherSound)
            {
                try
                {
                    System.Media.SoundPlayer simpleSound = new System.Media.SoundPlayer(@"Sound\matchfound.wav");
                    simpleSound.Play();
                }
                catch
                {
                    //ignore
                }
            }

            if (form.ShowDialog() == DialogResult.Yes)
            {
               Program.ChatServer.SendPacket(DevServerPackets.AcceptMatch,matchnumber);
            }
            else
            {
               Program.ChatServer.SendPacket(DevServerPackets.RefuseMatch,matchnumber);
               ResetQueue();
            }
        }
        public void OnMatchFound(string matchnumber)
        {
            var form = new DuelRequestFrm(
            "Found a Match, are you ready?",true);

            if (form.ShowDialog() == DialogResult.Yes)
            {
               Program.ChatServer.SendPacket(DevServerPackets.AcceptMatch,matchnumber);
            }
            else
            {
               Program.ChatServer.SendPacket(DevServerPackets.RefuseMatch,matchnumber);
               ResetQueue();
            }
        }