mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-09 00:08:01 +00:00
Feat(Core/Scripting): Add new hook CanPlayerResurrect to simplify HardCore mod etc. (#21272)
This commit is contained in:
@@ -4491,6 +4491,9 @@ void Player::BuildPlayerRepop()
|
|||||||
|
|
||||||
void Player::ResurrectPlayer(float restore_percent, bool applySickness)
|
void Player::ResurrectPlayer(float restore_percent, bool applySickness)
|
||||||
{
|
{
|
||||||
|
if (!sScriptMgr->CanPlayerResurrect(this))
|
||||||
|
return;
|
||||||
|
|
||||||
WorldPacket data(SMSG_DEATH_RELEASE_LOC, 4 * 4); // remove spirit healer position
|
WorldPacket data(SMSG_DEATH_RELEASE_LOC, 4 * 4); // remove spirit healer position
|
||||||
data << uint32(-1);
|
data << uint32(-1);
|
||||||
data << float(0);
|
data << float(0);
|
||||||
|
|||||||
@@ -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));
|
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)
|
PlayerScript::PlayerScript(const char* name, std::vector<uint16> enabledHooks)
|
||||||
: ScriptObject(name, PLAYERHOOK_END)
|
: ScriptObject(name, PLAYERHOOK_END)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -204,6 +204,7 @@ enum PlayerHook
|
|||||||
PLAYERHOOK_CAN_SEND_ERROR_ALREADY_LOOTED,
|
PLAYERHOOK_CAN_SEND_ERROR_ALREADY_LOOTED,
|
||||||
PLAYERHOOK_ON_AFTER_CREATURE_LOOT,
|
PLAYERHOOK_ON_AFTER_CREATURE_LOOT,
|
||||||
PLAYERHOOK_ON_AFTER_CREATURE_LOOT_MONEY,
|
PLAYERHOOK_ON_AFTER_CREATURE_LOOT_MONEY,
|
||||||
|
PLAYERHOOK_CAN_RESURRECT,
|
||||||
PLAYERHOOK_END
|
PLAYERHOOK_END
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -765,6 +766,15 @@ public:
|
|||||||
* @param player Contains information about the Player
|
* @param player Contains information about the Player
|
||||||
*/
|
*/
|
||||||
virtual void OnAfterCreatureLootMoney(Player* /*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
|
#endif
|
||||||
|
|||||||
@@ -459,6 +459,7 @@ public: /* PlayerScript */
|
|||||||
void OnAfterCreatureLoot(Player* player);
|
void OnAfterCreatureLoot(Player* player);
|
||||||
void OnAfterCreatureLootMoney(Player* player);
|
void OnAfterCreatureLootMoney(Player* player);
|
||||||
bool OnCanPlayerFlyInZone(Player* player, uint32 mapId, uint32 zoneId, SpellInfo const* bySpell);
|
bool OnCanPlayerFlyInZone(Player* player, uint32 mapId, uint32 zoneId, SpellInfo const* bySpell);
|
||||||
|
bool CanPlayerResurrect(Player* player);
|
||||||
|
|
||||||
// Anti cheat
|
// Anti cheat
|
||||||
void AnticheatSetCanFlybyServer(Player* player, bool apply);
|
void AnticheatSetCanFlybyServer(Player* player, bool apply);
|
||||||
|
|||||||
Reference in New Issue
Block a user