public List <DTOBuffValue> GetManagerShowBuffList(Guid managerId) { bool syncFlag = true; var values = GetBuffValues(managerId, EnumBuffUnitType.ManagerShow, true, syncFlag, BuffCache.BUFFCodes4ManagerShow); if (null == values || values.Length == 0) { return(null); } var list = new List <DTOBuffValue>(values.Length); foreach (var item in values) { if (null != item.SrcList) { list.Add(item); } } DicBuffEntity buffCfg = null; foreach (var item in list) { if (BuffCache.Instance().TryGetBuff(out buffCfg, item.BuffId)) { item.BuffName = buffCfg.BuffName; item.Icon = buffCfg.Icon; item.BuffMemo = string.Format(buffCfg.Memo, item.Point, item.Percent); } foreach (var srcItem in item.SrcList) { srcItem.SkillName = BuffCache.Instance().GetSkillName(srcItem.SkillCode, srcItem.SkillLevel); } } return(list); }
public static List <string>[] GetManagerSkillList(Guid managerId, ManagerSkillUseWrap use, string siteId = "") { var lstAll = new List <string>(); var lib = ManagerUtil.GetSkillLibWrap(managerId, siteId); FixTalents(use, lib, siteId); lstAll.AddRange(lib.LowWills.Keys); lstAll.AddRange(use.SetWills.Keys); lstAll.AddRange(lib.NodoTalents.Keys); if (!string.IsNullOrEmpty(use.Raw.CoachSkill)) { lstAll.Add(use.Raw.CoachSkill); } //var combs = ManagerSkillCache.Instance().CheckCombs(use.SetWills.Keys, use.OnPids); //var combs = ManagerSkillCache.Instance().CheckCombs(use.OnPids); //if (null != combs) // lstAll.AddRange(combs); var clubSkills = ManagerSkillCache.Instance().CheckClubSkills(use.OnPids); if (null != clubSkills) { lstAll.AddRange(clubSkills); } var rankSkills = BuffCache.Instance().GetRankedSkillList(lstAll); //if (null != combs) // rankSkills[1].AddRange(combs); var skills = use.ManagerSkills; skills[0] = rankSkills[0]; skills[1] = rankSkills[1]; skills[2] = rankSkills[2]; return(skills); }
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); }
void FillBuffMemberSkill(DTOBuffMemberView view, NbManagerbuffmemberEntity member, DTOBuffPlayer player) { member.MatchPropList = player.MatchPropList; member.MatchBoostList = player.MatchBoostList; if (null == view.ReadySkillList) { view.ReadySkillList = new List <string>(); } member.LiveSkillList = new List <string>(); member.FirmSkillList = new List <string>(); if (null != player.SBMList) { var rankSkills = BuffCache.Instance().GetRankedSkillList(player.SBMList); view.ReadySkillList.AddRange(rankSkills[0]); member.LiveSkillList.AddRange(rankSkills[1]); member.FirmSkillList.AddRange(rankSkills[2]); } var skill = player.ActionSkill; if (!string.IsNullOrEmpty(skill)) { member.LiveSkillList.Add(skill); } skill = player.StarPlusSkill; if (!string.IsNullOrEmpty(skill)) { member.LiveSkillList.Add(skill); } skill = player.StarSkill; if (!string.IsNullOrEmpty(skill)) { member.LiveSkillList.AddRange(player.AsStarSkill); } }
internal DTOBuffPoolView ReqRawPools(Guid managerId, string siteId = "", bool syncFlag = true) { int managerHash = ShareUtil.GetTableMod(managerId); byte[] verDb = null; var data = CreateBuffView(); var pools = NbManagerbuffpoolMgr.GetByMid(managerId, managerHash, siteId); var teamPools = CheckTeamBuffPools(managerId, siteId); if (null != teamPools) { pools.AddRange(teamPools); } NbManagerbuffpoolMgr.GetVersionByMid(managerId, managerHash, ref verDb, null, siteId); ulong verNo = 0; if (null != verDb) { verNo = BitConverter.ToUInt64(verDb, 0); } DateTime dtNow = DateTime.Now; DateTime dtSync = DATEInfi; List <string> liveSkills = null; foreach (var item in pools) { if (dtNow < item.ExpiryTime && item.ExpiryTime < dtSync) { dtSync = item.ExpiryTime; } if (item.LiveFlag != 2) { continue; } if (null == liveSkills) { liveSkills = new List <string>(); } liveSkills.Add(BuffCache.Instance().CastSkillKey(item.SkillCode, item.SkillLevel)); } data.BuffPools = pools; data.LiveSkills = liveSkills; data.SyncTime = dtSync; data.SyncVersion = verNo; if (syncFlag) { s_memBuffPool.Set(managerId.ToString(), data); } return(data); }
public static void ProcManagerBuff(DTOBuffPack buffPack, bool homeFlag, List <string> skillList, bool liveFlag) { if (null == skillList || skillList.Count == 0) { return; } var flows = liveFlag ? BuffCache.Instance().GetReadyBuffList(skillList) : BuffCache.Instance().GetFirmBuffList(skillList); if (null == flows || flows.Count == 0) { return; } ProcBuffFlow(buffPack, homeFlag, Guid.Empty, flows); }
public List <NbManagerbuffpoolEntity> CheckTeamBuffPools(Guid mid, string siteId = "") { var form = MemcachedFactory.SolutionClient.Get <NbSolutionEntity>(mid); if (null == form) { form = NbSolutionMgr.GetById(mid, siteId); } if (null == form) { return(null); } var pids = FrameUtil.CastIntList(form.PlayerString, ','); string club = string.Empty; string nation = string.Empty; DicPlayerEntity cfg = null; foreach (int pid in pids) { cfg = PlayersdicCache.Instance.GetPlayer(pid); if (null == cfg) { continue; } if (club == string.Empty) { club = cfg.Club; } if (nation == string.Empty) { nation = cfg.Nationality; } if (null != club && cfg.Club != club) { club = null; } if (null != nation && cfg.Nationality != nation) { nation = null; } } if (null != club || null != nation) { return(BuffCache.Instance().GenManagerPoolList(SKILLTeamBuff)); } 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); }
public static void FillPlayerCardData(DTOBuffPlayer buffPlayer, TeammemberEntity teammember) { try { if (null == teammember.PlayerCard || null == teammember.PlayerCard.Property) { return; } var cardProp = teammember.PlayerCard.Property; if (null == cardProp.Potential) { return; } ConfigPotentialEntity cfg; double point, percent; foreach (var item in cardProp.Potential) { cfg = PlayersdicCache.Instance.GetPotentialConfig(item.Level, item.Idx); if (null == cfg) { continue; } if (cfg.BuffType == 2) { point = 0; percent = Convert.ToDouble(item.Buff) / 100d; } else { point = Convert.ToDouble(item.Buff); percent = 0; } if (cfg.BuffId < 1000) { buffPlayer.SBMList.Add(BuffCache.Instance().GetVarySkillCode(cfg.BuffId, point, percent)); } else { buffPlayer.AddMatchBuff(point, percent, cfg.BuffId); } } } catch (Exception ex) { LogHelper.Insert(ex, "TeammemberDataHelper:FillPlayerCardData"); } }
public static void ProcPlayerBuff(DTOBuffPack buffPack, bool homeFlag, IEnumerable <NbManagerbuffmemberEntity> memberList, bool liveFlag) { List <string> skillList = null; Dictionary <string, List <ConfigBuffengineEntity> > flows = null; foreach (var item in memberList) { skillList = liveFlag ? item.ReadySkillList : item.FirmSkillList; if (null == skillList || skillList.Count == 0) { continue; } flows = liveFlag ? BuffCache.Instance().GetReadyBuffList(skillList) : BuffCache.Instance().GetFirmBuffList(skillList); if (null == flows || flows.Count == 0) { continue; } ProcBuffFlow(buffPack, homeFlag, item.Tid, flows); } }
void GetExcSkillBuffs(out string[] excSkills, out int[] excBuffs, string skillCode, int skillLevel) { const int exLen = 5; excSkills = new string[exLen]; excBuffs = new int[exLen]; var excPools = BuffCache.Instance().GetPoolExcBuffList(skillCode, skillLevel); for (int i = 0; i < exLen; i++) { if (i < excPools.Count) { excSkills[i] = excPools[i].SkillCode; excBuffs[i] = excPools[i].BuffNo; } else { excSkills[i] = string.Empty; excBuffs[i] = -1; } } }
/// <summary> /// 添加技能Buff,自动提交事务 /// </summary> /// <param name="managerId">经理Id</param> /// <param name="srcId">来源Id</param> /// <param name="skillCode">技能Code</param> /// <param name="skillLevel">技能等级</param> /// <param name="tranMgr">事务对象</param> /// <returns></returns> public bool PostAddPools(Guid managerId, string srcId, string skillCode, int skillLevel = 0, TransactionManager tranMgr = null) { try { int managerHash = ShareUtil.GetTableMod(managerId); var incPools = BuffCache.Instance().GetPoolIncBuffList(skillCode, skillLevel); var flows = BuffCache.Instance().GetFirmBuffList(skillCode, skillLevel); bool syncFlow = (null != flows && flows.Count > 0); if (null == incPools || incPools.Count == 0) { if (null != tranMgr && tranMgr.IsOpen) { tranMgr.Commit(); } if (syncFlow) { s_buffSync.SetBuffMembers(managerId); } return(true); } string[] excSkills; int[] excBuffs; GetExcSkillBuffs(out excSkills, out excBuffs, skillCode, skillLevel); if (null == tranMgr) { tranMgr = new TransactionManager(Dal.ConnectionFactory.Instance.GetDefault()); } using (tranMgr) { if (!tranMgr.IsOpen) { tranMgr.BeginTransaction(); } if (excSkills[0] != string.Empty) { NbManagerbuffpoolMgr.ExcludeMulti(managerId, managerHash, excSkills[0], excBuffs[0], excSkills[1], excBuffs[1], excSkills[2], excBuffs[2], excSkills[3], excBuffs[3], excSkills[4], excBuffs[4], tranMgr.TransactionObject); } foreach (var cfg in incPools) { NbManagerbuffpoolMgr.Include(managerId, managerHash, cfg.SkillCode, cfg.SkillLevel, cfg.BuffSrcType, srcId, (int)cfg.AsBuffUnitType, cfg.LiveFlag, cfg.BuffNo, cfg.DstDir, cfg.DstMode, cfg.DstKey, cfg.BuffMap, cfg.BuffVal, cfg.BuffPer, cfg.ExpiryMinutes, cfg.LimitTimes, cfg.TotalTimes, cfg.RepeatBuffFlag, cfg.RepeatTimeFlag, cfg.RepeatTimesFlag, tranMgr.TransactionObject); } tranMgr.Commit(); } s_buffSync.SyncBuffPools(managerId); if (syncFlow) { s_buffSync.SetBuffMembers(managerId); } return(true); } catch (Exception ex) { LogHelper.Insert(ex, "BuffPoolCore:PostAddPools"); throw ex; } }
/// <summary> /// 获取多个Buff /// </summary> /// <param name="managerId">经理Id</param> /// <param name="unitType">Buff细分类型</param> /// <param name="fillSource">是否填充源</param> /// <param name="syncFlag">缓存标记</param> /// <param name="buffCodes">Buff枚举</param> /// <returns></returns> public DTOBuffValue[] GetBuffValues(Guid managerId, EnumBuffUnitType unitType = EnumBuffUnitType.None, bool fillSource = false, bool syncFlag = true, params EnumBuffCode[] buffCodes) { if (null == buffCodes || buffCodes.Length == 0) { return(null); } int cnt = buffCodes.Length; var arr = new DTOBuffValue[cnt]; int buffId = 0; DTOBuffValue obj = null; Dictionary <int, DTOBuffValue> dic = null; bool multiFlag = cnt > 1; if (multiFlag) { dic = new Dictionary <int, DTOBuffValue>(cnt); for (int i = 0; i < buffCodes.Length; ++i) { buffId = (int)buffCodes[i]; if (!dic.TryGetValue(buffId, out obj)) { obj = new DTOBuffValue(buffId); dic[buffId] = obj; } arr[i] = obj; } } else { buffId = (int)buffCodes[0]; obj = new DTOBuffValue(buffId); arr[0] = obj; } var pools = GetBuffSource(managerId, unitType, syncFlag); if (null == pools || pools.Count == 0) { return(arr); } int[] buffIds = null; DateTime dtNow = DateTime.Now; foreach (var item in pools) { if (item.ExpiryTime <= dtNow) { continue; } buffIds = BuffCache.Instance().GetBaseBuffArray(item.BuffMap); if (null == buffIds) { continue; } foreach (int val in buffIds) { if (!multiFlag && val != buffId || multiFlag && !dic.TryGetValue(val, out obj)) { continue; } obj.Point += (double)item.BuffVal; obj.Percent += (double)item.BuffPer; if (fillSource) { if (null == obj.SrcList) { obj.SrcList = new List <DTOBuffSource>(); } obj.SrcList.Add(new DTOBuffSource() { Idx = item.Id, SkillCode = item.SkillCode, SkillLevel = item.SkillLevel, Point = (double)item.BuffVal, Percent = (double)item.BuffPer, ExpiryTime = ShareUtil.GetTimeTick(item.ExpiryTime), }); } if (!multiFlag) { break; } } } if (multiFlag) { dic.Clear(); } return(arr); }
public static DTOBuffMemberView GetMemberView(LocalTransferManagerEntity localManager) { var data = new DTOBuffMemberView(); //TODO: CombLevel var managerSBMList = new List <string>(); //套装字典 套装id->数量 var suitDic = new Dictionary <int, int>(); //套装id->套装类型 var suitTypeDic = new Dictionary <int, int>(); var buffPlayers = new Dictionary <Guid, DTOBuffPlayer>(PLAERCOUNT); foreach (var playerEntity in localManager.Players) { buffPlayers.Add(Guid.NewGuid(), BuildPlayer(playerEntity)); } //套装 //TeammemberDataHelper.FillSuitData(suitDic, suitTypeDic, ref managerSBMList); //阵型加成 TeammemberDataHelper.FillFormationData(localManager.FormationId, localManager.FormationLevel, ref managerSBMList); //天赋意志处理 var skills = new List <string>(); string[] subSkills = new string[2]; //天赋 if (localManager.TalentId > 0) { var localTalent = LocalHelper.TalentList.Talents.Find(d => d.Id == localManager.TalentId); if (localTalent != null) { string talent = string.Empty; LocalTalentEntity talentCfg = null; int len = 0; foreach (var talentdata in localTalent.Talentdatas) { talent = talentdata.Id; talentCfg = LocalHelper.LocalCache.Talents.Find(i => i.Id == talent); if (null == talentCfg) { continue; } if (talentCfg.DriveType == 0 || len >= 2) { skills.Add(talent); } else { subSkills[len++] = talent; } } } } //意志 组合 if (localManager.WillId > 0) { var localWill = LocalHelper.WillList.Wills.Find(d => d.Id == localManager.WillId); if (localWill != null) { foreach (var willdata in localWill.Willdatas) { skills.Add(willdata.Id); } } } //套装效果 if (localManager.SuitId > 0) { var locaSuit = LocalHelper.SuitList.Suits.Find(d => d.Id == localManager.SuitId); if (locaSuit != null) { foreach (var suitdata in locaSuit.Suitdatas) { skills.Add(suitdata.Id.ToString()); } } } var rankSkills = BuffCache.Instance().GetRankedSkillList(skills); foreach (var item in skills) { if (item.Substring(0, 1).ToUpper() == "H") { rankSkills[1].Add(item); } } var buffPack = new DTOBuffPack(); const bool homeFlag = true; buffPack.SetBuffPlayers(homeFlag, buffPlayers); buffPack.SetOnBuffPlayers(homeFlag, buffPlayers.Values.ToList()); BuffFlowFacade.ProcManagerBuff(buffPack, homeFlag, rankSkills[2], false); data.ReadySkillList = rankSkills[0]; data.LiveSkillList = rankSkills[1]; data.SubSkills = subSkills; BuffDataCore.Instance().FillBuffView(data, buffPlayers, true, 1); //TODO:球员组合 //DTOBuffPlayer player = null; //foreach (var member in data.BuffMembers.Values) //{ // if (!buffPlayers.TryGetValue(member.Tid, out player)) // continue; // if (string.IsNullOrEmpty(player.StarSkill)) // continue; // if (null == member.LiveSkillList) // member.LiveSkillList = new List<string>(); // member.LiveSkillList.Add(player.StarSkill); //} return(data); }