Items type now are separated
Alex Shubert [04-03-12 - 18:18]
Items type now are separated
diff --git a/AutoTurnIn.lua b/AutoTurnIn.lua
index e2bb7fb..cb30025 100644
--- a/AutoTurnIn.lua
+++ b/AutoTurnIn.lua
@@ -51,9 +51,9 @@ function AutoTurnIn:OnEnable()
AutoTurnInCharacterDB.togglekey = 1
end
- AutoTurnInCharacterDB.items = AutoTurnInCharacterDB.items and AutoTurnInCharacterDB.items or {}
- AutoTurnInCharacterDB.stats = AutoTurnInCharacterDB.stats and AutoTurnInCharacterDB.stats or {}
-
+ AutoTurnInCharacterDB.armor = AutoTurnInCharacterDB.armor and AutoTurnInCharacterDB.armor or {}
+ AutoTurnInCharacterDB.weapon = AutoTurnInCharacterDB.weapon and AutoTurnInCharacterDB.weapon or {}
+ AutoTurnInCharacterDB.stat = AutoTurnInCharacterDB.stat and AutoTurnInCharacterDB.stat or {}
local LDB = LibStub:GetLibrary("LibDataBroker-1.1", true)
if LDB then
@@ -281,19 +281,30 @@ function AutoTurnIn:Need()
self:Print(INVTYPE_RELIC .. ' or ' .. INVTYPE_TRINKET.. ' found. Choose reward manually pls.')
return true
end
- if AutoTurnInCharacterDB.items[subclass] or IsRangedAndRequired(subclass) or IsJewelryAndRequired(equipSlot) then
- if next(AutoTurnInCharacterDB.stats) then
- wipe(stattable)
- GetItemStats(link, stattable)
- for stat, value in pairs(stattable) do
- if ( AutoTurnInCharacterDB.stats[C.STATS[stat]] ) then
- tinsert(found, i)
- end
+
+ -- item is suitable is there are no type cpecified at all or item type is required
+ local OkByType = false
+ if class == C.WEAPONLABEL then
+ OkByType = (not next(AutoTurnInCharacterDB.weapon)) or (AutoTurnInCharacterDB.weapon[subclass] or IsRangedAndRequired(subclass))
+ else
+ OkByType = (not next(AutoTurnInCharacterDB.armor)) or (AutoTurnInCharacterDB.armor[subclass] or IsJewelryAndRequired(equipSlot))
+ end
+
+ --Same here: if no stat specified or item stat is chosen then item is wanted
+ local OkByStat = not not next(AutoTurnInCharacterDB.stat) -- true if table is not empty
+ if OkByStat then
+ wipe(stattable)
+ GetItemStats(link, stattable)
+ for stat, value in pairs(stattable) do
+ if ( AutoTurnInCharacterDB.stat[C.STATS[stat]] ) then
+ OkByStat = true
end
- else
- tinsert(found, i)
end
end
+
+ if (OkByType and OkByStat) then
+ tinsert(found, i)
+ end
end
-- HANDLE RESULT
@@ -307,11 +318,7 @@ function AutoTurnIn:Need()
GetQuestReward(found[1])
end
- if (#found == 0) then
- return false
- else
- return true
- end
+ return ( #found ~= 0 )
end
function AutoTurnIn:QUEST_COMPLETE()
diff --git a/RewardOptions.lua b/RewardOptions.lua
index e4d3cab..28db8df 100644
--- a/RewardOptions.lua
+++ b/RewardOptions.lua
@@ -28,7 +28,13 @@ local function CreatePanel(name, text, w, h)
end
end
function panel:GetConfig()
- return name == "StatPanel" and ptable.TempConfig.stats or ptable.TempConfig.items
+ if name == "StatPanel" then
+ return ptable.TempConfig.stat
+ elseif name == "ArmorPanel" then
+ return ptable.TempConfig.armor
+ else
+ return ptable.TempConfig.weapon
+ end
end
_G[panel:GetName().."Title"]:SetText(text)
return panel
@@ -100,14 +106,14 @@ RewardPanel.refresh = function()
ArmorPanel:ClearCheckBoxes()
StatPanel:ClearCheckBoxes()
- for k,v in pairs(ptable.TempConfig.items) do
- local w = _G[WeaponPanel:GetName()..k]
- w = w and w or _G[ArmorPanel:GetName()..k]
- w:SetChecked(v)
+ for k,v in pairs(ptable.TempConfig.armor) do
+ _G[ArmorPanel:GetName()..k]:SetChecked(v)
+ end
+ for k,v in pairs(ptable.TempConfig.weapon) do
+ _G[WeaponPanel:GetName()..k]:SetChecked(v)
end
-
- for k,v in pairs(ptable.TempConfig.stats) do
- _G[StatPanel:GetName()..k]:SetChecked(v)
+ for k,v in pairs(ptable.TempConfig.stat) do
+ _G[StatPanel:GetName()..k]:SetChecked(v)
end
GreedAfterNeed:SetChecked(ptable.TempConfig.greedifnothingfound )