Originally Posted by JordyMoos
I gues that you can just listen to this event: EVENT_GUILD_BANK_ITEM_ADDED
|
I think that you should look into guild history events.
Lua Code:
local history = {}
local function HandleResponse(eventCode, guildId, category)
if (category == GUILD_HISTORY_BANK and DoesPlayerHaveGuildPermission(guildId, GUILD_PERMISSION_BANK_WITHDRAW)) then
local guildName = GetGuildName(guildId)
--d("Response received for guild: " .. guildName)
for i = 1, GetNumGuildEvents(guildId, GUILD_HISTORY_BANK) do
local eventType, secsSinceEvent, displayName, count, itemLink = GetGuildEventInfo(guildId, GUILD_HISTORY_BANK, i)
local eventTime = zo_abs(zo_round(GetFrameTimeSeconds() - secsSinceEvent))
local historyKey = zo_strjoin("_", eventTime, displayName, count, GetItemLinkName(itemLink))
if (ComputeGuildHistoryEventSubcategory(eventType, GUILD_HISTORY_BANK) == GUILD_HISTORY_BANK_DEPOSITS and not history[historyKey]) then
d(zo_strformat("<<1>>: <<2>> deposited <<3>> x <<t:4>>", guildName, displayName, count, itemLink))
history[historyKey] = true
end
end
end
end
EVENT_MANAGER:RegisterForEvent("GuildBankDeposits", EVENT_GUILD_HISTORY_RESPONSE_RECEIVED, HandleResponse)
local function UpdateHistory()
for guildIndex = 1, GetNumGuilds() do
local guildId = GetGuildId(guildIndex)
if (DoesPlayerHaveGuildPermission(guildId, GUILD_PERMISSION_BANK_WITHDRAW)) then
RequestGuildHistoryCategoryNewest(guildId, GUILD_HISTORY_BANK)
end
end
end
EVENT_MANAGER:RegisterForUpdate("GuildBankDeposits", 60000, UpdateHistory) --1 minute interval