Core/Quest: Fix crash in GetQuestDialogStatus()
Port From (https://github.com/TrinityCore/TrinityCore/commit/b1b5a6a591be621e23905a7f320a3db1dc96cf7f)
This commit is contained in:
@@ -27,6 +27,7 @@ using Game.Networking.Packets;
|
|||||||
using Game.Spells;
|
using Game.Spells;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Game.AI;
|
||||||
|
|
||||||
namespace Game.Entities
|
namespace Game.Entities
|
||||||
{
|
{
|
||||||
@@ -1853,9 +1854,13 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
case TypeId.GameObject:
|
case TypeId.GameObject:
|
||||||
{
|
{
|
||||||
QuestGiverStatus? questStatus = questgiver.ToGameObject().GetAI().GetDialogStatus(this);
|
GameObjectAI ai = questgiver.ToGameObject().GetAI();
|
||||||
|
if (ai != null)
|
||||||
|
{
|
||||||
|
var questStatus = ai.GetDialogStatus(this);
|
||||||
if (questStatus.HasValue)
|
if (questStatus.HasValue)
|
||||||
return questStatus.Value;
|
return questStatus.Value;
|
||||||
|
}
|
||||||
|
|
||||||
qr = Global.ObjectMgr.GetGOQuestRelationBounds(questgiver.GetEntry());
|
qr = Global.ObjectMgr.GetGOQuestRelationBounds(questgiver.GetEntry());
|
||||||
qir = Global.ObjectMgr.GetGOQuestInvolvedRelationBounds(questgiver.GetEntry());
|
qir = Global.ObjectMgr.GetGOQuestInvolvedRelationBounds(questgiver.GetEntry());
|
||||||
@@ -1863,9 +1868,13 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
case TypeId.Unit:
|
case TypeId.Unit:
|
||||||
{
|
{
|
||||||
QuestGiverStatus? questStatus = questgiver.ToCreature().GetAI().GetDialogStatus(this);
|
CreatureAI ai = questgiver.ToCreature().GetAI();
|
||||||
|
if (ai != null)
|
||||||
|
{
|
||||||
|
QuestGiverStatus? questStatus = ai.GetDialogStatus(this);
|
||||||
if (questStatus.HasValue)
|
if (questStatus.HasValue)
|
||||||
return questStatus.Value;
|
return questStatus.Value;
|
||||||
|
}
|
||||||
|
|
||||||
qr = Global.ObjectMgr.GetCreatureQuestRelationBounds(questgiver.GetEntry());
|
qr = Global.ObjectMgr.GetCreatureQuestRelationBounds(questgiver.GetEntry());
|
||||||
qir = Global.ObjectMgr.GetCreatureQuestInvolvedRelationBounds(questgiver.GetEntry());
|
qir = Global.ObjectMgr.GetCreatureQuestInvolvedRelationBounds(questgiver.GetEntry());
|
||||||
|
|||||||
Reference in New Issue
Block a user