[11438] Clarify code for quest start/source/req items adding/remove at quest start.

* Fix problem with complete quest when quest start item == quest source item.
  And source item not have max items amount setting.
* Avoid remove start item for case when it will re-added at next code line as source item
This commit is contained in:
VladimirMangos 2011-05-08 05:45:59 +04:00
parent 1cd48649c2
commit a5fe00d6f6
4 changed files with 37 additions and 33 deletions

View file

@ -196,25 +196,8 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data )
break;
case TYPEID_ITEM:
case TYPEID_CONTAINER:
{
sScriptMgr.OnQuestAccept(_player, (Item*)pObject, qInfo);
// destroy not required for quest finish quest starting item
bool destroyItem = true;
for(int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
{
if ((qInfo->ReqItemId[i] == ((Item*)pObject)->GetEntry()) && (((Item*)pObject)->GetProto()->MaxCount > 0))
{
destroyItem = false;
break;
}
}
if(destroyItem)
_player->DestroyItem(((Item*)pObject)->GetBagSlot(), ((Item*)pObject)->GetSlot(), true);
break;
}
case TYPEID_GAMEOBJECT:
sScriptMgr.OnQuestAccept(_player, (GameObject*)pObject, qInfo);
break;