vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | TITAN_EMOTEMENU_ID = "EmoteMenu"; |
2 | TITAN_EMOTEMENURIGHT_ID = "EmoteMenuRight"; |
||
3 | TITAN_EMOTEMENU_ICON = "Interface\\Icons\\Ability_Hunter_Pet_WindSerpent" |
||
4 | |||
5 | TITAN_EMOTEMENU_VERSION = "11100-1"; |
||
6 | |||
7 | TitanPanelModMenu_EmoteMenuEmbeddable = true; |
||
8 | |||
9 | --[[ |
||
10 | TitanEmoteMenu |
||
11 | by Dsanai of Whisperwind |
||
12 | |||
13 | Special thanks to Tekkub for the borrowed code from TitanModMenu |
||
14 | |||
15 | This mod is meant to give the player a quickly-accessible list of emotes, organized by the 'feeling' behind them. |
||
16 | For instance, if you're feeling cranky, something in the Unhappy category will likely work. If you're Alliance and |
||
17 | run into a Horde character, the Hostile category is rife with choices. |
||
18 | |||
19 | I've designed this mod to allow emotes to sort to more than one category, where necessary. |
||
20 | |||
21 | If the end user wishes to change these categories, simply edit EmoteData.lua in a text editor (such as Notepad), |
||
22 | locate this part within the Emote record you wish to change: ["types"] = {0,2}, |
||
23 | And simply list all the categories you want it to sort to, separated by commas. |
||
24 | A list of the numbers, and what categories they represent, is found at the top of EmoteData.lua. |
||
25 | |||
26 | CHANGES |
||
27 | |||
28 | v11100-1 |
||
29 | -- Updated for Patch 1.11. |
||
30 | |||
31 | v10900-1 |
||
32 | -- Added informative tooltip text. |
||
33 | -- Updated TOC version. |
||
34 | |||
35 | v1.2 |
||
36 | -- Added DE localization of all available emotes for that client (thanks lapicidae @ Curse!) |
||
37 | |||
38 | v1.1 |
||
39 | -- Added hooks so that it can interface with ModMenu (if it's installed) (courtesy Tekkub) |
||
40 | -- Added FR localization of all available emotes for that client (thanks, Eurocontrol !) |
||
41 | |||
42 | v1.0 |
||
43 | -- Initial release |
||
44 | |||
45 | ]] |
||
46 | |||
47 | -------------------------------------------- |
||
48 | -- onFunctions -- |
||
49 | -------------------------------------------- |
||
50 | |||
51 | function TitanPanelEmoteMenuButton_OnLoad() |
||
52 | this.registry = { |
||
53 | id = TITAN_EMOTEMENU_ID, |
||
54 | menuText = TITAN_EMOTEMENU_MENU_TEXT, |
||
55 | buttonTextFunction = "TitanPanelEmoteMenuButton_GetButtonText", |
||
56 | icon = TITAN_EMOTEMENU_ICON, |
||
57 | iconWidth = 16, |
||
58 | savedVariables = { |
||
59 | ShowIcon = 1, |
||
60 | ShowLabelText = 1, |
||
61 | } |
||
62 | }; |
||
63 | end |
||
64 | |||
65 | function TitanPanelEmoteMenuRightButton_OnLoad() |
||
66 | this.registry = { |
||
67 | id = TITAN_EMOTEMENURIGHT_ID, |
||
68 | menuText = TITAN_EMOTEMENU_MENU_TEXTRIGHT, |
||
69 | buttonTextFunction = "TitanPanelEmoteMenuButton_GetButtonText", |
||
70 | tooltipTitle = TITAN_EMOTEMENU_MENU_TEXT, |
||
71 | tooltipTextFunction = "TitanPanelEmoteMenuButton_GetTooltipText", |
||
72 | icon = TITAN_EMOTEMENU_ICON, |
||
73 | iconWidth = 16, |
||
74 | savedVariables = { |
||
75 | ShowIcon = 1, |
||
76 | ShowLabelText = 1, |
||
77 | } |
||
78 | }; |
||
79 | end |
||
80 | |||
81 | function TitanPanelEmoteMenuButton_OnEvent() |
||
82 | end |
||
83 | |||
84 | -------------------------------------------- |
||
85 | -- Mod Functions -- |
||
86 | -------------------------------------------- |
||
87 | |||
88 | function TitanPanelEmoteMenuButton_GetTooltipText() |
||
89 | local value = "Right-click for a list of emotes."; |
||
90 | return value; |
||
91 | end |
||
92 | |||
93 | function TitanPanelEmoteMenu_ToggleFrame(f) |
||
94 | local fram = getglobal(f); |
||
95 | if (not fram) then fram = getglobal(this.value); end |
||
96 | DropDownList1:Hide(); |
||
97 | if (fram:IsVisible()) then |
||
98 | HideUIPanel(fram, true); |
||
99 | else |
||
100 | ShowUIPanel(fram, true); |
||
101 | end |
||
102 | end |
||
103 | |||
104 | function TitanPanelEmoteMenu_PassSlashCmd(c) |
||
105 | local cmd = c; |
||
106 | if (not cmd) then cmd = "/"..this.value; end |
||
107 | DropDownList1:Hide(); |
||
108 | TitanPanelEmoteMenuEditBox:SetText(cmd); |
||
109 | ChatEdit_SendText(TitanPanelEmoteMenuEditBox); |
||
110 | end |
||
111 | |||
112 | function TitanPanelEmoteMenu_CallFunction(f) |
||
113 | local funct = f; |
||
114 | if (not funct) then funct = this.value; end |
||
115 | DropDownList1:Hide(); |
||
116 | local func = getglobal(funct); |
||
117 | func(); |
||
118 | end |
||
119 | |||
120 | function TitanPanelEmoteMenu_RegisterMenu(addon, infoarray) |
||
121 | TitanEmoteMenu_MenuItems[addon] = infoarray; |
||
122 | end |
||
123 | |||
124 | -------------------------------------------- |
||
125 | -- Titan Functions -- |
||
126 | -------------------------------------------- |
||
127 | |||
128 | function TitanPanelEmoteMenuButton_GetButtonText(id) |
||
129 | return TITAN_EMOTEMENU_MENU_BARTEXT, ""; |
||
130 | end |
||
131 | |||
132 | function TitanPanelEmoteMenu_ToggleIconText() |
||
133 | if (TitanGetVar(TITAN_EMOTEMENU_ID, "ShowIcon") == TitanGetVar(TITAN_EMOTEMENU_ID, "ShowLabelText")) then |
||
134 | TitanToggleVar(TITAN_EMOTEMENU_ID, "ShowLabelText"); |
||
135 | else |
||
136 | TitanToggleVar(TITAN_EMOTEMENU_ID, "ShowIcon"); |
||
137 | TitanToggleVar(TITAN_EMOTEMENU_ID, "ShowLabelText"); |
||
138 | end |
||
139 | TitanPanelButton_UpdateButton(TITAN_EMOTEMENU_ID, 1); |
||
140 | end |
||
141 | |||
142 | function TitanPanelEmoteMenu_ToggleIcon() |
||
143 | if ((TitanGetVar(TITAN_EMOTEMENU_ID, "ShowIcon")) and (not TitanGetVar(TITAN_EMOTEMENU_ID, "ShowLabelText"))) then |
||
144 | TitanToggleVar(TITAN_EMOTEMENU_ID, "ShowLabelText"); |
||
145 | end |
||
146 | TitanToggleVar(TITAN_EMOTEMENU_ID, "ShowIcon"); |
||
147 | TitanPanelButton_UpdateButton(TITAN_EMOTEMENU_ID, 1); |
||
148 | end |
||
149 | |||
150 | function TitanPanelEmoteMenu_ToggleText() |
||
151 | if ((not TitanGetVar(TITAN_EMOTEMENU_ID, "ShowIcon")) and (TitanGetVar(TITAN_EMOTEMENU_ID, "ShowLabelText"))) then |
||
152 | TitanToggleVar(TITAN_EMOTEMENU_ID, "ShowIcon"); |
||
153 | end |
||
154 | TitanToggleVar(TITAN_EMOTEMENU_ID, "ShowLabelText"); |
||
155 | TitanPanelButton_UpdateButton(TITAN_EMOTEMENU_ID, 1); |
||
156 | end |
||
157 | |||
158 | function TitanPanelEmoteMenu_Hide() |
||
159 | TitanPanel_RemoveButton(TITAN_EMOTEMENU_ID); |
||
160 | end |
||
161 | |||
162 | function TitanPanelEmoteMenuRight_Hide() |
||
163 | TitanPanel_RemoveButton(TITAN_EMOTEMENURIGHT_ID); |
||
164 | end |
||
165 | |||
166 | function TitanPanelRightClickMenu_PrepareEmoteMenuMenu(level) |
||
167 | if (level == 1) then |
||
168 | TitanPanelEmoteMenu_BuildRootMenu(); |
||
169 | end |
||
170 | if (level == 2) then |
||
171 | TitanPanelEmoteMenu_BuildCatMenu(); |
||
172 | end |
||
173 | end |
||
174 | |||
175 | function TitanPanelRightClickMenu_PrepareEmoteMenuRightMenu(level) |
||
176 | if (level == 1) then |
||
177 | TitanPanelEmoteMenu_BuildRootMenu(); |
||
178 | end |
||
179 | if (level == 2) then |
||
180 | TitanPanelEmoteMenu_BuildCatMenu(); |
||
181 | end |
||
182 | end |
||
183 | |||
184 | function TitanPanelEmoteMenu_BuildRootMenu(modmenuembedded) |
||
185 | local level = 1; |
||
186 | if (modmenuembedded) then level = 2; end |
||
187 | |||
188 | TitanPanelRightClickMenu_AddTitle(TitanPlugins[TITAN_EMOTEMENU_ID].menuText, level); |
||
189 | TitanPanelRightClickMenu_AddSpacer(level); |
||
190 | |||
191 | for key, value in EL_Types do |
||
192 | local info = {}; |
||
193 | local val = {}; |
||
194 | val.isemotemenu = true; |
||
195 | val.key = key; |
||
196 | info.text = value; |
||
197 | info.value = val; |
||
198 | info.hasArrow = 1; |
||
199 | UIDropDownMenu_AddButton(info, level); |
||
200 | end |
||
201 | |||
202 | end |
||
203 | |||
204 | function TitanPanelEmoteMenu_BuildCatMenu(modmenuembedded) |
||
205 | local level = 2; |
||
206 | if (modmenuembedded) then level = 3; end |
||
207 | local elType = UIDROPDOWNMENU_MENU_VALUE.key; |
||
208 | local hasTarget = UnitName("target"); |
||
209 | local genderCode = UnitSex("player"); |
||
210 | local genderHe = nil; |
||
211 | local genderHis = nil; |
||
212 | local genderhe = nil; |
||
213 | local genderhis = nil; |
||
214 | if (genderCode==0) then -- male |
||
215 | genderHe = "He"; |
||
216 | genderhe = "he"; |
||
217 | genderHis = "His"; |
||
218 | genderhis = "his"; |
||
219 | else -- female (we hope) |
||
220 | genderHe = "She"; |
||
221 | genderhe = "she"; |
||
222 | genderHis = "Her"; |
||
223 | genderhis = "her"; |
||
224 | end |
||
225 | |||
226 | for key, value in EL_Emotes do |
||
227 | for key2, value2 in value.types do |
||
228 | if (elType == value2) then |
||
229 | local info = {}; |
||
230 | if (hasTarget) then |
||
231 | info.text = TitanPanelEmoteMenu_GetOnDemandText(value,true); |
||
232 | info.text = string.gsub(info.text,"<Target>",hasTarget); |
||
233 | else |
||
234 | info.text = TitanPanelEmoteMenu_GetOnDemandText(value,false); |
||
235 | end |
||
236 | info.value = key; |
||
237 | info.func = TitanPanelEmoteMenu_HandleModClick; |
||
238 | |||
239 | info.text = string.gsub(info.text,"<He>",genderHe); |
||
240 | info.text = string.gsub(info.text,"<His>",genderHis); |
||
241 | info.text = string.gsub(info.text,"<he>",genderhe); |
||
242 | info.text = string.gsub(info.text,"<his>",genderhis); |
||
243 | |||
244 | UIDropDownMenu_AddButton(info, level); |
||
245 | end |
||
246 | end |
||
247 | end |
||
248 | end |
||
249 | |||
250 | function TitanPanelEmoteMenu_HandleModClick() |
||
251 | if (this.value) then |
||
252 | if (EL_Types[EL_Emotes[this.value]["types"][1]] and EL_Types[EL_Emotes[this.value]["types"][1]]=="Custom") then -- Custom emote |
||
253 | local emoteText; |
||
254 | local hasTarget = UnitName("target"); |
||
255 | local genderCode = UnitSex("player"); |
||
256 | local genderHe = nil; |
||
257 | local genderHis = nil; |
||
258 | local genderhe = nil; |
||
259 | local genderhis = nil; |
||
260 | if (genderCode==0) then -- male |
||
261 | genderHe = "He"; |
||
262 | genderhe = "he"; |
||
263 | genderHis = "His"; |
||
264 | genderhis = "his"; |
||
265 | else -- female (we hope) |
||
266 | genderHe = "She"; |
||
267 | genderhe = "she"; |
||
268 | genderHis = "Her"; |
||
269 | genderhis = "her"; |
||
270 | end |
||
271 | |||
272 | if (hasTarget) then |
||
273 | emoteText = EL_Emotes[this.value].target; |
||
274 | emoteText = string.gsub(emoteText,"<Target>",hasTarget); |
||
275 | else |
||
276 | emoteText = EL_Emotes[this.value].none; |
||
277 | end |
||
278 | emoteText = string.gsub(emoteText,"<He>",genderHe); |
||
279 | emoteText = string.gsub(emoteText,"<His>",genderHis); |
||
280 | emoteText = string.gsub(emoteText,"<he>",genderhe); |
||
281 | emoteText = string.gsub(emoteText,"<his>",genderhis); |
||
282 | SendChatMessage(emoteText,"EMOTE"); |
||
283 | else |
||
284 | TitanPanelEmoteMenu_PassSlashCmd("/"..this.value); |
||
285 | end |
||
286 | end |
||
287 | end |
||
288 | |||
289 | function TitanPanelEmoteMenu_GetOnDemandText(value,hasTarget) |
||
290 | local color; |
||
291 | local flag = nil; |
||
292 | local returnCode; |
||
293 | local emoteText; |
||
294 | |||
295 | if (hasTarget) then emoteText = value.target; else emoteText = value.none; end |
||
296 | |||
297 | if (EL_Types[value["types"][1]] and EL_Types[value["types"][1]]=="Custom") then |
||
298 | emoteText = UnitName("player").." "..emoteText; -- custom emote |
||
299 | end |
||
300 | |||
301 | if (EL_React[value.react] == "") then -- None (text only) White |
||
302 | color = "fffefefe"; |
||
303 | elseif (EL_React[value.react] == "A") then -- Animated - Purple |
||
304 | color = "ffa335ee"; |
||
305 | flag = "A"; |
||
306 | elseif (EL_React[value.react] == "V") then -- Voice - Orange |
||
307 | color = "ffff8000"; |
||
308 | flag = "V"; |
||
309 | elseif (EL_React[value.react] == "AV") then -- Both - Green |
||
310 | color = "ff1eff00"; |
||
311 | flag = "AV"; |
||
312 | else -- Grey (Unknown) |
||
313 | color = "ff9d9d9d"; |
||
314 | end |
||
315 | |||
316 | returnCode = "|c" .. color .. emoteText .. FONT_COLOR_CODE_CLOSE; |
||
317 | if (flag) then returnCode = returnCode.." ["..flag.."]"; end |
||
318 | return returnCode; |
||
319 | end |