Пример #1
0
 public static void LoadProfessionEditorFiles()
 {
     try
     {
         DbcStores.InitFiles();
         Spell.LoadData();
         SkillLine.LoadData();
         SkillLineAbility.LoadData();
         SkillRaceClassInfo.LoadData();
         SpellFocusObject.LoadData();
         ChrRaces.LoadData();
         ChrClasses.LoadData();
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #2
0
        private WoWSpell GetRecipeSpell(int itemOrSpellId)
        {
            int skillLineId  = TradeSkillId;
            var skillLineIds = StyxWoW.Db[ClientDb.SkillLine]
                               .EnumerateIdRowPairs()
                               .Where(
                kvp =>
                kvp.Key == skillLineId ||
                SkillLineInfo.FromId((uint)kvp.Key).ParentSkillLineId == skillLineId)
                               .Select(kvp => (SkillLine)kvp.Key)
                               .ToList();

            var recipes = SkillLineAbility.GetAbilities()
                          .Where(a => skillLineIds.Contains(a.SkillLine) && a.NextSpellId == 0 && a.GreySkillLevel > 0 && a.TradeSkillCategoryId > 0)
                          .Select(a => WoWSpell.FromId(a.SpellId))
                          .Where(s => s != null && s.IsValid)
                          .ToList();

            return(recipes.FirstOrDefault(s => s.CreatesItemId == itemOrSpellId)
                   ?? recipes.FirstOrDefault(s => s.Id == itemOrSpellId));
        }
Пример #3
0
        public static ObservableCollection<SkillLineAbility> LoadSkillLineAbility()
        {
            ObservableCollection<SkillLineAbility> list = new ObservableCollection<SkillLineAbility>();
            using (FileStream stream = File.OpenRead(DATA_PATH + "DBC/SkillLineAbility.dbc"))
            {
                BinaryReader r = new BinaryReader(stream);
                stream.Position = 4;
                int records = r.ReadInt32();
                int fields = r.ReadInt32();
                int rowSize = r.ReadInt32();
                int stringBlockSize = r.ReadInt32();
                for (int i = 0; i != records; ++i)
                {
                    SkillLineAbility ability = new SkillLineAbility();
                    ability.ID = r.ReadInt32();
                    ability.Skill = r.ReadInt32();
                    ability.Spell = r.ReadInt32();
                    ability.Race = r.ReadInt32();
                    ability.Class = r.ReadInt32();
                    stream.Position += 8;
                    ability.RequiredSkillValue = r.ReadInt32();
                    ability.SupercededBySpell = r.ReadInt32();
                    ability.AccquiredMethod = r.ReadInt32();
                    ability.SkillLineRankHigh = r.ReadInt32();
                    ability.SkillLineRankLow = r.ReadInt32();
                    stream.Position += 8;
                    list.Add(ability);
                }

                r.Close();
                return list;
            }
        }
Пример #4
0
 public static void InsertSpellLineAbility(ObservableCollection<SkillLineAbility> list, SkillLineAbility ability, uint spell, bool s, uint superceded = 0)
 {
     var oldAbility = (from d in list where d.Spell == spell select d).FirstOrDefault();
     if (oldAbility != null)
     {
         oldAbility.Race = ability.Race;
         oldAbility.RequiredSkillValue = ability.RequiredSkillValue;
         oldAbility.Skill = ability.Skill;
         oldAbility.SkillLineRankHigh = ability.SkillLineRankHigh;
         oldAbility.SkillLineRankLow = ability.SkillLineRankLow;
         oldAbility.SupercededBySpell = s ? (int)superceded : 0; // handle this
     }
     else
     {
         SkillLineAbility newAbility = new SkillLineAbility();
         newAbility.ID = (from d in list select d.ID).Max() + 1;
         newAbility.Race = ability.Race;
         newAbility.RequiredSkillValue = ability.RequiredSkillValue;
         newAbility.Skill = ability.Skill;
         newAbility.SkillLineRankHigh = ability.SkillLineRankHigh;
         newAbility.SkillLineRankLow = ability.SkillLineRankLow;
         newAbility.SupercededBySpell = s ? (int)superceded : 0; // handle this
         newAbility.Spell = (int)spell;
         list.Add(newAbility);
     }
 }