vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 UnitPopupButtons["ADD_FRIEND"] = { text = TEXT(ADD_FRIEND), dist = 0 };
2 UnitPopupButtons["ADD_IGNORE"] = { text = TEXT(IGNORE), dist = 0 };
3 UnitPopupButtons["WHO"] = { text = TEXT(WHO), dist = 0 };
4 UnitPopupButtons["ADD_GUILD"] = { text = "Guild Invite", dist = 0 };
5 UnitPopupButtons["GET_NAME"] = { text = "Get Name", dist = 0 };
6  
7 UnitPopupMenus["FRIEND"] = { "WHISPER", "INVITE", "TARGET", "GET_NAME", "ADD_FRIEND", "ADD_IGNORE", "WHO", "ADD_GUILD", "GUILD_PROMOTE", "GUILD_LEAVE", "CANCEL" };
8 UnitPopupMenus["PARTY"] = { "WHISPER", "PROMOTE", "LOOT_PROMOTE", "UNINVITE", "INSPECT", "TRADE", "FOLLOW", "DUEL", "ADD_FRIEND", "WHO", "ADD_GUILD", "GET_NAME", "RAID_TARGET_ICON", "CANCEL" };
9 UnitPopupMenus["PLAYER"] = { "WHISPER", "INSPECT", "INVITE", "TRADE", "FOLLOW", "DUEL", "ADD_FRIEND", "ADD_IGNORE", "WHO", "ADD_GUILD", "GET_NAME", "RAID_TARGET_ICON", "CANCEL" };
10  
11 function SuperPlayerLink_OnLoad()
12 --hook UnitPopup_OnClick funciton
13 ori_unitpopup = UnitPopup_OnClick;
14 UnitPopup_OnClick = spl_unitpopup;
15  
16 --hook SetItemRef funciton
17 ori_SetItemRef = SetItemRef;
18 SetItemRef = spl_SetItemRef;
19 end
20  
21 function spl_unitpopup()
22 local dropdownFrame = getglobal(UIDROPDOWNMENU_INIT_MENU);
23 local button = this.value;
24 local unit = dropdownFrame.unit;
25 local name = dropdownFrame.name;
26 local server = dropdownFrame.server;
27  
28 if ( button == "ADD_FRIEND" ) then
29 AddFriend(name);
30 elseif ( button == "ADD_IGNORE" ) then
31 AddIgnore(name);
32 elseif ( button == "WHO" ) then
33 SendWho("n-"..name);
34 elseif (button == "ADD_GUILD") then
35 GuildInviteByName(name);
36 elseif (button == "GET_NAME") then
37 spl_GetName(name);
38 else
39 return ori_unitpopup();
40 end
41 PlaySound("UChatScrollButton");
42 end
43  
44 function spl_SetItemRef(link, text, button)
45 if (not link) then
46 link = arg1;
47 end
48 if (not text) then
49 text = arg2;
50 end
51 if (not button) then
52 button = arg3;
53 end
54 if ( strsub(link, 1, 6) == "player" ) then
55 local name = strsub(link, 8);
56 if ( name and (strlen(name) > 0) ) then
57 name = gsub(name, "([^%s]*)%s+([^%s]*)%s+([^%s]*)", "%3");
58 name = gsub(name, "([^%s]*)%s+([^%s]*)", "%2");
59 if ( IsShiftKeyDown() ) then
60 local staticPopup;
61 staticPopup = StaticPopup_Visible("ADD_IGNORE");
62 if ( staticPopup ) then
63 -- If add ignore dialog is up then enter the name into the editbox
64 getglobal(staticPopup.."EditBox"):SetText(name);
65 return;
66 end
67 staticPopup = StaticPopup_Visible("ADD_FRIEND");
68 if ( staticPopup ) then
69 -- If add ignore dialog is up then enter the name into the editbox
70 getglobal(staticPopup.."EditBox"):SetText(name);
71 return;
72 end
73 staticPopup = StaticPopup_Visible("ADD_GUILDMEMBER");
74 if ( staticPopup ) then
75 -- If add ignore dialog is up then enter the name into the editbox
76 getglobal(staticPopup.."EditBox"):SetText(name);
77 return;
78 end
79 staticPopup = StaticPopup_Visible("ADD_RAIDMEMBER");
80 if ( staticPopup ) then
81 -- If add ignore dialog is up then enter the name into the editbox
82 getglobal(staticPopup.."EditBox"):SetText(name);
83 return;
84 end
85 if ( ChatFrameEditBox:IsVisible() ) then
86 ChatFrameEditBox:Insert(name);
87 else
88 SendWho("n-"..name);
89 end
90 elseif ( IsControlKeyDown() ) then
91 TargetByName(name);
92 elseif ( IsAltKeyDown() ) then
93 spl_GetName(name);
94 elseif ( button == "RightButton" ) then
95 FriendsFrame_ShowDropdown(name, 1);
96 else
97 ChatFrame_SendTell(name);
98 end
99 end
100 return;
101 end
102 return ori_SetItemRef(link, text, button);
103 end
104  
105 function spl_GetName(name)
106 if ( ChatFrameEditBox:IsVisible() ) then
107 ChatFrameEditBox:Insert(name);
108 else
109 DEFAULT_CHAT_FRAME.editBox:Hide();
110 DEFAULT_CHAT_FRAME.editBox.chatType = "SAY";
111 ChatEdit_UpdateHeader(DEFAULT_CHAT_FRAME.editBox);
112 if (not DEFAULT_CHAT_FRAME.editBox:IsVisible()) then
113 ChatFrame_OpenChat(name, DEFAULT_CHAT_FRAME);
114 end
115 end
116 end