View Single Post
06-05-13, 01:43 PM   #9
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 758
I just found out that my ItemLinkMacrosFanUpdate needs a fix. Can someone please help me with it?

For some reason it blocks to copy pet cages names into the auction house window. I can't copy the name from a petcage in my bag into the AH and not from the chat into AH.

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 ( TradeSkillFrame and TradeSkillFrame:IsShown() )  then
  30.         local item;
  31.         if ( strfind(text, "item:", 1, true) ) then
  32.             item = GetItemInfo(text);
  33.         end
  34.         if ( item ) then
  35.             TradeSkillFrameSearchBox:SetFontObject("ChatFontSmall");
  36.             TradeSkillFrameSearchBoxSearchIcon:SetVertexColor(1.0, 1.0, 1.0);
  37.             TradeSkillFrameSearchBox:SetText(item);
  38.             return true;
  39.         end
  40.     end
  41.        if ( MacroFrameText and MacroFrameText:IsVisible() ) then
  42.           local macroText = MacroFrameText:GetText();
  43.          
  44.           local item;
  45.           if ( strfind(text, "item:", 1, true) ) then
  46.              item = GetItemInfo(text);
  47.           end
  48.           -- 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
  49.           local spellLink = strfind(text, "|Hspell:", 1, true)
  50.          
  51.           local enchantLink = strfind(text, "|Henchant:", 1, true)
  52.           local achievementLink = strfind(text, "|Hachievement:", 1, true)
  53.           local talentLink = strfind(text, "|Htalent:", 1, true)
  54.           local otherLink = enchantLink or achievementLink or talentLink
  55.          
  56.           if ( not otherLink and macroText == "" and not item ) then
  57.              MacroFrameText:Insert(SLASH_CAST1.." "..text);
  58.           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
  59.              MacroFrameText:Insert(item or text);
  60.           else
  61.              MacroFrameText:Insert(text);
  62.           end
  63.           return true;
  64.        end
  65.        return false;
  66.     end
  67.     SLASH_ADDTEXT1="/addtext"
  68.     SlashCmdList["ADDTEXT"] = function(text)
  69.        if ( MacroFrameText and MacroFrameText:IsVisible() ) then
  70.           MacroFrameText:Insert(text)
  71.        end
  72.     end
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
  Reply With Quote