public int HandlePacket(GameClient client, GSPacketIn packet) { bool flag = packet.ReadBoolean(); if (!client.Player.PlayerCharacter.IsMarried) { return(1); } if (client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked) { client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked", new object[0])); return(0); } if (client.Player.PlayerCharacter.IsCreatedMarryRoom) { client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("DivorceApplyHandler.Msg2", new object[0])); return(1); } int num = GameProperties.PRICE_DIVORCED; if (flag) { num = GameProperties.PRICE_DIVORCED_DISCOUNT; } if (client.Player.PlayerCharacter.Money < num) { client.Player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("DivorceApplyHandler.Msg1", new object[0])); return(1); } client.Player.RemoveMoney(num); LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_Unmarry, client.Player.PlayerCharacter.ID, num, client.Player.PlayerCharacter.Money, 0, 0, 0, 0, "", "", ""); CountBussiness.InsertSystemPayCount(client.Player.PlayerCharacter.ID, num, 0, 0, 3); using (PlayerBussiness playerBussiness = new PlayerBussiness()) { PlayerInfo userSingleByUserID = playerBussiness.GetUserSingleByUserID(client.Player.PlayerCharacter.SpouseID); if (userSingleByUserID == null || userSingleByUserID.Sex == client.Player.PlayerCharacter.Sex) { return(1); } MarryApplyInfo marryApplyInfo = new MarryApplyInfo(); marryApplyInfo.UserID = client.Player.PlayerCharacter.SpouseID; marryApplyInfo.ApplyUserID = client.Player.PlayerCharacter.ID; marryApplyInfo.ApplyUserName = client.Player.PlayerCharacter.NickName; marryApplyInfo.ApplyType = 3; marryApplyInfo.LoveProclamation = ""; marryApplyInfo.ApplyResult = false; int num2 = 0; if (playerBussiness.SavePlayerMarryNotice(marryApplyInfo, 0, ref num2)) { GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(userSingleByUserID.ID); client.Player.LoadMarryProp(); } } client.Player.QuestInventory.ClearMarryQuest(); client.Player.Out.SendPlayerDivorceApply(client.Player, true, true); client.Player.SendMessage(LanguageMgr.GetTranslation("DivorceApplyHandler.Msg3", new object[0])); return(0); }
public bool HandleCommand(TankMarryLogicProcessor process, GamePlayer player, GSPacketIn packet) { if (player.CurrentMarryRoom == null || player.CurrentMarryRoom.RoomState != eRoomState.FREE) { return(false); } if (player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.GroomID && player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.BrideID) { return(false); } int needMoney = GameProperties.PRICE_PROPOSE; if (player.CurrentMarryRoom.Info.IsHymeneal) { if (player.PlayerCharacter.Money < needMoney) { player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("UserFirecrackersCommand.MoneyNotEnough")); return(false); } } GamePlayer Groom = player.CurrentMarryRoom.GetPlayerByUserID(player.CurrentMarryRoom.Info.GroomID); if (Groom == null) { player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("HymenealCommand.NoGroom")); return(false); } GamePlayer Bride = player.CurrentMarryRoom.GetPlayerByUserID(player.CurrentMarryRoom.Info.BrideID); if (Bride == null) { player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("HymenealCommand.NoBride")); return(false); } bool result = false; bool isFirst = false; GSPacketIn pkg = packet.Clone(); int hymenealState = packet.ReadInt(); if (1 == hymenealState) { player.CurrentMarryRoom.RoomState = eRoomState.FREE; } else { player.CurrentMarryRoom.RoomState = eRoomState.Hymeneal; player.CurrentMarryRoom.BeginTimerForHymeneal(170 * 1000); if (!player.PlayerCharacter.IsGotRing) { isFirst = true; ItemTemplateInfo ringTemplate = ItemMgr.FindItemTemplate(9022); ItemInfo ring1 = ItemInfo.CreateFromTemplate(ringTemplate, 1, (int)ItemAddType.webing); ring1.IsBinds = true; //Groom.CurrentInventory.AddItem(ring1, 11); using (PlayerBussiness pb = new PlayerBussiness()) { ring1.UserID = 0; pb.AddGoods(ring1); string content = LanguageMgr.GetTranslation("HymenealCommand.Content", Bride.PlayerCharacter.NickName); MailInfo mail = new MailInfo(); mail.Annex1 = ring1.ItemID.ToString(); mail.Content = content; mail.Gold = 0; mail.IsExist = true; mail.Money = 0; mail.Receiver = Groom.PlayerCharacter.NickName; mail.ReceiverID = Groom.PlayerCharacter.ID; mail.Sender = LanguageMgr.GetTranslation("HymenealCommand.Sender"); mail.SenderID = 0; mail.Title = LanguageMgr.GetTranslation("HymenealCommand.Title"); mail.Type = (int)eMailType.Marry; if (pb.SendMail(mail)) { result = true; } player.Out.SendMailResponse(mail.ReceiverID, eMailRespose.Receiver); } ItemInfo ring2 = ItemInfo.CreateFromTemplate(ringTemplate, 1, (int)ItemAddType.webing); ring2.IsBinds = true; //Bride.CurrentInventory.AddItem(ring2, 11); using (PlayerBussiness pb = new PlayerBussiness()) { ring2.UserID = 0; pb.AddGoods(ring2); string content = LanguageMgr.GetTranslation("HymenealCommand.Content", Groom.PlayerCharacter.NickName); MailInfo mail = new MailInfo(); mail.Annex1 = ring2.ItemID.ToString(); mail.Content = content; mail.Gold = 0; mail.IsExist = true; mail.Money = 0; mail.Receiver = Bride.PlayerCharacter.NickName; mail.ReceiverID = Bride.PlayerCharacter.ID; mail.Sender = LanguageMgr.GetTranslation("HymenealCommand.Sender"); mail.SenderID = 0; mail.Title = LanguageMgr.GetTranslation("HymenealCommand.Title"); mail.Type = (int)eMailType.Marry; if (pb.SendMail(mail)) { result = true; } player.Out.SendMailResponse(mail.ReceiverID, eMailRespose.Receiver); } player.CurrentMarryRoom.Info.IsHymeneal = true; using (PlayerBussiness db = new PlayerBussiness()) { db.UpdateMarryRoomInfo(player.CurrentMarryRoom.Info); //更新IsGotRing的数据库 db.UpdatePlayerGotRingProp(Groom.PlayerCharacter.ID, Bride.PlayerCharacter.ID); //通过数据库读入PlayerCharacter内存 Groom.LoadMarryProp(); Bride.LoadMarryProp(); } //Groom.PlayerCharacter.IsGotRing = true; //Bride.PlayerCharacter.IsGotRing = true; } else { isFirst = false; result = true; } if (!isFirst) { //player.SetMoney(-needMoney, MoneyRemoveType.Marry); player.RemoveMoney(needMoney); LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_Hymeneal, player.PlayerCharacter.ID, needMoney, player.PlayerCharacter.Money, 0, 0, 0, 0, "", "", ""); CountBussiness.InsertSystemPayCount(player.PlayerCharacter.ID, needMoney, 0, (int)eConsumerType.Marry, (int)eSubConsumerType.Marry_Hymeneal); } pkg.WriteInt(player.CurrentMarryRoom.Info.ID); pkg.WriteBoolean(result); //0 player.CurrentMarryRoom.SendToAll(pkg); //0 player.CurrentMarryRoom.SendToAllForScene(pkg,1); player.CurrentMarryRoom.SendToAll(pkg); if (result) { string msg = LanguageMgr.GetTranslation("HymenealCommand.Succeed", Groom.PlayerCharacter.NickName, Bride.PlayerCharacter.NickName); GSPacketIn message = player.Out.SendMessage(eMessageType.ChatNormal, msg); player.CurrentMarryRoom.SendToPlayerExceptSelfForScene(message, player); } } return(true); }
public override int HandlePacket(GamePlayer player, GSPacketIn packet) { int result; if (player.PlayerCharacter.HasBagPassword && player.PlayerCharacter.IsLocked) { player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked", new object[0])); result = 0; } else { if (player.CurrentRoom != null) { player.CurrentRoom.RemovePlayerUnsafe(player); } if (player.CurrentSpaRoom != null) { player.CurrentSpaRoom.RemovePlayer(player); } SpaRoom[] rooms = SpaRoomMgr.GetAllSpaRoom(); if (rooms != null) { if (rooms.Count <SpaRoom>() > 2000) { result = 0; return(result); } } SpaRoomInfo info = new SpaRoomInfo(); info.RoomName = packet.ReadString().Replace(";", ""); info.Pwd = packet.ReadString(); info.RoomIntroduction = packet.ReadString(); info.MaxCount = packet.ReadInt(); info.ServerID = GameServer.Instance.Config.ServerID; info.AvailTime = SpaRoomMgr.priRoomInit_MinLimit; info.RoomType = 3; string[] array = new string[] { "1", "2" }; string[] money = "800,1600".Split(new char[] { ',' }); if (money.Length < 2) { SpaRoomCreateHandler.log.Error("SpaRoomCreateMoney node in configuration file is wrong"); result = 0; } else { int needMoney; if (info.MaxCount == 4) { needMoney = int.Parse(money[0]); } else { if (info.MaxCount == 8) { needMoney = int.Parse(money[1]); } else { needMoney = int.Parse(money[1]); info.MaxCount = 8; } } if (player.PlayerCharacter.Money >= needMoney) { SpaRoom room = SpaRoomMgr.CreateSpaRoom(player, info); if (room != null) { player.RemoveMoney(needMoney, LogMoneyType.Spa, LogMoneyType.Spa_Room_Creat); player.Out.SendSpaRoomInfo(player, room); player.Out.SendSpaRoomLogin(player); room.SendSpaRoomInfoUpdateToSpaScenePlayers(room); CountBussiness.InsertSystemPayCount(player.PlayerCharacter.ID, needMoney, 0, 3, 6); } result = 0; } else { player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("UserFirecrackersCommand.MoneyNotEnough", new object[0])); result = 1; } } } return(result); }
public int HandlePacket(GameClient client, GSPacketIn packet) { if (!client.Player.PlayerCharacter.IsMarried) { return(1); } if (client.Player.PlayerCharacter.IsCreatedMarryRoom) { //client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryRoomCreateHandler.Msg1")); return(1); } if (client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked) { client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked")); return(0); } if (client.Player.CurrentRoom != null) { client.Player.CurrentRoom.RemovePlayerUnsafe(client.Player); } if (client.Player.CurrentMarryRoom != null) { client.Player.CurrentMarryRoom.RemovePlayer(client.Player); } //GamePlayer tempPlayer = WorldMgr.GetPlayerById(client.Player.PlayerCharacter.SpouseID); //if(tempPlayer != null) //{ // if (tempPlayer.IsMarryRommCreating) // { // client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryRoomCreateHandler.IsCreating")); // return 1; // } //} //client.Player.IsMarryRommCreating = true; MarryRoomInfo info = new MarryRoomInfo(); info.Name = packet.ReadString().Replace(";", ""); info.Pwd = packet.ReadString(); info.MapIndex = packet.ReadInt(); info.AvailTime = packet.ReadInt(); info.MaxCount = packet.ReadInt(); info.GuestInvite = packet.ReadBoolean(); info.RoomIntroduction = packet.ReadString(); info.ServerID = GameServer.Instance.Configuration.ServerID; info.IsHymeneal = false; string[] money = GameProperties.PRICE_MARRY_ROOM.Split(','); if (money.Length < 3) { if (log.IsErrorEnabled) { log.Error("MarryRoomCreateMoney node in configuration file is wrong"); } return(1); } int needMoney = 0; switch (info.AvailTime) { case 2: needMoney = int.Parse(money[0]); break; case 3: needMoney = int.Parse(money[1]); break; case 4: needMoney = int.Parse(money[2]); break; default: needMoney = int.Parse(money[2]); info.AvailTime = 4; break; } if (client.Player.PlayerCharacter.Money >= needMoney) { MarryRoom room = MarryRoomMgr.CreateMarryRoom(client.Player, info); if (room != null) { client.Player.RemoveMoney(needMoney); LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_Room, client.Player.PlayerCharacter.ID, needMoney, client.Player.PlayerCharacter.Money, 0, 0, 0, 0, "", "", ""); GSPacketIn pkg = client.Player.Out.SendMarryRoomInfo(client.Player, room); client.Player.Out.SendMarryRoomLogin(client.Player, true); room.SendToScenePlayer(pkg); CountBussiness.InsertSystemPayCount(client.Player.PlayerCharacter.ID, needMoney, 0, (int)eConsumerType.Marry, (int)eSubConsumerType.Marry_MarryRoom); } return(0); } else { client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("UserFirecrackersCommand.MoneyNotEnough")); } return(1); }
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); }
public bool HandleCommand(TankMarryLogicProcessor process, GamePlayer player, GSPacketIn packet) { if (player.CurrentMarryRoom == null || player.CurrentMarryRoom.RoomState != eRoomState.FREE) { return(false); } if (player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.GroomID && player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.BrideID) { return(false); } int pRICE_PROPOSE = GameProperties.PRICE_PROPOSE; if (player.CurrentMarryRoom.Info.IsHymeneal && player.PlayerCharacter.Money < pRICE_PROPOSE) { player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("UserFirecrackersCommand.MoneyNotEnough", new object[0])); return(false); } GamePlayer playerByUserID = player.CurrentMarryRoom.GetPlayerByUserID(player.CurrentMarryRoom.Info.GroomID); if (playerByUserID == null) { player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("HymenealCommand.NoGroom", new object[0])); return(false); } GamePlayer playerByUserID2 = player.CurrentMarryRoom.GetPlayerByUserID(player.CurrentMarryRoom.Info.BrideID); if (playerByUserID2 == null) { player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("HymenealCommand.NoBride", new object[0])); return(false); } bool flag = false; bool flag2 = false; GSPacketIn gSPacketIn = packet.Clone(); int num = packet.ReadInt(); if (1 == num) { player.CurrentMarryRoom.RoomState = eRoomState.FREE; } else { player.CurrentMarryRoom.RoomState = eRoomState.Hymeneal; player.CurrentMarryRoom.BeginTimerForHymeneal(170000); if (!player.PlayerCharacter.IsGotRing) { flag2 = true; ItemTemplateInfo goods = ItemMgr.FindItemTemplate(9022); ItemInfo itemInfo = ItemInfo.CreateFromTemplate(goods, 1, 112); itemInfo.IsBinds = true; using (PlayerBussiness playerBussiness = new PlayerBussiness()) { itemInfo.UserID = 0; playerBussiness.AddGoods(itemInfo); string translation = LanguageMgr.GetTranslation("HymenealCommand.Content", new object[] { playerByUserID2.PlayerCharacter.NickName }); MailInfo mailInfo = new MailInfo(); mailInfo.Annex1 = itemInfo.ItemID.ToString(); mailInfo.Content = translation; mailInfo.Gold = 0; mailInfo.IsExist = true; mailInfo.Money = 0; mailInfo.Receiver = playerByUserID.PlayerCharacter.NickName; mailInfo.ReceiverID = playerByUserID.PlayerCharacter.ID; mailInfo.Sender = LanguageMgr.GetTranslation("HymenealCommand.Sender", new object[0]); mailInfo.SenderID = 0; mailInfo.Title = LanguageMgr.GetTranslation("HymenealCommand.Title", new object[0]); mailInfo.Type = 14; if (playerBussiness.SendMail(mailInfo)) { flag = true; } player.Out.SendMailResponse(mailInfo.ReceiverID, eMailRespose.Receiver); } ItemInfo itemInfo2 = ItemInfo.CreateFromTemplate(goods, 1, 112); itemInfo2.IsBinds = true; using (PlayerBussiness playerBussiness2 = new PlayerBussiness()) { itemInfo2.UserID = 0; playerBussiness2.AddGoods(itemInfo2); string translation2 = LanguageMgr.GetTranslation("HymenealCommand.Content", new object[] { playerByUserID.PlayerCharacter.NickName }); MailInfo mailInfo2 = new MailInfo(); mailInfo2.Annex1 = itemInfo2.ItemID.ToString(); mailInfo2.Content = translation2; mailInfo2.Gold = 0; mailInfo2.IsExist = true; mailInfo2.Money = 0; mailInfo2.Receiver = playerByUserID2.PlayerCharacter.NickName; mailInfo2.ReceiverID = playerByUserID2.PlayerCharacter.ID; mailInfo2.Sender = LanguageMgr.GetTranslation("HymenealCommand.Sender", new object[0]); mailInfo2.SenderID = 0; mailInfo2.Title = LanguageMgr.GetTranslation("HymenealCommand.Title", new object[0]); mailInfo2.Type = 14; if (playerBussiness2.SendMail(mailInfo2)) { flag = true; } player.Out.SendMailResponse(mailInfo2.ReceiverID, eMailRespose.Receiver); } player.CurrentMarryRoom.Info.IsHymeneal = true; using (PlayerBussiness playerBussiness3 = new PlayerBussiness()) { playerBussiness3.UpdateMarryRoomInfo(player.CurrentMarryRoom.Info); playerBussiness3.UpdatePlayerGotRingProp(playerByUserID.PlayerCharacter.ID, playerByUserID2.PlayerCharacter.ID); playerByUserID.LoadMarryProp(); playerByUserID2.LoadMarryProp(); goto IL_429; } } flag2 = false; flag = true; IL_429: if (!flag2) { player.RemoveMoney(pRICE_PROPOSE); LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_Hymeneal, player.PlayerCharacter.ID, pRICE_PROPOSE, player.PlayerCharacter.Money, 0, 0, 0, 0, "", "", ""); CountBussiness.InsertSystemPayCount(player.PlayerCharacter.ID, pRICE_PROPOSE, 0, 0, 1); } gSPacketIn.WriteInt(player.CurrentMarryRoom.Info.ID); gSPacketIn.WriteBoolean(flag); player.CurrentMarryRoom.SendToAll(gSPacketIn); if (flag) { string translation3 = LanguageMgr.GetTranslation("HymenealCommand.Succeed", new object[] { playerByUserID.PlayerCharacter.NickName, playerByUserID2.PlayerCharacter.NickName }); GSPacketIn packet2 = player.Out.SendMessage(eMessageType.ChatNormal, translation3); player.CurrentMarryRoom.SendToPlayerExceptSelfForScene(packet2, player); } } return(true); }
public int HandlePacket(GameClient client, GSPacketIn packet) { if (!client.Player.PlayerCharacter.IsMarried) { return(1); } if (client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked) { client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked")); return(0); } if (client.Player.PlayerCharacter.IsCreatedMarryRoom) { client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("DivorceApplyHandler.Msg2")); return(1); } int needMoney = GameProperties.PRICE_DIVORCED; if (client.Player.PlayerCharacter.Money < needMoney) { client.Player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("DivorceApplyHandler.Msg1")); return(1); } else { client.Player.RemoveMoney(needMoney); LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_Unmarry, client.Player.PlayerCharacter.ID, needMoney, client.Player.PlayerCharacter.Money, 0, 0, 0, 0, "", "", ""); CountBussiness.InsertSystemPayCount(client.Player.PlayerCharacter.ID, needMoney, 0, (int)eConsumerType.Marry, (int)eSubConsumerType.Marry_Divorce); using (PlayerBussiness db = new PlayerBussiness()) { PlayerInfo tempSpouse = db.GetUserSingleByUserID(client.Player.PlayerCharacter.SpouseID); if (tempSpouse == null || tempSpouse.Sex == client.Player.PlayerCharacter.Sex) { return(1); } MarryApplyInfo info = new MarryApplyInfo(); info.UserID = client.Player.PlayerCharacter.SpouseID; info.ApplyUserID = client.Player.PlayerCharacter.ID; info.ApplyUserName = client.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); client.Player.LoadMarryProp(); } } client.Player.QuestInventory.ClearMarryQuest(); //离婚后清除结婚后任务. client.Player.Out.SendPlayerDivorceApply(client.Player, true, true); client.Player.SendMessage(LanguageMgr.GetTranslation("DivorceApplyHandler.Msg3")); } return(0); }
public bool HandleCommand(TankMarryLogicProcessor process, GamePlayer player, GSPacketIn packet) { bool result; if (player.CurrentMarryRoom == null) { result = false; } else { if (player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.GroomID && player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.BrideID) { result = false; } else { int hour = packet.ReadInt(); string[] money = "2000,2700,3400".Split(new char[] { ',' }); if (money.Length < 3) { ContinuationCommand.log.Error("MarryRoomCreateMoney node in configuration file is wrong"); result = false; } else { int needMoney; switch (hour) { case 2: needMoney = int.Parse(money[0]); break; case 3: needMoney = int.Parse(money[1]); break; case 4: needMoney = int.Parse(money[2]); break; default: needMoney = int.Parse(money[2]); hour = 4; break; } if (player.PlayerCharacter.Money < needMoney) { player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryApplyHandler.Msg1", new object[0])); result = false; } else { player.RemoveMoney(needMoney, LogMoneyType.Marry, LogMoneyType.Marry_RoomAdd); CountBussiness.InsertSystemPayCount(player.PlayerCharacter.ID, needMoney, 0, 0, 0); player.CurrentMarryRoom.RoomContinuation(hour); GSPacketIn pkg = player.Out.SendContinuation(player, player.CurrentMarryRoom.Info); int spouseID; if (player.PlayerCharacter.ID == player.CurrentMarryRoom.Info.GroomID) { spouseID = player.CurrentMarryRoom.Info.BrideID; } else { spouseID = player.CurrentMarryRoom.Info.GroomID; } GamePlayer spouse = WorldMgr.GetPlayerById(spouseID); if (spouse != null) { spouse.Out.SendTCP(pkg); } player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ContinuationCommand.Successed", new object[0])); result = true; } } } } return(result); }
public bool HandleCommand(TankMarryLogicProcessor process, GamePlayer player, GSPacketIn packet) { if (player.CurrentMarryRoom == null) { return(false); } if (player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.GroomID && player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.BrideID) { return(false); } int hour = packet.ReadInt(); string[] money = GameProperties.PRICE_MARRY_ROOM.Split(','); if (money.Length < 3) { if (log.IsErrorEnabled) { log.Error("MarryRoomCreateMoney node in configuration file is wrong"); } return(false); } int needMoney = 0; switch (hour) { case 2: needMoney = int.Parse(money[0]); break; case 3: needMoney = int.Parse(money[1]); break; case 4: needMoney = int.Parse(money[2]); break; default: needMoney = int.Parse(money[2]); hour = 4; break; } if (player.PlayerCharacter.Money < needMoney) { player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryApplyHandler.Msg1")); return(false); } //player.SetMoney(-needMoney, MoneyRemoveType.Marry); player.RemoveMoney(needMoney); LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_RoomAdd, player.PlayerCharacter.ID, needMoney, player.PlayerCharacter.Money, 0, 0, 0, "", "", ""); CountBussiness.InsertSystemPayCount(player.PlayerCharacter.ID, needMoney, 0, (int)eConsumerType.Marry, (int)eSubConsumerType.Marry_MarryRoom); player.CurrentMarryRoom.RoomContinuation(hour); GSPacketIn pkg = player.Out.SendContinuation(player, player.CurrentMarryRoom.Info); int spouseID = 0; if (player.PlayerCharacter.ID == player.CurrentMarryRoom.Info.GroomID) { spouseID = player.CurrentMarryRoom.Info.BrideID; } else { spouseID = player.CurrentMarryRoom.Info.GroomID; } GamePlayer spouse = WorldMgr.GetPlayerById(spouseID); if (spouse != null) { spouse.Out.SendTCP(pkg); } player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ContinuationCommand.Successed")); return(true); }
public override int HandlePacket(GamePlayer player, GSPacketIn packet) { int result; if (!player.PlayerCharacter.IsMarried) { result = 1; } else { if (player.PlayerCharacter.IsCreatedMarryRoom) { 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 { if (player.CurrentRoom != null) { player.CurrentRoom.RemovePlayerUnsafe(player); } if (player.CurrentMarryRoom != null) { player.CurrentMarryRoom.RemovePlayer(player); } MarryRoomInfo info = new MarryRoomInfo(); info.Name = packet.ReadString().Replace(";", ""); info.Pwd = packet.ReadString(); info.MapIndex = packet.ReadInt(); info.AvailTime = packet.ReadInt(); info.MaxCount = packet.ReadInt(); info.GuestInvite = packet.ReadBoolean(); info.RoomIntroduction = packet.ReadString(); info.ServerID = GameServer.Instance.Config.ServerID; info.IsHymeneal = false; string[] array = new string[] { "1", "2", "3" }; string[] money = "2000,2700,3400".Split(new char[] { ',' }); if (money.Length < 3) { MarryRoomCreateHandler.log.Error("MarryRoomCreateMoney node in configuration file is wrong"); result = 1; } else { int needMoney; switch (info.AvailTime) { case 2: needMoney = int.Parse(money[0]); break; case 3: needMoney = int.Parse(money[1]); break; case 4: needMoney = int.Parse(money[2]); break; default: needMoney = int.Parse(money[2]); info.AvailTime = 4; break; } if (player.PlayerCharacter.Money >= needMoney) { MarryRoom room = MarryRoomMgr.CreateMarryRoom(player, info); if (room != null) { player.RemoveMoney(needMoney, LogMoneyType.Marry, LogMoneyType.Marry_Room); GSPacketIn pkg = player.Out.SendMarryRoomInfo(player, room); player.Out.SendMarryRoomLogin(player, true); room.SendToScenePlayer(pkg); CountBussiness.InsertSystemPayCount(player.PlayerCharacter.ID, needMoney, 0, 0, 0); } result = 0; } else { player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("UserFirecrackersCommand.MoneyNotEnough", new object[0])); result = 1; } } } } } return(result); }
public bool HandleCommand(TankMarryLogicProcessor process, GamePlayer player, GSPacketIn packet) { if (player.CurrentMarryRoom == null) { return(false); } if (player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.GroomID && player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.BrideID) { return(false); } int time = packet.ReadInt(); string[] array = GameProperties.PRICE_MARRY_ROOM.Split(new char[] { ',' }); if (array.Length < 3) { if (ContinuationCommand.log.IsErrorEnabled) { ContinuationCommand.log.Error("MarryRoomCreateMoney node in configuration file is wrong"); } return(false); } int num; switch (time) { case 2: num = int.Parse(array[0]); break; case 3: num = int.Parse(array[1]); break; case 4: num = int.Parse(array[2]); break; default: num = int.Parse(array[2]); time = 4; break; } if (player.PlayerCharacter.Money < num) { player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryApplyHandler.Msg1", new object[0])); return(false); } player.RemoveMoney(num); LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_RoomAdd, player.PlayerCharacter.ID, num, player.PlayerCharacter.Money, 0, 0, 0, 0, "", "", ""); CountBussiness.InsertSystemPayCount(player.PlayerCharacter.ID, num, 0, 0, 0); player.CurrentMarryRoom.RoomContinuation(time); GSPacketIn packet2 = player.Out.SendContinuation(player, player.CurrentMarryRoom.Info); int playerId; if (player.PlayerCharacter.ID == player.CurrentMarryRoom.Info.GroomID) { playerId = player.CurrentMarryRoom.Info.BrideID; } else { playerId = player.CurrentMarryRoom.Info.GroomID; } GamePlayer playerById = WorldMgr.GetPlayerById(playerId); if (playerById != null) { playerById.Out.SendTCP(packet2); } player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ContinuationCommand.Successed", new object[0])); return(true); }
public int HandlePacket(GameClient client, GSPacketIn packet) { if (!client.Player.PlayerCharacter.IsMarried) { return(1); } if (client.Player.PlayerCharacter.IsCreatedMarryRoom) { return(1); } if (client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked) { client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked", new object[0])); return(0); } if (client.Player.CurrentRoom != null) { client.Player.CurrentRoom.RemovePlayerUnsafe(client.Player); } if (client.Player.CurrentMarryRoom != null) { client.Player.CurrentMarryRoom.RemovePlayer(client.Player); } MarryRoomInfo marryRoomInfo = new MarryRoomInfo(); marryRoomInfo.Name = packet.ReadString().Replace(";", ""); marryRoomInfo.Pwd = packet.ReadString(); marryRoomInfo.MapIndex = packet.ReadInt(); marryRoomInfo.AvailTime = packet.ReadInt(); marryRoomInfo.MaxCount = packet.ReadInt(); marryRoomInfo.GuestInvite = packet.ReadBoolean(); marryRoomInfo.RoomIntroduction = packet.ReadString(); marryRoomInfo.ServerID = GameServer.Instance.Configuration.ServerID; marryRoomInfo.IsHymeneal = false; string[] array = GameProperties.PRICE_MARRY_ROOM.Split(new char[] { ',' }); if (array.Length < 3) { if (MarryRoomCreateHandler.log.IsErrorEnabled) { MarryRoomCreateHandler.log.Error("MarryRoomCreateMoney node in configuration file is wrong"); } return(1); } int num; switch (marryRoomInfo.AvailTime) { case 2: num = int.Parse(array[0]); break; case 3: num = int.Parse(array[1]); break; case 4: num = int.Parse(array[2]); break; default: num = int.Parse(array[2]); marryRoomInfo.AvailTime = 4; break; } if (client.Player.PlayerCharacter.Money >= num) { MarryRoom marryRoom = MarryRoomMgr.CreateMarryRoom(client.Player, marryRoomInfo); if (marryRoom != null) { client.Player.RemoveMoney(num); LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_Room, client.Player.PlayerCharacter.ID, num, client.Player.PlayerCharacter.Money, 0, 0, 0, 0, "", "", ""); GSPacketIn packet2 = client.Player.Out.SendMarryRoomInfo(client.Player, marryRoom); client.Player.Out.SendMarryRoomLogin(client.Player, true); marryRoom.SendToScenePlayer(packet2); CountBussiness.InsertSystemPayCount(client.Player.PlayerCharacter.ID, num, 0, 0, 0); } return(0); } client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("UserFirecrackersCommand.MoneyNotEnough", new object[0])); return(1); }
public bool HandleCommand(TankMarryLogicProcessor process, GamePlayer player, GSPacketIn packet) { bool result2; if (player.CurrentMarryRoom == null || player.CurrentMarryRoom.RoomState != eRoomState.FREE) { result2 = false; } else { if (player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.GroomID && player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.BrideID) { result2 = false; } else { int needMoney = 500; if (player.CurrentMarryRoom.Info.IsHymeneal) { if (player.PlayerCharacter.Money < needMoney) { player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("UserFirecrackersCommand.MoneyNotEnough", new object[0])); result2 = false; return(result2); } } GamePlayer Groom = player.CurrentMarryRoom.GetPlayerByUserID(player.CurrentMarryRoom.Info.GroomID); if (Groom == null) { player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("HymenealCommand.NoGroom", new object[0])); result2 = false; } else { GamePlayer Bride = player.CurrentMarryRoom.GetPlayerByUserID(player.CurrentMarryRoom.Info.BrideID); if (Bride == null) { player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("HymenealCommand.NoBride", new object[0])); result2 = false; } else { bool result = false; bool isFirst = false; GSPacketIn pkg = packet.Clone(); int hymenealState = packet.ReadInt(); if (1 == hymenealState) { player.CurrentMarryRoom.RoomState = eRoomState.FREE; } else { player.CurrentMarryRoom.RoomState = eRoomState.Hymeneal; player.CurrentMarryRoom.BeginTimerForHymeneal(170000); if (!player.PlayerCharacter.IsGotRing) { isFirst = true; ItemTemplateInfo ringTemplate = ItemMgr.FindItemTemplate(9022); ItemInfo ring = ItemInfo.CreateFromTemplate(ringTemplate, 1, 112); ring.IsBinds = true; using (PlayerBussiness pb = new PlayerBussiness()) { ring.UserID = 0; pb.AddGoods(ring); string content = LanguageMgr.GetTranslation("HymenealCommand.Content", new object[] { Bride.PlayerCharacter.NickName }); MailInfo mail = new MailInfo(); mail.Annex1 = ring.ItemID.ToString(); mail.Content = content; mail.Gold = 0; mail.IsExist = true; mail.Money = 0; mail.GiftToken = 0; mail.Receiver = Groom.PlayerCharacter.NickName; mail.ReceiverID = Groom.PlayerCharacter.ID; mail.Sender = LanguageMgr.GetTranslation("HymenealCommand.Sender", new object[0]); mail.SenderID = 0; mail.Title = LanguageMgr.GetTranslation("HymenealCommand.Title", new object[0]); mail.Type = 14; if (pb.SendMail(mail)) { result = true; } player.Out.SendMailResponse(mail.ReceiverID, eMailRespose.Receiver); } ItemInfo ring2 = ItemInfo.CreateFromTemplate(ringTemplate, 1, 112); ring2.IsBinds = true; using (PlayerBussiness pb = new PlayerBussiness()) { ring2.UserID = 0; pb.AddGoods(ring2); string content = LanguageMgr.GetTranslation("HymenealCommand.Content", new object[] { Groom.PlayerCharacter.NickName }); MailInfo mail = new MailInfo(); mail.Annex1 = ring2.ItemID.ToString(); mail.Content = content; mail.Gold = 0; mail.IsExist = true; mail.Money = 0; mail.GiftToken = 0; mail.Receiver = Bride.PlayerCharacter.NickName; mail.ReceiverID = Bride.PlayerCharacter.ID; mail.Sender = LanguageMgr.GetTranslation("HymenealCommand.Sender", new object[0]); mail.SenderID = 0; mail.Title = LanguageMgr.GetTranslation("HymenealCommand.Title", new object[0]); mail.Type = 14; if (pb.SendMail(mail)) { result = true; } player.Out.SendMailResponse(mail.ReceiverID, eMailRespose.Receiver); } player.CurrentMarryRoom.Info.IsHymeneal = true; using (PlayerBussiness db = new PlayerBussiness()) { db.UpdateMarryRoomInfo(player.CurrentMarryRoom.Info); db.UpdatePlayerGotRingProp(Groom.PlayerCharacter.ID, Bride.PlayerCharacter.ID); Groom.LoadMarryProp(); Bride.LoadMarryProp(); } } else { isFirst = false; result = true; } if (!isFirst) { player.RemoveMoney(needMoney, LogMoneyType.Marry, LogMoneyType.Marry_Hymeneal); CountBussiness.InsertSystemPayCount(player.PlayerCharacter.ID, needMoney, 0, 0, 1); } pkg.WriteInt(player.CurrentMarryRoom.Info.ID); pkg.WriteBoolean(result); player.CurrentMarryRoom.SendToAll(pkg); if (result) { string msg = LanguageMgr.GetTranslation("HymenealCommand.Succeed", new object[] { Groom.PlayerCharacter.NickName, Bride.PlayerCharacter.NickName }); GSPacketIn message = player.Out.SendMessage(eMessageType.ChatNormal, msg); player.CurrentMarryRoom.SendToPlayerExceptSelfForScene(message, player); } } result2 = true; } } } } return(result2); }