Originally Posted by Kevinmon
Would it be possible to make the banked gold on inventory as a stand-alone add-on?
|
If you want, grab BankedGold-0.1.zip from my Dropbox (link in my signature).
Source code:
Lua Code:
local label
local function OnStateChange(oldState, newState)
if (newState == SCENE_SHOWING) then
ZO_CurrencyControl_SetSimpleCurrency(label, CURRENCY_TYPE_MONEY, GetBankedMoney(), INVENTORY_BANKED_CURRENCY_OPTIONS)
end
end
local function OnBankMoneyUpdated(event, newBankedMoney, oldBankedMoney)
ZO_CurrencyControl_SetSimpleCurrency(label, CURRENCY_TYPE_MONEY, newBankedMoney, INVENTORY_BANKED_CURRENCY_OPTIONS)
end
local function OnAddonLoaded(event, name)
if name:find("^ZO_") then return end
EVENT_MANAGER:UnregisterForEvent("_BankedGold_", event)
label = WINDOW_MANAGER:CreateControlFromVirtual(nil, ZO_PlayerInventoryInfoBar, "ZO_CurrencyTemplate")
label:SetAnchor(TOPRIGHT, ZO_PlayerInventoryInfoBarMoney, BOTTOMRIGHT, 0, 0)
local inventoryScene = SCENE_MANAGER:GetScene("inventory")
inventoryScene:RegisterCallback("StateChange", OnStateChange)
EVENT_MANAGER:RegisterForEvent("_BankedGold_", EVENT_BANKED_MONEY_UPDATE, OnBankMoneyUpdated)
end
EVENT_MANAGER:RegisterForEvent("_BankedGold_", EVENT_ADD_ON_LOADED, OnAddonLoaded)