[7369] Remove ReqSourceRef in quest_template.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
NoFantasy 2009-03-02 03:30:38 +03:00 committed by VladimirMangos
parent 2f02dc7642
commit 94de4437f8
8 changed files with 59 additions and 114 deletions

View file

@ -13818,28 +13818,21 @@ bool Player::HasQuestForItem( uint32 itemid ) const
for (int j = 0; j < QUEST_SOURCE_ITEM_IDS_COUNT; j++)
{
// examined item is a source item
if (qinfo->ReqSourceId[j] == itemid && qinfo->ReqSourceRef[j] > 0 && qinfo->ReqSourceRef[j] <= QUEST_OBJECTIVES_COUNT)
if (qinfo->ReqSourceId[j] == itemid)
{
uint32 idx = qinfo->ReqSourceRef[j]-1;
ItemPrototype const *pProto = objmgr.GetItemPrototype(itemid);
// total count of created ReqItems and SourceItems is less than ReqItemCount
if(qinfo->ReqItemId[idx] != 0 &&
q_status.m_itemcount[idx] * qinfo->ReqSourceCount[j] + GetItemCount(itemid,true) < qinfo->ReqItemCount[idx] * qinfo->ReqSourceCount[j])
// 'unique' item
if (pProto->MaxCount && GetItemCount(itemid,true) < pProto->MaxCount)
return true;
// total count of casted ReqCreatureOrGOs and SourceItems is less than ReqCreatureOrGOCount
if (qinfo->ReqCreatureOrGOId[idx] != 0)
// allows custom amount drop when not 0
if (qinfo->ReqSourceCount[j])
{
if(q_status.m_creatureOrGOcount[idx] * qinfo->ReqSourceCount[j] + GetItemCount(itemid,true) < qinfo->ReqCreatureOrGOCount[idx] * qinfo->ReqSourceCount[j])
if (GetItemCount(itemid,true) < qinfo->ReqSourceCount[j])
return true;
}
// spell with SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT (with script) case
else if(qinfo->ReqSpell[idx] != 0)
{
// not casted and need more reagents/item for use.
if(!q_status.m_explored && GetItemCount(itemid,true) < qinfo->ReqSourceCount[j])
return true;
}
} else if (GetItemCount(itemid,true) < pProto->Stackable)
return true;
}
}
}