mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-30 17:13:47 +00:00
New hooks OnAfterRefCount and OnBeforeDropAddItem
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "Group.h"
|
||||
#include "Player.h"
|
||||
#include "Containers.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
static Rates const qualityToRate[MAX_ITEM_QUALITY] =
|
||||
{
|
||||
@@ -461,7 +462,7 @@ bool Loot::FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bo
|
||||
items.reserve(MAX_NR_LOOT_ITEMS);
|
||||
quest_items.reserve(MAX_NR_QUEST_ITEMS);
|
||||
|
||||
tab->Process(*this, store.IsRatesAllowed(), lootMode); // Processing is done there, callback via Loot::AddItem()
|
||||
tab->Process(*this, store.IsRatesAllowed(), lootMode, lootOwner); // Processing is done there, callback via Loot::AddItem()
|
||||
|
||||
// Setting access rights for group loot case
|
||||
Group* group = lootOwner->GetGroup();
|
||||
@@ -1296,7 +1297,7 @@ void LootTemplate::CopyConditions(LootItem* li) const
|
||||
}
|
||||
|
||||
// Rolls for every item in the template and adds the rolled items the the loot
|
||||
void LootTemplate::Process(Loot& loot, bool rate, uint16 lootMode, uint8 groupId) const
|
||||
void LootTemplate::Process(Loot& loot, bool rate, uint16 lootMode, Player const* player, uint8 groupId) const
|
||||
{
|
||||
if (groupId) // Group reference uses own processing of the group
|
||||
{
|
||||
@@ -1327,10 +1328,12 @@ void LootTemplate::Process(Loot& loot, bool rate, uint16 lootMode, uint8 groupId
|
||||
continue; // Error message already printed at loading stage
|
||||
|
||||
uint32 maxcount = uint32(float(item->maxcount) * sWorld->getRate(RATE_DROP_ITEM_REFERENCED_AMOUNT));
|
||||
sScriptMgr->OnAfterRefCount(item, maxcount);
|
||||
for (uint32 loop = 0; loop < maxcount; ++loop) // Ref multiplicator
|
||||
Referenced->Process(loot, rate, lootMode, item->group);
|
||||
Referenced->Process(loot, rate, lootMode, player, item->group);
|
||||
}
|
||||
else // Plain entries (not a reference, not grouped)
|
||||
sScriptMgr->OnBeforeDropAddItem(player, loot, item);
|
||||
loot.AddItem(*item); // Chance is already checked, just add
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user