Exemplo n.º 1
0
        private ManagerSkillCache()
        {
            try
            {
                s_dicTalent.Clear();
                s_dicTalentStep.Clear();
                s_dicTalentPoint.Clear();
                s_dicWill.Clear();
                s_dicCombIndex.Clear();
                s_dicClubSkill.Clear();
                s_dicAntiTalents.Clear();
                s_dicAntiTalents[204] = "MT204";
                s_dicAntiTalents[302] = "MT302";
                s_dicAntiTalents[403] = "MT403";
                var talents = DicManagertalentMgr.GetAllForCache();
                var wills   = DicManagerwillMgr.GetAllForCache();
                foreach (var item in talents)
                {
                    s_dicTalent[item.SkillCode] = item;
                    if (!s_dicTalentStep.ContainsKey(item.StepNo))
                    {
                        s_dicTalentStep[item.StepNo] = new List <string>();
                    }
                    s_dicTalentStep[item.StepNo].Add(item.SkillCode);
                    if (!s_dicTalentPoint.ContainsKey(item.ReqManagerLevel))
                    {
                        s_dicTalentPoint[item.ReqManagerLevel] = s_dicTalentPoint.Count + 1;
                    }
                }
                string[] arr;
                Dictionary <int, int> dic = null;
                int cnt     = 0;
                int pid     = 0;
                int cntLow  = 0;
                int cntHigh = 0;
                foreach (var item in wills)
                {
                    dic = new Dictionary <int, int>();
                    arr = item.PartMap.Trim(SPLITWillPid).Split(SPLITWillPid, SPLITWillStrength);
                    for (int i = 0; i < arr.Length / 2; i++)
                    {
                        dic[Convert.ToInt32(arr[2 * i])] = Convert.ToInt32(arr[2 * i + 1]);
                    }
                    item.DicPid = dic;
                    s_dicWill[item.SkillCode] = item;
                    if (item.WillRank > 1)
                    {
                        cntHigh++;
                    }
                    else
                    {
                        cntLow++;
                    }
                    if (string.IsNullOrEmpty(item.CombSkillCode))
                    {
                        continue;
                    }
                    cnt = dic.Count;
                    foreach (var kvp in dic)
                    {
                        pid = CastPlayerId(kvp.Key);
                        if (!s_dicCombIndex.ContainsKey(pid))
                        {
                            s_dicCombIndex[pid] = new Dictionary <string, int>();
                        }
                        s_dicCombIndex[pid][item.CombSkillCode] = cnt;
                    }
                }

                _willItemcodes.Clear();
                var list = DicManagerwillparttipsMgr.GetWillItemcodes();
                foreach (var data in list)
                {
                    if (!_willItemcodes.ContainsKey(data.ItemCode))
                    {
                        _willItemcodes.Add(data.ItemCode, 1);
                        _willCodeList.Add(data.ItemCode);
                    }
                }
                this.CountHighWill = cntHigh;
                this.CountLowWill  = cntLow;

                var clubSkills = DicClubskillMgr.GetAll();
                foreach (var item in clubSkills)
                {
                    s_dicClubSkill[item.SkillKey] = item;
                }
                this.InitFlag = true;
            }
            catch (Exception ex)
            {
                LogHelper.Insert(ex, "ManagerSkillCache:Init");
                this.InitFlag = false;
            }
        }
Exemplo n.º 2
0
        public static SkillTipsEntity ExportSkillTips(bool includeStarSkillLevel = false)
        {
            var tips = new SkillTipsEntity();

            tips.SkillCard     = DicSkillcardtipsMgr.GetAll();
            tips.StarSkill     = DicStarskilltipsMgr.GetAll();
            tips.ManagerTalent = DicManagertalenttipsMgr.GetAll();
            tips.ClubSkills    = DicClubskillMgr.GetAll();
            var wills     = DicManagerwilltipsMgr.GetAll();
            var willParts = DicManagerwillparttipsMgr.GetAll();
            var dicWill   = new Dictionary <string, DicManagerwilltipsEntity>(wills.Count);

            tips.LowWill  = new List <DicManagerwilltipsEntity>();
            tips.HighWill = new List <DicManagerwilltipsEntity>();
            var strengthList       = ConfigStrengthMgr.GetAll();
            var _configStrengthDic = new Dictionary <int, ConfigStrengthEntity>(strengthList.Count);

            foreach (var entity in strengthList)
            {
                var key = BuildStrengthKey(entity.CardLevel, entity.Source, entity.Target);
                if (!_configStrengthDic.ContainsKey(key))
                {
                    _configStrengthDic.Add(key, entity);
                }
            }
            tips.PlayerStrengthDic = _configStrengthDic;

            var allSkillConfig   = ConfigSkillupgradeMgr.GetAll();
            var _SkillUpgradeDic = new Dictionary <int, ConfigSkillupgradeEntity>(allSkillConfig.Count);

            foreach (var item in allSkillConfig)
            {
                var key = GetKey(item.SkillLevel, item.Quality);
                if (!_SkillUpgradeDic.ContainsKey(key))
                {
                    _SkillUpgradeDic.Add(key, item);
                }
                else
                {
                    _SkillUpgradeDic[key] = item;
                }
            }
            tips.SkillUpGradeDic = _SkillUpgradeDic;

            var allprpo = ConfigPrposellMgr.GetAll();

            tips.PrpoSelllist = allprpo;

            var allSkill     = DicSkillstreeMgr.GetAll();
            var allSkillDesc = DicSkillstreedesdicMgr.GetAll();
            var skillList    = new List <ManagerSkillTree>();

            foreach (var skill in allSkill)
            {
                var desc = allSkillDesc.FindAll(r => r.SkillCode == skill.SkillCode);
                foreach (var d in desc)
                {
                    var sk = new ManagerSkillTree();
                    sk.CoditionPoint = skill.ConditionPoint;
                    sk.Condition     = skill.Condition;
                    sk.Description   = d.Description;
                    sk.ManagerLevel  = skill.RequireManagerLevel;
                    sk.ManagerType   = skill.ManagerType;
                    sk.MaxPoint      = skill.MaxPoint;
                    sk.SkillCode     = skill.SkillCode;
                    sk.SkillLevel    = d.SkillLevel;
                    sk.SkillName     = skill.SkillName;
                    sk.Opener        = skill.Opener;
                    skillList.Add(sk);
                }
            }
            tips.ManagerSkillTree = skillList;
            #region CombLink
            //var combLinks = DicPlayerlinkMgr.GetAll();
            var cdic = new SortedDictionary <int, int>();
            int cno  = 0;
            int cnt  = 0;
            //foreach (var item in combLinks)
            //{
            //    if (!cdic.TryGetValue(item.Idx, out cno))
            //    {
            //        if (!cdic.TryGetValue(item.LinkId, out cno))
            //            cno = ++cnt;
            //    }
            //    cdic[item.Idx] = cno;
            //    cdic[item.LinkId] = cno;
            //}
            var dicComb = new Dictionary <int, string>();
            var list    = new List <int>();
            for (int i = 0; i <= cnt; i++)
            {
                cno = 0;
                list.Clear();
                foreach (var kvp in cdic)
                {
                    if (kvp.Value != i)
                    {
                        continue;
                    }
                    if (cno == 0)
                    {
                        cno = kvp.Key;
                    }
                    else
                    {
                        list.Add(kvp.Key);
                    }
                }
                if (list.Count > 0)
                {
                    dicComb[cno] = string.Join(",", list.ToArray());
                }
            }
            #endregion

            foreach (var item in wills)
            {
                if (item.WillRank == 1)
                {
                    tips.LowWill.Add(item);
                }
                else
                {
                    tips.HighWill.Add(item);
                }
                dicWill[item.SkillCode] = item;
            }
            DicManagerwilltipsEntity will = null;
            foreach (var g in willParts.GroupBy(i => i.SkillCode))
            {
                if (!dicWill.TryGetValue(g.Key, out will))
                {
                    continue;
                }
                will.PartList = g.ToList();
            }
            CombTipsEntity comb = null;
            tips.Combs = new List <CombTipsEntity>();
            foreach (var item in dicWill.Values)
            {
                if (item.WillRank == 1)
                {
                    continue;
                }
                comb          = new CombTipsEntity(item);
                comb.PartList = new List <CombPartTipsEntity>();
                foreach (var part in item.PartList)
                {
                    if (dicComb.ContainsKey(part.Pid))
                    {
                        part.LinkPid = dicComb[part.Pid];
                    }
                    else
                    {
                        part.LinkPid = string.Empty;
                    }
                    comb.PartList.Add(new CombPartTipsEntity(part));
                }
                tips.Combs.Add(comb);
            }
            //tips.StarArousalSkills = DicStararousalskillsMgr.GetAll();

            tips.Potential = new Dictionary <int, List <ConfigPotentialEntity> >();
            var allPotential = ConfigPotentialMgr.GetAll();
            foreach (var item in allPotential)
            {
                if (!tips.Potential.ContainsKey(item.PotentialId))
                {
                    tips.Potential.Add(item.PotentialId, new List <ConfigPotentialEntity>());
                }
                tips.Potential[item.PotentialId].Add(item);
            }
            if (includeStarSkillLevel)
            {
                tips.StarSkillLevels = DicStarskillleveltipsMgr.GetAll();
            }
            return(tips);
        }