Thread Tools Display Modes
Prev Previous Post   Next Post Next
Unread 11-29-12, 07:33 AM   #1
Tonyleila
An Onyxian Warder
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 371
Item Link Macros

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:
  1. local _G = getfenv(0)
  2. --stack references for globals
  3. local GetItemInfo = _G.GetItemInfo
  4. local GetItemSpell = _G.GetItemSpell
  5.  
  6. local strfind = _G.strfind
  7. ------- Replacing the ChatEdit_InsertLink function
  8. local oldFunction = ChatEdit_InsertLink
  9.  
  10. ChatEdit_InsertLink = function(text)
  11.    if ( not text ) then
  12.       return false;
  13.    end
  14.    local activeWindow = ChatEdit_GetActiveWindow();
  15.    if ( activeWindow ) then
  16.       activeWindow:Insert(text);
  17.       return true;
  18.    end
  19.    if ( BrowseName and BrowseName:IsVisible() ) then
  20.       local item;
  21.       if ( strfind(text, "item:", 1, true) ) then
  22.          item = GetItemInfo(text);
  23.       end
  24.       if ( item ) then
  25.          BrowseName:SetText(item);
  26.          return true;
  27.       end
  28.    end
  29.    if ( MacroFrameText and MacroFrameText:IsVisible() ) then
  30.       local macroText = MacroFrameText:GetText();
  31.      
  32.       local item;
  33.       if ( strfind(text, "item:", 1, true) ) then
  34.          item = GetItemInfo(text);
  35.       end
  36.       -- 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
  37.       local spellLink = strfind(text, "|Hspell:", 1, true)
  38.      
  39.       local enchantLink = strfind(text, "|Henchant:", 1, true)
  40.       local achievementLink = strfind(text, "|Hachievement:", 1, true)
  41.       local talentLink = strfind(text, "|Htalent:", 1, true)
  42.       local otherLink = enchantLink or achievementLink or talentLink
  43.      
  44.       if ( not otherLink and macroText == "" and not item ) then
  45.          MacroFrameText:Insert(SLASH_CAST1.." "..text);
  46.       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
  47.          MacroFrameText:Insert(item or text);
  48.       else
  49.          MacroFrameText:Insert(text);
  50.       end
  51.       return true;
  52.    end
  53.    return false;
  54. end
  55. SLASH_ADDTEXT1="/addtext"
  56. SlashCmdList["ADDTEXT"] = function(text)
  57.    if ( MacroFrameText and MacroFrameText:IsVisible() ) then
  58.       MacroFrameText:Insert(text)
  59.    end
  60. end
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________

Last edited by Tonyleila : 11-29-12 at 07:36 AM.
Tonyleila is offline   Reply With Quote
 

Go BackWoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Item Link Macros

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off