New release

Leandro Silva [11-11-18 - 22:30]
New release
Filename
LeoGuildManager.lua
LeoGuildManager.txt
LeoGuildManagerInit.lua
LeoGuildManagerUI.lua
Settings.lua
diff --git a/LeoGuildManager.lua b/LeoGuildManager.lua
index 4a447d0..34a6d39 100644
--- a/LeoGuildManager.lua
+++ b/LeoGuildManager.lua
@@ -14,6 +14,25 @@ local eventTooOld = {}
 local scanInterval = 5 * LeoGuildManager.MS_IN_MINUTE
 local shortScanInterval = 2000

+function LeoGuildManager.SetWarnOnline(guildName, value)
+    LeoGuildManager.globalData.settings.guilds[guildName].warnOnline = value
+end
+function LeoGuildManager.GetWarnOnline(guildName)
+    if LeoGuildManager.globalData.settings.guilds[guildName].warnOnline == nil then
+        LeoGuildManager.globalData.settings.guilds[guildName].warnOnline = true
+    end
+    return LeoGuildManager.globalData.settings.guilds[guildName].warnOnline
+end
+function LeoGuildManager.SetAutoKick(guildName, value)
+    LeoGuildManager.globalData.settings.guilds[guildName].autoKick = value
+end
+function LeoGuildManager.GetAutoKick(guildName)
+    if LeoGuildManager.globalData.settings.guilds[guildName].autoKick == nil then
+        LeoGuildManager.globalData.settings.guilds[guildName].autoKick = false
+    end
+    return LeoGuildManager.globalData.settings.guilds[guildName].autoKick
+end
+
 function LeoGuildManager.formatNumber(amount)
     if amount == nil then return nil; end
     if type(amount) == "string" then amount = tonumber( amount ) end
@@ -350,6 +369,8 @@ function LeoGuildManager.Initialize()
             integration = LeoGuildManager.integrations[1],
             tooltipRoster = false,
             scanAutomatically = false,
+            autoKick = false,
+            warnOnline = true,
             guilds = {},
         }
     end
@@ -488,28 +509,26 @@ function LeoGuildManager.ProcessEvent(guildId, category, eventIndex)
         LeoGuildManager.scanData[guildName][category].firstEvent = timeStamp
     end

-    initMemberScanData(guildName, displayName)
-    if (LeoGuildManager.scanData[guildName].members[displayName] ~= nil) then
-        if (category == GUILD_HISTORY_GENERAL) then
-            if (evType == GUILD_EVENT_GUILD_JOIN) then
-                LeoGuildManager.scanData[guildName].members[displayName].joined = timeStamp
-            elseif (evType == GUILD_EVENT_GUILD_INVITE) then
-                initMemberScanData(guildName, param2)
-                LeoGuildManager.scanData[guildName].members[param2].invited = timeStamp
-                LeoGuildManager.scanData[guildName].members[param2].invitedBy = param1
-            end
+    if (category == GUILD_HISTORY_GENERAL) then
+        if (evType == GUILD_EVENT_GUILD_JOIN) then
+            initMemberScanData(guildName, displayName)
+            LeoGuildManager.scanData[guildName].members[displayName].joined = timeStamp
+        elseif (evType == GUILD_EVENT_GUILD_INVITE) then
+            initMemberScanData(guildName, param2)
+            LeoGuildManager.scanData[guildName].members[param2].invited = timeStamp
+            LeoGuildManager.scanData[guildName].members[param2].invitedBy = param1
         end
+    end

-        if category == GUILD_HISTORY_BANK and (evType == GUILD_EVENT_BANKGOLD_ADDED or evType == GUILD_EVENT_BANKGOLD_REMOVED) and
-                eventIdNum ~= 0 then
-            if LeoGuildManager.scanData[guildName][category].events[eventIdNum] == nil then
-                LeoGuildManager.scanData[guildName][category].events[eventIdNum] = {
-                    type = evType,
-                    timeStamp = timeStamp,
-                    member = displayName,
-                    gold = param2
-                }
-            end
+    if category == GUILD_HISTORY_BANK and (evType == GUILD_EVENT_BANKGOLD_ADDED or evType == GUILD_EVENT_BANKGOLD_REMOVED) and
+            eventIdNum ~= 0 then
+        if LeoGuildManager.scanData[guildName][category].events[eventIdNum] == nil then
+            LeoGuildManager.scanData[guildName][category].events[eventIdNum] = {
+                type = evType,
+                timeStamp = timeStamp,
+                member = displayName,
+                gold = param2
+            }
         end
     end
 end
diff --git a/LeoGuildManager.txt b/LeoGuildManager.txt
index 99d418e..9f9f72a 100644
--- a/LeoGuildManager.txt
+++ b/LeoGuildManager.txt
@@ -1,7 +1,7 @@
 ## Title: Leo's Guild Manager
 ## APIVersion: 100024 100025
-## Version: 1.1.1
-## AddOnVersion: 111
+## Version: 1.1.2
+## AddOnVersion: 112
 ## Author: |c39B027@LeandroSilva|r
 ## SavedVariables: LeoGuildManagerGlobalData LeoGuildManagerScanData
 ## OptionalDependsOn: LibStub LibFeedback LibAddonMenu-2.0
diff --git a/LeoGuildManagerInit.lua b/LeoGuildManagerInit.lua
index b821acc..ec0aab8 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.1"
+LeoGuildManager.version = "1.1.2"
 LeoGuildManager.chatPrefix = "|c39B027" .. LeoGuildManager.name .. "|r: "

 LeoGuildManager.TAB_PURGE = "Purge"
diff --git a/LeoGuildManagerUI.lua b/LeoGuildManagerUI.lua
index 459f5da..96d0c10 100644
--- a/LeoGuildManagerUI.lua
+++ b/LeoGuildManagerUI.lua
@@ -569,6 +569,7 @@ function LeoGuildManagerUI.InitializeUI()
     guildDropdown:ClearItems()

     local defaultItem
+    local initializing = true
     for _, guildName in pairs(LeoGuildManager.guilds) do
         if LeoGuildManager.globalData.settings.guilds[guildName].enabled == true then
             local guildEntry = guildDropdown:CreateItemEntry(guildName, function()
@@ -577,6 +578,9 @@ function LeoGuildManagerUI.InitializeUI()
                     local descPurge = LeoGuildManager.CreatePurgeDescription(guildName)
                     LeoGuildManagerWindowPurgePanelPurgeDesc:SetText("|c"..LeoGuildManager.color.hex.yellow..descPurge.."|r")
                 end
+                if not initializing then
+                    LeoGuildManager.ClearList()
+                end
             end)
             if not LeoGuildManager.globalData.selectedGuild then
                 LeoGuildManager.globalData.selectedGuild = guildName
@@ -591,6 +595,7 @@ function LeoGuildManagerUI.InitializeUI()
     if defaultItem ~= nil then
         guildDropdown:SelectItem(defaultItem)
     end
+    initializing = false

     LeoGuildManager.memberScroll = LeoGuildManagerMemberList:New(LeoGuildManagerWindowPurgePanelMemberScroll)

diff --git a/Settings.lua b/Settings.lua
index 9e6397e..93ea00c 100644
--- a/Settings.lua
+++ b/Settings.lua
@@ -172,14 +172,14 @@ function LeoGuildManagerSettings:CreatePanel()
                         type = "checkbox",
                         name = "Warning in chat when member is online",
                         default = true,
-                        getFunc = function() return true end,
-                        setFunc = function(value) end,
+                        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 = true,
-                        getFunc = function() return true end,
-                        setFunc = function(value) end,
+                        default = false,
+                        getFunc = function() return LeoGuildManager.GetAutoKick(guild) end,
+                        setFunc = function(value) LeoGuildManager.SetAutoKick(guild, value) end,
                     },{
                         type = "button",
                         name = "Edit List",