Dragonflight Compat
ljosberinn opened this issue ยท 4 comments
hi,
unsure whether youre planning to maintain this going forward, but there would be a couple of 10.0 compat issues to address:
- error thrown on load:
Message: bad argument #3 to '?' (Usage: local line = self:CreateFontString([name, drawLayer, templateName]))
Time: Tue Oct 18 13:29:06 2022
Count: 1
Stack: bad argument #3 to '?' (Usage: local line = self:CreateFontString([name, drawLayer, templateName]))
[string "=[C]"]: in function `CreateFontString'
[string "@Interface/AddOns/ItemLinkLevel/main.lua"]:238: in function <Interface/AddOns/ItemLinkLevel/main.lua:165>
Locals: (*temporary) = "bad argument #3 to '?' (Usage: local line = self:CreateFontString([name, drawLayer, templateName]))"
fix: currently unknwon. I've commented out line 238-256. looks like it deosnt like "GameFontNormal"
being passed as 3rd argument
- when you link an item, it simply doesnt do anything. this is because all global constants like
LE_ITEM_CLASS_WEAPON
are nownil
so it never makes it pass the Filter check in L126.
fix:
local function Filter(self, event, message, user, ...)
for itemLink in message:gmatch("|%x+|Hitem:.-|h.-|h|r") do
local itemName, _, quality, _, _, itemType, itemSubType, _, itemEquipLoc, _, _, itemClassId, itemSubClassId = GetItemInfo(itemLink)
- if (quality ~= nil and quality >= SavedData.trigger_quality and (itemClassId == LE_ITEM_CLASS_WEAPON or itemClassId == LE_ITEM_CLASS_GEM or itemClassId == LE_ITEM_CLASS_ARMOR)) then
+ if (quality ~= nil and quality >= SavedData.trigger_quality and (itemClassId == Enum.ItemClass.Weapon or itemClassId == Enum.ItemClass.Gem or itemClassId == Enum.ItemClass.Armor)) then
local itemString = string.match(itemLink, "item[%-?%d:]+")
local _, _, color = string.find(itemLink, "|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*):?(%d*):?(%-?%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?")
local iLevel = PLH_GetRealILVL(itemLink)
local attrs = {}
if (SavedData.show_subtype and itemSubType ~= nil) then
- if (itemClassId == LE_ITEM_CLASS_ARMOR and itemSubClassId == 0) then
+ if (itemClassId == Enum.ItemClass.Armor and itemSubClassId == 0) then
-- don't display Miscellaneous for rings, necks and trinkets
- elseif (itemClassId == LE_ITEM_CLASS_ARMOR and itemEquipLoc == "INVTYPE_CLOAK") then
+ elseif (itemClassId == Enum.ItemClass.Armor and itemEquipLoc == "INVTYPE_CLOAK") then
-- don't display Cloth for cloaks
else
if (SavedData.subtype_short_format) then
table.insert(attrs, itemSubType:sub(0, 1))
else
table.insert(attrs, itemSubType)
end
end
- if (itemClassId == LE_ITEM_CLASS_GEM and itemSubClassId == LE_ITEM_ARMOR_RELIC) then
+ if (itemClassId == Enum.ItemClass.Gem and itemSubClassId == Enum.ItemArmorSubclass.Relic) then
local relicType = PLH_GetRelicType(itemLink)
table.insert(attrs, relicType)
end
end
if (SavedData.show_equiploc and itemEquipLoc ~= nil and _G[itemEquipLoc] ~= nil) then table.insert(attrs, _G[itemEquipLoc]) end
if (SavedData.show_ilevel and iLevel ~= nil) then
local txt = iLevel
if (ItemHasSockets(itemLink)) then txt = txt .. "+S" end
table.insert(attrs, txt)
end
local newItemName = itemName.." ("..table.concat(attrs, " ")..")"
local newLink = "|cff"..color.."|H"..itemString.."|h["..newItemName.."]|h|r"
message = string.gsub(message, EscapeSearchString(itemLink), newLink)
end
end
return false, message, user, ...
end
- next error thrown after above fixes:
Message: Interface/AddOns/ItemLinkLevel/main.lua:69: attempt to call method 'SetHyperlink' (a nil value)
Time: Tue Oct 18 13:33:46 2022
Count: 1
Stack: Interface/AddOns/ItemLinkLevel/main.lua:69: attempt to call method 'SetHyperlink' (a nil value)
[string "@Interface/AddOns/ItemLinkLevel/main.lua"]:69: in function <Interface/AddOns/ItemLinkLevel/main.lua:62>
[string "@Interface/AddOns/ItemLinkLevel/main.lua"]:129: in function `filterFunc'
[string "@Interface/FrameXML/ChatFrame.lua"]:3586: in function `ChatFrame_MessageEventHandler'
[string "@Interface/FrameXML/ChatFrame.lua"]:3145: in function `ChatFrame_OnEvent'
[string "*FloatingChatFrame.xml:675_OnEvent"]:1: in function <[string "*FloatingChatFrame.xml:675_OnEvent"]:1>
- fix:
local function CreateEmptyTooltip()
- local tip = CreateFrame('GameTooltip')
+ local tip = CreateFrame('GameTooltip', "ItemLinkLevelTooltip", nil, "GameTooltipTemplate")
local leftside = {}
local rightside = {}
local L, R
for i = 1, 6 do
L, R = tip:CreateFontString(), tip:CreateFontString()
L:SetFontObject(GameFontNormal)
R:SetFontObject(GameFontNormal)
tip:AddFontStrings(L, R)
leftside[i] = L
rightside[i] = R
end
tip.leftside = leftside
tip.rightside = rightside
return tip
end
now we dont crash anymore but the colorization is broken:
(the line above is print(newItemName, newLink, itemString, color, itemLink, quality)
inserted below their definitions in Filter
)
judging by itemString
, looks like its already reported wrong from the game but that may just be my interpretation. since quality
is a clear indicator, we could store a map of quality id <-> color and use that instead of parsing, esp considering the regex to parse it is hilariously complex.
which leaves the DD
prefix which I'm nut sure where its coming from
Thanks a lot for reporting those issues with Dragonflight and the initial analysis on how to fix them. Did you experience these on the PTR?
I'll probably try Dragonflight so I'll fix issues with ItemLinkLevel when it's released (or when the pre-patch is out).
that was quick :) wasn't technically on the PTR but should be "broken" there too. tested on beta
just found out that FF0070DD
needs the FF
stripped. then 0070DD
is the correct blue/rare color
fixed Filter
function:
- local function Filter(self, event, message, user, ...)
+ local function Filter(_, _, message, user, ...)
for itemLink in message:gmatch("|%x+|Hitem:.-|h.-|h|r") do
- local itemName, _, quality, _, _, itemType, itemSubType, _, itemEquipLoc, _, _, itemClassId, itemSubClassId = GetItemInfo(itemLink)
+ local itemName, _, quality, _, _, _, itemSubType, _, itemEquipLoc, _, _, itemClassId, itemSubClassId = GetItemInfo(itemLink)
- if (quality ~= nil and quality >= SavedData.trigger_quality and (itemClassId == LE_ITEM_CLASS_WEAPON or itemClassId == LE_ITEM_CLASS_GEM or itemClassId == LE_ITEM_CLASS_ARMOR)) then
+ if (quality ~= nil and quality >= SavedData.trigger_quality and (itemClassId == Enum.ItemClass.Weapon or itemClassId == Enum.ItemClass.Gem or itemClassId == Enum.ItemClass.Armor)) then
local itemString = string.match(itemLink, "item[%-?%d:]+")
- local _, _, color = string.find(itemLink, "|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*):?(%d*):?(%-?%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?")
+ local color = ITEM_QUALITY_COLORS[quality].hex
local iLevel = PLH_GetRealILVL(itemLink)
local attrs = {}
if (SavedData.show_subtype and itemSubType ~= nil) then
- if (itemClassId == LE_ITEM_CLASS_ARMOR and itemSubClassId == 0) then
+ if (itemClassId == Enum.ItemClass.Armor and itemSubClassId == 0) then
-- don't display Miscellaneous for rings, necks and trinkets
- elseif (itemClassId == LE_ITEM_CLASS_ARMOR and itemEquipLoc == "INVTYPE_CLOAK") then
+ elseif (itemClassId == Enum.ItemClass.Armor and itemEquipLoc == "INVTYPE_CLOAK") then
-- don't display Cloth for cloaks
else
if (SavedData.subtype_short_format) then
table.insert(attrs, itemSubType:sub(0, 1))
else
table.insert(attrs, itemSubType)
end
end
- if (itemClassId == LE_ITEM_CLASS_GEM and itemSubClassId == LE_ITEM_ARMOR_RELIC) then
+ if (itemClassId == Enum.ItemClass.Gem and itemSubClassId == Enum.ItemArmorSubclass.Relic) then
local relicType = PLH_GetRelicType(itemLink)
table.insert(attrs, relicType)
end
end
if (SavedData.show_equiploc and itemEquipLoc ~= nil and _G[itemEquipLoc] ~= nil) then table.insert(attrs, _G[itemEquipLoc]) end
if (SavedData.show_ilevel and iLevel ~= nil) then
local txt = iLevel
if (ItemHasSockets(itemLink)) then txt = txt .. "+S" end
table.insert(attrs, txt)
end
local newItemName = itemName.." ("..table.concat(attrs, " ")..")"
- local newLink = "|cff"..color.."|H"..itemString.."|h["..newItemName.."]|h|r"
+ local newLink = color.."|H"..itemString.."|h["..newItemName.."]|h|r"
message = string.gsub(message, EscapeSearchString(itemLink), newLink)
end
end
return false, message, user, ...
end
for copy pasting:
local function Filter(_, _, message, user, ...)
for itemLink in message:gmatch("|%x+|Hitem:.-|h.-|h|r") do
local itemName, _, quality, _, _, _, itemSubType, _, itemEquipLoc, _, _, itemClassId, itemSubClassId = GetItemInfo(itemLink)
if (quality ~= nil and quality >= SavedData.trigger_quality and (itemClassId == Enum.ItemClass.Weapon or itemClassId == Enum.ItemClass.Gem or itemClassId == Enum.ItemClass.Armor)) then
local itemString = string.match(itemLink, "item[%-?%d:]+")
local iLevel = PLH_GetRealILVL(itemLink)
local color = ITEM_QUALITY_COLORS[quality].hex
local attrs = {}
if (SavedData.show_subtype and itemSubType ~= nil) then
if (itemClassId == Enum.ItemClass.Armor and itemSubClassId == 0) then
-- don't display Miscellaneous for rings, necks and trinkets
elseif (itemClassId == Enum.ItemClass.Armor and itemEquipLoc == "INVTYPE_CLOAK") then
-- don't display Cloth for cloaks
else
if (SavedData.subtype_short_format) then
table.insert(attrs, itemSubType:sub(0, 1))
else
table.insert(attrs, itemSubType)
end
end
if (itemClassId == Enum.ItemClass.Gem and itemSubClassId == Enum.ItemArmorSubclass.Relic) then
local relicType = PLH_GetRelicType(itemLink)
table.insert(attrs, relicType)
end
end
if (SavedData.show_equiploc and itemEquipLoc ~= nil and _G[itemEquipLoc] ~= nil) then table.insert(attrs, _G[itemEquipLoc]) end
if (SavedData.show_ilevel and iLevel ~= nil) then
local txt = iLevel
if (ItemHasSockets(itemLink)) then txt = txt .. "+S" end
table.insert(attrs, txt)
end
local newItemName = itemName.." ("..table.concat(attrs, " ")..")"
local newLink = color.."|H"..itemString.."|h["..newItemName.."]|h|r"
message = string.gsub(message, EscapeSearchString(itemLink), newLink)
end
end
return false, message, user, ...
end