TrinityCore icon indicating copy to clipboard operation
TrinityCore copied to clipboard

[Crash] SatisfyQuestExclusiveGroup when entering Old Town

Open MrSmite opened this issue 14 years ago • 14 comments

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/

MrSmite avatar Nov 18 '12 09:11 MrSmite

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);

MrSmite avatar Nov 18 '12 09:11 MrSmite

No. pool_quest is not related to ExclusiveGroup field. The wiki would be wrong if there is such a thing written there

Shauren avatar Nov 18 '12 10:11 Shauren

ExclusiveGroup

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.

MrSmite avatar Nov 18 '12 10:11 MrSmite

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 :)

MrSmite avatar Nov 18 '12 11:11 MrSmite

"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)

Shauren avatar Nov 20 '12 09:11 Shauren

Ok so maybe then this quest doesn't need that field? If that's the case then the function wouldn't even be called.

MrSmite avatar Nov 20 '12 11:11 MrSmite

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)

Shauren avatar Nov 20 '12 11:11 Shauren

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.

MrSmite avatar Nov 20 '12 11:11 MrSmite

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)

joschiwald avatar Jun 13 '13 21:06 joschiwald

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 ?

jackpoz avatar Oct 21 '13 20:10 jackpoz

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 avatar Oct 21 '13 21:10 jackpoz

@jackpoz the information https://github.com/TrinityCore/TrinityCore/issues/11086

rodrigoalv avatar Oct 21 '13 21:10 rodrigoalv

@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

rodrigoalv avatar Oct 21 '13 21:10 rodrigoalv

Thanks you :D @jackpoz oz :) :+1:

rodrigoalv avatar Oct 21 '13 21:10 rodrigoalv