private Dictionary <string, int> ComponentsPerSpell(SpellComponentIDs comps) { Dictionary <string, int> compDict = new Dictionary <string, int>(); for (int i = 0; i < comps.Length; i++) { if (!compDict.ContainsKey(GetComponent(comps[i]).Name)) { compDict.Add(GetComponent(comps[i]).Name, 1); } else { compDict[GetComponent(comps[i]).Name] += 1; } } return(compDict); }
internal bool HaveComponents(int spellId) { bool haveOriginalComponents = true; bool haveScarabs = true; string scarabType = ""; SpellComponentIDs comps = RequiredComponents(spellId); Dictionary <string, int> compCounts = ComponentsPerSpell(comps); foreach (KeyValuePair <string, int> compRequired in compCounts) { if (compRequired.Key.Contains("Scarab")) { scarabType = compRequired.Key; } if (!(QuantityInInventory(compRequired.Key) >= compRequired.Value)) { if (compRequired.Key.Contains("Scarab")) { haveScarabs = false; } haveOriginalComponents = false; break; } } if (haveOriginalComponents) { return(true); } else if (haveScarabs && HaveTapers(scarabType) && (HaveFociOrAugmentation(spellId))) { return(true); } else { return(false); } }