mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Merge pull request #536 from liyunfan1223/crash_prequest
Fix crash if PreQuests=1
This commit is contained in:
@@ -79,6 +79,19 @@ void PlayerbotFactory::Init()
|
||||
if (!quest->GetRequiredClasses() || quest->IsRepeatable() || quest->GetMinLevel() < 10)
|
||||
continue;
|
||||
|
||||
if (quest->GetRewSpellCast() > 0)
|
||||
{
|
||||
int32 spellId = quest->GetRewSpellCast();
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
if (!spellInfo)
|
||||
continue;
|
||||
} else if (quest->GetRewSpell() > 0) {
|
||||
int32 spellId = quest->GetRewSpell();
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
if (!spellInfo)
|
||||
continue;
|
||||
}
|
||||
|
||||
AddPrevQuests(questId, classQuestIds);
|
||||
classQuestIds.remove(questId);
|
||||
classQuestIds.push_back(questId);
|
||||
@@ -381,7 +394,7 @@ void PlayerbotFactory::Randomize(bool incremental)
|
||||
if (bot->GetLevel() >= 70)
|
||||
{
|
||||
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Arenas");
|
||||
LOG_INFO("playerbots", "Initializing arena teams...");
|
||||
// LOG_INFO("playerbots", "Initializing arena teams...");
|
||||
InitArenaTeam();
|
||||
if (pmo)
|
||||
pmo->finish();
|
||||
@@ -2723,9 +2736,9 @@ void PlayerbotFactory::InitQuests(std::list<uint32>& questMap)
|
||||
bot->SetQuestStatus(questId, QUEST_STATUS_COMPLETE);
|
||||
bot->RewardQuest(quest, 0, bot, false);
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} ({} level) rewarded quest {}: {} (MinLevel={}, QuestLevel={})",
|
||||
bot->GetName().c_str(), bot->GetLevel(), questId, quest->GetTitle().c_str(), quest->GetMinLevel(),
|
||||
quest->GetQuestLevel());
|
||||
// LOG_INFO("playerbots", "Bot {} ({} level) rewarded quest {}: {} (MinLevel={}, QuestLevel={})",
|
||||
// bot->GetName().c_str(), bot->GetLevel(), questId, quest->GetTitle().c_str(), quest->GetMinLevel(),
|
||||
// quest->GetQuestLevel());
|
||||
|
||||
if (!(count++ % 10))
|
||||
ClearInventory();
|
||||
@@ -2738,7 +2751,7 @@ void PlayerbotFactory::InitInstanceQuests()
|
||||
{
|
||||
// Yunfan: use configuration instead of hard code
|
||||
uint32 currentXP = bot->GetUInt32Value(PLAYER_XP);
|
||||
LOG_INFO("playerbots", "Initializing quests...");
|
||||
// LOG_INFO("playerbots", "Initializing quests...");
|
||||
InitQuests(classQuestIds);
|
||||
InitQuests(specialQuestIds);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user