Beispiel #1
0
        /// <summary>
        /// 更新技能
        /// </summary>
        /// <param name="manager"></param>
        /// <param name="transaction"></param>
        /// <returns></returns>
        public static MessageCode SetSkillMapByManagerLevel(NbManagerEntity manager, DbTransaction transaction)
        {
            var bag = SkillCardConvert.GetSkillBagWrap(manager.Idx);

            var skillList     = SkillCardCache.Instance().GetSkillCardByManagerLevel(manager.Level);
            var unLearnedList = new List <DTOSkillSetItem>();

            foreach (var entity in skillList)
            {
                if (!bag.SetList.ContainsKey(entity.SkillRoot))
                {
                    DTOSkillSetItem onItem = SkillCardConvert.GetNewSkillCardOn(entity);
                    unLearnedList.Add(onItem);
                }
            }

            if (unLearnedList.Count > 0)
            {
                string onItemMap = FlatTextFormatter.ListToText(unLearnedList, SkillBagWrap.SPLITSect, SkillBagWrap.SPLITUnit);
                int    errorCode = 0;
                NbManagerskillbagMgr.Add(manager.Idx, onItemMap, bag.RawBag.RowVersion, ref errorCode, transaction);
                if (errorCode != (int)MessageCode.Success)
                {
                    return((MessageCode)errorCode);
                }
            }
            return(MessageCode.Success);
        }
Beispiel #2
0
        static bool InnerDealMix(DTOSkillCardItem dst, out int newLevel)
        {
            newLevel = 0;
            if (null == dst || !SkillCardConvert.FillSkillCardConfig(dst, true))
            {
                return(false);
            }
            newLevel = dst.Cfg.SkillLevel + 1;
            //int addExp = dst.Exp + 10;
            //if (!SkillCardCache.Instance().TryCheckSkillLevel(dst.Cfg.SkillClass, addExp, out newLevel))
            //    return false;
            //if (dst.Cfg.SkillLevel == newLevel)
            //{
            //    dst.Exp = addExp;
            //    return true;
            //}
            string newCode = string.Empty;

            if (!SkillCardCache.Instance().TryGetSkillCode(dst.Cfg.SkillRoot, newLevel, out newCode))
            {
                return(false);
            }
            // dst.Exp = addExp;
            dst.ItemCode = newCode;
            SkillCardConvert.FillSkillCardConfig(dst, true);
            return(true);
        }
Beispiel #3
0
 public static bool FillSkillCardConfig(DTOSkillCardItem src, bool forceFlag)
 {
     if (null == src ||
         !forceFlag && null != src.Cfg && src.ItemCode == src.Cfg.SkillCode)
     {
         return(true);
     }
     if (!SkillCardCache.Instance().TryGetSkillCard(src.ItemCode, out src.Cfg))
     {
         return(false);
     }
     src.SkillType  = src.Cfg.ActType;
     src.SkillClass = src.Cfg.SkillClass;
     src.SkillLevel = src.Cfg.SkillLevel;
     return(true);
 }
Beispiel #4
0
 public static void StartService()
 {
     SkillCardCache.Instance();
 }