vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 local dewdrop = DewdropLib:GetInstance('1.0')
2 local tablet = TabletLib:GetInstance('1.0')
3  
4 --[[
5 EmoteFu
6 by Cilraaz of Cenarion Circle
7  
8 Please note that this mod is a port of TitanEmoteMenu by Dsanai of Whisperwind. Some of the functions are largely based
9 on that mod. The entire emote list is also borrowed from TitanEmoteMenu. So a huge thanks to Dsanai for even making
10 this mod possible.
11  
12 Also, a special thanks to chuckg from www.wowinterface.com. Chuckg helped in straightening out a few problem areas in
13 my code, as well as pointing out the DoEmote API function, which was invalueable.
14  
15 Welcome to EmoteFu! This is a FuBar port of TitanEmoteMenu. It is meant to give players an easily
16 accessible menu of emotes. The emotes have been sorted by category (ie. "Friendly", "Hostile", etc) to make it quite
17 simple to quickly access the emote you want. Emotes can end up in more than one category, where applicable (ie. /dance
18 can be found in "Happy" and "Affection").
19  
20 Emotes in the list are colorized and marked with a label (A, V, AV) if they are Animated, Voice, or Both.
21  
22 It is also possible to add your own custom emotes! To do so, simply edit the EmoteData.lua file. You will want to
23 match the format exactly or that mod may no longer function! If that occurs, just replace the EmoteData.lua with a good
24 copy from the zip.
25  
26 Change Log:
27 v0.1.5 (TOC 11200)
28 -- Issue from v0.1.3 (gender handling) somehow occurred again in version 0.1.4, but this has now been corrected
29 v0.1.4 (TOC 11200)
30 -- Updated TOC
31 v0.1.3b (TOC 11100)
32 -- Re-upped the archive yet again. I added the directory structure to include a folder, so that the zip only needs unzipped into the AddOns folder, rather than the user needing to create a folder for it
33 v0.1.3a (TOC 11100)
34 -- Re-upped the archive as a ZIP file, rather than a RAR file. Sorry about that all!
35 v0.1.3 (TOC 11100)
36 -- Changed gender handling to fit Blizzard's new scheme (now 1=unknown, 2=male, 3=female...was 0=male, 1=female, 2=unknown)
37 -- Updated TOC
38 v0.1.2 (TOC 11000)
39 -- As per feature request 839, an option has been added to the menu labeled "Toggle Slash Commands". When selected, this will cause all emotes in the menus to be prefixed with their slash command. In the case of custom emotes, they will be prefixed with "Custom: ".
40 v0.1.1 (TOC 11000)
41 -- Fixed an issue with some emotes not working properly
42 -- Removed an unnecessary line from EmoteFuLocals.lua
43 -- Fixed one emote, which was showing as having neither an action or vocal, when in fact it had an action associated with it
44 -- Files changed: All
45 v0.1.0 (TOC 11000)
46 -- Initial Release
47  
48 To do:
49 -- Add localization
50  
51 ]]
52  
53 EmoteFu = FuBarPlugin:GetInstance("1.2"):new({
54 name = EmoteFuLocals.NAME,
55 description = EmoteFuLocals.DESCRIPTION,
56 version = "0.1.2",
57 releaseDate = "06-03-2006",
58 aceCompatible = 103,
59 fuCompatible = 101,
60 author = "Cilraaz",
61 email = "Cilraaz@gmail.com",
62 website = "http://cilraaz.wowinterface.com/",
63 category = "others",
64 db = AceDatabase:new("EmoteFuDB"),
65 cmd = AceChatCmd:new(EmoteFuLocals.COMMANDS, EmoteFuLocals.CMD_OPTIONS),
66 loc = EmoteFuLocals,
67 data = EmoteData,
68 hasIcon = "Interface\\Icons\\Spell_Shadow_Charm",
69 hasText = "EmoteFu",
70 cannotDetachTooltip = TRUE
71 })
72  
73 EmoteFu.profileCode = true;
74  
75 function EmoteFu:IsShowingSlashCommands()
76 return self.data.showSlashCommand
77 end
78  
79 function EmoteFu:ToggleShowingSlashCommands()
80 self.data.showSlashCommand = not self.data.showSlashCommand
81 if loud then
82 self.cmd:status(self.loc.ARGUMENT_SLASH, self.data.showSlashCommand and 1 or 0, FuBarLocals.MAP_ONOFF)
83 end
84 return self.data.showSlashCommand
85 end
86  
87 function EmoteFu:UpdateTooltip()
88 local cat = tablet:AddCategory()
89 cat:AddLine(
90 "text", self.loc.LMBTEXT
91 )
92 end
93  
94 function EmoteFu:MenuSettings(level, value)
95 if level == 1 then
96  
97 for k, v in EL_Types do
98 local elType = k;
99 local label = v;
100  
101 dewdrop:AddLine(
102 'text', label,
103 'value', elType,
104 'hasArrow', TRUE
105 )
106 end
107  
108 dewdrop:AddLine()
109 dewdrop:AddLine(
110 'text', "Toggle Slash Commands",
111 'arg1', self,
112 'func', "ToggleShowingSlashCommands",
113 'checked', self:IsShowingSlashCommands()
114 )
115  
116 elseif level == 2 then
117  
118 local hasTarget = UnitName("target");
119 local genderCode = UnitSex("player");
120 local genderHe = nil;
121 local genderHis = nil;
122 local genderhe = nil;
123 local genderhis = nil;
124 if (genderCode==2) then -- male
125 genderHe = "He";
126 genderhe = "he";
127 genderHis = "His";
128 genderhis = "his";
129 else -- female (we hope)
130 genderHe = "She";
131 genderhe = "she";
132 genderHis = "Her";
133 genderhis = "her";
134 end
135  
136 for k2, v2 in EL_Emotes do
137 for k3, v3 in v2.types do
138 if (value == v3) then
139 local info = nil;
140 if (hasTarget) then
141 info = self:GetOnDemandText(v2,true);
142 info = string.gsub(info,"<Target>",hasTarget);
143 else
144 info = self:GetOnDemandText(v2,false);
145 end
146  
147 info = string.gsub(info,"<He>",genderHe);
148 info = string.gsub(info,"<His>",genderHis);
149 info = string.gsub(info,"<he>",genderhe);
150 info = string.gsub(info,"<his>",genderhis);
151  
152 for k4, v4 in v2.custom do
153 if (v4 == 1) then
154 slshCmd = "Custom: ";
155 else
156 slshCmd = "/"..k2..": ";
157 end
158 end
159  
160 if (self.data.showSlashCommand) then
161 dewdrop:AddLine(
162 'text', slshCmd..info,
163 'level', 2,
164 'arg1', k2,
165 'func', function(k2)
166 self:HandleModClick(k2)
167 end,
168 'closeWhenClicked', true
169 )
170 else
171 dewdrop:AddLine(
172 'text', info,
173 'level', 2,
174 'arg1', k2,
175 'func', function(k2)
176 self:HandleModClick(k2)
177 end,
178 'closeWhenClicked', true
179 )
180 end
181 end
182 end
183 end
184  
185 end
186 end
187  
188 function EmoteFu:GetOnDemandText(v2,hasTarget)
189 local color;
190 local flag = nil;
191 local returnCode;
192 local emoteText;
193  
194 if (hasTarget) then emoteText = v2.target else emoteText = v2.none end
195  
196 if (EL_Types[v2["types"][1]] and EL_Types[v2["types"][1]]=="Custom") then
197 emoteText = UnitName("player").." "..emoteText; -- custom emote
198 end
199  
200 if (EL_React[v2.react] == "") then -- None (text only) White
201 color = "fffefefe";
202 elseif (EL_React[v2.react] == "A") then -- Animated - Purple
203 color = "ffa335ee";
204 flag = "A";
205 elseif (EL_React[v2.react] == "V") then -- Voice - Orange
206 color = "ffff8000";
207 flag = "V";
208 elseif (EL_React[v2.react] == "AV") then -- Both - Green
209 color = "ff1eff00";
210 flag = "AV";
211 else -- Grey (Unknown)
212 color = "ff9d9d9d";
213 end
214  
215 returnCode = "|c" .. color .. emoteText .. FONT_COLOR_CODE_CLOSE;
216 if (flag) then returnCode = returnCode.." ["..flag.."]"; end
217 return returnCode;
218 end
219  
220 function EmoteFu:HandleModClick(k2)
221 if (k2) then
222 if (EL_Types[EL_Emotes[k2]["types"][1]] and EL_Types[EL_Emotes[k2]["types"][1]]=="Custom") then -- Custom emote
223 local emoteText;
224 local hasTarget = UnitName("target");
225 local genderCode = UnitSex("player");
226 local genderHe = nil;
227 local genderHis = nil;
228 local genderhe = nil;
229 local genderhis = nil;
230 if (genderCode==2) then -- male
231 genderHe = "He";
232 genderhe = "he";
233 genderHis = "His";
234 genderhis = "his";
235 else -- female (we hope)
236 genderHe = "She";
237 genderhe = "she";
238 genderHis = "Her";
239 genderhis = "her";
240 end
241  
242 if (hasTarget) then
243 emoteText = EL_Emotes[k2].target;
244 emoteText = string.gsub(emoteText,"<Target>",hasTarget);
245 else
246 emoteText = EL_Emotes[k2].none;
247 end
248 emoteText = string.gsub(emoteText,"<He>",genderHe);
249 emoteText = string.gsub(emoteText,"<His>",genderHis);
250 emoteText = string.gsub(emoteText,"<he>",genderhe);
251 emoteText = string.gsub(emoteText,"<his>",genderhis);
252  
253 SendChatMessage(emoteText,"EMOTE");
254 else
255 emoteToken = string.upper(k2);
256 if (emoteToken == "LAVISH") then
257 emoteToken = "PRAISE";
258 end
259 if (emoteToken == "EXCITED") then
260 emoteToken = "TALKEX";
261 end
262 if (emoteToken == "DOOM") then
263 emoteToken = "THREATEN";
264 end
265 if (emoteToken == "SILLY") then
266 emoteToken = "JOKE";
267 end
268 if (emoteToken == "LAY") then
269 emoteToken = "LAYDOWN";
270 end
271 if (emoteToken == "REAR") then
272 emoteToken = "SHAKE";
273 end
274 if (emoteToken == "BELCH") then
275 emoteToken = "BURP";
276 end
277 if (emoteToken == "SMELL") then
278 emoteToken = "STINK";
279 end
280 if (emoteToken == "GOODBYE") then
281 emoteToken = "BYE";
282 end
283 if (emoteToken == "FOLLOWME") then
284 emoteToken = "FOLLOW";
285 end
286 if (emoteToken == "ATTACKTARGET") then
287 emoteToken = "ATTACKMYTARGET";
288 end
289 if (emoteToken == "CONGRATS") then
290 emoteToken = "CONGRATULATE";
291 end
292 if (emoteToken == "PUZZLED") then
293 emoteToken = "PUZZLE";
294 end
295 if (emoteToken == "QUESTION") then
296 emoteToken = "TALKQ";
297 end
298 DoEmote(emoteToken);
299 end
300 end
301 end
302  
303 EmoteFu:RegisterForLoad()