Reply
 
Thread Tools Display Modes
Unread 11-29-12, 07:33 AM   #1
Tonyleila
A Rage Talon Dragon Guard
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 311
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
Unread 11-29-12, 09:02 AM   #2
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 761
Just beware that changing the global function ChatEdit_InsertLink will taint and break any secure code used by the chat and such, so if chat related stuff start to stop working, keep this in mind.
__________________
Profile: Curse | Wowhead
Vlad is offline   Reply With Quote
Unread 11-29-12, 10:59 AM   #3
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,007
You're missing this block of code that should be after the MacroFrameText check.
Lua Code:
  1. if ( TradeSkillFrame and TradeSkillFrame:IsShown() )  then
  2.     local item;
  3.     if ( strfind(text, "item:", 1, true) ) then
  4.         item = GetItemInfo(text);
  5.     end
  6.     if ( item ) then
  7.         TradeSkillFrameSearchBox:SetFontObject("ChatFontSmall");
  8.         TradeSkillFrameSearchBoxSearchIcon:SetVertexColor(1.0, 1.0, 1.0);
  9.         TradeSkillFrameSearchBox:SetText(item);
  10.         return true;
  11.     end
  12. end
__________________
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 11-29-12 at 11:22 AM.
SDPhantom is offline   Reply With Quote
Unread 11-29-12, 06:01 PM   #4
Tonyleila
A Rage Talon Dragon Guard
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 311
Originally Posted by SDPhantom View Post
You're missing this block of code that should be after the...
Thanks for the code works fine now!
I'll send the code to author so he can update it
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
Tonyleila is offline   Reply With Quote
Unread 11-30-12, 06:12 PM   #5
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,007
That came out of the last half of the function the author copied from and modified the macro handling of. He just missed including it in his code.
__________________
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
SDPhantom is offline   Reply With Quote
Unread 12-01-12, 01:07 PM   #6
natassja72
A Fallenroot Satyr
Join Date: Aug 2008
Posts: 29
Untill it gets updated, if at all, would it be possible to put here all code, including the fix? I don't want to mess things up myself...
natassja72 is offline   Reply With Quote
Reply

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