mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-13 19:53:02 -04:00
AI/SmartScripts: SMART_ACTION_ADD_QUEST -> SMART_ACTION_OFFER_QUEST. Open quest offer instead of adding straight to log - old behavior can be requested using action_param2. Closes #17735.
This commit is contained in:
@@ -316,7 +316,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
delete targets;
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_ADD_QUEST:
|
||||
case SMART_ACTION_OFFER_QUEST:
|
||||
{
|
||||
ObjectList* targets = GetTargets(e, unit);
|
||||
if (!targets)
|
||||
@@ -324,13 +324,26 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
{
|
||||
if (IsPlayer(*itr))
|
||||
if (Player* pTarget = (*itr)->ToPlayer())
|
||||
{
|
||||
if (Quest const* q = sObjectMgr->GetQuestTemplate(e.action.quest.quest))
|
||||
if (Quest const* q = sObjectMgr->GetQuestTemplate(e.action.questOffer.questID))
|
||||
{
|
||||
(*itr)->ToPlayer()->AddQuestAndCheckCompletion(q, nullptr);
|
||||
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_ADD_QUEST: Player guidLow %u add quest %u",
|
||||
(*itr)->GetGUID().GetCounter(), e.action.quest.quest);
|
||||
if (me && e.action.questOffer.directAdd == 0)
|
||||
{
|
||||
if (pTarget->CanTakeQuest(q, true))
|
||||
if (WorldSession* session = pTarget->GetSession())
|
||||
{
|
||||
PlayerMenu menu(session);
|
||||
menu.SendQuestGiverQuestDetails(q, me->GetGUID(), true);
|
||||
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_OFFER_QUEST: Player guidLow %u - offering quest %u", pTarget->GetGUID().GetCounter(), e.action.questOffer.questID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
(*itr)->ToPlayer()->AddQuestAndCheckCompletion(q, nullptr);
|
||||
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_OFFER_QUEST: Player guidLow %u - quest %u added",
|
||||
pTarget->GetGUID().GetCounter(), e.action.questOffer.questID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user