mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 09:17:18 +00:00
fix(Core/QuestTracker): do not store quest if quest_id is null (#4027)
This commit is contained in:
@@ -15876,7 +15876,7 @@ void Player::AddQuest(Quest const* quest, Object* questGiver)
|
||||
if (sWorld->getBoolConfig(CONFIG_QUEST_ENABLE_QUEST_TRACKER))
|
||||
{
|
||||
// prepare Quest Tracker datas
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_QUEST_TRACK);
|
||||
auto stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_QUEST_TRACK);
|
||||
stmt->setUInt32(0, quest_id);
|
||||
stmt->setUInt32(1, GetGUIDLow());
|
||||
stmt->setString(2, _HASH);
|
||||
@@ -15893,31 +15893,35 @@ void Player::AddQuest(Quest const* quest, Object* questGiver)
|
||||
|
||||
void Player::CompleteQuest(uint32 quest_id)
|
||||
{
|
||||
if (quest_id)
|
||||
if (!quest_id)
|
||||
{
|
||||
SetQuestStatus(quest_id, QUEST_STATUS_COMPLETE);
|
||||
|
||||
uint16 log_slot = FindQuestSlot(quest_id);
|
||||
if (log_slot < MAX_QUEST_LOG_SIZE)
|
||||
SetQuestSlotState(log_slot, QUEST_STATE_COMPLETE);
|
||||
|
||||
Quest const* qInfo = sObjectMgr->GetQuestTemplate(quest_id);
|
||||
if (qInfo && qInfo->HasFlag(QUEST_FLAGS_TRACKING))
|
||||
{
|
||||
RewardQuest(qInfo, 0, this, false);
|
||||
}
|
||||
|
||||
// Xinef: area auras may change on quest completion!
|
||||
UpdateZoneDependentAuras(GetZoneId());
|
||||
UpdateAreaDependentAuras(GetAreaId());
|
||||
AdditionalSavingAddMask(ADDITIONAL_SAVING_INVENTORY_AND_GOLD | ADDITIONAL_SAVING_QUEST_STATUS);
|
||||
return;
|
||||
}
|
||||
|
||||
SetQuestStatus(quest_id, QUEST_STATUS_COMPLETE);
|
||||
|
||||
auto log_slot = FindQuestSlot(quest_id);
|
||||
if (log_slot < MAX_QUEST_LOG_SIZE)
|
||||
{
|
||||
SetQuestSlotState(log_slot, QUEST_STATE_COMPLETE);
|
||||
}
|
||||
|
||||
Quest const* qInfo = sObjectMgr->GetQuestTemplate(quest_id);
|
||||
if (qInfo && qInfo->HasFlag(QUEST_FLAGS_TRACKING))
|
||||
{
|
||||
RewardQuest(qInfo, 0, this, false);
|
||||
}
|
||||
|
||||
// Xinef: area auras may change on quest completion!
|
||||
UpdateZoneDependentAuras(GetZoneId());
|
||||
UpdateAreaDependentAuras(GetAreaId());
|
||||
AdditionalSavingAddMask(ADDITIONAL_SAVING_INVENTORY_AND_GOLD | ADDITIONAL_SAVING_QUEST_STATUS);
|
||||
|
||||
// check if Quest Tracker is enabled
|
||||
if (sWorld->getBoolConfig(CONFIG_QUEST_ENABLE_QUEST_TRACKER))
|
||||
{
|
||||
// prepare Quest Tracker datas
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_QUEST_TRACK_COMPLETE_TIME);
|
||||
auto stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_QUEST_TRACK_COMPLETE_TIME);
|
||||
stmt->setUInt32(0, quest_id);
|
||||
stmt->setUInt32(1, GetGUIDLow());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user