Feat(LuaEngine/PlayerHooks): Add OnCanPlayerResurrect (#236)

This commit is contained in:
iThorgrim
2025-02-08 07:33:43 +01:00
committed by GitHub
parent ccfcc5f86f
commit 7511f38eab
5 changed files with 17 additions and 0 deletions

View File

@@ -812,6 +812,11 @@ public:
{
sEluna->OnCreatureKilledByPet(player, killed);
}
bool CanPlayerResurrect(Player* player) override
{
return sEluna->CanPlayerResurrect(player);
}
};
class Eluna_ServerScript : public ServerScript

View File

@@ -221,6 +221,7 @@ namespace Hooks
PLAYER_EVENT_ON_GROUP_ROLL_REWARD_ITEM = 56, // (event, player, item, count, voteType, roll)
PLAYER_EVENT_ON_BG_DESERTION = 57, // (event, player, type)
PLAYER_EVENT_ON_PET_KILL = 58, // (event, player, killer)
PLAYER_EVENT_ON_CAN_RESURRECT = 59, // (event, player)
PLAYER_EVENT_COUNT
};

View File

@@ -451,6 +451,7 @@ public:
void OnGroupRollRewardItem(Player* player, Item* item, uint32 count, RollVote voteType, Roll* roll);
void OnBattlegroundDesertion(Player* player, const BattlegroundDesertionType type);
void OnCreatureKilledByPet(Player* player, Creature* killed);
bool CanPlayerResurrect(Player* player);
/* Vehicle */
void OnInstall(Vehicle* vehicle);

View File

@@ -706,3 +706,11 @@ void Eluna::OnCreatureKilledByPet(Player* player, Creature* killed)
Push(killed);
CallAllFunctions(PlayerEventBindings, key);
}
bool Eluna::CanPlayerResurrect(Player* player)
{
START_HOOK_WITH_RETVAL(PLAYER_EVENT_ON_CAN_RESURRECT, true);
Push(player);
return CallAllFunctionsBool(PlayerEventBindings, key);
}

View File

@@ -716,6 +716,8 @@ namespace LuaGlobalFunctions
* PLAYER_EVENT_ON_CAN_GROUP_INVITE = 55, // (event, player, memberName) - Can return false to prevent inviting
* PLAYER_EVENT_ON_GROUP_ROLL_REWARD_ITEM = 56, // (event, player, item, count, voteType, roll)
* PLAYER_EVENT_ON_BG_DESERTION = 57, // (event, player, type)
* PLAYER_EVENT_ON_PET_KILL = 58, // (event, player, killer)
* PLAYER_EVENT_ON_CAN_RESURRECT = 59, // (event, player)
* };
* </pre>
*