private void HandleGetMainDataCommand(GameClient client, int nID, byte[] bytes, string[] cmdParams) { if (this.IsGongNengOpened(client)) { DateTime now = TimeUtil.NowDateTime(); CoupleWishMainData mainData = new CoupleWishMainData(); lock (this.Mutex) { mainData.RankList = new List <CoupleWishCoupleData>(this.ThisWeekTopNList); mainData.CanGetAwardId = this.CheckGiveAward(client); int idx; if (this.SyncData.ThisWeek.RoleIndex.TryGetValue(client.ClientData.RoleID, out idx)) { CoupleWishCoupleDataK coupleDataK = this.SyncData.ThisWeek.RankList[idx]; if (coupleDataK.Man.RoleId == client.ClientData.RoleID || coupleDataK.Wife.RoleId == client.ClientData.RoleID) { mainData.MyCoupleRank = coupleDataK.Rank; mainData.MyCoupleBeWishNum = coupleDataK.BeWishedNum; } } } mainData.MyCoupleManSelector = Global.sendToDB <RoleData4Selector, int>(10232, client.ClientData.RoleID, client.ServerId); if (MarryLogic.IsMarried(client.ClientData.RoleID)) { mainData.MyCoupleWifeSelector = Global.sendToDB <RoleData4Selector, int>(10232, client.ClientData.MyMarriageData.nSpouseID, client.ServerId); } if (client.ClientData.RoleSex == 1) { DataHelper2.Swap <RoleData4Selector>(ref mainData.MyCoupleManSelector, ref mainData.MyCoupleWifeSelector); } client.sendCmd <CoupleWishMainData>(nID, mainData, false); } }
public KuaFuCmdData GetRebornRoleData(int ptId, int roleId, long dataAge) { try { lock (this.Mutex) { KuaFuData <KFRebornRoleData> kfRebornRoleData = null; if (!this.RebornRoleDataDict.TryGetValue(new KeyValuePair <int, int>(ptId, roleId), out kfRebornRoleData)) { return(null); } if (dataAge != kfRebornRoleData.Age) { return(new KuaFuCmdData { Age = kfRebornRoleData.Age, Bytes0 = DataHelper2.ObjectToBytes <KFRebornRoleData>(kfRebornRoleData.V) }); } return(new KuaFuCmdData { Age = kfRebornRoleData.Age }); } } catch (Exception ex) { LogManager.WriteException(ex.ToString()); } return(null); }
public void Update() { if (!IsNeedDownload()) { return; } try { ClientServerListData clientListData = new ClientServerListData(); clientListData.lTime = TimeUtil.NOW(); clientListData.strMD5 = MD5Helper.get_md5_string(ConstData.HTTP_MD5_KEY + clientListData.lTime.ToString()); byte[] clientBytes = DataHelper2.ObjectToBytes <ClientServerListData>(clientListData); byte[] responseData = WebHelper.RequestByPost(KuaFuServerManager.GetPlatChargeKingUrl, clientBytes, 2000, 30000); if (responseData == null) { return; } InputKingPaiHangDataEx tmpRankEx = DataHelper2.BytesToObject <InputKingPaiHangDataEx>(responseData, 0, responseData.Length); if (tmpRankEx != null) { rankEx = tmpRankEx; } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Error, "PlatChargeKingManager.Update exception", ex); } }
public AsyncDataItem GetHongBaoDataList(long dataAge) { try { if (this.TotalCharge > 0L) { DateTime now = TimeUtil.NowDateTime(); long nowTicks = TimeUtil.NOW(); if (now >= this.StartTime && now < this.EndTime) { lock (this.Mutex) { byte[] bytes = DataHelper2.ObjectToBytes <Dictionary <int, SystemHongBaoData> >(this.HongBaoDataDict); KuaFuCmdData cmdData = new KuaFuCmdData { Age = nowTicks, Bytes0 = bytes }; return(new AsyncDataItem(KuaFuEventTypes.ChongZhiHongBaoList, new object[] { cmdData })); } } } } catch (Exception ex) { } return(null); }
/// <summary> /// 输入明文和密钥,输出密文 /// </summary> /// <param name="plainText"></param> /// <param name="key"></param> /// <returns></returns> public static string Encrypt(string plainText, string passwd, string saltValue) { if (string.IsNullOrEmpty(plainText)) { return(null); } byte[] bytesData = null; try { bytesData = new UTF8Encoding().GetBytes(plainText); } catch (Exception) { return(null); } byte[] bytesResult = null; try { bytesResult = AesHelper.AesEncryptBytes(bytesData, passwd, saltValue); } catch (Exception) { return(null); } return(DataHelper2.Bytes2HexString(bytesResult)); }
public RebornSyncData Reborn_SyncData(long ageRank, long ageBoss) { try { RebornSyncData SyncData = new RebornSyncData(); lock (this.Mutex) { SyncData.RebornRankDict.Age = this.RebornRankDict.Age; SyncData.BossRefreshDict.Age = this.BossRefreshDict.Age; if (ageRank != this.RebornRankDict.Age) { SyncData.BytesRebornRankDict = DataHelper2.ObjectToBytes <KuaFuData <Dictionary <int, List <KFRebornRankInfo> > > >(this.RebornRankDict); } if (ageBoss != this.BossRefreshDict.Age) { SyncData.BytesRebornBossRefreshDict = DataHelper2.ObjectToBytes <KuaFuData <Dictionary <KeyValuePair <int, int>, KFRebornBossRefreshData> > >(this.BossRefreshDict); } } return(SyncData); } catch (Exception ex) { LogManager.WriteException(ex.ToString()); } return(null); }
public int UpdateZhanDui(TianTi5v5ZhanDuiData data) { string sql = string.Format("update t_kf_5v5_zhandui set `leaderid`={1},`xuanyan`='{2}',`zhanduiname`='{3}',`duanweiid`='{4}',`zhanli`='{5}',`data1`=@data1,leaderrolename='{6}',`liansheng`='{7}',`fightcount`='{8}',`successcount`='{9}',lastfighttime='{10}',`duanweijifen`='{11}',`duanweirank`='{12}',`monthduanweirank`='{13}' where `zhanduiid`={0};", new object[] { data.ZhanDuiID, data.LeaderRoleID, data.XuanYan, data.ZhanDuiName, data.DuanWeiId, data.ZhanDouLi, data.LeaderRoleName, data.LianSheng, data.FightCount, data.SuccessCount, data.LastFightTime, data.DuanWeiJiFen, data.DuanWeiRank, data.MonthDuanWeiRank }); int result; if (!this.AddDelayWriteSql(sql, new List <Tuple <string, byte[]> > { new Tuple <string, byte[]>("@data1", DataHelper2.ObjectToBytes <List <TianTi5v5ZhanDuiRoleData> >(data.teamerList)) }, null)) { result = -11000; } else { result = 0; } return(result); }
public KuaFuCmdData GetEraData(int juntuanid, long dataAge) { KuaFuCmdData result; lock (this.Mutex) { if (0 == this.RuntimeData.CurrentEraID) { result = null; } else { KuaFuData <KFEraData> data = null; if (juntuanid == 0 && 0L == dataAge) { data = new KuaFuData <KFEraData>(); data.V.EraID = this.RuntimeData.CurrentEraID; TimeUtil.AgeByNow(ref data.Age); } else { if (!this.EraDataDict.TryGetValue(juntuanid, out data)) { data = new KuaFuData <KFEraData>(); data.V.EraID = this.RuntimeData.CurrentEraID; data.V.JunTuanID = juntuanid; data.V.EraStage = 1; TimeUtil.AgeByNow(ref data.Age); this.EraDataDict[juntuanid] = data; } if (data.V.FastEraStage != this.RuntimeData.CurFastEraStage || data.V.FastEraStateProcess != this.RuntimeData.CurFastEraStateProcess) { TimeUtil.AgeByNow(ref data.Age); } } data.V.FastEraStage = this.RuntimeData.CurFastEraStage; data.V.FastEraStateProcess = this.RuntimeData.CurFastEraStateProcess; if (dataAge != data.Age) { result = new KuaFuCmdData { Age = data.Age, Bytes0 = DataHelper2.ObjectToBytes <KFEraData>(data.V) }; } else { result = new KuaFuCmdData { Age = data.Age }; } } } return(result); }
public KFRebornRoleData Reborn_GetRebornRoleData(int ptId, int roleId) { try { IKuaFuWorld kuaFuService = this.GetKuaFuService(false); if (null == kuaFuService) { return(null); } try { lock (this.Mutex) { KeyValuePair <int, int> key = new KeyValuePair <int, int>(ptId, roleId); KuaFuData <KFRebornRoleData> RebornRoleData = null; if (!this.RebornRoleDataDict.TryGetValue(key, out RebornRoleData)) { RebornRoleData = new KuaFuData <KFRebornRoleData>(); this.RebornRoleDataDict[key] = RebornRoleData; } KuaFuCmdData result = kuaFuService.Reborn_GetRebornRoleData(ptId, roleId, RebornRoleData.Age); if (result == null || result.Age < 0L) { return(null); } if (result != null && result.Age > RebornRoleData.Age) { RebornRoleData.Age = result.Age; if (null != result.Bytes0) { RebornRoleData.V = DataHelper2.BytesToObject <KFRebornRoleData>(result.Bytes0, 0, result.Bytes0.Length); } if (null != RebornRoleData.V) { this.RebornRoleDataDict[key] = RebornRoleData; } } return(RebornRoleData.V); } } catch (Exception ex) { this.ResetKuaFuService(); } } catch (Exception ex) { LogManager.WriteException(ex.ToString()); } return(null); }
public void PushMemoryStream(MemoryStream ms) { try { if (QueueMemoryStream.Count <= QueueMemoryStreamMaxSize) { QueueMemoryStream.Enqueue(ms); } } catch (System.Exception ex) { DataHelper2.WriteExceptionLogEx(ex, ""); } }
/// <summary> /// 从缓存队列中提取所需内存对象 /// </summary> /// <param name="needSize"></param> /// <returns></returns> public MemoryBlock PopMemoryBlock(int needSize) { try { int index = Log2(needSize); int blockSize = MemoryBlockSizeArray[index]; if (blockSize > 0) { if (blockSize < needSize) { index++; } if (MemoryBlockStackArray[index].Count > 0) { return(MemoryBlockStackArray[index].Pop()); } else { if (null != PopMemoryBlockHandler) { return(PopMemoryBlockHandler(needSize)); } return(null); } } else { if (MemoryBlockStackArray[index].Count > 0) { return(MemoryBlockStackArray[index].Pop()); } else { if (null != PopMemoryBlockHandler) { return(PopMemoryBlockHandler(needSize)); } return(null); } } } catch (System.Exception ex) { DataHelper2.WriteExceptionLogEx(ex, ""); } return(null); }
public static int GetUniqueClientId() { int uniqueClientId = DataHelper2.UnixSecondsNow(); lock (UniqueClientIdMutex) { UniqueClientId++; if (UniqueClientId < uniqueClientId) { UniqueClientId = uniqueClientId; } uniqueClientId = UniqueClientId; } return(uniqueClientId); }
/// <summary> /// 将内存块还回缓存队列 /// </summary> /// <param name="item"></param> public void PushMemoryBlock(MemoryBlock item) { try { int index = Log2(item.BlockSize); int blockSize = MemoryBlockSizeArray[index]; if (blockSize > 0) { if (blockSize < item.BlockSize) { index++; } if (MemoryBlockStackArray[index].Count <= MemoryBlockNumArray[index]) { MemoryBlockStackArray[index].Push(item); } else { if (null != PushMemoryBlockHandler) { PushMemoryBlockHandler(item); } } } else { if (MemoryBlockStackArray[index].Count <= MemoryBlockNumArray[index]) { MemoryBlockStackArray[index].Push(item); } else { if (null != PushMemoryBlockHandler) { PushMemoryBlockHandler(item); } } } } catch (System.Exception ex) { DataHelper2.WriteExceptionLogEx(ex, ""); } }
public bool LoadZhanDuiData(Dictionary <int, TianTi5v5ZhanDuiData> dict) { bool result = false; string sql = "select `zhanduiid`,`leaderid`,`xuanyan`,`zhanduiname`,`duanweiid`,`zhanli`,`data1`,`duanweijifen`,`duanweirank`,`liansheng`,`fightcount`,`successcount`,`lastfighttime`,`monthduanweirank`,leaderrolename,zoneid,zorkjifen,zorklastfighttime,escapejifen,escapelastfighttime from t_kf_5v5_zhandui"; using (MySqlDataReader reader = DbHelperMySQL.ExecuteReader(sql, false)) { result = true; while (reader.Read()) { try { TianTi5v5ZhanDuiData data = new TianTi5v5ZhanDuiData(); data.ZhanDuiID = Convert.ToInt32(reader[0].ToString()); data.LeaderRoleID = Convert.ToInt32(reader["leaderid"].ToString()); data.XuanYan = reader["xuanyan"].ToString(); data.ZhanDuiName = reader["zhanduiname"].ToString(); data.DuanWeiId = Convert.ToInt32(reader["duanweiid"].ToString()); data.ZhanDouLi = Convert.ToInt64(reader["zhanli"].ToString()); byte[] bytes = (reader["data1"] as byte[]) ?? new byte[0]; data.teamerList = DataHelper2.BytesToObject <List <TianTi5v5ZhanDuiRoleData> >(bytes, 0, bytes.Length); data.DuanWeiJiFen = Convert.ToInt32(reader["duanweijifen"].ToString()); data.DuanWeiRank = Convert.ToInt32(reader["duanweirank"].ToString()); data.LianSheng = Convert.ToInt32(reader["liansheng"].ToString()); data.FightCount = Convert.ToInt32(reader["fightcount"].ToString()); data.SuccessCount = Convert.ToInt32(reader["successcount"].ToString()); data.LastFightTime = Convert.ToDateTime(reader["lastfighttime"].ToString()); data.MonthDuanWeiRank = Convert.ToInt32(reader["monthduanweirank"].ToString()); data.LeaderRoleName = reader["leaderrolename"].ToString(); data.ZoneID = Convert.ToInt32(reader["zoneid"].ToString()); data.ZorkJiFen = Convert.ToInt32(reader["zorkjifen"].ToString()); data.ZorkLastFightTime = Convert.ToDateTime(reader["zorklastfighttime"].ToString()); data.EscapeJiFen = Convert.ToInt32(reader["escapejifen"].ToString()); data.EscapeLastFightTime = Convert.ToDateTime(reader["escapelastfighttime"].ToString()); dict[data.ZhanDuiID] = data; } catch (Exception ex) { LogManager.WriteException(ex.ToString()); } } } return(result); }
public int InitZhanDui(TianTi5v5ZhanDuiData data) { string sql = string.Format("INSERT INTO t_kf_5v5_zhandui(`leaderid`,`xuanyan`,`zhanduiname`,`duanweiid`,`zhanli`,`data1`,`leaderrolename`,zoneid) VALUES('{1}','{2}','{3}','{4}','{5}',@content,'{6}',{7});", new object[] { data.ZhanDuiID, data.LeaderRoleID, data.XuanYan, data.ZhanDuiName, data.DuanWeiId, data.ZhanDouLi, data.LeaderRoleName, data.ZoneID }); List <Tuple <string, byte[]> > imgList = new List <Tuple <string, byte[]> >(); imgList.Add(new Tuple <string, byte[]>("@content", DataHelper2.ObjectToBytes <List <TianTi5v5ZhanDuiRoleData> >(data.teamerList))); LogManager.WriteLog(LogTypes.SQL, sql, null, true); return((int)DbHelperMySQL.ExecuteSqlGetIncrement(sql, imgList)); }
public KuaFuLueDuoBHData GetBHDataByBhid_KuaFuLueDuo(int bhid) { IKuaFuService kuaFuService = this.GetKuaFuService(false); if (null != kuaFuService) { try { lock (this.Mutex) { KuaFuData <KuaFuLueDuoBHData> bhdata = null; if (!this.KuaFuLueDuoBHDataDict.TryGetValue(bhid, out bhdata)) { bhdata = new KuaFuData <KuaFuLueDuoBHData>(); this.KuaFuLueDuoBHDataDict[bhid] = bhdata; } KuaFuCmdData result = kuaFuService.GetBHDataByBhid_KuaFuLueDuo(bhid, bhdata.Age); if (result == null || result.Age < 0L) { return(null); } if (result != null && result.Age > bhdata.Age) { bhdata.Age = result.Age; if (null != result.Bytes0) { bhdata.V = DataHelper2.BytesToObject <KuaFuLueDuoBHData>(result.Bytes0, 0, result.Bytes0.Length); } if (null != bhdata.V) { this.KuaFuLueDuoBHDataDict[bhid] = bhdata; } } return(bhdata.V); } } catch (Exception ex) { LogManager.WriteException(ex.ToString()); } } return(null); }
public MemoryStream PopMemoryStream() { try { if (QueueMemoryStream.Count > 0) { MemoryStream ms = QueueMemoryStream.Dequeue(); ms.Position = 0; ms.SetLength(0); return(ms); } } catch (System.Exception ex) { DataHelper2.WriteExceptionLogEx(ex, ""); } return(new MemoryStream()); }
/// <summary> /// 玩家查看情侣祝福主界面 /// </summary> /// <param name="client"></param> /// <param name="nID"></param> /// <param name="bytes"></param> /// <param name="cmdParams"></param> private void HandleGetMainDataCommand(GameClient client, int nID, byte[] bytes, string[] cmdParams) { if (!IsGongNengOpened(client)) { return; } DateTime now = TimeUtil.NowDateTime(); CoupleWishMainData mainData = new CoupleWishMainData(); lock (Mutex) { mainData.RankList = new List <CoupleWishCoupleData>(ThisWeekTopNList); mainData.CanGetAwardId = CheckGiveAward(client); int idx; if (SyncData.ThisWeek.RoleIndex.TryGetValue(client.ClientData.RoleID, out idx)) { CoupleWishCoupleDataK coupleDataK = SyncData.ThisWeek.RankList[idx]; if (coupleDataK.Man.RoleId == client.ClientData.RoleID || coupleDataK.Wife.RoleId == client.ClientData.RoleID) { mainData.MyCoupleRank = coupleDataK.Rank; mainData.MyCoupleBeWishNum = coupleDataK.BeWishedNum; } } } mainData.MyCoupleManSelector = Global.sendToDB <RoleData4Selector, string>((int)TCPGameServerCmds.CMD_SPR_GETROLEUSINGGOODSDATALIST, string.Format("{0}", client.ClientData.RoleID), client.ServerId); if (MarryLogic.IsMarried(client.ClientData.RoleID)) { mainData.MyCoupleWifeSelector = Global.sendToDB <RoleData4Selector, string>((int)TCPGameServerCmds.CMD_SPR_GETROLEUSINGGOODSDATALIST, string.Format("{0}", client.ClientData.MyMarriageData.nSpouseID), client.ServerId); } if (client.ClientData.RoleSex == (int)ERoleSex.Girl) { DataHelper2.Swap(ref mainData.MyCoupleManSelector, ref mainData.MyCoupleWifeSelector); } client.sendCmd(nID, mainData); }
public void UpdateZhanDuiDayRank(List <TianTi5v5ZhanDuiData> list, int dayId, int maxRankCount, bool updateMonthRank) { try { this.AddDelayWriteSql("delete from t_kf_5v5_zhandui_paihang where dayid=" + dayId, null, null); int i = 0; while (i < maxRankCount && i < list.Count) { TianTi5v5ZhanDuiData data = list[i]; string sql = string.Format("REPLACE INTO t_kf_5v5_zhandui_paihang (`dayid`,`zhanduiid`,`leaderid`,`xuanyan`,`zhanduiname`,`leaderrolename`,`zoneid`,`zhanli`,`data1`,`data2`,`duanweiid`,`duanweijifen`,`duanweirank`,`monthduanweirank`,`liansheng`,`fightcount`,`successcount`,`lastfighttime`) VALUES({15},{0},{1},'{2}','{3}','{4}',{5},{6},@data1,@data2,{7},{8},{9},{10},{11},{12},{13},'{14}');", new object[] { data.ZhanDuiID, data.LeaderRoleID, data.XuanYan, data.ZhanDuiName, data.LeaderRoleName, data.ZoneID, data.ZhanDouLi, data.DuanWeiId, data.DuanWeiJiFen, data.DuanWeiRank, data.MonthDuanWeiRank, data.LianSheng, data.FightCount, data.SuccessCount, data.LastFightTime, dayId }); this.AddDelayWriteSql(sql, new List <Tuple <string, byte[]> > { new Tuple <string, byte[]>("@data1", DataHelper2.ObjectToBytes <List <TianTi5v5ZhanDuiRoleData> >(data.teamerList)), new Tuple <string, byte[]>("@data2", null) }, null); i++; } } catch (Exception ex) { LogManager.WriteException(ex.ToString()); } }
public int LoadZhanDuiRankList(List <TianTi5v5ZhanDuiData> list, int dayID) { int result = 0; string sql = string.Format("select `zhanduiid`,`leaderid`,`xuanyan`,`zhanduiname`,`duanweiid`,`zhanli`,`data1`,`duanweijifen`,`duanweirank`,`liansheng`,`fightcount`,`successcount`,`lastfighttime`,`monthduanweirank`,leaderrolename,zoneid from t_kf_5v5_zhandui_paihang where dayid={0} order by duanweirank", dayID); using (MySqlDataReader reader = DbHelperMySQL.ExecuteReader(sql, false)) { result = 1; while (reader.Read()) { try { TianTi5v5ZhanDuiData data = new TianTi5v5ZhanDuiData(); data.ZhanDuiID = Convert.ToInt32(reader[0].ToString()); data.LeaderRoleID = Convert.ToInt32(reader["leaderid"].ToString()); data.XuanYan = reader["xuanyan"].ToString(); data.ZhanDuiName = reader["zhanduiname"].ToString(); data.DuanWeiId = Convert.ToInt32(reader["duanweiid"].ToString()); data.ZhanDouLi = Convert.ToInt64(reader["zhanli"].ToString()); byte[] bytes = (reader["data1"] as byte[]) ?? new byte[0]; data.teamerList = DataHelper2.BytesToObject <List <TianTi5v5ZhanDuiRoleData> >(bytes, 0, bytes.Length); data.DuanWeiJiFen = Convert.ToInt32(reader["duanweijifen"].ToString()); data.DuanWeiRank = Convert.ToInt32(reader["duanweirank"].ToString()); data.LianSheng = Convert.ToInt32(reader["liansheng"].ToString()); data.FightCount = Convert.ToInt32(reader["fightcount"].ToString()); data.SuccessCount = Convert.ToInt32(reader["successcount"].ToString()); data.LastFightTime = Convert.ToDateTime(reader["lastfighttime"].ToString()); data.MonthDuanWeiRank = Convert.ToInt32(reader["monthduanweirank"].ToString()); data.LeaderRoleName = reader["leaderrolename"].ToString(); data.ZoneID = Convert.ToInt32(reader["zoneid"].ToString()); list.Add(data); } catch (Exception ex) { LogManager.WriteException(ex.ToString()); } } } return(result); }
public KuaFuCmdData GetEraRankData(long dataAge) { KuaFuCmdData result; lock (this.Mutex) { if (dataAge != this.EraRankList.Age) { result = new KuaFuCmdData { Age = this.EraRankList.Age, Bytes0 = DataHelper2.ObjectToBytes <List <KFEraRankData> >(this.EraRankList.V) }; } else { result = new KuaFuCmdData { Age = this.EraRankList.Age }; } } return(result); }
private bool BuildZhengBaRank(int nowMonth, List <ZhanDuiZhengBaZhanDuiData> rankList) { bool bMonthFirst = false; try { foreach (ZhanDuiZhengBaZhanDuiData roleData in rankList) { string repSql = string.Format("REPLACE INTO t_zhandui_zhengba(`month`,zhanduiid,zoneid,zhanduiname,duanweiid,duanweijifen,duanweirank,zhanli,`grade`,`group`,state,data1,data2) VALUES({0},{1},{2},'{3}',{4},{5},{6},{7},{8},{9},{10},@content,null)", new object[] { nowMonth, roleData.ZhanDuiID, roleData.ZoneId, roleData.ZhanDuiName, roleData.DuanWeiId, 0, roleData.DuanWeiRank, roleData.ZhanLi, 64, roleData.Group, 0 }); DbHelperMySQL.ExecuteSqlInsertImg(repSql, new List <Tuple <string, byte[]> > { new Tuple <string, byte[]>("content", DataHelper2.ObjectToBytes <List <RoleOccuNameZhanLi> >(roleData.MemberList)) }); } DbHelperMySQL.ExecuteSql(string.Format("REPLACE INTO t_async(`id`,`value`) VALUES({0},{1});", 13, nowMonth)); bMonthFirst = true; } catch (Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); } return(bMonthFirst); }
private List <ZhanDuiZhengBaZhanDuiData> LoadZhengBaRankData(int nowMonth) { List <ZhanDuiZhengBaZhanDuiData> roleList = new List <ZhanDuiZhengBaZhanDuiData>(); try { string strSql = string.Format("SELECT zhanduiid,zhanduiname,zoneid,duanweiid,duanweijifen,duanweirank,zhanli,grade,`group`,state,data1,data2 FROM t_zhandui_zhengba where `month`={0} ORDER BY duanweirank ASC;", nowMonth); using (MySqlDataReader sdr = DbHelperMySQL.ExecuteReader(strSql, false)) { while (sdr != null && sdr.Read()) { ZhanDuiZhengBaZhanDuiData roleData = new ZhanDuiZhengBaZhanDuiData(); roleData.ZhanDuiID = Convert.ToInt32(sdr["zhanduiid"]); roleData.ZoneId = Convert.ToInt32(sdr["zoneid"]); roleData.ZhanDuiName = sdr["zhanduiname"].ToString(); roleData.DuanWeiId = Convert.ToInt32(sdr["duanweiid"]); roleData.DuanWeiRank = Convert.ToInt32(sdr["duanweirank"]); roleData.ZhanLi = Convert.ToInt64(sdr["zhanli"]); if (!sdr.IsDBNull(sdr.GetOrdinal("data1"))) { byte[] bytes = (byte[])sdr["data1"]; roleData.MemberList = DataHelper2.BytesToObject <List <RoleOccuNameZhanLi> >(bytes, 0, bytes.Length); } roleData.Grade = Convert.ToInt32(sdr["grade"]); roleData.Group = Convert.ToInt32(sdr["group"]); roleData.State = Convert.ToInt32(sdr["state"]); roleList.Add(roleData); } } } catch (Exception ex) { LogManager.WriteException(ex.ToString()); } return(roleList); }
/// <summary> /// 输入密文和密钥,输出明文 /// </summary> /// <param name="plainText"></param> /// <param name="key"></param> /// <returns></returns> public static string Decrypt(string encryptText, string passwd, string saltValue) { if (string.IsNullOrEmpty(encryptText)) { return(null); } byte[] bytesData = DataHelper2.HexString2Bytes(encryptText); if (null == bytesData) { return(null); } byte[] bytesResult = null; try { bytesResult = AesHelper.AesDecryptBytes(bytesData, passwd, saltValue); } catch (Exception) { return(null); } string strResult = null; try { strResult = new UTF8Encoding().GetString(bytesResult, 0, bytesResult.Length); } catch (Exception) //解析错误 { return(null); } return(strResult); }
/// <summary> /// 检测生成众生争霸排行榜 /// </summary> /// <param name="now"></param> private bool CheckBuildZhengBaRank(int selectRoleIfNewCreate, int nowMonth) { bool bMonthFirst = false; try { DbHelperMySQL.ExecuteSql( string.Format("INSERT IGNORE INTO t_async(`id`,`value`) VALUES({0},{1});", AsyncTypes.ZhengBaCurrMonth, ZhengBaConsts.DefaultAsyncMonth) ); // 防止人为的重新reload月排行榜导致众神争霸战斗信息丢失 /* 这里有一些细节要注意: * 1:每月1号凌晨3点更新月排行榜,然后触发更新争霸角色 * 2: 服务器启动的时候,尝试生成争霸角色 * 3:要防止当月的争霸角色重复生成 * 4:必须保证天梯排行角色已经生成,才能生成争霸角色 -->例如,1号凌晨两点启动,必须保证等到3点的时候,天梯月排行榜生成之后,能够生成本月的争霸角色 */ int oldMonth = (int)DbHelperMySQL.GetSingle("select value from t_async where id = " + AsyncTypes.ZhengBaCurrMonth); object ageObj_tiantiMonth = DbHelperMySQL.GetSingle("select value from t_async where id = " + AsyncTypes.TianTiPaiHangModifyOffsetDay); if (oldMonth != nowMonth && ageObj_tiantiMonth != null && ZhengBaUtils.MakeMonth(DataHelper2.GetRealDate((int)ageObj_tiantiMonth)) == nowMonth) { string strSql = string.Format("SELECT rid,rname,zoneid,duanweiid,duanweijifen,duanweirank,zhanli,data1,data2 FROM t_tianti_month_paihang ORDER BY duanweirank ASC LIMIT {0};", selectRoleIfNewCreate); var sdr = DbHelperMySQL.ExecuteReader(strSql); while (sdr != null && sdr.Read()) { ZhengBaRoleInfoData roleData = new ZhengBaRoleInfoData(); roleData.RoleId = (int)Convert.ToInt32(sdr["rid"]); roleData.ZoneId = (int)Convert.ToInt32(sdr["zoneid"]); roleData.DuanWeiId = (int)Convert.ToInt32(sdr["duanweiid"]); roleData.DuanWeiJiFen = (int)Convert.ToInt32(sdr["duanweijifen"]); roleData.DuanWeiRank = (int)Convert.ToInt32(sdr["duanweirank"]); roleData.ZhanLi = (int)Convert.ToInt32(sdr["zhanli"]); roleData.RoleName = sdr["rname"].ToString(); if (!sdr.IsDBNull(sdr.GetOrdinal("data1"))) { roleData.TianTiPaiHangRoleData = (byte[])(sdr["data1"]); } if (!sdr.IsDBNull(sdr.GetOrdinal("data2"))) { roleData.PlayerJingJiMirrorData = (byte[])(sdr["data2"]); } if (string.IsNullOrEmpty(roleData.RoleName) && roleData.TianTiPaiHangRoleData != null) { var onlyName = DataHelper2.BytesToObject <TianTiPaiHangRoleData_OnlyName>( roleData.TianTiPaiHangRoleData, 0, roleData.TianTiPaiHangRoleData.Length); if (onlyName != null) { roleData.RoleName = onlyName.RoleName; } } string repSql = string.Format( "REPLACE INTO t_zhengba_roles(`month`,rid,zoneid,duanweiid,duanweijifen,duanweirank,zhanli,`grade`,`group`,state,rname,data1,data2) " + "VALUES({0},{1},{2},{3},{4},{5},{6},{7},{8},{9},'{10}',@content,@mirror)", nowMonth, roleData.RoleId, roleData.ZoneId, roleData.DuanWeiId, roleData.DuanWeiJiFen, roleData.DuanWeiRank, roleData.ZhanLi, (int)EZhengBaGrade.Grade100, (int)ZhengBaConsts.NoneGroup, (int)EZhengBaState.None, roleData.RoleName); DbHelperMySQL.ExecuteSqlInsertImg(repSql, new List <Tuple <string, byte[]> > { new Tuple <string, byte[]>("content", roleData.TianTiPaiHangRoleData), new Tuple <string, byte[]>("mirror", roleData.PlayerJingJiMirrorData) }); } if (sdr != null) { sdr.Close(); } DbHelperMySQL.ExecuteSql( string.Format("REPLACE INTO t_async(`id`,`value`) VALUES({0},{1});", AsyncTypes.ZhengBaCurrMonth, nowMonth) ); bMonthFirst = true; } } catch (Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); } return(bMonthFirst); }
public void Update() { try { lock (this.Mutex) { if (this.IsNeedDownload()) { bool flag = false; List <InputKingPaiHangDataEx> list = new List <InputKingPaiHangDataEx>(); if (KuaFuServerManager.GetPlatChargeKingUrl != null) { for (int i = 0; i < KuaFuServerManager.GetPlatChargeKingUrl.Length; i++) { ClientServerListData clientListData = new ClientServerListData(); clientListData.lTime = TimeUtil.NOW(); clientListData.strMD5 = MD5Helper.get_md5_string(ConstData.HTTP_MD5_KEY + clientListData.lTime.ToString()); byte[] clientBytes = DataHelper2.ObjectToBytes <ClientServerListData>(clientListData); byte[] responseData = WebHelper.RequestByPost(KuaFuServerManager.GetPlatChargeKingUrl[i], clientBytes, 2000, 30000); if (responseData == null) { flag = true; break; } InputKingPaiHangDataEx tmpRankEx = DataHelper2.BytesToObject <InputKingPaiHangDataEx>(responseData, 0, responseData.Length); if (tmpRankEx == null) { flag = true; break; } list.Add(tmpRankEx); } if (flag) { this.rankEx = new InputKingPaiHangDataEx(); } else { this.rankEx = this.MergePlatfromInputKingList(list); } } } if (this.IsNeedDownloadEveryDay()) { if (KuaFuServerManager.GetPlatChargeKingUrl_EveryDay != null) { bool flag = false; Dictionary <int, List <InputKingPaiHangDataEx> > dict = new Dictionary <int, List <InputKingPaiHangDataEx> >(); for (int i = 0; i < KuaFuServerManager.GetPlatChargeKingUrl_EveryDay.Length; i++) { List <InputKingPaiHangDataEx> tempRankExList = new List <InputKingPaiHangDataEx>(); if (this.MeiRiPCKingFromDate < this.MeiRiPCKingToDate) { DateTime timeLoop = this.MeiRiPCKingFromDate; while (timeLoop < this.MeiRiPCKingToDate && timeLoop < TimeUtil.NowDateTime()) { InputKingPaiHangDataEx tmpRankEx = null; byte[] clientBytes = DataHelper2.ObjectToBytes <InputKingPaiHangDataSearch>(new InputKingPaiHangDataSearch { startDate = timeLoop.ToString("yyyy-MM-dd HH:mm:ss"), endDate = timeLoop.AddDays(1.0).AddSeconds(-1.0).ToString("yyyy-MM-dd HH:mm:ss") }); byte[] responseData = WebHelper.RequestByPost(KuaFuServerManager.GetPlatChargeKingUrl_EveryDay[i], clientBytes, 2000, 30000); if (responseData != null) { tmpRankEx = DataHelper2.BytesToObject <InputKingPaiHangDataEx>(responseData, 0, responseData.Length); } if (null != tmpRankEx) { tempRankExList.Add(tmpRankEx); } else { tempRankExList.Add(new InputKingPaiHangDataEx()); flag = true; } if (flag) { break; } timeLoop = timeLoop.AddDays(1.0); } if (flag) { break; } if (!dict.ContainsKey(i)) { dict.Add(i, tempRankExList); } } } if (flag) { this.rankExList = new List <InputKingPaiHangDataEx>(); } else { this.rankExList = this.MergePlatfromInputKingListEveryDay(dict); } } } } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Error, "PlatChargeKingManager.Update exception", ex, true); } }
public void LoadTianTiRankData(DateTime now) { try { ExecuteSqlNoQuery("INSERT IGNORE INTO t_async(`id`,`value`) VALUES(4,1);"); object ageObj = DbHelperMySQL.GetSingle("select value from t_async where id = " + AsyncTypes.TianTiPaiHangModifyOffsetDay); if (null != ageObj) { int dayId = (int)ageObj; DateTime modifyDate = DataHelper2.GetRealDate(dayId); List <TianTiRoleInfoData> tianTiRoleInfoDataList = new List <TianTiRoleInfoData>(); List <TianTiRoleInfoData> tianTiMonthRoleInfoDataList = new List <TianTiRoleInfoData>(); MySqlDataReader sdr = null; try { LoadTianTiRankDayList(tianTiRoleInfoDataList); //ReloadTianTiRankDayList(tianTiRoleInfoDataList); sdr = DbHelperMySQL.ExecuteReader(string.Format("SELECT rid,rname,zoneid,duanweiid,duanweijifen,duanweirank,zhanli,data1,data2 FROM t_tianti_month_paihang ORDER BY `duanweirank` ASC LIMIT {0};", RankData.MaxPaiMingRank)); for (int index = 1; sdr.Read(); index++) { TianTiRoleInfoData tianTiRoleInfoData = new TianTiRoleInfoData(); tianTiRoleInfoData.RoleId = (int)Convert.ToInt32(sdr["rid"]); if (index <= MaxSendDetailDataCount) { tianTiRoleInfoData.ZoneId = (int)Convert.ToInt32(sdr["zoneid"]); tianTiRoleInfoData.DuanWeiId = (int)Convert.ToInt32(sdr["duanweiid"]); tianTiRoleInfoData.DuanWeiJiFen = (int)Convert.ToInt32(sdr["duanweijifen"]); //tianTiRoleInfoData.DuanWeiRank = (int)Convert.ToInt32(sdr["duanweirank"]); tianTiRoleInfoData.ZhanLi = (int)Convert.ToInt32(sdr["zhanli"]); tianTiRoleInfoData.RoleName = sdr["rname"].ToString(); if (!sdr.IsDBNull(sdr.GetOrdinal("data1"))) { tianTiRoleInfoData.TianTiPaiHangRoleData = (byte[])(sdr["data1"]); } // if (!sdr.IsDBNull(sdr.GetOrdinal("data2"))) tianTiRoleInfoData.PlayerJingJiMirrorData = (byte[])(sdr["data2"]); } tianTiRoleInfoData.DuanWeiRank = index; tianTiMonthRoleInfoDataList.Add(tianTiRoleInfoData); } } catch (System.Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); } finally { if (null != sdr) { sdr.Close(); } } lock (Mutex) { RankData.ModifyTime = modifyDate; RankData.TianTiRoleInfoDataList = tianTiRoleInfoDataList; RankData.TianTiMonthRoleInfoDataList = tianTiMonthRoleInfoDataList; } if (DataHelper2.GetOffsetDay(now) != dayId) { UpdateTianTiRankData(now, modifyDate.Month != now.Month, true); } } } catch (System.Exception ex) { LogManager.WriteException(ex.ToString()); } }
public void UpdateTianTiRankData(DateTime now, bool monthRank = false, bool force = false) { if (Monitor.TryEnter(MutexPaiHang)) { try { if (!force) { lock (Mutex) { if (RankData.ModifyTime.DayOfYear == now.DayOfYear) { return; } } } if (!monthRank) { if (now.Day == 1) { monthRank = true; } } List <TianTiRoleInfoData> tianTiRoleInfoDataList = new List <TianTiRoleInfoData>(); string strSql = ""; MySqlDataReader sdr = null; try { ReloadTianTiRankDayList(tianTiRoleInfoDataList); } catch (System.Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); return; } finally { if (null != sdr) { sdr.Close(); } } int ret = 0; try { if (tianTiRoleInfoDataList.Count > 0) { ret = DbHelperMySQL.ExecuteSql(string.Format("UPDATE t_tianti_roles SET `duanweirank`={0}", RankData.MaxPaiMingRank + 1)); if (ret >= 0) { ret = DbHelperMySQL.ExecuteSql("DELETE FROM t_tianti_day_paihang;"); } if (ret >= 0) { int c = tianTiRoleInfoDataList.Count; int numPerExec = 50; for (int i = 0; i < c; i++) { if (i % numPerExec == 0) { strSql = "INSERT INTO t_tianti_day_paihang(rid,rank) VALUES"; } strSql += string.Format("({0},{1})", tianTiRoleInfoDataList[i].RoleId, tianTiRoleInfoDataList[i].DuanWeiRank); if ((i % numPerExec) == (numPerExec - 1) || i == (c - 1)) { DbHelperMySQL.ExecuteSql(strSql); } else { strSql += ','; } } DbHelperMySQL.ExecuteSql("UPDATE t_tianti_roles r, t_tianti_day_paihang d SET r.`duanweirank` = d.`rank` WHERE r.`rid` = d.`rid`;"); if (monthRank) { DbHelperMySQL.ExecuteSql("DELETE FROM t_tianti_month_paihang;"); strSql = "INSERT INTO t_tianti_month_paihang SELECT * FROM t_tianti_roles WHERE rid IN (SELECT rid FROM t_tianti_day_paihang) ORDER BY `duanweirank` ASC;"; DbHelperMySQL.ExecuteSql(strSql); DbHelperMySQL.ExecuteSql("DELETE FROM t_tianti_day_paihang;"); DbHelperMySQL.ExecuteSql("UPDATE t_tianti_roles SET `duanweirank`=0,`duanweijifen`=0,`duanweiid`=0;"); } } if (ret >= 0) { strSql = string.Format("UPDATE t_async SET `value`={1} WHERE `id`={0};", AsyncTypes.TianTiPaiHangModifyOffsetDay, DataHelper2.GetOffsetDay(now)); ExecuteSqlNoQuery(strSql); } } lock (Mutex) { RankData.ModifyTime = now; if (monthRank) { RankData.TianTiRoleInfoDataList = new List <TianTiRoleInfoData>(); RankData.TianTiMonthRoleInfoDataList = tianTiRoleInfoDataList; } else { RankData.TianTiRoleInfoDataList = tianTiRoleInfoDataList; } } if (monthRank) { try { // 这里是为了保证跨服中心月初跨天的时候,更新 ZhengBaManagerK.Instance().ReloadSyncData(now); } catch (Exception ex) { LogManager.WriteLog(LogTypes.Error, "UpdateTianTiRankData -> zhengba reload execption", ex); } } } catch (System.Exception ex) { ret = -1; LogManager.WriteException(ex.ToString()); } } finally { Monitor.Exit(MutexPaiHang); } } }
public byte[] SyncData_KuaFuLueDuo(byte[] bytes) { return(DataHelper2.ObjectToBytes <KuaFuLueDuoSyncData>(KuaFuLueDuoService.Instance().SyncData_KuaFuLueDuo(bytes))); }
public static MarryResult MarryDivorce(GameClient client, MarryDivorceType divorceType) { MarryResult result; if (!MarryLogic.IsVersionSystemOpenOfMarriage()) { result = MarryResult.NotOpen; } else if (0 >= client.ClientData.MyMarriageData.byMarrytype) { result = MarryResult.NotMarried; } else if (!SingletonTemplate <CoupleArenaManager> .Instance().IsNowCanDivorce(TimeUtil.NowDateTime())) { result = MarryResult.DeniedByCoupleAreanTime; } else { int spouseID = client.ClientData.MyMarriageData.nSpouseID; GameClient spouseClient = GameManager.ClientMgr.FindClient(spouseID); if (divorceType == MarryDivorceType.DivorceForce || divorceType == MarryDivorceType.DivorceFree || divorceType == MarryDivorceType.DivorceFreeAccept) { if (client.ClientData.ExchangeID > 0 || client.ClientSocket.IsKuaFuLogin || client.ClientData.CopyMapID > 0) { return(MarryResult.SelfBusy); } if (-1 != client.ClientData.FuBenID && MapTypes.MarriageCopy == Global.GetMapType(client.ClientData.MapCode)) { return(MarryResult.SelfBusy); } if (null != spouseClient) { if (-1 != spouseClient.ClientData.FuBenID && MapTypes.MarriageCopy == Global.GetMapType(spouseClient.ClientData.MapCode)) { return(MarryResult.TargetBusy); } } if (divorceType == MarryDivorceType.DivorceForce || divorceType == MarryDivorceType.DivorceFree) { if (MarryLogic.ApplyExist(client.ClientData.RoleID)) { return(MarryResult.SelfBusy); } } } int _man = client.ClientData.RoleID; int _wife = spouseID; if (client.ClientData.MyMarriageData.byMarrytype == 2) { DataHelper2.Swap <int>(ref _man, ref _wife); } if (divorceType == MarryDivorceType.DivorceForce) { if (client.ClientData.UserMoney < MarryLogic.DivorceForceCost) { return(MarryResult.MoneyNotEnough); } if (!SingletonTemplate <CoupleWishManager> .Instance().PreClearDivorceData(_man, _wife)) { return(MarryResult.NotOpen); } if (!SingletonTemplate <CoupleArenaManager> .Instance().PreClearDivorceData(_man, _wife)) { return(MarryResult.NotOpen); } if (!GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, MarryLogic.DivorceForceCost, "强制离婚", false, true, false, DaiBiSySType.None)) { } client.ClientData.MyMarriageData.byMarrytype = -1; client.ClientData.MyMarriageData.nSpouseID = -1; MarryFuBenMgr.UpdateMarriageData2DB(client); MarriageOtherLogic.getInstance().ResetRingAttr(client); if (null != spouseClient) { spouseClient.ClientData.MyMarriageData.nSpouseID = -1; spouseClient.ClientData.MyMarriageData.byMarrytype = -1; MarryFuBenMgr.UpdateMarriageData2DB(spouseClient); MarriageOtherLogic.getInstance().ResetRingAttr(spouseClient); MarriageOtherLogic.getInstance().SendMarriageDataToClient(spouseClient, true); if (spouseClient._IconStateMgr.CheckJieRiFanLi(spouseClient, ActivityTypes.JieriMarriage)) { spouseClient._IconStateMgr.AddFlushIconState(14000, spouseClient._IconStateMgr.IsAnyJieRiTipActived()); spouseClient._IconStateMgr.SendIconStateToClient(spouseClient); } } else { string tcpstring = string.Format("{0}", spouseID); MarriageData spouseMarriageData = Global.sendToDB <MarriageData, string>(10186, tcpstring, client.ServerId); if (spouseMarriageData != null && 0 < spouseMarriageData.byMarrytype) { spouseMarriageData.byMarrytype = -1; spouseMarriageData.nSpouseID = -1; MarryFuBenMgr.UpdateMarriageData2DB(spouseID, spouseMarriageData, client); } } MarryPartyLogic.getInstance().MarryPartyRemove(client.ClientData.RoleID, true, client); MarryPartyLogic.getInstance().MarryPartyRemove(spouseID, true, client); MarriageOtherLogic.getInstance().SendMarriageDataToClient(client, true); if (client._IconStateMgr.CheckJieRiFanLi(client, ActivityTypes.JieriMarriage)) { client._IconStateMgr.AddFlushIconState(14000, client._IconStateMgr.IsAnyJieRiTipActived()); client._IconStateMgr.SendIconStateToClient(client); } string msg = string.Format(GLang.GetLang(486, new object[0]), client.ClientData.RoleName); MarryLogic.SendDivorceMail(spouseID, GLang.GetLang(487, new object[0]), msg, spouseClient, client.ServerId); SingletonTemplate <CoupleArenaManager> .Instance().OnDivorce(client.ClientData.RoleID, spouseID); } else if (divorceType == MarryDivorceType.DivorceFree) { if (null == spouseClient) { return(MarryResult.TargetOffline); } if (spouseClient.ClientData.ExchangeID > 0 || spouseClient.ClientSocket.IsKuaFuLogin || spouseClient.ClientData.CopyMapID > 0) { return(MarryResult.TargetBusy); } if (Global.GetTotalBindTongQianAndTongQianVal(client) < MarryLogic.DivorceCost) { return(MarryResult.MoneyNotEnough); } if (!Global.SubBindTongQianAndTongQian(client, MarryLogic.DivorceCost, "申请离婚")) { return(MarryResult.MoneyNotEnough); } MarryLogic.AddMarryApply(client.ClientData.RoleID, MarryApplyType.ApplyDivorce, spouseID); string notifyData = string.Format("{0}:{1}", client.ClientData.RoleID, 1); spouseClient.sendCmd(892, notifyData, false); SingletonTemplate <CoupleArenaManager> .Instance().OnSpouseRequestDivorce(spouseClient, client); } else { if (null == spouseClient) { return(MarryResult.TargetOffline); } if (!MarryLogic.RemoveMarryApply(spouseID, MarryApplyType.ApplyDivorce)) { return(MarryResult.ApplyTimeout); } MarryLogic.RemoveMarryApply(spouseID, MarryApplyType.ApplyNull); if (divorceType == MarryDivorceType.DivorceFreeAccept) { if (SingletonTemplate <CoupleWishManager> .Instance().PreClearDivorceData(_man, _wife) && SingletonTemplate <CoupleArenaManager> .Instance().PreClearDivorceData(_man, _wife)) { client.ClientData.MyMarriageData.byMarrytype = -1; client.ClientData.MyMarriageData.nSpouseID = -1; spouseClient.ClientData.MyMarriageData.byMarrytype = -1; spouseClient.ClientData.MyMarriageData.nSpouseID = -1; MarryFuBenMgr.UpdateMarriageData2DB(client); MarryFuBenMgr.UpdateMarriageData2DB(spouseClient); MarriageOtherLogic.getInstance().SendMarriageDataToClient(client, true); MarriageOtherLogic.getInstance().SendMarriageDataToClient(spouseClient, true); MarriageOtherLogic.getInstance().ResetRingAttr(client); MarriageOtherLogic.getInstance().ResetRingAttr(spouseClient); MarryPartyLogic.getInstance().MarryPartyRemove(client.ClientData.RoleID, true, client); MarryPartyLogic.getInstance().MarryPartyRemove(spouseID, true, client); if (client._IconStateMgr.CheckJieRiFanLi(client, ActivityTypes.JieriMarriage)) { client._IconStateMgr.AddFlushIconState(14000, client._IconStateMgr.IsAnyJieRiTipActived()); client._IconStateMgr.SendIconStateToClient(client); } if (spouseClient._IconStateMgr.CheckJieRiFanLi(spouseClient, ActivityTypes.JieriMarriage)) { spouseClient._IconStateMgr.AddFlushIconState(14000, spouseClient._IconStateMgr.IsAnyJieRiTipActived()); spouseClient._IconStateMgr.SendIconStateToClient(spouseClient); } SingletonTemplate <CoupleArenaManager> .Instance().OnDivorce(client.ClientData.RoleID, spouseID); } else { GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, spouseClient, MarryLogic.DivorceCost, "自由离婚拒绝返还绑金", false); GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(488, new object[0]), new object[0]), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, 0); GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, spouseClient, StringUtil.substitute(GLang.GetLang(488, new object[0]), new object[0]), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, 0); } } else if (divorceType == MarryDivorceType.DivorceFreeReject) { GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, spouseClient, MarryLogic.DivorceCost, "自由离婚拒绝返还绑金", false); string notifyData = string.Format("{0}:{1}", client.ClientData.RoleID, 3); spouseClient.sendCmd(892, notifyData, false); } } result = MarryResult.Success; } return(result); }