fix: Fixes bank box withdraw using account gold (#671)

Fixes various locations where account gold is not used.
This commit is contained in:
Kamron Batman 2021-08-02 19:23:25 -07:00 • committed by GitHub
parent 677e44d35f
commit 3dc406624e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 28 deletions

View file

@ -161,22 +161,14 @@ namespace Server.Engines.Quests.Collector
return; return;
} }
if (player.Backpack?.ConsumeTotal(typeof(Gold), 10) == true) if (player.Backpack?.ConsumeTotal(typeof(Gold), 10) == true || Banker.Withdraw(player, 10))
{ {
obj.Complete(); obj.Complete();
} }
else else
{ {
if (player.FindBankNoCreate()?.ConsumeTotal(typeof(Gold), 10) == true) // You don't have enough gold to buy the sheet music.
{ player.SendLocalizedMessage(1055108);
obj.Complete();
}
else
{
player.SendLocalizedMessage(
1055108
); // You don't have enough gold to buy the sheet music.
}
} }
} }
} }

View file

@ -5,6 +5,7 @@ using System.Text;
using Server.Accounting; using Server.Accounting;
using Server.ContextMenus; using Server.ContextMenus;
using Server.Gumps; using Server.Gumps;
using Server.Mobiles;
using Server.Network; using Server.Network;
using Server.Regions; using Server.Regions;
@ -518,7 +519,7 @@ namespace Server.Items
Container bank = from.FindBankNoCreate(); Container bank = from.FindBankNoCreate();
if (m_TicketPrice == 0 || from.Backpack?.ConsumeTotal(typeof(Gold), m_TicketPrice) == true || if (m_TicketPrice == 0 || from.Backpack?.ConsumeTotal(typeof(Gold), m_TicketPrice) == true ||
bank?.ConsumeTotal(typeof(Gold), m_TicketPrice) == true) Banker.Withdraw(from, m_TicketPrice))
{ {
Entries.Add(new RaffleEntry(from)); Entries.Add(new RaffleEntry(from));

View file

@ -280,15 +280,7 @@ namespace Server.Mobiles
} }
} }
public override bool HandlesOnSpeech(Mobile from) public override bool HandlesOnSpeech(Mobile from) => from.InRange(Location, 12) || base.HandlesOnSpeech(from);
{
if (from.InRange(Location, 12))
{
return true;
}
return base.HandlesOnSpeech(from);
}
public override void OnSpeech(SpeechEventArgs e) public override void OnSpeech(SpeechEventArgs e)
{ {
@ -441,11 +433,11 @@ namespace Server.Mobiles
else else
{ {
Say( Say(
1042673, 1042673, // Into your bank box I have placed a check in the amount of:
AffixType.Append, AffixType.Append,
amount.ToString(), amount.ToString(),
"" ""
); // Into your bank box I have placed a check in the amount of: );
} }
} }
} }

View file

@ -230,8 +230,7 @@ namespace Server.Mobiles
if (!bought && totalCost >= 2000) if (!bought && totalCost >= 2000)
{ {
cont = buyer.FindBankNoCreate(); if (Banker.Withdraw(buyer, totalCost))
if (cont?.ConsumeTotal(typeof(Gold), totalCost) == true)
{ {
bought = true; bought = true;
fromBank = true; fromBank = true;

View file

@ -181,7 +181,7 @@ namespace Server.Mobiles
Container bank = from.FindBankNoCreate(); Container bank = from.FindBankNoCreate();
if (!(from.Backpack?.GetAmount(typeof(Gold)) >= 30) && if (!(from.Backpack?.GetAmount(typeof(Gold)) >= 30) &&
!(bank?.GetAmount(typeof(Gold)) >= 30)) !(Banker.GetBalance(from) >= 30))
{ {
SayTo(from, 1042556); // Thou dost not have enough gold, not even in thy bank account. SayTo(from, 1042556); // Thou dost not have enough gold, not even in thy bank account.
} }
@ -246,8 +246,7 @@ namespace Server.Mobiles
{ {
Container bank = from.FindBankNoCreate(); Container bank = from.FindBankNoCreate();
if (from.Backpack?.ConsumeTotal(typeof(Gold), 30) == true || if (from.Backpack?.ConsumeTotal(typeof(Gold), 30) == true || Banker.Withdraw(from, 30))
bank?.ConsumeTotal(typeof(Gold), 30) == true)
{ {
pet.ControlTarget = null; pet.ControlTarget = null;
pet.ControlOrder = OrderType.Stay; pet.ControlOrder = OrderType.Stay;