mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-21 20:56:23 +00:00
chore(Core/ScriptMgr): Add Hooks for profession skill gains (#16526)
This commit is contained in:
@@ -727,6 +727,7 @@ bool Player::UpdateGatherSkill(uint32 SkillId, uint32 SkillValue,
|
||||
|
||||
uint32 gathering_skill_gain =
|
||||
sWorld->getIntConfig(CONFIG_SKILL_GAIN_GATHERING);
|
||||
sScriptMgr->OnUpdateGatheringSkill(this, SkillId, SkillValue, RedLevel + 100, RedLevel + 50, RedLevel + 25, gathering_skill_gain);
|
||||
|
||||
// For skinning and Mining chance decrease with level. 1-74 - no decrease,
|
||||
// 75-149 - 2 times, 225-299 - 8 times
|
||||
@@ -804,6 +805,7 @@ bool Player::UpdateCraftSkill(uint32 spellid)
|
||||
|
||||
uint32 craft_skill_gain =
|
||||
sWorld->getIntConfig(CONFIG_SKILL_GAIN_CRAFTING);
|
||||
sScriptMgr->OnUpdateCraftingSkill(this, _spell_idx->second, SkillValue, craft_skill_gain);
|
||||
|
||||
return UpdateSkillPro(
|
||||
_spell_idx->second->SkillLine,
|
||||
|
||||
@@ -975,6 +975,20 @@ void ScriptMgr::OnGetMaxSkillValue(Player* player, uint32 skill, int32& result,
|
||||
});
|
||||
}
|
||||
|
||||
void ScriptMgr::OnUpdateGatheringSkill(Player *player, uint32 skillId, uint32 currentLevel, uint32 gray, uint32 green, uint32 yellow, uint32 &gain) {
|
||||
ExecuteScript<PlayerScript>([&](PlayerScript* script)
|
||||
{
|
||||
script->OnUpdateGatheringSkill(player, skillId, gray, green, yellow, currentLevel, gain);
|
||||
});
|
||||
}
|
||||
|
||||
void ScriptMgr::OnUpdateCraftingSkill(Player *player, SkillLineAbilityEntry const* skill, uint32 currentLevel, uint32& gain) {
|
||||
ExecuteScript<PlayerScript>([&](PlayerScript* script)
|
||||
{
|
||||
script->OnUpdateCraftingSkill(player, skill, currentLevel, gain);
|
||||
});
|
||||
}
|
||||
|
||||
bool ScriptMgr::OnUpdateFishingSkill(Player* player, int32 skill, int32 zone_skill, int32 chance, int32 roll)
|
||||
{
|
||||
auto ret = IsValidBoolScript<PlayerScript>([&](PlayerScript* script)
|
||||
|
||||
@@ -1274,6 +1274,29 @@ public:
|
||||
|
||||
virtual void OnGetMaxSkillValue(Player* /*player*/, uint32 /*skill*/, int32& /*result*/, bool /*IsPure*/) { }
|
||||
|
||||
/**
|
||||
* @brief This hook called before gathering skill gain is applied to the character.
|
||||
*
|
||||
* @param player Contains information about the Player sender
|
||||
* @param skill_id Contains information about the skill line
|
||||
* @param current Contains the current skill level for skill
|
||||
* @param gray Contains the gray skill level for current application
|
||||
* @param green Contains the green skill level for current application
|
||||
* @param yellow Contains the yellow skill level for current application
|
||||
* @param gain Contains the amount of points that should be added to the Player
|
||||
*/
|
||||
virtual void OnUpdateGatheringSkill(Player* /*player*/, uint32 /*skill_id*/, uint32 /*current*/, uint32 /*gray*/, uint32 /*green*/, uint32 /*yellow*/, uint32& /*gain*/) { }
|
||||
|
||||
/**
|
||||
* @brief This hook is called before crafting skill gain is applied to the character.
|
||||
*
|
||||
* @param player Contains information about the Player sender
|
||||
* @param skill Contains information about the skill line
|
||||
* @param current_level Contains the current skill level for skill
|
||||
* @param gain Contains the amount of points that should be added to the Player
|
||||
*/
|
||||
virtual void OnUpdateCraftingSkill(Player* /*player*/, SkillLineAbilityEntry const* /*skill*/, uint32 /*current_level*/, uint32& /*gain*/) { }
|
||||
|
||||
[[nodiscard]] virtual bool OnUpdateFishingSkill(Player* /*player*/, int32 /*skill*/, int32 /*zone_skill*/, int32 /*chance*/, int32 /*roll*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanAreaExploreAndOutdoor(Player* /*player*/) { return true; }
|
||||
@@ -2334,6 +2357,8 @@ public: /* PlayerScript */
|
||||
void OnDeleteFromDB(CharacterDatabaseTransaction trans, uint32 guid);
|
||||
bool CanRepopAtGraveyard(Player* player);
|
||||
void OnGetMaxSkillValue(Player* player, uint32 skill, int32& result, bool IsPure);
|
||||
void OnUpdateGatheringSkill(Player* player, uint32 skillId, uint32 currentLevel, uint32 gray, uint32 green, uint32 yellow, uint32& gain);
|
||||
void OnUpdateCraftingSkill(Player* player, SkillLineAbilityEntry const* skill, uint32 currentLevel, uint32& gain);
|
||||
bool OnUpdateFishingSkill(Player* player, int32 skill, int32 zone_skill, int32 chance, int32 roll);
|
||||
bool CanAreaExploreAndOutdoor(Player* player);
|
||||
void OnVictimRewardBefore(Player* player, Player* victim, uint32& killer_title, uint32& victim_title);
|
||||
|
||||
Reference in New Issue
Block a user