少年修仙传客户端代码仓库
client_Wu Xijin
2018-08-14 fa1e861eaa0d06914823e88d1dd76f853d12f082
Core/GameEngine/Model/TelPartialConfig/PetInfoConfig.cs
@@ -1,102 +1,102 @@
// ------------------------------------------------------------------------------
//  <autogenerated>
//      This code was generated by a tool.
//      Mono Runtime Version: 2.0.50727.1433
//
//      Changes to this file may cause incorrect behavior and will be lost if
//      the code is regenerated.
//  </autogenerated>
// ------------------------------------------------------------------------------
namespace TableConfig
{
    using System;
    using System.Collections.Generic;
    public partial class PetInfoConfig : ConfigBase, IConfigPostProcess
    {
        public static Dictionary<int, List<PetSkillLimit>> petSkillDict = new Dictionary<int, List<PetSkillLimit>>();
        public void OnConfigParseCompleted()
        {
            List<PetSkillLimit> list = null;
            if (!petSkillDict.TryGetValue(ID, out list))
            {
                list = new List<PetSkillLimit>();
                petSkillDict.Add(ID, list);
            }
            var skills = ConfigParse.GetMultipleStr<int>(SkillID);
            var skillUnlocks = ConfigParse.GetMultipleStr<int>(SkillUnLock);
            for (int i = 0; i < skills.Length; i++)
            {
                list.Add(new PetSkillLimit()
                {
                    skill = skills[i],
                    lv = skillUnlocks[i],
                });
            }
        }
        public static void GetPetSkills(int petId, int lv, bool onlyAcitve, ref List<int> skills)
        {
            if (skills == null)
            {
                return;
            }
            skills.Clear();
            List<PetSkillLimit> list = null;
            if (petSkillDict.TryGetValue(petId, out list))
            {
                for (int i = 0; i < list.Count; i++)
                {
                    if (lv < list[i].lv && onlyAcitve)
                    {
                        continue;
                    }
                    skills.Add(list[i].skill);
                }
            }
        }
        public static int GetPetSkillCondition(int petId, int skillId)
        {
            List<PetSkillLimit> list = null;
            if (petSkillDict.TryGetValue(petId, out list))
            {
                for (int i = 0; i < list.Count; i++)
                {
                    if (skillId == list[i].skill)
                    {
                        return list[i].lv;
                    }
                }
            }
            return 0;
        }
        public static bool TryGetPetIdBySkill(int skillId, out int petId)
        {
            petId = 0;
            foreach (var key in petSkillDict.Keys)
            {
                var list = petSkillDict[key];
                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i].skill == skillId)
                    {
                        petId = key;
                        return true;
                    }
                }
            }
            return false;
        }
        public struct PetSkillLimit
        {
            public int skill;
            public int lv;
        }
    }
}
// ------------------------------------------------------------------------------
//  <autogenerated>
//      This code was generated by a tool.
//      Mono Runtime Version: 2.0.50727.1433
//
//      Changes to this file may cause incorrect behavior and will be lost if
//      the code is regenerated.
//  </autogenerated>
// ------------------------------------------------------------------------------
namespace TableConfig
{
    using System;
    using System.Collections.Generic;
    public partial class PetInfoConfig : ConfigBase, IConfigPostProcess
    {
        public static Dictionary<int, List<PetSkillLimit>> petSkillDict = new Dictionary<int, List<PetSkillLimit>>();
        public void OnConfigParseCompleted()
        {
            List<PetSkillLimit> list = null;
            if (!petSkillDict.TryGetValue(ID, out list))
            {
                list = new List<PetSkillLimit>();
                petSkillDict.Add(ID, list);
            }
            var skills = ConfigParse.GetMultipleStr<int>(SkillID);
            var skillUnlocks = ConfigParse.GetMultipleStr<int>(SkillUnLock);
            for (int i = 0; i < skills.Length; i++)
            {
                list.Add(new PetSkillLimit()
                {
                    skill = skills[i],
                    lv = skillUnlocks[i],
                });
            }
        }
        public static void GetPetSkills(int petId, int lv, bool onlyAcitve, ref List<int> skills)
        {
            if (skills == null)
            {
                return;
            }
            skills.Clear();
            List<PetSkillLimit> list = null;
            if (petSkillDict.TryGetValue(petId, out list))
            {
                for (int i = 0; i < list.Count; i++)
                {
                    if (lv < list[i].lv && onlyAcitve)
                    {
                        continue;
                    }
                    skills.Add(list[i].skill);
                }
            }
        }
        public static int GetPetSkillCondition(int petId, int skillId)
        {
            List<PetSkillLimit> list = null;
            if (petSkillDict.TryGetValue(petId, out list))
            {
                for (int i = 0; i < list.Count; i++)
                {
                    if (skillId == list[i].skill)
                    {
                        return list[i].lv;
                    }
                }
            }
            return 0;
        }
        public static bool TryGetPetIdBySkill(int skillId, out int petId)
        {
            petId = 0;
            foreach (var key in petSkillDict.Keys)
            {
                var list = petSkillDict[key];
                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i].skill == skillId)
                    {
                        petId = key;
                        return true;
                    }
                }
            }
            return false;
        }
        public struct PetSkillLimit
        {
            public int skill;
            public int lv;
        }
    }
}