public static void AddSpellToList(uint classId, uint spellLevel, Spell spell) { if(!_library.ContainsKey(classId)) { _library.Add(classId, new Dictionary<uint, List<Spell>>()); } if(!_library[classId].ContainsKey(spellLevel)) { _library[classId].Add(spellLevel, new List<Spell>()); } if(!_library[classId][spellLevel].Contains(spell)) { _library[classId][spellLevel].Add(spell); } }
/// <summary> /// Load powers from the DataArrays\Spell.txt folder and store them in _library /// </summary> public static void Load() { string file = System.IO.Directory.GetCurrentDirectory() + "\\DataArrays\\Spell.txt"; FileStream strLib = File.Open(file, FileMode.Open); using (StreamReader read = new StreamReader(strLib, Encoding.UTF7)) { while (read.Peek() >= 0) { Spell toAdd = new Spell(read.ReadLine()); _library.Add(toAdd.Id, toAdd); } } }