mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 02:25:38 +01:00
Add PlayerScript hooks:
* OnMoneyChanged * OnGiveXP * OnReputationChange * OnChat * OnEmote * OnTextEmote --HG-- branch : trunk
This commit is contained in:
@@ -1097,6 +1097,36 @@ void ScriptMgr::OnPlayerTalentsReset(Player *player, bool no_cost)
|
||||
FOREACH_SCRIPT(PlayerScript)->OnTalentsReset(player, no_cost);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerMoneyChanged(Player *player, int32& amount)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnMoneyChanged(player, amount);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnGivePlayerXP(Player *player, uint32& amount, Unit *victim)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnGiveXP(player, amount, victim);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerReputationChange(Player *player, uint32 factionID, int32& standing, bool incremental)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnReputationChange(player, factionID, standing, incremental);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerChat(WorldSession *session, uint32 type, uint32 lang, std::string msg, std::string toOrChannel)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnChat(session, type, lang, msg, toOrChannel);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerEmote(WorldSession *session, uint32 emote)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnEmote(session, emote);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerTextEmote(WorldSession *session, uint32 text_emote, uint32 emoteNum, uint64 guid)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnTextEmote(session, text_emote, emoteNum, guid);
|
||||
}
|
||||
|
||||
SpellHandlerScript::SpellHandlerScript(const char* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
|
||||
@@ -677,6 +677,22 @@ public:
|
||||
|
||||
// Called when a player's talent points are reset (right before the reset is done)
|
||||
virtual void OnTalentsReset(Player *player, bool no_cost) { }
|
||||
|
||||
// Called when a player's money is modified (before the modification is done)
|
||||
virtual void OnMoneyChanged(Player *player, int32& amount) { }
|
||||
|
||||
// Called when a player gains XP (before anything is given)
|
||||
virtual void OnGiveXP(Player *player, uint32& amount, Unit *victim) { }
|
||||
|
||||
// Called when a player's reputation changes (before it is actually changed)
|
||||
virtual void OnReputationChange(Player *player, uint32 factionID, int32& standing, bool incremental) { }
|
||||
|
||||
// Called when a player sends a chat message. toOrChannel is empty when type is neither whisper nor channel
|
||||
virtual void OnChat(WorldSession *session, uint32 type, uint32 lang, std::string msg, std::string toOrChannel) { }
|
||||
|
||||
// Both of the below are called on emote opcodes
|
||||
virtual void OnEmote(WorldSession *session, uint32 emote) { }
|
||||
virtual void OnTextEmote(WorldSession *session, uint32 text_emote, uint32 emoteNum, uint64 guid) { }
|
||||
};
|
||||
|
||||
// Placed here due to ScriptRegistry::AddScript dependency.
|
||||
@@ -858,6 +874,12 @@ class ScriptMgr
|
||||
void OnPlayerLevelChanged(Player *player, uint8 newLevel);
|
||||
void OnPlayerFreeTalentPointsChanged(Player *player, uint32 newPoints);
|
||||
void OnPlayerTalentsReset(Player *player, bool no_cost);
|
||||
void OnPlayerMoneyChanged(Player *player, int32& amount);
|
||||
void OnGivePlayerXP(Player *player, uint32& amount, Unit *victim);
|
||||
void OnPlayerReputationChange(Player *player, uint32 factionID, int32& standing, bool incremental);
|
||||
void OnPlayerChat(WorldSession *session, uint32 type, uint32 lang, std::string msg, std::string toOrChannel);
|
||||
void OnPlayerEmote(WorldSession *session, uint32 emote);
|
||||
void OnPlayerTextEmote(WorldSession *session, uint32 text_emote, uint32 emoteNum, uint64 guid);
|
||||
|
||||
public: /* ScriptRegistry */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user