typo fix

esorochinskiy [05-31-22 - 11:28]
typo fix
Filename
UI.lua
WellEater.lua
lang/en.lua
lang/ru.lua
diff --git a/UI.lua b/UI.lua
index 90da634..4f12406 100644
--- a/UI.lua
+++ b/UI.lua
@@ -1,6 +1,6 @@
 WellEater = WellEater or {}

-function WellEater:InitSettingsMenu()
+function WellEater:initSettingsMenu()

     local L = self:getLocale()
     local LAM = LibAddonMenu2
@@ -41,6 +41,8 @@ function WellEater:InitSettingsMenu()
             end
             if not data.setFunc then
                 data.setFunc = function(value)
+                    d("New value of" .. data.key .. " is")
+		    d(value)
                     self:setUserPreference(data.key, value)
                 end
             end
@@ -69,6 +71,26 @@ function WellEater:InitSettingsMenu()

     MakeControlEntry({
         type = "header",
+        name = L.timerSetupHeader,
+    })
+
+    MakeControlEntry({
+        type = "slider",
+        name = L.timerSetupLabel,
+        tooltip = L.timerSetupLabel_TT,
+        setFunc = function(value)
+                    d("New value of updayeYime is")
+                    d(value)
+
+            self:setUserPreference("updateTime", value)
+            self.InterfaceHook_OnTimerSlider()
+        end,
+        min = 1000, max = 3000, step = 100,
+        noAlert = true,
+    }, "general", "updateTime")
+
+    MakeControlEntry({
+        type = "header",
         name = L.generalSetupHeader,
     })

@@ -108,9 +130,10 @@ function WellEater:InitSettingsMenu()
         noAlert = true,
     }, "general", "maxQuality")

-    self.optionsData = optionsTable

-    local myLAMAddonPanel = LAM:RegisterAddonPanel(self:getAddonName() .. "_Settings_Panel", self.panelData)
+    self.optionsData = optionsTable
+    -- local myLAMAddonPanel =
+    LAM:RegisterAddonPanel(self:getAddonName() .. "_Settings_Panel", self.panelData)
     LAM:RegisterOptionControls(self:getAddonName() .. "_Settings_Panel", self.optionsData)
-    return myLAMAddonPanel
-end
\ No newline at end of file
+    -- return myLAMAddonPanel
+end
diff --git a/WellEater.lua b/WellEater.lua
index 79eabeb..fdc5e72 100644
--- a/WellEater.lua
+++ b/WellEater.lua
@@ -57,7 +57,7 @@ function WellEater:prepareToAnalize()
     return self:isAddonEnabled() and not IsUnitInCombat("player")
             and not IsUnitSwimming("player") and not IsUnitDead("player")
 end
--- local functions
+

 -- Raid Notifier algorithm. Thanx memus
 NAMESPACE.blackList = {
@@ -75,7 +75,7 @@ NAMESPACE.blackList = {
     [89683] = true, -- erhöhter Erfahrungsgewinn
     [91369] = true, -- erhöhter Erfahrungsgewinn der Narrenpastete
 }
-
+-- local functions
 local function getActiveFoodBuff(abilityId)
     if NAMESPACE.blackList[abilityId] then
         return false
@@ -195,16 +195,12 @@ local function StartUp()
 end

 local function ShutDown()
-    d("Shutdown minQ = " .. WellEater.settingsUser.minQuality)
-    d("Shutdown maxQ = " .. WellEater.settingsUser.maxQuality)
+    d(WellEater.AddonName .. " Shutdown minQ = " .. WellEater.settingsUser.minQuality)
+    d(WellEater.AddonName .. " Shutdown maxQ = " .. WellEater.settingsUser.maxQuality)
     d(WellEater.AddonName .. " Timer cancelled")
     EVENT_MANAGER:UnregisterForUpdate(WellEater.AddonName .. "_TimersUpdate")
 end

-local function OnSettingsClosed()
-    ShutDown()
-    StartUp()
-end

 local function OnUIError(_,errorString)
     --Hide some bugs
@@ -298,13 +294,49 @@ local function InitOnLoad(_, addonName)
             end
     )

+    -- EVENT_PLAYER_ACTIVATED
+    EVENT_MANAGER:RegisterForEvent(
+            WellEater.AddonName,
+            EVENT_PLAYER_ACTIVATED,
+            function(_,initial)
+                if initial then
+                    if not WellEater:isAddonEnabled() then
+                        return
+                    end
+
+                    d(WellEater.AddonName .. " Active")
+                    StartUp()
+                end
+            end
+    )
+
+-- EVENT_PLAYER_DEACTIVATED
+    EVENT_MANAGER:RegisterForEvent(
+            WellEater.AddonName,
+            EVENT_PLAYER_DEACTIVATED,
+            function()
+                if not WellEater:isAddonEnabled() then
+                    return
+                end
+                d(WellEater.AddonName .. " Inactive")
+                ShutDown()
+            end
+    )
+
     EVENT_MANAGER:RegisterForEvent(WellEater.AddonName, EVENT_LUA_ERROR, OnUIError)

-    local lamPanel = WellEater:InitSettingsMenu()
-    lamPanel:SetHandler("OnEffectivelyHidden", OnSettingsClosed)
+    -- local lamPanel =
+    WellEater:initSettingsMenu()
+    -- lamPanel:SetHandler("OnEffectivelyHidden", OnSettingsClosed)
+end
+
+-- @static global only
+function WellEater.InterfaceHook_OnTimerSlider()
+    ShutDown()
     StartUp()
 end

+
 -- Init Hook --
 EVENT_MANAGER:RegisterForEvent(
         WellEater.AddonName, EVENT_ADD_ON_LOADED, InitOnLoad)
diff --git a/lang/en.lua b/lang/en.lua
index 1b72ffa..d0f10d7 100644
--- a/lang/en.lua
+++ b/lang/en.lua
@@ -8,6 +8,11 @@ local L = {
     foodBlue = "Excellent (blue)",
     foodCyan = "Artifact (cyan)",
     foodGold = "Legendary (gold)",
+
+    timerSetupHeader = "Inventory Scan Timer",
+    timerSetupLabel = "Scan period, ms",
+    timerSetupLabel_TT = "How often the inventory is scanned for food. The more the better but more probably " ..
+            "you can run out of food for a long time in critical situation",
 }

 function WellEater:getLocale()
diff --git a/lang/ru.lua b/lang/ru.lua
index 29b7b22..ae75fe7 100644
--- a/lang/ru.lua
+++ b/lang/ru.lua
@@ -8,6 +8,12 @@ local L = {
     foodBlue = "Превосходное (синее)",
     foodCyan = "Эпическое (фиолетовое)",
     foodGold = "Легендарное (золотое)",
+
+    timerSetupHeader = "Таймер опроса инвентаря",
+    timerSetupLabel = "Период опроса, мс",
+    timerSetupLabel_TT = "Как часто инвентарь сканируется на наличие еды." ..
+    "Большее значение - меньше нагрузка но большая вероятность оказаться без еды на некоторое время "..
+    "в критической ситуации",
 }

 function WellEater:getLocale()