[11007] Implement use personal loot slot types that fix problems with some loot cases.

For example it fix looting 43016.

Also use enum and clarify uses diff loot slot types.
This commit is contained in:
VladimirMangos 2011-01-14 18:47:52 +03:00
parent 5e74d1e425
commit f7d49a4254
4 changed files with 43 additions and 8 deletions

View file

@ -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;
}
}