diff --git a/src/game/LootMgr.cpp b/src/game/LootMgr.cpp index cc32b8cb9..1d070302b 100644 --- a/src/game/LootMgr.cpp +++ b/src/game/LootMgr.cpp @@ -741,7 +741,8 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) { if (!l.items[i].is_looted && !l.items[i].freeforall && !l.items[i].conditionId && l.items[i].AllowedForPlayer(lv.viewer)) { - uint8 slot_type = (l.items[i].is_blocked || l.items[i].is_underthreshold) ? 0 : 1; + LootSlotType slot_type = (l.items[i].is_blocked || l.items[i].is_underthreshold) + ? LOOT_SLOT_NORMAL : LOOT_SLOT_VIEW; 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 @@ -751,13 +752,25 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) break; } 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)) { - uint8 slot_type = (lv.permission==MASTER_PERMISSION && !l.items[i].is_underthreshold) ? 2 : 0; + 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; @@ -769,6 +782,9 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) return b; // nothing output more } + // in next cases used same slot type for all items + LootSlotType slot_type = lv.permission == OWNER_PERMISSION ? LOOT_SLOT_OWNER : LOOT_SLOT_NORMAL; + QuestItemMap const& lootPlayerQuestItems = l.GetPlayerQuestItems(); QuestItemMap::const_iterator q_itr = lootPlayerQuestItems.find(lv.viewer->GetGUIDLow()); if (q_itr != lootPlayerQuestItems.end()) @@ -781,7 +797,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) { b << uint8(l.items.size() + (qi - q_list->begin())); b << item; - b << uint8(0); // allow loot + b << uint8(slot_type); // allow loot ++itemsShown; } } @@ -798,7 +814,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) if (!fi->is_looted && !item.is_looted) { b << uint8(fi->index) << item; - b << uint8(0); // allow loot + b << uint8(slot_type); // allow loot ++itemsShown; } } @@ -815,7 +831,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) if (!ci->is_looted && !item.is_looted) { b << uint8(ci->index) << item; - b << uint8(0); // allow loot + b << uint8(slot_type); // allow loot ++itemsShown; } } diff --git a/src/game/LootMgr.h b/src/game/LootMgr.h index 675af2262..fede8ba23 100644 --- a/src/game/LootMgr.h +++ b/src/game/LootMgr.h @@ -36,7 +36,8 @@ enum PermissionTypes ALL_PERMISSION = 0, GROUP_PERMISSION = 1, MASTER_PERMISSION = 2, - NONE_PERMISSION = 3 + OWNER_PERMISSION = 3, // for single player only loots + NONE_PERMISSION = 4 }; enum LootType @@ -55,6 +56,17 @@ enum LootType LOOT_INSIGNIA = 22 // unsupported by client, sending LOOT_CORPSE instead }; +enum LootSlotType +{ + LOOT_SLOT_NORMAL = 0, // can be looted + LOOT_SLOT_VIEW = 1, // can be only view (ignore any loot attempts) + 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 +}; + + + class Player; class LootStore; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 173e1414d..27a83d88c 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -7954,6 +7954,8 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type) return; } + permission = OWNER_PERMISSION; + loot = &item->loot; if (!item->HasGeneratedLoot()) @@ -8009,6 +8011,8 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type) if (bones->lootRecipient != this) permission = NONE_PERMISSION; + else + permission = OWNER_PERMISSION; break; } case HIGHGUID_UNIT: @@ -8044,6 +8048,7 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type) const uint32 a = urand(0, creature->getLevel()/2); const uint32 b = urand(0, getLevel()/2); loot->gold = uint32(10 * (a + b) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY)); + permission = OWNER_PERMISSION; } } else @@ -8106,6 +8111,8 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type) // let reopen skinning loot if will closed. if (!loot->empty()) creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + + permission = OWNER_PERMISSION; } } // set group rights only for loot_type != LOOT_SKINNING @@ -8131,7 +8138,7 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type) permission = NONE_PERMISSION; } else if (recipient == this) - permission = ALL_PERMISSION; + permission = OWNER_PERMISSION; else permission = NONE_PERMISSION; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 0684ccc7f..a6a8ad134 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 "11006" + #define REVISION_NR "11007" #endif // __REVISION_NR_H__