Core/ScriptMgr: Add hooks for duel phases: OnDuelRequest, OnDuelStart, OnDuelEnd

--HG--
branch : trunk
This commit is contained in:
Shocker
2010-09-13 01:42:14 +03:00
parent 21182308b3
commit 4908187578
4 changed files with 33 additions and 0 deletions
@@ -7173,6 +7173,8 @@ void Player::DuelComplete(DuelCompleteType type)
SendMessageToSet(&data,true);
}
sScriptMgr.OnPlayerDuelEnd(duel->opponent, this, type);
switch (type)
{
case DUEL_FLED:
@@ -18476,6 +18478,8 @@ void Player::UpdateDuelFlag(time_t currTime)
if (!duel || duel->startTimer == 0 ||currTime < duel->startTimer + 3)
return;
sScriptMgr.OnPlayerDuelStart(this, duel->opponent);
SetUInt32Value(PLAYER_DUEL_TEAM, 1);
duel->opponent->SetUInt32Value(PLAYER_DUEL_TEAM, 2);
+15
View File
@@ -1116,6 +1116,21 @@ void ScriptMgr::OnPlayerReputationChange(Player *player, uint32 factionID, int32
FOREACH_SCRIPT(PlayerScript)->OnReputationChange(player, factionID, standing, incremental);
}
void ScriptMgr::OnPlayerDuelRequest(Player *target, Player *challenger)
{
FOREACH_SCRIPT(PlayerScript)->OnDuelRequest(target, challenger);
}
void ScriptMgr::OnPlayerDuelStart(Player *player1, Player *player2)
{
FOREACH_SCRIPT(PlayerScript)->OnDuelStart(player1, player2);
}
void ScriptMgr::OnPlayerDuelEnd(Player *winner, Player *looser, DuelCompleteType type)
{
FOREACH_SCRIPT(PlayerScript)->OnDuelEnd(winner, looser, type);
}
void ScriptMgr::OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string msg)
{
FOREACH_SCRIPT(PlayerScript)->OnChat(player, type, lang, msg);
+12
View File
@@ -674,6 +674,15 @@ class PlayerScript : public ScriptObject
// 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 duel is requested
virtual void OnDuelRequest(Player* /*target*/, Player* /*challenger*/) { }
// Called when a duel starts (after 3s countdown)
virtual void OnDuelStart(Player* /*player1*/, Player* /*player2*/) { }
// Called when a duel ends
virtual void OnDuelEnd(Player* /*winner*/, Player* /*looser*/, DuelCompleteType /*type*/) { }
// 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*/) { }
@@ -885,6 +894,9 @@ 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 OnPlayerDuelRequest(Player* target, Player* challenger);
void OnPlayerDuelStart(Player* player1, Player* player2);
void OnPlayerDuelEnd(Player* winner, Player* looser, DuelCompleteType type);
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);
+2
View File
@@ -5474,6 +5474,8 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
caster->SetUInt64Value(PLAYER_DUEL_ARBITER, pGameObj->GetGUID());
target->SetUInt64Value(PLAYER_DUEL_ARBITER, pGameObj->GetGUID());
sScriptMgr.OnPlayerDuelRequest(target, caster);
}
void Spell::EffectStuck(SpellEffIndex /*effIndex*/)