feat(Core/Scripting): Add Player SetSkill hook (#25599)
This commit is contained in:
@@ -5375,6 +5375,7 @@ void Player::SetSkill(uint16 id, uint16 step, uint16 newVal, uint16 maxVal)
|
|||||||
RemoveAurasDueToSpell(pAbility->Spell);
|
RemoveAurasDueToSpell(pAbility->Spell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sScriptMgr->OnPlayerSetSkill(this, id, currVal, maxVal, step, newVal);
|
||||||
}
|
}
|
||||||
else if (newVal) //add
|
else if (newVal) //add
|
||||||
{
|
{
|
||||||
@@ -5421,6 +5422,7 @@ void Player::SetSkill(uint16 id, uint16 step, uint16 newVal, uint16 maxVal)
|
|||||||
learnSkillRewardedSpells(id, newVal);
|
learnSkillRewardedSpells(id, newVal);
|
||||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL, id);
|
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL, id);
|
||||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL, id);
|
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL, id);
|
||||||
|
sScriptMgr->OnPlayerSetSkill(this, id, currVal, maxVal, step, newVal);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -908,6 +908,11 @@ void ScriptMgr::OnPlayerUpdateSkill(Player* player, uint32 skillId, uint32 value
|
|||||||
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_UPDATE_SKILL, script->OnPlayerUpdateSkill(player, skillId, value, max, step, newValue));
|
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_UPDATE_SKILL, script->OnPlayerUpdateSkill(player, skillId, value, max, step, newValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScriptMgr::OnPlayerSetSkill(Player* player, uint32 skillId, uint32 value, uint32 max, uint32 step, uint32 newValue)
|
||||||
|
{
|
||||||
|
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_SET_SKILL, script->OnPlayerSetSkill(player, skillId, value, max, step, newValue));
|
||||||
|
}
|
||||||
|
|
||||||
bool ScriptMgr::OnPlayerCanResurrect(Player* player)
|
bool ScriptMgr::OnPlayerCanResurrect(Player* player)
|
||||||
{
|
{
|
||||||
CALL_ENABLED_BOOLEAN_HOOKS(PlayerScript, PLAYERHOOK_CAN_RESURRECT, !script->OnPlayerCanResurrect(player));
|
CALL_ENABLED_BOOLEAN_HOOKS(PlayerScript, PLAYERHOOK_CAN_RESURRECT, !script->OnPlayerCanResurrect(player));
|
||||||
|
|||||||
@@ -206,6 +206,7 @@ enum PlayerHook
|
|||||||
PLAYERHOOK_ON_CAN_UPDATE_SKILL,
|
PLAYERHOOK_ON_CAN_UPDATE_SKILL,
|
||||||
PLAYERHOOK_ON_BEFORE_UPDATE_SKILL,
|
PLAYERHOOK_ON_BEFORE_UPDATE_SKILL,
|
||||||
PLAYERHOOK_ON_UPDATE_SKILL,
|
PLAYERHOOK_ON_UPDATE_SKILL,
|
||||||
|
PLAYERHOOK_ON_SET_SKILL,
|
||||||
PLAYERHOOK_CAN_RESURRECT,
|
PLAYERHOOK_CAN_RESURRECT,
|
||||||
PLAYERHOOK_ON_CAN_GIVE_LEVEL,
|
PLAYERHOOK_ON_CAN_GIVE_LEVEL,
|
||||||
PLAYERHOOK_ON_SEND_LIST_INVENTORY,
|
PLAYERHOOK_ON_SEND_LIST_INVENTORY,
|
||||||
@@ -785,6 +786,7 @@ public:
|
|||||||
virtual bool OnPlayerCanUpdateSkill(Player* /*player*/, uint32 /*skillId*/) { return true; }
|
virtual bool OnPlayerCanUpdateSkill(Player* /*player*/, uint32 /*skillId*/) { return true; }
|
||||||
virtual void OnPlayerBeforeUpdateSkill(Player* /*player*/, uint32 /*skillId*/, uint32& /*value*/, uint32 /*max*/, uint32 /*step*/) { }
|
virtual void OnPlayerBeforeUpdateSkill(Player* /*player*/, uint32 /*skillId*/, uint32& /*value*/, uint32 /*max*/, uint32 /*step*/) { }
|
||||||
virtual void OnPlayerUpdateSkill(Player* /*player*/, uint32 /*skillId*/, uint32 /*value*/, uint32 /*max*/, uint32 /*step*/, uint32 /*newValue*/) { }
|
virtual void OnPlayerUpdateSkill(Player* /*player*/, uint32 /*skillId*/, uint32 /*value*/, uint32 /*max*/, uint32 /*step*/, uint32 /*newValue*/) { }
|
||||||
|
virtual void OnPlayerSetSkill(Player* /*player*/, uint32 /*skillId*/, uint32 /*value*/, uint32 /*max*/, uint32 /*step*/, uint32 /*newValue*/) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This hook is called, to avoid player resurrect
|
* @brief This hook is called, to avoid player resurrect
|
||||||
|
|||||||
@@ -462,6 +462,7 @@ public: /* PlayerScript */
|
|||||||
bool OnPlayerCanUpdateSkill(Player* player, uint32 skillId);
|
bool OnPlayerCanUpdateSkill(Player* player, uint32 skillId);
|
||||||
void OnPlayerBeforeUpdateSkill(Player* player, uint32 skill_id, uint32& value, uint32 max, uint32 step);
|
void OnPlayerBeforeUpdateSkill(Player* player, uint32 skill_id, uint32& value, uint32 max, uint32 step);
|
||||||
void OnPlayerUpdateSkill(Player* player, uint32 skillId, uint32 value, uint32 max, uint32 step, uint32 newValue);
|
void OnPlayerUpdateSkill(Player* player, uint32 skillId, uint32 value, uint32 max, uint32 step, uint32 newValue);
|
||||||
|
void OnPlayerSetSkill(Player* player, uint32 skillId, uint32 value, uint32 max, uint32 step, uint32 newValue);
|
||||||
bool OnPlayerCanResurrect(Player* player);
|
bool OnPlayerCanResurrect(Player* player);
|
||||||
bool OnPlayerCanGiveLevel(Player* player, uint8 newLevel);
|
bool OnPlayerCanGiveLevel(Player* player, uint8 newLevel);
|
||||||
void OnPlayerSendListInventory(Player* player, ObjectGuid vendorGuid, uint32& vendorEntry);
|
void OnPlayerSendListInventory(Player* player, ObjectGuid vendorGuid, uint32& vendorEntry);
|
||||||
|
|||||||
Reference in New Issue
Block a user