Core/ScriptSystem: Refactor ScriptMgr::OnPlayerChat to no longer accept a C-style parameter of type void*.

Instead, use overloaded methods for the different types.

--HG--
branch : trunk
This commit is contained in:
silinoron
2010-09-04 12:49:39 -07:00
parent 0f9fe8dbeb
commit 0f997162ee
3 changed files with 112 additions and 87 deletions

View File

@@ -675,15 +675,12 @@ public:
// 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. param depends on the chat type:
// CHAT_MSG_WHISPER - Player*: receiver;
// CHAT_MSG_PARTY, CHAT_MSG_PARTY_LEADER - Group*: group of player;
// CHAT_MSG_OFFICER, CHAT_MSG_GUILD - Guild*: guild of player;
// CHAT_MSG_RAID, CHAT_MSG_RAID_LEADER, CHAT_MSG_RAID_WARNING - Group*: group of player;
// CHAT_MSG_BATTLEGROUND, CHAT_MSG_BATTLEGROUND_LEADER - Group*: group of player;
// CHAT_MSG_CHANNEL - Channel*: channel player speaks to;
// other - NULL.
virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string /*msg*/, void* /*param*/ = NULL) { }
// The following methods are called when a player sends a chat message
virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string /*msg*/) { }
virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string /*msg*/, Player* /*receiver*/) { }
virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string /*msg*/, Group* /*group*/) { }
virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string /*msg*/, Guild* /*guild*/) { }
virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string /*msg*/, Channel* /*channel*/) { }
// Both of the below are called on emote opcodes
virtual void OnEmote(Player* /*player*/, uint32 /*emote*/) { }
@@ -887,7 +884,11 @@ class ScriptMgr
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(Player* player, uint32 type, uint32 lang, std::string msg, void* param = NULL);
void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string msg);
void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string msg, Player* receiver);
void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string msg, Group* group);
void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string msg, Guild* guild);
void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string msg, Channel* channel);
void OnPlayerEmote(Player* player, uint32 emote);
void OnPlayerTextEmote(Player* player, uint32 text_emote, uint32 emoteNum, uint64 guid);
void OnPlayerSpellCast(Player *player, Spell *spell, bool skipCheck);