private void StartNew() { if (this.Spells.Length != 6) { if (this.Spells.Length > 6) { Debug.LogError("Too many spell levels in grimoire '" + base.name + "': some will be dropped!"); } Grimoire.SpellChapter[] array = new Grimoire.SpellChapter[6]; this.Spells.CopyTo(array, 0); this.Spells = array; } for (int i = 0; i < this.Spells.Length; i++) { if (this.Spells[i] == null) { this.Spells[i] = new Grimoire.SpellChapter(); } else if (this.Spells[i].SpellData.Length != (4 + (int)IEModOptions.ExtraWizardSpells)) { if (this.Spells[i].SpellData.Length > (4 + (int)IEModOptions.ExtraWizardSpells)) { Debug.LogError(string.Concat(new object[] { "Too many spell slots in grimoire '", base.name, "' for level ", i + 1, ": some will be dropped!" })); } GenericSpell[] array2 = new GenericSpell[(4 + (int)IEModOptions.ExtraWizardSpells)]; for (int j = 0; j < Mathf.Min(array2.Length, this.Spells[i].SpellData.Length); j++) { array2[j] = this.Spells[i].SpellData[j]; } this.Spells[i].SpellData = array2; } } }
private void StartNew() { if (this.Spells.Length != MaxSpellLevel) { if (this.Spells.Length > MaxSpellLevel) { Debug.LogError("Too many spell levels in grimoire '" + base.name + "': some will be dropped!"); } Grimoire.SpellChapter[] array = new Grimoire.SpellChapter[MaxSpellLevel]; this.Spells.CopyTo(array, 0); this.Spells = array; } for (int i = 0; i < this.Spells.Length; i++) { if (this.Spells[i] == null) { this.Spells[i] = new Grimoire.SpellChapter(); } else if (this.Spells[i].SpellData.Length != MaxSpellsPerLevel + (int)IEModOptions.ExtraWizardSpells) { if (this.Spells[i].SpellData.Length > MaxSpellsPerLevel + (int)IEModOptions.ExtraWizardSpells) { Debug.LogError(string.Concat(new object[] { "Too many spell slots in grimoire '", base.name, "' for level ", i + 1, ": some will be dropped!" })); } GenericSpell[] array2 = new GenericSpell[(MaxSpellsPerLevel + (int)IEModOptions.ExtraWizardSpells)]; for (int j = 0; j < Mathf.Min(array2.Length, this.Spells[i].SpellData.Length); j++) { array2[j] = this.Spells[i].SpellData[j]; } this.Spells[i].SpellData = array2; } } }