Originally Posted by Fizzlemizz
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:
local addonName, addon = ...
addon.db = {
{
name = {
enUS = "Herb-Infused Water",
deDE = "Mit Kräutern aromatisiertes Wasser"
},
questID = 75612,
icon = "interface/icons/inv_mushroom_11",
item = 210399,
announce = {
deDE = "Die Grundlage eines jeden %s Getränks: Wasser! Aufgegossen mit ausgewählten Kräutern aus meinem Garten.",
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",
}
},
{
name = "Emerald Mark of Mastery",
questID = 75624,
icon = "interface/icons/inv_mushroom_11",
item = 20897,
announce = {
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"
}
},
{
name = "Emerald Mark of Mastery",
questID = 74352,
icon = "interface/icons/inv_mushroom_11",
item = 193440,
announce = {
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"
}
}
}
---------------------------------------------------------------------------------------------------
-- Code to replace %s in announce texts with item links. Replaces the GetItemLinkById(...) function
local function LoadItem(item)
for k, v in pairs(addon.db[item.dbID].announce) do -- replace the %s with the itemlink in eal locale in the .announce key
addon.db[item.dbID].announce[k] = format(v, item:GetItemLink())
end
end
for i, v in ipairs(addon.db) do
local item = Item:CreateFromItemID(v.item)
item.dbID = i
item:ContinueOnItemLoad(function() LoadItem(item) end)
end