diff --git a/src/PlayerbotFactory.cpp b/src/PlayerbotFactory.cpp index 542983d80..fe6b45eb3 100644 --- a/src/PlayerbotFactory.cpp +++ b/src/PlayerbotFactory.cpp @@ -212,29 +212,11 @@ void PlayerbotFactory::Randomize(bool incremental) if (pmo) pmo->finish(); */ - InitInstanceQuests(); - // clear quest reward inventory - ClearInventory(); - bot->GiveLevel(level); - if (sPlayerbotAIConfig->randomBotPreQuests) - { - uint32 currentXP = bot->GetUInt32Value(PLAYER_XP); - LOG_INFO("playerbots", "Initializing quests..."); + if (sPlayerbotAIConfig->randomBotPreQuests){ pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Quests"); - InitQuests(classQuestIds); - InitQuests(specialQuestIds); - - // quest rewards boost bot level, so reduce back - - bot->GiveLevel(level); - - - ClearInventory(); - bot->SetUInt32Value(PLAYER_XP, currentXP); - CancelAuras(); - bot->SaveToDB(false, false); - if (pmo) + InitInstanceQuests(); + if (pmo) pmo->finish(); } @@ -2454,21 +2436,17 @@ void PlayerbotFactory::InitQuests(std::list& questMap) void PlayerbotFactory::InitInstanceQuests() { // Yunfan: use configuration instead of hard code + uint32 currentXP = bot->GetUInt32Value(PLAYER_XP); + LOG_INFO("playerbots", "Initializing quests..."); + InitQuests(classQuestIds); + InitQuests(specialQuestIds); - // The Caverns of Time - if (bot->GetLevel() >= 64) { - uint32 questId = 10277; - Quest const *quest = sObjectMgr->GetQuestTemplate(questId); - bot->SetQuestStatus(questId, QUEST_STATUS_COMPLETE); - bot->RewardQuest(quest, 5, bot, false); - } - // Return to Andormu - if (bot->GetLevel() >= 66) { - uint32 questId = 10285; - Quest const *quest = sObjectMgr->GetQuestTemplate(questId); - bot->SetQuestStatus(questId, QUEST_STATUS_COMPLETE); - bot->RewardQuest(quest, 5, bot, false); - } + // quest rewards boost bot level, so reduce back + bot->GiveLevel(level); + + ClearInventory(); + bot->SetUInt32Value(PLAYER_XP, currentXP); + bot->SaveToDB(false, false); } void PlayerbotFactory::ClearInventory() diff --git a/src/PlayerbotFactory.h b/src/PlayerbotFactory.h index 5a1e583ee..9dad3e381 100644 --- a/src/PlayerbotFactory.h +++ b/src/PlayerbotFactory.h @@ -135,6 +135,7 @@ class PlayerbotFactory void InitMounts(); void InitBags(bool destroyOld = true); void ApplyEnchantAndGemsNew(bool destoryOld = true); + void InitInstanceQuests(); private: void Prepare(); // void InitSecondEquipmentSet(); @@ -151,7 +152,6 @@ class PlayerbotFactory void InitTalents(uint32 specNo); void InitTalentsByTemplate(uint32 specNo); void InitQuests(std::list& questMap); - void InitInstanceQuests(); void ClearInventory(); void ClearAllItems(); void ResetQuests(); diff --git a/src/PlayerbotMgr.cpp b/src/PlayerbotMgr.cpp index c83777218..976595835 100644 --- a/src/PlayerbotMgr.cpp +++ b/src/PlayerbotMgr.cpp @@ -628,6 +628,11 @@ std::string const PlayerbotHolder::ProcessBotCommand(std::string const cmd, Obje sRandomPlayerbotMgr->Randomize(bot); return "ok"; } + else if (cmd == "quests"){ + PlayerbotFactory factory(bot, bot->getLevel()); + factory.InitInstanceQuests(); + return "Initialization quests"; + } // } return "unknown command";