added glyphs deconstruction

Leandro Silva [04-11-20 - 14:15]
added glyphs deconstruction
Filename
Craft.lua
Deconstruct.lua
LeoTrainer.lua
LeoTrainer.txt
LeoTrainerConst.lua
Research.lua
Settings.lua
diff --git a/Craft.lua b/Craft.lua
index 9621e93..10a5418 100644
--- a/Craft.lua
+++ b/Craft.lua
@@ -174,6 +174,11 @@ function Craft.StartCraft(craftSkill)
 end

 function Craft.OnStationEnter(craftSkill)
+    if craftSkill == CRAFTING_TYPE_ENCHANTING then
+        LeoTrainer.nextStage()
+        return
+    end
+
     Craft.GetPatternIndexes(craftSkill)

     Craft.isCrafting = false
diff --git a/Deconstruct.lua b/Deconstruct.lua
index 92c2903..54d848d 100644
--- a/Deconstruct.lua
+++ b/Deconstruct.lua
@@ -92,6 +92,9 @@ function Deconstruct.DoDeconstruct(fromBags)

     KEYBIND_STRIP:RemoveKeybindButtonGroup(Deconstruct.keybindStripDescriptor)
     if #Deconstruct.queue > 0 then
+        if ENCHANTING.enchantingMode ~= ENCHANTING_MODE_EXTRACTION then
+            ZO_MenuBar_SelectDescriptor(ENCHANTING.modeBar, ENCHANTING_MODE_EXTRACTION)
+        end
         PrepareDeconstructMessage()
         for i, itemData in pairs(Deconstruct.queue) do
             for _, bagId in pairs(fromBags) do
@@ -114,7 +117,6 @@ function Deconstruct.ShouldDeconstruct(craftSkill)
 end

 function Deconstruct.OnStationEnter(craftSkill)
-    -- LeoTrainer.debug("deconstruct OnStationEnter")
     local line = LeoTrainer.CraftToLineSkill(craftSkill)
     local maxLevel = GetSkillLineDynamicInfo(SKILL_TYPE_TRADESKILL, line) == 50
     if #Deconstruct.queue > 0 and not maxLevel then
diff --git a/LeoTrainer.lua b/LeoTrainer.lua
index dd9de92..3a98e05 100644
--- a/LeoTrainer.lua
+++ b/LeoTrainer.lua
@@ -5,7 +5,8 @@ function LeoTrainer.IsInUsableStation()
     return station == CRAFTING_TYPE_BLACKSMITHING or
         station == CRAFTING_TYPE_WOODWORKING or
         station == CRAFTING_TYPE_CLOTHIER or
-        station == CRAFTING_TYPE_JEWELRYCRAFTING
+        station == CRAFTING_TYPE_JEWELRYCRAFTING or
+        station == CRAFTING_TYPE_ENCHANTING
 end

 function LeoTrainer.LLC_Completed(event, station, result)
@@ -140,13 +141,15 @@ local craftSkillsBySound = {
     [ITEM_SOUND_CATEGORY_TWO_HAND_AX]     = CRAFTING_TYPE_BLACKSMITHING,
     [ITEM_SOUND_CATEGORY_TWO_HAND_HAMMER] = CRAFTING_TYPE_BLACKSMITHING,
     [ITEM_SOUND_CATEGORY_TWO_HAND_SWORD]  = CRAFTING_TYPE_BLACKSMITHING,
+    [ITEM_SOUND_CATEGORY_ENCHANTMENT]     = CRAFTING_TYPE_ENCHANTING
 }

 function LeoTrainer.CraftToLineSkill(craftSkill)
     if craftSkill == CRAFTING_TYPE_BLACKSMITHING then return 2
     elseif craftSkill == CRAFTING_TYPE_CLOTHIER then return 3
     elseif craftSkill == CRAFTING_TYPE_WOODWORKING then return 7
-    elseif craftSkill == CRAFTING_TYPE_JEWELRYCRAFTING then return 5 end
+    elseif craftSkill == CRAFTING_TYPE_JEWELRYCRAFTING then return 5
+    elseif craftSkill == CRAFTING_TYPE_ENCHANTING then return 4 end

     return 0
 end
@@ -287,6 +290,8 @@ function LeoTrainer.Initialize()
     LeoTrainer.data = LibSavedVars:NewAccountWide( "LeoTrainer_Data", LeoTrainer.dataDefaults )
     LeoTrainer.data.loaded = true

+    if LeoTrainer.settings.deconstruct.maxQuality[CRAFTING_TYPE_ENCHANTING] == nil then LeoTrainer.settings.deconstruct.maxQuality[CRAFTING_TYPE_ENCHANTING] = ITEM_QUALITY_ARCANE end
+
     LeoTrainer.stage = LEOTRAINER_STAGE_START

     LeoTrainer.craft.Initialize()
diff --git a/LeoTrainer.txt b/LeoTrainer.txt
index dd93f5e..3ebf2a3 100644
--- a/LeoTrainer.txt
+++ b/LeoTrainer.txt
@@ -1,7 +1,7 @@
 ## Title: Leo's Trainer
 ## APIVersion: 100030
-## Version: 2.0.4
-## AddOnVersion: 204
+## Version: 2.1.0
+## AddOnVersion: 210
 ## Author: |c39B027@LeandroSilva|r
 ## SavedVariables: LeoTrainer_Settings LeoTrainer_Data
 ## OptionalDependsOn: FCOItemSaver PersonalAssistant DolgubonsLazyWritCreator
diff --git a/LeoTrainerConst.lua b/LeoTrainerConst.lua
index e9ee4e0..db684b6 100644
--- a/LeoTrainerConst.lua
+++ b/LeoTrainerConst.lua
@@ -8,7 +8,7 @@ LeoTrainer = {
 }
 LeoTrainer.name = "LeoTrainer"
 LeoTrainer.displayName = "Leo's Trainer"
-LeoTrainer.version = "2.0.4"
+LeoTrainer.version = "2.1.0"
 LeoTrainer.chatPrefix = "|c39B027" .. LeoTrainer.name .. "|r: "
 LeoTrainer.setting = nil
 LeoTrainer.hidden = true
@@ -42,6 +42,7 @@ LeoTrainer.settingsDefaults = {
             [CRAFTING_TYPE_CLOTHIER]        = ITEM_QUALITY_ARCANE,
             [CRAFTING_TYPE_WOODWORKING]     = ITEM_QUALITY_ARCANE,
             [CRAFTING_TYPE_JEWELRYCRAFTING] = ITEM_QUALITY_ARCANE,
+            [CRAFTING_TYPE_ENCHANTING]      = ITEM_QUALITY_ARCANE,
         },
     },
     bank = {
@@ -571,4 +572,4 @@ LEOTRAINER_STAGE_DONE = 4
 ZO_CreateStringId('SI_BINDING_NAME_LEOTRAINER_TOGGLE_WINDOW', "Show/Hide Main Window")
 ZO_CreateStringId('SI_BINDING_NAME_LEOTRAINER_CRAFT_NEXT', "Craft next in queue")
 ZO_CreateStringId('SI_BINDING_NAME_LEOTRAINER_DECON', "Deconstruct")
-ZO_CreateStringId('SI_BINDING_NAME_LEOTRAINER_RESEARCH', "Research")
\ No newline at end of file
+ZO_CreateStringId('SI_BINDING_NAME_LEOTRAINER_RESEARCH', "Research")
diff --git a/Research.lua b/Research.lua
index b285ff4..d6039a9 100644
--- a/Research.lua
+++ b/Research.lua
@@ -291,7 +291,7 @@ end

 function Research.OnStationEnter(craftSkill)
     lineList = nil
-    if not LeoAltholic.HasStillResearchFor(craftSkill) then
+    if craftSkill == CRAFTING_TYPE_ENCHANTING or not LeoAltholic.HasStillResearchFor(craftSkill) then
         LeoTrainer.nextStage()
         return
     end
diff --git a/Settings.lua b/Settings.lua
index 78af961..bdfec2a 100644
--- a/Settings.lua
+++ b/Settings.lua
@@ -85,18 +85,20 @@ function LeoTrainer_SettingsMenu:CreatePanel()
             text = GetString(SI_KEEP_UPGRADE_AT_MAX)
         }
     }
-    for _, craftSkill in ipairs({ CRAFTING_TYPE_BLACKSMITHING, CRAFTING_TYPE_CLOTHIER, CRAFTING_TYPE_WOODWORKING, CRAFTING_TYPE_JEWELRYCRAFTING }) do
-        table.insert(researchMaxQualities, {
-            type = "dropdown",
-            width = "half",
-            choices = qualityChoices,
-            choicesValues = qualityChoicesValues,
-            name = zo_strformat(SI_ABILITY_NAME, ZO_GetCraftingSkillName(craftSkill)),
-            getFunc = function() return LeoTrainer.settings.research.maxQuality[craftSkill] end,
-            setFunc = function(value) LeoTrainer.settings.research.maxQuality[craftSkill] = value end,
-            default = LeoTrainer.settingsDefaults.research.maxQuality[craftSkill],
-            disabled = function() return not LeoTrainer.settings.research.auto end,
-        });
+    for _, craftSkill in ipairs({ CRAFTING_TYPE_BLACKSMITHING, CRAFTING_TYPE_CLOTHIER, CRAFTING_TYPE_WOODWORKING, CRAFTING_TYPE_JEWELRYCRAFTING, CRAFTING_TYPE_ENCHANTING }) do
+        if craftSkill ~= CRAFTING_TYPE_ENCHANTING then
+            table.insert(researchMaxQualities, {
+                type = "dropdown",
+                width = "half",
+                choices = qualityChoices,
+                choicesValues = qualityChoicesValues,
+                name = zo_strformat(SI_ABILITY_NAME, ZO_GetCraftingSkillName(craftSkill)),
+                getFunc = function() return LeoTrainer.settings.research.maxQuality[craftSkill] end,
+                setFunc = function(value) LeoTrainer.settings.research.maxQuality[craftSkill] = value end,
+                default = LeoTrainer.settingsDefaults.research.maxQuality[craftSkill],
+                disabled = function() return not LeoTrainer.settings.research.auto end,
+            });
+        end
         table.insert(deconstructMaxQualities, {
             type = "dropdown",
             width = "half",