Implement a PlayerScript class with a handful of new hooks:

* OnPVPKill
* OnCreatureKill
* OnPlayerKilledByCreature
* OnPlayerLevelChanged
* OnPlayerFreeTalentPointsChanged
* OnPlayerTalentsReset
* More hooks may be added in the future

--HG--
branch : trunk
This commit is contained in:
silinoron
2010-08-11 19:52:58 -07:00
parent bd1f9ceaf9
commit 0963cb3aea
6 changed files with 105 additions and 8 deletions
@@ -2655,6 +2655,8 @@ void Player::GiveLevel(uint8 level)
if (level == getLevel())
return;
sScriptMgr.OnPlayerLevelChanged(this, level);
PlayerLevelInfo info;
sObjectMgr.GetPlayerLevelInfo(getRace(),getClass(),level,&info);
@@ -3983,6 +3985,8 @@ uint32 Player::resetTalentsCost() const
bool Player::resetTalents(bool no_cost)
{
sScriptMgr.OnPlayerTalentsReset(this, no_cost);
// not need after this call
if (HasAtLoginFlag(AT_LOGIN_RESET_TALENTS))
RemoveAtLoginFlag(AT_LOGIN_RESET_TALENTS, true);
@@ -4070,6 +4074,12 @@ bool Player::resetTalents(bool no_cost)
return true;
}
void Player::SetFreeTalentPoints(uint32 points)
{
sScriptMgr.OnPlayerFreeTalentPointsChanged(this, points);
SetUInt32Value(PLAYER_CHARACTER_POINTS1,points);
}
Mail* Player::GetMail(uint32 id)
{
for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr)
+1 -1
View File
@@ -1559,7 +1559,7 @@ class Player : public Unit, public GridObject<Player>
uint32 GetReputation(uint32 factionentry);
std::string GetGuildName();
uint32 GetFreeTalentPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS1); }
void SetFreeTalentPoints(uint32 points) { SetUInt32Value(PLAYER_CHARACTER_POINTS1,points); }
void SetFreeTalentPoints(uint32 points);
bool resetTalents(bool no_cost = false);
uint32 resetTalentsCost() const;
void InitTalentForLevel();