/// <summary> /// Loads all the spell infos. /// </summary> public static void Load() { var spells = Database.Dal.Spells.GetAllSpellInfos(); foreach (var dbSpell in spells) { var spellInfo = new Models.Spells.SpellInfo(dbSpell); if (_spells.ContainsKey(spellInfo.Id)) { _spells[spellInfo.Id].TryAdd(spellInfo.Level, spellInfo); } else { if (_spells.TryAdd(spellInfo.Id)) { _spells[spellInfo.Id].TryAdd(spellInfo.Level, spellInfo); } } switch (spellInfo.Id) { case 5010: case 7020: case 1290: case 1260: case 5030: case 5040: case 7000: case 7010: case 7030: case 7040: case 1250: case 5050: case 5020: case 10490: case 1300: { if (spellInfo.DbSpellInfo.Distance >= 3) { spellInfo.DbSpellInfo.Distance = 3; } if (spellInfo.DbSpellInfo.Range > 3) { spellInfo.DbSpellInfo.Range = 3; } _weaponSpells.TryAdd(spellInfo.WeaponSubtype, spellInfo.Id); break; } } } }
/// <summary> /// Loads item additions. /// </summary> public static void LoadAdditions() { foreach (var line in System.IO.File.ReadAllLines(Drivers.Settings.DatabaseSettings.WorldFlatDatabase + "\\Items\\ItemAdd.dat")) { if (string.IsNullOrWhiteSpace(line)) { continue; } var data = line.Split(' '); var addition = new Models.Items.ItemAddition { ItemId = uint.Parse(data[0]), Plus = byte.Parse(data[1]), HP = ushort.Parse(data[2]), MinAttack = uint.Parse(data[3]), MaxAttack = uint.Parse(data[4]), Defense = ushort.Parse(data[5]), MagicAttack = ushort.Parse(data[6]), MagicDefense = ushort.Parse(data[7]), Dexterity = ushort.Parse(data[8]), Dodge = byte.Parse(data[9]) }; if (!_itemAdditions.ContainsKey(addition.ItemId)) { if (!_itemAdditions.TryAdd(addition.ItemId)) { throw new TypeLoadException("Failed to load item additions."); } } else { if (!_itemAdditions[addition.ItemId].TryAdd(addition.Plus, addition)) { throw new TypeLoadException("Failed to load item additions."); } } } }