feat(Core): OnBeforeLootMoney hook (#13030)
This commit is contained in:
@@ -168,6 +168,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/)
|
|||||||
|
|
||||||
if (loot)
|
if (loot)
|
||||||
{
|
{
|
||||||
|
sScriptMgr->OnBeforeLootMoney(player, loot);
|
||||||
loot->NotifyMoneyRemoved();
|
loot->NotifyMoneyRemoved();
|
||||||
if (shareMoney && player->GetGroup()) //item, pickpocket and players can be looted only single player
|
if (shareMoney && player->GetGroup()) //item, pickpocket and players can be looted only single player
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -146,6 +146,14 @@ void ScriptMgr::OnPlayerMoneyChanged(Player* player, int32& amount)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScriptMgr::OnBeforeLootMoney(Player* player, Loot* loot)
|
||||||
|
{
|
||||||
|
ExecuteScript<PlayerScript>([&](PlayerScript* script)
|
||||||
|
{
|
||||||
|
script->OnBeforeLootMoney(player, loot);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void ScriptMgr::OnGivePlayerXP(Player* player, uint32& amount, Unit* victim)
|
void ScriptMgr::OnGivePlayerXP(Player* player, uint32& amount, Unit* victim)
|
||||||
{
|
{
|
||||||
ExecuteScript<PlayerScript>([&](PlayerScript* script)
|
ExecuteScript<PlayerScript>([&](PlayerScript* script)
|
||||||
|
|||||||
@@ -1021,6 +1021,9 @@ public:
|
|||||||
// Called when a player's money is modified (before the modification is done)
|
// Called when a player's money is modified (before the modification is done)
|
||||||
virtual void OnMoneyChanged(Player* /*player*/, int32& /*amount*/) { }
|
virtual void OnMoneyChanged(Player* /*player*/, int32& /*amount*/) { }
|
||||||
|
|
||||||
|
// Called before looted money is added to a player
|
||||||
|
virtual void OnBeforeLootMoney(Player* /*player*/, Loot* /*loot*/) {}
|
||||||
|
|
||||||
// Called when a player gains XP (before anything is given)
|
// Called when a player gains XP (before anything is given)
|
||||||
virtual void OnGiveXP(Player* /*player*/, uint32& /*amount*/, Unit* /*victim*/) { }
|
virtual void OnGiveXP(Player* /*player*/, uint32& /*amount*/, Unit* /*victim*/) { }
|
||||||
|
|
||||||
@@ -2208,6 +2211,7 @@ public: /* PlayerScript */
|
|||||||
void OnPlayerFreeTalentPointsChanged(Player* player, uint32 newPoints);
|
void OnPlayerFreeTalentPointsChanged(Player* player, uint32 newPoints);
|
||||||
void OnPlayerTalentsReset(Player* player, bool noCost);
|
void OnPlayerTalentsReset(Player* player, bool noCost);
|
||||||
void OnPlayerMoneyChanged(Player* player, int32& amount);
|
void OnPlayerMoneyChanged(Player* player, int32& amount);
|
||||||
|
void OnBeforeLootMoney(Player* player, Loot* loot);
|
||||||
void OnGivePlayerXP(Player* player, uint32& amount, Unit* victim);
|
void OnGivePlayerXP(Player* player, uint32& amount, Unit* victim);
|
||||||
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