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* qitem = nullptr;
|
||||||
QuestItem* ffaitem = nullptr;
|
QuestItem* ffaitem = nullptr;
|
||||||
QuestItem* conditem = 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)
|
if (!item || item->is_looted)
|
||||||
{
|
{
|
||||||
SendEquipError(EQUIP_ERR_ALREADY_LOOTED, nullptr, nullptr);
|
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
|
// 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)
|
if (!qitem && !ffaitem && !conditem)
|
||||||
{
|
{
|
||||||
SendLootRelease(GetLootGUID());
|
SendLootRelease(GetLootGUID());
|
||||||
return;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!item->AllowedForPlayer(this, loot->sourceWorldObjectGUID))
|
if (!item->AllowedForPlayer(this, loot->sourceWorldObjectGUID))
|
||||||
{
|
{
|
||||||
SendLootRelease(GetLootGUID());
|
SendLootRelease(GetLootGUID());
|
||||||
return;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// questitems use the blocked field for other purposes
|
// questitems use the blocked field for other purposes
|
||||||
if (!qitem && item->is_blocked)
|
if (!qitem && item->is_blocked)
|
||||||
{
|
{
|
||||||
SendLootRelease(GetLootGUID());
|
SendLootRelease(GetLootGUID());
|
||||||
return;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// xinef: dont allow protected item to be looted by someone else
|
// xinef: dont allow protected item to be looted by someone else
|
||||||
if (item->rollWinnerGUID && item->rollWinnerGUID != GetGUID())
|
if (item->rollWinnerGUID && item->rollWinnerGUID != GetGUID())
|
||||||
{
|
{
|
||||||
SendLootRelease(GetLootGUID());
|
SendLootRelease(GetLootGUID());
|
||||||
return;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemPosCountVec dest;
|
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)
|
if (msg == EQUIP_ERR_OK)
|
||||||
{
|
{
|
||||||
AllowedLooterSet looters = item->GetAllowedLooters();
|
AllowedLooterSet looters = item->GetAllowedLooters();
|
||||||
@@ -13342,9 +13343,13 @@ void Player::StoreLootItem(uint8 lootSlot, Loot* loot)
|
|||||||
sScriptMgr->OnLootItem(this, newitem, item->count, this->GetLootGUID());
|
sScriptMgr->OnLootItem(this, newitem, item->count, this->GetLootGUID());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
SendEquipError(msg, nullptr, nullptr, item->itemid);
|
SendEquipError(msg, nullptr, nullptr, item->itemid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 Player::CalculateTalentsPoints() const
|
uint32 Player::CalculateTalentsPoints() const
|
||||||
{
|
{
|
||||||
uint32 base_talent = getLevel() < 10 ? 0 : getLevel() - 9;
|
uint32 base_talent = getLevel() < 10 ? 0 : getLevel() - 9;
|
||||||
|
|||||||
@@ -1280,7 +1280,7 @@ public:
|
|||||||
bool StoreNewItemInBestSlots(uint32 item_id, uint32 item_count);
|
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(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 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 UpdateLootAchievements(LootItem* item, Loot* loot);
|
||||||
void UpdateTitansGrip();
|
void UpdateTitansGrip();
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,16 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData)
|
|||||||
loot = &creature->loot;
|
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 player is removing the last LootItem, delete the empty container.
|
||||||
if (loot->isLooted() && lguid.IsItem())
|
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 (!item->is_looted && item->freeforall && item->AllowedForPlayer(player, sourceWorldObjectGUID))
|
||||||
if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item->itemid))
|
if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item->itemid))
|
||||||
if (proto->IsCurrencyToken())
|
if (proto->IsCurrencyToken())
|
||||||
player->StoreLootItem(i, this);
|
{
|
||||||
|
InventoryResult msg;
|
||||||
|
player->StoreLootItem(i, this, msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user