mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 18:10:26 +00:00
feat(Core): improved some hooks (#6302)
This commit is contained in:
@@ -1344,13 +1344,13 @@ void ScriptMgr::OnShutdown()
|
||||
FOREACH_SCRIPT(WorldScript)->OnShutdown();
|
||||
}
|
||||
|
||||
bool ScriptMgr::OnCriteriaCheck(uint32 scriptId, Player* source, Unit* target)
|
||||
bool ScriptMgr::OnCriteriaCheck(uint32 scriptId, Player* source, Unit* target, uint32 criteria_id)
|
||||
{
|
||||
ASSERT(source);
|
||||
// target can be nullptr.
|
||||
|
||||
GET_SCRIPT_RET(AchievementCriteriaScript, scriptId, tmpscript, false);
|
||||
return tmpscript->OnCheck(source, target);
|
||||
return tmpscript->OnCheck(source, target, criteria_id);
|
||||
}
|
||||
|
||||
// Player
|
||||
@@ -1650,11 +1650,33 @@ void ScriptMgr::OnPlayerRemoveFromBattleground(Player* player, Battleground* bg)
|
||||
FOREACH_SCRIPT(PlayerScript)->OnRemoveFromBattleground(player, bg);
|
||||
}
|
||||
|
||||
bool ScriptMgr::OnBeforeAchievementComplete(Player* player, AchievementEntry const* achievement)
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
FOR_SCRIPTS_RET(PlayerScript, itr, end, ret) // return true by default if not scripts
|
||||
if (!itr->second->OnBeforeAchiComplete(player, achievement))
|
||||
ret = false; // we change ret value only when scripts return false
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ScriptMgr::OnAchievementComplete(Player* player, AchievementEntry const* achievement)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnAchiComplete(player, achievement);
|
||||
}
|
||||
|
||||
bool ScriptMgr::OnBeforeCriteriaProgress(Player* player, AchievementCriteriaEntry const* criteria)
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
FOR_SCRIPTS_RET(PlayerScript, itr, end, ret) // return true by default if not scripts
|
||||
if (!itr->second->OnBeforeCriteriaProgress(player, criteria))
|
||||
ret = false; // we change ret value only when scripts return false
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ScriptMgr::OnCriteriaProgress(Player* player, AchievementCriteriaEntry const* criteria)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnCriteriaProgress(player, criteria);
|
||||
@@ -1981,9 +2003,25 @@ void ScriptMgr::OnBeforeDropAddItem(Player const* player, Loot& loot, bool canRa
|
||||
FOREACH_SCRIPT(GlobalScript)->OnBeforeDropAddItem(player, loot, canRate, lootMode, LootStoreItem, store);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnItemRoll(Player const* player, LootStoreItem const* LootStoreItem, float& chance, Loot& loot, LootStore const& store)
|
||||
bool ScriptMgr::OnItemRoll(Player const* player, LootStoreItem const* LootStoreItem, float& chance, Loot& loot, LootStore const& store)
|
||||
{
|
||||
FOREACH_SCRIPT(GlobalScript)->OnItemRoll(player, LootStoreItem, chance, loot, store);
|
||||
bool ret = true; // return true by default
|
||||
|
||||
FOR_SCRIPTS_RET(GlobalScript, itr, end, ret)
|
||||
if (!itr->second->OnItemRoll(player, LootStoreItem, chance, loot, store))
|
||||
ret = false; // we change ret value only when a script returns false
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ScriptMgr::OnBeforeLootEqualChanced(Player const* player, LootStoreItemList EqualChanced, Loot& loot, LootStore const& store) {
|
||||
bool ret = true; // return true by default
|
||||
|
||||
FOR_SCRIPTS_RET(GlobalScript, itr, end, ret)
|
||||
if (!itr->second->OnBeforeLootEqualChanced(player, EqualChanced, loot, store))
|
||||
ret = false; // we change ret value only when a script returns false
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ScriptMgr::OnInitializeLockedDungeons(Player* player, uint8& level, uint32& lockData, lfg::LFGDungeonData const* dungeon)
|
||||
|
||||
Reference in New Issue
Block a user