mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 03:15:41 +00:00
Refactored quest_template table structure
This commit is contained in:
committed by
Francesco Borzì
parent
4255b986d6
commit
468faa3ead
@@ -15635,15 +15635,15 @@ void Player::AddQuest(Quest const* quest, Object* questGiver)
|
||||
uint32 qtime = 0;
|
||||
if (quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_TIMED))
|
||||
{
|
||||
uint32 limittime = quest->GetLimitTime();
|
||||
uint32 timeAllowed = quest->GetTimeAllowed();
|
||||
|
||||
// shared timed quest
|
||||
if (questGiver && questGiver->GetTypeId() == TYPEID_PLAYER)
|
||||
limittime = questGiver->ToPlayer()->getQuestStatusMap()[quest_id].Timer / IN_MILLISECONDS;
|
||||
timeAllowed = questGiver->ToPlayer()->getQuestStatusMap()[quest_id].Timer / IN_MILLISECONDS;
|
||||
|
||||
AddTimedQuest(quest_id);
|
||||
questStatusData.Timer = limittime * IN_MILLISECONDS;
|
||||
qtime = static_cast<uint32>(time(NULL)) + limittime;
|
||||
questStatusData.Timer = timeAllowed * IN_MILLISECONDS;
|
||||
qtime = static_cast<uint32>(time(NULL)) + timeAllowed;
|
||||
}
|
||||
else
|
||||
questStatusData.Timer = 0;
|
||||
@@ -15723,10 +15723,10 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
|
||||
|
||||
for (uint8 i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
|
||||
{
|
||||
if (quest->RequiredSourceItemId[i])
|
||||
if (quest->ItemDrop[i])
|
||||
{
|
||||
uint32 count = quest->RequiredSourceItemCount[i];
|
||||
DestroyItemCount(quest->RequiredSourceItemId[i], count ? count : 9999, true);
|
||||
uint32 count = quest->ItemDropQuantity[i];
|
||||
DestroyItemCount(quest->ItemDrop[i], count ? count : 9999, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15962,9 +15962,9 @@ void Player::FailQuest(uint32 questId)
|
||||
// Destroy items received on starting the quest.
|
||||
DestroyItemCount(quest->RequiredItemId[i], quest->RequiredItemCount[i], true, true);
|
||||
for (uint8 i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
|
||||
if (quest->RequiredSourceItemId[i] > 0 && quest->RequiredSourceItemCount[i] > 0)
|
||||
if (quest->ItemDrop[i] > 0 && quest->ItemDropQuantity[i] > 0)
|
||||
// Destroy items received during the quest.
|
||||
DestroyItemCount(quest->RequiredSourceItemId[i], quest->RequiredSourceItemCount[i], true, true);
|
||||
DestroyItemCount(quest->ItemDrop[i], quest->ItemDropQuantity[i], true, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16128,7 +16128,7 @@ bool Player::SatisfyQuestClass(Quest const* qInfo, bool msg) const
|
||||
|
||||
bool Player::SatisfyQuestRace(Quest const* qInfo, bool msg) const
|
||||
{
|
||||
uint32 reqraces = qInfo->GetRequiredRaces();
|
||||
uint32 reqraces = qInfo->GetAllowableRaces();
|
||||
if (reqraces == 0)
|
||||
return true;
|
||||
if ((reqraces & getRaceMask()) == 0)
|
||||
@@ -17228,7 +17228,7 @@ bool Player::HasQuestForItem(uint32 itemid) const
|
||||
for (uint8 j = 0; j < QUEST_SOURCE_ITEM_IDS_COUNT; ++j)
|
||||
{
|
||||
// examined item is a source item
|
||||
if (qinfo->RequiredSourceItemId[j] == itemid)
|
||||
if (qinfo->ItemDrop[j] == itemid)
|
||||
{
|
||||
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(itemid);
|
||||
|
||||
@@ -17237,9 +17237,9 @@ bool Player::HasQuestForItem(uint32 itemid) const
|
||||
return true;
|
||||
|
||||
// allows custom amount drop when not 0
|
||||
if (qinfo->RequiredSourceItemCount[j])
|
||||
if (qinfo->ItemDropQuantity[j])
|
||||
{
|
||||
if (GetItemCount(itemid, true) < qinfo->RequiredSourceItemCount[j])
|
||||
if (GetItemCount(itemid, true) < qinfo->ItemDropQuantity[j])
|
||||
return true;
|
||||
} else if (GetItemCount(itemid, true) < pProto->GetMaxStackSize())
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user