From af4661330ae99cd538b1831bf643209635573f48 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 14 Sep 2023 04:33:14 -0400 Subject: [PATCH] Core/Mail: Reorder mail attachment checks to be able to report nonempty bag error to client. Port From (https://github.com/TrinityCore/TrinityCore/commit/7b48268e2cfc7fddeba8fe55721aaab4234cc152) --- Source/Game/Handlers/MailHandler.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Source/Game/Handlers/MailHandler.cs b/Source/Game/Handlers/MailHandler.cs index 8c6643e91..a312ecc11 100644 --- a/Source/Game/Handlers/MailHandler.cs +++ b/Source/Game/Handlers/MailHandler.cs @@ -186,6 +186,13 @@ namespace Game return; } + // handle empty bag before CanBeTraded, since that func already has that check + if (item.IsNotEmptyBag()) + { + player.SendMailResult(0, MailResponseType.Send, MailResponseResult.EquipError, InventoryResult.DestroyNonemptyBag); + return; + } + if (!item.CanBeTraded(true)) { player.SendMailResult(0, MailResponseType.Send, MailResponseResult.EquipError, InventoryResult.MailBoundItem); @@ -213,12 +220,6 @@ namespace Game return; } - if (item.IsNotEmptyBag()) - { - player.SendMailResult(0, MailResponseType.Send, MailResponseResult.EquipError, InventoryResult.DestroyNonemptyBag); - return; - } - items.Add(item); }