Core/Loot: Fixed looting of individual, owner only items (item loot/skinning)
Signed-off-by: Shauren <[email protected]>
This commit is contained in:
@@ -8474,6 +8474,8 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
permission = OWNER_PERMISSION;
|
||||||
|
|
||||||
loot = &item->loot;
|
loot = &item->loot;
|
||||||
|
|
||||||
if (!item->m_lootGenerated)
|
if (!item->m_lootGenerated)
|
||||||
@@ -8526,6 +8528,8 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
|
|||||||
|
|
||||||
if (bones->lootRecipient != this)
|
if (bones->lootRecipient != this)
|
||||||
permission = NONE_PERMISSION;
|
permission = NONE_PERMISSION;
|
||||||
|
else
|
||||||
|
permission = OWNER_PERMISSION;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -8560,6 +8564,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
|
|||||||
const uint32 a = urand(0, creature->getLevel()/2);
|
const uint32 a = urand(0, creature->getLevel()/2);
|
||||||
const uint32 b = urand(0, getLevel()/2);
|
const uint32 b = urand(0, getLevel()/2);
|
||||||
loot->gold = uint32(10 * (a + b) * sWorld->getRate(RATE_DROP_MONEY));
|
loot->gold = uint32(10 * (a + b) * sWorld->getRate(RATE_DROP_MONEY));
|
||||||
|
permission = OWNER_PERMISSION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -8600,6 +8605,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
|
|||||||
{
|
{
|
||||||
loot->clear();
|
loot->clear();
|
||||||
loot->FillLoot(creature->GetCreatureInfo()->SkinLootId, LootTemplates_Skinning, this, true);
|
loot->FillLoot(creature->GetCreatureInfo()->SkinLootId, LootTemplates_Skinning, this, true);
|
||||||
|
permission = OWNER_PERMISSION;
|
||||||
}
|
}
|
||||||
// set group rights only for loot_type != LOOT_SKINNING
|
// set group rights only for loot_type != LOOT_SKINNING
|
||||||
else
|
else
|
||||||
@@ -8628,7 +8634,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
|
|||||||
permission = NONE_PERMISSION;
|
permission = NONE_PERMISSION;
|
||||||
}
|
}
|
||||||
else if (recipient == this)
|
else if (recipient == this)
|
||||||
permission = ALL_PERMISSION;
|
permission = OWNER_PERMISSION;
|
||||||
else
|
else
|
||||||
permission = NONE_PERMISSION;
|
permission = NONE_PERMISSION;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -866,8 +866,21 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
|||||||
}
|
}
|
||||||
case ALL_PERMISSION:
|
case ALL_PERMISSION:
|
||||||
case MASTER_PERMISSION:
|
case MASTER_PERMISSION:
|
||||||
|
case OWNER_PERMISSION:
|
||||||
{
|
{
|
||||||
uint8 slot_type = (lv.permission == MASTER_PERMISSION) ? LOOT_SLOT_TYPE_MASTER : LOOT_SLOT_TYPE_ALLOW_LOOT;
|
uint8 slot_type = LOOT_SLOT_TYPE_ALLOW_LOOT;
|
||||||
|
switch (lv.permission)
|
||||||
|
{
|
||||||
|
case MASTER_PERMISSION:
|
||||||
|
slot_type = LOOT_SLOT_TYPE_MASTER;
|
||||||
|
break;
|
||||||
|
case OWNER_PERMISSION:
|
||||||
|
slot_type = LOOT_SLOT_TYPE_OWNER;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
for (uint8 i = 0; i < l.items.size(); ++i)
|
for (uint8 i = 0; i < l.items.size(); ++i)
|
||||||
{
|
{
|
||||||
if (!l.items[i].is_looted && !l.items[i].freeforall && l.items[i].conditions.empty() && l.items[i].AllowedForPlayer(lv.viewer))
|
if (!l.items[i].is_looted && !l.items[i].freeforall && l.items[i].conditions.empty() && l.items[i].AllowedForPlayer(lv.viewer))
|
||||||
@@ -883,6 +896,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
|||||||
return b; // nothing output more
|
return b; // nothing output more
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LootSlotType slotType = lv.permission == OWNER_PERMISSION ? LOOT_SLOT_TYPE_OWNER : LOOT_SLOT_TYPE_ALLOW_LOOT;
|
||||||
QuestItemMap const& lootPlayerQuestItems = l.GetPlayerQuestItems();
|
QuestItemMap const& lootPlayerQuestItems = l.GetPlayerQuestItems();
|
||||||
QuestItemMap::const_iterator q_itr = lootPlayerQuestItems.find(lv.viewer->GetGUIDLow());
|
QuestItemMap::const_iterator q_itr = lootPlayerQuestItems.find(lv.viewer->GetGUIDLow());
|
||||||
if (q_itr != lootPlayerQuestItems.end())
|
if (q_itr != lootPlayerQuestItems.end())
|
||||||
@@ -895,7 +909,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
|||||||
{
|
{
|
||||||
b << uint8(l.items.size() + (qi - q_list->begin()));
|
b << uint8(l.items.size() + (qi - q_list->begin()));
|
||||||
b << item;
|
b << item;
|
||||||
b << uint8(LOOT_SLOT_TYPE_ALLOW_LOOT);
|
b << uint8(slotType);
|
||||||
++itemsShown;
|
++itemsShown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -911,8 +925,9 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
|||||||
LootItem &item = l.items[fi->index];
|
LootItem &item = l.items[fi->index];
|
||||||
if (!fi->is_looted && !item.is_looted)
|
if (!fi->is_looted && !item.is_looted)
|
||||||
{
|
{
|
||||||
b << uint8(fi->index) << item;
|
b << uint8(fi->index);
|
||||||
b << uint8(LOOT_SLOT_TYPE_ALLOW_LOOT);
|
b << item;
|
||||||
|
b << uint8(slotType);
|
||||||
++itemsShown;
|
++itemsShown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -928,8 +943,9 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
|||||||
LootItem &item = l.items[ci->index];
|
LootItem &item = l.items[ci->index];
|
||||||
if (!ci->is_looted && !item.is_looted)
|
if (!ci->is_looted && !item.is_looted)
|
||||||
{
|
{
|
||||||
b << uint8(ci->index) << item;
|
b << uint8(ci->index);
|
||||||
b << uint8(LOOT_SLOT_TYPE_ALLOW_LOOT);
|
b << item;
|
||||||
|
b << uint8(slotType);
|
||||||
++itemsShown;
|
++itemsShown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,8 @@ enum PermissionTypes
|
|||||||
GROUP_PERMISSION = 1,
|
GROUP_PERMISSION = 1,
|
||||||
MASTER_PERMISSION = 2,
|
MASTER_PERMISSION = 2,
|
||||||
ROUND_ROBIN_PERMISSION = 3,
|
ROUND_ROBIN_PERMISSION = 3,
|
||||||
NONE_PERMISSION = 4,
|
OWNER_PERMISSION = 4,
|
||||||
|
NONE_PERMISSION = 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum LootType
|
enum LootType
|
||||||
@@ -93,6 +94,7 @@ enum LootSlotType
|
|||||||
LOOT_SLOT_TYPE_ROLL_ONGOING = 1, // roll is ongoing. player cannot loot.
|
LOOT_SLOT_TYPE_ROLL_ONGOING = 1, // roll is ongoing. player cannot loot.
|
||||||
LOOT_SLOT_TYPE_MASTER = 2, // item can only be distributed by group loot master.
|
LOOT_SLOT_TYPE_MASTER = 2, // item can only be distributed by group loot master.
|
||||||
LOOT_SLOT_TYPE_LOCKED = 3, // item is shown in red. player cannot loot.
|
LOOT_SLOT_TYPE_LOCKED = 3, // item is shown in red. player cannot loot.
|
||||||
|
LOOT_SLOT_TYPE_OWNER = 4, // ignore binding confirmation and etc, for single player looting
|
||||||
};
|
};
|
||||||
|
|
||||||
class Player;
|
class Player;
|
||||||
|
|||||||
Reference in New Issue
Block a user