Esempio n. 1
0
        public static RoomInfos FromName(string roomName)
        {
            RoomInfos infos = new RoomInfos();

            if (roomName.Length < 15) return null;

            string rules = roomName.Substring(0, 6);

            infos.rule = int.Parse(rules[0].ToString());
            infos.mode = int.Parse(rules[1].ToString());
            infos.timer = int.Parse(rules[2].ToString());
            infos.enablePriority = rules[3] == 'T' || rules[3] == '1';
            infos.isNoCheckDeck = rules[4] == 'T' || rules[4] == '1';
            infos.isNoShuffleDeck = rules[5] == 'T' || rules[5] == '1';

            string data = roomName.Substring(6, roomName.Length - 6);

            if (!data.Contains(",")) return null;

            string[] list = data.Split(',');

            infos.startLp = int.Parse(list[0]);
            infos.banListType = int.Parse(list[1]);
            infos.startHand = int.Parse(list[2]);
            infos.drawCount = int.Parse(list[3]);

            if (list[4] == "RL" || list[4] == "UL")
                infos.isLocked = true;

            if (list[4] == "R" || list[4] == "RL")
                infos.isRanked = true;
            else
                infos.isRanked = false;

            if(infos.isRanked)
            {
                //dont allow prerelease cards in ranked
                infos.rule %= 4;
                infos.banListType = infos.rule == 0 ? 1 : 0;
            }

            infos.roomName = (list[5] == "" ? GenerateroomName() : list[5]);

            if (infos.rule >= 4) infos.isPreReleaseMode = true;

            if (infos.enablePriority || infos.isNoCheckDeck || infos.isNoShuffleDeck ||
                (infos.mode == 2) ? infos.startLp != 16000 : infos.startLp != 8000 || infos.startHand != 5 || infos.drawCount != 1)
                infos.isIllegal = true;
            else
                infos.isIllegal = false;

            infos.server = Program.Config.ServerName;

            return infos;
        }
Esempio n. 2
0
 public static bool CompareRoomInfo(RoomInfos playerinfo, RoomInfos otherroom)
 {
     if (playerinfo.rule == otherroom.rule && playerinfo.banListType == otherroom.banListType &&
         playerinfo.mode == otherroom.mode && playerinfo.isNoCheckDeck == otherroom.isNoCheckDeck &&
         playerinfo.isNoShuffleDeck == otherroom.isNoShuffleDeck && playerinfo.enablePriority == otherroom.enablePriority &&
         playerinfo.startLp == otherroom.startLp && playerinfo.timer == otherroom.timer && otherroom.hasStarted == false && otherroom.isLocked == false)
     {
         string[] players = otherroom.playerList;
         if (GameMode(otherroom.mode) == "Tag")
         {
             if (players.Length < 4)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             if (players.Length < 2)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }
     else
     {
         return(false);
     }
 }
Esempio n. 3
0
 public void OnRoomCreate(RoomInfos room)
 {
     if (!m_rooms.ContainsKey(room.GetRoomName()))
     {
         Invoke(new Action<RoomInfos>(InternalRoomCreated), room);
     }
 }
Esempio n. 4
0
 private void InternalRoomCreated(RoomInfos room)
 {
     string roomname = room.GetRoomName();
     if (m_rooms.ContainsKey(roomname))
         return;
     m_rooms.Add(roomname, room);
     ListBox rooms = (room.isRanked ? RankedList : UnrankedList);
     
     rooms.Items.Add(roomname);
 }
Esempio n. 5
0
 public void OnRoomCreated(RoomInfos[] room)
 {
     Invoke(new Action<RoomInfos>(InternalRoomCreated), room[0]);
 }
Esempio n. 6
0
 private void InternalRoomsList(RoomInfos[] rooms)
 {
     m_rooms.Clear();
     UnrankedList.Items.Clear();
     RankedList.Items.Clear();
     foreach (RoomInfos room in rooms)
     {
         InternalRoomCreated(room);
     }
     UpdateLabel.Text = Program.LanguageManager.Translation.GameUpdating1 + 60 + Program.LanguageManager.Translation.GameUpdating2;
     GameListUpdateTimer.Enabled = true;
 }
Esempio n. 7
0
 public void OnRoomsList(RoomInfos[] rooms)
 {
     Invoke(new Action<RoomInfos[]>(InternalRoomsList), new object[] { rooms });
 }
Esempio n. 8
0
 public static bool CompareRoomInfo(RoomInfos playerinfo,RoomInfos otherroom)
 {
     if (playerinfo.rule == otherroom.rule && playerinfo.banListType == otherroom.banListType
         && playerinfo.mode == otherroom.mode && playerinfo.isNoCheckDeck == otherroom.isNoCheckDeck
         && playerinfo.isNoShuffleDeck == otherroom.isNoShuffleDeck && playerinfo.enablePriority == otherroom.enablePriority
         && playerinfo.startLp == otherroom.startLp && playerinfo.timer == otherroom.timer && otherroom.hasStarted == false && otherroom.isLocked == false)
     {
         string[] players = otherroom.playerList;
         if (GameMode(otherroom.mode) == "Tag")
         {
             if (players.Length < 4)
                 return true;
             return false;
         }
         if (players.Length < 2)
             return true;
         return false;
     }
     return false;
 }
Esempio n. 9
0
        public static RoomInfos FromName(string roomName)
        {
            RoomInfos infos = new RoomInfos();

            if (roomName.Length < 15)
            {
                return(null);
            }

            string rules = roomName.Substring(0, 7);

            infos.rule            = int.Parse(rules[0].ToString());
            infos.mode            = int.Parse(rules[1].ToString());
            infos.banListType     = int.Parse(rules[2].ToString());
            infos.timer           = int.Parse(rules[3].ToString());
            infos.enablePriority  = rules[4] == 'T' || rules[4] == '1';
            infos.isNoCheckDeck   = rules[5] == 'T' || rules[5] == '1';
            infos.isNoShuffleDeck = rules[6] == 'T' || rules[6] == '1';

            string data = roomName.Substring(7, roomName.Length - 7);

            if (!data.Contains(","))
            {
                return(null);
            }

            string[] list = data.Split(',');

            infos.startLp = int.Parse(list[0]);

            infos.startHand = 5;
            infos.drawCount = 1;
            if (list[1] == "RL" || list[1] == "UL")
            {
                infos.isLocked = true;
            }

            if (list[1] == "R" || list[1] == "RL")
            {
                infos.isRanked = true;
            }
            else
            {
                infos.isRanked = false;
            }

            infos.roomName = (list[2] == "" ? GenerateroomName() : list[2]);

            if (infos.rule >= 4)
            {
                infos.isAnimemode = true;
            }

            if (infos.enablePriority || infos.isNoCheckDeck || infos.isNoShuffleDeck ||
                (infos.mode == 2) ? infos.startLp != 16000 : infos.startLp != 8000 || infos.startHand != 5 || infos.drawCount != 1)
            {
                infos.isIllegal = true;
            }

            return(infos);
        }
Esempio n. 10
0
 private void InternalRoomsList(RoomInfos[] rooms)
 {
     m_rooms.Clear();
     UnrankedList.Items.Clear();
     RankedList.Items.Clear();
     foreach (RoomInfos room in rooms)
     {
         InternalRoomCreated(room);
     }
     UpdateServerInfo();
 }
Esempio n. 11
0
        private void InternalRoomCreated(RoomInfos room)
        {
            string roomname = room.roomName;
            if (m_rooms.ContainsKey(roomname))
                return;
            m_rooms.Add(roomname, room);
            ListBox rooms = (room.isRanked ? RankedList : UnrankedList);

            if (FilterActive.Checked)
            {
                if (!m_rooms[roomname].hasStarted)
                {
                    if (m_rooms[roomname].Contains(FilterTextBox.Text.ToLower()) ||
                        m_rooms[roomname].roomName.ToLower().Contains(FilterTextBox.Text.ToLower()) ||
                        FilterTextBox.Text == "Search" || FilterTextBox.Text == "")
                    {
                        rooms.Items.Add(roomname);
                    }
                }
            }
            else
            {
                if (m_rooms[roomname].Contains(FilterTextBox.Text.ToLower()) ||
                        m_rooms[roomname].roomName.ToLower().Contains(FilterTextBox.Text.ToLower()) ||
                        FilterTextBox.Text == "Search" || FilterTextBox.Text == "")
                    {
                        rooms.Items.Add(roomname);
                    }
            }

            UpdateServerInfo();
        }
Esempio n. 12
0
        public static RoomInfos FromName(string roomName)
        {
            RoomInfos infos = new RoomInfos();

            if (roomName.Length < 15)
            {
                return(null);
            }

            string rules = roomName.Substring(0, 6);

            infos.rule            = int.Parse(rules[0].ToString());
            infos.mode            = int.Parse(rules[1].ToString());
            infos.timer           = int.Parse(rules[2].ToString());
            infos.enablePriority  = rules[3] == 'T' || rules[3] == '1';
            infos.isNoCheckDeck   = rules[4] == 'T' || rules[4] == '1';
            infos.isNoShuffleDeck = rules[5] == 'T' || rules[5] == '1';

            string data = roomName.Substring(6, roomName.Length - 6);

            if (!data.Contains(","))
            {
                return(null);
            }

            string[] list = data.Split(',');

            infos.startLp     = int.Parse(list[0]);
            infos.banListType = int.Parse(list[1]);
            infos.startHand   = int.Parse(list[2]);
            infos.drawCount   = int.Parse(list[3]);

            if (list[4] == "RL" || list[4] == "UL")
            {
                infos.isLocked = true;
            }

            if (list[4] == "R" || list[4] == "RL")
            {
                infos.isRanked = true;
            }
            else
            {
                infos.isRanked = false;
            }

            if (infos.isRanked)
            {
                //dont allow prerelease cards in ranked
                infos.rule       %= 4;
                infos.banListType = infos.rule == 0 ? 1 : 0;
            }

            infos.roomName = (list[5] == "" ? GenerateroomName() : list[5]);

            if (infos.rule >= 4)
            {
                infos.isPreReleaseMode = true;
            }

            if (infos.enablePriority || infos.isNoCheckDeck || infos.isNoShuffleDeck ||
                (infos.mode == 2) ? infos.startLp != 16000 : infos.startLp != 8000 || infos.startHand != 5 || infos.drawCount != 1)
            {
                infos.isIllegal = true;
            }
            else
            {
                infos.isIllegal = false;
            }

            infos.server = Program.Config.ServerName;

            return(infos);
        }
Esempio n. 13
0
        public static RoomInfos FromName(string roomName)
        {
            RoomInfos infos = new RoomInfos();

            if (roomName.Length < 15) return null;

            string rules = roomName.Substring(0, 7);

            infos.rule = int.Parse(rules[0].ToString());
            infos.mode = int.Parse(rules[1].ToString());
            infos.banListType = int.Parse(rules[2].ToString());
            infos.timer = int.Parse(rules[3].ToString());
            infos.enablePriority = rules[4] == 'T' || rules[4] == '1';
            infos.isNoCheckDeck = rules[5] == 'T' || rules[5] == '1';
            infos.isNoShuffleDeck = rules[6] == 'T' || rules[6] == '1';

            string data = roomName.Substring(7, roomName.Length - 7);

            if (!data.Contains(",")) return null;

            string[] list = data.Split(',');

            infos.startLp = int.Parse(list[0]);

            infos.startHand = 5;
            infos.drawCount = 1;
            if (list[1] == "RL" || list[1] == "UL")
                infos.isLocked = true;

            if (list[1] == "R" || list[1] == "RL")
            {
                infos.isRanked = true;
            }
            else
            {
                infos.isRanked = false;
            }

            infos.roomName = (list[2] == "" ? GenerateroomName() : list[2]);

            if (infos.rule >= 4) infos.isAnimemode = true;

            if (infos.enablePriority || infos.isNoCheckDeck || infos.isNoShuffleDeck ||
                (infos.mode == 2) ? infos.startLp != 16000 : infos.startLp != 8000 || infos.startHand != 5 || infos.drawCount != 1)
                infos.isIllegal = true;

            return infos;
        }
        private void InternalRoomCreated(RoomInfos room)
        {
            string roomname = room.GetRoomName();
            if (m_rooms.ContainsKey(roomname))
                return;
            m_rooms.Add(roomname, room);
            ListBox rooms = (room.isRanked ? RankedList : UnrankedList);

            //Remove DevBot games
            if (!room.playerList[0].Trim().ToLower().Equals("devbot"))
                rooms.Items.Add(roomname);
        }