public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            //if (client.Player.CurrentGame != null)
            //{
            //    client.Player.CurrentGame.RemovePlayer(client.Player);
            //}
            //if(client.Player.CurrentMarryRoom != null)
            //{
            //    client.Player.CurrentMarryRoom.RemovePlayer(client.Player);
            //}

            MarryRoom room = null;
            string    msg  = "";

            int    id      = packet.ReadInt();
            string pwd     = packet.ReadString();
            int    sceneID = packet.ReadInt();

            if (id != 0)
            {
                room = MarryRoomMgr.GetMarryRoombyID(id, pwd == null ? "" : pwd, ref msg);
            }
            else
            {
                if (client.Player.PlayerCharacter.IsCreatedMarryRoom)
                {
                    MarryRoom[] rooms = MarryRoomMgr.GetAllMarryRoom();

                    foreach (MarryRoom r in rooms)
                    {
                        if (r.Info.GroomID == client.Player.PlayerCharacter.ID || r.Info.BrideID == client.Player.PlayerCharacter.ID)
                        {
                            room = r;
                            break;
                        }
                    }
                }

                if (room == null && client.Player.PlayerCharacter.SelfMarryRoomID != 0)
                {
                    client.Player.Out.SendMarryRoomLogin(client.Player, false);
                    MarryRoomInfo info = null;
                    using (PlayerBussiness db = new PlayerBussiness())
                    {
                        info = db.GetMarryRoomInfoSingle(client.Player.PlayerCharacter.SelfMarryRoomID);
                    }

                    if (info != null)
                    {
                        client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryRoomLoginHandler.RoomExist", info.ServerID, client.Player.PlayerCharacter.SelfMarryRoomID));
                        return(0);
                    }
                }
            }

            if (room != null)
            {
                if (room.CheckUserForbid(client.Player.PlayerCharacter.ID))
                {
                    client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("MarryRoomLoginHandler.Forbid"));
                    client.Player.Out.SendMarryRoomLogin(client.Player, false);
                    return(1);
                }

                if (room.RoomState == eRoomState.FREE)
                {
                    if (room.AddPlayer(client.Player))
                    {
                        client.Player.MarryMap = sceneID;

                        GSPacketIn pkg = client.Player.Out.SendMarryRoomLogin(client.Player, true);

                        room.SendMarryRoomInfoUpdateToScenePlayers(room);

                        return(0);
                    }
                }
                else
                {
                    client.Player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("MarryRoomLoginHandler.AlreadyBegin"));
                }

                client.Player.Out.SendMarryRoomLogin(client.Player, false);
            }
            else
            {
                client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation(string.IsNullOrEmpty(msg) ? "MarryRoomLoginHandler.Failed" : msg));
                client.Player.Out.SendMarryRoomLogin(client.Player, false);
            }

            return(1);
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            MarryRoom marryRoom = null;
            string    text      = "";
            int       num       = packet.ReadInt();
            string    text2     = packet.ReadString();
            int       marryMap  = packet.ReadInt();

            if (num != 0)
            {
                marryRoom = MarryRoomMgr.GetMarryRoombyID(num, (text2 == null) ? "" : text2, ref text);
            }
            else
            {
                if (client.Player.PlayerCharacter.IsCreatedMarryRoom)
                {
                    MarryRoom[] allMarryRoom = MarryRoomMgr.GetAllMarryRoom();
                    MarryRoom[] array        = allMarryRoom;
                    for (int i = 0; i < array.Length; i++)
                    {
                        MarryRoom marryRoom2 = array[i];
                        if (marryRoom2.Info.GroomID == client.Player.PlayerCharacter.ID || marryRoom2.Info.BrideID == client.Player.PlayerCharacter.ID)
                        {
                            marryRoom = marryRoom2;
                            break;
                        }
                    }
                }
                if (marryRoom == null && client.Player.PlayerCharacter.SelfMarryRoomID != 0)
                {
                    client.Player.Out.SendMarryRoomLogin(client.Player, false);
                    MarryRoomInfo marryRoomInfo = null;
                    using (PlayerBussiness playerBussiness = new PlayerBussiness())
                    {
                        marryRoomInfo = playerBussiness.GetMarryRoomInfoSingle(client.Player.PlayerCharacter.SelfMarryRoomID);
                    }
                    if (marryRoomInfo != null)
                    {
                        client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryRoomLoginHandler.RoomExist", new object[]
                        {
                            marryRoomInfo.ServerID,
                            client.Player.PlayerCharacter.SelfMarryRoomID
                        }));
                        return(0);
                    }
                }
            }
            if (marryRoom != null)
            {
                if (marryRoom.CheckUserForbid(client.Player.PlayerCharacter.ID))
                {
                    client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("MarryRoomLoginHandler.Forbid", new object[0]));
                    client.Player.Out.SendMarryRoomLogin(client.Player, false);
                    return(1);
                }
                if (marryRoom.RoomState == eRoomState.FREE)
                {
                    if (marryRoom.AddPlayer(client.Player))
                    {
                        client.Player.MarryMap = marryMap;
                        client.Player.Out.SendMarryRoomLogin(client.Player, true);
                        marryRoom.SendMarryRoomInfoUpdateToScenePlayers(marryRoom);
                        return(0);
                    }
                }
                else
                {
                    client.Player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("MarryRoomLoginHandler.AlreadyBegin", new object[0]));
                }
                client.Player.Out.SendMarryRoomLogin(client.Player, false);
            }
            else
            {
                client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation(string.IsNullOrEmpty(text) ? "MarryRoomLoginHandler.Failed" : text, new object[0]));
                client.Player.Out.SendMarryRoomLogin(client.Player, false);
            }
            return(1);
        }
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            MarryRoom room    = null;
            string    msg     = "";
            int       id      = packet.ReadInt();
            string    pwd     = packet.ReadString();
            int       sceneID = packet.ReadInt();
            int       result;

            if (id != 0)
            {
                room = MarryRoomMgr.GetMarryRoombyID(id, (pwd == null) ? "" : pwd, ref msg);
            }
            else
            {
                if (player.PlayerCharacter.IsCreatedMarryRoom)
                {
                    MarryRoom[] rooms = MarryRoomMgr.GetAllMarryRoom();
                    MarryRoom[] array = rooms;
                    for (int i = 0; i < array.Length; i++)
                    {
                        MarryRoom r = array[i];
                        if (r.Info.GroomID == player.PlayerCharacter.ID || r.Info.BrideID == player.PlayerCharacter.ID)
                        {
                            room = r;
                            break;
                        }
                    }
                }
                if (room == null && player.PlayerCharacter.SelfMarryRoomID != 0)
                {
                    player.Out.SendMarryRoomLogin(player, false);
                    MarryRoomInfo info = null;
                    using (PlayerBussiness db = new PlayerBussiness())
                    {
                        info = db.GetMarryRoomInfoSingle(player.PlayerCharacter.SelfMarryRoomID);
                    }
                    if (info != null)
                    {
                        player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryRoomLoginHandler.RoomExist", new object[]
                        {
                            info.ServerID,
                            player.PlayerCharacter.SelfMarryRoomID
                        }));
                        result = 0;
                        return(result);
                    }
                }
            }
            if (room != null)
            {
                if (room.CheckUserForbid(player.PlayerCharacter.ID))
                {
                    player.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("MarryRoomLoginHandler.Forbid", new object[0]));
                    player.Out.SendMarryRoomLogin(player, false);
                    result = 1;
                    return(result);
                }
                if (room.RoomState == eRoomState.FREE)
                {
                    if (room.AddPlayer(player))
                    {
                        player.MarryMap = sceneID;
                        GSPacketIn pkg = player.Out.SendMarryRoomLogin(player, true);
                        room.SendMarryRoomInfoUpdateToScenePlayers(room);
                        result = 0;
                        return(result);
                    }
                }
                else
                {
                    player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("MarryRoomLoginHandler.AlreadyBegin", new object[0]));
                }
                player.Out.SendMarryRoomLogin(player, false);
            }
            else
            {
                player.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation(string.IsNullOrEmpty(msg) ? "MarryRoomLoginHandler.Failed" : msg, new object[0]));
                player.Out.SendMarryRoomLogin(player, false);
            }
            result = 1;
            return(result);
        }