ItemLinkMacros
ItemLinkMacros is an addon which allows you to add item links into your macros simply by Shift-LClicking an item link while the macro window is open.
|
The macro link part of this addon is still working fine BUT since 5.1 it blocks Shift klicking items to search them inside profession windows. Can anyone tell me how to fix this please?
Lua Code:
local _G = getfenv(0)
--stack references for globals
local GetItemInfo = _G.GetItemInfo
local GetItemSpell = _G.GetItemSpell
local strfind = _G.strfind
------- Replacing the ChatEdit_InsertLink function
local oldFunction = ChatEdit_InsertLink
ChatEdit_InsertLink = function(text)
if ( not text ) then
return false;
end
local activeWindow = ChatEdit_GetActiveWindow();
if ( activeWindow ) then
activeWindow:Insert(text);
return true;
end
if ( BrowseName and BrowseName:IsVisible() ) then
local item;
if ( strfind(text, "item:", 1, true) ) then
item = GetItemInfo(text);
end
if ( item ) then
BrowseName:SetText(item);
return true;
end
end
if ( MacroFrameText and MacroFrameText:IsVisible() ) then
local macroText = MacroFrameText:GetText();
local item;
if ( strfind(text, "item:", 1, true) ) then
item = GetItemInfo(text);
end
-- my check for whether this is a spell or "other" link is kinda bad. I could improve it with a Regex, but I doubt there will be many problems
local spellLink = strfind(text, "|Hspell:", 1, true)
local enchantLink = strfind(text, "|Henchant:", 1, true)
local achievementLink = strfind(text, "|Hachievement:", 1, true)
local talentLink = strfind(text, "|Htalent:", 1, true)
local otherLink = enchantLink or achievementLink or talentLink
if ( not otherLink and macroText == "" and not item ) then
MacroFrameText:Insert(SLASH_CAST1.." "..text);
elseif ( not otherLink and not spellLink and ( strfind(macroText, SLASH_USE1, 1, true) or strfind(macroText, SLASH_EQUIP1, 1, true) or strfind(macroText, SLASH_CAST1, 1, true) ) ) then
MacroFrameText:Insert(item or text);
else
MacroFrameText:Insert(text);
end
return true;
end
return false;
end
SLASH_ADDTEXT1="/addtext"
SlashCmdList["ADDTEXT"] = function(text)
if ( MacroFrameText and MacroFrameText:IsVisible() ) then
MacroFrameText:Insert(text)
end
end