static string GetFormPidStr(Guid managerId) { var form = MatchDataHelper.GetSolution(managerId); if (null == form) { return(string.Empty); } return(form.PlayerString); }
/// <summary> /// BuildPackageData /// </summary> /// <param name="package"></param> /// <param name="itemType"></param> /// <returns></returns> public ItemPackageData BuildPackageData(ItemPackageFrame package, int itemType = 0) { var data = new ItemPackageData(); data.Items = package.GetItemsByType(itemType); var teammember = MatchDataHelper.GetSolutionTeammembers(package.ManagerId); ItemPackageFrame.CaluPackageCardKpi(data.Items, teammember); data.PackageSize = package.PackageSize; return(data); }
/// <summary> /// 解雇球员 /// </summary> /// <param name="managerId"></param> /// <param name="teammemberId"></param> /// <returns></returns> public MessageCodeResponse FireTeamMember(Guid managerId, Guid teammemberId) { try { var package = ItemCore.Instance.GetPackage(managerId, EnumTransactionType.TeammemberTrans); if (package == null) { return(ResponseHelper.Create <MessageCodeResponse>(MessageCode.NbNoPackage)); } var player = package.GetPlayer(teammemberId); if (player.ItemType != (int)EnumItemType.PlayerCard) { return(ResponseHelper.Exception <MessageCodeResponse>()); } int pid = player.ItemCode % 100000; //检查球员是否已在场上 var solution = MatchDataHelper.GetSolution(managerId); if (solution.PlayerDic.ContainsKey(pid)) { return(ResponseHelper.Create <MessageCodeResponse>(MessageCode.TeammemberIsMain)); } var property = player.ItemProperty as PlayerCardProperty; if (property != null && property.Equipment != null) { return(ResponseHelper.Create <MessageCodeResponse>(MessageCode.TeammemberHasEquip)); } var messcode = package.Delete(player.ItemId); if (messcode != MessageCode.Success) { return(ResponseHelper.Create <MessageCodeResponse>(messcode)); } using (var transactionManager = new TransactionManager(Dal.ConnectionFactory.Instance.GetDefault())) { transactionManager.BeginTransaction(); if (!package.Save(transactionManager.TransactionObject)) { transactionManager.Rollback(); return(ResponseHelper.Create <MessageCodeResponse>(MessageCode.NbUpdateFail)); } transactionManager.Commit(); MemcachedFactory.TeammembersClient.Delete(managerId); package.Shadow.Save(); } return(ResponseHelper.Create <MessageCodeResponse>(MessageCode.Success)); } catch (Exception ex) { SystemlogMgr.Error("TeamMember-Fire", ex); return(ResponseHelper.Create <MessageCodeResponse>(MessageCode.Exception)); } }
public MessageCode JobUpdateKpi() { var onlineList = OnlineCore.GetOnlineList(); if (onlineList != null && onlineList.Count > 0) { foreach (var guid in onlineList) { MatchDataHelper.GetManagerKpi(guid); } } return(MessageCode.Success); }
public Match_FightinfoResponse GetLeagueFightInfo(Guid matchId, Guid managerId) { LeagueEncounterEntity matchInfo = LeagueEncounterMgr.GetById(matchId); DicNpcEntity homeNpc = null; DicNpcEntity awayNpc = null; if (matchInfo.HomeIsNpc) { homeNpc = CacheFactory.NpcdicCache.GetNpc(matchInfo.HomeId); } if (matchInfo.AwayIsNpc) { awayNpc = CacheFactory.NpcdicCache.GetNpc(matchInfo.AwayId); } DTOBuffMemberView homeView, awayView; BuffDataCore.Instance().GetMembers(out homeView, out awayView, "", matchInfo.HomeId, matchInfo.HomeIsNpc, "", matchInfo.AwayId, matchInfo.AwayIsNpc, true, false); Match_FightManagerinfo home, away; if (matchInfo.HomeIsNpc) { home = MatchDataHelper.GetFightinfo(homeNpc, homeView); } else { home = MatchDataHelper.GetFightinfo(matchInfo.HomeId, false, homeView, ""); } if (matchInfo.AwayIsNpc) { away = MatchDataHelper.GetFightinfo(awayNpc, awayView); } else { away = MatchDataHelper.GetFightinfo(matchInfo.AwayId, false, awayView, ""); } if (home == null || away == null) { return(ResponseHelper.Create <Match_FightinfoResponse>(MessageCode.NbParameterError)); } var response = ResponseHelper.CreateSuccess <Match_FightinfoResponse>(); response.Data = new Match_Fightinfo(); response.Data.Home = home; response.Data.Away = away; return(response); }
/// <summary> /// 球员成长里的球员列表 /// </summary> /// <param name="managerId"></param> /// <returns></returns> public TeammemberListForGrowResponse GetTeammemberListForGrow(Guid managerId) { var teammembers = MatchDataHelper.GetTeammembers(managerId); var grows = TeammemberGrowMgr.GetByManager(managerId); var response = ResponseHelper.CreateSuccess <TeammemberListForGrowResponse>(); response.Data = new TeammemberListForGrowEntity(); response.Data.Teammembers = new List <TeammemberForGrowEntity>(teammembers.Count); foreach (var entity in teammembers) { response.Data.Teammembers.Add(BuildTeammemberForGrow(entity, grows)); } return(response); }
void doRebuildKpi(Guid managerId) { try { var buffView = BuffDataCore.Instance().RebuildMembers(managerId); if (buffView != null) { // ChatHelper.SendUpdateKpi(managerId, buffView.Kpi); MatchDataHelper.UpdateManagerKpi(managerId, buffView.Kpi); } } catch (Exception ex) { SystemlogMgr.Error("doRebuildKpi", ex); } }
void CreateTemplate(List <DicPlayerEntity> list) { var positionList = BuildTemplatePosition(); var conditionList = BuildTemplateCondition(); string s = ""; List <int> ids = new List <int>(11); //for (int i = 0; i < 11; i++) //{ // var items = list.FindAll(d => d.Position == (int)positionList[i].Position // &&d.Kpi>=conditionList[i].MinPower && d.Kpi<=conditionList[i].MaxPower); // var item = items[RandomHelper.GetInt32WithoutMax(0, items.Count)]; // while (ids.Contains(item.Idx)) // { // item = items[RandomHelper.GetInt32WithoutMax(0, items.Count)]; // } // ids.Add(item.Idx); // s += item.Idx + ","; //} //不能有元老卡 DTOBuffMemberView view = new DTOBuffMemberView(); view.BuffMembers = new Dictionary <Guid, NbManagerbuffmemberEntity>(); for (int i = 0; i < 7; i++) { var condition = conditionList[i]; if (condition.MaxPower == 0) { condition.MaxPower = 200; } var position = positionList[i]; var items = list.FindAll(d => d.Position == (int)position.Position && d.CardLevel == condition.CardLevel && d.Capacity >= condition.MinPower && d.Capacity <= condition.MaxPower); var item = items[RandomHelper.GetInt32WithoutMax(0, items.Count)]; while (ids.Contains(item.Idx)) { item = items[RandomHelper.GetInt32WithoutMax(0, items.Count)]; } view.BuffMembers.Add(Guid.NewGuid(), BuildBuffMember(item)); ids.Add(item.Idx); s += item.Idx + ","; } MatchDataHelper.CalKpi(view); s = s.TrimEnd(','); TemplateRegisterMgr.Add(s, view.Kpi); }
public static RootResponse <DTOSkillSetView> GetSkillSetInfo(Guid mid) { var bag = SkillCardConvert.GetSkillBagWrap(mid); int managerLevel = (int)FrameConvert.GetWorthValue(mid, EnumWorthType.ManagerLevel); var data = new DTOSkillSetView(); data.MaxSetCells = GetMaxSkillCells(managerLevel); var form = MatchDataHelper.GetSolution(mid); if (null != form) { data.FormId = form.FormationId; data.PidStr = form.PlayerString.TrimEnd(); } data.SetList = bag.GetShowSet(); data.CntSetCells = bag.CntSetNum; return(ResponseHelper.CreateRoot <DTOSkillSetView>(data)); }
/// <summary> /// 获取阵容和球员信息 /// </summary> /// <param name="managerId"></param> /// <returns></returns> public NBSolutionInfoResponse SolutionAndTeammemberResponse(Guid managerId) { var solution = MatchDataHelper.GetSolutionInfo(managerId); if (solution == null) { return(ResponseHelper.InvalidParameter <NBSolutionInfoResponse>()); } var response = ResponseHelper.CreateSuccess <NBSolutionInfoResponse>(); response.Data = solution; var manager = ManagerCore.Instance.GetManager(managerId, true); if (manager != null) { response.Data.Kpi = manager.Kpi; } return(response); }
void InitCache() { try { LogHelper.Insert("npc dic cache init start", LogType.Info); List <DicNpcEntity> list = null; if (ShareUtil.IsCross) { list = DicNpcMgr.GetAllForCross(); } else { list = DicNpcMgr.GetAll(); } _dicNpc = new Dictionary <Guid, DicNpcEntity>(); _transferManagerDic = new Dictionary <Guid, ManagerInput>(list.Count); _fightManagerinfoDic = new Dictionary <Guid, Match_FightManagerinfo>(list.Count); _dicBuffView = new Dictionary <Guid, DTOBuffMemberView>(list.Count); foreach (var entity in list) { var buffView = NpcDataHelper.GetMemberView(entity); _dicNpc.Add(entity.Idx, entity); _dicBuffView.Add(entity.Idx, buffView); _transferManagerDic.Add(entity.Idx, MatchTransferUtil.BuildTransferNpc(entity, buffView)); _fightManagerinfoDic.Add(entity.Idx, MatchDataHelper.GetFightinfo(entity, buffView, true)); } _guidePlayers = new List <PlayerInput>(); var guideConfig = CacheFactory.AppsettingCache.GetAppSetting(EnumAppsetting.TourGuidePlayers); var ssss = guideConfig.Split('|'); foreach (var ss in ssss) { var s = ss.Split(','); _guidePlayers.Add(MatchTransferUtil.BuildPlayerInputForGuide(Convert.ToInt32(s[0]), Convert.ToInt32(s[1]), s[2])); } LogHelper.Insert("npc dic cache init end", LogType.Info); } catch (Exception ex) { LogHelper.Insert(ex); } }
public Match_FightinfoResponse GetFightInfoWithoutNpc(Guid managerId, Guid awayId, bool isHomeBot, bool isAwayBot, bool syncAwayFlag = false, string homeSiteId = "", string awaySiteId = "") { DTOBuffMemberView homeView, awayView; BuffDataCore.Instance().GetMembers(out homeView, out awayView, homeSiteId, managerId, false, awaySiteId, awayId, false, true, syncAwayFlag); Match_FightManagerinfo home = MatchDataHelper.GetFightinfo(managerId, isHomeBot, homeView, homeSiteId); Match_FightManagerinfo away = MatchDataHelper.GetFightinfo(awayId, isAwayBot, awayView, awaySiteId); if (home == null || away == null) { return(ResponseHelper.Create <Match_FightinfoResponse>(MessageCode.NbParameterError)); } var response = ResponseHelper.CreateSuccess <Match_FightinfoResponse>(); response.Data = new Match_Fightinfo(); response.Data.Home = home; response.Data.Away = away; return(response); }
/// <summary> /// 获取阵型数据 /// </summary> /// <param name="managerId"></param> /// <param name="zoneName"></param> /// <returns></returns> public NBSolutionInfoResponse SolutionAndTeammemberResponse(Guid managerId, string zoneName) { try { var arenaFrame = new ArenaTeammemberFrame(managerId, (EnumArenaType)this.ArenaType, zoneName); var solution = MatchDataHelper.GetArenaSolutionInfo(arenaFrame); if (solution == null) { return(ResponseHelper.InvalidParameter <NBSolutionInfoResponse>()); } var response = ResponseHelper.CreateSuccess <NBSolutionInfoResponse>(); response.Data = solution; response.Data.Kpi = arenaFrame.Kpi; return(response); } catch (Exception ex) { SystemlogMgr.Error("竞技场获取阵容", ex); return(ResponseHelper.InvalidParameter <NBSolutionInfoResponse>()); } }
public ItemPackageResponse GetPackageResponse(Guid managerId) { var package = ItemPackageMgr.GetById(managerId); var response = ResponseHelper.CreateSuccess <ItemPackageResponse>(); response.Data = package; //AchievementTaskCore.Instance.UpdatePlayCardCount(new ItemPackageFrame(package)); var packageItemsEntity = SerializationHelper.FromByte <ItemPackageItemsEntity>(package.ItemString); if (packageItemsEntity == null || packageItemsEntity.Items == null) { response.Data.Items = new List <ItemInfoEntity>(); } else { var teammember = MatchDataHelper.GetSolutionTeammembers(managerId); ItemPackageFrame.CaluPackageCardKpi(packageItemsEntity.Items, teammember); response.Data.Items = packageItemsEntity.Items; } return(response); }
public NbSolutionEntity GetSolution(Guid managerId) { return(MatchDataHelper.GetSolution(managerId)); }
/// <summary> /// 替换上场 /// </summary> /// <param name="managerId"></param> /// <param name="teammemberId"></param> /// <param name="byTeammemberId"></param> /// <returns></returns> public NBSolutionInfoResponse ReplacePlayer(Guid managerId, Guid teammemberId, Guid byTeammemberId) { bool isChanagePlayer = false; try { ItemPackageFrame package = null; MessageCode messCode = MessageCode.Success; var soluti = MatchDataHelper.GetSolution(managerId); if (soluti == null) { return(ResponseHelper.InvalidParameter <NBSolutionInfoResponse>()); } var byteammember = GetTeammember(managerId, byTeammemberId); if (byteammember == null || !soluti.PlayerDic.ContainsKey(byteammember.PlayerId)) { return(ResponseHelper.Create <NBSolutionInfoResponse>((int)MessageCode.TeammemberNotMain)); } var teammember = GetTeammember(managerId, teammemberId); var playerString = ""; var playerIdList = FrameUtil.CastIntList(soluti.PlayerString, ','); if (teammember != null) { ExchangePlayer(playerIdList, teammember.PlayerId, byteammember.PlayerId, false, ref playerString); soluti.PlayerString = playerString; if (!NbSolutionMgr.Update(soluti)) { return(ResponseHelper.Create <NBSolutionInfoResponse>((int)MessageCode.NbUpdateFail)); } MemcachedFactory.SolutionClient.Delete(managerId); KpiHandler.Instance.RebuildKpi(managerId, true); var manager = MatchDataHelper.GetManager(managerId, true, true); if (manager == null) { return(ResponseHelper.Create <NBSolutionInfoResponse>((int)MessageCode.NbParameterError)); } var response1 = SolutionAndTeammemberResponse(managerId); return(response1); //换位置 } else //换替补 { isChanagePlayer = true; package = ItemCore.Instance.GetPackage(managerId, EnumTransactionType.TeammemberTrans); if (package == null) { return(ResponseHelper.Create <NBSolutionInfoResponse>(MessageCode.NbNoPackage)); } var player = package.GetPlayer(teammemberId); if (player.ItemType != (int)EnumItemType.PlayerCard) { return(ResponseHelper.Exception <NBSolutionInfoResponse>()); } player.IsDeal = false; var itemInfo = CacheFactory.ItemsdicCache.GetItem(player.ItemCode); //限制金卡 if (itemInfo != null && itemInfo.ItemType == (int)EnumItemType.PlayerCard && itemInfo.PlayerCardLevel == (int)EnumPlayerCardLevel.Gold) { var solution = MatchDataHelper.GetSolutionInfo(managerId); if (solution == null) { return(ResponseHelper.InvalidParameter <NBSolutionInfoResponse>()); } if (solution.MaxVeteranCount <= solution.VeteranCount) { return (ResponseHelper.Create <NBSolutionInfoResponse>( (int)MessageCode.TeammemberVeteranCountOver)); } } var pid = player.ItemCode % 100000; //检查是否已有相同pid的球员 var linkList = CacheFactory.PlayersdicCache.GetLinkPlayerList(pid); if (linkList != null) { foreach (var link in linkList) { if (playerIdList.Exists(d => d == link)) { return(ResponseHelper.Create <NBSolutionInfoResponse>(MessageCode.TeammemberSolutionPlayerRepeat)); } } } int teammemberCount = 0; int returnCode = 0; TeammemberMgr.GetForTransCheck(managerId, pid, ShareUtil.GetTableMod(managerId), (int)MessageCode.TeammemberRepeat, ref teammemberCount, ref returnCode); if (returnCode != (int)MessageCode.Success) { return(ResponseHelper.Create <NBSolutionInfoResponse>(returnCode)); } messCode = package.ReplacePlayerCard(100000 + byteammember.PlayerId, false, byteammember.Strength, byteammember.Idx, byteammember.Equipment, player.ItemId, byteammember.Level); ExchangePlayer(playerIdList, pid, byteammember.PlayerId, true, ref playerString); soluti.PlayerString = playerString; if (messCode != MessageCode.Success) { return(ResponseHelper.Create <NBSolutionInfoResponse>(messCode)); } } using (var transactionManager = new TransactionManager(Dal.ConnectionFactory.Instance.GetDefault())) { transactionManager.BeginTransaction(); messCode = MessageCode.NbUpdateFail; do { if (package != null) { if (!package.SavePlayer(transactionManager.TransactionObject)) { break; } } if (!NbSolutionMgr.Update(soluti, transactionManager.TransactionObject)) { break; } messCode = MessageCode.Success; } while (false); if (messCode == MessageCode.Success) { transactionManager.Commit(); MemcachedFactory.TeammembersClient.Delete(managerId); MemcachedFactory.SolutionClient.Delete(managerId); package.Shadow.Save(); int orangeCount = 0; string[] pIds = playerString.Split(','); foreach (var pId in pIds) { int id = ConvertHelper.ConvertToInt(pId); var player = CacheFactory.PlayersdicCache.GetPlayer(id); if (player.CardLevel == (int)EnumPlayerCardLevel.Orange) { orangeCount++; } } ActivityExThread.Instance.TememberColect(managerId, 3, orangeCount); } else { transactionManager.Rollback(); return(ResponseHelper.Create <NBSolutionInfoResponse>(messCode)); } } } catch (Exception ex) { SystemlogMgr.Error("替换球员上场", ex); } KpiHandler.Instance.RebuildKpi(managerId, true); var response = SolutionAndTeammemberResponse(managerId); if (isChanagePlayer) { var pop = TaskHandler.Instance.SolutionChangePlayer(managerId); if (response.Data != null) { response.Data.PopMsg = pop; } } return(response); }
//public Match_FightinfoResponse GetCrowdFightInfo(Guid matchId, Guid managerId) //{ // var match = MemcachedFactory.CrowdMatchClient.Get<CrowdMatchEntity>(matchId); // if (match == null) // return ResponseHelper.InvalidParameter<Match_FightinfoResponse>(); // if (managerId == match.HomeId) // { // return GetFightInfo(managerId, match.AwayId); // } // else if (managerId == match.AwayId) // { // return GetFightInfo(managerId, match.HomeId); // } // else // { // return ResponseHelper.InvalidParameter<Match_FightinfoResponse>(); // } //} /// <summary> /// 获取竞技场对阵 /// </summary> /// <param name="matchId"></param> /// <returns></returns> public Match_FightinfoResponse GetArenaFightInfo(Guid matchId) { var matchData = MemcachedFactory.ArenaMatchClient.Get <BaseMatchData>(matchId); if (matchData == null) { return(ResponseHelper.Create <Match_FightinfoResponse>(MessageCode.NbParameterError)); } DicNpcEntity homeNpc = null; DicNpcEntity awayNpc = null; ArenaTeammemberFrame homeFrame = null; ArenaTeammemberFrame awayFrame = null; if (matchData.Home.IsNpc) { homeNpc = CacheFactory.NpcdicCache.GetNpc(matchData.Home.ManagerId); } else { homeFrame = new ArenaTeammemberFrame(matchData.Home.ManagerId, (EnumArenaType)matchData.Home.ArenaType, matchData.Home.ZoneName); } if (matchData.Away.IsNpc) { awayNpc = CacheFactory.NpcdicCache.GetNpc(matchData.Away.ManagerId); } else { awayFrame = new ArenaTeammemberFrame(matchData.Away.ManagerId, (EnumArenaType)matchData.Away.ArenaType, matchData.Away.ZoneName); } DTOBuffMemberView homeView, awayView; ArenaBuffDataCore.Instance().GetMembers(out homeView, out awayView, matchData.Home.ZoneName, matchData.Home.ManagerId, matchData.Home.IsNpc, matchData.Away.ZoneName, matchData.Away.ManagerId, homeFrame, awayFrame, matchData.Away.IsNpc, true, false); Match_FightManagerinfo home, away; if (matchData.Home.IsNpc) { home = MatchDataHelper.GetFightinfo(homeNpc, homeView); } else { home = MatchDataHelper.GetFightinfoArena(homeFrame, false, homeView, matchData.Home.ZoneName); } if (matchData.Away.IsNpc) { away = MatchDataHelper.GetFightinfo(awayNpc, awayView); } else { away = MatchDataHelper.GetFightinfoArena(awayFrame, false, awayView, matchData.Away.ZoneName); } if (home == null || away == null) { return(ResponseHelper.Create <Match_FightinfoResponse>(MessageCode.NbParameterError)); } var response = ResponseHelper.CreateSuccess <Match_FightinfoResponse>(); response.Data = new Match_Fightinfo(); response.Data.Home = home; response.Data.Away = away; return(response); }
public NBSolutionInfoResponse SaveSolution(Guid managerId, int formationId, string playerString, bool hasTask) { var solution = MatchDataHelper.GetSolution(managerId); if (solution == null) { return(ResponseHelper.InvalidParameter <NBSolutionInfoResponse>()); } bool isChangePlayer = solution.PlayerString != playerString; string[] pIds = playerString.Split(','); if (pIds.Length != SystemConstants.TeammemberCount) { return(ResponseHelper.Create <NBSolutionInfoResponse>(MessageCode.TeammemberInvalidCount)); } var formation = CacheFactory.FormationCache.GetFormation(formationId); if (formation == null) { return(ResponseHelper.InvalidParameter <NBSolutionInfoResponse>()); } var teammembers = MatchDataHelper.GetTeammembers(managerId, null, true); List <int> tempPids = new List <int>(pIds.Length); int veteranCount = 0; int orangeCount = 0; int combCount = 0; foreach (var pId in pIds) { int id = ConvertHelper.ConvertToInt(pId); if (!teammembers.Exists(d => d.PlayerId == id)) { return(ResponseHelper.Create <NBSolutionInfoResponse>(MessageCode.TeammemberInvalidPlayer)); } if (tempPids.Contains(id)) { return(ResponseHelper.Create <NBSolutionInfoResponse>(MessageCode.TeammemberSolutionPlayerRepeat)); } tempPids.Add(id); var player = CacheFactory.PlayersdicCache.GetPlayer(id); if (player.CardLevel == (int)EnumPlayerCardLevel.Gold || player.CardLevel == (int)EnumPlayerCardLevel.Silver) { veteranCount++; } else if (player.CardLevel == (int)EnumPlayerCardLevel.Orange || player.CardLevel == (int)EnumPlayerCardLevel.BlackGold) { orangeCount++; } } foreach (var tempPid in tempPids) { var linkList = CacheFactory.PlayersdicCache.GetLinkPlayerList(tempPid); if (linkList != null) { foreach (var link in linkList) { if (tempPids.Exists(d => d == link)) { return(ResponseHelper.Create <NBSolutionInfoResponse>(MessageCode.TeammemberSolutionPlayerRepeat)); } } } } int veteranNumber = _maxVeteranCount; var manager = NbManagerextraMgr.GetById(managerId); if (manager == null) { return(ResponseHelper.Create <NBSolutionInfoResponse>(MessageCode.NbParameterError)); } if (manager.VeteranNumber > _maxVeteranCount) { veteranNumber = manager.VeteranNumber; } if (veteranCount > veteranNumber) { return(ResponseHelper.Create <NBSolutionInfoResponse>(MessageCode.TeammemberVeteranCountOver)); } combCount = ManagerSkillCache.Instance().GetCombsNum(tempPids.ToArray()); if (TeammemberMgr.SaveSolution(managerId, formationId, playerString, veteranCount, orangeCount, combCount)) { DeleteSolutionCache(managerId, true); ActivityExThread.Instance.TememberColect(managerId, 3, orangeCount); var response = SolutionAndTeammemberResponse(managerId); if (hasTask && isChangePlayer) { var pop = TaskHandler.Instance.SolutionChangePlayer(managerId); if (response.Data != null) { response.Data.PopMsg = pop; } } return(response); } else { return(ResponseHelper.Create <NBSolutionInfoResponse>(MessageCode.NbUpdateFail)); } }
public static List <TeammemberEntity> GetRawMembers(Guid managerId, bool homeFlag, ArenaTeammemberFrame arenaFrame, string siteId = "") { bool syncFlag = homeFlag || string.IsNullOrEmpty(siteId); return(MatchDataHelper.GetRawMembersArena(managerId, arenaFrame, syncFlag, siteId)); }
public static NbSolutionEntity GetSolutionArena(ArenaTeammemberFrame arenaFrame) { return(MatchDataHelper.GetArenaSolution(arenaFrame)); }
public static NbSolutionEntity GetSolution(Guid managerId, string siteId = "") { return(MatchDataHelper.GetSolution(managerId, siteId)); }
public MessageCode BackSaveSolution(Guid managerId, NbSolutionEntity solution, int[] newPids, List <TeammemberEntity> members) { if (null == solution) { return(MessageCode.Success); } if (newPids.Length != SystemConstants.TeammemberCount) { return(MessageCode.TeammemberInvalidCount); } if (null == members) { members = MatchDataHelper.GetTeammembers(managerId, null, true); } List <int> tempPids = new List <int>(newPids.Length); int veteranCount = 0; int orangeCount = 0; int combCount = 0; foreach (var pId in newPids) { int id = ConvertHelper.ConvertToInt(pId); if (!members.Exists(d => d.PlayerId == id)) { return(MessageCode.TeammemberInvalidPlayer); } if (tempPids.Contains(id)) { return(MessageCode.TeammemberSolutionPlayerRepeat); } tempPids.Add(id); var player = CacheFactory.PlayersdicCache.GetPlayer(id); if (player.CardLevel == (int)EnumPlayerCardLevel.Gold || player.CardLevel == (int)EnumPlayerCardLevel.Silver) { veteranCount++; } else if (player.CardLevel == (int)EnumPlayerCardLevel.Orange || player.CardLevel == (int)EnumPlayerCardLevel.BlackGold) { orangeCount++; } } int veteranNumber = _maxVeteranCount; var manager = NbManagerextraMgr.GetById(managerId); if (manager == null) { return(MessageCode.NbParameterError); } if (manager.VeteranNumber > _maxVeteranCount) { veteranNumber = manager.VeteranNumber; } if (veteranCount > veteranNumber) { return(MessageCode.TeammemberVeteranCountOver); } combCount = ManagerSkillCache.Instance().GetCombsNum(tempPids.ToArray()); string playerString = string.Join(",", newPids); if (!TeammemberMgr.SaveSolution(managerId, solution.FormationId, playerString, veteranCount, orangeCount, combCount)) { return(MessageCode.NbUpdateFail); } //DeleteSolutionCache(managerId, true); return(MessageCode.Success); }
public TeammemberEntity GetTeammember(Guid managerId, Guid teammemberId, bool withHire = false) { return(MatchDataHelper.GetTeammember(managerId, teammemberId, withHire)); }