Hello.
I've been trying to fix a problem with my auto repair mod when it comes to guild repairs. Namely, if the guild bank has insufficient funds for your repairs, but you are allowed to withdraw money, then the addon should not tell you that your gear was repaired.
Wowprogramming states that GetGuildBankMoney() only updates when GUILDBANK_UPDATE_MONEY or GUILDBANKFRAME_OPENED fires. Otherwise, it returns a cached amount. This seems to be a problem even in the Blizzard UI; sometimes, when mousing over the guild repair icon, the tooltip indicates the amount of a guild of one of your other characters.
This code is used in MerchantFrame.xml, used to calculate the amount you can use for repairs:
Code:
local amount = GetGuildBankWithdrawMoney();
local guildBankMoney = GetGuildBankMoney();
if ( amount == -1 ) then
-- Guild leader shows full guild bank amount
amount = guildBankMoney;
else
amount = min(amount, guildBankMoney);
end
The problem here is that when GetGuildBankMoney() returns a cached amount, for example 0, the display will be incorrect.
In fact, even the button is bugged - they acknowledge it in the code. You hear the 'repair' sound when you click it, even when your guild has no money left. You do get an error though stating that your guild does not have enough money when you try this, but that's before the amount returned by GetGuildBankMoney() even updates.
--
Simply put - is there a fool-proof way to ensure your guild has enough money before the addon attempts to repair? Perhaps there is a way to force either of these events to fire? Or should the addon check your gear's durability after it attempted a repair, to ensure that it actually was repaired?