View Single Post
01-11-24, 12:51 PM   #8
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,937
So what we have so far is ...

A way to open direct to a recipe page via a recipe id

And

A way to open the professions page from a hyperlink.


What we need now is a way to find out the recipe id from a recipe link which hopefully will be figureoutable from this page : https://warcraft.wiki.gg/wiki/Hyperlinks

Ah never mind, looks like the recipe links are either item links or enchant links.

Looking at the tradeskill window itself, it only allows people to link their whole profession not a recipe, so you might only be able to open to a particular recipe page using a known recipe ID. Unfortunately the only way I could see to get both a recipelink and recipeid automagically was by reading the recipes from the tradeskill page.

The last known recipe in my example was the Enchant Vellum I could craft with my Inscription Gal.
The recipe ID for it is 52739 but none of the numbers in the Enchant Vellum recipe link contains that number. Instead it has 38682 which is the actual item id and 70:266 which I assume is the player level and specialization id who provided the link and the next numbers that appear are 1:3524 which don't provide any clues to me but could be the number of bonsuses and a bonus id - if I am reading the info on https://warcraft.wiki.gg/wiki/ItemLink correctly.

Anyway, this is my last attempt, and is the best I could do using both the info Fizzle provided and what I tracked down and hopefully gets you part way at least.


Lua Code:
  1. local addonName,db = ...
  2.  
  3. local cf = CreateFrame("Frame","TestFrame",UIParent)
  4. cf:SetSize(600,100)
  5. cf:SetPoint("CENTER",0,0)
  6. cf:SetHyperlinksEnabled(true)
  7. cf.fs = cf:CreateFontString(nil,"OVERLAY","GameFontNormal")
  8. cf.fs:SetAllPoints()
  9. cf:SetScript("OnHyperlinkClick", ChatFrame_OnHyperlinkShow)
  10.  
  11.  
  12. local cf2 = CreateFrame("Frame","TestFrame2",UIParent)
  13. cf2:SetSize(600,100)
  14. cf2:SetPoint("TOP",cf, "BOTTOM",0,0)
  15. cf2:SetHyperlinksEnabled(true)
  16. cf2.fs = cf2:CreateFontString(nil,"OVERLAY","GameFontNormal")
  17. cf2.fs:SetAllPoints()
  18. cf2:SetScript("OnHyperlinkClick", function(self)    
  19.        
  20.     -- if you have a recipeInfo.recipeID then use that to jump to its crafting page    
  21.     if db.recipeInfo and db.recipeInfo.recipeID then
  22.         ProfessionsUtil.OpenProfessionFrameToRecipe(db.recipeInfo.recipeID)
  23.     end
  24. end)
  25.  
  26. local function OnEvent(self,event,...)    
  27.     local args = { ... }
  28.     if event == "ADDON_LOADED" and args[1] == addonName then
  29.     elseif event =="TRADE_SKILL_SHOW" then
  30.         db.link = C_TradeSkillUI.GetTradeSkillListLink()
  31.        
  32.         -- Cycles through all recipes known to the player or player who provided the link ( only tested on myself )
  33.         for _, id in pairs(C_TradeSkillUI.GetAllRecipeIDs()) do
  34.             local recipeInfo = C_TradeSkillUI.GetRecipeInfo(id)
  35.             if recipeInfo.learned then  
  36.                 print(recipeInfo.recipeID, recipeInfo.name, recipeInfo.learned)
  37.                 db.recipeInfo = recipeInfo
  38.             end
  39.         end    
  40.     end
  41.  
  42.     -- set the profession link to the first text area
  43.     cf.fs:SetText(db.link)
  44.    
  45.     -- set the last recipe found's hyperlink to the second text area
  46.     -- If you have a specific recipeInfo.hyperlink ) use that instead
  47.     if db.recipeInfo and db.recipeInfo.hyperlink then
  48.         cf2.fs:SetText(db.recipeInfo.hyperlink)
  49.     end
  50. end
  51.  
  52. local f = CreateFrame("Frame")
  53. f:RegisterEvent("ADDON_LOADED")
  54. f:RegisterEvent("PLAYER_LOGIN")
  55. f:RegisterEvent("TRADE_SKILL_SHOW")
  56. f:SetScript("OnEvent",OnEvent)
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote