feat(Core): improved some hooks (#6302)

This commit is contained in:
Yehonal
2021-06-13 10:23:24 +02:00
committed by GitHub
parent 806dc4052f
commit baf437bb98
43 changed files with 162 additions and 93 deletions

View File

@@ -289,7 +289,8 @@ bool LootStoreItem::Roll(bool rate, Player const* player, Loot& loot, LootStore
{
float _chance = chance;
sScriptMgr->OnItemRoll(player, this, _chance, loot, store);
if (!sScriptMgr->OnItemRoll(player, this, _chance, loot, store))
return false;
if (_chance >= 100.0f)
return true;
@@ -1205,7 +1206,8 @@ LootStoreItem const* LootTemplate::LootGroup::Roll(Loot& loot, Player const* pla
LootStoreItem* item = *itr;
float chance = item->chance;
sScriptMgr->OnItemRoll(player, item, chance, loot, store);
if (!sScriptMgr->OnItemRoll(player, item, chance, loot, store))
return nullptr;
if (chance >= 100.0f)
return item;
@@ -1216,6 +1218,9 @@ LootStoreItem const* LootTemplate::LootGroup::Roll(Loot& loot, Player const* pla
}
}
if (!sScriptMgr->OnBeforeLootEqualChanced(player, EqualChanced, loot, store))
return nullptr;
possibleLoot = EqualChanced;
possibleLoot.remove_if(LootGroupInvalidSelector(loot, lootMode));
if (!possibleLoot.empty()) // If nothing selected yet - an item is taken from equal-chanced part