diff --git a/API.lua b/API.lua index c59a631..df41ebe 100644 --- a/API.lua +++ b/API.lua @@ -1533,18 +1533,12 @@ do -- Quest local TextModifier = TextModifier_None; local function GetModifiedQuestText(method) - local text = GetQuestText(method); - if text then - return TextModifier(text) - end + return TextModifier(GetQuestText(method)) end API.GetModifiedQuestText = GetModifiedQuestText; local function GetModifiedGossipText() - local text = GetGossipText(); - if text then - return TextModifier(text) - end + return TextModifier(GetGossipText()); end API.GetModifiedGossipText = GetModifiedGossipText; @@ -1552,11 +1546,6 @@ do -- Quest TextModifier = modifierFunc or TextModifier_None; end addon.SetDialogueTextModifier = SetDialogueTextModifier; - - addon.SetChatTextModifier = function(modifierFunc) - modifierFunc("test"); - CallbackRegistry:Trigger("SetChatTextModifier", modifierFunc or TextModifier_None); - end end @@ -2520,7 +2509,33 @@ do -- Tooltip end API.GetRewardItemLevelDelta = GetRewardItemLevelDelta; + -- Armor subClassID: 1=Cloth, 2=Leather, 3=Mail, 4=Plate + local CLASS_ARMOR_TYPE = { + WARRIOR = 4, PALADIN = 4, DEATHKNIGHT = 4, + HUNTER = 3, SHAMAN = 3, EVOKER = 3, + ROGUE = 2, MONK = 2, DRUID = 2, DEMONHUNTER = 2, + MAGE = 1, PRIEST = 1, WARLOCK = 1, + }; + + local function IsEquipmentForPlayerClass(item) + local _, _, _, _, _, classID, subClassID = GetItemInfoInstant(item); + -- For armor pieces with a specific armor type (cloth/leather/mail/plate), + -- reject items that don't match the player's armor proficiency + if classID == 4 and subClassID >= 1 and subClassID <= 4 then + local _, playerClass = UnitClass("player"); + local expectedType = playerClass and CLASS_ARMOR_TYPE[playerClass]; + if expectedType and subClassID ~= expectedType then + return false + end + end + return true + end + API.IsEquipmentForPlayerClass = IsEquipmentForPlayerClass; + local function IsItemAnUpgrade(newLink) + if not IsEquipmentForPlayerClass(newLink) then + return false, true + end local delta, isReady = GetMaxEquippedItemLevelDelta(newLink) return (delta and delta > 0), isReady end diff --git a/Code/GossipData/ItemData_Container.lua b/Code/GossipData/ItemData_Container.lua index f89aa76..6e22144 100644 --- a/Code/GossipData/ItemData_Container.lua +++ b/Code/GossipData/ItemData_Container.lua @@ -27,6 +27,8 @@ local MiscUsableItem = { --Some items don't align to the pattern (Flags_0 is 0x0) [142447] = true, --Torn Sack of Pet Supplies [184866] = true, --Grummlepouch + [257023] = true, --Preyseeker's Adventurer Chest + [264274] = true, --Fabled Adventurer's Cache }; function API.IsContainerItem(itemID) diff --git a/Code/Settings/Settings.lua b/Code/Settings/Settings.lua index 0227cd6..7b60e3d 100644 --- a/Code/Settings/Settings.lua +++ b/Code/Settings/Settings.lua @@ -493,6 +493,18 @@ local function QuestItemDisplayPosition_Validation() return f and f:IsUsingCustomPosition() end +local function QuickSlot_Move_OnClick() + addon.QuickSlotManager:ToggleEditMode(); +end + +local function QuickSlot_Reset_OnClick() + addon.QuickSlotManager:ResetPosition(); +end + +local function QuickSlotPosition_Validation() + return addon.QuickSlotManager:IsUsingCustomPosition() +end + local function RPAddOn_Validation() return addon.GetInstalledRPAddOnName() ~= nil end @@ -711,6 +723,11 @@ local Schematic = { --Scheme {type = "Subheader", name = L["Quest"]}, {type = "Checkbox", name = L["Valuable Reward Popup"], description = L["Valuable Reward Popup Desc"], dbKey = "QuickSlotQuestReward", preview = "QuickSlotQuestReward", ratio = 2}, + {type = "Checkbox", name = L["Always-On Loot Popup"], description = L["Always-On Loot Popup Desc"], dbKey = "QuickSlotAlwaysOn", requiredParentValueAnd = {QuickSlotQuestReward = true}}, + {type = "Checkbox", name = L["Upgrades And Containers Only"], description = L["Upgrades And Containers Only Desc"], dbKey = "QuickSlotPriorityOnly", requiredParentValueAnd = {QuickSlotQuestReward = true, QuickSlotAlwaysOn = true}}, + {type = "Checkbox", name = L["Include Collectibles"], description = L["Include Collectibles Desc"], dbKey = "QuickSlotCollectibleHighPriority", requiredParentValueAnd = {QuickSlotQuestReward = true, QuickSlotAlwaysOn = true}}, + {type = "Custom", name = L["Move Position"], icon = "Settings-Move.png", onClickFunc = QuickSlot_Move_OnClick, requiredParentValueAnd = {QuickSlotQuestReward = true}}, + {type = "Custom", name = L["Reset Position"], icon = "Settings-Reset.png", validationFunc = QuickSlotPosition_Validation, onClickFunc = QuickSlot_Reset_OnClick, requireSameParentValue = true}, {type = "Checkbox", name = L["Auto Complete Quest"], description = L["Auto Complete Quest Desc"], dbKey = "AutoCompleteQuest", preview = "QuestAutoComplete", ratio = 2}, {type = "Checkbox", name = L["Press Key To Use Item"], tooltip = UseItemHotkey_Tooltip, dbKey = "QuickSlotUseHotkey", requiredParentValueOr = {QuickSlotQuestReward = true, AutoCompleteQuest = true}, branchLevel = 0}, diff --git a/Code/SupportedAddOns/SupportedAddOns.xml b/Code/SupportedAddOns/SupportedAddOns.xml index 6d4dfa0..7e8865a 100644 --- a/Code/SupportedAddOns/SupportedAddOns.xml +++ b/Code/SupportedAddOns/SupportedAddOns.xml @@ -7,6 +7,7 @@