diff --git a/src/game/LootMgr.cpp b/src/game/LootMgr.cpp index 615262ca7..20a6fb6b2 100644 --- a/src/game/LootMgr.cpp +++ b/src/game/LootMgr.cpp @@ -392,6 +392,27 @@ bool LootItem::AllowedForPlayer(Player const * player) const return true; } +LootSlotType LootItem::GetSlotTypeForSharedLoot(PermissionTypes permission, Player* viewer, bool condition_ok /*= false*/) const +{ + // ignore looted, FFA (each player get own copy) and not allowed items + if (is_looted || freeforall || conditionId && !condition_ok || !AllowedForPlayer(viewer)) + return MAX_LOOT_SLOT_TYPE; + + switch (permission) + { + case GROUP_PERMISSION: + return (is_blocked || is_underthreshold) ? LOOT_SLOT_NORMAL : LOOT_SLOT_VIEW; + case ALL_PERMISSION: + return LOOT_SLOT_NORMAL; + case OWNER_PERMISSION: + return LOOT_SLOT_OWNER; + case MASTER_PERMISSION: + return !is_underthreshold ? LOOT_SLOT_MASTER : LOOT_SLOT_NORMAL; + } + + return MAX_LOOT_SLOT_TYPE; +} + // // --------- Loot --------- // @@ -737,55 +758,38 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) size_t count_pos = b.wpos(); // pos of item count byte b << uint8(0); // item count placeholder - switch (lv.permission) + if (lv.permission == NONE_PERMISSION) + return b; // nothing output more + + + for (uint8 i = 0; i < l.items.size(); ++i) { - case GROUP_PERMISSION: + LootSlotType slot_type = l.items[i].GetSlotTypeForSharedLoot(lv.permission, lv.viewer); + if (slot_type >= MAX_LOOT_SLOT_TYPE) + continue; + + b << uint8(i) << l.items[i]; + b << uint8(slot_type); // 0 - get 1 - look only 2 - master selection + ++itemsShown; + } + + QuestItemMap const& lootPlayerNonQuestNonFFAConditionalItems = l.GetPlayerNonQuestNonFFAConditionalItems(); + QuestItemMap::const_iterator nn_itr = lootPlayerNonQuestNonFFAConditionalItems.find(lv.viewer->GetGUIDLow()); + if (nn_itr != lootPlayerNonQuestNonFFAConditionalItems.end()) + { + QuestItemList *conditional_list = nn_itr->second; + for (QuestItemList::const_iterator ci = conditional_list->begin() ; ci != conditional_list->end(); ++ci) { - // You are not the items proprietary, so you can only see - // blocked rolled items and quest items, and !ffa items - 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)) - { - LootSlotType slot_type = (l.items[i].is_blocked || l.items[i].is_underthreshold) - ? LOOT_SLOT_NORMAL : LOOT_SLOT_VIEW; + LootItem &item = l.items[ci->index]; - b << uint8(i) << l.items[i]; //send the index and the item if it's not looted, and blocked or under threshold, free for all items will be sent later, only one-player loots here - b << uint8(slot_type); // 0 - get 1 - look only - ++itemsShown; - } - } - break; + LootSlotType slot_type = item.GetSlotTypeForSharedLoot(lv.permission, lv.viewer, !ci->is_looted); + if (slot_type >= MAX_LOOT_SLOT_TYPE) + continue; + + b << uint8(ci->index) << item; + b << uint8(slot_type); // allow loot + ++itemsShown; } - case ALL_PERMISSION: - case OWNER_PERMISSION: - case MASTER_PERMISSION: - { - 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)) - { - LootSlotType slot_type = LOOT_SLOT_NORMAL; - - switch(lv.permission) - { - case MASTER_PERMISSION: - if (!l.items[i].is_underthreshold) - slot_type = LOOT_SLOT_MASTER; - break; - case OWNER_PERMISSION: - slot_type = LOOT_SLOT_OWNER; - } - - 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; - } - } - break; - } - default: - return b; // nothing output more } // in next cases used same slot type for all items @@ -826,23 +830,6 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) } } - QuestItemMap const& lootPlayerNonQuestNonFFAConditionalItems = l.GetPlayerNonQuestNonFFAConditionalItems(); - QuestItemMap::const_iterator nn_itr = lootPlayerNonQuestNonFFAConditionalItems.find(lv.viewer->GetGUIDLow()); - if (nn_itr != lootPlayerNonQuestNonFFAConditionalItems.end()) - { - QuestItemList *conditional_list = nn_itr->second; - for (QuestItemList::const_iterator ci = conditional_list->begin() ; ci != conditional_list->end(); ++ci) - { - LootItem &item = l.items[ci->index]; - if (!ci->is_looted && !item.is_looted) - { - b << uint8(ci->index) << item; - b << uint8(slot_type); // allow loot - ++itemsShown; - } - } - } - //update number of items shown b.put(count_pos,itemsShown); diff --git a/src/game/LootMgr.h b/src/game/LootMgr.h index fede8ba23..f6de6b42d 100644 --- a/src/game/LootMgr.h +++ b/src/game/LootMgr.h @@ -63,6 +63,7 @@ enum LootSlotType LOOT_SLOT_MASTER = 2, // can be looted only master (error message) LOOT_SLOT_REQS = 3, // can't be looted (error message about missing reqs) LOOT_SLOT_OWNER = 4, // ignore binding confirmation and etc, for single player looting + MAX_LOOT_SLOT_TYPE // custom, use for mark skipped from show items }; @@ -114,6 +115,7 @@ struct LootItem // Basic checks for player/item compatibility - if false no chance to see the item in the loot bool AllowedForPlayer(Player const * player) const; + LootSlotType GetSlotTypeForSharedLoot(PermissionTypes permission, Player* viewer, bool condition_ok = false) const; }; typedef std::vector LootItemList; diff --git a/src/game/Unit.h b/src/game/Unit.h index c894f430d..6525ea116 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1854,12 +1854,12 @@ class MANGOS_DLL_SPEC Unit : public WorldObject SpellAuraProcResult HandleModDamagePercentDoneAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); SpellAuraProcResult HandleModRating(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); SpellAuraProcResult HandleManaShieldAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - SpellAuraProcResult HandleNULLProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown) + SpellAuraProcResult HandleNULLProc(Unit* /*pVictim*/, uint32 /*damage*/, Aura* /*triggeredByAura*/, SpellEntry const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/) { // no proc handler for this aura type return SPELL_AURA_PROC_OK; } - SpellAuraProcResult HandleCantTrigger(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown) + SpellAuraProcResult HandleCantTrigger(Unit* /*pVictim*/, uint32 /*damage*/, Aura* /*triggeredByAura*/, SpellEntry const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/) { // this aura type can't proc return SPELL_AURA_PROC_CANT_TRIGGER; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 349b37191..2515c4c2f 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11268" + #define REVISION_NR "11269" #endif // __REVISION_NR_H__