[Crash] SatisfyQuestExclusiveGroup when entering Old Town
Rev: 29e20d4c4156933559c841ebbbf9e653986902a5
Bug:
When entering Old Town the server crashes when you start walking toward Champion's Hall
Details:
The strange thing is when running through the debugger, the server is crashing because of a quest that my character doesn't have:
11335 "A Call To Arms: Arathi Basin"
Crash dump: http://www.trinitycore.org/f/pastebin/i0g1uwobct1/
This is the actual code causing the crash:
ObjectMgr::ExclusiveQuestGroups::iterator iter = sObjectMgr->mExclusiveQuestGroups.lower_bound(qInfo->GetExclusiveGroup());
ObjectMgr::ExclusiveQuestGroups::iterator end = sObjectMgr->mExclusiveQuestGroups.upper_bound(qInfo->GetExclusiveGroup());
ASSERT(iter != end); // always must be found if qInfo->ExclusiveGroup != 0
The debugger shows the following values of interest:
qInfo->ExclusiveGroup = 11338 end (11377,11379) iter (11377,11379)
According to the wiki, all quests that use ExclusiveGroup MUST have an entry in pool_template and pool_quest however both these SQL return no results:
SELECT * FROM `pool_quest` WHERE `entry` IN (SELECT `Id` FROM `quest_template` WHERE `ExclusiveGroup` = 11338);
SELECT * FROM `pool_template` WHERE `entry` IN (SELECT `Id` FROM `quest_template` WHERE `ExclusiveGroup` = 11338);
No. pool_quest is not related to ExclusiveGroup field. The wiki would be wrong if there is such a thing written there
Note: All quests that use an ExclusiveGroup must also have entries in pool_template and pool_quest in order for the core to choose one randomly. See the examples section for examples.
For kicks, I created the pool and it didn't fix the problem.
This fixes the problem by surrounding the FOR loop with an IF and executing the same code only once if iter = end
http://www.trinitycore.org/f/pastebin/i0g1uwopqkm/
But I'm not sure what you guys think of that or if it causes any issues with ExclusiveGroup. Let me know and I can do a proper PR if you think this is a valid fix.
Or someone else can if they want, I need sleep :)
"in order for the core to choose one randomly" quoting this part from the wiki - it only applies when you want one to be available at the time (such as randomly chosen dalaran cooking dailies)
Ok so maybe then this quest doesn't need that field? If that's the case then the function wouldn't even be called.
ExclusiveGroup is generally used to mark quests that you cannot have in log together/complete both, setting one daily available randomly is what pool_quest does (it needs exclusive group too so you cannot take the quest on previous day and keep it, but that is another story)
Well, if this quest needs ExclusiveGroup then the function is broken. I already created the pools but the function still crashed on the ASSERT() statement.
The code I posted avoids the crash but I'm not sure if it actually prevents quest hoarding properly. I'm curious why the pool didn't fix the problem though.
try:
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -3758,6 +3758,9 @@ void ObjectMgr::LoadQuests()
// Post processing
for (QuestMap::iterator iter = _questTemplates.begin(); iter != _questTemplates.end(); ++iter)
{
+ if (qinfo->ExclusiveGroup)
+ mExclusiveQuestGroups.insert(std::pair<int32, uint32>(qinfo->ExclusiveGroup, qinfo->GetQuestId()));
+
// skip post-loading checks for disabled quests
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, iter->first, NULL))
continue;
@@ -4337,8 +4340,6 @@ void ObjectMgr::LoadQuests()
}
}
- if (qinfo->ExclusiveGroup)
- mExclusiveQuestGroups.insert(std::pair<int32, uint32>(qinfo->ExclusiveGroup, qinfo->GetQuestId()));
if (qinfo->LimitTime)
qinfo->SetFlag(QUEST_TRINITY_FLAGS_TIMED);
if (qinfo->RequiredPlayerKills)
or maybe it is better to delete the disable check here to ensure that the quest store is loaded correctly
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -3758,10 +3758,6 @@ void ObjectMgr::LoadQuests()
// Post processing
for (QuestMap::iterator iter = _questTemplates.begin(); iter != _questTemplates.end(); ++iter)
{
- // skip post-loading checks for disabled quests
- if (DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, iter->first, NULL))
- continue;
-
Quest * qinfo = iter->second;
// additional quest integrity checks (GO, creature_template and item_template must be loaded already)
quest 11335 is supposed to be disabled, in fact it's in the world.disables table as "Deprecated quest: Call to Arms: Arathi Basin" . could you verify that the quest is in that table ? did you apply any customization ?
could you please execute these queries and tell if they return anything ? thank you
SELECT `id`, `quest`FROM `world`.`creature_queststarter` WHERE quest = 11335;
SELECT `id`, `quest`FROM `world`.`gameobject_queststarter` WHERE quest = 11335;
SELECT `id`, `quest`FROM `world`.`game_event_creature_quest` WHERE quest = 11335;
SELECT `id`, `quest`FROM `world`.`game_event_gameobject_quest` WHERE quest = 11335;
SELECT entry, description FROM `world`.`pool_quest` WHERE entry = 11335;
@jackpoz the information https://github.com/TrinityCore/TrinityCore/issues/11086
@jackpoz
SELECT id, questFROM world.creature_queststarter WHERE quest = 11335; only file id = 15351 and quest = 11335
SELECT id, questFROM world.gameobject_queststarter WHERE quest = 11335; nathing
SELECT id, questFROM world.game_event_creature_quest WHERE quest = 11335; nathing
SELECT id, questFROM world.game_event_gameobject_quest WHERE quest = 11335; nathing
SELECT entry, description FROM world.pool_quest WHERE entry = 11335; nathing
any idea? :S
and the quest 11335 is in disable table
Thanks you :D @jackpoz oz :) :+1: