[9964] Implement Treshold in Masterloot.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Emme 2010-05-23 18:14:39 +04:00 committed by VladimirMangos
parent 702d368114
commit 8a424642e6
4 changed files with 16 additions and 5 deletions

View file

@ -580,8 +580,17 @@ void Group::NeedBeforeGreed(Creature *creature, Loot *loot)
}
}
void Group::MasterLoot(Creature *creature, Loot* /*loot*/)
void Group::MasterLoot(Creature *creature, Loot* loot)
{
for (LootItemList::iterator i=loot->items.begin(); i != loot->items.end(); ++i)
{
ItemPrototype const *item = ObjectMgr::GetItemPrototype(i->itemid);
if (!item)
continue;
if (item->Quality < uint32(m_lootThreshold))
i->is_underthreshold = 1;
}
uint32 real_count = 0;
WorldPacket data(SMSG_LOOT_MASTER_LIST, 330);

View file

@ -724,11 +724,11 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
case ALL_PERMISSION:
case MASTER_PERMISSION:
{
uint8 slot_type = (lv.permission==MASTER_PERMISSION) ? 2 : 0;
for (uint8 i = 0; i < l.items.size(); ++i)
{
if (!l.items[i].is_looted && !l.items[i].freeforall && !l.items[i].conditionId && l.items[i].AllowedForPlayer(lv.viewer))
{
uint8 slot_type = (lv.permission==MASTER_PERMISSION && !l.items[i].is_underthreshold) ? 2 : 0;
b << uint8(i) << l.items[i]; //only send one-player loot items now, free for all will be sent later
b << uint8(slot_type); // 0 - get 2 - master selection
++itemsShown;

View file

@ -101,6 +101,8 @@ struct LootItem
bool AllowedForPlayer(Player const * player) const;
};
typedef std::vector<LootItem> LootItemList;
struct QuestItem
{
uint8 index; // position in quest_items;
@ -220,7 +222,7 @@ struct Loot
QuestItemMap const& GetPlayerFFAItems() const { return PlayerFFAItems; }
QuestItemMap const& GetPlayerNonQuestNonFFAConditionalItems() const { return PlayerNonQuestNonFFAConditionalItems; }
std::vector<LootItem> items;
LootItemList items;
uint32 gold;
uint8 unlootedCount;
LootType loot_type; // required for achievement system
@ -281,7 +283,7 @@ struct Loot
QuestItemList* FillQuestLoot(Player* player);
QuestItemList* FillNonQuestNonFFAConditionalLoot(Player* player);
std::vector<LootItem> quest_items;
LootItemList quest_items;
std::set<uint64> PlayersLooting;
QuestItemMap PlayerQuestItems;
QuestItemMap PlayerFFAItems;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9963"
#define REVISION_NR "9964"
#endif // __REVISION_NR_H__