mirror of
https://gitcode.com/GitHub_Trending/az/azerothcore-wotlk.git
synced 2026-07-11 03:13:10 +00:00
feat(Core/Loot): add OnPlayerBeforeSendLoot hook to PlayerScript (#26364)
This commit is contained in:
@@ -8195,6 +8195,8 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
|
|||||||
{
|
{
|
||||||
SetLootGUID(guid);
|
SetLootGUID(guid);
|
||||||
|
|
||||||
|
sScriptMgr->OnPlayerBeforeSendLoot(this, guid, loot);
|
||||||
|
|
||||||
WorldPacket data(SMSG_LOOT_RESPONSE, (9 + 50)); // we guess size
|
WorldPacket data(SMSG_LOOT_RESPONSE, (9 + 50)); // we guess size
|
||||||
data << guid;
|
data << guid;
|
||||||
data << uint8(loot_type);
|
data << uint8(loot_type);
|
||||||
|
|||||||
@@ -132,6 +132,11 @@ void ScriptMgr::OnPlayerBeforeLootMoney(Player* player, Loot* loot)
|
|||||||
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_BEFORE_LOOT_MONEY, script->OnPlayerBeforeLootMoney(player, loot));
|
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_BEFORE_LOOT_MONEY, script->OnPlayerBeforeLootMoney(player, loot));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScriptMgr::OnPlayerBeforeSendLoot(Player* player, ObjectGuid lootGuid, Loot* loot)
|
||||||
|
{
|
||||||
|
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_BEFORE_SEND_LOOT, script->OnPlayerBeforeSendLoot(player, lootGuid, loot));
|
||||||
|
}
|
||||||
|
|
||||||
void ScriptMgr::OnPlayerGiveXP(Player* player, uint32& amount, Unit* victim, uint8 xpSource)
|
void ScriptMgr::OnPlayerGiveXP(Player* player, uint32& amount, Unit* victim, uint8 xpSource)
|
||||||
{
|
{
|
||||||
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_GIVE_EXP, script->OnPlayerGiveXP(player, amount, victim, xpSource));
|
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_GIVE_EXP, script->OnPlayerGiveXP(player, amount, victim, xpSource));
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ enum PlayerHook
|
|||||||
PLAYERHOOK_ON_UPDATE,
|
PLAYERHOOK_ON_UPDATE,
|
||||||
PLAYERHOOK_ON_MONEY_CHANGED,
|
PLAYERHOOK_ON_MONEY_CHANGED,
|
||||||
PLAYERHOOK_ON_BEFORE_LOOT_MONEY,
|
PLAYERHOOK_ON_BEFORE_LOOT_MONEY,
|
||||||
|
PLAYERHOOK_ON_BEFORE_SEND_LOOT,
|
||||||
PLAYERHOOK_ON_GIVE_EXP,
|
PLAYERHOOK_ON_GIVE_EXP,
|
||||||
PLAYERHOOK_ON_REPUTATION_CHANGE,
|
PLAYERHOOK_ON_REPUTATION_CHANGE,
|
||||||
PLAYERHOOK_ON_REPUTATION_RANK_CHANGE,
|
PLAYERHOOK_ON_REPUTATION_RANK_CHANGE,
|
||||||
@@ -281,6 +282,9 @@ public:
|
|||||||
// Called before looted money is added to a player
|
// Called before looted money is added to a player
|
||||||
virtual void OnPlayerBeforeLootMoney(Player* /*player*/, Loot* /*loot*/) {}
|
virtual void OnPlayerBeforeLootMoney(Player* /*player*/, Loot* /*loot*/) {}
|
||||||
|
|
||||||
|
// Called before loot is sent to a player
|
||||||
|
virtual void OnPlayerBeforeSendLoot(Player* /*player*/, ObjectGuid /*lootGuid*/, Loot* /*loot*/) { }
|
||||||
|
|
||||||
// Called when a player gains XP (before anything is given)
|
// Called when a player gains XP (before anything is given)
|
||||||
virtual void OnPlayerGiveXP(Player* /*player*/, uint32& /*amount*/, Unit* /*victim*/, uint8 /*xpSource*/) { }
|
virtual void OnPlayerGiveXP(Player* /*player*/, uint32& /*amount*/, Unit* /*victim*/, uint8 /*xpSource*/) { }
|
||||||
|
|
||||||
|
|||||||
@@ -312,6 +312,7 @@ public: /* PlayerScript */
|
|||||||
void OnPlayerAfterSpecSlotChanged(Player* player, uint8 newSlot);
|
void OnPlayerAfterSpecSlotChanged(Player* player, uint8 newSlot);
|
||||||
void OnPlayerMoneyChanged(Player* player, int32& amount);
|
void OnPlayerMoneyChanged(Player* player, int32& amount);
|
||||||
void OnPlayerBeforeLootMoney(Player* player, Loot* loot);
|
void OnPlayerBeforeLootMoney(Player* player, Loot* loot);
|
||||||
|
void OnPlayerBeforeSendLoot(Player* player, ObjectGuid lootGuid, Loot* loot);
|
||||||
void OnPlayerGiveXP(Player* player, uint32& amount, Unit* victim, uint8 xpSource);
|
void OnPlayerGiveXP(Player* player, uint32& amount, Unit* victim, uint8 xpSource);
|
||||||
bool OnPlayerReputationChange(Player* player, uint32 factionID, int32& standing, bool incremental);
|
bool OnPlayerReputationChange(Player* player, uint32 factionID, int32& standing, bool incremental);
|
||||||
void OnPlayerReputationRankChange(Player* player, uint32 factionID, ReputationRank newRank, ReputationRank oldRank, bool increased);
|
void OnPlayerReputationRankChange(Player* player, uint32 factionID, ReputationRank newRank, ReputationRank oldRank, bool increased);
|
||||||
|
|||||||
Reference in New Issue
Block a user