diff --git a/UI.lua b/UI.lua index f44f9e1..81a3993 100644 --- a/UI.lua +++ b/UI.lua @@ -7,7 +7,7 @@ function WellEater:initSettingsMenu() local optionsTable = {} local index = 0 - local function MakeControlEntry(data, category, key) + local function MakeControlEntry(optTable, data, category, key) if (category and key) then -- for the majority of the settings @@ -48,10 +48,29 @@ function WellEater:initSettingsMenu() end -- add to appropriate table - table.insert(optionsTable, data) + table.insert(optTable, data) + return optTable end + local function MakeSubmenu(optTable, title, description) + local subTable = {} + MakeControlEntry(optTable,{ + type = "submenu", + name = title, + controls = subTable, + }) + MakeControlEntry(subTable, { + type = "description", + text = description, + }) + MakeControlEntry(subTable,{ + type = "divider", + alpha = 1, + }) + return subTable + end + self.panelData = { type = "panel", @@ -62,17 +81,17 @@ function WellEater:initSettingsMenu() registerForDefaults = true, } - MakeControlEntry({ + MakeControlEntry(optionsTable,{ type = "description", text = L.generalSetupDescription, }) - MakeControlEntry({ + MakeControlEntry(optionsTable,{ type = "header", name = L.timerSetupHeader, }) - MakeControlEntry({ + MakeControlEntry(optionsTable,{ type = "slider", name = L.timerSetupLabel, tooltip = L.timerSetupLabel_TT, @@ -86,25 +105,36 @@ function WellEater:initSettingsMenu() }, "general", "updateTime") - MakeControlEntry({ - type = "header", - name = L.foodQualityHeader, - }) + local sTable = MakeSubmenu(optionsTable,L.mealSetupHeader, L.mealSetupDescription) + + MakeControlEntry(sTable,{ + type = "checkbox", + name = L.mealSetupFood, + tooltip = L.mealSetupFood, + }, "general", "useFood") + + MakeControlEntry(sTable,{ + type = "checkbox", + name = L.mealSetupDrink, + tooltip = L.mealSetupDrink, + }, "general", "useDrink") + + sTable = MakeSubmenu(optionsTable,L.foodQualityHeader, L.foodQualityDescription) for i = ITEM_QUALITY_MAGIC, ITEM_QUALITY_LEGENDARY do - MakeControlEntry({ + MakeControlEntry(sTable,{ type = "checkbox", name = L.foods[i], tooltip = L.foods[i], }, "general", i) end - MakeControlEntry({ + MakeControlEntry(optionsTable,{ type = "header", name = L.outputSetupHeader, }) - MakeControlEntry({ + MakeControlEntry(optionsTable,{ type = "checkbox", name = L.outputOnScreen, tooltip = L.outputSetupHeader_TT, diff --git a/WellEater.lua b/WellEater.lua index a00cb07..ad2d694 100644 --- a/WellEater.lua +++ b/WellEater.lua @@ -2,7 +2,7 @@ WellEater = WellEater or {} WellEater.WELLEATER_SAVED_VERSION = 1 WellEater.AddonName = "WellEater" WellEater.DisplayName = "|cFFFFFFWell |c0099FFEater|r" -WellEater.Version = "1.0.0" +WellEater.Version = "1.0.1" WellEater.Author = "|c5EFFF5esorochinskiy|r" local NAMESPACE = {} NAMESPACE.settingsDefaults = { @@ -13,6 +13,8 @@ NAMESPACE.settingsDefaults = { [ITEM_QUALITY_ARTIFACT] = false, [ITEM_QUALITY_LEGENDARY] = false, notifyToScreen = true, + useFood = true, + useDrink = true, } function WellEater:getAddonName() @@ -141,11 +143,15 @@ local function processAutoEat() for _, itemInfo in pairs(bagCache) do local locSettings = WellEater:getAllUserPreferences() + local useFood = locSettings.useFood + local useDrink = locSettings.useDrink local slotId = itemInfo.slotIndex if not itemInfo.stolen then local itemType, specialType = GetItemType(bagId, slotId) local itemId = GetItemId(bagId, slotId) - if (itemType == ITEMTYPE_FOOD or itemType == ITEMTYPE_DRINK) and not SkillUpItem(itemId) then + if ((useFood and itemType == ITEMTYPE_FOOD) or + (useDrink and itemType == ITEMTYPE_DRINK)) and + not SkillUpItem(itemId) then local icon, stack, sellPrice, meetsUsageRequirement, locked, equipType, itemStyleId, quality = GetItemInfo(bagId, slotId) if meetsUsageRequirement and locSettings and locSettings[quality] then @@ -161,6 +167,7 @@ local function processAutoEat() if formattedName and abilityDescription then local toScreen = locSettings.notifyToScreen if toScreen then + WellEater.AnimIn:PlayFromStart() WellEaterIndicator:SetHidden(false) WellEaterIndicatorLabel:SetText(formattedName) end @@ -193,6 +200,7 @@ local function TimersUpdate() foodQuantity = timeEnding * 1000 - now haveFood = (bFood and (foodQuantity > 0)) if haveFood then + WellEater.AnimOut:PlayFromStart() WellEaterIndicator:SetHidden(true) break end @@ -348,6 +356,11 @@ local function InitOnLoad(_, addonName) -- local lamPanel = WellEater:initSettingsMenu() + WellEater.AnimIn = ANIMATION_MANAGER:CreateTimelineFromVirtual( + "WellEaterAnnounceFadeIn", WellEaterIndicatorLabel) + WellEater.AnimOut = ANIMATION_MANAGER:CreateTimelineFromVirtual( + "WellEaterAnnounceFadeOut", WellEaterIndicatorLabel) + -- lamPanel:SetHandler("OnEffectivelyHidden", OnSettingsClosed) end diff --git a/WellEater.txt b/WellEater.txt index fcacd81..c497a44 100644 --- a/WellEater.txt +++ b/WellEater.txt @@ -31,7 +31,7 @@ ## Author: |c5EFFF5esorochinskiy|r ## APIVersion: 101033 ## Description: Auto eat your preferred meals provided by your inventory after food or drink buff expiration. -## Version: 1.0.0 +## Version: 1.0.1 ## SavedVariables: WellEater_Settings ## DependsOn: LibAddonMenu-2.0>=28 diff --git a/WellEater.xml b/WellEater.xml index c16c05f..e7d191d 100644 --- a/WellEater.xml +++ b/WellEater.xml @@ -1,11 +1,23 @@ <GuiXml> + <Animations> + <AnimationTimeline name="WellEaterAnnounceFadeIn"> + <Animations> + <AlphaAnimation duration="500" startAlpha="0" endAlpha="1" /> + </Animations> + </AnimationTimeline> + <AnimationTimeline name="WellEaterAnnounceFadeOut"> + <Animations> + <AlphaAnimation duration="500" startAlpha="1" endAlpha="0" /> + </Animations> + </AnimationTimeline> + + </Animations> <Controls> <TopLevelControl name="WellEaterIndicator"> <Dimensions x="200" y="25" /> <Anchor point="CENTER" relativeTo="GuiRoot" relativePoint="CENTER" /> - <Controls> - <Label name="$(parent)Label" width="300" height="40" font="ZoFontWinH4" inheritAlpha="true" color="FFFFFF" + <Label name="$(parent)Label" width="300" height="40" font="ZoFontWinH2" inheritAlpha="true" color="FFFFFF" wrapMode="TRUNCATE" verticalAlignment="TOP" horizontalAlignment="CENTER"> <Anchor point="TOP" relativeTo="$(parent)" relativePoint="TOP" /> </Label> diff --git a/lang/de.lua b/lang/de.lua index cf03924..3ed1df9 100644 --- a/lang/de.lua +++ b/lang/de.lua @@ -1,7 +1,8 @@ WellEater = WellEater or {} local L = { - generalSetupDescription = "Lässt es Ihnen nach der Wirkzeit von dem Essen im Inventar gefundene Gericht automatisch essen", + generalSetupDescription = "Lässt es Ihnen, nach die Essen- oder Trinken-Bufffs auslaufen, im Inventar gefundene Gericht automatisch essen", foodQualityHeader = "Die Qualität der suchenden Lebensmittel", + foodQualityDescription = "Lasst die Qualität der Lebensmittel auswahlen", foods = { [ITEM_QUALITY_MAGIC] = "Gut (grün)", [ITEM_QUALITY_ARCANE] = "Ausgezeichnet (blau)", @@ -20,8 +21,16 @@ local L = { outputSetupHeader_TT = "Wenn die Einstellung aktiviert ist, wird eine Nachricht über das gegessene Gericht" .. " auf dem Bildschirm angezeigt, und nicht nur zum Debug-Log", + mealSetupHeader = "Gerichtart", + mealSetupDescription = "Was zu verwenden: Essen oder Trinken. ACHTUNG Wenn die Beide ausgeschaltet sind," .. + " dann wird kein Essen verwendet, denn ist es egal, der Addon ausgeschaltet wird. Schalten Sie mindestens" .. + " einen ein", + + mealSetupFood = "Essen", + mealSetupDrink = "Trinken", + } function WellEater:getLocale() return L -end \ No newline at end of file +end diff --git a/lang/en.lua b/lang/en.lua index ebf6c43..16c50f5 100644 --- a/lang/en.lua +++ b/lang/en.lua @@ -2,6 +2,7 @@ WellEater = WellEater or {} local L = { generalSetupDescription = "Auto eat your preferred meals provided by your inventory after food or drink buff expiration", foodQualityHeader = "Quality of food to search", + foodQualityDescription = "Allows to choose the quality of the food", foods = { [ITEM_QUALITY_MAGIC] = "Normal (green)", [ITEM_QUALITY_ARCANE] = "Excellent (blue)", @@ -17,6 +18,14 @@ local L = { outputSetupHeader = "Meal eaten notification output", outputOnScreen = "On screen", outputSetupHeader_TT = "When on the notification about the meal eaten is written to the screen not only to the debug log", + + mealSetupHeader = "Kind of meal to use", + mealSetupDescription = "What kind of meal to use: food or drink. WARNING If both are off then" .. + " there will be no choice made, that is the same as the addon is disabled. Leave at least one on", + + mealSetupFood = "Food", + mealSetupDrink = "Drink", + } function WellEater:getLocale() diff --git a/lang/ru.lua b/lang/ru.lua index f99080b..a693a78 100644 --- a/lang/ru.lua +++ b/lang/ru.lua @@ -2,6 +2,7 @@ WellEater = WellEater or {} local L = { generalSetupDescription = "После истечения времени эффектов, которые дает еда, позволяет автоматически съесть найденное в инвентаре блюдо", foodQualityHeader = "Качество искомой еды", + foodQualityDescription = "Позволяет выбрать качество еды", foods = { [ITEM_QUALITY_MAGIC] = "Хорошее (зеленое)", [ITEM_QUALITY_ARCANE] = "Превосходное (синее)", @@ -20,6 +21,13 @@ local L = { outputSetupHeader_TT = "При включенной настройке сообщение о съеденном блюде будет выведено на экран, а не только" .. " в лог отладки", + mealSetupHeader = "Тип блюда", + mealSetupDescription = "Что использовать: еду или питье. ВНИМАНИЕ Если отключить оба, " .. + " выбора не будет, что равносильно отключению аддона. Включите хотя бы один.", + + mealSetupFood = "Еда", + mealSetupDrink = "Напиток", + } function WellEater:getLocale()