use SpellInfo if available

This commit is contained in:
Spit
2025-08-31 13:18:37 +03:00
parent a3d32e3e46
commit be2f6837c8
+18 -18
View File
@@ -984,7 +984,7 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame)
local iconFrame, nameFrame, extraFrame, itemButton;
local text, extra;
local wlPage, wlPageMax = 1, 1;
local isItem, isEnchant, isSpell;
local itemType;
local spellName, spellIcon;
if dataID == "SearchResult" and dataID == "WishList" then
AtlasLoot_IsLootTableAvailable(dataID);
@@ -1101,20 +1101,14 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame)
--Check for a valid object (that it exists, and that it has a name)
if (dataSource[dataID][i] ~= nil and dataSource[dataID][i][3] ~= "") then
if string.sub(dataSource[dataID][i][1], 1, 1) == "s" then
isItem = false;
isEnchant = false;
isSpell = true;
itemType = "SPELL"
elseif string.sub(dataSource[dataID][i][1], 1, 1) == "e" then
isItem = false;
isEnchant = true;
isSpell = false;
itemType = "ENCHANT"
else
isItem = true;
isEnchant = false;
isSpell = false;
itemType = "ITEM"
end
local quantityFrame
if isItem then
if itemType == "ITEM" then
local itemName, _, itemQuality = GetItemInfo(dataSource[dataID][i][1]);
--If the client has the name of the item in cache, use that instead.
--This is poor man's localisation, English is replaced be whatever is needed
@@ -1127,15 +1121,21 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame)
end
quantityFrame = getglobal("AtlasLootItem_"..i.."_Quantity");
quantityFrame:SetText("")
elseif isEnchant then
elseif itemType == "ENCHANT" then
spellName = GetSpellInfoAtlasLootDB["enchants"][tonumber(string.sub(dataSource[dataID][i][1], 2))]["name"]
spellIcon = dataSource[dataID][i][2]
if SpellInfo then
spellName, spellIcon = SpellInfo(tonumber(string.sub(dataSource[dataID][i][1], 2)))
end
text = AtlasLoot_FixText(string.sub(dataSource[dataID][i][3], 1, 4)..spellName)
quantityFrame = getglobal("AtlasLootItem_"..i.."_Quantity");
quantityFrame:SetText("")
elseif isSpell then
elseif itemType == "SPELL" then
spellName = dataSource[dataID][i][3]
spellIcon = dataSource[dataID][i][2]
if SpellInfo then
spellName, spellIcon = SpellInfo(tonumber(string.sub(dataSource[dataID][i][1], 2)))
end
text = AtlasLoot_FixText(spellName)
local qtyMin = GetSpellInfoAtlasLootDB["craftspells"][tonumber(string.sub(dataSource[dataID][i][1], 2))]["craftQuantityMin"];
local qtyMax = GetSpellInfoAtlasLootDB["craftspells"][tonumber(string.sub(dataSource[dataID][i][1], 2))]["craftQuantityMax"];
@@ -1183,7 +1183,7 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame)
elseif dataSource[dataID][i][2] == "" then
local _, _, _, _, _, _, _, _, itemTexture1 = GetItemInfo(dataSource[dataID][i][1])
iconFrame:SetTexture(itemTexture1);
elseif (not isItem) and (spellIcon) then
elseif (itemType ~= "ITEM") and (spellIcon) then
if type(dataSource[dataID][i][2]) == "number" then
local _, _, _, _, _, _, _, _, itemTexture2 = GetItemInfo(dataSource[dataID][i][2])
iconFrame:SetTexture(itemTexture2);
@@ -1331,9 +1331,9 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame)
border:Show()
end
local spellID
if isItem then
if itemType == "ITEM" then
itemButton.dressingroomID = dataSource[dataID][i][1];
elseif isEnchant then
elseif itemType == "ENCHANT" then
spellID = tonumber(string.sub(dataSource[dataID][i][1], 2));
if GetSpellInfoAtlasLootDB["enchants"][spellID]["item"] and GetSpellInfoAtlasLootDB["enchants"][spellID]["item"] ~= nil and GetSpellInfoAtlasLootDB["enchants"][spellID]["item"] ~= "" then
itemButton.dressingroomID = GetSpellInfoAtlasLootDB["enchants"][spellID]["item"];
@@ -1345,7 +1345,7 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame)
GameTooltip:SetHyperlink("item:"..GetSpellInfoAtlasLootDB["enchants"][spellID]["item"]..":0:0:0");
end
end
elseif isSpell then
elseif itemType == "SPELL" then
spellID = tonumber(string.sub(dataSource[dataID][i][1], 2));
itemButton.dressingroomID = GetSpellInfoAtlasLootDB["craftspells"][spellID]["craftItem"];
if GetSpellInfoAtlasLootDB["craftspells"][spellID]["craftItem"] ~= "" then
@@ -3135,7 +3135,7 @@ function AtlasLootItem_OnEnter()
end
AtlasLootTooltip2:Show();
-- Reposition if tooltips overlap
if AtlasLootTooltip:GetBottom() < AtlasLootTooltip2:GetTop() then
if (AtlasLootTooltip:GetBottom() and AtlasLootTooltip2:GetTop()) and (AtlasLootTooltip:GetBottom() < AtlasLootTooltip2:GetTop()) then
AtlasLootTooltip2:ClearAllPoints()
AtlasLootTooltip2:SetPoint("TOPLEFT", this, "TOPRIGHT", -(this:GetWidth() / 2), 24)
AtlasLootTooltip:ClearAllPoints()