Beispiel #1
0
        public static List <TeammemberEntity> GetRawMembers(Guid managerId, bool syncFlag = true, string siteId = "")
        {
            try
            {
                List <TeammemberEntity> list = null;
                if (syncFlag)
                {
                    list = MemcachedFactory.TeammembersClient.Get <List <TeammemberEntity> >(managerId);
                }
                if (null != list && list.Count > 0)
                {
                    return(list);
                }
                list = TeammemberMgr.GetByManager(managerId, ShareUtil.GetTableMod(managerId), siteId);

                TeammemberGrowEntity grow = null;
                var growList = TeammemberGrowMgr.GetByManager(managerId, siteId);
                foreach (var entity in list)
                {
                    if (!entity.IsHirePlayer)
                    {
                        grow = growList.Find(d => d.Idx == entity.Idx);
                        if (grow != null)
                        {
                            entity.GrowLevel = grow.GrowLevel;
                        }
                    }
                    if (entity.UsedPlayerCard != null && entity.UsedPlayerCard.Length > 0)
                    {
                        entity.PlayerCard = SerializationHelper.FromByte <PlayerCardUsedEntity>(entity.UsedPlayerCard);
                    }
                    if (entity.UsedEquipment != null && entity.UsedEquipment.Length > 0)
                    {
                        entity.Equipment = SerializationHelper.FromByte <EquipmentUsedEntity>(entity.UsedEquipment);
                    }
                    TeammemberDataHelper.CalPropertyCount(entity);
                    if (entity.IsHirePlayer)
                    {
                        TeammemberDataHelper.CalMaxGrow(entity, null);
                    }
                    else
                    {
                        TeammemberDataHelper.CalMaxGrow(entity, grow, siteId);
                    }
                    entity.RawProperty = new TeammemberPropertyEntity(entity);
                }
                if (syncFlag && list.Count > 0)
                {
                    MemcachedFactory.TeammembersClient.Set(managerId, list);
                }
                return(list);
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("GetRawMembers", string.Format("mid:{0}", managerId), ex);
                throw ex;
            }
        }
Beispiel #2
0
        public static DTOBuffMemberView GetMemberView(DicNpcEntity npcEntity)
        {
            if (npcEntity.Type == 1 || npcEntity.Type == 2 || npcEntity.Type == 3 || npcEntity.Type == 4 || npcEntity.Type == 5 || npcEntity.Type == 6)//球星启示录计算真实kpi
            {
                npcEntity.KpiBuff = npcEntity.Buff;
                npcEntity.Buff    = 100;// npcEntity.Buff;
            }
            else
            {
                npcEntity.KpiBuff = 100;
            }
            var data = new DTOBuffMemberView();
            //TODO: CombLevel

            var managerSBMList = new List <string>();
            //套装字典 套装id->数量
            var suitDic = new Dictionary <int, List <int> >();
            //套装id->套装类型
            var suitTypeDic      = new Dictionary <int, int>();
            var formationDetails = CacheFactory.FormationCache.GetFormationDetail(npcEntity.FormationId);
            int i = 0;

            var buffPlayers = new Dictionary <Guid, DTOBuffPlayer>(PLAERCOUNT);

            buffPlayers.Add(Guid.NewGuid(), BuildPlayer(npcEntity, npcEntity.TP1, npcEntity.TE1, npcEntity.TS1, formationDetails[i++].Position, npcEntity.KpiBuff, ref suitDic, ref suitTypeDic));
            buffPlayers.Add(Guid.NewGuid(), BuildPlayer(npcEntity, npcEntity.TP2, npcEntity.TE2, npcEntity.TS2, formationDetails[i++].Position, npcEntity.KpiBuff, ref suitDic, ref suitTypeDic));
            buffPlayers.Add(Guid.NewGuid(), BuildPlayer(npcEntity, npcEntity.TP3, npcEntity.TE3, npcEntity.TS3, formationDetails[i++].Position, npcEntity.KpiBuff, ref suitDic, ref suitTypeDic));
            buffPlayers.Add(Guid.NewGuid(), BuildPlayer(npcEntity, npcEntity.TP4, npcEntity.TE4, npcEntity.TS4, formationDetails[i++].Position, npcEntity.KpiBuff, ref suitDic, ref suitTypeDic));
            buffPlayers.Add(Guid.NewGuid(), BuildPlayer(npcEntity, npcEntity.TP5, npcEntity.TE5, npcEntity.TS5, formationDetails[i++].Position, npcEntity.KpiBuff, ref suitDic, ref suitTypeDic));
            buffPlayers.Add(Guid.NewGuid(), BuildPlayer(npcEntity, npcEntity.TP6, npcEntity.TE6, npcEntity.TS6, formationDetails[i++].Position, npcEntity.KpiBuff, ref suitDic, ref suitTypeDic));
            buffPlayers.Add(Guid.NewGuid(), BuildPlayer(npcEntity, npcEntity.TP7, npcEntity.TE7, npcEntity.TS7, formationDetails[i++].Position, npcEntity.KpiBuff, ref suitDic, ref suitTypeDic));
            //套装
            TeammemberDataHelper.FillSuitData(suitDic, suitTypeDic, ref managerSBMList);
            //阵型加成
            TeammemberDataHelper.FillFormationData(npcEntity.FormationId, npcEntity.FormationLevel, ref managerSBMList);
            //TODO:球员组合
            BuffDataCore.Instance().FillBuffView(data, buffPlayers, true, 1, npcEntity.FormationId);
            data.BuffPlayers = buffPlayers;
            return(data);
        }
        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);
        }