Core/Mail: Moved gold check closer to where it is taken away
Port From (https://github.com/TrinityCore/TrinityCore/commit/1dcb2904d5b5a6c12f5f3b56e44c74e4a79b9626)
This commit is contained in:
@@ -121,17 +121,17 @@ namespace Game
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!player.HasEnoughMoney(reqmoney) && !player.IsGameMaster())
|
|
||||||
{
|
|
||||||
player.SendMailResult(0, MailResponseType.Send, MailResponseResult.NotEnoughMoney);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void mailCountCheckContinuation(Team receiverTeam, ulong mailsCount, uint receiverLevel, uint receiverAccountId, uint receiverBnetAccountId)
|
void mailCountCheckContinuation(Team receiverTeam, ulong mailsCount, uint receiverLevel, uint receiverAccountId, uint receiverBnetAccountId)
|
||||||
{
|
{
|
||||||
if (_player != player)
|
if (_player != player)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!player.HasEnoughMoney(reqmoney) && !player.IsGameMaster())
|
||||||
|
{
|
||||||
|
player.SendMailResult(0, MailResponseType.Send, MailResponseResult.NotEnoughMoney);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// do not allow to have more than 100 mails in mailbox.. mails count is in opcode uint8!!! - so max can be 255..
|
// do not allow to have more than 100 mails in mailbox.. mails count is in opcode uint8!!! - so max can be 255..
|
||||||
if (mailsCount > 100)
|
if (mailsCount > 100)
|
||||||
{
|
{
|
||||||
@@ -478,7 +478,7 @@ namespace Game
|
|||||||
{
|
{
|
||||||
new MailDraft(m.subject, "")
|
new MailDraft(m.subject, "")
|
||||||
.AddMoney(m.COD)
|
.AddMoney(m.COD)
|
||||||
.SendMailTo(trans, new MailReceiver(receiver, m.sender), new MailSender( MailMessageType.Normal, m.receiver), MailCheckMask.CodPayment);
|
.SendMailTo(trans, new MailReceiver(receiver, m.sender), new MailSender(MailMessageType.Normal, m.receiver), MailCheckMask.CodPayment);
|
||||||
}
|
}
|
||||||
|
|
||||||
player.ModifyMoney(-(long)m.COD);
|
player.ModifyMoney(-(long)m.COD);
|
||||||
@@ -549,7 +549,7 @@ namespace Game
|
|||||||
var mails = player.GetMails();
|
var mails = player.GetMails();
|
||||||
|
|
||||||
MailListResult response = new();
|
MailListResult response = new();
|
||||||
long curTime = GameTime.GetGameTime();
|
long curTime = GameTime.GetGameTime();
|
||||||
|
|
||||||
foreach (Mail m in mails)
|
foreach (Mail m in mails)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user