mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-09 08:17:56 +00:00
Added OnBeforeItemRoll hook and added missing parameter to:
OnAfterRefCount OnBeforeDropAddItem please update your scripts if you're using them
This commit is contained in:
@@ -1317,6 +1317,8 @@ void LootTemplate::Process(Loot& loot, bool rate, uint16 lootMode, Player const*
|
|||||||
LootStoreItem* item = *i;
|
LootStoreItem* item = *i;
|
||||||
if (!(item->lootmode & lootMode)) // Do not add if mode mismatch
|
if (!(item->lootmode & lootMode)) // Do not add if mode mismatch
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
sScriptMgr->OnBeforeItemRoll(player, loot, rate, lootMode, item);
|
||||||
|
|
||||||
if (!item->Roll(rate))
|
if (!item->Roll(rate))
|
||||||
continue; // Bad luck for the entry
|
continue; // Bad luck for the entry
|
||||||
@@ -1328,12 +1330,12 @@ void LootTemplate::Process(Loot& loot, bool rate, uint16 lootMode, Player const*
|
|||||||
continue; // Error message already printed at loading stage
|
continue; // Error message already printed at loading stage
|
||||||
|
|
||||||
uint32 maxcount = uint32(float(item->maxcount) * sWorld->getRate(RATE_DROP_ITEM_REFERENCED_AMOUNT));
|
uint32 maxcount = uint32(float(item->maxcount) * sWorld->getRate(RATE_DROP_ITEM_REFERENCED_AMOUNT));
|
||||||
sScriptMgr->OnAfterRefCount(item, maxcount);
|
sScriptMgr->OnAfterRefCount(player, loot, rate, lootMode, item, maxcount);
|
||||||
for (uint32 loop = 0; loop < maxcount; ++loop) // Ref multiplicator
|
for (uint32 loop = 0; loop < maxcount; ++loop) // Ref multiplicator
|
||||||
Referenced->Process(loot, rate, lootMode, player, item->group);
|
Referenced->Process(loot, rate, lootMode, player, item->group);
|
||||||
} else {
|
} else {
|
||||||
// Plain entries (not a reference, not grouped)
|
// Plain entries (not a reference, not grouped)
|
||||||
sScriptMgr->OnBeforeDropAddItem(player, loot, item);
|
sScriptMgr->OnBeforeDropAddItem(player, loot, rate, lootMode, item);
|
||||||
loot.AddItem(*item); // Chance is already checked, just add
|
loot.AddItem(*item); // Chance is already checked, just add
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1001,8 +1001,11 @@ class GlobalScript : public ScriptObject
|
|||||||
// items
|
// items
|
||||||
virtual void OnItemDelFromDB(SQLTransaction& /*trans*/, uint32 /*itemGuid*/) { }
|
virtual void OnItemDelFromDB(SQLTransaction& /*trans*/, uint32 /*itemGuid*/) { }
|
||||||
virtual void OnMirrorImageDisplayItem(const Item* /*item*/, uint32& /*display*/) { }
|
virtual void OnMirrorImageDisplayItem(const Item* /*item*/, uint32& /*display*/) { }
|
||||||
virtual void OnAfterRefCount(LootStoreItem* /*LootStoreItem*/, uint32& /*maxcount*/) { }
|
|
||||||
virtual void OnBeforeDropAddItem(Player const* /*player*/, Loot& /*loot*/, LootStoreItem* /*LootStoreItem*/) { }
|
// loot
|
||||||
|
virtual void OnAfterRefCount(Player const* /*player*/, LootStoreItem* /*LootStoreItem*/, Loot& /*loot*/, bool /*canRate*/, uint16 /*lootMode*/, uint32& /*maxcount*/) { }
|
||||||
|
virtual void OnBeforeDropAddItem(Player const* /*player*/, Loot& /*loot*/, bool /*canRate*/, uint16 /*lootMode*/, LootStoreItem* /*LootStoreItem*/) { }
|
||||||
|
virtual void OnBeforeItemRoll(Player const* /*player*/, Loot& /*loot*/, bool /*canRate*/, uint16 /*lootMode*/, LootStoreItem* /*LootStoreItem*/) { };
|
||||||
|
|
||||||
virtual void OnInitializeLockedDungeons(Player* /*player*/, uint8& /*level*/, uint32& /*lockData*/) { }
|
virtual void OnInitializeLockedDungeons(Player* /*player*/, uint8& /*level*/, uint32& /*lockData*/) { }
|
||||||
virtual void OnAfterInitializeLockedDungeons(Player* /*player*/) { }
|
virtual void OnAfterInitializeLockedDungeons(Player* /*player*/) { }
|
||||||
@@ -1271,8 +1274,9 @@ class ScriptMgr
|
|||||||
void OnGlobalItemDelFromDB(SQLTransaction& trans, uint32 itemGuid);
|
void OnGlobalItemDelFromDB(SQLTransaction& trans, uint32 itemGuid);
|
||||||
void OnGlobalMirrorImageDisplayItem(const Item *item, uint32 &display);
|
void OnGlobalMirrorImageDisplayItem(const Item *item, uint32 &display);
|
||||||
void OnBeforeUpdateArenaPoints(ArenaTeam* at, std::map<uint32, uint32> &ap);
|
void OnBeforeUpdateArenaPoints(ArenaTeam* at, std::map<uint32, uint32> &ap);
|
||||||
void OnAfterRefCount(LootStoreItem* LootStoreItem, uint32 &maxcount);
|
void OnAfterRefCount(Player const* player, Loot& loot, bool canRate, uint16 lootMode, LootStoreItem* LootStoreItem, uint32 &maxcount);
|
||||||
void OnBeforeDropAddItem(Player const* player, Loot& loot, LootStoreItem* LootStoreItem);
|
void OnBeforeDropAddItem(Player const* player, Loot& loot, bool canRate, uint16 lootMode, LootStoreItem* LootStoreItem);
|
||||||
|
void OnBeforeItemRoll(Player const* player, Loot& loot, bool canRate, uint16 lootMode, LootStoreItem* LootStoreItem);
|
||||||
void OnInitializeLockedDungeons(Player* player, uint8& level, uint32& lockData);
|
void OnInitializeLockedDungeons(Player* player, uint8& level, uint32& lockData);
|
||||||
void OnAfterInitializeLockedDungeons(Player* player);
|
void OnAfterInitializeLockedDungeons(Player* player);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user