Originally Posted by Carriola
Thank you, you were very kind to answer me. Unfortunately, however, I don't think the solutions work. From the addon channel with SendAddonMessage(MyChannelAddon_channel, msg, "WHISPER", sender) I receive the profession link of the other guildmate For example [Tailoring]. I have to put this link on a frame that collects all the links that I receive from other guildmate.
For now the only way I've found is to put a chat frame on the frame (see screen):
<snipped code for brevity>
but unfortunately I find chat frames unpredictable. Sometimes it disappears for no reason and i can't really hide ButtonFrame, EditBox and tab of the chat.
I will try to find another way, thank you very much!
You have been very kind!
|
This works in 10.2.5 so hopefully it will work for you
How this example addon works is when you first log in / reload the ui you can open the tradeskill of your choice and it will automatically grab the skill link and send it via addonmessage to the chatframe. The addon then stops checking for the tradeskill frame being opened and closes the window. It then sees there is an addon message and grabs the link sent earlier and puts it into the fontstring set up for it.
Clicking on that link will then bring up the trade skill window ( showing the name of the link sender - in my case me ).
Looking at the tradeskill frame there is no option for WHISPERing the tradeskill link automatically as an addon message with a special prefix. So I had to use this roundabout route to get the tradeskill link and send it manually via addonmessage with the prefix.
It adds a clickable profession link to a font string so does what you are asking, you might just have to do some additional work, to make it work in your addon.
If my example doesn't work for you in 10.2.0 or 10.2.5 then mayhap something is not working right at your end and could explain the problems you are having. And as Fizzle says, we cannot help with addons not designed to work on official servers.
Lua Code:
local addonName,db = ...
-- Simple Frame to display the link(s) and control how that link works when you click it
local cf = CreateFrame("Frame","TestFrame",UIParent)
cf:SetSize(600,100)
cf:SetPoint("CENTER",0,0)
cf:SetHyperlinksEnabled(true)
cf:SetScript("OnHyperlinkClick", ChatFrame_OnHyperlinkShow)
-- Font string that holds the text
-- I am just using one, but you could have a list of strings set up
cf.fs = cf:CreateFontString(nil,"OVERLAY","GameFontNormal")
cf.fs:SetAllPoints()
local function OnEvent(self,event,...)
local args = { ... }
-- Register addon message prefix when the addon is loaded
if event == "ADDON_LOADED" and args[1] == addonName then
local successfulRequest = C_ChatInfo.RegisterAddonMessagePrefix("XTA-AMP")
if successfulRequest then db.addonMessagePrefix = "XTA-AMP" end
-- This is used to get the trade skill link when they open the tradeskill frame
-- If you have another way to send the addon message the link then use that
elseif event =="TRADE_SKILL_SHOW" then
self:RegisterEvent("TRADE_SKILL_LIST_UPDATE")
elseif event == "TRADE_SKILL_LIST_UPDATE" then
local link = C_TradeSkillUI.GetTradeSkillListLink()
local success = C_ChatInfo.SendAddonMessage(db.addonMessagePrefix, link, "WHISPER", UnitName("player"))
-- Make sure we close the tradeskill frame and unregister events so that it doesn't trigger until the next reload
C_TradeSkillUI.CloseTradeSkill()
self:UnregisterEvent("TRADE_SKILL_LIST_UPDATE")
self:UnregisterEvent("TRADE_SKILL_SHOW")
-- Monitor Addon messages in the chat frame
elseif event == "CHAT_MSG_ADDON" then
-- args 1 is the prefix
-- args 2 is the message
if args[1] == db.addonMessagePrefix then
-- set the profession link to the fontstring requiring it
-- remember I am using a single fontstring, if you are using multiple, make sure you are updating the correct one
cf.fs:SetText(args[2] or "")
end
end
end
local f = CreateFrame("Frame")
f:RegisterEvent("ADDON_LOADED")
f:RegisterEvent("PLAYER_LOGIN")
f:RegisterEvent("TRADE_SKILL_SHOW")
f:RegisterEvent("CHAT_MSG_ADDON")
f:SetScript("OnEvent",OnEvent)