if(DEBUG) DoDebug("moi_essentiacnv: Building meld selection");
SetHeader("You are investing in soulmelds as a "+GetStringByStrRef(StringToInt(Get2DACache("classes", "Name", nClass)))+". You can invest up to "+IntToString(GetMaxEssentiaCapacity(oMeldshaper, nClass, -1))+" into a single soulmeld, and up to "+IntToString(GetTotalUsableEssentia(oMeldshaper))+" total. You have used "+IntToString(GetTotalEssentiaInvested(oMeldshaper))+" of your total.");
int i;
for(i = 1; i < 11 ; i++) // Done as two separate loops to skip out Totem melds
{
int nMeld = GetIsChakraUsed(oMeldshaper, i, nClass);
if(DEBUG) DoDebug("moi_essentiacnv: Building feat selection");
SetHeader("Choose the feat you wish to invest essentia in. You can invest up to "+IntToString(GetMaxEssentiaCapacityFeat(oMeldshaper))+" into a single feat, and up to "+IntToString(GetTotalUsableEssentia(oMeldshaper))+" total. Essentia invested into feats is used up until your next rest. You have used "+IntToString(GetTotalEssentiaInvested(oMeldshaper))+" of your total.");
int i;
for (i = 8869; i < 8889; i++)
{
// Can't have any essentia invested in the feat already
if(DEBUG) DoDebug("moi_essentiacnv: Building feat selection");
SetHeader("Choose the ability you wish to invest essentia in. You can invest up to "+IntToString(GetMaxEssentiaCapacity(oMeldshaper, -1, -1))+" into a single ability, and up to "+IntToString(GetTotalUsableEssentia(oMeldshaper))+" total. You have used "+IntToString(GetTotalEssentiaInvested(oMeldshaper))+" of your total.");
if (GetLevelByClass(CLASS_TYPE_SPINEMELD_WARRIOR, oMeldshaper) >= 2) AddChoice("Spine Enhancement", MELD_SPINE_ENHANCEMENT, oMeldshaper);
if (GetLevelByClass(CLASS_TYPE_IRONSOUL_FORGEMASTER, oMeldshaper) >= 1) AddChoice("Shield Bond", MELD_IRONSOUL_SHIELD, oMeldshaper);
if (GetLevelByClass(CLASS_TYPE_IRONSOUL_FORGEMASTER, oMeldshaper) >= 5) AddChoice("Armor Bond", MELD_IRONSOUL_ARMOR, oMeldshaper);
if (GetLevelByClass(CLASS_TYPE_IRONSOUL_FORGEMASTER, oMeldshaper) >= 9) AddChoice("Weapon Bond", MELD_IRONSOUL_WEAPON, oMeldshaper);
if (GetLevelByClass(CLASS_TYPE_UMBRAL_DISCIPLE, oMeldshaper) >= 1) AddChoice("Step of the Bodiless",MELD_UMBRAL_STEP , oMeldshaper);
if (GetLevelByClass(CLASS_TYPE_UMBRAL_DISCIPLE, oMeldshaper) >= 3) AddChoice("Embrace of Shadow", MELD_UMBRAL_SHADOW, oMeldshaper);
if (GetLevelByClass(CLASS_TYPE_UMBRAL_DISCIPLE, oMeldshaper) >= 7) AddChoice("Sight of the Eyeless",MELD_UMBRAL_SIGHT , oMeldshaper);
if (GetLevelByClass(CLASS_TYPE_UMBRAL_DISCIPLE, oMeldshaper) >= 9) AddChoice("Soulchilling Strike", MELD_UMBRAL_SOUL , oMeldshaper);
if (GetLevelByClass(CLASS_TYPE_UMBRAL_DISCIPLE, oMeldshaper) >= 10) AddChoice("Kiss of the Shadows", MELD_UMBRAL_KISS , oMeldshaper);
if (GetLevelByClass(CLASS_TYPE_INCANDESCENT_CHAMPION, oMeldshaper) >= 1) AddChoice("Incandescent Strike", MELD_INCANDESCENT_STRIKE , oMeldshaper);
if (GetLevelByClass(CLASS_TYPE_INCANDESCENT_CHAMPION, oMeldshaper) >= 2) AddChoice("Incandescent Heal", MELD_INCANDESCENT_HEAL , oMeldshaper);
if (GetLevelByClass(CLASS_TYPE_INCANDESCENT_CHAMPION, oMeldshaper) >= 3) AddChoice("Incandescent Countenance", MELD_INCANDESCENT_COUNTENANCE , oMeldshaper);
if (GetLevelByClass(CLASS_TYPE_INCANDESCENT_CHAMPION, oMeldshaper) >= 5) AddChoice("Incandescent Ray", MELD_INCANDESCENT_RAY , oMeldshaper);
if (GetLevelByClass(CLASS_TYPE_INCANDESCENT_CHAMPION, oMeldshaper) >= 8) AddChoice("Incandescent Aura", MELD_INCANDESCENT_AURA , oMeldshaper);
if (GetLevelByClass(CLASS_TYPE_WITCHBORN_BINDER, oMeldshaper) >= 1) AddChoice("Meldshield", MELD_WITCH_MELDSHIELD, oMeldshaper);
if (GetLevelByClass(CLASS_TYPE_WITCHBORN_BINDER, oMeldshaper) >= 2) AddChoice("Dispelling Orb", MELD_WITCH_DISPEL , oMeldshaper);
if (GetLevelByClass(CLASS_TYPE_WITCHBORN_BINDER, oMeldshaper) >= 4) AddChoice("Mage Shackles", MELD_WITCH_SHACKLES , oMeldshaper);
if (GetLevelByClass(CLASS_TYPE_WITCHBORN_BINDER, oMeldshaper) >= 6) AddChoice("Word of Abrogation", MELD_WITCH_ABROGATION, oMeldshaper);
if (GetLevelByClass(CLASS_TYPE_WITCHBORN_BINDER, oMeldshaper) >= 8) AddChoice("Spiritflat", MELD_WITCH_SPIRITFLAY, oMeldshaper);
if (GetLevelByClass(CLASS_TYPE_WITCHBORN_BINDER, oMeldshaper) >= 10) AddChoice("Grim Integument", MELD_WITCH_INTEGUMENT, oMeldshaper);
// Set the next, previous and wait tokens to default values
if(DEBUG) DoDebug("moi_essentiacnv: Building spell selection");
string sType = "power";
if (GetPrimaryArcaneClass(oMeldshaper)) sType = "spell";
SetHeader("Choose the "+sType+" you wish to invest essentia in. You can invest 1 essentia into a single "+sType+", and into "+IntToString(GetLevelByClass(CLASS_TYPE_SOULCASTER, oMeldshaper))+" "+sType+"s total");
if(DEBUG) DoDebug("moi_essentiacnv: Building essentia selection");
// Build the confirmation query
int nMeld = GetLocalInt(oMeldshaper, "nMeld");
SetHeader("How much do you want to invest into "+GetStringByStrRef(StringToInt(Get2DACache("spells", "Name", nMeld)))+"?");
int i;
for(i = 1; i <= min(GetTotalEssentia(oMeldshaper)-GetTotalEssentiaInvested(oMeldshaper), GetMaxEssentiaCapacity(oMeldshaper, nClass, nMeld)); i++)
{
AddChoice(IntToString(i), i, oMeldshaper);
}
// If there's still room to add more essentia, and there's expanded soulmeld essentia available
if (((GetTotalEssentia(oMeldshaper)-GetTotalEssentiaInvested(oMeldshaper)) > GetMaxEssentiaCapacity(oMeldshaper, nClass, nMeld)) && !GetIsSoulmeldCapacityUsed(oMeldshaper))
{
AddChoice(IntToString(i), 1000+i, oMeldshaper);
}
}
else if(nStage == STAGE_SELECT_ESSENTIA_FEAT)
{
if(DEBUG) DoDebug("moi_essentiacnv: Building essentia selection");
// Build the confirmation query
int nMeld = GetLocalInt(oMeldshaper, "nMeld");
SetHeader("How much do you want to invest into "+GetStringByStrRef(StringToInt(Get2DACache("feat", "FEAT", nMeld)))+"?");
int i;
for(i = 1; i <= min(GetTotalEssentia(oMeldshaper)-GetTotalEssentiaInvested(oMeldshaper), GetMaxEssentiaCapacityFeat(oMeldshaper)); i++)
{
AddChoice(IntToString(i), i, oMeldshaper);
}
}
else if(nStage == STAGE_SELECT_ESSENTIA_CLASS)
{
if(DEBUG) DoDebug("moi_essentiacnv: Building essentia selection");
// Build the confirmation query
int nMeld = GetLocalInt(oMeldshaper, "nMeld");
SetHeader("How much do you want to invest into "+GetStringByStrRef(StringToInt(Get2DACache("spells", "Name", nMeld)))+"?");
int nMax = min(GetTotalEssentia(oMeldshaper)-GetTotalEssentiaInvested(oMeldshaper), GetMaxEssentiaCapacityFeat(oMeldshaper));
if (nMeld == MELD_SPINE_ENHANCEMENT) nMax = GetLevelByClass(CLASS_TYPE_SPINEMELD_WARRIOR, oMeldshaper)/2;
int i;
for(i = 1; i <= nMax; i++)
{
AddChoice(IntToString(i), i, oMeldshaper);
}
}
else if(nStage == STAGE_SELECT_ESSENTIA_SPELL)
{
if(DEBUG) DoDebug("moi_essentiacnv: Building essentia selection");
// Build the confirmation query
int nMeld = GetLocalInt(oMeldshaper, "nMeld");
SetHeader("How much do you want to invest into "+GetStringByStrRef(StringToInt(Get2DACache("spells", "Name", nMeld)))+"?");
AddChoice(IntToString(1), 1, oMeldshaper);
if (GetLevelByClass(CLASS_TYPE_SOULCASTER, oMeldshaper) >= 7) AddChoice(IntToString(2), 2, oMeldshaper);
}
// Selection confirmation stage
else if(nStage == STAGE_CONFIRM_SELECTION)
{
if(DEBUG) DoDebug("moi_essentiacnv: Building selection confirmation");
// Build the confirmation query
int nMeld = GetLocalInt(oMeldshaper, "nMeld");
int nEssentia = GetLocalInt(oMeldshaper, "nEssentia");
// Marked as using Expanded Soulmeld Capacity, make it look pretty
if (nEssentia > 1000) nEssentia -= 1000;
string sToken = "You have chosen to invest "+IntToString(nEssentia)+" essentia into "+GetStringByStrRef(StringToInt(Get2DACache("spells", "Name", nMeld)))+"."+ "\n\n";
sToken += GetStringByStrRef(STRREF_SELECTED_HEADER2); // "Is this correct?"