diff --git a/LeoGuildManager.lua b/LeoGuildManager.lua
index 34a6d39..6066357 100644
--- a/LeoGuildManager.lua
+++ b/LeoGuildManager.lua
@@ -7,6 +7,7 @@ LeoGuildManager.depositsEvents = {}
LeoGuildManager.numEvents = {}
LeoGuildManager.inCombat = false
LeoGuildManager.nextGuildScan = 1
+LeoGuildManager.isDebug = false
LeoGuildManager.manualScan = false
local eventTooOld = {}
@@ -32,11 +33,33 @@ function LeoGuildManager.GetAutoKick(guildName)
end
return LeoGuildManager.globalData.settings.guilds[guildName].autoKick
end
+function LeoGuildManager.SetTooltipRoster(guildName, value)
+ LeoGuildManager.globalData.settings.guilds[guildName].tooltipRoster = value
+end
+function LeoGuildManager.UseTooltipRoster(guildName)
+ if LeoGuildManager.globalData.settings.guilds[guildName].tooltipRoster == nil then
+ LeoGuildManager.globalData.settings.guilds[guildName].tooltipRoster = false
+ end
+ return LeoGuildManager.globalData.settings.guilds[guildName].tooltipRoster
+end
+
+function LeoGuildManager.TimeAgo(timestamp)
+ local diff = GetTimeStamp() - timestamp
+ if diff < 3600 then
+ ago = ZO_CachedStrFormat(GetString(SI_TIME_FORMAT_MINUTES), math.floor(diff / 60))
+ elseif diff < 86400 then
+ ago = ZO_CachedStrFormat(GetString(SI_TIME_FORMAT_HOURS), math.floor(diff / 3600))
+ else
+ ago = ZO_CachedStrFormat(GetString(SI_TIME_FORMAT_DAYS), math.floor(diff / 86400))
+ end
+ return ZO_CachedStrFormat(GetString(SI_TIME_DURATION_AGO), ago)
+end
function LeoGuildManager.formatNumber(amount)
if amount == nil then return nil; end
if type(amount) == "string" then amount = tonumber( amount ) end
if type(amount) ~= "number" then return amount; end
+ if amount < 0 then amount = 0 end
if amount < 1000 then return amount; end
return FormatIntegerWithDigitGrouping( amount, GetString( SI_DIGIT_GROUP_SEPARATOR ) )
end
@@ -49,6 +72,12 @@ function LeoGuildManager.log(message)
d(formatMessage(message))
end
+function LeoGuildManager.debug(message)
+ if LeoGuildManager.isDebug == true then
+ d(formatMessage("[D] "..message))
+ end
+end
+
function LeoGuildManager.GetCycles()
local cycleData = LeoGuildManager.cycleMM
if LeoGuildManager.globalData.settings.integration == "Arkadiu's Trade Tools" then
@@ -156,6 +185,15 @@ function LeoGuildManager.GetGuildRanks(guildId)
return ranks
end
+function LeoGuildManager.GetGuildMember(name)
+ for i = 1, #LeoGuildManager.members do
+ if LeoGuildManager.members[i].name == name then
+ return LeoGuildManager.members[i]
+ end
+ end
+ return nil
+end
+
function LeoGuildManager.GetGuildMembers(guildId)
LeoGuildManager.members = {}
@@ -176,11 +214,12 @@ function LeoGuildManager.GetGuildMembers(guildId)
memberSince = 0,
invitedBy = "",
online = secsSinceLogoff,
- deposits = 0,
+ deposits = -1,
taxes = 0,
- sales = 0,
+ sales = -1,
joined = 0,
- endangered = false
+ endangered = false,
+ depositEvents = {}
})
end
end
@@ -237,16 +276,22 @@ end
function LeoGuildManager.AddSale(memberName, value)
for i = 1, #LeoGuildManager.members do
if LeoGuildManager.members[i].name == memberName then
+ if LeoGuildManager.members[i].sales < 0 then LeoGuildManager.members[i].sales = 0 end
LeoGuildManager.members[i].sales = LeoGuildManager.members[i].sales + value
return
end
end
end
-function LeoGuildManager.AddDeposit(memberName, value)
+function LeoGuildManager.AddDeposit(memberName, value, timestamp)
for i = 1, #LeoGuildManager.members do
if LeoGuildManager.members[i].name == memberName then
+ if LeoGuildManager.members[i].deposits < 0 then LeoGuildManager.members[i].deposits = 0 end
LeoGuildManager.members[i].deposits = LeoGuildManager.members[i].deposits + value
+ table.insert(LeoGuildManager.members[i].depositEvents, {
+ value = value,
+ timestamp = timestamp
+ })
return
end
end
@@ -265,6 +310,12 @@ function LeoGuildManager.CreatePurgeDescription(guildName)
local ignoreRank = LeoGuildManager.globalData.settings.guilds[guildName].ignoreRank
local ignoreNew = LeoGuildManager.globalData.settings.guilds[guildName].ignoreNew
+ local guildId = LeoGuildManager.GetGuildId(LeoGuildManager.globalData.selectedGuild)
+ local canScan = LeoGuildManager.CanScanBankHistory(guildId)
+ local integrationLoaded = LeoGuildManager.HasIntegrationAddonsLoaded()
+ if not canScan then tickets = 0 end
+ if not integrationLoaded then sales = 0 end
+
local descPurge = ""
if tickets > 0 and sales > 0 then
@@ -351,7 +402,8 @@ local function normalizeGuilds()
tickets = 0,
sales = 0,
inactivity = 30,
- blacklist = {}
+ blacklist = {},
+ tooltipRoster = false
}
end
end
@@ -398,7 +450,16 @@ function LeoGuildManager.Initialize()
LeoGuildManager.settings:CreatePanel()
SLASH_COMMANDS["/leogm"] = function(cmd)
- LeoGuildManagerUI:ToggleUI()
+ if cmd == "" then LeoGuildManagerUI:ToggleUI()
+ elseif cmd == "debug" then
+ if LeoGuildManager.isDebug == false then
+ LeoGuildManager.isDebug = true
+ LeoGuildManager.debug("Debug mode ON")
+ else
+ LeoGuildManager.debug("Debug mode OFF")
+ LeoGuildManager.isDebug = false
+ end
+ end
end
end
@@ -554,7 +615,7 @@ local function RequestGuildHistoryCategoryOlderLocal(guildIndex, category, numGu
else
LeoGuildManager.nextGuildScan = 1
end
- LeoGuildManager.log("Events too old")
+ --LeoGuildManager.log("Events too old")
return false
end
@@ -570,7 +631,21 @@ local function RequestGuildHistoryCategoryOlderLocal(guildIndex, category, numGu
return false
end
-local function canScanBankHistory(guildId)
+function LeoGuildManager.HasIntegrationAddonsLoaded()
+ return (LeoGuildManager.globalData.settings.integration == LeoGuildManager.integrations[2] and
+ ArkadiusTradeTools ~= nil and ArkadiusTradeTools.Modules ~= nil and ArkadiusTradeTools.Modules.Sales ~= nil)
+ or
+ (LeoGuildManager.globalData.settings.integration == LeoGuildManager.integrations[1] and
+ MasterMerchant ~= nil and MasterMerchant.guildSales ~= nil)
+end
+
+function LeoGuildManager.GuildNeedsScan(guildId)
+ local guildName = GetGuildName(guildId)
+ return LeoGuildManager.globalData.settings.guilds[guildName].enabled and
+ (LeoGuildManager.CanScanBankHistory(guildId) or LeoGuildManager.UseTooltipRoster(guildName))
+end
+
+function LeoGuildManager.CanScanBankHistory(guildId)
local guildName = GetGuildName(guildId)
return LeoGuildManager.globalData.settings.guilds[guildName].enabled and
DoesPlayerHaveGuildPermission(guildId, GUILD_PERMISSION_BANK_VIEW_GOLD)
@@ -628,16 +703,16 @@ function LeoGuildManager.ScanGuilds()
for i = 1, numGuilds do
guildId = GetGuildId(i)
- local guildName = GetGuildName(guildId)
- if LeoGuildManager.globalData.settings.guilds[guildName].enabled then
+ if LeoGuildManager.GuildNeedsScan(guildId) then
+ local guildName = GetGuildName(guildId)
initGuildScanData(guildName)
- if (RequestGuildHistoryCategoryNewest(guildId, GUILD_HISTORY_GENERAL)) then
-
+ if (LeoGuildManager.UseTooltipRoster(guildName) and RequestGuildHistoryCategoryNewest(guildId, GUILD_HISTORY_GENERAL)) then
+ LeoGuildManager.debug("Starting scan for new guild events on " .. guildName .. " ...")
zo_callLater(LeoGuildManager.ScanGuilds, shortScanInterval)
return
end
- if (canScanBankHistory(guildId) and RequestGuildHistoryCategoryNewest(guildId, GUILD_HISTORY_BANK)) then
- --LeoGuildManager.log("Starting scan for new bank events on " .. guildName .. " ...")
+ if (LeoGuildManager.CanScanBankHistory(guildId) and RequestGuildHistoryCategoryNewest(guildId, GUILD_HISTORY_BANK)) then
+ LeoGuildManager.debug("Starting scan for new bank events on " .. guildName .. " ...")
zo_callLater(LeoGuildManager.ScanGuilds, shortScanInterval)
return
end
@@ -647,15 +722,15 @@ function LeoGuildManager.ScanGuilds()
for i = LeoGuildManager.nextGuildScan, numGuilds do
guildId = GetGuildId(i)
- local guildName = GetGuildName(guildId)
- if LeoGuildManager.globalData.settings.guilds[guildName].enabled then
- if (RequestGuildHistoryCategoryOlderLocal(i, GUILD_HISTORY_GENERAL, numGuilds)) then
- --LeoGuildManager.log("Starting scan for old general events on " .. guildName .. " ...")
+ if LeoGuildManager.GuildNeedsScan(guildId) then
+ local guildName = GetGuildName(guildId)
+ if (LeoGuildManager.UseTooltipRoster(guildName) and RequestGuildHistoryCategoryOlderLocal(i, GUILD_HISTORY_GENERAL, numGuilds)) then
+ LeoGuildManager.debug("Starting scan for old general events on " .. guildName .. " ...")
zo_callLater(LeoGuildManager.ScanGuilds, shortScanInterval)
return
end
- if (canScanBankHistory(guildId) and RequestGuildHistoryCategoryOlderLocal(i, GUILD_HISTORY_BANK, numGuilds)) then
- --LeoGuildManager.log("Starting scan for old bank events on " .. guildName .. " ...")
+ if (LeoGuildManager.CanScanBankHistory(guildId) and RequestGuildHistoryCategoryOlderLocal(i, GUILD_HISTORY_BANK, numGuilds)) then
+ LeoGuildManager.debug("Starting scan for old bank events on " .. guildName .. " ...")
zo_callLater(LeoGuildManager.ScanGuilds, shortScanInterval)
return
end
@@ -664,15 +739,15 @@ function LeoGuildManager.ScanGuilds()
for i = 1, LeoGuildManager.nextGuildScan - 1 do
guildId = GetGuildId(i)
- local guildName = GetGuildName(guildId)
- if LeoGuildManager.globalData.settings.guilds[guildName].enabled then
- if (RequestGuildHistoryCategoryOlderLocal(i, GUILD_HISTORY_GENERAL, numGuilds)) then
- --LeoGuildManager.log("Starting scan for old general2 events on " .. guildName .. " ...")
+ if LeoGuildManager.GuildNeedsScan(guildId) then
+ local guildName = GetGuildName(guildId)
+ if (LeoGuildManager.UseTooltipRoster(guildName) and RequestGuildHistoryCategoryOlderLocal(i, GUILD_HISTORY_GENERAL, numGuilds)) then
+ LeoGuildManager.debug("Starting scan for old general2 events on " .. guildName .. " ...")
zo_callLater(LeoGuildManager.ScanGuilds, shortScanInterval)
return
end
- if (canScanBankHistory(guildId) and RequestGuildHistoryCategoryOlderLocal(i, GUILD_HISTORY_BANK, numGuilds)) then
- --LeoGuildManager.log("Starting scan for old bank2 events on " .. guildName .. " ...")
+ if (LeoGuildManager.CanScanBankHistory(guildId) and RequestGuildHistoryCategoryOlderLocal(i, GUILD_HISTORY_BANK, numGuilds)) then
+ LeoGuildManager.debug("Starting scan for old bank2 events on " .. guildName .. " ...")
zo_callLater(LeoGuildManager.ScanGuilds, shortScanInterval)
return
end
diff --git a/LeoGuildManager.txt b/LeoGuildManager.txt
index 9f9f72a..b8aeba1 100644
--- a/LeoGuildManager.txt
+++ b/LeoGuildManager.txt
@@ -1,7 +1,7 @@
## Title: Leo's Guild Manager
## APIVersion: 100024 100025
-## Version: 1.1.2
-## AddOnVersion: 112
+## Version: 1.1.3
+## AddOnVersion: 113
## Author: |c39B027@LeandroSilva|r
## SavedVariables: LeoGuildManagerGlobalData LeoGuildManagerScanData
## OptionalDependsOn: LibStub LibFeedback LibAddonMenu-2.0
diff --git a/LeoGuildManager.xml b/LeoGuildManager.xml
index a1dbfac..7a5c949 100644
--- a/LeoGuildManager.xml
+++ b/LeoGuildManager.xml
@@ -235,13 +235,17 @@
<Anchor point="TOPLEFT" relativeTo="$(parent)" relativePoint="TOPLEFT" offsetX="24"/>
<OnMouseUp> LeoGuildManager.UserClick(self, button, upInside) </OnMouseUp>
</Label>
- <Label name="$(parent)Deposits" font="LeoGuildManagerNormalFont" verticalAlignment="CENTER">
+ <Label name="$(parent)Deposits" font="LeoGuildManagerNormalFont" verticalAlignment="CENTER" mouseEnabled="true">
<Dimensions x="100" y="32" />
<Anchor point="TOPLEFT" relativeTo="$(parent)Name" relativePoint="TOPRIGHT" offsetX="10"/>
+ <OnMouseEnter> LeoGuildManagerUI.TooltipDeposits(self, true) </OnMouseEnter>
+ <OnMouseExit> LeoGuildManagerUI.TooltipDeposits(self, false) </OnMouseExit>
</Label>
- <Label name="$(parent)Sales" font="LeoGuildManagerNormalFont" verticalAlignment="CENTER">
+ <Label name="$(parent)Sales" font="LeoGuildManagerNormalFont" verticalAlignment="CENTER" mouseEnabled="true">
<Dimensions x="100" y="32" />
<Anchor point="TOPLEFT" relativeTo="$(parent)Deposits" relativePoint="TOPRIGHT" offsetX="10"/>
+ <OnMouseEnter> LeoGuildManagerUI.TooltipSales(self, true) </OnMouseEnter>
+ <OnMouseExit> LeoGuildManagerUI.TooltipSales(self, false) </OnMouseExit>
</Label>
<Label name="$(parent)Online" font="LeoGuildManagerNormalFont" verticalAlignment="CENTER">
<Dimensions x="100" y="32" />
diff --git a/LeoGuildManagerInit.lua b/LeoGuildManagerInit.lua
index ec0aab8..3c70337 100644
--- a/LeoGuildManagerInit.lua
+++ b/LeoGuildManagerInit.lua
@@ -4,7 +4,7 @@ LeoGuildManagerUI = LeoGuildManagerUI or {}
LeoGuildManager.name = "LeoGuildManager"
LeoGuildManager.displayName = "Leo's Guild Manager"
-LeoGuildManager.version = "1.1.2"
+LeoGuildManager.version = "1.1.3"
LeoGuildManager.chatPrefix = "|c39B027" .. LeoGuildManager.name .. "|r: "
LeoGuildManager.TAB_PURGE = "Purge"
diff --git a/LeoGuildManagerUI.lua b/LeoGuildManagerUI.lua
index 96d0c10..bf4eec7 100644
--- a/LeoGuildManagerUI.lua
+++ b/LeoGuildManagerUI.lua
@@ -70,6 +70,11 @@ function LeoGuildManager.ShowTab(tab)
if tab == LeoGuildManager.TAB_PURGE then
local descPurge = LeoGuildManager.CreatePurgeDescription(LeoGuildManager.globalData.selectedGuild)
LeoGuildManagerWindowPurgePanelPurgeDesc:SetText("|c"..LeoGuildManager.color.hex.yellow..descPurge.."|r")
+ if LeoGuildManager.GuildNeedsScan(LeoGuildManager.GetGuildId(LeoGuildManager.globalData.selectedGuild)) then
+ LeoGuildManagerWindowPurgePanelScanButton:SetHidden(false)
+ else
+ LeoGuildManagerWindowPurgePanelScanButton:SetHidden(true)
+ end
end
LeoGuildManager.globalData.activeTab = tab
@@ -258,6 +263,10 @@ function LeoGuildManagerMemberList:SetupEntry(control, data)
control.data = data
+ local guildId = LeoGuildManager.GetGuildId(LeoGuildManager.globalData.selectedGuild)
+ local canScan = LeoGuildManager.CanScanBankHistory(guildId)
+ local integrationLoaded = LeoGuildManager.HasIntegrationAddonsLoaded()
+
control.checkbox = GetControl(control, "Checkbox")
if data.endangered then
control.checkbox:SetTexture('/esoui/art/buttons/checkbox_checked.dds')
@@ -271,10 +280,18 @@ function LeoGuildManagerMemberList:SetupEntry(control, data)
control.name.data = data.name
control.deposits = GetControl(control, "Deposits")
- control.deposits:SetText(LeoGuildManager.formatNumber(data.deposits))
+ if canScan then
+ control.deposits:SetText(LeoGuildManager.formatNumber(data.deposits))
+ else
+ control.deposits:SetText("-")
+ end
control.sales = GetControl(control, "Sales")
- control.sales:SetText(LeoGuildManager.formatNumber(data.sales))
+ if integrationLoaded then
+ control.sales:SetText(LeoGuildManager.formatNumber(data.sales))
+ else
+ control.sales:SetText("-")
+ end
control.online = GetControl(control, "Online")
control.online:SetText(LeoGuildManager.GetTime(data.online))
@@ -286,7 +303,6 @@ function LeoGuildManagerMemberList:SetupEntry(control, data)
control.joined:SetText("")
end
- local guildId = LeoGuildManager.GetGuildId(LeoGuildManager.globalData.selectedGuild)
local rankName = GetGuildRankCustomName(guildId, data.rankIndex)
if rankName == "" then
rankName = GetDefaultGuildRankName(guildId, data.rankIndex)
@@ -316,6 +332,9 @@ end
function LeoGuildManagerMemberList:ColorRow(control, data, mouseIsOver)
local guildData = LeoGuildManager.globalData.settings.guilds[LeoGuildManager.globalData.selectedGuild]
+ local guildId = LeoGuildManager.GetGuildId(LeoGuildManager.globalData.selectedGuild)
+ local canScan = LeoGuildManager.CanScanBankHistory(guildId)
+ local integrationLoaded = LeoGuildManager.HasIntegrationAddonsLoaded()
local ticketsThreshold = guildData.tickets * 1000
local salesThreshold = guildData.sales * 1000
@@ -325,15 +344,23 @@ function LeoGuildManagerMemberList:ColorRow(control, data, mouseIsOver)
child:SetColor(1,1,1)
child = GetControl(control, "Deposits")
- child:SetColor(0,1,0)
- if ticketsThreshold > 0 and data.deposits < ticketsThreshold then
- child:SetColor(1,0,0)
+ if canScan then
+ child:SetColor(0,1,0)
+ if ticketsThreshold > 0 and data.deposits < ticketsThreshold then
+ child:SetColor(1,0,0)
+ end
+ else
+ child:SetColor(1,1,1)
end
child = GetControl(control, "Sales")
- child:SetColor(0,1,0)
- if salesThreshold > 0 and data.sales < salesThreshold then
- child:SetColor(1,0,0)
+ if integrationLoaded then
+ child:SetColor(0,1,0)
+ if salesThreshold > 0 and data.sales < salesThreshold then
+ child:SetColor(1,0,0)
+ end
+ else
+ child:SetColor(1,1,1)
end
child = GetControl(control, "Online")
@@ -356,17 +383,20 @@ function LeoGuildManagerMemberList:FilterScrollList()
local ignoreRank = guildData.ignoreRank
local ignoreNew = guildData.ignoreNew * LeoGuildManager.SECONDS_IN_DAY
local now = GetTimeStamp()
+ local guildId = LeoGuildManager.GetGuildId(LeoGuildManager.globalData.selectedGuild)
+ local canScan = LeoGuildManager.CanScanBankHistory(guildId)
+ local integrationLoaded = LeoGuildManager.HasIntegrationAddonsLoaded()
for i = 1, #self.masterList do
local data = self.masterList[i]
local canAdd = true
- if salesThreshold > 0 and ticketsThreshold > 0 and ( data.sales >= salesThreshold or data.deposits >= ticketsThreshold ) then
- canAdd = false
- elseif salesThreshold > 0 and data.sales >= salesThreshold then
+ if integrationLoaded and salesThreshold > 0 and data.sales >= salesThreshold then
canAdd = false
- elseif ticketsThreshold > 0 and data.deposits >= ticketsThreshold then
+ end
+ if canAdd and canScan and ticketsThreshold > 0 and data.deposits >= ticketsThreshold then
canAdd = false
end
+
--Add even if sold a lot??
if not canAdd and offlineThreshold > 0 and data.online > 0 and data.online > offlineThreshold then
canAdd = true
@@ -493,10 +523,11 @@ function LeoGuildManager.ListPurge()
local guildId = LeoGuildManager.GetGuildId(LeoGuildManager.globalData.selectedGuild)
local guildName = LeoGuildManager.globalData.selectedGuild
- if not DoesPlayerHaveGuildPermission(guildId, GUILD_PERMISSION_BANK_VIEW_GOLD) then
+ LeoGuildManager.GetGuildMembers(guildId)
+
+ --[[if not LeoGuildManager.CanScanBankHistory(guildId) then
LeoGuildManager.log("|cFF2222You don't have permission to scan guild gold deposits.|r")
- return
- end
+ end]]
if LeoGuildManager.globalData.settings.integration == LeoGuildManager.integrations[1] and (MasterMerchant == nil or
MasterMerchant.guildSales == nil or
@@ -504,7 +535,6 @@ function LeoGuildManager.ListPurge()
MasterMerchant.guildSales[guildName].sellers == nil)
then
LeoGuildManager.log("|cFF2222MasterMerchant sales data not found for this guild.|r Try again in a few moments if it is still initializing.")
- return
end
if LeoGuildManager.globalData.settings.integration == LeoGuildManager.integrations[2] and (ArkadiusTradeTools == nil or
@@ -512,37 +542,46 @@ function LeoGuildManager.ListPurge()
ArkadiusTradeTools.Modules.Sales == nil)
then
LeoGuildManager.log("|cFF2222ArkadiusTradeTools sales not found for this guild.|r Try again in a few moments if it is still initializing.")
- return
end
+ local canScan = LeoGuildManager.CanScanBankHistory(guildId)
+ local integrationLoaded = LeoGuildManager.HasIntegrationAddonsLoaded()
+
local cycle = LeoGuildManager.globalData.settings.guilds[guildName].cycle
local start, finish = getStartFinishFromCycle(cycle)
-
- if start == nil or finish == nil then
- LeoGuildManager.log("Error fetching cycle settings.")
+ if (start == nil or finish == nil) and (canScan == true or integrationLoaded == true) then
+ LeoGuildManager.log("Error fetching time frame settings.")
+ return
end
- if LeoGuildManager.scanData[guildName] == nil or LeoGuildManager.scanData[guildName][GUILD_HISTORY_BANK] == nil then return end
+ if canScan then
+ if LeoGuildManager.scanData[guildName] == nil or LeoGuildManager.scanData[guildName][GUILD_HISTORY_BANK] == nil then return end
- LeoGuildManager.GetGuildMembers(guildId)
+ for _, event in pairs(LeoGuildManager.scanData[guildName][GUILD_HISTORY_BANK].events) do
+ if event.type == GUILD_EVENT_BANKGOLD_ADDED and event.timeStamp >= start and event.timeStamp <= finish then
+ LeoGuildManager.AddDeposit(event.member, event.gold, event.timeStamp)
+ end
+ end
- for _, event in pairs(LeoGuildManager.scanData[guildName][GUILD_HISTORY_BANK].events) do
- if event.type == GUILD_EVENT_BANKGOLD_ADDED and event.timeStamp >= start and event.timeStamp <= finish then
- LeoGuildManager.AddDeposit(event.member, event.gold)
+ for i = 1, #LeoGuildManager.members do
+ local name = LeoGuildManager.members[i].name
+ if LeoGuildManager.UseTooltipRoster(guildName) and LeoGuildManager.scanData[guildName].members[name] ~= nil and
+ LeoGuildManager.scanData[guildName].members[name].joined ~= nil then
+ LeoGuildManager.SetJoined(name, LeoGuildManager.scanData[guildName].members[name].joined)
+ end
end
end
- for i = 1, #LeoGuildManager.members do
- local name = LeoGuildManager.members[i].name
- local sale = getSalesData(name, cycle, start, finish)
- if sale > 0 then
- LeoGuildManager.AddSale(name, sale)
- end
- if LeoGuildManager.scanData[guildName].members[name] ~= nil and
- LeoGuildManager.scanData[guildName].members[name].joined ~= nil then
- LeoGuildManager.SetJoined(name, LeoGuildManager.scanData[guildName].members[name].joined)
+ if integrationLoaded then
+ for i = 1, #LeoGuildManager.members do
+ local name = LeoGuildManager.members[i].name
+ local sale = getSalesData(name, cycle, start, finish)
+ if sale > 0 then
+ LeoGuildManager.AddSale(name, sale)
+ end
end
end
+
LeoGuildManagerMemberList:RefreshData()
end
@@ -581,6 +620,11 @@ function LeoGuildManagerUI.InitializeUI()
if not initializing then
LeoGuildManager.ClearList()
end
+ if LeoGuildManager.GuildNeedsScan(LeoGuildManager.GetGuildId(guildName)) then
+ LeoGuildManagerWindowPurgePanelScanButton:SetHidden(false)
+ else
+ LeoGuildManagerWindowPurgePanelScanButton:SetHidden(true)
+ end
end)
if not LeoGuildManager.globalData.selectedGuild then
LeoGuildManager.globalData.selectedGuild = guildName
@@ -623,4 +667,76 @@ function LeoGuildManager.GetTime(seconds)
else return 'online' end
end
+local function addLine(tooltip, text, color)
+ if not color then color = ZO_TOOLTIP_DEFAULT_COLOR end
+ local r, g, b = color:UnpackRGB()
+ tooltip:AddLine(text, "", r, g, b, CENTER, MODIFY_TEXT_TYPE_NONE, TEXT_ALIGN_LEFT, true)
+end
+
+local function addLineTitle(tooltip, text, color)
+ if not color then color = ZO_SELECTED_TEXT end
+ local r, g, b = color:UnpackRGB()
+ tooltip:AddLine(text, "ZoFontHeader3", r, g, b, CENTER, MODIFY_TEXT_TYPE_NONE, TEXT_ALIGN_CENTER, true)
+end
+
+function LeoGuildManagerUI.TooltipSales(control, visible)
+
+ if visible then
+ if not parent then parent = control end
+
+ local name = control:GetParent().data.name
+ if LeoGuildManager.HasIntegrationAddonsLoaded() then
+ local cycle = LeoGuildManager.cycleMM
+ if LeoGuildManager.globalData.settings.integration == "Arkadiu's Trade Tools" then
+ cycle = LeoGuildManager.cycleATT
+ end
+
+ InitializeTooltip(InformationTooltip, control, LEFT, 5, 0)
+ addLineTitle(InformationTooltip, "Sales")
+ for _, cycleData in pairs(cycle) do
+ local cycleId = cycleData.id
+ local start, finish = getStartFinishFromCycle(cycleId)
+
+ if start ~= nil and finish ~= nil then
+ local sale = getSalesData(name, cycleId, start, finish)
+ if sale > 0 then
+ addLine(InformationTooltip, cycleData.name .. ": |c"..LeoGuildManager.color.hex.white.. LeoGuildManager.formatNumber(sale).."|r")
+ end
+ end
+ end
+ InformationTooltip:SetHidden(false)
+ InformationTooltipTopLevel:BringWindowToTop()
+ end
+
+ else
+ ClearTooltip(InformationTooltip)
+ InformationTooltip:SetHidden(true)
+ end
+end
+
+function LeoGuildManagerUI.TooltipDeposits(control, visible)
+
+ if visible then
+ if not parent then parent = control end
+
+ local guildName = LeoGuildManager.globalData.selectedGuild
+ local guildId = LeoGuildManager.GetGuildId(guildName)
+ local name = control:GetParent().data.name
+ if LeoGuildManager.CanScanBankHistory(guildId) then
+ InitializeTooltip(InformationTooltip, control, LEFT, 5, 0)
+ addLineTitle(InformationTooltip, "Deposits")
+ local member = LeoGuildManager.GetGuildMember(name)
+ for _, deposit in pairs(member.depositEvents) do
+ addLine(InformationTooltip, LeoGuildManager.TimeAgo(deposit.timestamp) .. ": |c"..LeoGuildManager.color.hex.white.. LeoGuildManager.formatNumber(deposit.value).."|r")
+ end
+ InformationTooltip:SetHidden(false)
+ InformationTooltipTopLevel:BringWindowToTop()
+ end
+
+ else
+ ClearTooltip(InformationTooltip)
+ InformationTooltip:SetHidden(true)
+ end
+end
+
ZO_CreateStringId('SI_BINDING_NAME_LEOGM_TOGGLE_WINDOW', "Show/Hide Main Window")
diff --git a/Settings.lua b/Settings.lua
index 93ea00c..6d02b6c 100644
--- a/Settings.lua
+++ b/Settings.lua
@@ -44,12 +44,6 @@ function LeoGuildManagerSettings:CreatePanel()
getFunc = function() return LeoGuildManager.globalData.settings.scanAutomatically end,
setFunc = function(value) LeoGuildManager.globalData.settings.scanAutomatically = value end,
},{
- type = "checkbox",
- name = "Add guild roster tooltip",
- default = false,
- getFunc = function() return LeoGuildManager.globalData.settings.tooltipRoster end,
- setFunc = function(value) LeoGuildManager.globalData.settings.tooltipRoster = value end,
- },{
type = "header",
name = "|c3f7fffGuilds|r"
}
@@ -78,123 +72,161 @@ function LeoGuildManagerSettings:CreatePanel()
local ranks = LeoGuildManager.GetGuildRanks(guildId)
ranks[0] = "disabled"
+ local purgeWarning = ""
+ if not LeoGuildManager.CanScanBankHistory(guildId) then
+ purgeWarning = "To use deposits/tickets, you need guild permission to 'View Bank Gold'."
+ end
+ if not LeoGuildManager.HasIntegrationAddonsLoaded() then
+ if purgeWarning ~= "" then
+ purgeWarning = purgeWarning .. "\n"
+ end
+ purgeWarning = "For purge using sales, you Master Merchant or Arkadiu's Trade Tools installed|r"
+ end
+ if purgeWarning ~= "" then
+ purgeWarning = "|c"..LeoGuildManager.color.hex.red..purgeWarning
+ end
+
table.insert(optionsData, {
type = "submenu",
name = guild,
- disabled = true,
controls = {
{
- type = "header",
- name = "|c3f7fffPurge|r"
- },{
- type = "description",
- text = "|c"..LeoGuildManager.color.hex.red.."This module requires Master Merchant or Arkadiu's Trade Tools|r",
- },{
- type = "description",
- text = "",
- reference = "LeoGuildManagerSettingsRequirementsDescription" .. guildId
- },{
- type = "dropdown",
- name = "Cycle duration",
- tooltip = "When running a purge, the search for sales and deposits will use this range of time. The values are taken from the Addon selected above.",
- choices = LeoGuildManager.GetCycles(),
- getFunc = function() return LeoGuildManager.GetCycleName(LeoGuildManager.globalData.settings.guilds[guild].cycle) end,
- setFunc = function(value) LeoGuildManager.globalData.settings.guilds[guild].cycle = LeoGuildManager.GetCycleIdByName(value) end
- },{
- type = "dropdown",
- name = "Ignore members with rank equal or above",
- choices = ranks,
- getFunc = function()
- local name = LeoGuildManager.GetGuildRankName(guildId, LeoGuildManager.globalData.settings.guilds[guild].ignoreRank)
- if name == nil then name = "disabled" end
- return name
- end,
- setFunc = function(value)
- LeoGuildManager.globalData.settings.guilds[guild].ignoreRank = LeoGuildManager.GetGuildRankId(guildId, value)
- end
- },{
- type = "dropdown",
- name = "Ignore new members",
- tooltip = "Recently added members need some time to start, right? :)",
- choices = {
- "1 week",
- "2 weeks",
- "3 weeks",
- "1 month",
- },
- getFunc = function()
- local value = LeoGuildManager.globalData.settings.guilds[guild].ignoreNew
- return LeoGuildManager.GetNewRangeName(value)
- end,
- setFunc = function(value)
- if value == "1 week" then value = 7
- elseif value == "2 weeks" then value = 14
- elseif value == "3 weeks" then value = 21
- else value = 30 end
- LeoGuildManager.globalData.settings.guilds[guild].ignoreNew = value
- end
- },{
- type = "slider",
- name = "Deposits / Tickets bought (in k)",
- tooltip = "Required value (deposits or tickets value) to be deposited",
- width = "half",
- getFunc = function() return LeoGuildManager.globalData.settings.guilds[guild].tickets end,
- setFunc = function(value) LeoGuildManager.globalData.settings.guilds[guild].tickets = value end,
- min = 0,
- max = 100,
- default = 10,
- },{
- type = "slider",
- name = "Sales (in k)",
- tooltip = "Required value of sales",
- width = "half",
- getFunc = function() return LeoGuildManager.globalData.settings.guilds[guild].sales end,
- setFunc = function(value) LeoGuildManager.globalData.settings.guilds[guild].sales = value end,
- min = 0,
- max = 1000,
- default = 150,
- }, {
- type = "slider",
- name = "Inactivity (in days)",
- width = "half",
- getFunc = function() return LeoGuildManager.globalData.settings.guilds[guild].inactivity end,
- setFunc = function(value) LeoGuildManager.globalData.settings.guilds[guild].inactivity = value end,
- min = 0,
- max = 120,
- default = 30,
- },{
- type = "header",
- name = "|c3f7fffBlacklist|r"
- },{
- type = "description",
- text = "You can add members to a blacklist and be warned when they are online and even automatically kick them from the guild."
- },{
- type = "checkbox",
- name = "Warning in chat when member is online",
- default = true,
- getFunc = function() return LeoGuildManager.GetWarnOnline(guild) end,
- setFunc = function(value) LeoGuildManager.SetWarnOnline(guild, value) end,
- },{
type = "checkbox",
- name = "|c"..LeoGuildManager.color.hex.red.."Automatically|r kick members",
+ name = "Add guild roster tooltip",
default = false,
- getFunc = function() return LeoGuildManager.GetAutoKick(guild) end,
- setFunc = function(value) LeoGuildManager.SetAutoKick(guild, value) end,
+ warning = "This feature requires periodic guild scan.",
+ getFunc = function() LeoGuildManager.UseTooltipRoster(guild) end,
+ setFunc = function(value) LeoGuildManager.SetTooltipRoster(guild, value) end,
},{
- type = "button",
- name = "Edit List",
- width = "half",
- func = function()
- ZO_Dialogs_ShowDialog("EDIT_NOTE", {
- displayName = "One UserID per line",
- note = table.concat(LeoGuildManager.globalData.settings.guilds[guild].blacklist, "\n"),
- changedCallback = function(displayName, text) LeoGuildManagerWindow.OnBlacklistChanged(guildId, guild, text) end
- })
- end,
+ type = "submenu",
+ name = "|c3f7fffPurge|r",
+ controls = {
+ {
+ type = "description",
+ text = "|c"..LeoGuildManager.color.hex.red..purgeWarning,
+ },{
+ type = "description",
+ text = "",
+ reference = "LeoGuildManagerSettingsRequirementsDescription" .. guildId
+ },{
+ type = "dropdown",
+ name = "Time frame",
+ tooltip = "When running a purge, the search for sales and deposits will use this range of time. The values are taken from the Addon selected above.",
+ choices = LeoGuildManager.GetCycles(),
+ getFunc = function() return LeoGuildManager.GetCycleName(LeoGuildManager.globalData.settings.guilds[guild].cycle) end,
+ setFunc = function(value) LeoGuildManager.globalData.settings.guilds[guild].cycle = LeoGuildManager.GetCycleIdByName(value) end
+ },{
+ type = "dropdown",
+ name = "Ignore members with rank equal or above",
+ choices = ranks,
+ getFunc = function()
+ local name = LeoGuildManager.GetGuildRankName(guildId, LeoGuildManager.globalData.settings.guilds[guild].ignoreRank)
+ if name == nil then name = "disabled" end
+ return name
+ end,
+ setFunc = function(value)
+ LeoGuildManager.globalData.settings.guilds[guild].ignoreRank = LeoGuildManager.GetGuildRankId(guildId, value)
+ end
+ },{
+ type = "dropdown",
+ name = "Ignore new members",
+ tooltip = "Recently added members need some time to start, right? :)",
+ choices = {
+ "1 week",
+ "2 weeks",
+ "3 weeks",
+ "1 month",
+ },
+ getFunc = function()
+ local value = LeoGuildManager.globalData.settings.guilds[guild].ignoreNew
+ return LeoGuildManager.GetNewRangeName(value)
+ end,
+ setFunc = function(value)
+ if value == "1 week" then value = 7
+ elseif value == "2 weeks" then value = 14
+ elseif value == "3 weeks" then value = 21
+ else value = 30 end
+ LeoGuildManager.globalData.settings.guilds[guild].ignoreNew = value
+ end
+ },{
+ type = "slider",
+ name = "Deposits / Tickets bought (in k)",
+ tooltip = "Required value (deposits or tickets value) to be deposited",
+ width = "half",
+ disabled = function() return not LeoGuildManager.CanScanBankHistory(guildId) end,
+ getFunc = function() return LeoGuildManager.globalData.settings.guilds[guild].tickets end,
+ setFunc = function(value) LeoGuildManager.globalData.settings.guilds[guild].tickets = value end,
+ min = 0,
+ max = 100,
+ default = 10,
+ },{
+ type = "slider",
+ name = "Sales (in k)",
+ tooltip = "Required value of sales",
+ width = "half",
+ disabled = function() return not LeoGuildManager.HasIntegrationAddonsLoaded() end,
+ getFunc = function() return LeoGuildManager.globalData.settings.guilds[guild].sales end,
+ setFunc = function(value) LeoGuildManager.globalData.settings.guilds[guild].sales = value end,
+ min = 0,
+ max = 1000,
+ default = 150,
+ }, {
+ type = "slider",
+ name = "Inactivity (in days)",
+ width = "half",
+ getFunc = function() return LeoGuildManager.globalData.settings.guilds[guild].inactivity end,
+ setFunc = function(value) LeoGuildManager.globalData.settings.guilds[guild].inactivity = value end,
+ min = 0,
+ max = 120,
+ default = 30,
+ }
+ }
},{
- type = "description",
- text = "Members: " .. table.concat(LeoGuildManager.globalData.settings.guilds[guild].blacklist, ", "),
- reference = "LeoGuildManagerSettingsBlacklistLabel" .. guildId
+ type = "submenu",
+ name = "|c3f7fffBlacklist|r",
+ controls = {
+ {
+ type = "description",
+ text = "You can add members to a blacklist and be warned when they are online and even automatically kick them from the guild."
+ }, {
+ type = "checkbox",
+ name = "Warning in chat when member is online",
+ default = true,
+ getFunc = function()
+ return LeoGuildManager.GetWarnOnline(guild)
+ end,
+ setFunc = function(value)
+ LeoGuildManager.SetWarnOnline(guild, value)
+ end,
+ }, {
+ type = "checkbox",
+ name = "|c" .. LeoGuildManager.color.hex.red .. "Automatically|r kick members",
+ default = false,
+ getFunc = function()
+ return LeoGuildManager.GetAutoKick(guild)
+ end,
+ setFunc = function(value)
+ LeoGuildManager.SetAutoKick(guild, value)
+ end,
+ }, {
+ type = "button",
+ name = "Edit List",
+ width = "half",
+ func = function()
+ ZO_Dialogs_ShowDialog("EDIT_NOTE", {
+ displayName = "One UserID per line",
+ note = table.concat(LeoGuildManager.globalData.settings.guilds[guild].blacklist, "\n"),
+ changedCallback = function(displayName, text)
+ LeoGuildManagerWindow.OnBlacklistChanged(guildId, guild, text)
+ end
+ })
+ end,
+ }, {
+ type = "description",
+ text = "Members: " .. table.concat(LeoGuildManager.globalData.settings.guilds[guild].blacklist, ", "),
+ reference = "LeoGuildManagerSettingsBlacklistLabel" .. guildId
+ }
+ }
}
}
})