mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-29 00:23:48 +00:00
fix(Core/Loot): Disenchanted, milled or prospected items should be se… (#14273)
fix(Core/Loot): Disenchanted, milled or prospected items should be sent as retrieval mail in case of full bags. Fixes #10798
This commit is contained in:
@@ -13250,18 +13250,19 @@ void Player::AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore cons
|
||||
}
|
||||
}
|
||||
|
||||
void Player::StoreLootItem(uint8 lootSlot, Loot* loot)
|
||||
LootItem* Player::StoreLootItem(uint8 lootSlot, Loot* loot, InventoryResult& msg)
|
||||
{
|
||||
QuestItem* qitem = nullptr;
|
||||
QuestItem* ffaitem = nullptr;
|
||||
QuestItem* conditem = nullptr;
|
||||
|
||||
LootItem* item = loot->LootItemInSlot(lootSlot, this, &qitem, &ffaitem, &conditem);
|
||||
msg = EQUIP_ERR_OK;
|
||||
|
||||
LootItem* item = loot->LootItemInSlot(lootSlot, this, &qitem, &ffaitem, &conditem);
|
||||
if (!item || item->is_looted)
|
||||
{
|
||||
SendEquipError(EQUIP_ERR_ALREADY_LOOTED, nullptr, nullptr);
|
||||
return;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Xinef: exploit protection, dont allow to loot normal items if player is not master loot and not below loot threshold
|
||||
@@ -13270,31 +13271,31 @@ void Player::StoreLootItem(uint8 lootSlot, Loot* loot)
|
||||
if (!qitem && !ffaitem && !conditem)
|
||||
{
|
||||
SendLootRelease(GetLootGUID());
|
||||
return;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!item->AllowedForPlayer(this, loot->sourceWorldObjectGUID))
|
||||
{
|
||||
SendLootRelease(GetLootGUID());
|
||||
return;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// questitems use the blocked field for other purposes
|
||||
if (!qitem && item->is_blocked)
|
||||
{
|
||||
SendLootRelease(GetLootGUID());
|
||||
return;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// xinef: dont allow protected item to be looted by someone else
|
||||
if (item->rollWinnerGUID && item->rollWinnerGUID != GetGUID())
|
||||
{
|
||||
SendLootRelease(GetLootGUID());
|
||||
return;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ItemPosCountVec dest;
|
||||
InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item->itemid, item->count);
|
||||
msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item->itemid, item->count);
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
{
|
||||
AllowedLooterSet looters = item->GetAllowedLooters();
|
||||
@@ -13342,7 +13343,11 @@ void Player::StoreLootItem(uint8 lootSlot, Loot* loot)
|
||||
sScriptMgr->OnLootItem(this, newitem, item->count, this->GetLootGUID());
|
||||
}
|
||||
else
|
||||
{
|
||||
SendEquipError(msg, nullptr, nullptr, item->itemid);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
uint32 Player::CalculateTalentsPoints() const
|
||||
|
||||
@@ -1280,7 +1280,7 @@ public:
|
||||
bool StoreNewItemInBestSlots(uint32 item_id, uint32 item_count);
|
||||
void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const& store, bool broadcast = false);
|
||||
void AutoStoreLoot(uint32 loot_id, LootStore const& store, bool broadcast = false) { AutoStoreLoot(NULL_BAG, NULL_SLOT, loot_id, store, broadcast); }
|
||||
void StoreLootItem(uint8 lootSlot, Loot* loot);
|
||||
LootItem* StoreLootItem(uint8 lootSlot, Loot* loot, InventoryResult& msg);
|
||||
void UpdateLootAchievements(LootItem* item, Loot* loot);
|
||||
void UpdateTitansGrip();
|
||||
|
||||
|
||||
@@ -93,7 +93,16 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData)
|
||||
loot = &creature->loot;
|
||||
}
|
||||
|
||||
player->StoreLootItem(lootSlot, loot);
|
||||
InventoryResult msg;
|
||||
LootItem* lootItem = player->StoreLootItem(lootSlot, loot, msg);
|
||||
if (msg != EQUIP_ERR_OK && lguid.IsItem() && loot->loot_type != LOOT_CORPSE)
|
||||
{
|
||||
lootItem->is_looted = true;
|
||||
loot->NotifyItemRemoved(lootItem->itemIndex);
|
||||
loot->unlootedCount--;
|
||||
|
||||
player->SendItemRetrievalMail(lootItem->itemid, lootItem->count);
|
||||
}
|
||||
|
||||
// If player is removing the last LootItem, delete the empty container.
|
||||
if (loot->isLooted() && lguid.IsItem())
|
||||
|
||||
@@ -627,7 +627,10 @@ void Loot::FillNotNormalLootFor(Player* player)
|
||||
if (!item->is_looted && item->freeforall && item->AllowedForPlayer(player, sourceWorldObjectGUID))
|
||||
if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item->itemid))
|
||||
if (proto->IsCurrencyToken())
|
||||
player->StoreLootItem(i, this);
|
||||
{
|
||||
InventoryResult msg;
|
||||
player->StoreLootItem(i, this, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user