mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-26 03:42:37 +01:00
Core/Player: Added helpers to check quest objective status
This commit is contained in:
@@ -16420,6 +16420,19 @@ int32 Player::GetQuestSlotObjectiveData(uint16 slot, QuestObjective const& objec
|
||||
return GetQuestSlotObjectiveFlag(slot, objective.StorageIndex) ? 1 : 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);
|
||||
@@ -17006,6 +17019,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;
|
||||
|
||||
@@ -1611,6 +1611,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
int64 GetQuestSlotEndTime(uint16 slot) const;
|
||||
bool GetQuestSlotObjectiveFlag(uint16 slot, int8 objectiveIndex) 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);
|
||||
@@ -1644,6 +1645,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