少年修仙传客户端代码仓库
hch
2020-09-27 306a989a3953fea434d9bfb1d504a916a59de6f2
0312 修复坐骑功能未开启前,获得皮肤道具报错问题
1个文件已修改
816 ■■■■ 已修改文件
System/Mount/MountModel.cs 816 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Mount/MountModel.cs
@@ -71,9 +71,9 @@
    
    private Dictionary<int, int> DicDefaultMount = new Dictionary<int, int>();
    Dictionary<SkillEffectGroup, int> integrationSkills = new Dictionary<SkillEffectGroup, int>();
    Dictionary<SkillEffectGroup, List<int>> integrationHorseSkills = new Dictionary<SkillEffectGroup, List<int>>();
    Dictionary<int, SkillEffectGroup> horseSkillEffectValues = new Dictionary<int, SkillEffectGroup>();
    Dictionary<SkillEffectGroup, int> integrationSkills = new Dictionary<SkillEffectGroup, int>();
    Dictionary<SkillEffectGroup, List<int>> integrationHorseSkills = new Dictionary<SkillEffectGroup, List<int>>();
    Dictionary<int, SkillEffectGroup> horseSkillEffectValues = new Dictionary<int, SkillEffectGroup>();
    Dictionary<int, int> horseSkills = new Dictionary<int, int>();
    Dictionary<int, int> unLockSkinItems = new Dictionary<int, int>();
@@ -94,67 +94,69 @@
        }
        string MountRedDotstr = FuncConfigConfig.Get("MountPetRedDot").Numerical1;
        DicDefaultMount = ConfigParse.GetDic<int, int>(MountRedDotstr);
        var funcConfig = FuncConfigConfig.Get("HorseUpItem");
        var funcConfig = FuncConfigConfig.Get("HorseUpItem");
        horseUpItemId = int.Parse(funcConfig.Numerical1);
        HorseDanExp = int.Parse(funcConfig.Numerical2);
        horseDanAttr = JsonMapper.ToObject<int[][]>(funcConfig.Numerical3);
        horseDanAttr = JsonMapper.ToObject<int[][]>(funcConfig.Numerical3);
        HorseAttrSort = JsonMapper.ToObject<int[]>(funcConfig.Numerical4); //坐骑面板属性排序
        HorseTrainMoreCnt = int.Parse(funcConfig.Numerical5);
        var shopConfig = StoreConfig.GetStoreCfg(horseUpItemId, 1, 1);
        if (shopConfig != null)
        {
            horseUpItemCost = shopConfig.MoneyNumber;
        if (shopConfig != null)
        {
            horseUpItemCost = shopConfig.MoneyNumber;
        }
        funcConfig = FuncConfigConfig.Get("PetHorseSkillIntegration");
        var intArray = ConfigParse.GetMultipleStr<int>(funcConfig.Numerical2);
        for (int i = 0; i < intArray.Length; i++)
        {
            var skillConfig = SkillConfig.Get(intArray[i]);
            if (skillConfig != null)
            {
                var effectValue = SkillConfig.GetSkillEffectValue(skillConfig);
                integrationSkills.Add(effectValue, intArray[i]);
            }
        funcConfig = FuncConfigConfig.Get("PetHorseSkillIntegration");
        var intArray = ConfigParse.GetMultipleStr<int>(funcConfig.Numerical2);
        for (int i = 0; i < intArray.Length; i++)
        {
            var skillConfig = SkillConfig.Get(intArray[i]);
            if (skillConfig != null)
            {
                var effectValue = SkillConfig.GetSkillEffectValue(skillConfig);
                integrationSkills.Add(effectValue, intArray[i]);
            }
        }
        funcConfig = FuncConfigConfig.Get("AutoActivePetHorse");
        funcConfig = FuncConfigConfig.Get("AutoActivePetHorse");
        autoActiveHorseId = int.Parse(funcConfig.Numerical2);
        //var _horseSkills = GetMountSkillAndItem.Keys;
        //foreach (var skillId in _horseSkills)
        //{
        //    var skillConfig = SkillConfig.Get(skillId);
        //    var effectValue = SkillConfig.GetSkillEffectValue(skillConfig);
        //    if (integrationSkills.ContainsKey(effectValue))
        //    {
        //        List<int> skills = null;
        //        if (!integrationHorseSkills.TryGetValue(effectValue, out skills))
        //        {
        //            skills = new List<int>();
        //            integrationHorseSkills.Add(effectValue, skills);
        //        }
        //        skills.Add(skillId);
        //    }
        //    horseSkills.Add(skillId, GetMountSkillAndItem[skillId].HorseID);
        //    horseSkillEffectValues.Add(skillId, effectValue);
        //foreach (var skillId in _horseSkills)
        //{
        //    var skillConfig = SkillConfig.Get(skillId);
        //    var effectValue = SkillConfig.GetSkillEffectValue(skillConfig);
        //    if (integrationSkills.ContainsKey(effectValue))
        //    {
        //        List<int> skills = null;
        //        if (!integrationHorseSkills.TryGetValue(effectValue, out skills))
        //        {
        //            skills = new List<int>();
        //            integrationHorseSkills.Add(effectValue, skills);
        //        }
        //        skills.Add(skillId);
        //    }
        //    horseSkills.Add(skillId, GetMountSkillAndItem[skillId].HorseID);
        //    horseSkillEffectValues.Add(skillId, effectValue);
        //}
        mountSkin.Clear();
        MountSkinActive.Clear();
        foreach (var config in HorseSkinPlusConfig.GetValues())
        {
            mountSkin[config.HorseID] = config.ID;
        {
            mountSkin[config.HorseID] = config.ID;
            MountSkinActive[config.ID] = 0;
        }
        unLockSkinItems.Clear();
        foreach (var config in HorseConfig.GetValues())
        {
            if (mountSkin.ContainsKey(config.HorseID))
            {
                unLockSkinItems[config.UnlockItemID] = mountSkin[config.HorseID];
            }
        foreach (var config in HorseConfig.GetValues())
        {
            if (mountSkin.ContainsKey(config.HorseID))
            {
                unLockSkinItems[config.UnlockItemID] = mountSkin[config.HorseID];
            }
        }
    }
@@ -217,7 +219,7 @@
    public int RedPoint_HuaxingID = MainRedDot.RedPoint_MountPackKey * 10; //化形红点
    int RedPoint_DanID = MainRedDot.RedPoint_MountPackKey * 10 + 1; //可用坐骑丹红点
    Redpoint RedPoint_Dan;
    Redpoint RedPoint_Dan;
    private void MountNumberPreservation()//用来对坐骑个数的保存
    {
        Redpoint RedPoint_Huaxing = new Redpoint(MainRedDot.RedPoint_MountPackKey, RedPoint_HuaxingID);
@@ -272,9 +274,9 @@
    //    //var configs = HorseUpConfig.GetValues();
    //    foreach (var config in Uconfigs)
    //    {
    //        if (!HorseConfig.Has(config.HorseID))
    //        {
    //            continue;
    //        if (!HorseConfig.Has(config.HorseID))
    //        {
    //            continue;
    //        }
    //        for (int i = 0; i < config.SkillID.Length; i++)
@@ -297,72 +299,72 @@
    //            }
    //        }
    //    }
    //}
    //private const int Redpoint_key1 = 1050101;
    //public Redpoint redPointStre1 = new Redpoint(MainRedDot.RedPoint_MountPackKey, Redpoint_key1);//坐骑外观
    //private const int Redpoint_key2 = 1050102;
    //public Redpoint redPointStre2 = new Redpoint(MainRedDot.RedPoint_MountPackKey, Redpoint_key2);//坐骑兽魂
    public event Action HorseExpItemRefresh;
    //}
    //private const int Redpoint_key1 = 1050101;
    //public Redpoint redPointStre1 = new Redpoint(MainRedDot.RedPoint_MountPackKey, Redpoint_key1);//坐骑外观
    //private const int Redpoint_key2 = 1050102;
    //public Redpoint redPointStre2 = new Redpoint(MainRedDot.RedPoint_MountPackKey, Redpoint_key2);//坐骑兽魂
    public event Action HorseExpItemRefresh;
    private void OnItemRefreshEvent(PackType type, int index, int id)
    {
        if (type == PackType.Equip)
        {
        if (type == PackType.Equip)
        {
            RefreshCurrentMount(playerPack.GetItemByIndex(type, index));
        }
        if (type == PackType.Item)
        {
            MountChangeRedPoint();
            if (id == horseUpItemId)
            {
            if (id == horseUpItemId)
            {
                MountDanRed();
                if (HorseExpItemRefresh != null)
                    HorseExpItemRefresh();
                if (HorseExpItemRefresh != null)
                    HorseExpItemRefresh();
            }
            if (unLockSkinItems.ContainsKey(id))
            {
                int activeID = unLockSkinItems[id];
                if (MountSkinActive[activeID] == 0)
                {
                    DeblockingRedPoint[activeID].state = RedPointState.Simple;
                }
            if (unLockSkinItems.ContainsKey(id))
            {
                int activeID = unLockSkinItems[id];
                if (MountSkinActive[activeID] == 0)
                {
                    DeblockingRedPoint[activeID].state = RedPointState.Simple;
                }
            }
            var config = HorseConfig.Get(autoActiveHorseId);
            if (config != null && id == config.UnlockItemID)
            {
                TryAutoActiveHorse();
            var config = HorseConfig.Get(autoActiveHorseId);
            if (config != null && id == config.UnlockItemID)
            {
                TryAutoActiveHorse();
            }
        }
    }
    private void OnFuncStateChangeEvent(int funcId)
    {
        if (funcId == (int)FuncOpenEnum.Mounts)
        {
            TryAutoActiveHorse();
        }
    private void OnFuncStateChangeEvent(int funcId)
    {
        if (funcId == (int)FuncOpenEnum.Mounts)
        {
            TryAutoActiveHorse();
        }
    }
    private void TryAutoActiveHorse()
    {
        if (IsOk && FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Mounts)
            && !_DicHorse.ContainsKey(autoActiveHorseId) && !hasSendAutoActive)
        {
            var horseConfig = HorseConfig.Get(autoActiveHorseId);
            if (horseConfig != null)
            {
                var itemCount = playerPack.GetItemCountByID(PackType.Item, horseConfig.UnlockItemID);
                if (itemCount >= horseConfig.UnlockItemCnt)
                {
                    hasSendAutoActive = true;
                    var pak = new CA501_tagPlayerActivateHorse();
                    pak.HorseID = (uint)autoActiveHorseId;
                    GameNetSystem.Instance.SendInfo(pak);
                }
            }
        }
    private void TryAutoActiveHorse()
    {
        if (IsOk && FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Mounts)
            && !_DicHorse.ContainsKey(autoActiveHorseId) && !hasSendAutoActive)
        {
            var horseConfig = HorseConfig.Get(autoActiveHorseId);
            if (horseConfig != null)
            {
                var itemCount = playerPack.GetItemCountByID(PackType.Item, horseConfig.UnlockItemID);
                if (itemCount >= horseConfig.UnlockItemCnt)
                {
                    hasSendAutoActive = true;
                    var pak = new CA501_tagPlayerActivateHorse();
                    pak.HorseID = (uint)autoActiveHorseId;
                    GameNetSystem.Instance.SendInfo(pak);
                }
            }
        }
    }
    private void MountStoneRed()//坐骑魂石红点
@@ -474,13 +476,13 @@
            }
        }
        return SkillLv;
    }
    }
    void RefreshCurrentMount(ItemModel info)//获取当前的坐骑
    {
        if (info == null)
        {
            return;
        if (info == null)
        {
            return;
        }
        if (info.config.EquipPlace == (byte)RoleEquipType.Mount)//坐骑位置19
@@ -519,15 +521,15 @@
    {
        bool islvup = false;
        bool isSkinActive = false;
        if (MountHA301MorePack && info.LV > HorseLV)
        {
            islvup = true;
            MountDanRed();
        if (MountHA301MorePack && info.LV > HorseLV)
        {
            islvup = true;
            MountDanRed();
        }
        if (MountHA301MorePack && info.SkinPlusState > SkinPlusState)
        {
            isSkinActive = true;
        if (MountHA301MorePack && info.SkinPlusState > SkinPlusState)
        {
            isSkinActive = true;
        }
        HorseLV = info.LV;
        HorseEatCount = info.EatItemCount;
@@ -538,37 +540,37 @@
        if (onHorseInfoUpdate != null)
            onHorseInfoUpdate();
        if (islvup && onHorseLVUP != null)
        if (islvup && onHorseLVUP != null)
            onHorseLVUP();
        if (isSkinActive && onMountSkinActive != null)
        {
            CalcMountSkinActive();
        if (isSkinActive && onMountSkinActive != null)
        {
            CalcMountSkinActive();
            onMountSkinActive();
        }
        if (!MountHA301MorePack)
        {
            CalcMountSkinActive();
        {
            CalcMountSkinActive();
        }
        MountHA301MorePack = true;
    }
    private void CalcMountSkinActive()
    {
        MountSkinActive.Clear();
        foreach (var config in HorseSkinPlusConfig.GetValues())
        {
            MountSkinActive[config.ID] = isMountSkinActiveByID(config.ID) ? 1 : 0;
        }
        foreach (var redpoint in DeblockingRedPoint)
        {
            if (isMountSkinActiveByID(redpoint.Key))
            {
                redpoint.Value.state = RedPointState.None;
            }
        }
    private void CalcMountSkinActive()
    {
        MountSkinActive.Clear();
        foreach (var config in HorseSkinPlusConfig.GetValues())
        {
            MountSkinActive[config.ID] = isMountSkinActiveByID(config.ID) ? 1 : 0;
        }
        foreach (var redpoint in DeblockingRedPoint)
        {
            if (isMountSkinActiveByID(redpoint.Key))
            {
                redpoint.Value.state = RedPointState.None;
            }
        }
    }
    public void MountHA339(HA339_tagMCAttrFruitEatCntList info)//坐骑魂石
@@ -745,305 +747,305 @@
    #region 预览坐骑碎片属性
    // 坐骑皮肤属性
    public Dictionary<int, int> GetMountAttrAddDict(int mountCode)
    {
    {
        var mountAttrDict = new Dictionary<int, int>();
        mountAttrDict.Clear();
        var config = HorseSkinPlusConfig.Get(mountSkin[mountCode]);
        int showIndex = 0;
        foreach (var attrID in config.AttrType)
        {
            mountAttrDict[attrID] = config.AttrValue[showIndex];
            showIndex++;
        }
        mountAttrDict.Clear();
        var config = HorseSkinPlusConfig.Get(mountSkin[mountCode]);
        int showIndex = 0;
        foreach (var attrID in config.AttrType)
        {
            mountAttrDict[attrID] = config.AttrValue[showIndex];
            showIndex++;
        }
        return mountAttrDict;
    }
    // 坐骑皮肤战力
    public int GetMountSkinFightPower(int mountCode)
    {
        var config = HorseSkinPlusConfig.Get(mountSkin[mountCode]);
        return (UIHelper.GetFightPower(GetMountAttrAddDict(mountCode)) + config.InitFightPower);
    }
    }
    // 坐骑皮肤战力
    public int GetMountSkinFightPower(int mountCode)
    {
        var config = HorseSkinPlusConfig.Get(mountSkin[mountCode]);
        return (UIHelper.GetFightPower(GetMountAttrAddDict(mountCode)) + config.InitFightPower);
    }
    #endregion
    #region 技能整合
    public bool TryGetIntegrationSkill(SkillEffectGroup effect, out int skillId)
    {
        return integrationSkills.TryGetValue(effect, out skillId);
    public bool TryGetIntegrationSkill(SkillEffectGroup effect, out int skillId)
    {
        return integrationSkills.TryGetValue(effect, out skillId);
    }
    public bool TryGetHorseSkills(SkillEffectGroup effect, out List<int> skills)
    {
        return integrationHorseSkills.TryGetValue(effect, out skills);
    public bool TryGetHorseSkills(SkillEffectGroup effect, out List<int> skills)
    {
        return integrationHorseSkills.TryGetValue(effect, out skills);
    }
    public SkillEffectGroup GetSkillEffectGroup(int skillId)
    {
        if (horseSkillEffectValues.ContainsKey(skillId))
        {
            return horseSkillEffectValues[skillId];
        }
        return default(SkillEffectGroup);
    public SkillEffectGroup GetSkillEffectGroup(int skillId)
    {
        if (horseSkillEffectValues.ContainsKey(skillId))
        {
            return horseSkillEffectValues[skillId];
        }
        return default(SkillEffectGroup);
    }
    public bool IsSkillUnlock(int skillId)
    {
        var config = SkillConfig.Get(skillId);
        if (config == null)
        {
            return false;
        }
        var effect = SkillConfig.GetSkillEffectValue(config);
        if (integrationHorseSkills.ContainsKey(effect)
            && !integrationHorseSkills[effect].Contains(skillId))
        {
            var skills = integrationHorseSkills[effect];
            foreach (var id in skills)
            {
                if (IsSkillUnlock(id))
                {
                    return true;
                }
            }
        }
        else
        {
            if (GetMountSkillAndItem.ContainsKey(skillId))
            {
                var horseId = GetMountSkillAndItem[skillId].HorseID;
                if (_DicHorse.ContainsKey(horseId))
                {
                    var horseInfo = _DicHorse[horseId];
                    if (horseInfo.Lv >= GetSkillUnlockLevel(skillId))
                    {
                        return true;
                    }
                }
            }
        }
        return false;
    public bool IsSkillUnlock(int skillId)
    {
        var config = SkillConfig.Get(skillId);
        if (config == null)
        {
            return false;
        }
        var effect = SkillConfig.GetSkillEffectValue(config);
        if (integrationHorseSkills.ContainsKey(effect)
            && !integrationHorseSkills[effect].Contains(skillId))
        {
            var skills = integrationHorseSkills[effect];
            foreach (var id in skills)
            {
                if (IsSkillUnlock(id))
                {
                    return true;
                }
            }
        }
        else
        {
            if (GetMountSkillAndItem.ContainsKey(skillId))
            {
                var horseId = GetMountSkillAndItem[skillId].HorseID;
                if (_DicHorse.ContainsKey(horseId))
                {
                    var horseInfo = _DicHorse[horseId];
                    if (horseInfo.Lv >= GetSkillUnlockLevel(skillId))
                    {
                        return true;
                    }
                }
            }
        }
        return false;
    }
    public int GetSkillUnlockLevel(int skillId)
    {
        if (GetMountSkillAndItem.ContainsKey(skillId))
        {
            return GetMountSkillAndItem[skillId].HorseLV;
        }
        return 0;
    public int GetSkillUnlockLevel(int skillId)
    {
        if (GetMountSkillAndItem.ContainsKey(skillId))
        {
            return GetMountSkillAndItem[skillId].HorseLV;
        }
        return 0;
    }
    #endregion
    public bool IsHorseMaxLevel(int horseId)
    {
        if (_DicHorse.ContainsKey(horseId))
        {
            var horseConfig = HorseConfig.Get(horseId);
            return _DicHorse[horseId].Lv >= horseConfig.MaxLV;
        }
        else
        {
            return false;
        }
    public bool IsHorseMaxLevel(int horseId)
    {
        if (_DicHorse.ContainsKey(horseId))
        {
            var horseConfig = HorseConfig.Get(horseId);
            return _DicHorse[horseId].Lv >= horseConfig.MaxLV;
        }
        else
        {
            return false;
        }
    }
    public bool IsHorseUnlock(int horseId)
    {
        return _DicHorse.ContainsKey(horseId);
    public bool IsHorseUnlock(int horseId)
    {
        return _DicHorse.ContainsKey(horseId);
    }
    private Dictionary<int, int> HorseAllAttr = new Dictionary<int, int>();
    private int activeAllSkinAddPower = 0;   //额外增加的坐骑皮肤战力
    //坐骑属性:丹经验属性,升阶属性,皮肤属性
    public Dictionary<int, int> RefreshHorseAllAttr()
    {
        HorseAllAttr.Clear();
        activeAllSkinAddPower = 0;
        int allHorseEatCount = HorseEatCount;
        //丹经验属性
        for (int i = 1; i < HorseLV; i++)
        {
            var config = HorseLVUpConfig.Get(i);
            allHorseEatCount += config.NeedEatCount;
        }
        foreach (var attrPair in horseDanAttr)
        {
            HorseAllAttr[attrPair[0]] = attrPair[1] * allHorseEatCount;
        }
        //升阶属性
        for (int k = 1; k <= HorseLV; k++)
        {
            var horseLVConfig = HorseLVUpConfig.Get(k);
            for (int i = 0; i < horseLVConfig.LVAttrType.Length; i++)
            {
                if (!HorseAllAttr.ContainsKey(horseLVConfig.LVAttrType[i]))
                {
                    HorseAllAttr[horseLVConfig.LVAttrType[i]] = 0;
                }
                HorseAllAttr[horseLVConfig.LVAttrType[i]] = HorseAllAttr[horseLVConfig.LVAttrType[i]] + horseLVConfig.LVAttrValue[i];
            }
        }
        //皮肤属性
        foreach (var byteID in HorseSkinPlusConfig.GetKeys())
        {
            if (!isMountSkinActiveByID(int.Parse(byteID)))
                //未激活皮肤
                continue;
            var config = HorseSkinPlusConfig.Get(byteID);
            for (int i = 0; i < config.AttrType.Length; i++)
            {
                if (!HorseAllAttr.ContainsKey(config.AttrType[i]))
                {
                    HorseAllAttr[config.AttrType[i]] = 0;
                }
                HorseAllAttr[config.AttrType[i]] = HorseAllAttr[config.AttrType[i]] + config.AttrValue[i];
            }
            activeAllSkinAddPower += config.InitFightPower;
        }
        return HorseAllAttr;
    public Dictionary<int, int> RefreshHorseAllAttr()
    {
        HorseAllAttr.Clear();
        activeAllSkinAddPower = 0;
        int allHorseEatCount = HorseEatCount;
        //丹经验属性
        for (int i = 1; i < HorseLV; i++)
        {
            var config = HorseLVUpConfig.Get(i);
            allHorseEatCount += config.NeedEatCount;
        }
        foreach (var attrPair in horseDanAttr)
        {
            HorseAllAttr[attrPair[0]] = attrPair[1] * allHorseEatCount;
        }
        //升阶属性
        for (int k = 1; k <= HorseLV; k++)
        {
            var horseLVConfig = HorseLVUpConfig.Get(k);
            for (int i = 0; i < horseLVConfig.LVAttrType.Length; i++)
            {
                if (!HorseAllAttr.ContainsKey(horseLVConfig.LVAttrType[i]))
                {
                    HorseAllAttr[horseLVConfig.LVAttrType[i]] = 0;
                }
                HorseAllAttr[horseLVConfig.LVAttrType[i]] = HorseAllAttr[horseLVConfig.LVAttrType[i]] + horseLVConfig.LVAttrValue[i];
            }
        }
        //皮肤属性
        foreach (var byteID in HorseSkinPlusConfig.GetKeys())
        {
            if (!isMountSkinActiveByID(int.Parse(byteID)))
                //未激活皮肤
                continue;
            var config = HorseSkinPlusConfig.Get(byteID);
            for (int i = 0; i < config.AttrType.Length; i++)
            {
                if (!HorseAllAttr.ContainsKey(config.AttrType[i]))
                {
                    HorseAllAttr[config.AttrType[i]] = 0;
                }
                HorseAllAttr[config.AttrType[i]] = HorseAllAttr[config.AttrType[i]] + config.AttrValue[i];
            }
            activeAllSkinAddPower += config.InitFightPower;
        }
        return HorseAllAttr;
    }
    public bool isMountSkinActive(int horseID)
    {
        if (!mountSkin.ContainsKey(horseID))
        {
            return false;
        }
        return isMountSkinActiveByID(mountSkin[horseID]);
    }
    public bool isMountSkinActiveByID(int ID)
    {
        if (((int)Math.Pow(2, ID) & SkinPlusState) <= 0)
            //未激活皮肤
            return false;
        return true;
    }
    //额外增加战力
    public int GetMountSkinAddFightPower()
    {
        int fightPower = 0;
        foreach (var config in HorseSkinPlusConfig.GetValues())
        {
            if (isMountSkinActiveByID(config.ID))
            {
                fightPower += config.InitFightPower;
            }
        }
        return fightPower;
    }
    public Dictionary<int, int> GetHorseAllAttr()
    {
        if (HorseAllAttr.Keys.Count == 0)
            RefreshHorseAllAttr();
        return HorseAllAttr;
    }
    //UIHelper.GetFightPower(FightDic)
    public int GetHorseFightPower()
    {
        var allAttrDict = GetHorseAllAttr();
        return UIHelper.GetFightPower(allAttrDict) + activeAllSkinAddPower;
    }
    //默认驯养一颗,当数量大于X 全部驯养(不超过2阶)
    public int GetTrainCount()
    {
        var config = HorseLVUpConfig.Get(HorseLV);
        if (config.NeedEatCount == 0)
        {
            //已满级
            return 0;
        }
        //int number = playerPack.GetItemCountByID(PackType.Item, horseUpItemId);
        //if (number > HorseTrainMoreCnt)
        //{
        //    trainCount = number;
        //    if (HorseEatCount + number >= config.NeedEatCount)
        //    {
        //        //有升阶的情况,最多一阶
        //        var Nextconfig = HorseLVUpConfig.Get(HorseLV + 1);
        //        if (Nextconfig.NeedEatCount == 0)
        //        {
        //            //升级后满级
        //            trainCount = config.NeedEatCount - HorseEatCount;
        //        }
        //        else if (number >= (config.NeedEatCount - HorseEatCount + Nextconfig.NeedEatCount))
        //        {
        //            //超过2阶的情况
        //            trainCount = config.NeedEatCount - HorseEatCount + Nextconfig.NeedEatCount - 1;
        //        }
        //    }
        //}
        var nextConfig = HorseLVUpConfig.Get(HorseLV + 1);
        if (nextConfig.NeedEatCount == 0)
        {
            // 下一阶满级,只扣剩余所需不超过单次的材料数量
            if (config.NeedEatCount - HorseEatCount < config.useCnt)
            {
                return config.NeedEatCount - HorseEatCount;
            }
        }
        return config.useCnt;
    }
    public Dictionary<int, int> GetNextTrainAttr()
    {
        Dictionary<int, int> nextTrainAttr = new Dictionary<int, int>();
        var NextTrainCount = GetTrainCount();
        if (NextTrainCount == 0)
        {
            return nextTrainAttr;
        }
        foreach (var attrPair in horseDanAttr)
        {
            nextTrainAttr[attrPair[0]] = attrPair[1] * NextTrainCount;
        }
        var config = HorseLVUpConfig.Get(HorseLV);
        if (HorseEatCount + NextTrainCount >= config.NeedEatCount)
        {
            //有升阶的情况
            var Nextconfig = HorseLVUpConfig.Get(HorseLV + 1);
            for (int i = 0; i < Nextconfig.LVAttrType.Length; i++)
            {
                if (!nextTrainAttr.ContainsKey(Nextconfig.LVAttrType[i]))
                {
                    nextTrainAttr[Nextconfig.LVAttrType[i]] = 0;
                }
                nextTrainAttr[Nextconfig.LVAttrType[i]] = nextTrainAttr[Nextconfig.LVAttrType[i]] + Nextconfig.LVAttrValue[i];
            }
        }
        return nextTrainAttr;
    }
    //获取升阶的所有坐骑ID
    public List<int> RankHorseIDList = new List<int>();
    private void GetRankHorseIDs()
    {
        RankHorseIDList.Clear();
        foreach (var horseConfig in HorseLVUpConfig.GetValues())
        {
            RankHorseIDList.Add(horseConfig.HorseID);
        }
    }
    public bool isMountSkinActive(int horseID)
    {
        if (!mountSkin.ContainsKey(horseID))
        {
            return false;
        }
        return isMountSkinActiveByID(mountSkin[horseID]);
    }
    public bool isMountSkinActiveByID(int ID)
    {
        if (((int)Math.Pow(2, ID) & SkinPlusState) <= 0)
            //未激活皮肤
            return false;
        return true;
    }
    //额外增加战力
    public int GetMountSkinAddFightPower()
    {
        int fightPower = 0;
        foreach (var config in HorseSkinPlusConfig.GetValues())
        {
            if (isMountSkinActiveByID(config.ID))
            {
                fightPower += config.InitFightPower;
            }
        }
        return fightPower;
    }
    public Dictionary<int, int> GetHorseAllAttr()
    {
        if (HorseAllAttr.Keys.Count == 0)
            RefreshHorseAllAttr();
        return HorseAllAttr;
    }
    //UIHelper.GetFightPower(FightDic)
    public int GetHorseFightPower()
    {
        var allAttrDict = GetHorseAllAttr();
        return UIHelper.GetFightPower(allAttrDict) + activeAllSkinAddPower;
    }
    //默认驯养一颗,当数量大于X 全部驯养(不超过2阶)
    public int GetTrainCount()
    {
        var config = HorseLVUpConfig.Get(HorseLV);
        if (config.NeedEatCount == 0)
        {
            //已满级
            return 0;
        }
        //int number = playerPack.GetItemCountByID(PackType.Item, horseUpItemId);
        //if (number > HorseTrainMoreCnt)
        //{
        //    trainCount = number;
        //    if (HorseEatCount + number >= config.NeedEatCount)
        //    {
        //        //有升阶的情况,最多一阶
        //        var Nextconfig = HorseLVUpConfig.Get(HorseLV + 1);
        //        if (Nextconfig.NeedEatCount == 0)
        //        {
        //            //升级后满级
        //            trainCount = config.NeedEatCount - HorseEatCount;
        //        }
        //        else if (number >= (config.NeedEatCount - HorseEatCount + Nextconfig.NeedEatCount))
        //        {
        //            //超过2阶的情况
        //            trainCount = config.NeedEatCount - HorseEatCount + Nextconfig.NeedEatCount - 1;
        //        }
        //    }
        //}
        var nextConfig = HorseLVUpConfig.Get(HorseLV + 1);
        if (nextConfig.NeedEatCount == 0)
        {
            // 下一阶满级,只扣剩余所需不超过单次的材料数量
            if (config.NeedEatCount - HorseEatCount < config.useCnt)
            {
                return config.NeedEatCount - HorseEatCount;
            }
        }
        return config.useCnt;
    }
    public Dictionary<int, int> GetNextTrainAttr()
    {
        Dictionary<int, int> nextTrainAttr = new Dictionary<int, int>();
        var NextTrainCount = GetTrainCount();
        if (NextTrainCount == 0)
        {
            return nextTrainAttr;
        }
        foreach (var attrPair in horseDanAttr)
        {
            nextTrainAttr[attrPair[0]] = attrPair[1] * NextTrainCount;
        }
        var config = HorseLVUpConfig.Get(HorseLV);
        if (HorseEatCount + NextTrainCount >= config.NeedEatCount)
        {
            //有升阶的情况
            var Nextconfig = HorseLVUpConfig.Get(HorseLV + 1);
            for (int i = 0; i < Nextconfig.LVAttrType.Length; i++)
            {
                if (!nextTrainAttr.ContainsKey(Nextconfig.LVAttrType[i]))
                {
                    nextTrainAttr[Nextconfig.LVAttrType[i]] = 0;
                }
                nextTrainAttr[Nextconfig.LVAttrType[i]] = nextTrainAttr[Nextconfig.LVAttrType[i]] + Nextconfig.LVAttrValue[i];
            }
        }
        return nextTrainAttr;
    }
    //获取升阶的所有坐骑ID
    public List<int> RankHorseIDList = new List<int>();
    private void GetRankHorseIDs()
    {
        RankHorseIDList.Clear();
        foreach (var horseConfig in HorseLVUpConfig.GetValues())
        {
            RankHorseIDList.Add(horseConfig.HorseID);
        }
    }
}