mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
feat(PlayerHooks): Add tweaks for OnPlayerQuestAccept (#282)
This commit is contained in:
@@ -69,6 +69,7 @@ public:
|
||||
|
||||
bool CanCreatureQuestAccept(Player* player, Creature* creature, Quest const* quest) override
|
||||
{
|
||||
sEluna->OnPlayerQuestAccept(player, quest);
|
||||
sEluna->OnQuestAccept(player, creature, quest);
|
||||
return false;
|
||||
}
|
||||
@@ -146,6 +147,7 @@ public:
|
||||
|
||||
bool CanGameObjectQuestAccept(Player* player, GameObject* go, Quest const* quest) override
|
||||
{
|
||||
sEluna->OnPlayerQuestAccept(player, quest);
|
||||
sEluna->OnQuestAccept(player, go, quest);
|
||||
return false;
|
||||
}
|
||||
@@ -169,7 +171,10 @@ public:
|
||||
bool CanGameObjectQuestReward(Player* player, GameObject* go, Quest const* quest, uint32 opt) override
|
||||
{
|
||||
if (sEluna->OnQuestAccept(player, go, quest))
|
||||
{
|
||||
sEluna->OnPlayerQuestAccept(player, quest);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sEluna->OnQuestReward(player, go, quest, opt))
|
||||
return false;
|
||||
@@ -192,7 +197,10 @@ public:
|
||||
bool CanItemQuestAccept(Player* player, Item* item, Quest const* quest) override
|
||||
{
|
||||
if (sEluna->OnQuestAccept(player, item, quest))
|
||||
{
|
||||
sEluna->OnPlayerQuestAccept(player, quest);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -226,6 +226,7 @@ namespace Hooks
|
||||
PLAYER_EVENT_ON_CAN_UPDATE_SKILL = 60, // (event, player, skill_id) -- Can return true or false
|
||||
PLAYER_EVENT_ON_BEFORE_UPDATE_SKILL = 61, // (event, player, skill_id, value, max, step) -- Can return new amount
|
||||
PLAYER_EVENT_ON_UPDATE_SKILL = 62, // (event, player, skill_id, value, max, step, new_value)
|
||||
PLAYER_EVENT_ON_QUEST_ACCEPT = 63, // (event, player, quest)
|
||||
|
||||
PLAYER_EVENT_COUNT
|
||||
};
|
||||
|
||||
@@ -491,6 +491,7 @@ public:
|
||||
void OnPlayerBeforeUpdateSkill(Player* player, uint32 skill_id, uint32& value, uint32 max, uint32 step);
|
||||
void OnPlayerUpdateSkill(Player* player, uint32 skill_id, uint32 value, uint32 max, uint32 step, uint32 new_value);
|
||||
bool CanPlayerResurrect(Player* player);
|
||||
void OnPlayerQuestAccept(Player* player, Quest const* quest);
|
||||
|
||||
/* Vehicle */
|
||||
void OnInstall(Vehicle* vehicle);
|
||||
|
||||
@@ -754,10 +754,17 @@ void Eluna::OnPlayerUpdateSkill(Player* player, uint32 skill_id, uint32 value, u
|
||||
CallAllFunctions(PlayerEventBindings, key);
|
||||
}
|
||||
|
||||
|
||||
bool Eluna::CanPlayerResurrect(Player* player)
|
||||
{
|
||||
START_HOOK_WITH_RETVAL(PLAYER_EVENT_ON_CAN_RESURRECT, true);
|
||||
Push(player);
|
||||
return CallAllFunctionsBool(PlayerEventBindings, key);
|
||||
}
|
||||
|
||||
void Eluna::OnPlayerQuestAccept(Player* player, Quest const* quest)
|
||||
{
|
||||
START_HOOK(PLAYER_EVENT_ON_QUEST_ACCEPT);
|
||||
Push(player);
|
||||
Push(quest);
|
||||
CallAllFunctions(PlayerEventBindings, key);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user