mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
feat(Core/Hooks): Added new hook for pvp flag state (#8336)
This commit is contained in:
6
doc/changelog/pendings/changes_1633634641262326500.md
Normal file
6
doc/changelog/pendings/changes_1633634641262326500.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added `OnPlayerPVPFlagChange` hook, it will be executed after the pvp flag from a player gets changed.
|
||||||
|
|
||||||
|
|
||||||
@@ -1475,6 +1475,7 @@ void Player::UpdatePvP(bool state, bool _override)
|
|||||||
}
|
}
|
||||||
|
|
||||||
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_PVP_TIMER);
|
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_PVP_TIMER);
|
||||||
|
sScriptMgr->OnPlayerPVPFlagChange(this, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::UpdatePotionCooldown(Spell* spell)
|
void Player::UpdatePotionCooldown(Spell* spell)
|
||||||
|
|||||||
@@ -1366,6 +1366,11 @@ void ScriptMgr::OnPVPKill(Player* killer, Player* killed)
|
|||||||
FOREACH_SCRIPT(PlayerScript)->OnPVPKill(killer, killed);
|
FOREACH_SCRIPT(PlayerScript)->OnPVPKill(killer, killed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScriptMgr::OnPlayerPVPFlagChange(Player* player, bool state)
|
||||||
|
{
|
||||||
|
FOREACH_SCRIPT(PlayerScript)->OnPlayerPVPFlagChange(player, state);
|
||||||
|
}
|
||||||
|
|
||||||
void ScriptMgr::OnCreatureKill(Player* killer, Creature* killed)
|
void ScriptMgr::OnCreatureKill(Player* killer, Creature* killed)
|
||||||
{
|
{
|
||||||
#ifdef ELUNA
|
#ifdef ELUNA
|
||||||
|
|||||||
@@ -729,6 +729,9 @@ public:
|
|||||||
// Called when a player kills another player
|
// Called when a player kills another player
|
||||||
virtual void OnPVPKill(Player* /*killer*/, Player* /*killed*/) { }
|
virtual void OnPVPKill(Player* /*killer*/, Player* /*killed*/) { }
|
||||||
|
|
||||||
|
// Called when a player toggles pvp
|
||||||
|
virtual void OnPlayerPVPFlagChange(Player* /*player*/, bool /*state*/) { }
|
||||||
|
|
||||||
// Called when a player kills a creature
|
// Called when a player kills a creature
|
||||||
virtual void OnCreatureKill(Player* /*killer*/, Creature* /*killed*/) { }
|
virtual void OnCreatureKill(Player* /*killer*/, Creature* /*killed*/) { }
|
||||||
|
|
||||||
@@ -1612,6 +1615,7 @@ public: /* PlayerScript */
|
|||||||
void OnSendInitialPacketsBeforeAddToMap(Player* player, WorldPacket& data);
|
void OnSendInitialPacketsBeforeAddToMap(Player* player, WorldPacket& data);
|
||||||
void OnPlayerReleasedGhost(Player* player);
|
void OnPlayerReleasedGhost(Player* player);
|
||||||
void OnPVPKill(Player* killer, Player* killed);
|
void OnPVPKill(Player* killer, Player* killed);
|
||||||
|
void OnPlayerPVPFlagChange(Player* player, bool state);
|
||||||
void OnCreatureKill(Player* killer, Creature* killed);
|
void OnCreatureKill(Player* killer, Creature* killed);
|
||||||
void OnCreatureKilledByPet(Player* petOwner, Creature* killed);
|
void OnCreatureKilledByPet(Player* petOwner, Creature* killed);
|
||||||
void OnPlayerKilledByCreature(Creature* killer, Player* killed);
|
void OnPlayerKilledByCreature(Creature* killer, Player* killed);
|
||||||
|
|||||||
Reference in New Issue
Block a user