feat: custom quest items db

This commit is contained in:
Salikh Gurgenidze
2026-01-05 01:29:02 +04:00
parent 1e3561a5e0
commit e94a5ab0d4
6 changed files with 103 additions and 9 deletions
+51
View File
@@ -0,0 +1,51 @@
-- Guda Quest Items Database
-- Contains item IDs that are quest items for specific factions
-- Used to mark items as quest items even when tooltip doesn't indicate it
local addon = Guda
-- Quest items by faction
-- "both" = quest item for Alliance and Horde
-- "alliance" = quest item for Alliance only
-- "horde" = quest item for Horde only
addon.QuestItemsDB = {
both = {
[3404] = true,
[8483] = true,
[8393] = true,
[8396] = true,
[11404] = true,
[20404] = true,
},
alliance = {
[723] = true,
[729] = true,
[730] = true,
[731] = true,
[2296] = true,
},
horde = {
[2296] = true,
},
}
-- Check if an item ID is a quest item for the given faction
-- Returns: isQuestItem (boolean), factionSpecific (string or nil)
function addon:IsQuestItemByID(itemID, playerFaction)
if not itemID then return false, nil end
-- Check "both" factions first
if self.QuestItemsDB.both[itemID] then
return true, "both"
end
-- Check faction-specific
if playerFaction then
local factionKey = string.lower(playerFaction)
if self.QuestItemsDB[factionKey] and self.QuestItemsDB[factionKey][itemID] then
return true, factionKey
end
end
return false, nil
end
+1
View File
@@ -10,6 +10,7 @@ Localization.lua
Core\Init.lua
Core\Database.lua
DB\QuestItems.lua
Core\Events.lua
Core\Utils.lua
Core\Tooltip.lua
+12
View File
@@ -607,6 +607,12 @@ local function AddSortKeys(items)
item.sortedClass = CATEGORY_ORDER["Quest"] or 7
elseif IsQuestItemTooltip(item.bagID, item.slot) then
item.sortedClass = CATEGORY_ORDER["Quest"] or 7
elseif addon.IsQuestItemByID then
-- Check QuestItemsDB for faction-specific quest items
local playerFaction = UnitFactionGroup("player")
if addon:IsQuestItemByID(itemID, playerFaction) then
item.sortedClass = CATEGORY_ORDER["Quest"] or 7
end
end
end
item.equipSlotOrder = 999
@@ -635,6 +641,12 @@ local function AddSortKeys(items)
item.isQuest = true
if IsQuestItemStarter(item.bagID, item.slot) then item.isQuestStarter = true end
if IsQuestItemUsable(item.bagID, item.slot) then item.isQuestUsable = true end
elseif addon.IsQuestItemByID then
-- Check QuestItemsDB for faction-specific quest items
local playerFaction = UnitFactionGroup("player")
if addon:IsQuestItemByID(itemID, playerFaction) then
item.isQuest = true
end
end
-- Texture pattern for grouping similar items (especially trade goods)
+9 -1
View File
@@ -54,13 +54,21 @@ function Guda_CategorizeItem(itemData, bagID, slotID, categories, specialItems,
end
-- Priority 3: Quest Items
-- Check multiple sources: tooltip scan, itemClass, and itemType (same logic as ItemButton display)
-- Check multiple sources: tooltip scan, itemClass, itemType, and QuestItemsDB
local isQuestItem = false
if itemData.class == "Quest" or itemData.type == "Quest" then
isQuestItem = true
elseif not isOtherChar then
isQuestItem = addon.Modules.Utils:IsQuestItemTooltip(bagID, slotID)
end
-- Also check the QuestItemsDB for known faction-specific quest items
if not isQuestItem and itemData.link then
local itemID = addon.Modules.Utils:ExtractItemID(itemData.link)
if itemID and addon.IsQuestItemByID then
local playerFaction = UnitFactionGroup("player")
isQuestItem = addon:IsQuestItemByID(itemID, playerFaction)
end
end
if isQuestItem then
table.insert(categories["Quest"], {bagID = bagID, slotID = slotID, itemData = itemData})
return
+15 -8
View File
@@ -62,14 +62,21 @@ local function IsQuestItem(bagID, slotID, isBank)
local itemName, _, _, _, itemCategory, itemType = addon.Modules.Utils:GetItemInfoSafe(itemID)
if itemCategory == "Quest" or itemType == "Quest" then
isQuestItem = true
-- For quest items, try a light heuristic to flag starters by name
--if itemName and (string.find(itemName, "Note") or
-- string.find(itemName, "Letter") or
-- string.find(itemName, "Orders") or
-- string.find(itemName, "Document") or
-- string.find(itemName, "Tablet")) then
-- isQuestStarter = true
--end
end
end
end
end
-- Check the QuestItemsDB for known faction-specific quest items
if not isQuestItem then
local link = GetContainerItemLink(bagID, slotID)
if link and addon and addon.Modules and addon.Modules.Utils and addon.Modules.Utils.ExtractItemID then
local itemID = addon.Modules.Utils:ExtractItemID(link)
if itemID and addon.IsQuestItemByID then
local playerFaction = UnitFactionGroup("player")
local isDBQuestItem = addon:IsQuestItemByID(itemID, playerFaction)
if isDBQuestItem then
isQuestItem = true
end
end
end
+15
View File
@@ -75,6 +75,21 @@ function QuestItemBar:CheckQuestItemUsable(bagID, slotID)
end
end
-- Check the QuestItemsDB for known faction-specific quest items
if not isQuestItem then
local link = GetContainerItemLink(bagID, slotID)
if link and addon.Modules.Utils and addon.Modules.Utils.ExtractItemID then
local itemID = addon.Modules.Utils:ExtractItemID(link)
if itemID and addon.IsQuestItemByID then
local playerFaction = UnitFactionGroup("player")
local isDBQuestItem = addon:IsQuestItemByID(itemID, playerFaction)
if isDBQuestItem then
isQuestItem = true
end
end
end
end
return isQuestItem, isQuestStarter, isUsable
end