mirror of
https://github.com/mangosfour/server.git
synced 2025-12-25 13:37:02 +00:00
[11979] Remove ReqSourceItems when rewarding or abandoning a quest
Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
parent
24574b000e
commit
c17fdc3093
4 changed files with 127 additions and 48 deletions
|
|
@ -320,22 +320,32 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recv_data)
|
|||
uint8 slot;
|
||||
recv_data >> slot;
|
||||
|
||||
DEBUG_LOG( "WORLD: Received CMSG_QUESTLOG_REMOVE_QUEST slot = %u",slot );
|
||||
DEBUG_LOG("WORLD: Received CMSG_QUESTLOG_REMOVE_QUEST slot = %u", slot);
|
||||
|
||||
if( slot < MAX_QUEST_LOG_SIZE )
|
||||
if (slot < MAX_QUEST_LOG_SIZE)
|
||||
{
|
||||
if(uint32 quest = _player->GetQuestSlotQuestId(slot))
|
||||
if (uint32 quest = _player->GetQuestSlotQuestId(slot))
|
||||
{
|
||||
if(!_player->TakeQuestSourceItem( quest, true ))
|
||||
if (!_player->TakeQuestSourceItem(quest, true))
|
||||
return; // can't un-equip some items, reject quest cancel
|
||||
|
||||
if (const Quest *pQuest = sObjectMgr.GetQuestTemplate(quest))
|
||||
if (const Quest* pQuest = sObjectMgr.GetQuestTemplate(quest))
|
||||
{
|
||||
if (pQuest->HasSpecialFlag(QUEST_SPECIAL_FLAG_TIMED))
|
||||
_player->RemoveTimedQuest(quest);
|
||||
|
||||
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
|
||||
{
|
||||
if (pQuest->ReqSourceId[i])
|
||||
{
|
||||
ItemPrototype const* iProto = ObjectMgr::GetItemPrototype(pQuest->ReqSourceId[i]);
|
||||
if (iProto && iProto->Bonding == BIND_QUEST_ITEM)
|
||||
_player->DestroyItemCount(pQuest->ReqSourceId[i], pQuest->ReqSourceCount[i], true, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_player->SetQuestStatus( quest, QUEST_STATUS_NONE);
|
||||
_player->SetQuestStatus(quest, QUEST_STATUS_NONE);
|
||||
}
|
||||
|
||||
_player->SetQuestSlot(slot, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue