stevin05 / CraftScan

MIT License
5 stars 2 forks source link

Addon Responds with Base Item Level Instead of Requested Item Level #32

Open addoodi opened 1 month ago

addoodi commented 1 month ago

Hello,

First, thank you for developing the CraftScan addon; it's been incredibly helpful!

I've encountered an issue where the addon responds to crafting requests with the base item level (ilvl) of the item, rather than the ilvl specified in the request. For example:

Issue: When someone requests crafting for an item at ilvl 636, the addon responds with "I can craft {item}." but the item link refers to the base ilvl of the item, not ilvl 636.

Expected Behavior: The addon should capture the requested item's ilvl and respond with the item link that matches the requested ilvl. So the response would be "I can craft {item}" where {item} is linked with ilvl 636.

Possible Cause: It seems the addon might be using the base item link without including the item level modifiers from the original request.

Steps to Reproduce: Send a crafting request in trade chat for an item specifying a higher ilvl (e.g., ilvl 636). Observe the addon's automated response. Notice that the item link in the response does not match the requested ilvl.

Suggestion: Adjust the code to parse the original item link from the crafting request, including any ilvl modifiers, and use that exact link in the response. OR Have a setting or wildcard text to always respond with the highest quality ilvl.

Additional Information: Any guidance or updates to address this issue would be greatly appreciated! Thank you for your time and assistance.

stevin05 commented 1 month ago

I played with this a few weeks ago and never got back to it after it didn't initially work. It shows the 5* thing on my screen and in the proposed message, but the chat system doesn't seem to allow it because whispers with it don't go through.

(This current version doesn't have it embedded in the item link like it should be - was just seeing if I could send the 5* icon in chat at all even outside a link.)

I assume there are some functions somewhere for manipulating item links, but I didn't find them in my first pass playing with this.

Here's where you can mess with it if you want to give it a try. I'll get around to it some day, but busy actually playing currently. Just update the 'itemLink' variable to include what you want and the rest of the function will include it in messages as before. In ChatScanner.lua line 335-ish:

    -- TODO - Want to make the item look 5*, but this doesn't send through chat.
    --if itemLink then
    --local tier5 = Professions.GetChatIconMarkupForQuality(5, true, 0);
    --itemLink = itemLink .. " " .. tier5;
    --end

Another option would be to simply mimic the input item link back instead of trying to generate it. This wouldn't work for keyword matches, but would improve things some. Here's a regex match from another section that's grabbing whole item links out of messages. CraftScan does not currently match against multiple links in the same message (been too lazy and it doesn't happen all that often). I forget how it chooses one over the other or if it only cares about the first item link, so you'd need just want to make sure the itemLink you pull from the message with this regex matches the one we're replying about.

for itemLink in string.gmatch(inputString, "(item:[%d:]+%|h%b[])") do