Ejemplo n.º 1
0
        public static void Join(Client pClient, MMatchChannel pChannel)
        {
            Leave(pClient);
            lock (pChannel.lClients)
                pChannel.lClients.Add(pClient);

            pClient.mPlace = MMatchPlace.Lobby;
            pClient.mChannel = pChannel;

            PacketWriter pPacket = new PacketWriter(Operation.ChannelResponseJoin, CryptFlags.Encrypt);
            pPacket.Write(pChannel.uidChannel);
            pPacket.Write((Int32)pChannel.nChannelType);
            pPacket.Write(pChannel.szName);
            pPacket.Write(true);
            pClient.Send(pPacket);

            pPacket = new PacketWriter(Operation.MatchResponseRuleset, CryptFlags.Encrypt);
            pPacket.Write(pChannel.uidChannel);
            pPacket.Write(pChannel.nChannelRule.ToString().ToLower());
            pClient.Send(pPacket);

            foreach (Client c in pChannel.lClients)
            {
                PlayerList(c);
            }
        }
Ejemplo n.º 2
0
 public static void ProcessLiveCheck(Client pClient, PacketReader pPacket)
 {
     var timeStamp = pPacket.ReadInt32();
     PacketWriter pResponseLiveCheck = new PacketWriter(Operation.MatchAgentResponseLiveCheck, CryptFlags.Encrypt);
     pResponseLiveCheck.Write(timeStamp);
     pClient.Send(pResponseLiveCheck);
 }
Ejemplo n.º 3
0
        public static void ProcessBuyItem(Client pClient, PacketReader pPacket)
        {
            var uid = pPacket.ReadUInt64();
            var itemid = pPacket.ReadInt32();
            Item item = null;
            var result = Results.Accepted;

            item = Program.mItems.Find(i => i.nItemID == itemid);
            if (item == null)
                result = Results.ShopItemNonExistant;
            else if (item.nPrice > pClient.mCharacter.nBP)
                result = Results.ShopInsufficientBounty;
            else
            {
                Item temp = new Item();
                temp.nItemID = item.nItemID;
                temp.nLevel = item.nLevel;
                temp.nMaxWT = item.nMaxWT;
                temp.nWeight = item.nWeight;
                temp.nPrice = item.nPrice;
                Database.Execute(string.Format("INSERT INTO CharacterItem (CID,ItemID,RegDate) VALUES ({0},{1},GetDate())", pClient.mCharacter.nCID, item.nItemID));
                temp.nItemCID = Database.GetIdentity(string.Format("select @@identity"));
                pClient.mCharacter.nItems.Add(temp);

                pClient.mCharacter.nBP -= item.nPrice;
                Database.Execute(string.Format("UPDATE Character SET BP={0} WHERE CID={1}", pClient.mCharacter.nBP, pClient.mCharacter.nCID));
            }

            PacketWriter pResponseBuyItem = new PacketWriter(Operation.MatchResponseBuyItem, CryptFlags.Decrypt);
            pResponseBuyItem.Write((Int32)result);
            pClient.Send(pResponseBuyItem);
        }
Ejemplo n.º 4
0
        public static void ProcessGameTimeSync(Client client, PacketReader pPacket)
        {
            var nTime = pPacket.ReadInt32();

            PacketWriter packet = new PacketWriter(Operation.GameResponseTimeSync, CryptFlags.Encrypt);
            packet.Write(nTime);
            packet.Write(Program.timeGetTime());
            client.Send(packet);
        }
Ejemplo n.º 5
0
        public static void ProcessCharacters(Client pClient, PacketReader pPacket)
        {
            pClient.UnloadCharacter();

            PacketWriter pResponseChars = new PacketWriter(Operation.MatchResponseAccountCharList, CryptFlags.Encrypt);
            var charCount = Database.GetQuery(string.Format("SELECT COUNT(*) FROM Character WHERE AID={0}", pClient.mAccount.nAID));
            pResponseChars.Write(charCount, 34);
            Database.GetCharacterList(pClient.mAccount.nAID, pResponseChars);
            pClient.Send(pResponseChars);
        }
Ejemplo n.º 6
0
        public static void ProcessCharInfo(Client pClient, PacketReader pReader)
        {
            var index = pReader.ReadByte();

            if (index < 0 || index > 4)
            {
                pClient.Disconnect();
                return;
            }

            pClient.mCharacter.nCharNum = index;
            Database.GetCharacter(pClient.mAccount.nAID, index, pClient.mCharacter);
            pClient.mCharacter.nUGradeID = pClient.mAccount.nUGradeID;

            PacketWriter pCharInfoResponse = new PacketWriter(Operation.MatchResponseAccountCharInfo, CryptFlags.Encrypt);
            pCharInfoResponse.Write(index);
            pCharInfoResponse.Write(pClient.mCharacter);
            pClient.Send(pCharInfoResponse);
        }
Ejemplo n.º 7
0
        public static void ProcessBattleInfo(Client pClient, PacketReader pPacket)
        {
            MMatchStage stage = pClient.mStage;
            PacketWriter packet = new PacketWriter(Operation.BattleResponseInfo, CryptFlags.Encrypt);

            packet.Write(stage.uidStage);
            packet.Write(1,6);
            packet.Write(stage.nRedTeamScore);
            packet.Write(stage.nBlueTeamScore);
            packet.Write((Int32)0);
            packet.Write(0, 0);
            packet.Write(stage.Clients.Count, 17);
            foreach (Client c in stage.Clients)
            {
                packet.Write(c.mClientUID);
                packet.Write(c.mGame.Spawned);
                packet.Write(c.mGame.Kills);
                packet.Write(c.mGame.Deaths);
            }
            pClient.Send(packet);
            stage.BattleMgr.GameInfoCallback(pClient);
        }
Ejemplo n.º 8
0
        public static void Leave(Client pClient)
        {
            if (pClient.mChannel == null)
                return;

            lock (pClient.mChannel.lClients)
                pClient.mChannel.lClients.Remove(pClient);

            PacketWriter pChannelLeave = new PacketWriter(Operation.ChannelLeave, CryptFlags.Encrypt);
            pChannelLeave.Write(pClient.mClientUID);
            pChannelLeave.Write(pClient.mChannel.uidChannel);
            pClient.Send(pChannelLeave);

            foreach (Client c in pClient.mChannel.lClients)
                PlayerList(c);

            if (pClient.mChannel.lClients.Count == 0 && (pClient.mChannel.nChannelType == MMatchChannelType.Private || pClient.mChannel.nChannelType == MMatchChannelType.Clan))
                lock (Program.mChannels)
                    Program.mChannels.Remove(pClient.mChannel);

            pClient.mChannel = null;
        }
Ejemplo n.º 9
0
        public static void ProcessTakeOffItem(Client pClient, PacketReader pPacket)
        {
            var uidChar = pPacket.ReadUInt64();
            var nItemSlot = pPacket.ReadInt32();

            if (!Enum.IsDefined(typeof(MMatchItemSlotType), nItemSlot))
            {
                pClient.Disconnect();
                return;
            }
            pClient.mCharacter.nEquippedItems[nItemSlot].nItemCID = 0;
            pClient.mCharacter.nEquippedItems[nItemSlot].nItemID = 0;
            Database.Execute(string.Format("UPDATE Character SET {0}={1} WHERE CID={2}", (MMatchItemSlotType)nItemSlot, 0, pClient.mCharacter.nCID));

            PacketWriter pResponseTakeOffItem = new PacketWriter(Operation.MatchResponseTakeOffItem, CryptFlags.Decrypt);
            pResponseTakeOffItem.Write((Int32)0);
            pClient.Send(pResponseTakeOffItem);

            ProcessCharItemList(pClient, null);
        }
Ejemplo n.º 10
0
        public static void ResponseChannelList(Client pClient, PacketReader pPacket)
        {
            var uid = pPacket.ReadUInt64();
            var type = pPacket.ReadInt32();

            if (!Enum.IsDefined(typeof(MMatchChannelType), (byte)type))
            {
                pClient.Disconnect();
                return;
            }

            List<MMatchChannel> channels = Program.mChannels.FindAll (c => c.nChannelType == (MMatchChannelType)type);
            if (channels == null || channels.Count == 0)
                return;

            PacketWriter pChannelList = new PacketWriter(Operation.ChannelList, CryptFlags.Encrypt);
            pChannelList.Write(channels.Count, 88);
            Int16 index = 0;

            foreach (MMatchChannel c in channels)
            {
                pChannelList.Write(c.uidChannel);
                pChannelList.Write(++index);
                pChannelList.Write((Int16)c.lClients.Count);
                pChannelList.Write((Int16)c.nMaxUsers);
                pChannelList.Write((Int16)c.nMinLevel);
                pChannelList.Write((Int16)c.nMaxLevel);
                pChannelList.Write((byte)c.nChannelType);
                pChannelList.Write(c.szName, 64);
                pChannelList.Write(false);
                pChannelList.Write((Int32)0);
            }
            pClient.Send(pChannelList);
        }
Ejemplo n.º 11
0
        public static void PlayerList(Client pClient)
        {
            PacketWriter pResonsePlayerList = new PacketWriter(Operation.ChannelResponsePlayerList, CryptFlags.Encrypt);
            List<Client> clients;

            var pages = Convert.ToByte(pClient.mChannel.lClients.Count / 6);
            var page = Math.Min(pClient.mChannelPage, pages);
            var start = page * 6;
            var count = Math.Min(pClient.mChannel.lClients.Count - start, 6);

            pResonsePlayerList.Write((byte)pClient.mChannel.lClients.Count);
            pResonsePlayerList.Write((byte)page);
            pResonsePlayerList.Write(count, 71);
            clients = pClient.mChannel.lClients.GetRange(start, count);

            foreach (Client c in clients)
            {
                pResonsePlayerList.Write(c.mClientUID);
                pResonsePlayerList.Write(c.mCharacter.szName, 32);
                pResonsePlayerList.Write(c.mCharacter.szClanName, 16);
                pResonsePlayerList.Write((byte)c.mCharacter.nLevel);
                pResonsePlayerList.Write((Int32)c.mPlace);
                pResonsePlayerList.Write((byte)c.mAccount.nUGradeID);
                pResonsePlayerList.Write((byte)2);
                pResonsePlayerList.Write(c.mCharacter.nCLID);
                pResonsePlayerList.Write((Int32)0);
            }
            pClient.Send(pResonsePlayerList);
        }
Ejemplo n.º 12
0
        public static void ProcessDeleteChar(Client pClient, PacketReader pPacket)
        {
            var uid = pPacket.ReadUInt64();
            var index = pPacket.ReadInt32();
            var name = pPacket.ReadString();
            var result = Results.Accepted;

            if (uid != pClient.mClientUID || !Program.mRegex.IsMatch(name) || index < 0 || index > 4)
            {
                pClient.Disconnect();
                return;
            }

            var cid = Database.GetQuery(string.Format("SELECT CID FROM Character WHERE CharNum={0} AND AID={1}", index, pClient.mAccount.nAID));
            if (cid == 0) result = Results.CharacterDeleteDisabled;
            else
            {
                Database.Execute("DELETE FROM CharacterItem WHERE CID=" + cid);
                Database.Execute("DELETE FROM Character WHERE CID=" + cid);
                Database.UpdateIndexes(pClient.mAccount.nAID);
            }

            PacketWriter pResponseDeleteChar = new PacketWriter(Operation.MatchResponseDeleteChar, CryptFlags.Encrypt);
            pResponseDeleteChar.Write((Int32)result);
            pClient.Send(pResponseDeleteChar);
        }
Ejemplo n.º 13
0
        public static void ProcessCharItemList(Client pClient, PacketReader pPacket)
        {
            PacketWriter pResponseCharItems = new PacketWriter(Operation.MatchResponseCharacterItemList, CryptFlags.Decrypt);
            pResponseCharItems.Write(pClient.mCharacter.nBP);

            pResponseCharItems.Write(12, 8);
            for (int i = 0; i < 12; ++i)
            {
                pResponseCharItems.Write((Int32)0);
                pResponseCharItems.Write(pClient.mCharacter.nEquippedItems[i].nItemCID);
            }

            pResponseCharItems.Write(pClient.mCharacter.nItems.Count, 16);
            foreach (Item i in pClient.mCharacter.nItems)
            {
                pResponseCharItems.Write((Int32)0);
                pResponseCharItems.Write(i.nItemCID);
                pResponseCharItems.Write(i.nItemID);
                pResponseCharItems.Write(i.nRentHour);
            }
            pResponseCharItems.Write(0, 12);
            pClient.Send(pResponseCharItems);
        }
Ejemplo n.º 14
0
        public static void ProcessEquipItem(Client pClient, PacketReader pPacket)
        {
            var uidChar = pPacket.ReadUInt64();
            var nItemLow = pPacket.ReadInt32();
            var nItemHigh = pPacket.ReadInt32();
            var nItemSlot = pPacket.ReadInt32();
            Results result = Results.Accepted;

            if (!Enum.IsDefined(typeof(MMatchItemSlotType), nItemSlot))
            {
                pClient.Disconnect();
                return;
            }

            Item nItem = pClient.mCharacter.nItems.Find(i => i.nItemCID == nItemHigh);
            if (nItem == null)
                result = Results.ShopItemNonExistant;
            else
            {
                pClient.mCharacter.nEquippedItems[nItemSlot].nItemCID = nItemHigh;
                pClient.mCharacter.nEquippedItems[nItemSlot].nItemID = nItem.nItemID;
                Database.Execute(string.Format("UPDATE Character SET {0}={1} WHERE CID={2}", (MMatchItemSlotType)nItemSlot, nItemHigh, pClient.mCharacter.nCID));
            }
            PacketWriter pResponseEquipItem = new PacketWriter(Operation.MatchResponseEquipItem, CryptFlags.Decrypt);
            pResponseEquipItem.Write((Int32)result);
            pClient.Send(pResponseEquipItem);

            ProcessCharItemList(pClient, pPacket);
        }
Ejemplo n.º 15
0
        public static void ProcessCreateChar(Client pClient, PacketReader pPacket)
        {
            var uid = pPacket.ReadUInt64();
            var index = pPacket.ReadInt32();
            var name = pPacket.ReadString();
            var sex = pPacket.ReadInt32();
            var hair = pPacket.ReadInt32();
            var face = pPacket.ReadInt32();
            var costume = pPacket.ReadInt32();
            var result = Results.Accepted;

            if (uid != pClient.mClientUID || index < 0 || index > 4 || sex < 0 || sex > 1)
            {
                pClient.Disconnect();
                return;
            }

            if (!Program.mRegex.IsMatch(name))
                result = Results.CharacterEnterName;
            else if (Database.GetQuery("SELECT COUNT(AID) FROM Character WHERE AID=" + pClient.mAccount.nAID) >= 4)
                result = Results.CharacterInvalidName;
            else if (Database.GetQuery("SELECT COUNT(Name) FROM Character WHERE Name='" + name + "'") > 0)
                result = Results.CharacterNameInUse;
            else if (!Database.CreateCharacter(pClient.mAccount.nAID, (byte)index, name, sex, hair, face, costume))
                result = Results.CharacterInvalidName;

            PacketWriter pResponseCreateChar = new PacketWriter(Operation.MatchResponseCreateChar, CryptFlags.Encrypt);
            pResponseCreateChar.Write((Int32)result);
            pResponseCreateChar.Write(name);
            pClient.Send(pResponseCreateChar);
        }
Ejemplo n.º 16
0
        public static void ProcessShopItemList(Client pClient, PacketReader pPacket)
        {
            PacketWriter pResponseShop = new PacketWriter(Operation.MatchResponseShopItemList, CryptFlags.Decrypt);
            pResponseShop.Write(1, 12);
            pResponseShop.WriteSkip(12);

            pResponseShop.Write(Program.mShop.Count, 4);
            foreach (uint item in Program.mShop)
                pResponseShop.Write(item);

            pClient.Send(pResponseShop);
        }
Ejemplo n.º 17
0
        public static void ProcessSellItem(Client pClient, PacketReader pPacket)
        {
            var uidChar = pPacket.ReadUInt64();
            var low = pPacket.ReadInt32();
            var high = pPacket.ReadInt32();
            var result = Results.Accepted;

            var item = pClient.mCharacter.nItems.Find (i => i.nItemCID == high);
            if (item == null)
                result = Results.ShopItemNonExistant;
            else
            {
                Database.Execute(string.Format("DELETE FROM CharacterItem WHERE CIID={0}", item.nItemCID));
                pClient.mCharacter.nBP += item.nPrice;
                Database.Execute(string.Format("UPDATE Character SET BP={0} WHERE CID={1}", pClient.mCharacter.nBP, pClient.mCharacter.nCID));
                pClient.mCharacter.nItems.Remove(item);
            }

            PacketWriter pResponseSellItem = new PacketWriter(Operation.MatchResponseSellItem, CryptFlags.Decrypt);
            pResponseSellItem.Write((Int32)result);
            pClient.Send(pResponseSellItem);
        }
Ejemplo n.º 18
0
        public static void ProcessSelectChar(Client pClient, PacketReader pPacket)
        {
            var uid = pPacket.ReadUInt64();
            var index = pPacket.ReadInt32();

            if (uid != pClient.mClientUID || index < 0 || index > 4)
            {
                pClient.Disconnect();
                return;
            }

            PacketWriter pResponseSelectChar = new PacketWriter(Operation.MatchResponseSelectChar, CryptFlags.Encrypt);
            pResponseSelectChar.Write((Int32)0);
            pResponseSelectChar.Write(pClient.mCharacter);
            pResponseSelectChar.Write(1, 1);
            pResponseSelectChar.Write((byte)0x3E);
            pClient.Send(pResponseSelectChar);

            pClient.mClientFlags = PacketFlags.Character;
        }
Ejemplo n.º 19
0
        public static void ProcessRequestRecommendChannel(Client pClient, PacketReader pPacket)
        {
            MMatchChannel channel = null;
            channel = Program.mChannels.Find(c => c.nMaxUsers > c.lClients.Count && c.nMinLevel < pClient.mCharacter.nLevel && c.nMaxLevel > pClient.mCharacter.nLevel);
            if (channel == null)
                channel = Program.mChannels[0];

            PacketWriter pResponseRecommendChannel = new PacketWriter(Operation.MatchResponseRecommendedChannel, CryptFlags.Encrypt);
            pResponseRecommendChannel.Write(channel.uidChannel);
            pClient.Send(pResponseRecommendChannel);
        }
Ejemplo n.º 20
0
        public static void ProcessLogin(Client client, PacketReader pPacket)
        {
            /* @ARGS
             * UserID - string
             * Password - string
             * CommandVersion - int
             * Checksum - int
             * MD5 - Blob
             */

            var UserID = pPacket.ReadString();
            var Password = pPacket.ReadString();
            var CommandID = pPacket.ReadInt32();
            var Checksum = pPacket.ReadInt32();
            var totalSize = pPacket.ReadInt32();
            var blobSize = pPacket.ReadInt32();
            var count = pPacket.ReadInt32();
            Results result = Results.Accepted;

            if (blobSize > 32)
            {
                client.Disconnect();
                return;
            }

            if (!Program.mRegex.IsMatch(UserID) || !Program.mRegex.IsMatch(Password))
                result = Results.LoginIncorrectPassword;
            else
            {
                Log.Write("Login: {0} {1}", UserID, Password);
                Database.GetAccount(UserID, Password, ref client.mAccount);
                if (client.mAccount.nAID == 0)
                    result = Results.LoginIncorrectPassword;
                else if (client.mAccount.nUGradeID == MMatchUserGradeID.Banned || client.mAccount.nUGradeID == MMatchUserGradeID.Penalty)
                    result = Results.LoginBannedID;
                else if (client.mAccount.nAID > 0)
                    client.mClientFlags = PacketFlags.Login;
            }
            PacketWriter pLoginResponse = new PacketWriter(Operation.MatchLoginResponse, CryptFlags.Encrypt);
            pLoginResponse.Write((Int32)result);
            pLoginResponse.Write("Lol Emu Test");
            pLoginResponse.Write((byte)2);//Moode
            pLoginResponse.Write(UserID);
            pLoginResponse.Write((byte)client.mAccount.nUGradeID);
            pLoginResponse.Write((byte)client.mAccount.nPGradeID);
            pLoginResponse.Write(client.mClientUID);
            pLoginResponse.Write(false);
            pLoginResponse.Write(1, 20);
            pLoginResponse.WriteSkip(20);
            client.Send(pLoginResponse);

            if (client.mAccount.nUGradeID == MMatchUserGradeID.Banned || client.mAccount.nUGradeID == MMatchUserGradeID.Penalty)
                client. Disconnect();
        }
Ejemplo n.º 21
0
        public static void Join(Client pClient, MMatchStage pStage)
        {
            if (pStage.Clients.Count < pStage.nMaxPlayers)
            {
                pClient.mPlace = MMatchPlace.Stage;
                pClient.mStage = pStage;
                pClient.mClientFlags = PacketFlags.Stage;

                lock (pStage.Clients)
                    pStage.Clients.Add(pClient);

                PacketWriter pPacket = new PacketWriter(Operation.StageJoin, CryptFlags.Encrypt);
                pPacket.Write(pClient.mClientUID);
                pPacket.Write(pStage.uidStage);
                pPacket.Write(Convert.ToInt32(pClient.mChannel.lStages.IndexOf(pStage) + 1));
                pPacket.Write(pStage.szName);

                foreach (Client c in pStage.Clients)
                    c.Send(pPacket);

                pPacket = new PacketWriter(Operation.MatchObjectCache, CryptFlags.Encrypt);
                pPacket.Write((byte)ObjectCache.Expire);
                pPacket.Write(pStage.Clients.Count, 152);
                foreach (Client c in pStage.Clients)
                {
                    pPacket.Write((Int32)0);
                    pPacket.Write(c.mClientUID);
                    pPacket.Write(c.mCharacter.szName, 32);
                    pPacket.Write(c.mCharacter.szClanName, 16);
                    pPacket.Write((Int32)c.mCharacter.nLevel);
                    pPacket.Write((Int32)c.mAccount.nUGradeID);
                    pPacket.Write((Int32)0);
                    pPacket.Write((Int32)0);
                    pPacket.Write((Int32)0);//CLID
                    pPacket.Write((Int32)0);//Emblem
                    pPacket.Write((Int32)c.mCharacter.nSex);
                    pPacket.Write((byte)c.mCharacter.nHair);
                    pPacket.Write((byte)c.mCharacter.nFace);
                    pPacket.Write((Int16)0);
                    foreach (Item i in c.mCharacter.nEquippedItems)
                        pPacket.Write(i.nItemID);
                    pPacket.Write((Int32)1);
                    pPacket.Write((Int32)5);
                    pPacket.Write((Int32)25);
                }
                pClient.Send(pPacket);
                UpdateStageCache(pStage, pClient, ObjectCache.Keep);
                UpdateMaster(pStage);
            }

            StageList(pClient);
        }
Ejemplo n.º 22
0
        public void GameEnterCalback(Client client)
        {
            PacketWriter packet = new PacketWriter(Operation.StageEnterBattle, CryptFlags.Encrypt);

            if (client.mStage.nStageState == MMatachStageState.Standby)
                packet.Write((byte)0);
            else
                packet.Write((byte)1);

            packet.Write(1, 166);
            packet.Write(client.mClientUID);

            if (client.mPeerEnd == null)
            {
                packet.Write(new byte[4], 0, 4);
                packet.Write((Int32)0);
            }
            else
            {
                packet.Write(client.mPeerEnd.Address.GetAddressBytes(), 0, 4);
                packet.Write(client.mPeerEnd.Port);
            }

            packet.Write(client.mCharacter.szName, 32);
            packet.Write(client.mCharacter.szClanName, 16);
            packet.Write((Int32)0);//clan rank
            packet.Write((Int16)0);//clan points
            packet.Write((byte)0);//?
            packet.Write((Int16)client.mCharacter.nLevel);
            packet.Write((byte)client.mCharacter.nSex);
            packet.Write((byte)client.mCharacter.nHair);
            packet.Write((byte)client.mCharacter.nFace);
            packet.Write(client.mCharacter.nXP);
            packet.Write(client.mCharacter.nBP);
            packet.Write(client.mCharacter.fBonusRate);
            packet.Write(client.mCharacter.nPrize);
            packet.Write(client.mCharacter.nHP);
            packet.Write(client.mCharacter.nAP);
            packet.Write(client.mCharacter.nMaxWeight);
            packet.Write(client.mCharacter.nSafeFalls);
            packet.Write(client.mCharacter.nFR);
            packet.Write(client.mCharacter.nCR);
            packet.Write(client.mCharacter.nER);
            packet.Write(client.mCharacter.nWR);
            foreach (Item nItem in client.mCharacter.nEquippedItems)
                packet.Write(nItem.nItemID);
            packet.Write((Int32)client.mAccount.nUGradeID);
            packet.Write((Int32)0);//clan id
            packet.Write((byte)client.mTeam);
            packet.Write((byte)0);
            packet.Write((Int16)0);
            foreach (Client c in client.mStage.Clients)
            {
                c.Send(packet);
            }

            client.mGame.InGame = true;
            packet = new PacketWriter(Operation.StageRoundState, CryptFlags.Encrypt);
            packet.Write(client.mStage.uidStage);
            packet.Write((Int32)client.mStage.nRounds);
            packet.Write((Int32)client.mStage.nRoundState);
            packet.Write((Int32)0);
            client.Send(packet);

            ProcessBattleState(client);
        }