public Consumable(int ip, int spellId, int spellLevel, int casterLevel, CNWSpell spell, bool adjustCost = true, string iconName = null)
{
blueprint = new NWN2ItemBlueprint();
string tag = tagPrefix + spellId.ToString() + "_" + casterLevel.ToString();
ushort resType = OEIShared.Utils.BWResourceTypes.GetResourceType("UTI");
blueprint.Resource = Globals.repository.CreateResource(new OEIShared.Utils.OEIResRef(tag), resType);
blueprint.TemplateResRef = new OEIShared.Utils.OEIResRef(tag);
blueprint.Tag = tag;
blueprint.ResourceName = new OEIShared.Utils.OEIResRef(tag);
blueprint.BaseItem = new OEIShared.IO.TwoDA.TwoDAReference("baseitems", "Name", true, baseType);
string name = ConsumableName(spell, spellId, spellLevel, casterLevel);
blueprint.LocalizedName = new OEIShared.Utils.OEIExoLocString();
blueprint.LocalizedName[OEIShared.Utils.BWLanguages.BWLanguage.English] = name;
blueprint.LocalizedDescriptionIdentified = new OEIShared.Utils.OEIExoLocString();
blueprint.LocalizedDescriptionIdentified[OEIShared.Utils.BWLanguages.BWLanguage.English] =
baseDescription + Environment.NewLine + Environment.NewLine +
Globals.GetTlkEntry((uint)spell.GetSpellDescription()) + Environment.NewLine + Environment.NewLine +
GetAuraDescription(spellLevel, spell);
if (ip >= 0) blueprint.Properties.Add(itemProperty(ip));
blueprint.Classification = baseCategory;
if (iconName == null)
iconName = findIconName(spellId, spell, spellLevel);
int iconId = Globals.getIconId(iconName);
if (iconId == 0)
flagIconMissingForSpell(spellId, GetSpellName(spell));
blueprint.Icon = new TwoDAReference("nwn2_icons", "ICON", false, iconId);
blueprint.CalculateBaseCosts();
if (adjustCost)
blueprint.AdditionalCost = cost(spellLevel, casterLevel) - (int)blueprint.Cost;
}
}