feat(Core/Groups): mail roll-won items when inventory is full (#25909)

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Andrew
2026-05-19 21:41:11 -03:00
committed by GitHub
parent a5c11d081d
commit 169e31f2c6
7 changed files with 66 additions and 6 deletions

View File

@@ -3386,6 +3386,16 @@ DungeonAccessRequirements.OptionalStringID = 0
JoinBGAndLFG.Enable = 0
#
# LFG.MailItemOnFullInventory
# Description: When a player wins a group roll but their inventory is full, mail
# the item to them instead of leaving it on the corpse.
# Default: 0 - Disabled
# 1 - Only in LFG/RDF groups
# 2 - In all group types
LFG.MailItemOnFullInventory = 0
#
# DungeonFinder.OptionsMask
# Description: Dungeon and raid finder system.

View File

@@ -1668,6 +1668,7 @@ public:
[[nodiscard]] PlayerMails const& GetMails() const { return m_mail; }
void SendItemRetrievalMail(uint32 itemEntry, uint32 count); // Item retrieval mails sent by The Postmaster (34337)
void SendItemRetrievalMail(std::vector<std::pair<uint32, uint32>> mailItems); // Item retrieval mails sent by The Postmaster (34337)
void SendItemRetrievalMail(Item* item); // As above, but for a pre-created item (preserves randomPropertyId)
/*********************************************************/
/*** MAILED ITEMS SYSTEM ***/

View File

@@ -508,3 +508,16 @@ void Player::SendItemRetrievalMail(std::vector<std::pair<uint32, uint32>> mailIt
CharacterDatabase.CommitTransaction(trans);
}
void Player::SendItemRetrievalMail(Item* item)
{
if (!item)
return;
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
item->SaveToDB(trans);
MailDraft("Recovered Item", "We recovered a lost item in the twisting nether and noted that it was yours.$B$BPlease find said object enclosed.")
.AddItem(item)
.SendMailTo(trans, MailReceiver(this, GetGUID().GetCounter()), MailSender(MAIL_CREATURE, 34337 /* The Postmaster */));
CharacterDatabase.CommitTransaction(trans);
}

View File

@@ -1490,9 +1490,22 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap)
}
else
{
item->is_blocked = false;
item->rollWinnerGUID = player->GetGUID();
player->SendEquipError(msg, nullptr, nullptr, roll->itemid);
uint32 mailOnFull = sWorld->getIntConfig(CONFIG_LFG_MAIL_ITEM_ON_FULL_INVENTORY);
if (mailOnFull == MAIL_ITEM_ON_FULL_INVENTORY_EVERYWHERE || (mailOnFull == MAIL_ITEM_ON_FULL_INVENTORY_LFG_ONLY && isLFGGroup()))
{
item->is_looted = true;
roll->getLoot()->NotifyItemRemoved(roll->itemSlot);
roll->getLoot()->unlootedCount--;
player->SendEquipError(msg, nullptr, nullptr, roll->itemid);
if (Item* mailItem = Item::CreateItem(roll->itemid, item->count, player, false, item->randomPropertyId))
player->SendItemRetrievalMail(mailItem);
}
else
{
item->is_blocked = false;
item->rollWinnerGUID = player->GetGUID();
player->SendEquipError(msg, nullptr, nullptr, roll->itemid);
}
}
}
}
@@ -1560,9 +1573,22 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap)
}
else
{
item->is_blocked = false;
item->rollWinnerGUID = player->GetGUID();
player->SendEquipError(msg, nullptr, nullptr, roll->itemid);
uint32 mailOnFull = sWorld->getIntConfig(CONFIG_LFG_MAIL_ITEM_ON_FULL_INVENTORY);
if (mailOnFull == MAIL_ITEM_ON_FULL_INVENTORY_EVERYWHERE || (mailOnFull == MAIL_ITEM_ON_FULL_INVENTORY_LFG_ONLY && isLFGGroup()))
{
item->is_looted = true;
roll->getLoot()->NotifyItemRemoved(roll->itemSlot);
roll->getLoot()->unlootedCount--;
player->SendEquipError(msg, nullptr, nullptr, roll->itemid);
if (Item* mailItem = Item::CreateItem(roll->itemid, item->count, player, false, item->randomPropertyId))
player->SendItemRetrievalMail(mailItem);
}
else
{
item->is_blocked = false;
item->rollWinnerGUID = player->GetGUID();
player->SendEquipError(msg, nullptr, nullptr, roll->itemid);
}
}
}
else if (rollvote == DISENCHANT)

View File

@@ -128,6 +128,13 @@ enum lfgGroupFlags
GROUP_LFG_FLAG_IS_HEROIC = 0x004
};
enum MailItemOnFullInventory
{
MAIL_ITEM_ON_FULL_INVENTORY_DISABLED = 0,
MAIL_ITEM_ON_FULL_INVENTORY_LFG_ONLY = 1,
MAIL_ITEM_ON_FULL_INVENTORY_EVERYWHERE = 2,
};
enum DifficultyPreventionChangeType
{
DIFFICULTY_PREVENTION_CHANGE_NONE = 0,

View File

@@ -494,6 +494,8 @@ void WorldConfig::BuildConfigCache()
SetConfigValue<bool>(CONFIG_ALLOW_JOIN_BG_AND_LFG, "JoinBGAndLFG.Enable", false);
SetConfigValue<uint32>(CONFIG_LFG_MAIL_ITEM_ON_FULL_INVENTORY, "LFG.MailItemOnFullInventory", 0);
SetConfigValue<bool>(CONFIG_LEAVE_GROUP_ON_LOGOUT, "LeaveGroupOnLogout.Enabled", false);
SetConfigValue<uint32>(CONFIG_RANDOM_ROLL_MAXIMUM, "Group.RandomRollMaximum", 1000000);

View File

@@ -375,6 +375,7 @@ enum ServerConfigs
CONFIG_LOOT_NEED_BEFORE_GREED_ILVL_RESTRICTION,
CONFIG_LFG_MAX_KICK_COUNT,
CONFIG_LFG_KICK_PREVENTION_TIMER,
CONFIG_LFG_MAIL_ITEM_ON_FULL_INVENTORY,
CONFIG_CHANGE_FACTION_MAX_MONEY,
CONFIG_WATER_BREATH_TIMER,
CONFIG_DAILY_RBG_MIN_LEVEL_AP_REWARD,