mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 17:27:36 +01:00
Core/Player: Added helpers to check quest objective status
(cherry picked from commit 9dd8647125)
This commit is contained in:
@@ -15895,6 +15895,19 @@ int32 Player::GetQuestSlotObjectiveData(uint16 slot, QuestObjective const& objec
|
||||
return uint8((GetQuestSlotState(slot) & objective.StorageIndex) != 0);
|
||||
}
|
||||
|
||||
int32 Player::GetQuestSlotObjectiveData(uint32 questId, uint32 objectiveId) const
|
||||
{
|
||||
uint16 slot = FindQuestSlot(questId);
|
||||
if (slot >= MAX_QUEST_LOG_SIZE)
|
||||
return 0;
|
||||
|
||||
QuestObjective const* obj = sObjectMgr->GetQuestObjective(objectiveId);
|
||||
if (!obj)
|
||||
return 0;
|
||||
|
||||
return GetQuestSlotObjectiveData(slot, *obj);
|
||||
}
|
||||
|
||||
void Player::SetQuestSlot(uint16 slot, uint32 quest_id)
|
||||
{
|
||||
auto questLogField = m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::QuestLog, slot);
|
||||
@@ -16466,6 +16479,23 @@ bool Player::IsQuestObjectiveComplete(uint16 slot, Quest const* quest, QuestObje
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Player::IsQuestObjectiveComplete(uint32 questId, uint32 objectiveId) const
|
||||
{
|
||||
Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
|
||||
if (!quest)
|
||||
return false;
|
||||
|
||||
uint16 slot = FindQuestSlot(questId);
|
||||
if (slot >= MAX_QUEST_LOG_SIZE)
|
||||
return false;
|
||||
|
||||
QuestObjective const* obj = sObjectMgr->GetQuestObjective(objectiveId);
|
||||
if (!obj)
|
||||
return false;
|
||||
|
||||
return IsQuestObjectiveComplete(slot, quest, *obj);
|
||||
}
|
||||
|
||||
bool Player::IsQuestObjectiveProgressBarComplete(uint16 slot, Quest const* quest) const
|
||||
{
|
||||
float progress = 0.0f;
|
||||
|
||||
@@ -1567,6 +1567,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
uint16 GetQuestSlotCounter(uint16 slot, uint8 counter) const;
|
||||
int64 GetQuestSlotEndTime(uint16 slot) const;
|
||||
int32 GetQuestSlotObjectiveData(uint16 slot, QuestObjective const& objective) const;
|
||||
int32 GetQuestSlotObjectiveData(uint32 questId, uint32 objectiveId) const;
|
||||
void SetQuestSlot(uint16 slot, uint32 quest_id);
|
||||
void SetQuestSlotCounter(uint16 slot, uint8 counter, uint16 count);
|
||||
void SetQuestSlotState(uint16 slot, uint32 state);
|
||||
@@ -1598,6 +1599,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
void SetQuestObjectiveData(QuestObjective const& objective, int32 data);
|
||||
bool IsQuestObjectiveCompletable(uint16 slot, Quest const* quest, QuestObjective const& objective) const;
|
||||
bool IsQuestObjectiveComplete(uint16 slot, Quest const* quest, QuestObjective const& objective) const;
|
||||
bool IsQuestObjectiveComplete(uint32 questId, uint32 objectiveId) const;
|
||||
bool IsQuestObjectiveProgressBarComplete(uint16 slot, Quest const* quest) const;
|
||||
void SendQuestComplete(uint32 questId) const;
|
||||
void SendQuestReward(Quest const* quest, Creature const* questGiver, uint32 xp, bool hideChatMessage) const;
|
||||
|
||||
Reference in New Issue
Block a user