Пример #1
0
        public void ProcBuffFlow(List <DTOBuffPlayer> buffDest, DTOBuffPack buffPack, bool homeFlag, string skillKey, ConfigBuffengineEntity buffFlow)
        {
            var buffList = buffFlow.PropIndexList;

            if (null == buffList || buffList.Length == 0)
            {
                return;
            }
            double buffVal = (double)buffFlow.BuffVal;
            double buffPer = (double)buffFlow.BuffPer;
            string args    = skillKey.Substring(skillKey.LastIndexOf('.') + 1);
            int    fact    = 0;

            if (!int.TryParse(args, out fact) || fact <= 0)
            {
                fact = 1;
            }
            foreach (var dst in buffDest)
            {
                foreach (int idx in buffList)
                {
                    if (idx >= 0 && idx < dst.Props.Length)
                    {
                        dst.Props[idx].Point   += buffVal * fact;
                        dst.Props[idx].Percent += buffPer * fact;
                    }
                }
            }
        }
Пример #2
0
        /// <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));
        }
Пример #3
0
        public void ProcBuffFlow(List <DTOBuffPlayer> buffDest, DTOBuffPack buffPack, bool homeFlag, string skillKey, ConfigBuffengineEntity buffFlow)
        {
            var buffList = buffFlow.PropIndexList;

            if (null == buffList || buffList.Length == 0)
            {
                return;
            }
            double buffVal   = (double)buffFlow.BuffVal;
            double buffPer   = (double)buffFlow.BuffPer;
            int    skillStar = 0;
            int    skillLv   = 0;

            string[] args = skillKey.Split('.');
            if (args.Length >= 2 && !int.TryParse(args[1], out skillStar) || skillStar <= 0)
            {
                skillStar = 0;
            }
            if (args.Length >= 3 && !int.TryParse(args[2], out skillLv) || skillLv <= 0)
            {
                skillLv = 1;
            }
            foreach (var dst in buffDest)
            {
                foreach (int idx in buffList)
                {
                    if (idx >= 0 && idx < dst.Props.Length)
                    {
                        dst.Props[idx].Point   += buffVal * (100 + skillLv - 1 + skillStar * 20) / 100d;
                        dst.Props[idx].Percent += buffPer * (100 + skillLv - 1 + skillStar * 20) / 100d;
                    }
                }
            }
        }
Пример #4
0
        public static void ProcManagerBuff(DTOBuffPack buffPack, bool homeFlag, DTOBuffPoolView poolView = null)
        {
            Guid managerId = buffPack.GetMid(homeFlag);
            var  pools     = BuffPoolCore.Instance().GetBuffSource(managerId, EnumBuffUnitType.PlayerProp, true, poolView);

            ProcBuffPool(buffPack, homeFlag, Guid.Empty, pools);
        }
Пример #5
0
        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);
        }
Пример #6
0
        static void ProcBuffPool(DTOBuffPack buffPack, bool homeFlag, Guid memberId, List <NbManagerbuffpoolEntity> buffPools)
        {
            if (null == buffPack || null == buffPools || buffPools.Count == 0)
            {
                return;
            }
            var proc = CreateBuffPoolProc();

            if (null == proc)
            {
                return;
            }
            char split = BuffCache.SPLITValues;
            List <DTOBuffPlayer> buffDest = null;
            var dicDest = new Dictionary <string, List <DTOBuffPlayer> >();

            foreach (var pool in buffPools)
            {
                buffDest = GetBuffDest(dicDest, buffPack, homeFlag, memberId, pool.DstMode, pool.DstDir, pool.DstKey);
                if (null == buffDest || buffDest.Count == 0)
                {
                    continue;
                }
                proc.ProcBuffPool(buffDest, pool.SkillCode, FrameUtil.CastIntArray(pool.BuffMap, split), (double)pool.BuffVal, (double)pool.BuffPer);
            }
            dicDest.Clear();
        }
Пример #7
0
        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);
        }
Пример #8
0
 void FillBuffPack(DTOBuffPack buffPack, bool homeFlag, Dictionary <Guid, DTOBuffPlayer> buffPlayers)
 {
     if (null == buffPlayers)
     {
         return;
     }
     buffPack.SetBuffPlayers(homeFlag, buffPlayers);
     buffPack.SetOnBuffPlayers(homeFlag, buffPlayers.Values.ToList());
     //buffPack.SetOnPids(homeFlag, buffPlayers.ToDictionary(i => i.Value.Pid, i => i.Key));
 }
Пример #9
0
        protected IEnumerable <DTOBuffPlayer> GetRootDest(DTOBuffPack buffPack, bool homeFlag, Guid memberId, int dstDir)
        {
            if (null == buffPack)
            {
                return(null);
            }
            switch (dstDir)
            {
            case 0:    //己方全体
                var players = buffPack.GetBuffPlayers(homeFlag);
                if (null == players)
                {
                    return(null);
                }
                return(players.Values);

            case 1:    //己方场上
                var onPlayers = buffPack.GetOnBuffPlayers(homeFlag);
                if (null == onPlayers)
                {
                    return(null);
                }
                return(onPlayers);

            case 9:    //自己
                players = buffPack.GetBuffPlayers(homeFlag);
                DTOBuffPlayer player = null;
                if (players.TryGetValue(memberId, out player))
                {
                    return new DTOBuffPlayer[] { player }
                }
                ;
                return(null);

            case 10:    //对方全体
                players = buffPack.GetBuffPlayers(!homeFlag);
                if (null == players)
                {
                    return(null);
                }
                return(players.Values);

            case 11:    //对方场上
                onPlayers = buffPack.GetOnBuffPlayers(!homeFlag);
                if (null == onPlayers)
                {
                    return(null);
                }
                return(onPlayers);

            default:
                return(null);
            }
        }
Пример #10
0
        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);
        }
Пример #11
0
        public override List <DTOBuffPlayer> GetBuffDest(DTOBuffPack buffPack, bool homeFlag, Guid memberId, int dstDir, string dstKey)
        {
            var rootDest = GetRootDest(buffPack, homeFlag, memberId, dstDir);

            if (null == rootDest)
            {
                return(null);
            }
            if (string.IsNullOrEmpty(dstKey))
            {
                return(rootDest.ToList());
            }
            return(rootDest.Where(i => string.Compare(i.Nationality, dstKey, true) == 0).ToList());
        }
Пример #12
0
        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);
        }
Пример #13
0
        public override List <DTOBuffPlayer> GetBuffDest(DTOBuffPack buffPack, bool homeFlag, Guid memberId, int dstDir, string dstKey)
        {
            var rootDest = GetRootDest(buffPack, homeFlag, memberId, dstDir);

            if (null == rootDest)
            {
                return(null);
            }
            if (string.IsNullOrEmpty(dstKey))
            {
                return(rootDest.ToList());
            }
            char split = BuffCache.SPLITValues;

            dstKey += split;
            return(rootDest.Where(i => dstKey.IndexOf(i.Clr.ToString() + split) >= 0).ToList());
        }
Пример #14
0
        /// <summary>
        /// 填充球员数据
        /// 装备数据,副卡加成,成长加点,阵型加成,等级加成
        /// </summary>
        /// <param name="buffPack"></param>
        /// <param name="homeFlag"></param>
        public static void FillTeammemberData(DTOBuffPack buffPack, bool homeFlag, string siteId = "")
        {
            try
            {
                var managerSBMList = new List <string>();
                buffPack.SetSBM(homeFlag, managerSBMList);

                var members     = buffPack.GetRawMembers(homeFlag);
                var buffPlayers = buffPack.GetBuffPlayers(homeFlag);
                //套装字典 套装id->数量
                Dictionary <int, List <int> > suitDic = new Dictionary <int, List <int> >();
                //套装id->套装类型
                Dictionary <int, int> suitTypeDic = new Dictionary <int, int>();
                foreach (var teammember in members.Values)
                {
                    var buffPlayer = buffPlayers[teammember.Idx];
                    buffPlayer.SBMList   = new List <string>();
                    buffPlayer.Strength  = teammember.Strength;
                    buffPlayer.Level     = teammember.Level;
                    buffPlayer.ArousalLv = teammember.ArousalLv;
                    ////球星技能
                    buffPlayer.StarSkill = CacheFactory.PlayersdicCache.GetStarSkill(buffPlayer.AsPid, buffPlayer.Strength, teammember.ArousalLv);
                    //装备和副卡 徽章
                    FillEquipData(buffPlayer, teammember.Equipment, ref suitDic, ref suitTypeDic);
                    //成长
                    FillTeammemberGrowData(teammember, buffPlayer);
                    //等级
                    FillTeammemberLevelData(teammember, buffPlayer);
                    //球员星级
                    TheStarPlayerCardData(teammember, buffPlayer);
                    //球星潜力
                    FillPlayerCardData(buffPlayer, teammember);
                }
                //套装
                FillSuitData(suitDic, suitTypeDic, ref managerSBMList);
                //阵型加成
                var solution = buffPack.GetSolution(homeFlag);
                FillFormationData(solution.FormationId, solution.FormationLevel, ref managerSBMList);
                //教练加成
                FillCoachData(buffPack.GetMid(homeFlag), managerSBMList, siteId);
            }
            catch (Exception ex)
            {
                LogHelper.Insert(ex, "TeammemberDataHelper:FillTeammemberData");
            }
        }
Пример #15
0
        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);
            }
        }
Пример #16
0
        static void ProcBuffFlow(DTOBuffPack buffPack, bool homeFlag, Guid memberId, Dictionary <string, List <ConfigBuffengineEntity> > buffFlows)
        {
            if (null == buffPack || null == buffFlows || buffFlows.Count == 0)
            {
                return;
            }
            string               skillKey = string.Empty;
            IBuffCheck           chk      = null;
            IBuffFlowProc        proc     = null;
            List <DTOBuffPlayer> buffDest = null;
            var dicDest = new Dictionary <string, List <DTOBuffPlayer> >();

            foreach (var kvp in buffFlows)
            {
                skillKey = kvp.Key;
                foreach (var flow in kvp.Value)
                {
                    chk = CreateBuffCheck(flow.CheckMode);
                    if (null != chk && !chk.CheckBuff(buffPack, homeFlag, flow.CheckKey))
                    {
                        continue;
                    }
                    proc = CreateBuffFlowProc(flow.CalcMode);
                    if (null == proc)
                    {
                        continue;
                    }
                    buffDest = GetBuffDest(dicDest, buffPack, homeFlag, memberId, flow.DstMode, flow.DstDir, flow.DstKey);
                    if (null == buffDest || buffDest.Count == 0)
                    {
                        continue;
                    }
                    proc.ProcBuffFlow(buffDest, buffPack, homeFlag, skillKey, flow);
                }
            }
            dicDest.Clear();
        }
Пример #17
0
        void FillBuffView(DTOBuffMemberView buffView, DTOBuffPack buffPack, bool homeFlag, bool fillProp = true, int fillKpi = 0)
        {
            var solution = buffPack.GetSolution(homeFlag);

            FillBuffView(buffView, buffPack.GetBuffPlayers(homeFlag), fillProp, fillKpi, solution.FormationId);
        }
Пример #18
0
        static List <DTOBuffPlayer> GetBuffDest(Dictionary <string, List <DTOBuffPlayer> > dicDest, DTOBuffPack buffPack, bool homeFlag, Guid memberId, int dstMode, int dstDir, string dstKey)
        {
            string dstIdx = CastDestIdx(dstMode, dstDir, dstKey);
            List <DTOBuffPlayer> list;

            if (dicDest.TryGetValue(dstIdx, out list))
            {
                return(list);
            }
            var dst = CreateBuffDest(dstMode);

            if (null == dst)
            {
                return(null);
            }
            return(dst.GetBuffDest(buffPack, homeFlag, memberId, dstDir, dstKey));
        }
Пример #19
0
 public bool CheckBuff(DTOBuffPack buffPack, bool homeFlag, string checkKey)
 {
     return(true);
 }
Пример #20
0
 public abstract List <DTOBuffPlayer> GetBuffDest(DTOBuffPack buffPack, bool homeFlag, Guid memberId, int dstDir, string dstKey);
Пример #21
0
 public void ProcBuffFlow(List <DTOBuffPlayer> buffDest, DTOBuffPack buffPack, bool homeFlag, string skillKey, ConfigBuffengineEntity buffFlow)
 {
     ProcBuffPool(buffDest, skillKey, buffFlow.PropIndexList, (double)buffFlow.BuffVal, (double)buffFlow.BuffPer);
 }
Пример #22
0
        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);
        }