[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 <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-10-08 20:48:23 +02:00
parent 8bb27ebd8e
commit 795c3e1f2f
4 changed files with 48 additions and 3 deletions

View file

@ -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:
{

View file

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

View file

@ -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

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10591"
#define REVISION_NR "10592"
#endif // __REVISION_NR_H__