From 795c3e1f2f3df7cc21bee178834fb38f0cb2f973 Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Fri, 8 Oct 2010 20:48:23 +0200 Subject: [PATCH] [10592] Make GO type 2 activate/deactivate As with similar GO's that are not interactable (gameobject_template.flags|4) as default, GO's of type 2 becomes active when player can take a quest (or deliver quest). Signed-off-by: NoFantasy --- src/game/GameObject.cpp | 28 ++++++++++++++++++++++++++++ src/game/Object.cpp | 6 ++++-- src/game/ObjectMgr.cpp | 15 +++++++++++++++ src/shared/revision_nr.h | 2 +- 4 files changed, 48 insertions(+), 3 deletions(-) diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 9c3da3564..a098c3c79 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -725,6 +725,34 @@ bool GameObject::ActivateToQuest(Player *pTarget)const switch(GetGoType()) { + case GAMEOBJECT_TYPE_QUESTGIVER: + { + // Not fully clear when GO's can activate/deactivate + // For cases where GO has additional (except quest itself), + // these conditions are not sufficient/will fail. + // Never expect flags|4 for these GO's? (NF-note: It doesn't appear it's expected) + + const QuestRelations &qRel = sObjectMgr.mGOQuestRelations; + + for(QuestRelations::const_iterator itr = qRel.lower_bound(GetEntry()); itr != qRel.upper_bound(GetEntry()); ++itr) + { + const Quest *qInfo = sObjectMgr.GetQuestTemplate(itr->second); + + if (pTarget->CanTakeQuest(qInfo, false)) + return true; + } + + const QuestRelations &qInRel = sObjectMgr.mGOQuestInvolvedRelations; + + for(QuestRelations::const_iterator itr = qInRel.lower_bound(GetEntry()); itr != qInRel.upper_bound(GetEntry()); ++itr) + { + if ((pTarget->GetQuestStatus(itr->second) == QUEST_STATUS_INCOMPLETE || pTarget->GetQuestStatus(itr->second) == QUEST_STATUS_COMPLETE) + && !pTarget->GetQuestRewardStatus(itr->second)) + return true; + } + + break; + } // scan GO chest with loot including quest items case GAMEOBJECT_TYPE_CHEST: { diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 7e27bee18..6df8b3291 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -686,8 +686,6 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask * { // GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY can have lo flag = 2 // most likely related to "can enter map" and then should be 0 if can not enter - // GAMEOBJECT_TYPE_QUESTGIVER can have lo flag = 1 - // most likely related to can take/finish quest at // GO_DYNFLAG_ACTIVATE = 0x01 // GO_DYNFLAG_ANIMATE = 0x02 @@ -698,6 +696,10 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask * { switch(((GameObject*)this)->GetGoType()) { + case GAMEOBJECT_TYPE_QUESTGIVER: + *data << uint16(1); + *data << uint16(-1); + break; case GAMEOBJECT_TYPE_CHEST: // enable quest object. Represent 9, but 1 for client before 2.3.0 *data << uint16(9); diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index d18bc9f0b..0fdc9ca84 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -7720,6 +7720,21 @@ void ObjectMgr::LoadGameObjectForQuests() switch(goInfo->type) { + case GAMEOBJECT_TYPE_QUESTGIVER: + { + if (mGOQuestRelations.find(go_entry) != mGOQuestRelations.end()) + { + mGameObjectForQuestSet.insert(go_entry); + ++count; + } + else if (mGOQuestInvolvedRelations.find(go_entry) != mGOQuestInvolvedRelations.end()) + { + mGameObjectForQuestSet.insert(go_entry); + ++count; + } + + break; + } case GAMEOBJECT_TYPE_CHEST: { // scan GO chest with loot including quest items diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 31e4138ab..26bfec67a 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10591" + #define REVISION_NR "10592" #endif // __REVISION_NR_H__