DTOBuffMemberView GetMembers4Db(Guid managerId, ManagerSkillUseWrap use, ArenaTeammemberFrame arenaFrame) { if (!FrameConfig.SWAPBuffDataReadDb || null == use || use.Raw.SyncFlag != 0) { return(null); } var rawMembers = BuffUtil.GetRawMembers(managerId, true, arenaFrame); var members = NbManagerbuffmemberMgr.GetByMid(managerId, ShareUtil.GetTableMod(managerId)); //var extra = NbManagerextraMgr.GetById(managerId); var dic = new Dictionary <Guid, NbManagerbuffmemberEntity>(members.Count); DicPlayerEntity cfg = null; foreach (var item in members) { cfg = PlayersdicCache.Instance.GetPlayer(Math.Abs(item.Pid)); if (null == cfg) { continue; } FillBuffMemberProp(item, cfg); item.ReadySkillList = item.ReadySkills.Split(',').ToList(); item.LiveSkillList = item.LiveSkills.Split(',').ToList(); } var data = CreateBuffView(managerId, use, rawMembers.ToDictionary(i => i.Idx, i => i)); data.Kpi = arenaFrame.Kpi; data.SyncIdleFlag = false; data.BuffMembers = dic; return(data); }
void FillBuffPackRaw(DTOBuffPack buffPack, bool homeFlag, Guid managerId, ArenaTeammemberFrame arenaFrame, List <TeammemberEntity> rawMembers = null, string siteId = "") { bool memFlag = string.IsNullOrEmpty(siteId); buffPack.SetMid(homeFlag, managerId); bool topFlag = null == rawMembers; var members = buffPack.GetRawMembers(homeFlag); var pids = buffPack.GetOnPids(homeFlag); var form = buffPack.GetSolution(homeFlag); if (null == members || null != rawMembers) { if (null == rawMembers) { rawMembers = BuffUtil.GetRawMembers(managerId, homeFlag, arenaFrame, siteId); if (null == rawMembers) { throw new Exception(string.Format("BuffDataCore:Manager[{0}] site[{1}] Miss RawMembers", managerId, siteId)); } } members = rawMembers.ToDictionary(i => i.Idx, i => i); buffPack.SetRawMembers(homeFlag, members); } if (null == pids || null == form) { form = BuffUtil.GetSolutionArena(arenaFrame); var pDic = new Dictionary <int, Guid>(members.Count); foreach (var entity in members.Values) { pDic.Add(entity.PlayerId, entity.Idx); } int pid = 0; Guid tid = Guid.Empty; if (form.PlayerDic == null) { form.PlayerDic = new Dictionary <int, Entity.NBall.Custom.Teammember.SolutionPlayerEntity>(); } pids = new Dictionary <int, Guid>(form.PlayerDic.Count); foreach (var kvp in form.PlayerDic) { pid = kvp.Key; if (!pDic.TryGetValue(pid, out tid)) { break; } pids[pid] = tid; } pDic.Clear(); //if (pids.Count != CNTPlayersOn && topFlag) //{ // if (memFlag) // MemcachedFactory.ArenaSolutionClient.Delete(arenaFrame.ArenaType.ToString() + managerId.ToString()); // buffPack.SetSolution(homeFlag, null); // FillBuffPackRaw(buffPack, homeFlag, managerId,arenaFrame, BuffUtil.GetRawMembers(managerId, homeFlag,arenaFrame, siteId), siteId); // return; //} buffPack.SetSolution(homeFlag, form); buffPack.SetOnPids(homeFlag, pids); } }
public DTOBuffMemberView RebuildMembers(Guid managerId, ArenaTeammemberFrame arenaFrame) { const bool homeFlag = true; var buffPack = new DTOBuffPack(); var use = ManagerUtil.GetSkillUseWrap(managerId); var poolView = BuffPoolCore.Instance().GetRawPools(managerId, "", true); FillBuffPack(buffPack, homeFlag, managerId, arenaFrame); TeammemberDataHelper.FillTeammemberData(buffPack, homeFlag); use.OnPids = buffPack.GetOnPids(homeFlag).Keys.ToArray(); BuffUtil.GetManagerSkillList(managerId, use); BuffCache.Instance().FillRankedSkillList(buffPack.GetSBM(homeFlag), use.ManagerSkills); BuffUtil.FillLiveSkillList(use, poolView.LiveSkills); var data = CreateBuffView(managerId, use, buffPack.GetRawMembers(homeFlag)); data.PoolSyncTime = poolView.SyncTime; data.PoolSyncVersion = poolView.SyncVersion; FillBuffView(data, buffPack, homeFlag, false, 0); BuffFlowFacade.ProcManagerBuff(buffPack, homeFlag, data.FirmSkillList, false); BuffFlowFacade.ProcPlayerBuff(buffPack, homeFlag, data.BuffMembers.Values, false); BuffFlowFacade.ProcManagerBuff(buffPack, homeFlag, poolView); FillBuffView(data, buffPack, homeFlag, true, 1); data.TalentType = BuffUtil.GetTalentType(managerId); NbManagerextraMgr.UpdateKpi(managerId, data.Kpi); data.SyncIdleFlag = false; s_memBuffMember.Set(arenaFrame.ArenaType.ToString() + managerId.ToString(), data); return(data); }
/// <summary> /// 获取球员Buff /// </summary> /// <param name="managerId">经理Id</param> /// <param name="arenaFrame"></param> /// <param name="syncFlag">同步缓存标记</param> /// <returns></returns> public DTOBuffMemberView GetMembers(Guid managerId, ArenaTeammemberFrame arenaFrame, bool syncFlag = true, string siteId = "") { const bool homeFlag = true; var buffPack = new DTOBuffPack(); return(GetMembersCore(buffPack, homeFlag, managerId, arenaFrame, syncFlag, siteId)); }
void FillBuffPack(DTOBuffPack buffPack, bool homeFlag, Guid managerId, ArenaTeammemberFrame arenaFrame, List <TeammemberEntity> rawMembers = null, string siteId = "") { FillBuffPackRaw(buffPack, homeFlag, managerId, arenaFrame, rawMembers, siteId); var dicAll = buffPack.GetBuffPlayers(homeFlag); var lstOn = buffPack.GetOnBuffPlayers(homeFlag); if (null != dicAll && null != lstOn) { return; } var members = buffPack.GetRawMembers(homeFlag); var pids = buffPack.GetOnPids(homeFlag); var form = buffPack.GetSolution(homeFlag); dicAll = new Dictionary <Guid, DTOBuffPlayer>(members.Count); lstOn = new List <DTOBuffPlayer>(12); int pid = 0; Guid tid = Guid.Empty; DicPlayerEntity cfg = null; DTOBuffPlayer buffP = null; int showOrder = 1; foreach (var kvp in form.PlayerDic) { pid = kvp.Key; cfg = PlayersdicCache.Instance.GetPlayer(pid); if (null == cfg || !pids.TryGetValue(pid, out tid)) { throw new Exception(string.Format("BuffDataCore:Manager[{0}] Miss Player[{1}] With Config Or Member", managerId, pid)); } buffP = CreateBuffPlayer(cfg, showOrder++); buffP.Pos = buffP.PosOn = kvp.Value.Position; buffP.ActionSkill = kvp.Value.SkillCode; dicAll[tid] = buffP; lstOn.Add(buffP); } foreach (var kvp in members) { pid = kvp.Value.PlayerId; tid = kvp.Key; if (dicAll.ContainsKey(tid)) { continue; } cfg = PlayersdicCache.Instance.GetPlayer(pid); if (null == cfg) { continue; } buffP = CreateBuffPlayer(cfg, showOrder++, -cfg.Idx); dicAll[tid] = buffP; } buffPack.SetBuffPlayers(homeFlag, dicAll); buffPack.SetOnBuffPlayers(homeFlag, lstOn); }
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 void GetMembers(out DTOBuffMemberView homeData, out DTOBuffMemberView awayData, string homeSiteId, Guid homeId, bool isHomeNpc, string awaySiteId, Guid awayId, ArenaTeammemberFrame homeFrame, ArenaTeammemberFrame awayFrame, bool isAwayNpc, bool syncHomeFlag = true, bool syncAwayFlag = false) { var buffPack = new DTOBuffPack(); if (isHomeNpc) { syncHomeFlag = false; homeData = CloneBuffView(NpcdicCache.Instance.GetBuffView(homeId), true); } else { homeData = GetMembersCore(buffPack, true, homeId, homeFrame, syncHomeFlag, homeSiteId); } if (isAwayNpc) { syncAwayFlag = false; awayData = CloneBuffView(NpcdicCache.Instance.GetBuffView(awayId), true); } else { awayData = GetMembersCore(buffPack, false, awayId, awayFrame, syncAwayFlag, awaySiteId); } string antiTalentSkill; if (ManagerSkillCache.Instance().TryGetAntiTanlent(out antiTalentSkill, homeData.TalentType, awayData.TalentType)) { if (null == homeData.ReadySkillList) { homeData.ReadySkillList = new List <string>(2); } homeData.ReadySkillList.Add(antiTalentSkill); } if (ManagerSkillCache.Instance().TryGetAntiTanlent(out antiTalentSkill, awayData.TalentType, homeData.TalentType)) { if (null == awayData.ReadySkillList) { awayData.ReadySkillList = new List <string>(2); } awayData.ReadySkillList.Add(antiTalentSkill); } int cntHome = 0; int cntAway = 0; if (null != homeData.ReadySkillList) { cntHome = homeData.ReadySkillList.Count; } if (null != awayData.ReadySkillList) { cntAway = awayData.ReadySkillList.Count; } if (cntHome == 0 && cntAway == 0) { return; } if (isHomeNpc) { FillBuffPack(buffPack, true, homeData.BuffPlayers); } else { FillBuffPack(buffPack, true, homeId, homeFrame, null, homeSiteId); } if (isAwayNpc) { FillBuffPack(buffPack, false, awayData.BuffPlayers); } else { FillBuffPack(buffPack, false, awayId, awayFrame, null, awaySiteId); } BuffFlowFacade.ProcManagerBuff(buffPack, true, homeData.ReadySkillList, true); BuffFlowFacade.ProcManagerBuff(buffPack, false, awayData.ReadySkillList, true); FillBuffView(homeData, buffPack, true, true, 2); FillBuffView(awayData, buffPack, false, true, 2); }
DTOBuffMemberView GetMembers4Mem(out ManagerSkillUseWrap use, out DTOBuffPoolView poolView, Guid managerId, string siteId, ArenaTeammemberFrame arenaFrame) { use = ManagerUtil.GetSkillUseWrap(managerId, siteId); poolView = BuffPoolCore.Instance().GetRawPools(managerId, siteId, true); bool syncFlag = true; if (FrameConfig.SWAPBuffDisableCrossCache && !string.IsNullOrEmpty(siteId)) { syncFlag = false; } ulong verNo = use.VersionNo; DateTime dtNow = DateTime.Now; if (verNo == 0 || dtNow >= poolView.SyncTime) { if (syncFlag) { s_buffSync.SyncBuffPools(managerId, siteId); } return(null); } var data = s_memBuffMember.Get <DTOBuffMemberView>(arenaFrame.ArenaType.ToString() + managerId.ToString()); if (null != data && data.UseSyncVersion == verNo && data.PoolSyncTime == poolView.SyncTime && data.PoolSyncVersion == poolView.SyncVersion) { return(data); } return(null); }
DTOBuffMemberView GetMembersCore(DTOBuffPack buffPack, bool homeFlag, Guid managerId, ArenaTeammemberFrame arenaFrame, bool syncFlag = true, string siteId = "") { if (FrameConfig.SWAPBuffDisableCrossCache && !string.IsNullOrEmpty(siteId)) { syncFlag = false; } ManagerSkillUseWrap use; DTOBuffPoolView poolView; var data = GetMembers4Mem(out use, out poolView, managerId, siteId, arenaFrame); do { if (null != data) { break; } if (string.IsNullOrEmpty(siteId)) { data = GetMembers4Db(managerId, use, arenaFrame); } if (null == data) { FillBuffPack(buffPack, homeFlag, managerId, arenaFrame, null, siteId); TeammemberDataHelper.FillTeammemberData(buffPack, homeFlag, siteId); use.OnPids = buffPack.GetOnPids(homeFlag).Keys.ToArray(); BuffUtil.GetManagerSkillList(managerId, use, siteId); BuffCache.Instance().FillRankedSkillList(buffPack.GetSBM(homeFlag), use.ManagerSkills); BuffUtil.FillLiveSkillList(use, poolView.LiveSkills); data = CreateBuffView(managerId, use, buffPack.GetRawMembers(homeFlag)); data.PoolSyncTime = poolView.SyncTime; data.PoolSyncVersion = poolView.SyncVersion; FillBuffView(data, buffPack, homeFlag, false, 0); BuffFlowFacade.ProcManagerBuff(buffPack, homeFlag, data.FirmSkillList, false); BuffFlowFacade.ProcPlayerBuff(buffPack, homeFlag, data.BuffMembers.Values, false); BuffFlowFacade.ProcManagerBuff(buffPack, homeFlag, poolView); FillBuffView(data, buffPack, homeFlag, true, 1); } data.TalentType = BuffUtil.GetTalentType(managerId, siteId); if (syncFlag) { s_buffSync.SyncBuffMembers(managerId, arenaFrame.ArenaType, CloneBuffView(data), siteId); } }while (false); data.KpiReady = data.Kpi; data.ClothId = BuffPoolCore.Instance().GetManagerClothId(managerId, poolView); return(data); }