public List <Spell> Get2DomainSpellsWithRank(ClericDomain domain_1, ClericDomain domain_2, int rank) { List <Spell> result = GetDomainAndRankSpells(domain_1, rank); result.AddRange(GetDomainAndRankSpells(domain_2, rank)); return(result); }
private IEnumerator CreateSpellButtons() { yield return(StartCoroutine(Clean())); yield return(null); int rank = storage.selectedRank; CharClassEnum cclass = storage.selectedChar.cclass; List <Spell> spells = new List <Spell>(); if (storage.selectedRankMain) { // main class spells spells.AddRange(storage.spellList.GetSpellsOfClassAndRank(cclass, rank)); } else { // extra spells (domains / school-spec) if (cclass == CharClassEnum.Cleric) { ClericDomain dom_1 = (ClericDomain)storage.selectedChar.attributes[0]; ClericDomain dom_2 = (ClericDomain)storage.selectedChar.attributes[1]; spells.AddRange(storage.spellList.Get2DomainSpellsWithRank(dom_1, dom_2, rank)); } else if (cclass == CharClassEnum.Wizard) { MagicSchool school = (MagicSchool)storage.selectedChar.attributes[0]; spells.AddRange(storage.spellList.GetWizardSchoolSpecializationSpells(school, rank)); } } CreateSpellButtons(spells); }
// Sets one of creature's cleric domains (either 1 or 2). public static void SetClericDomain(uint creature, int index, ClericDomain domain) { Internal.NativeFunctions.nwnxSetFunction(PLUGIN_NAME, "SetClericDomain"); Internal.NativeFunctions.nwnxPushInt((int)domain); Internal.NativeFunctions.nwnxPushInt(index); Internal.NativeFunctions.nwnxPushObject(creature); Internal.NativeFunctions.nwnxCallFunction(); }
private List <Spell> GetDomainAndRankSpells(ClericDomain domain, int rank) { List <Spell> result = mSpellList.FindAll( delegate(Spell temp) { return(temp.Contains(domain, rank)); }); return(result); }
public bool Contains(ClericDomain domain, int rank) { foreach (SpellAttribute attribute in mDomains) { if (attribute.attributeValue == (int)domain && attribute.rank == rank) { return(true); } } return(false); }
private void DomainHandler(int domain, string text) { if (domain == 1 || domain == 2) { if (mCharacter.attributes.Count != 2) { mCharacter.attributes.Clear(); mCharacter.attributes.Add(0); mCharacter.attributes.Add(0); } foreach (ClericDomain dom in ClericDomain.GetValues(typeof(ClericDomain))) { if (dom.ToString() == text) { mCharacter.attributes[domain - 1] = (int)dom; } } } }