[Spells/Disciplines] Bulk Train / Scribe (#1640)

* Bulk scribe spells

* Add bulk disc training

* Remove bulk from non bulk method

* PR adjustments
This commit is contained in:
Chris Miles authored and GitHub committed 2021-10-27 21:45:27 -04:00
1 parent 6e5bf4b941
commit 7230714cbc
7 files changed
+157 -75

No files matched your search

+5 -1
View File
@@ -1130,7 +1130,8 @@ uint16 QuestManager::scribespells(uint8 max_level, uint8 min_level) {
if (initiator->HasSpellScribed(spell_id))
continue;
initiator->ScribeSpell(spell_id, book_slot);
// defer saving per spell and bulk save at the end
initiator->ScribeSpell(spell_id, book_slot, true, true);
book_slot = initiator->GetNextAvailableSpellBookSlot(book_slot);
spells_learned++;
}
@@ -1139,6 +1140,9 @@ uint16 QuestManager::scribespells(uint8 max_level, uint8 min_level) {
if (spells_learned > 0) {
std::string spell_message = (spells_learned == 1 ? "a new spell" : fmt::format("{} new spells", spells_learned));
initiator->Message(Chat::White, fmt::format("You have learned {}!", spell_message).c_str());
// bulk insert spells
initiator->SaveSpells();
}
return spells_learned;
}