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 iconFrame, nameFrame, extraFrame, itemButton;
local text, extra; local text, extra;
local wlPage, wlPageMax = 1, 1; local wlPage, wlPageMax = 1, 1;
local isItem, isEnchant, isSpell; local itemType;
local spellName, spellIcon; local spellName, spellIcon;
if dataID == "SearchResult" and dataID == "WishList" then if dataID == "SearchResult" and dataID == "WishList" then
AtlasLoot_IsLootTableAvailable(dataID); 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) --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 (dataSource[dataID][i] ~= nil and dataSource[dataID][i][3] ~= "") then
if string.sub(dataSource[dataID][i][1], 1, 1) == "s" then if string.sub(dataSource[dataID][i][1], 1, 1) == "s" then
isItem = false; itemType = "SPELL"
isEnchant = false;
isSpell = true;
elseif string.sub(dataSource[dataID][i][1], 1, 1) == "e" then elseif string.sub(dataSource[dataID][i][1], 1, 1) == "e" then
isItem = false; itemType = "ENCHANT"
isEnchant = true;
isSpell = false;
else else
isItem = true; itemType = "ITEM"
isEnchant = false;
isSpell = false;
end end
local quantityFrame local quantityFrame
if isItem then if itemType == "ITEM" then
local itemName, _, itemQuality = GetItemInfo(dataSource[dataID][i][1]); local itemName, _, itemQuality = GetItemInfo(dataSource[dataID][i][1]);
--If the client has the name of the item in cache, use that instead. --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 --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 end
quantityFrame = getglobal("AtlasLootItem_"..i.."_Quantity"); quantityFrame = getglobal("AtlasLootItem_"..i.."_Quantity");
quantityFrame:SetText("") quantityFrame:SetText("")
elseif isEnchant then elseif itemType == "ENCHANT" then
spellName = GetSpellInfoAtlasLootDB["enchants"][tonumber(string.sub(dataSource[dataID][i][1], 2))]["name"] spellName = GetSpellInfoAtlasLootDB["enchants"][tonumber(string.sub(dataSource[dataID][i][1], 2))]["name"]
spellIcon = dataSource[dataID][i][2] 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) text = AtlasLoot_FixText(string.sub(dataSource[dataID][i][3], 1, 4)..spellName)
quantityFrame = getglobal("AtlasLootItem_"..i.."_Quantity"); quantityFrame = getglobal("AtlasLootItem_"..i.."_Quantity");
quantityFrame:SetText("") quantityFrame:SetText("")
elseif isSpell then elseif itemType == "SPELL" then
spellName = dataSource[dataID][i][3] spellName = dataSource[dataID][i][3]
spellIcon = dataSource[dataID][i][2] spellIcon = dataSource[dataID][i][2]
if SpellInfo then
spellName, spellIcon = SpellInfo(tonumber(string.sub(dataSource[dataID][i][1], 2)))
end
text = AtlasLoot_FixText(spellName) text = AtlasLoot_FixText(spellName)
local qtyMin = GetSpellInfoAtlasLootDB["craftspells"][tonumber(string.sub(dataSource[dataID][i][1], 2))]["craftQuantityMin"]; 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"]; 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 elseif dataSource[dataID][i][2] == "" then
local _, _, _, _, _, _, _, _, itemTexture1 = GetItemInfo(dataSource[dataID][i][1]) local _, _, _, _, _, _, _, _, itemTexture1 = GetItemInfo(dataSource[dataID][i][1])
iconFrame:SetTexture(itemTexture1); iconFrame:SetTexture(itemTexture1);
elseif (not isItem) and (spellIcon) then elseif (itemType ~= "ITEM") and (spellIcon) then
if type(dataSource[dataID][i][2]) == "number" then if type(dataSource[dataID][i][2]) == "number" then
local _, _, _, _, _, _, _, _, itemTexture2 = GetItemInfo(dataSource[dataID][i][2]) local _, _, _, _, _, _, _, _, itemTexture2 = GetItemInfo(dataSource[dataID][i][2])
iconFrame:SetTexture(itemTexture2); iconFrame:SetTexture(itemTexture2);
@@ -1331,9 +1331,9 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame)
border:Show() border:Show()
end end
local spellID local spellID
if isItem then if itemType == "ITEM" then
itemButton.dressingroomID = dataSource[dataID][i][1]; itemButton.dressingroomID = dataSource[dataID][i][1];
elseif isEnchant then elseif itemType == "ENCHANT" then
spellID = tonumber(string.sub(dataSource[dataID][i][1], 2)); 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 if GetSpellInfoAtlasLootDB["enchants"][spellID]["item"] and GetSpellInfoAtlasLootDB["enchants"][spellID]["item"] ~= nil and GetSpellInfoAtlasLootDB["enchants"][spellID]["item"] ~= "" then
itemButton.dressingroomID = GetSpellInfoAtlasLootDB["enchants"][spellID]["item"]; 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"); GameTooltip:SetHyperlink("item:"..GetSpellInfoAtlasLootDB["enchants"][spellID]["item"]..":0:0:0");
end end
end end
elseif isSpell then elseif itemType == "SPELL" then
spellID = tonumber(string.sub(dataSource[dataID][i][1], 2)); spellID = tonumber(string.sub(dataSource[dataID][i][1], 2));
itemButton.dressingroomID = GetSpellInfoAtlasLootDB["craftspells"][spellID]["craftItem"]; itemButton.dressingroomID = GetSpellInfoAtlasLootDB["craftspells"][spellID]["craftItem"];
if GetSpellInfoAtlasLootDB["craftspells"][spellID]["craftItem"] ~= "" then if GetSpellInfoAtlasLootDB["craftspells"][spellID]["craftItem"] ~= "" then
@@ -3135,7 +3135,7 @@ function AtlasLootItem_OnEnter()
end end
AtlasLootTooltip2:Show(); AtlasLootTooltip2:Show();
-- Reposition if tooltips overlap -- 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:ClearAllPoints()
AtlasLootTooltip2:SetPoint("TOPLEFT", this, "TOPRIGHT", -(this:GetWidth() / 2), 24) AtlasLootTooltip2:SetPoint("TOPLEFT", this, "TOPRIGHT", -(this:GetWidth() / 2), 24)
AtlasLootTooltip:ClearAllPoints() AtlasLootTooltip:ClearAllPoints()