View Single Post
  #2  
Old 02-16-2016, 02:17 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,603
Default

Well, endurance-based spell costs are categorized as disciplines due to the IsDiscipline logic.
Code:
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:
Code:
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
}
Reply With Quote