public override void OnTick(MarryRoom room)
 {
     try
     {
         if (room != null)
         {
             room.KickAllPlayer();
             using (PlayerBussiness playerBussiness = new PlayerBussiness())
             {
                 playerBussiness.DisposeMarryRoomInfo(room.Info.ID);
             }
             GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(room.Info.GroomID);
             GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(room.Info.BrideID);
             GameServer.Instance.LoginServer.SendMarryRoomInfoToPlayer(room.Info.GroomID, false, room.Info);
             GameServer.Instance.LoginServer.SendMarryRoomInfoToPlayer(room.Info.BrideID, false, room.Info);
             MarryRoomMgr.RemoveMarryRoom(room);
             GSPacketIn gSPacketIn = new GSPacketIn(254);
             gSPacketIn.WriteInt(room.Info.ID);
             WorldMgr.MarryScene.SendToALL(gSPacketIn);
             room.StopTimer();
         }
     }
     catch (Exception exception)
     {
         if (TankMarryLogicProcessor.log.IsErrorEnabled)
         {
             TankMarryLogicProcessor.log.Error("OnTick", exception);
         }
     }
 }
Esempio n. 2
0
 private static void CheckRoomStatus()
 {
     using (PlayerBussiness playerBussiness = new PlayerBussiness())
     {
         MarryRoomInfo[] marryRoomInfo = playerBussiness.GetMarryRoomInfo();
         MarryRoomInfo[] array         = marryRoomInfo;
         for (int i = 0; i < array.Length; i++)
         {
             MarryRoomInfo marryRoomInfo2 = array[i];
             if (marryRoomInfo2.ServerID == GameServer.Instance.Configuration.ServerID)
             {
                 TimeSpan timeSpan = DateTime.Now - marryRoomInfo2.BeginTime;
                 int      num      = marryRoomInfo2.AvailTime * 60 - (int)timeSpan.TotalMinutes;
                 if (num > 0)
                 {
                     MarryRoomMgr.CreateMarryRoomFromDB(marryRoomInfo2, num);
                 }
                 else
                 {
                     playerBussiness.DisposeMarryRoomInfo(marryRoomInfo2.ID);
                     if (GameServer.Instance.LoginServer != null)
                     {
                         Console.WriteLine(marryRoomInfo2.Name);
                         GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(marryRoomInfo2.GroomID);
                         GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(marryRoomInfo2.BrideID);
                         GameServer.Instance.LoginServer.SendMarryRoomInfoToPlayer(marryRoomInfo2.GroomID, false, marryRoomInfo2);
                         GameServer.Instance.LoginServer.SendMarryRoomInfoToPlayer(marryRoomInfo2.BrideID, false, marryRoomInfo2);
                     }
                 }
             }
         }
     }
 }
Esempio n. 3
0
 private static void CheckRoomStatus()
 {
     using (PlayerBussiness db = new PlayerBussiness())
     {
         MarryRoomInfo[] roomInfos = db.GetMarryRoomInfo();
         MarryRoomInfo[] array     = roomInfos;
         for (int i = 0; i < array.Length; i++)
         {
             MarryRoomInfo roomInfo = array[i];
             if (roomInfo.ServerID == GameServer.Instance.Config.ServerID)
             {
                 TimeSpan usedTime = DateTime.Now - roomInfo.BeginTime;
                 int      timeLeft = roomInfo.AvailTime * 60 - (int)usedTime.TotalMinutes;
                 if (timeLeft > 0)
                 {
                     MarryRoomMgr.CreateMarryRoomFromDB(roomInfo, timeLeft);
                 }
                 else
                 {
                     db.DisposeMarryRoomInfo(roomInfo.ID);
                     GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(roomInfo.GroomID);
                     GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(roomInfo.BrideID);
                     GameServer.Instance.LoginServer.SendMarryRoomInfoToPlayer(roomInfo.GroomID, false, roomInfo);
                     GameServer.Instance.LoginServer.SendMarryRoomInfoToPlayer(roomInfo.BrideID, false, roomInfo);
                 }
             }
         }
     }
 }
Esempio n. 4
0
        private static void CheckRoomStatus()
        {
            using (PlayerBussiness db = new PlayerBussiness())
            {
                MarryRoomInfo[] roomInfos = db.GetMarryRoomInfo();

                foreach (MarryRoomInfo roomInfo in roomInfos)
                {
                    //TimeSpan usedTime = roomInfo.BreakTime - roomInfo.BeginTime;
                    //int timeLeft = roomInfo.AvailTime - usedTime.Hours;

                    if (roomInfo.ServerID != GameServer.Instance.Configuration.ServerID)
                    {
                        continue;
                    }

                    TimeSpan usedTime = DateTime.Now - roomInfo.BeginTime;
                    int      timeLeft = roomInfo.AvailTime * 60 - (int)usedTime.TotalMinutes;

                    if (timeLeft > 0)
                    {
                        //创建房间
                        CreateMarryRoomFromDB(roomInfo, timeLeft);
                    }
                    else
                    {
                        db.DisposeMarryRoomInfo(roomInfo.ID);
                        GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(roomInfo.GroomID);
                        GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(roomInfo.BrideID);

                        GameServer.Instance.LoginServer.SendMarryRoomInfoToPlayer(roomInfo.GroomID, false, roomInfo);
                        GameServer.Instance.LoginServer.SendMarryRoomInfoToPlayer(roomInfo.BrideID, false, roomInfo);
                    }
                }
            }
        }
Esempio n. 5
0
        public override void OnTick(MarryRoom room)
        {
            try
            {
                if (room != null)
                {
                    room.KickAllPlayer();

                    using (PlayerBussiness db = new PlayerBussiness())
                    {
                        db.DisposeMarryRoomInfo(room.Info.ID);
                    }

                    GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(room.Info.GroomID);
                    GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(room.Info.BrideID);

                    GameServer.Instance.LoginServer.SendMarryRoomInfoToPlayer(room.Info.GroomID, false, room.Info);
                    GameServer.Instance.LoginServer.SendMarryRoomInfoToPlayer(room.Info.BrideID, false, room.Info);

                    MarryRoomMgr.RemoveMarryRoom(room);

                    GSPacketIn pkg = new GSPacketIn((short)ePackageType.MARRY_ROOM_DISPOSE);
                    pkg.WriteInt(room.Info.ID);
                    WorldMgr.MarryScene.SendToALL(pkg);

                    room.StopTimer();
                }
            }
            catch (Exception ex)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("OnTick", ex);
                }
            }
        }
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            bool isInMovie = packet.ReadBoolean();
            int  result;

            if (!player.PlayerCharacter.IsMarried)
            {
                result = 1;
            }
            else
            {
                if (player.PlayerCharacter.HasBagPassword && player.PlayerCharacter.IsLocked)
                {
                    player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked", new object[0]));
                    result = 0;
                }
                else
                {
                    int needMoney = AppConfig.AppSettings["DivorcedMoney"].ConvertToInt(5214);
                    if (player.PlayerCharacter.Money < needMoney)
                    {
                        player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("DivorceApplyHandler.Msg1", new object[0]));
                        result = 1;
                    }
                    else
                    {
                        if (player.PlayerCharacter.IsCreatedMarryRoom)
                        {
                            using (PlayerBussiness db = new PlayerBussiness())
                            {
                                db.DisposeMarryRoomInfo(player.PlayerCharacter.SelfMarryRoomID);
                                GameServer.Instance.LoginServer.SendMarryRoomDisposeToPlayer(player.PlayerCharacter.SelfMarryRoomID);
                            }
                            MarryRoom[] rooms = MarryRoomMgr.GetAllMarryRoom();
                            MarryRoom[] array = rooms;
                            for (int i = 0; i < array.Length; i++)
                            {
                                MarryRoom room = array[i];
                                if (room.Info.GroomID == player.PlayerCharacter.ID || room.Info.BrideID == player.PlayerCharacter.ID)
                                {
                                    room.KillAllPlayer();
                                    GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(room.Info.GroomID);
                                    GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(room.Info.BrideID);
                                    GameServer.Instance.LoginServer.SendMarryRoomInfoToPlayer(room.Info.GroomID, false, room.Info);
                                    GameServer.Instance.LoginServer.SendMarryRoomInfoToPlayer(room.Info.BrideID, false, room.Info);
                                    MarryRoomMgr.RemoveMarryRoom(room);
                                    GSPacketIn pkg = new GSPacketIn(254);
                                    pkg.WriteInt(room.Info.ID);
                                    WorldMgr.MarryScene.SendToALL(pkg);
                                    room.StopTimer();
                                    if (isInMovie)
                                    {
                                        GSPacketIn pkg2 = new GSPacketIn(249);
                                        pkg2.WriteByte(9);
                                        room.SendToAll(pkg2);
                                        room.StopTimerForHymeneal();
                                        room.SendUserRemoveLate();
                                    }
                                    break;
                                }
                            }
                        }
                        player.RemoveMoney(needMoney, LogMoneyType.Marry, LogMoneyType.Marry_Unmarry);
                        CountBussiness.InsertSystemPayCount(player.PlayerCharacter.ID, needMoney, 0, 0, 3);
                        using (PlayerBussiness db = new PlayerBussiness())
                        {
                            PlayerInfo tempSpouse = db.GetUserSingleAllUserID(player.PlayerCharacter.SpouseID);
                            if (tempSpouse == null || tempSpouse.Sex == player.PlayerCharacter.Sex)
                            {
                                result = 1;
                                return(result);
                            }
                            MarryApplyInfo info = new MarryApplyInfo();
                            info.UserID           = player.PlayerCharacter.SpouseID;
                            info.ApplyUserID      = player.PlayerCharacter.ID;
                            info.ApplyUserName    = player.PlayerCharacter.NickName;
                            info.ApplyType        = 3;
                            info.LoveProclamation = "";
                            info.ApplyResult      = false;
                            int id = 0;
                            if (db.SavePlayerMarryNotice(info, 0, ref id))
                            {
                                GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(tempSpouse.ID);
                                player.LoadMarryProp();
                            }
                        }
                        player.QuestInventory.ClearMarryQuest();
                        player.Out.SendPlayerDivorceApply(player, true, true);
                        result = 0;
                    }
                }
            }
            return(result);
        }