Restore DepositBankMoney & WithdrawBankMoney
Simply revert the commit "Remove guild bank methods" Date : 2017.07.19 5:12pm
I dont understand why it was removed cause it worked fine.
The functions only allowed you to deposit an amount of money, but not check if it was successful or even possible. For example there was no way to check the lower or upper bounds of the guild stash. That is why you have no idea how much you actually put or take from the bank - could be for example that you take money from an empty bank or put money to a full bank.
Ah ok Can't add a DB check to fix that problem ?
So what about Player:ModifyMoney ? There's the same problem.
The situation is a bit different since you can check how much money the player has: http://www.elunaengine.com/Player/GetCoinage.html (function naming was influenced by arcemu I am guessing..) Also min and maximum money is a constant.
I just added a check system in my LUA script and I have no problem at all with that commands.
@ConradBunton Can you show what kind of "check system" you used? Just in case it helps with this.
It's just a generic script but it's something like that...
=========== DepositBankMoney == If there's too much money, it only add money to the maximal.
Deposit = xxx -- xxx = Money to deposit
Max_GBank = yyy -- yyy = Maximal money in the bank
if (player:IsInGuild()) then
Chk_Deposit = CharDBQuery("SELECT * FROM guild WHERE guildid = '"..player:GetGuildId().."';")
if Chk_Deposit then
Current_Bank = Chk_Deposit:GetUInt32(11) -- BankMoney Column
if Current_Bank + Deposit > Max_GBank then
-- Delete the next line to change the result. (No transaction when too much money)
player:GetGuild():DepositBankMoney(player, (Max_GBank-Current_Bank))
player:SendBroadcastMessage("Too much money in your guild bank")
else
player:GetGuild():DepositBankMoney(player, Deposit)
end
end
end
========== WithdrawBank == If there's not enough money, it just withdraw to left the minimal.
Withdraw = xxx -- xxx = Money to Withdraw
Min_GBank = 0 -- Can use more than 0
if (player:IsInGuild()) then
Chk_Withdraw = CharDBQuery("SELECT * FROM guild WHERE guildid = '"..player:GetGuildId().."';")
if Chk_Withdraw then
Current_Bank = Chk_Withdraw:GetUInt32(11) -- BankMoney Column
if (Current_Bank - Withdraw < Min_GBank) then
-- Delete the next line to change the result. (No transaction when not enough money)
player:GetGuild():WithdrawBankMoney(player, (Current_Bank-Min_GBank))
player:SendBroadcastMessage("Not enough money in your guild bank")
else
player:GetGuild():WithdrawBankMoney(player, Withdraw)
end
end
end
Does it help you ?