diff --git a/AutoTurnIn.lua b/AutoTurnIn.lua index f9bfa16..c7e61b3 100644 --- a/AutoTurnIn.lua +++ b/AutoTurnIn.lua @@ -57,6 +57,7 @@ function AutoTurnIn:OnEnable() AutoTurnInCharacterDB.armor = AutoTurnInCharacterDB.armor and AutoTurnInCharacterDB.armor or {} AutoTurnInCharacterDB.weapon = AutoTurnInCharacterDB.weapon and AutoTurnInCharacterDB.weapon or {} AutoTurnInCharacterDB.stat = AutoTurnInCharacterDB.stat and AutoTurnInCharacterDB.stat or {} + AutoTurnInCharacterDB.secondary = AutoTurnInCharacterDB.secondary and AutoTurnInCharacterDB.secondary or {} local LDB = LibStub:GetLibrary("LibDataBroker-1.1", true) if LDB then @@ -148,7 +149,6 @@ function AutoTurnIn:QUEST_GREETING() if quest and quest.amount then if self:GetItemAmount(quest.currency, quest.item) >= quest.amount then SelectAvailableQuest(index) - return end else SelectAvailableQuest(index) @@ -172,12 +172,10 @@ function AutoTurnIn:VarArgForActiveQuests(...) if self:GetItemAmount(quest.currency, quest.item) >= quest.amount then SelectGossipActiveQuest(math.floor(i/MOP_INDEX_CONST)+1) self.DarkmoonAllowToProceed = false - return end else SelectGossipActiveQuest(math.floor(i/MOP_INDEX_CONST)+1) self.DarkmoonAllowToProceed = false - return end end end @@ -193,12 +191,10 @@ function AutoTurnIn:VarArgForAvailableQuests(...) if AutoTurnInCharacterDB.all or (quest and (not quest.donotaccept)) then if quest and quest.amount then if self:GetItemAmount(quest.currency, quest.item) >= quest.amount then - SelectGossipAvailableQuest(math.floor(i/MOP_INDEX_CONST)+1) - return + SelectGossipAvailableQuest(math.floor(i/MOP_INDEX_CONST)+1) end else - SelectGossipAvailableQuest(math.floor(i/MOP_INDEX_CONST)+1) - return + SelectGossipAvailableQuest(math.floor(i/MOP_INDEX_CONST)+1) end end end @@ -267,8 +263,8 @@ function AutoTurnIn:BAG_UPDATE(event, bagID) local name = GetItemInfo(link) if ( name and self.autoEquipList[name] ) then self:Print(L["equipping reward"], link) - EquipItemByName(name) self.autoEquipList[name]=nil + EquipItemByName(name) end end end @@ -322,7 +318,7 @@ if more than one suitable item found then item list is shown in a chat window an AutoTurnIn.found, AutoTurnIn.stattable = {}, {} function AutoTurnIn:Need() wipe(self.found) - + for i=1, GetNumQuestChoices() do local link = GetQuestItemLink("choice", i) @@ -349,22 +345,26 @@ function AutoTurnIn:Need() end --Same here: if no stat specified or item stat is chosen then item is wanted - local OkByStat = (not next(AutoTurnInCharacterDB.stat)) -- true if table is empty - if (not OkByStat) and ('INVTYPE_RELIC' ~= equipSlot) then + local OkByStat = not next(AutoTurnInCharacterDB.stat) -- true if table is empty + local OkBySecondary = not next(AutoTurnInCharacterDB.secondary) -- true if table is empty + if (not (OkByStat and OkBySecondaryStat)) and ('INVTYPE_RELIC' ~= equipSlot) then wipe(self.stattable) GetItemStats(link, self.stattable) for stat, value in pairs(self.stattable) do if ( AutoTurnInCharacterDB.stat[stat] ) then OkByStat = true end + if ( AutoTurnInCharacterDB.secondary[stat] ) then + OkBySecondary = true + end end end - - -- User may not choose any options hence any item became 'ok'. That situation is undoubtly incorrect. - local EmptySettings = (class == C.WEAPONLABEL and (not next(AutoTurnInCharacterDB.weapon)) or (not next(AutoTurnInCharacterDB.armor))) and - (not next(AutoTurnInCharacterDB.stat)) - if (OkByType and OkByStat and (not EmptySettings)) then + -- User may not choose any options hence any item became 'ok'. That situation is undoubtly incorrect. + local SettingsExists = (class == C.WEAPONLABEL and next(AutoTurnInCharacterDB.weapon) or next(AutoTurnInCharacterDB.armor)) + or next(AutoTurnInCharacterDB.stat) + + if (OkByType and OkByStat and OkBySecondary and SettingsExists) then tinsert(self.found, i) end end diff --git a/rewards_const.lua b/rewards_const.lua index ff740cd..5a79530 100644 --- a/rewards_const.lua +++ b/rewards_const.lua @@ -40,4 +40,20 @@ C.ITEMS = { ['Idols'] = armor[8], ['Totems'] = armor[9], ]]-- -} \ No newline at end of file +} + +--[[ +from GlobalStrings.lua +ITEM_MOD_CRIT_RATING_SHORT = "Critical Strike"; +ITEM_MOD_DODGE_RATING_SHORT = "Dodge"; +ITEM_MOD_PARRY_RATING_SHORT = "Parry"; + +ITEM_MOD_EXPERTISE_RATING_SHORT = "Expertise"; +ITEM_MOD_HASTE_RATING_SHORT = "Haste"; +ITEM_MOD_HIT_RATING_SHORT = "Hit"; + +ITEM_MOD_MASTERY_RATING_SHORT = "Mastery"; +ITEM_MOD_SPELL_PENETRATION_SHORT = "Spell Penetration"; +ITEM_MOD_SPELL_POWER_SHORT = "Spell Power"; + +]]-- \ No newline at end of file diff --git a/ui/reward_options.lua b/ui/reward_options.lua index dd10f47..85f9b78 100644 --- a/ui/reward_options.lua +++ b/ui/reward_options.lua @@ -33,8 +33,10 @@ local function CreatePanel(name, text, w, h) return ptable.TempConfig.stat elseif name == "ArmorPanel" then return ptable.TempConfig.armor - else + elseif name == "WeaponPanel" then return ptable.TempConfig.weapon + elseif name == "SecStatPanel" then + return ptable.TempConfig.secondary end end _G[panel:GetName().."Title"]:SetText(text) @@ -106,7 +108,21 @@ CreateCheckbox('ITEM_MOD_AGILITY_SHORT', StatPanel, 152, -8, SPELL_STAT2_NAME) CreateCheckbox('ITEM_MOD_INTELLECT_SHORT', StatPanel, 292, -8, SPELL_STAT4_NAME) CreateCheckbox('ITEM_MOD_SPIRIT_SHORT', StatPanel, 436, -8, SPELL_STAT5_NAME) --- 'Enable' CheckBox +local SecStatPanel = CreatePanel("SecStatPanel", STAT_CATEGORY_ATTRIBUTES .. "-2", 590, 102) +CreateCheckbox('ITEM_MOD_CRIT_RATING_SHORT', SecStatPanel, 10, -8, ITEM_MOD_CRIT_RATING_SHORT) +CreateCheckbox('ITEM_MOD_DODGE_RATING_SHORT', SecStatPanel, 206, -8, ITEM_MOD_DODGE_RATING_SHORT) +CreateCheckbox('ITEM_MOD_PARRY_RATING_SHORT', SecStatPanel, 402, -8, ITEM_MOD_PARRY_RATING_SHORT) + -- 2nd line +CreateCheckbox('ITEM_MOD_EXPERTISE_RATING_SHORT', SecStatPanel, 10, -40, ITEM_MOD_EXPERTISE_RATING_SHORT) +CreateCheckbox('ITEM_MOD_HASTE_RATING_SHORT', SecStatPanel, 206, -40, ITEM_MOD_HASTE_RATING_SHORT) +CreateCheckbox('ITEM_MOD_HIT_RATING_SHORT', SecStatPanel, 402, -40, ITEM_MOD_HIT_RATING_SHORT) + -- 3rd line +CreateCheckbox('ITEM_MOD_MASTERY_RATING_SHORT', SecStatPanel, 10, -72, ITEM_MOD_MASTERY_RATING_SHORT) +CreateCheckbox('ITEM_MOD_SPELL_PENETRATION_SHORT', SecStatPanel, 206, -72, ITEM_MOD_SPELL_PENETRATION_SHORT) +CreateCheckbox('ITEM_MOD_SPELL_POWER_SHORT', SecStatPanel, 402, -72, ITEM_MOD_SPELL_POWER_SHORT) + + +-- 'Greed' CheckBox local GreedAfterNeed = CreateFrame("CheckButton", O.."Enable", RewardPanel, "OptionsCheckButtonTemplate") _G[GreedAfterNeed:GetName().."Text"]:SetText(L["greedifnothing"]) GreedAfterNeed:SetScript("OnClick", function(self) @@ -118,9 +134,10 @@ description:SetPoint("TOPLEFT", 16, -8) WeaponPanel:SetPoint("TOPLEFT", description, "BOTTOMLEFT", 0, -20) ArmorPanel:SetPoint("TOPLEFT", WeaponPanel, "BOTTOMLEFT", 0, -20) StatPanel:SetPoint("TOPLEFT", ArmorPanel, "BOTTOMLEFT", 0, -20) -GreedAfterNeed:SetPoint("TOPLEFT", StatPanel, "BOTTOMLEFT", 8, -16) +SecStatPanel:SetPoint("TOPLEFT", StatPanel, "BOTTOMLEFT", 0, -20) +GreedAfterNeed:SetPoint("TOPLEFT", SecStatPanel, "BOTTOMLEFT", 8, -16) ---[[ PANEL FINCTIONS ]]-- +--[[ PANEL FUNCTIONS ]]-- local AC = {[NONE_KEY]=1, [armor[2]]=2, [armor[3]]=3, [armor[4]]=4,[armor[5]]=5} RewardPanel.refresh = function() WeaponPanel:ClearCheckBoxes() @@ -133,11 +150,11 @@ RewardPanel.refresh = function() for k,v in pairs(ptable.TempConfig.stat) do _G[StatPanel:GetName()..k]:SetChecked(v) end + for k,v in pairs(ptable.TempConfig.secondary) do + _G[SecStatPanel:GetName()..k]:SetChecked(v) + end for k,v in pairs(ptable.TempConfig.armor) do - local w = _G[ArmorPanel:GetName()..k] - if ( w ) then - w:SetChecked(v) - end + _G[ArmorPanel:GetName()..k]:SetChecked(v) end GreedAfterNeed:SetChecked(ptable.TempConfig.greedifnothingfound )