Core/Entities: allow interaction with gameobject questgivers if player can take or return quests

Closes #11269
Closes #8898
Closes #10204
Closes #11410
Closes #7053
Closes #6189
Closes #9474
This commit is contained in:
joschiwald
2014-02-06 21:23:18 +01:00
parent 59e14b2b9b
commit b000fdca70
8 changed files with 197 additions and 207 deletions
@@ -986,9 +986,17 @@ bool GameObject::ActivateToQuest(Player* target) const
switch (GetGoType())
{
// scan GO chest with loot including quest items
case GAMEOBJECT_TYPE_QUESTGIVER:
{
GameObject* go = const_cast<GameObject*>(this);
QuestGiverStatus questStatus = target->GetQuestDialogStatus(go);
if (questStatus > DIALOG_STATUS_UNAVAILABLE)
return true;
break;
}
case GAMEOBJECT_TYPE_CHEST:
{
// scan GO chest with loot including quest items
if (LootTemplates_Gameobject.HaveQuestLootForPlayer(GetGOInfo()->GetLootId(), target))
{
if (Battleground const* bg = target->GetBattleground())
@@ -2148,6 +2156,10 @@ void GameObject::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* t
int16 pathProgress = -1;
switch (GetGoType())
{
case GAMEOBJECT_TYPE_QUESTGIVER:
if (ActivateToQuest(target))
dynFlags |= GO_DYNFLAG_LO_ACTIVATE;
break;
case GAMEOBJECT_TYPE_CHEST:
case GAMEOBJECT_TYPE_GOOBER:
if (ActivateToQuest(target))