View Single Post
02-22-24, 11:23 PM   #19
Hubb777
A Flamescale Wyrmkin
 
Hubb777's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2024
Posts: 113
Originally Posted by Fizzlemizz View Post
You still don't say what you want to see when a link is clicked so, using the code you linked and guessing you just want to see the item tooltip when a link is clicked:

The item field added to each entry in addon.db is the (random because I don't know that acual) item ID that will be the link/tooltip (replacing the %s in each announce.enUS field).
Hello. Yes, that's perfect. This is exactly what I wanted. Thank you so much for your help. I have already started creating my first addon. Which I will definitely publish on https://www.wowinterface.com/.

I set the localization lines correctly, did I do everything right?

Lua Code:
  1. local addonName, addon = ...
  2. addon.db = {
  3.     {
  4.         name = {
  5.             enUS = "Herb-Infused Water",
  6.             deDE = "Mit Kräutern aromatisiertes Wasser"
  7.         },
  8.         questID = 75612,
  9.         icon = "interface/icons/inv_mushroom_11",
  10.         item = 210399,
  11.         announce = {
  12.             deDE = "Die Grundlage eines jeden %s Getränks: Wasser! Aufgegossen mit ausgewählten Kräutern aus meinem Garten.",
  13.              enUS = "Awarded for outstanding service to Dragonkind.\n%s\nBring it to Theozhaklos the Curious at the Wellspring \nOverlook in the Emerald Dream to receive powerful \nequipment for your efforts",
  14.         }
  15.     },
  16.     {
  17.         name = "Emerald Mark of Mastery",
  18.         questID = 75624,
  19.         icon = "interface/icons/inv_mushroom_11",
  20.         item = 20897,
  21.         announce = {
  22.              enUS = "Awarded for outstanding service to Dragonkind.\n%s\nBring it to Theozhaklos the Curious at the Wellspring \nOverlook in the Emerald Dream to receive powerful \nequipment for your efforts"
  23.         }
  24.     },
  25.     {
  26.         name = "Emerald Mark of Mastery",
  27.         questID = 74352,
  28.         icon = "interface/icons/inv_mushroom_11",
  29.         item = 193440,
  30.         announce = {
  31.              enUS = "Awarded for outstanding service to Dragonkind.\n%s\nBring it to Theozhaklos the Curious at the Wellspring \nOverlook in the Emerald Dream to receive powerful \nequipment for your efforts"
  32.         }
  33.     }
  34. }
  35. ---------------------------------------------------------------------------------------------------
  36. -- Code to replace %s in announce texts with item links. Replaces the GetItemLinkById(...) function
  37. local function LoadItem(item)
  38.     for k, v in pairs(addon.db[item.dbID].announce) do -- replace the %s with the itemlink in eal locale in the .announce key
  39.         addon.db[item.dbID].announce[k] = format(v, item:GetItemLink())
  40.     end
  41. end
  42. for i, v in ipairs(addon.db) do
  43.     local item = Item:CreateFromItemID(v.item)
  44.     item.dbID = i
  45.     item:ContinueOnItemLoad(function() LoadItem(item) end)
  46. end
  Reply With Quote