void SaveMatchStat() { try { int matchType = (int)EnumMatchType.Dailycup; foreach (var entity in _matchstatDic.Values) { MatchCore.SaveMatchStat(entity.ManagerId, matchType, entity.Win, entity.Lose, entity.Draw, entity.Goals); } } catch (Exception ex) { SystemlogMgr.Error("DailycupProcess SaveMatchStat", ex); } }
public MessageCode MatchCallback(BaseMatchData matchData) { var fmatchData = (FriendMatchData)matchData; if (fmatchData == null || fmatchData.ErrorCode != (int)MessageCode.Success) { return(MessageCode.MatchCreateFail); } var friendRecord = fmatchData.FriendRecord; bool isFriend = friendRecord != null; var coin = 0; int intimacy = 0; if (isFriend) { var oldIntimacy = friendRecord.Intimacy; AddFriendMatchIntimacy(friendRecord); intimacy = friendRecord.Intimacy - oldIntimacy; if (friendRecord.DayMatchCount == 1) { //第一次比赛有奖励 if (fmatchData.Home.Score > fmatchData.Away.Score) { coin = 30; } else if (fmatchData.Home.Score == fmatchData.Away.Score) { coin = 20; } else { coin = 10; } } } var match = new FriendMatchEntity(); match.Idx = fmatchData.MatchId; match.HomeId = fmatchData.Home.ManagerId; match.HomeName = fmatchData.Home.Name; match.HomeScore = fmatchData.Home.Score; match.AwayId = fmatchData.Away.ManagerId; match.AwayName = fmatchData.Away.Name; match.AwayScore = fmatchData.Away.Score; match.Intimacy = intimacy; match.IsFriend = isFriend; match.RowTime = DateTime.Now; match.Status = 0; MatchCore.SaveMatchStat(match.HomeId, EnumMatchType.Friend, match.HomeScore, match.AwayScore, match.HomeScore); var winType = EnumWinType.Win; if (match.HomeScore == match.AwayScore) { winType = EnumWinType.Draw; } else if (match.HomeScore < match.AwayScore) { winType = EnumWinType.Lose; } using (var transactionManager = new TransactionManager(Dal.ConnectionFactory.Instance.GetDefault())) { transactionManager.BeginTransaction(); var trans = transactionManager.TransactionObject; var messageCode = MessageCode.NbUpdateFail; do { if (isFriend) { if (!FriendManagerMgr.Update(friendRecord, trans)) { break; } } if (!FriendMatchMgr.Insert(match, trans)) { break; } //记录成就相关数据 var mess = AchievementTaskCore.Instance.UpdateFriendMatchComb(match.HomeId, winType, trans); if (mess != MessageCode.Success) { break; } if (coin > 0) { //友谊赛金币奖励 var manager = ManagerCore.Instance.GetManager(fmatchData.Home.ManagerId); if (manager != null) { mess = ManagerCore.Instance.AddCoin(manager, coin, EnumCoinChargeSourceType.FriendMatch, ShareUtil.GenerateComb().ToString(), trans); if (mess != MessageCode.Success) { break; } } } messageCode = MessageCode.Success; } while (false); if (messageCode == ShareUtil.SuccessCode) { transactionManager.Commit(); } else { transactionManager.Rollback(); } } return(MessageCode.Success); }
/// <summary> /// /// </summary> /// <param name="matchData"></param> /// <param name="laddermatch"></param> void Fight(BaseMatchData matchData, CrossladderMatchEntity laddermatch) { if (laddermatch.HomeIsBot && laddermatch.AwayIsBot) { laddermatch.HomeScore = 0; laddermatch.AwayScore = 0; laddermatch.Status = (int)EnumLadderStatus.End; //保存比赛 CrossladderMatchMgr.Insert(laddermatch); return; } else { try { MatchCore.CreateMatch(matchData); if (matchData.ErrorCode == (int)MessageCode.Success) { laddermatch.HomeScore = matchData.Home.Score; laddermatch.AwayScore = matchData.Away.Score; laddermatch.Status = (int)EnumLadderStatus.End; CalPrizePoint(laddermatch); int returnCode = -1; //保存比赛 CrossladderMatchMgr.SaveMatch(laddermatch.DomainId, laddermatch.LadderId, laddermatch.HomeId, laddermatch.AwayId, laddermatch.HomeName, laddermatch.AwayName, laddermatch.HomeLogo, laddermatch.AwayLogo, laddermatch.HomeSiteId, laddermatch.AwaySiteId, laddermatch.HomeLadderScore, laddermatch.AwayLadderScore, laddermatch.HomeScore, laddermatch.AwayScore, laddermatch.HomeCoin, laddermatch.AwayCoin, laddermatch.HomeExp, laddermatch.AwayExp, laddermatch.HomeIsBot, laddermatch.AwayIsBot, laddermatch.GroupIndex, laddermatch.PrizeHomeScore, laddermatch.PrizeAwayScore, laddermatch.RowTime, laddermatch.Idx, ref returnCode); if (!laddermatch.HomeIsBot) { WebServerHandler.AddManagerData(laddermatch.HomeId, laddermatch.HomeExp, laddermatch.HomeCoin, 0, laddermatch.HomeSiteId); MatchCore.SaveMatchStat(laddermatch.HomeId, EnumMatchType.CrossLadder, laddermatch.HomeScore, laddermatch.AwayScore, laddermatch.HomeScore, laddermatch.HomeSiteId); if (laddermatch.HomeIsHook) { CrossLadderManager.Instance.UpdateHookScore(laddermatch.HomeSiteId, laddermatch.HomeId, laddermatch.PrizeHomeScore, laddermatch.HomeScore > laddermatch.AwayScore, laddermatch.HomeScore, laddermatch.AwayScore, laddermatch.HomeName, laddermatch.AwayName, laddermatch.HomeCoin); } } if (!laddermatch.AwayIsBot) { WebServerHandler.AddManagerData(laddermatch.AwayId, laddermatch.AwayExp, laddermatch.AwayCoin, 0, laddermatch.AwaySiteId); MatchCore.SaveMatchStat(laddermatch.AwayId, EnumMatchType.CrossLadder, laddermatch.AwayScore, laddermatch.HomeScore, laddermatch.AwayScore, laddermatch.AwaySiteId); if (laddermatch.AwayIsHook) { CrossLadderManager.Instance.UpdateHookScore(laddermatch.AwaySiteId, laddermatch.AwayId, laddermatch.PrizeAwayScore, laddermatch.AwayScore < laddermatch.HomeScore, laddermatch.HomeScore, laddermatch.AwayScore, laddermatch.HomeName, laddermatch.AwayName, laddermatch.AwayCoin); } } } MemcachedFactory.LadderMatchClient.Set(laddermatch.Idx, laddermatch); } catch (Exception ex) { SystemlogMgr.Error("CrossLadderProcess-Fight", ex); } } matchData = null; laddermatch = null; }
public MessageCode MatchCallback(BaseMatchData matchData, long revengeRecordId, PlayerKillOpponentEntity awayOpp, PlayerkillInfoEntity info) { var pkmatchData = matchData; if (pkmatchData == null || pkmatchData.ErrorCode != (int)MessageCode.Success) { return(MessageCode.MatchCreateFail); } bool isrevenge = false; Guid lotteryMatchId = Guid.Empty; var winType = ShareUtil.CalWinType(pkmatchData.Home.Score, pkmatchData.Away.Score); int win = 0; int lose = 0; int draw = 0; int prizeExp = 0; int prizeCoin = 0; if (!isrevenge) { if (winType == EnumWinType.Win) { win = 1; } if (winType == EnumWinType.Lose) { lose = 1; } if (winType == EnumWinType.Draw) { draw = 1; } var prize = CacheFactory.PlayerKillCache.GetPrize(winType); prizeCoin = prize.Coin; prizeExp = prize.Exp; } int prizeItemCode = 0; string prizeItemString = ""; var manager = ManagerCore.Instance.GetManager(pkmatchData.Home.ManagerId); var managerex = ManagerCore.Instance.GetManagerExtra(pkmatchData.Home.ManagerId); var subtype = 1; if (manager.Level % 10 == 0) { subtype = manager.Level / 10; } else { subtype = manager.Level / 10 + 1; } int matchTimes = 0; PlayerkillInfoMgr.GetMatchTimes(manager.Idx, ref matchTimes); //if (winType == EnumWinType.Win) //{ var lotteryEntity = CacheFactory.LotteryCache.LotteryFive(EnumLotteryType.PlayerKill, subtype); int pointCount = 0; if (lotteryEntity != null) { //第一场友谊赛固定获得5钻石 if (matchTimes == 0) { prizeItemCode = 810001; pointCount = 5; lotteryMatchId = pkmatchData.MatchId; } else { if (winType == EnumWinType.Win) { prizeItemCode = lotteryEntity.PrizeItemCode; prizeItemString = lotteryEntity.ItemString; if (prizeItemCode == 810001) { var pointConfig = CacheFactory.PlayerKillCache.GetPointConfig(manager.VipLevel); if (pointConfig != null && (info.DayPoint + pointCount) < pointConfig.TotalPoint) { pointCount = pointConfig.PrizePoint; int point = pointCount; //欧洲杯狂欢 ActivityExThread.Instance.EuropeCarnival(5, ref point); info.DayPoint = info.DayPoint + point; info.DayPoint = info.DayPoint > pointConfig.TotalPoint ? pointConfig.TotalPoint : info.DayPoint; } else { prizeItemCode = 910001; pointCount = 5; } } else if (prizeItemCode == 910001) { prizeItemCode = 910001; pointCount = 5; } var itemcode = ActivityExThread.Instance.SummerGiftBag(4); if (itemcode > 0) { prizeItemCode = itemcode; } else { itemcode = ActivityExThread.Instance.MidAutumnActivity(4, info.SpecialItemNumber); if (itemcode > 0) { info.SpecialItemNumber++; prizeItemCode = itemcode; } } lotteryMatchId = pkmatchData.MatchId; } } } //} //LogHelper.Insert("友谊赛比赛结果处理请求:比赛id"+lotteryMatchId+",ManagerId:" + pkmatchData.Home.ManagerId.ToString() + " ,对手Id:" + pkmatchData.Away.ManagerId.ToString(), LogType.Info); double totalPlusRate = 0; //是否有vip效果 var vipRate = CacheFactory.VipdicCache.GetEffectValue(manager.VipLevel, EnumVipEffect.PkOrLeagueExpPlus); totalPlusRate += vipRate / 100.00; //是否有增加经验的Buff var buffExp = BuffPoolCore.Instance().GetBuffValue(manager.Idx, EnumBuffCode.PkMatchExp, true, false); NbManagerbuffpoolEntity buffExpEntity = null; if (buffExp != null) { if (buffExp.SrcList != null && buffExp.SrcList.Count > 0) { buffExpEntity = NbManagerbuffpoolMgr.GetById(buffExp.SrcList[0].Idx); if (buffExpEntity != null && buffExpEntity.RemainTimes > 0) { totalPlusRate += buffExp.Percent; } } } prizeExp = (int)(prizeExp * (1 + totalPlusRate)); if (matchData.Home.Score > matchData.Away.Score) { awayOpp.HasWin = true; info.OpponentInfo = SerializationHelper.ToByte(info.Opponents); //PlayerkillInfoMgr.Update(info); } //欧洲杯狂欢 ActivityExThread.Instance.EuropeCarnival(1, ref prizeExp); LogHelper.Insert(string.Format("revengeId:{0},score1:{1},score2:{2},haswin:{3}", revengeRecordId, matchData.Home.Score, matchData.Away.Score, awayOpp.HasWin), LogType.Info); OnlineCore.Instance.CalIndulgePrize(manager, ref prizeExp, ref prizeCoin); ManagerUtil.AddManagerData(manager, prizeExp, prizeCoin, 0, EnumCoinChargeSourceType.PlayerKillPrize, pkmatchData.MatchId.ToString()); long outRevengeRecordId = 0; //扣除行动力 var code = ManagerCore.Instance.SubStamina(managerex, _pkStamina, manager.Level, manager.VipLevel); if (code != MessageCode.Success) { return(code); } code = SaveMatch(manager, managerex, pkmatchData, lotteryMatchId, win, lose, draw, prizeExp, prizeCoin, prizeItemCode, prizeItemString, isrevenge, revengeRecordId, ref outRevengeRecordId, info, pointCount); //统计使用的行动力 StatisticKpiMgr.UpdateSame(ShareUtil.ZoneId, DateTime.Now.Date, 0, _pkStamina, 0, 0); if (code == MessageCode.Success) { //更新祝福Buff剩余场次数 if (buffExpEntity != null && buffExpEntity.RemainTimes > 0) { buffExpEntity.RemainTimes--; NbManagerbuffpoolMgr.Update(buffExpEntity); } //记录比赛数据 MatchCore.SaveMatchStat(pkmatchData.Home.ManagerId, EnumMatchType.PlayerKill, pkmatchData.Home.Score, pkmatchData.Away.Score, pkmatchData.Home.Score); //记录成就相关数据 AchievementTaskCore.Instance.UpdatePkMatchGoals(manager.Idx, pkmatchData.Home.Score); TaskHandler.Instance.PkOrFriendMatchCount(manager.Idx); var popList = ManagerUtil.SaveManagerAfter(manager, false); var taskPop = TaskHandler.Instance.PlayerKillFight(manager.Idx, (int)winType); if (matchData.HasTask) { //var taskPop = TaskHandler.Instance.PlayerKillFight(manager.Idx, (int)winType); if (taskPop != null && taskPop.Count > 0) { if (popList == null) { popList = taskPop; } else { popList.AddRange(taskPop); } } } MemcachedFactory.MatchPopClient.Set(matchData.MatchId, popList); } return(code); }
/// <summary> /// 联赛打比赛 /// </summary> /// <param name="leagueId"></param> /// <param name="managerId"></param> /// <returns></returns> public LeagueFightResultResponse Fight(Guid managerId, int leagueId) { var manager = ManagerCore.Instance.GetManager(managerId); if (manager == null) { return(ResponseHelper.Create <LeagueFightResultResponse>(MessageCode.NbParameterError)); } var managerExtra = ManagerCore.Instance.GetManagerExtra(managerId); if (managerExtra == null) { return(ResponseHelper.Create <LeagueFightResultResponse>(MessageCode.NbParameterError)); } if (managerExtra.Stamina < 5) { return(ResponseHelper.Create <LeagueFightResultResponse>(MessageCode.LeagueStaminaNotEnough)); } var currectLeague = LeagueManagerrecordMgr.GetManagerMarkInfo(managerId, leagueId); if (currectLeague == null) { return(ResponseHelper.Create <LeagueFightResultResponse>(MessageCode.NbParameterError)); } var leagueRecordInfo = LeagueRecordMgr.GetById(currectLeague.LeagueRecordId); if (leagueRecordInfo == null) { return(ResponseHelper.Create <LeagueFightResultResponse>(MessageCode.NbParameterError)); } if (leagueRecordInfo.Schedule > currectLeague.MaxWheelNumber) { return(ResponseHelper.Create <LeagueFightResultResponse>(MessageCode.LeagueHavePass)); } //扣除行动力 var code = ManagerCore.Instance.SubStamina(managerExtra, 5, manager.Level, manager.VipLevel); if (code != MessageCode.Success) { return(ResponseHelper.Create <LeagueFightResultResponse>(code)); } //遍历对阵 int botStatus = 0;//0=主队和客队都是NPC 1 我是主队 2 我是客队 var npchome = Guid.Empty; var npcaway = Guid.Empty; var matchId = ShareUtil.GenerateComb(); //获取对阵记录 var fightMap = new LeagueFightMapFrame(managerId); //获取对阵 var pairList = CreateFightMap(currectLeague.FightDicId, leagueRecordInfo.Schedule); BaseMatchData managerMatch = null; foreach (var item in pairList) { botStatus = 0; if (item.HomeId == 0) { botStatus = 1; npchome = managerId; npcaway = CacheFactory.LeagueCache.GetLeagueNpcGuid(leagueId, item.AwayId); } else if (item.AwayId == 0) { botStatus = 2; npchome = CacheFactory.LeagueCache.GetLeagueNpcGuid(leagueId, item.HomeId); npcaway = managerId; } else { npchome = CacheFactory.LeagueCache.GetLeagueNpcGuid(leagueId, item.HomeId); npcaway = CacheFactory.LeagueCache.GetLeagueNpcGuid(leagueId, item.AwayId); } SingleMatch(leagueRecordInfo.Schedule, npchome, npcaway, item.HomeId, item.AwayId, leagueRecordInfo.LaegueId, matchId, botStatus, fightMap, ref managerMatch); } if (managerMatch == null) { return(ResponseHelper.Create <LeagueFightResultResponse>(MessageCode.MatchCreateFail)); } LeagueWincountrecordEntity leagueWincountRecord = null; //记录比赛数据 if (managerMatch.Away.IsBot) { MatchCore.SaveMatchStat(managerId, EnumMatchType.League, managerMatch.Home.Score, managerMatch.Away.Score, managerMatch.Home.Score); } else { MatchCore.SaveMatchStat(managerId, EnumMatchType.League, managerMatch.Away.Score, managerMatch.Home.Score, managerMatch.Away.Score); } var response = ResponseHelper.CreateSuccess <LeagueFightResultResponse>(); response.Data = new LeagueFightResult { HomeGoals = managerMatch.Home.Score, AwayGoals = managerMatch.Away.Score, PrizeList = new List <LeaguePrizeEntity>() }; int star = 0; if (managerMatch.Home.Score > managerMatch.Away.Score) { if (managerMatch.Home.ManagerId == managerId) { star = managerMatch.Home.Score - managerMatch.Away.Score; response.Data.Result = 0; } else { response.Data.Result = 2; } } else if (managerMatch.Home.Score == managerMatch.Away.Score) { response.Data.Result = 1; } else { if (managerMatch.Away.ManagerId == managerId) { star = managerMatch.Away.Score - managerMatch.Home.Score; response.Data.Result = 0; } else { response.Data.Result = 2; } } var winType = CalWinType(response.Data.Result); LaegueManagerinfoEntity leagueManagerInfo = null; if (winType == EnumWinType.Win) { leagueManagerInfo = LaegueManagerinfoMgr.GetById(managerId); if (leagueManagerInfo.DailyWinUpdateTime.Date != DateTime.Now.Date) { leagueManagerInfo.DailyWinCount = 1; } else { leagueManagerInfo.DailyWinCount++; } leagueManagerInfo.DailyWinUpdateTime = DateTime.Now; } //更新胜场奖励 star = star > 3 ? 3 : star; star = star < 0 ? 0 : star; UpdateWincountRecord(managerId, leagueId, star, ref leagueWincountRecord); currectLeague.MatchId = matchId; currectLeague.UpdateTime = DateTime.Now; var result = MatchConfirm(manager, leagueRecordInfo, currectLeague, leagueManagerInfo, managerMatch, fightMap, managerExtra, leagueWincountRecord); if (result.Code != (int)MessageCode.Success) { return(ResponseHelper.Create <LeagueFightResultResponse>(result.Code)); } var pop = TaskHandler.Instance.LeagueFight(managerId, (int)winType); if (pop != null) { MemcachedFactory.MatchPopClient.Set(managerId, pop); } response.Data.StarNumber = star; response.Data.Stamina = managerExtra.Stamina; response.Data.PrizeList = result.Data.PrizeList; response.Data.VipExp = result.Data.VipExp; response.Data.MatchId = managerMatch.MatchId; return(response); }
/// <summary> /// /// </summary> /// <param name="matchData"></param> /// <param name="laddermatch"></param> private void Fight(BaseMatchData matchData, LadderMatchEntity laddermatch) { try { if (laddermatch.HomeIsBot && laddermatch.AwayIsBot) { laddermatch.HomeScore = 0; laddermatch.AwayScore = 0; laddermatch.Status = (int)EnumLadderStatus.End; //保存比赛 LadderMatchMgr.Insert(laddermatch); return; } else { MatchCore.CreateMatch(matchData); ////测试用 ------------ //matchData.ErrorCode = (int)MessageCode.Success; //matchData.Home.Score = 5; //matchData.Away.Score = 2; if (matchData.ErrorCode == (int)MessageCode.Success) { laddermatch.HomeScore = matchData.Home.Score; laddermatch.AwayScore = matchData.Away.Score; laddermatch.Status = (int)EnumLadderStatus.End; CalPrizePoint(laddermatch); int returnCode = -1; //保存比赛 LadderMatchMgr.SaveMatch(laddermatch.LadderId, laddermatch.HomeId, laddermatch.AwayId, laddermatch.HomeName, laddermatch.AwayName, laddermatch.HomeLadderScore, laddermatch.AwayLadderScore, laddermatch.HomeScore, laddermatch.AwayScore, laddermatch.HomeCoin, laddermatch.AwayCoin, laddermatch.HomeExp, laddermatch.AwayExp, laddermatch.HomeIsBot, laddermatch.AwayIsBot, laddermatch.GroupIndex, laddermatch.PrizeHomeScore, laddermatch.PrizeAwayScore, laddermatch.RowTime, laddermatch.Idx, ref returnCode); if (!laddermatch.HomeIsBot) { AddManagerData(laddermatch.HomeId, laddermatch.HomeExp, laddermatch.HomeCoin, 0, EnumCoinChargeSourceType.Ladder, laddermatch.Idx.ToString() + "_home"); } if (!laddermatch.AwayIsBot) { AddManagerData(laddermatch.AwayId, laddermatch.AwayExp, laddermatch.AwayCoin, 0, EnumCoinChargeSourceType.Ladder, laddermatch.Idx.ToString() + "_away"); } int homeWinType = (int)CalWinType(laddermatch.HomeScore, laddermatch.AwayScore); int awayWinType = (int)CalWinType(laddermatch.AwayScore, laddermatch.HomeScore); if (!laddermatch.HomeIsBot && homeWinType == (int)EnumWinType.Win) //胜场活动 { ActivityExThread.Instance.LadderDayPrize(laddermatch.HomeId); } if (!laddermatch.AwayIsBot && awayWinType == (int)EnumWinType.Win) //胜场活动 { ActivityExThread.Instance.LadderDayPrize(laddermatch.AwayId); } if (!laddermatch.HomeIsBot) { var homepop = TaskHandler.Instance.LadderFight(laddermatch.HomeId, homeWinType); if (homepop != null) { MemcachedFactory.MatchPopClient.Set(laddermatch.HomeId, homepop); } MatchCore.SaveMatchStat(laddermatch.HomeId, EnumMatchType.Ladder, laddermatch.HomeScore, laddermatch.AwayScore, laddermatch.HomeScore); //ActivityExThread.Instance.Ladder(laddermatch.HomeId, laddermatch.HomeLadderScore + laddermatch.PrizeHomeScore, homeWinType); //Games.NBall.Core.Guild.GuildMessage.Instance().LadderActive(laddermatch.HomeId); //ActiveCore.Instance.AddActive(laddermatch.HomeId, EnumActiveType.Ladder, 1); //记录成就相关数据 AchievementTaskCore.Instance.UpdateLadderGoals(laddermatch.HomeId, laddermatch.HomeScore, (EnumWinType)homeWinType, laddermatch.HomeLadderScore + laddermatch.PrizeHomeScore); if (laddermatch.HomeIsHook) { LadderThread.Instance.UpdateHookScore(laddermatch.HomeId, laddermatch.PrizeHomeScore, laddermatch.HomeScore > laddermatch.AwayScore, laddermatch.HomeScore, laddermatch.AwayScore, laddermatch.HomeName, laddermatch.AwayName, laddermatch.HomeCoin); } } if (!laddermatch.AwayIsBot) { var awaypop = TaskHandler.Instance.LadderFight(laddermatch.AwayId, awayWinType); if (awaypop != null) { MemcachedFactory.MatchPopClient.Set(laddermatch.AwayId, awaypop); } MatchCore.SaveMatchStat(laddermatch.AwayId, EnumMatchType.Ladder, laddermatch.AwayScore, laddermatch.HomeScore, laddermatch.AwayScore); //ActivityExThread.Instance.Ladder(laddermatch.AwayId, laddermatch.AwayLadderScore + laddermatch.PrizeAwayScore, awayWinType); //Games.NBall.Core.Guild.GuildMessage.Instance().LadderActive(laddermatch.AwayId); //ActiveCore.Instance.AddActive(laddermatch.AwayId, EnumActiveType.Ladder, 1); //记录成就相关数据 AchievementTaskCore.Instance.UpdateLadderGoals(laddermatch.AwayId, laddermatch.AwayScore, (EnumWinType)awayWinType, laddermatch.AwayLadderScore + laddermatch.PrizeAwayScore); if (laddermatch.AwayIsHook) { LadderThread.Instance.UpdateHookScore(laddermatch.AwayId, laddermatch.PrizeAwayScore, laddermatch.AwayScore < laddermatch.HomeScore, laddermatch.HomeScore, laddermatch.AwayScore, laddermatch.HomeName, laddermatch.AwayName, laddermatch.AwayCoin); } } if (!laddermatch.HomeIsBot) { var manager = ManagerCore.Instance.GetManager(laddermatch.HomeId); if (manager != null) { int cd = LadderCore.Instance.LadderNotVipMatchCD; if (manager.VipLevel > 0) { cd = LadderCore.Instance.LadderVipMatchCD; } if (!LadderCore.Instance._ManagerMatchCD.ContainsKey(laddermatch.HomeId)) //加cd { LadderCore.Instance._ManagerMatchCD.TryAdd(laddermatch.HomeId, DateTime.Now.AddSeconds(cd)); } else { LadderCore.Instance._ManagerMatchCD[laddermatch.HomeId] = DateTime.Now.AddSeconds(cd); } } } if (!laddermatch.AwayIsBot) { var manager = ManagerCore.Instance.GetManager(laddermatch.AwayId); if (manager != null) { int cd = LadderCore.Instance.LadderNotVipMatchCD; if (manager.VipLevel > 0) { cd = LadderCore.Instance.LadderVipMatchCD; } if (!LadderCore.Instance._ManagerMatchCD.ContainsKey(laddermatch.AwayId)) //加cd { LadderCore.Instance._ManagerMatchCD.TryAdd(laddermatch.AwayId, DateTime.Now.AddSeconds(cd)); } else { LadderCore.Instance._ManagerMatchCD[laddermatch.AwayId] = DateTime.Now.AddSeconds(cd); } } } } MemcachedFactory.LadderMatchClient.Set <LadderMatchEntity>(laddermatch.Idx, laddermatch); } matchData = null; laddermatch = null; } catch (Exception ex) { SystemlogMgr.Error("天梯比赛", ex); } if (laddermatch != null) { MemcachedFactory.LadderMatchClient.Delete(laddermatch.Idx); var match = LadderMatchMgr.GetById(laddermatch.Idx); MemcachedFactory.LadderMatchClient.Set(laddermatch.Idx, match); } }