public int CoupleWishWishRole(CoupleWishWishRoleReq req) { ITianTiService kuaFuService = GetKuaFuService(); if (null != kuaFuService) { try { return(kuaFuService.CoupleWishWishRole(req)); } catch (System.Exception ex) { ResetKuaFuService(); return(StdErrorCode.Error_Server_Internal_Error); } } else { return(StdErrorCode.Error_Server_Not_Registed); } }
public int CoupleWishWishRole(CoupleWishWishRoleReq req) { return(CoupleWishService.getInstance().CoupleWishWishRole(req)); }
public int CoupleWishWishRole(CoupleWishWishRoleReq req) { DateTime now = TimeUtil.NowDateTime(); long nowMs = now.Ticks / 10000L; int result; try { lock (this.Mutex) { if (this.SyncData.ThisWeek.Week != this.CurrRankWeek(now)) { result = -11000; } else { CoupleWishTypeConfig wishCfg = this._Config.WishTypeCfgList.Find((CoupleWishTypeConfig _w) => _w.WishType == req.WishType); if (wishCfg == null) { result = -3; } else { if (wishCfg.CooldownTime > 0) { if (this.WishCdControls.ContainsKey(req.WishType) && nowMs - this.WishCdControls[req.WishType] < (long)(wishCfg.CooldownTime * 1000)) { return(-30); } } CoupleWishCoupleDataK coupleData; if (req.IsWishRank) { int idx; if (!this.SyncData.ThisWeek.CoupleIdex.TryGetValue(req.ToCoupleId, out idx)) { return(-11); } coupleData = this.SyncData.ThisWeek.RankList[idx]; coupleData.BeWishedNum += wishCfg.GetWishNum; if (req.ToManSelector != null && req.ToWifeSelector != null) { coupleData.Man = req.ToMan; coupleData.ManSelector = req.ToManSelector; coupleData.Wife = req.ToWife; coupleData.WifeSelector = req.ToWifeSelector; this.Persistence.WriteCoupleData(this.SyncData.ThisWeek.Week, coupleData); } } else { if (req.ToManSelector == null || req.ToWifeSelector == null) { return(-11003); } if (!this.IsValidCoupleIfExist(req.ToMan.RoleId, req.ToWife.RoleId)) { return(-11003); } bool bFirstCreate = false; int idx; if (!this.SyncData.ThisWeek.RoleIndex.TryGetValue(req.ToMan.RoleId, out idx)) { bFirstCreate = true; coupleData = new CoupleWishCoupleDataK(); coupleData.DbCoupleId = this.Persistence.GetNextDbCoupleId(); coupleData.Rank = this.SyncData.ThisWeek.RankList.Count + 1; } else { coupleData = this.SyncData.ThisWeek.RankList[idx]; } coupleData.Man = req.ToMan; coupleData.ManSelector = req.ToManSelector; coupleData.Wife = req.ToWife; coupleData.WifeSelector = req.ToWifeSelector; coupleData.BeWishedNum += wishCfg.GetWishNum; if (!this.Persistence.WriteCoupleData(this.SyncData.ThisWeek.Week, coupleData)) { coupleData.BeWishedNum -= wishCfg.GetWishNum; return(-15); } if (bFirstCreate) { this.SyncData.ThisWeek.RankList.Add(coupleData); this.SyncData.ThisWeek.BuildIndex(); } } this.IsNeedSort = true; if (this.SyncData.ThisWeek.RankList.Count <= CoupleWishConsts.MaxRankNum || this.SyncData.ThisWeek.RankList.Last <CoupleWishCoupleDataK>().Rank <= CoupleWishConsts.MaxRankNum) { this.CheckSortRank(); } this.WishCdControls[req.WishType] = nowMs; this.WishRecordMgr.AddWishRecord(req.From, req.WishType, req.WishTxt, coupleData.DbCoupleId, coupleData.Man, coupleData.Wife); result = 1; } } } } catch (Exception ex) { LogManager.WriteExceptionUseCache(ex.Message); result = -11003; } return(result); }
/// <summary> /// 查询祝福记录 /// </summary> /// <param name="req"></param> /// <returns></returns> public List <CoupleWishWishRecordData> GetWishRecord(int roleId) { List <CoupleWishWishRecordData> result = null; MySqlDataReader sdr = null; try { lock (Mutex) { Queue <CoupleWishWishRecordData> wishQ = null; if (RoleWishRecords.TryGetValue(roleId, out wishQ)) { result = wishQ.ToList(); } if (result == null) { string sql = string.Format( "SELECT `from_rid`,`from_zoneid`,`from_rname`,`to_man_rid`,`to_man_zoneid`,`to_man_rname`,`to_wife_rid`,`to_wife_zoneid`,`to_wife_rname`,`wish_type`,`wish_txt` " + " FROM t_couple_wish_wish_log WHERE `week`={0} AND (`from_rid`={1} OR `to_man_rid`={1} OR `to_wife_rid`={1}) ORDER BY `time` LIMIT {2};", this.ThisWeek, roleId, CoupleWishConsts.MaxWishRecordNum); sdr = DbHelperMySQL.ExecuteReader(sql); RoleWishRecords[roleId] = wishQ = new Queue <CoupleWishWishRecordData>(); while (sdr != null && sdr.Read()) { CoupleWishWishRoleReq req = new CoupleWishWishRoleReq(); req.From.RoleId = Convert.ToInt32(sdr["from_rid"]); req.From.ZoneId = Convert.ToInt32(sdr["from_zoneid"]); req.From.RoleName = sdr["from_rname"].ToString(); req.ToMan.RoleId = Convert.ToInt32(sdr["to_man_rid"]); req.ToMan.ZoneId = Convert.ToInt32(sdr["to_man_zoneid"]); req.ToMan.RoleName = sdr["to_man_rname"].ToString(); req.ToWife.RoleId = Convert.ToInt32(sdr["to_wife_rid"]); req.ToWife.ZoneId = Convert.ToInt32(sdr["to_wife_zoneid"]); req.ToWife.RoleName = sdr["to_wife_rname"].ToString(); req.WishType = Convert.ToInt32(sdr["wish_type"]); req.WishTxt = sdr["wish_txt"].ToString(); if (req.From.RoleId == roleId) { AddCachedWishOther(req.From, req.WishType, req.WishTxt, req.ToMan, req.ToWife); } if (req.ToMan.RoleId == roleId) { AddCachedBeWished(req.ToMan, req.ToWife, req.WishType, req.WishTxt, req.From); } if (req.ToWife.RoleId == roleId) { AddCachedBeWished(req.ToWife, req.ToMan, req.WishType, req.WishTxt, req.From); } } result = wishQ.ToList(); } RoleLastReadMs[roleId] = TimeUtil.NOW(); } } catch (Exception ex) { LogManager.WriteExceptionUseCache(ex.Message); } finally { if (sdr != null) { sdr.Close(); } } return(result); }
/// <summary> /// 祝福情侣 /// </summary> /// <param name="req"></param> /// <returns></returns> public int CoupleWishWishRole(CoupleWishWishRoleReq req) { DateTime now = TimeUtil.NowDateTime(); long nowMs = now.Ticks / TimeSpan.TicksPerMillisecond; try { lock (Mutex) { if (this.SyncData.ThisWeek.Week != CurrRankWeek(now)) { return(StdErrorCode.Error_Server_Busy); } CoupleWishTypeConfig wishCfg = _Config.WishTypeCfgList.Find(_w => _w.WishType == req.WishType); if (wishCfg == null) { return(StdErrorCode.Error_Config_Fault); } if (wishCfg.CooldownTime > 0) { if (WishCdControls.ContainsKey(req.WishType) && nowMs - WishCdControls[req.WishType] < wishCfg.CooldownTime * 1000) { return(StdErrorCode.Error_Wish_Type_Is_In_CD); } } CoupleWishCoupleDataK coupleData = null; if (req.IsWishRank) { int idx; if (!SyncData.ThisWeek.CoupleIdex.TryGetValue(req.ToCoupleId, out idx)) { return(StdErrorCode.Error_Operation_Faild); } coupleData = SyncData.ThisWeek.RankList[idx]; coupleData.BeWishedNum += wishCfg.GetWishNum; if (req.ToManSelector != null && req.ToWifeSelector != null) { // 排行榜祝福,如果祝福者和被祝福者是同一服务器的,那么也会更新被祝福者的形象 coupleData.Man = req.ToMan; coupleData.ManSelector = req.ToManSelector; coupleData.Wife = req.ToWife; coupleData.WifeSelector = req.ToWifeSelector; Persistence.WriteCoupleData(this.SyncData.ThisWeek.Week, coupleData); } } else { // 本服祝福 if (req.ToManSelector == null || req.ToWifeSelector == null) { return(StdErrorCode.Error_Server_Internal_Error); } if (!IsValidCoupleIfExist(req.ToMan.RoleId, req.ToWife.RoleId)) { return(StdErrorCode.Error_Server_Internal_Error); } bool bFirstCreate = false; int idx; if (!this.SyncData.ThisWeek.RoleIndex.TryGetValue(req.ToMan.RoleId, out idx)) { // 首次被祝福 bFirstCreate = true; coupleData = new CoupleWishCoupleDataK(); coupleData.DbCoupleId = Persistence.GetNextDbCoupleId(); coupleData.Rank = this.SyncData.ThisWeek.RankList.Count + 1; } else { coupleData = this.SyncData.ThisWeek.RankList[idx]; } // 本服祝福会更新被祝福者形象 coupleData.Man = req.ToMan; coupleData.ManSelector = req.ToManSelector; coupleData.Wife = req.ToWife; coupleData.WifeSelector = req.ToWifeSelector; coupleData.BeWishedNum += wishCfg.GetWishNum; // 本服祝福,保证把形象更新到db if (!Persistence.WriteCoupleData(this.SyncData.ThisWeek.Week, coupleData)) { coupleData.BeWishedNum -= wishCfg.GetWishNum; return(StdErrorCode.Error_DB_Faild); } if (bFirstCreate) { this.SyncData.ThisWeek.RankList.Add(coupleData); this.SyncData.ThisWeek.BuildIndex(); } } this.IsNeedSort = true; if (this.SyncData.ThisWeek.RankList.Count <= CoupleWishConsts.MaxRankNum || this.SyncData.ThisWeek.RankList.Last().Rank <= CoupleWishConsts.MaxRankNum) { // 不足20名时,立即刷新 this.CheckSortRank(); } WishCdControls[req.WishType] = nowMs; WishRecordMgr.AddWishRecord(req.From, req.WishType, req.WishTxt, coupleData.DbCoupleId, coupleData.Man, coupleData.Wife); return(StdErrorCode.Error_Success); } } catch (Exception ex) { LogManager.WriteExceptionUseCache(ex.Message); return(StdErrorCode.Error_Server_Internal_Error); } }
/// <summary> /// 玩家请求祝福他人 /// </summary> /// <param name="client"></param> /// <param name="nID"></param> /// <param name="bytes"></param> /// <param name="cmdParams"></param> private void HandleWishOtherRoleCommand(GameClient client, int nID, byte[] bytes, string[] cmdParams) { var cliReq = DataHelper.BytesToObject <CoupleWishWishReqData>(bytes, 0, bytes.Length); DateTime now = TimeUtil.NowDateTime(); if (client.ClientSocket.IsKuaFuLogin) { client.sendCmd(nID, StdErrorCode.Error_Operation_Denied.ToString()); return; } if (cliReq.CostType != (int)CoupleWishWishReqData.ECostType.Goods && cliReq.CostType != (int)CoupleWishWishReqData.ECostType.ZuanShi) { client.sendCmd(nID, StdErrorCode.Error_Invalid_Params.ToString()); return; } // 是否是活动时间 int wishWeek; if (!_Config.IsInWishTime(now, out wishWeek)) { client.sendCmd(nID, StdErrorCode.Error_Wish_In_Balance_Time.ToString()); return; } // 祝福类型检查 CoupleWishTypeConfig wishCfg = _Config.WishTypeCfgList.Find(_w => _w.WishType == cliReq.WishType); if (wishCfg == null) { client.sendCmd(nID, StdErrorCode.Error_Config_Fault.ToString()); return; } // 道具检查 if (cliReq.CostType == (int)CoupleWishWishReqData.ECostType.Goods && wishCfg.CostGoodsId > 0 && wishCfg.CostGoodsNum > 0 && Global.GetTotalGoodsCountByID(client, wishCfg.CostGoodsId) < wishCfg.CostGoodsNum) { client.sendCmd(nID, StdErrorCode.Error_Goods_Not_Enough.ToString()); return; } // 钻石检查 if (cliReq.CostType == (int)CoupleWishWishReqData.ECostType.ZuanShi && wishCfg.CostZuanShi > 0 && client.ClientData.UserMoney < wishCfg.CostZuanShi) { client.sendCmd(nID, StdErrorCode.Error_ZuanShi_Not_Enough.ToString()); return; } // 祝福寄语检查 if (!string.IsNullOrEmpty(cliReq.WishTxt)) { if (wishCfg.CanHaveWishTxt != 1) { client.sendCmd(nID, StdErrorCode.Error_Cannot_Have_Wish_Txt.ToString()); return; } else if (cliReq.WishTxt.Length > CoupleWishConsts.MaxWishTxtLen) { client.sendCmd(nID, StdErrorCode.Error_Wish_Txt_Length_Limit.ToString()); return; } } CoupleWishWishRoleReq centerReq = new CoupleWishWishRoleReq(); centerReq.From.RoleId = client.ClientData.RoleID; centerReq.From.ZoneId = client.ClientData.ZoneID; centerReq.From.RoleName = client.ClientData.RoleName; centerReq.WishType = cliReq.WishType; centerReq.WishTxt = cliReq.WishTxt; RoleData4Selector toManSelector = null; RoleData4Selector toWifeSelector = null; CoupleWishCoupleDataK rankCoupleData = null; if (cliReq.IsWishRankRole) { centerReq.IsWishRank = true; // 跨服排行榜祝福 lock (Mutex) { int coupleIdx; if (!this.SyncData.ThisWeek.CoupleIdex.TryGetValue(cliReq.ToRankCoupleId, out coupleIdx)) { client.sendCmd(nID, StdErrorCode.Error_Operation_Denied.ToString()); return; } rankCoupleData = this.SyncData.ThisWeek.RankList[coupleIdx]; if (rankCoupleData == null || rankCoupleData.DbCoupleId != cliReq.ToRankCoupleId || rankCoupleData.Rank > CoupleWishConsts.MaxRankNum * 2) { // 因为客户端看到的不是实时的数据,客户端看到的时候某对情侣可能处于前20名,但是当祝福的时候,可能已经不是前20名了,优化下体验,如果是前40名就允许 client.sendCmd(nID, StdErrorCode.Error_Operation_Denied.ToString()); return; } centerReq.ToCoupleId = cliReq.ToRankCoupleId; // 赠送排行榜情侣,检测是否是本服的情侣,尝试更新角色形象 toManSelector = Global.sendToDB <RoleData4Selector, string>((int)TCPGameServerCmds.CMD_SPR_GETROLEUSINGGOODSDATALIST, string.Format("{0}", rankCoupleData.Man.RoleId), client.ServerId); toWifeSelector = Global.sendToDB <RoleData4Selector, string>((int)TCPGameServerCmds.CMD_SPR_GETROLEUSINGGOODSDATALIST, string.Format("{0}", rankCoupleData.Wife.RoleId), client.ServerId); if (toManSelector == null || toWifeSelector == null || toManSelector.RoleID <= 0 || toWifeSelector.RoleID <= 0) { toManSelector = toWifeSelector = null; } } } else { // 本服祝福 int toRoleId = -1; if (!string.IsNullOrEmpty(cliReq.ToLocalRoleName)) { toRoleId = RoleName2IDs.FindRoleIDByName(cliReq.ToLocalRoleName, true); } if (toRoleId <= 0) { client.sendCmd(nID, StdErrorCode.Error_Wish_Player_Not_Exist.ToString()); return; } if (toRoleId == client.ClientData.RoleID) { client.sendCmd(nID, StdErrorCode.Error_Cannot_Wish_Self.ToString()); return; } int nSpouseId = MarryLogic.GetSpouseID(toRoleId); if (nSpouseId <= 0) { client.sendCmd(nID, StdErrorCode.Error_Wish_Player_Not_Marry.ToString()); return; } toManSelector = Global.sendToDB <RoleData4Selector, string>((int)TCPGameServerCmds.CMD_SPR_GETROLEUSINGGOODSDATALIST, string.Format("{0}", toRoleId), client.ServerId); toWifeSelector = Global.sendToDB <RoleData4Selector, string>((int)TCPGameServerCmds.CMD_SPR_GETROLEUSINGGOODSDATALIST, string.Format("{0}", nSpouseId), client.ServerId); if (toManSelector == null || toWifeSelector == null || toManSelector.RoleSex == toWifeSelector.RoleSex) { client.sendCmd(nID, StdErrorCode.Error_DB_Faild.ToString()); return; } if (toManSelector.RoleSex == (int)ERoleSex.Girl) { DataHelper2.Swap(ref toManSelector, ref toWifeSelector); } } if (toManSelector != null && toWifeSelector != null) { // 不管是排行榜赠送还是选中好友赠送,都尝试更新被赠送者形象数据 // 排行榜赠送时,toManSelector和toWifeSelector可能都为null,或者都不为null // 选中好友赠送,toManSelector和toWifeSelector一定都不为null centerReq.ToMan.RoleId = toManSelector.RoleID; centerReq.ToMan.ZoneId = toManSelector.ZoneId; centerReq.ToMan.RoleName = toManSelector.RoleName; centerReq.ToManSelector = DataHelper.ObjectToBytes <RoleData4Selector>(toManSelector); centerReq.ToWife.RoleId = toWifeSelector.RoleID; centerReq.ToWife.ZoneId = toWifeSelector.ZoneId; centerReq.ToWife.RoleName = toWifeSelector.RoleName; centerReq.ToWifeSelector = DataHelper.ObjectToBytes <RoleData4Selector>(toWifeSelector); } int ec = TianTiClient.getInstance().CoupleWishWishRole(centerReq); if (ec < 0) { client.sendCmd(nID, ec.ToString()); return; } // 扣除物品 if (cliReq.CostType == (int)CoupleWishWishReqData.ECostType.Goods && wishCfg.CostGoodsId > 0 && wishCfg.CostGoodsNum > 0) { bool oneUseBind = false; bool oneUseTimeLimit = false; Global.UseGoodsBindOrNot(client, wishCfg.CostGoodsId, wishCfg.CostGoodsNum, true, out oneUseBind, out oneUseTimeLimit); } // 扣除钻石 if (cliReq.CostType == (int)CoupleWishWishReqData.ECostType.ZuanShi && wishCfg.CostZuanShi > 0) { GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, wishCfg.CostZuanShi, "情侣祝福"); } // 增加本服祝福特效 if (wishCfg.IsHaveEffect == 1) { CoupleWishNtfWishEffectData effectData = new CoupleWishNtfWishEffectData(); effectData.From = centerReq.From; effectData.WishType = cliReq.WishType; effectData.WishTxt = cliReq.WishTxt; effectData.To = new List <KuaFuRoleMiniData>(); if (cliReq.IsWishRankRole) { effectData.To.Add(rankCoupleData.Man); effectData.To.Add(rankCoupleData.Wife); } else { if (centerReq.ToMan.RoleName == cliReq.ToLocalRoleName) { effectData.To.Add(centerReq.ToMan); } else { effectData.To.Add(centerReq.ToWife); } } lock (Mutex) { // 这里必须锁住,不然多个人同时祝福,都有可能修改所有在线玩家的奖励数据 HandleWishEffect(effectData); } } client.sendCmd(nID, StdErrorCode.Error_Success.ToString()); }
private void HandleWishOtherRoleCommand(GameClient client, int nID, byte[] bytes, string[] cmdParams) { CoupleWishWishReqData cliReq = DataHelper.BytesToObject <CoupleWishWishReqData>(bytes, 0, bytes.Length); DateTime now = TimeUtil.NowDateTime(); int wishWeek; if (client.ClientSocket.IsKuaFuLogin) { client.sendCmd(nID, -12); } else if (cliReq.CostType != 1 && cliReq.CostType != 2) { client.sendCmd(nID, -18); } else if (!this._Config.IsInWishTime(now, out wishWeek)) { client.sendCmd(nID, -31); } else { CoupleWishTypeConfig wishCfg = this._Config.WishTypeCfgList.Find((CoupleWishTypeConfig _w) => _w.WishType == cliReq.WishType); if (wishCfg == null) { client.sendCmd(nID, -3); } else if (cliReq.CostType == 1 && wishCfg.CostGoodsId > 0 && wishCfg.CostGoodsNum > 0 && Global.GetTotalGoodsCountByID(client, wishCfg.CostGoodsId) < wishCfg.CostGoodsNum) { client.sendCmd(nID, -6, false); } else if (cliReq.CostType == 2 && wishCfg.CostZuanShi > 0 && client.ClientData.UserMoney < wishCfg.CostZuanShi) { client.sendCmd(nID, -10, false); } else { if (!string.IsNullOrEmpty(cliReq.WishTxt)) { if (wishCfg.CanHaveWishTxt != 1) { client.sendCmd(nID, -25, false); return; } if (cliReq.WishTxt.Length > CoupleWishConsts.MaxWishTxtLen) { client.sendCmd(nID, -26, false); return; } } CoupleWishWishRoleReq centerReq = new CoupleWishWishRoleReq(); centerReq.From.RoleId = client.ClientData.RoleID; centerReq.From.ZoneId = client.ClientData.ZoneID; centerReq.From.RoleName = client.ClientData.RoleName; centerReq.WishType = cliReq.WishType; centerReq.WishTxt = cliReq.WishTxt; RoleData4Selector toManSelector = null; RoleData4Selector toWifeSelector = null; CoupleWishCoupleDataK rankCoupleData = null; if (cliReq.IsWishRankRole) { centerReq.IsWishRank = true; lock (this.Mutex) { int coupleIdx; if (!this.SyncData.ThisWeek.CoupleIdex.TryGetValue(cliReq.ToRankCoupleId, out coupleIdx)) { client.sendCmd(nID, -12, false); return; } rankCoupleData = this.SyncData.ThisWeek.RankList[coupleIdx]; if (rankCoupleData == null || rankCoupleData.DbCoupleId != cliReq.ToRankCoupleId || rankCoupleData.Rank > CoupleWishConsts.MaxRankNum * 2) { client.sendCmd(nID, -12, false); return; } centerReq.ToCoupleId = cliReq.ToRankCoupleId; toManSelector = Global.sendToDB <RoleData4Selector, int>(10232, rankCoupleData.Man.RoleId, client.ServerId); toWifeSelector = Global.sendToDB <RoleData4Selector, int>(10232, rankCoupleData.Wife.RoleId, client.ServerId); if (toManSelector == null || toWifeSelector == null || toManSelector.RoleID <= 0 || toWifeSelector.RoleID <= 0) { toWifeSelector = (toManSelector = null); } } } else { int toRoleId = -1; if (!string.IsNullOrEmpty(cliReq.ToLocalRoleName)) { toRoleId = RoleName2IDs.FindRoleIDByName(cliReq.ToLocalRoleName, true); } if (toRoleId <= 0) { client.sendCmd(nID, -28, false); return; } if (toRoleId == client.ClientData.RoleID) { client.sendCmd(nID, -27, false); return; } int nSpouseId = MarryLogic.GetSpouseID(toRoleId); if (nSpouseId <= 0) { client.sendCmd(nID, -29, false); return; } toManSelector = Global.sendToDB <RoleData4Selector, int>(10232, toRoleId, client.ServerId); toWifeSelector = Global.sendToDB <RoleData4Selector, int>(10232, nSpouseId, client.ServerId); if (toManSelector == null || toWifeSelector == null) { client.sendCmd(nID, -15, false); return; } if (!MarryLogic.SameSexMarry(false)) { if (toManSelector.RoleSex == toWifeSelector.RoleSex) { client.sendCmd(nID, -15, false); return; } if (toManSelector.RoleSex == 1) { DataHelper2.Swap <RoleData4Selector>(ref toManSelector, ref toWifeSelector); } } } if (toManSelector != null && toWifeSelector != null) { centerReq.ToMan.RoleId = toManSelector.RoleID; centerReq.ToMan.ZoneId = toManSelector.ZoneId; centerReq.ToMan.RoleName = toManSelector.RoleName; centerReq.ToManSelector = DataHelper.ObjectToBytes <RoleData4Selector>(toManSelector); centerReq.ToWife.RoleId = toWifeSelector.RoleID; centerReq.ToWife.ZoneId = toWifeSelector.ZoneId; centerReq.ToWife.RoleName = toWifeSelector.RoleName; centerReq.ToWifeSelector = DataHelper.ObjectToBytes <RoleData4Selector>(toWifeSelector); } int ec = TianTiClient.getInstance().CoupleWishWishRole(centerReq); if (ec < 0) { client.sendCmd(nID, ec); } else { if (cliReq.CostType == 1 && wishCfg.CostGoodsId > 0 && wishCfg.CostGoodsNum > 0) { bool oneUseBind = false; bool oneUseTimeLimit = false; Global.UseGoodsBindOrNot(client, wishCfg.CostGoodsId, wishCfg.CostGoodsNum, true, out oneUseBind, out oneUseTimeLimit); } if (cliReq.CostType == 2 && wishCfg.CostZuanShi > 0) { GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, wishCfg.CostZuanShi, "情侣祝福", true, true, false, DaiBiSySType.None); } if (wishCfg.IsHaveEffect == 1) { CoupleWishNtfWishEffectData effectData = new CoupleWishNtfWishEffectData(); effectData.From = centerReq.From; effectData.WishType = cliReq.WishType; effectData.WishTxt = cliReq.WishTxt; effectData.To = new List <KuaFuRoleMiniData>(); if (cliReq.IsWishRankRole) { effectData.To.Add(rankCoupleData.Man); effectData.To.Add(rankCoupleData.Wife); } else if (centerReq.ToMan.RoleName == cliReq.ToLocalRoleName) { effectData.To.Add(centerReq.ToMan); } else { effectData.To.Add(centerReq.ToWife); } lock (this.Mutex) { this.HandleWishEffect(effectData); } } client.sendCmd(nID, 1); } } } }