Log in

View Full Version : Spells that have an endurance cost do not get scribed with quest::scribespells


zerjz3
02-16-2016, 02:13 PM
I have thoroughly tested this. If a spell has a value set for Endurance Cost, it will not be scribed via the quest::scribespells function.

Seems like an unintentional bug to me, would be nice to have a fix for this.

Kingly_Krab
02-16-2016, 02:17 PM
Well, endurance-based spell costs are categorized as disciplines due to the IsDiscipline logic. bool IsDiscipline(uint16 spell_id)
{
if (!IsValidSpell(spell_id))
return false;

if (spells[spell_id].mana == 0 &&
(spells[spell_id].EndurCost || spells[spell_id].EndurUpkeep))
return true;

return false;
}The reason I bring this up is because quest::scribespells checks if the spell is a discipline and using that check causes all endurance-based spells to be categorized as disciplines: uint16 QuestManager::scribespells(uint8 max_level, uint8 min_level) {
QuestManagerCurrentQuestVars();
uint16 book_slot, count;
uint16 curspell;

uint32 Char_ID = initiator->CharacterID();
bool SpellGlobalRule = RuleB(Spells, EnableSpellGlobals);
bool SpellGlobalCheckResult = 0;


for(curspell = 0, book_slot = initiator->GetNextAvailableSpellBookSlot(), count = 0; curspell < SPDAT_RECORDS && book_slot < MAX_PP_SPELLBOOK; curspell++, book_slot = initiator->GetNextAvailableSpellBookSlot(book_slot))
{
if
(
spells[curspell].classes[WARRIOR] != 0 && //check if spell exists
spells[curspell].classes[initiator->GetPP().class_-1] <= max_level && //maximum level
spells[curspell].classes[initiator->GetPP().class_-1] >= min_level && //minimum level
spells[curspell].skill != 52 &&
spells[curspell].effectid[EFFECT_COUNT - 1] != 10
)
{
if (book_slot == -1) //no more book slots
break;
if(!IsDiscipline(curspell) && !initiator->HasSpellScribed(curspell)) { //isn't a discipline & we don't already have it scribed
if (SpellGlobalRule) {
// Bool to see if the character has the required QGlobal to scribe it if one exists in the Spell_Globals table
SpellGlobalCheckResult = initiator->SpellGlobalCheck(curspell, Char_ID);
if (SpellGlobalCheckResult) {
initiator->ScribeSpell(curspell, book_slot);
count++;
}
}
else {
initiator->ScribeSpell(curspell, book_slot);
count++;
}
}
}
}
return count; //how many spells were scribed successfully
}

zerjz3
02-16-2016, 02:41 PM
Thank you so much, Kingly. Turns out it wasn't a bug at all like I thought. I've got it changed in my source now to work like I want it to :)