Feat(Core/Scripting): Add new hook CanPlayerResurrect to simplify HardCore mod etc. (#21272)
This commit is contained in:
parent
6753b44b16
commit
c53112d820
4 changed files with 19 additions and 0 deletions
|
|
@ -895,6 +895,11 @@ bool ScriptMgr::AnticheatCheckMovementInfo(Player* player, MovementInfo const& m
|
|||
CALL_ENABLED_BOOLEAN_HOOKS(PlayerScript, PLAYERHOOK_ANTICHEAT_CHECK_MOVEMENT_INFO, !script->AnticheatCheckMovementInfo(player, movementInfo, mover, jump));
|
||||
}
|
||||
|
||||
bool ScriptMgr::CanPlayerResurrect(Player* player)
|
||||
{
|
||||
CALL_ENABLED_BOOLEAN_HOOKS(PlayerScript, PLAYERHOOK_CAN_RESURRECT, !script->CanPlayerResurrect(player));
|
||||
}
|
||||
|
||||
PlayerScript::PlayerScript(const char* name, std::vector<uint16> enabledHooks)
|
||||
: ScriptObject(name, PLAYERHOOK_END)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -204,6 +204,7 @@ enum PlayerHook
|
|||
PLAYERHOOK_CAN_SEND_ERROR_ALREADY_LOOTED,
|
||||
PLAYERHOOK_ON_AFTER_CREATURE_LOOT,
|
||||
PLAYERHOOK_ON_AFTER_CREATURE_LOOT_MONEY,
|
||||
PLAYERHOOK_CAN_RESURRECT,
|
||||
PLAYERHOOK_END
|
||||
};
|
||||
|
||||
|
|
@ -765,6 +766,15 @@ public:
|
|||
* @param player Contains information about the Player
|
||||
*/
|
||||
virtual void OnAfterCreatureLootMoney(Player* /*player*/) { }
|
||||
|
||||
/**
|
||||
* @brief This hook is called, to avoid player resurrect
|
||||
*
|
||||
* @param player Contains information about the Player
|
||||
*
|
||||
* @return true if player is authorized to resurect
|
||||
*/
|
||||
virtual bool CanPlayerResurrect(Player* /*player*/) { return true; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue