vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 ----
2 -- TitanPanel[Roll]
3 ----
4 --[[
5  
6 author: QuippeR
7  
8 many thanks for code from:
9 LootHog by Chompers
10 ToggleMe by Taii
11  
12 description:
13  
14 This Titan Panel plugin catches dice rolls from the chat system. It displays the last roll
15 (performers name and roll value) in Titan Panel, and hovering the plugin brings up a list
16 of the latest catched rolls.
17 Dice rolls with the range of 1-100 are displayed in green, others in red with the minimum
18 and maximum of the roll after the actual value.
19 Clicking on the text displayed performs a roll.
20  
21 ]]--
22  
23  
24 TITAN_ROLL_ID = "Roll"
25  
26 TITANROLL_TIMEOUTS = { 10, 20, 30, 60, 120, 180, -1};
27  
28 function TitanPanelRollButton_OnLoad()
29 this.registry = {
30 id = TITAN_ROLL_ID,
31 menuText = TITANROLL_MENUTEXT,
32 buttonTextFunction = "TitanPanelRollButton_GetButtonText",
33 tooltipTitle = TITANROLL_TOOLTIP,
34 tooltipTextFunction = "TitanPanelRollButton_GetTooltipText",
35 icon = "Interface\\PvPRankBadges\\PvPRank10",
36 iconWidth = 16,
37 category = "Information",
38 savedVariables = {
39 ShowIcon = 1,
40 ShowLabelText = 1,
41 ShowWinner = 1,
42 ReplaceBadRolls = 1,
43 SortList = 0,
44 HighlightParty = 0,
45 PerformedRoll = "1-100",
46 ListLength = 10,
47 Timeout = 20,
48 OnlyGoodRollsWin = 1,
49 AcceptGroupOnly = 0,
50 IgnoreMultiRoll = 0,
51 AnnouncePattern = TITANROLL_ANNPATT,
52 EraseTimedOutRolls = 0,
53 ShowTimeOut = 1
54 }
55 };
56  
57 this:RegisterEvent("CHAT_MSG_SYSTEM");
58 this:RegisterEvent("CHAT_MSG_SAY");
59 this:RegisterEvent("CHAT_MSG_PARTY");
60 this:RegisterEvent("CHAT_MSG_RAID");
61 this:RegisterEvent("CHAT_MSG_GUILD");
62  
63 TitanRolls = {};
64 TimedOut = 0;
65  
66 end
67  
68 function TitanPanelRollButton_OnClick(button)
69 local i;
70 if (( button == "LeftButton" ) and IsShiftKeyDown()) then
71 TitanPanelRollButton_TimeOutAll();
72 elseif (( button == "LeftButton" ) and IsControlKeyDown()) then
73 if (TitanRollsCount) then
74 for i = 1, TitanRollsCount do
75 TitanRolls[i] = TitanRolls[i+1];
76 end
77 TitanRollsCount = TitanRollsCount - 1;
78 if (TimedOut ~= 0) then
79 TimedOut = TimedOut - 1;
80 end
81 if (TitanRollsCount == 0) then
82 TitanRollsCount = nil;
83 end
84 TitanPanelButton_UpdateButton(TITAN_ROLL_ID);
85 end
86 elseif (( button == "LeftButton" ) and IsAltKeyDown()) then
87 TitanRoll_AnnounceWinner();
88  
89 -- (Maybe in a future version) --
90 -- elseif (( button == "LeftButton" ) and ChatFrameEditBox:IsShown()) then
91 -- local Ilink = ChatFrameEditBox:GetText();
92 -- ChatFrameEditBox:SetText("");
93 -- ChatFrameEditBox:Hide();
94 -- TitanRoll_AnnounceItem(Ilink);
95  
96 elseif ( button == "LeftButton" ) then
97 TitanRoll_EditBox:SetText("/rnd "..TitanGetVar(TITAN_ROLL_ID, "PerformedRoll"));
98 ChatEdit_SendText(TitanRoll_EditBox);
99 end
100 end
101  
102 -- Special thanks to LootHog author Chompers !
103  
104 function TitanPanelRollButton_OnEvent()
105 local msg = arg1;
106 local pattern = TITANROLL_SEARCHPATTERN;
107 local player, roll, min_roll, max_roll, report;
108 _, _, player, roll, min_roll, max_roll = string.find(msg, pattern);
109 if (player) and ((TitanGetVar(TITAN_ROLL_ID, "AcceptGroupOnly") and (UnitInGroupByName(player)) or (not TitanGetVar(TITAN_ROLL_ID, "AcceptGroupOnly")))) then
110 TitanPanelRollButton_ProcessRoll(player, roll, min_roll, max_roll);
111 end
112 if (strlower(msg)=="!roll") then
113 TitanRoll_EditBox:SetText("/rnd 100");
114 ChatEdit_SendText(TitanRoll_EditBox);
115 end
116 end
117  
118 function TitanPanelRollButton_ProcessRoll(player, roll, min_roll, max_roll)
119 local rollOK = true;
120 local deleted = 0;
121 local rolltime = GetTime();
122 local firstRoll = true;
123 min_roll = tonumber(min_roll);
124 max_roll = tonumber(max_roll);
125 roll = tonumber(roll);
126 _, _, rolltime, _ = string.find(rolltime, "(%d+).(%d+)");
127 rolltime = tonumber(rolltime);
128 if (min_roll ~=1) or (max_roll~=100) then
129 rollOK = false;
130 end
131 if ((TitanRollsCount) and (TitanGetVar(TITAN_ROLL_ID, "IgnoreMultiRoll")) and (TimedOut>0)) then
132 for i = 1, TimedOut do
133 if ((TitanRolls[i].name == player) and not (TitanGetVar(TITAN_ROLL_ID,"ReplaceBadRolls") and (not TitanRolls[i].onetohundred))) then
134 firstRoll = false;
135 end
136 end
137 end
138 if (firstRoll) then
139 if (TitanRollsCount) then
140 if (TitanGetVar(TITAN_ROLL_ID, "ReplaceBadRolls")) then
141 for i = 1, TitanRollsCount do
142 if ((TitanRolls[i-deleted].name == player) and (not (TitanRolls[i-deleted].onetohundred)) and rollOK) then
143 for j = i-deleted, TitanRollsCount do
144 TitanRolls[j] = TitanRolls[j+1];
145 end
146 TitanRollsCount = TitanRollsCount - 1;
147 if (TimedOut >= (i-deleted)) then
148 TimedOut = TimedOut - 1;
149 end
150 deleted = deleted + 1;
151 end
152 end
153 end
154 for i = TitanRollsCount, 1, -1 do
155 TitanRolls[i+1] = TitanRolls[i];
156 end
157 if (TitanRollsCount < TitanGetVar(TITAN_ROLL_ID, "ListLength")) then
158 TitanRollsCount = TitanRollsCount + 1;
159 end
160 if (TimedOut < TitanGetVar(TITAN_ROLL_ID, "ListLength")) then
161 TimedOut = TimedOut + 1;
162 end
163 else
164 TitanRollsCount = 1;
165 TimedOut = 1;
166 end
167 if (rollOK) then
168 TitanRolls[1] = {name = player,
169 rolled = roll,
170 onetohundred = rollOK,
171 since = rolltime};
172 else
173 TitanRolls[1] = {name = player,
174 rolled = roll,
175 onetohundred = rollOK,
176 since = rolltime,
177 base = min_roll,
178 top = max_roll};
179 end
180 TitanPanelButton_UpdateButton(TITAN_ROLL_ID);
181 TitanPanelButton_SetTooltip(TITAN_ROLL_ID);
182 end
183 end
184  
185 function TitanPanelRollButton_OnUpdate()
186 local secNow;
187 if (TimedOut > 0) and (TitanGetVar(TITAN_ROLL_ID, "Timeout") > 0) then
188 secNow = GetTime();
189 _, _, secNow, _ = string.find(secNow, "(%d+).(%d+)");
190 if ((secNow - TitanRolls[TimedOut].since) > TitanGetVar(TITAN_ROLL_ID, "Timeout")) then
191 TimedOut = TimedOut - 1;
192 if (TitanGetVar(TITAN_ROLL_ID, "EraseTimedOutRolls") == 1) then
193 TitanRollsCount = TimedOut;
194 end
195 TitanPanelButton_UpdateButton(TITAN_ROLL_ID);
196 end
197 elseif (TitanGetVar(TITAN_ROLL_ID, "Timeout") == -1) then
198 TimedOut = TitanRollsCount or 0;
199 TitanPanelButton_UpdateButton(TITAN_ROLL_ID);
200 else
201 -- I don't want it to be negative no way
202 TimedOut = 0;
203 end
204 TitanPanelButton_UpdateTooltip();
205 end
206  
207  
208 function TitanPanelRollButton_GetButtonText()
209 local buttonText = "";
210 local max = -1;
211 local maxloc = 0;
212 local i;
213 local hasBadRoll = false;
214 local parenth = "";
215 local winners = "";
216  
217 if (TitanRollsCount) then
218 if not (TitanGetVar(TITAN_ROLL_ID, "ShowWinner")) then
219 buttonText = buttonText..TitanRolls[1].name.." ";
220 if (TitanRolls[1].onetohundred) then
221 buttonText = buttonText..TitanUtils_GetGreenText(TitanRolls[1].rolled);
222 else
223 buttonText = buttonText..TitanUtils_GetRedText(TitanRolls[1].rolled);
224 end
225 parenth = " ("..TimedOut..")";
226 else
227 for i = 1, TitanRollsCount do
228 if (TitanRolls[i].rolled >= max) and (i <= TimedOut) and ((TitanGetVar(TITAN_ROLL_ID, "OnlyGoodRollsWin") and (TitanRolls[i].onetohundred)) or (not TitanGetVar(TITAN_ROLL_ID, "OnlyGoodRollsWin"))) then
229 if (max ~= tonumber(TitanRolls[i].rolled)) then
230 winners = TitanRolls[i].name;
231 else
232 winners = winners..", "..TitanRolls[i].name;
233 end
234 max = tonumber(TitanRolls[i].rolled);
235 maxloc = i;
236 end
237 if not (TitanRolls[i].onetohundred) and (i <= TimedOut) then
238 hasBadRoll = true;
239 end
240 end
241 if (maxloc > 0) then
242 if hasBadRoll then
243 buttonText = buttonText..TitanUtils_GetRedText(winners.." ");
244 else
245 buttonText = buttonText..winners.." ";
246 end
247 if (TitanRolls[maxloc].onetohundred) then
248 buttonText = buttonText..TitanUtils_GetGreenText(TitanRolls[maxloc].rolled);
249 else
250 buttonText = buttonText..TitanUtils_GetRedText(TitanRolls[maxloc].rolled)
251 end
252 parenth = " ("..TimedOut..")";
253 else
254 buttonText = TitanUtils_GetColoredText(TITAN_NA, HIGHLIGHT_FONT_COLOR);
255 end
256 end
257 else
258 buttonText = buttonText..TitanUtils_GetColoredText(TITAN_NA, HIGHLIGHT_FONT_COLOR);
259 end
260 if not (TitanGetVar(TITAN_ROLL_ID, "ShowWinner")) then
261 return TITANROLL_LABELTEXT, buttonText..parenth;
262 else
263 return TITANROLL_LABELWINNER, buttonText..parenth;
264 end
265 end
266  
267 function TitanPanelRollButton_GetTooltipText()
268 local tooltipText = "";
269 local i, j, k;
270 local sortedList = {};
271 if (TitanRollsCount) then
272 if (TitanGetVar(TITAN_ROLL_ID, "SortList")) then
273 for i = 1, TitanRollsCount do
274 if (sortedList) then
275 if (i <= TimedOut) then
276 j = 1;
277 while (j<i) and (sortedList[j].rolled > TitanRolls[i].rolled) do
278 j = j + 1;
279 end
280 for k = i-1, j, -1 do
281 sortedList[k+1] = sortedList[k];
282 end
283 sortedList[j] = TitanRolls[i];
284 else
285 sortedList[i] = TitanRolls[i];
286 end
287 else
288 sortedList[i] = TitanRolls[i];
289 end
290 end
291 tooltipText = TitanPanelRollButton_PrintTooltipText(sortedList)
292 else
293 tooltipText = TitanPanelRollButton_PrintTooltipText(TitanRolls)
294 end
295 else
296 tooltipText = tooltipText..TitanUtils_GetNormalText(TITANROLL_NOROLL).."\n";
297 end
298 tooltipText = tooltipText..TitanUtils_GetGreenText(TITANROLL_HINT);
299 return tooltipText;
300 end
301  
302 function UnitInGroupByName(name)
303 if (UnitName("player") == name) or (UnitName("party1") == name) or
304 (UnitName("party2") == name) or (UnitName("party3") == name) or (UnitName("party4") == name) then
305 return true;
306 else
307 local raidmember = false;
308 for i = 0, 40 do
309 if (UnitName("raid"..i)) and (UnitName("raid"..i) == name) then
310 raidmember = true;
311 end
312 end
313 return raidmember;
314 end
315 end
316  
317 function TitanPanelRollButton_PrintTooltipText(array)
318 local i;
319 local name="";
320 local tooltipText = "";
321 local tooltipLength = 0;
322 local nowIs = GetTime();
323 local since = 0;
324 local sinceText = "";
325 local t = 0;
326 _, _, nowIs, _ = string.find(nowIs, "(%d+).(%d+)");
327 if TitanRollsCount < TITANROLL_MAXTTLEN then
328 tooltipLength = TitanRollsCount;
329 else
330 tooltipLength = TITANROLL_MAXTTLEN;
331 end
332 for i = 1, tooltipLength do
333 if (TitanGetVar(TITAN_ROLL_ID, "ShowTimeOut")) then
334 since = (nowIs-array[i].since);
335 t = since-mod(since,3600);
336 if t>0 then
337 sinceText = ">"..(t/3600).."h"
338 else
339 t = since-mod(since,60);
340 if t>60 then
341 sinceText = ">"..(t/60).."min"
342 elseif t>0 then
343 sinceText = "1min "..(since-60).."s"
344 else
345 sinceText = since.."s"
346 end
347 end
348 name = "["..sinceText.."] "..array[i].name;
349 else
350 name = array[i].name;
351 end
352 if (i <= TimedOut) then
353 if (UnitInGroupByName(array[i].name) and TitanGetVar(TITAN_ROLL_ID, "HighlightParty")) then
354 tooltipText = tooltipText..TitanUtils_GetHighlightText(name).."\t";
355 else
356 tooltipText = tooltipText..TitanUtils_GetGreenText(name).."\t";
357 end
358 else
359 tooltipText = tooltipText..name.."\t";
360 end
361 if (i <= TimedOut) then
362 if (array[i].onetohundred) then
363 if (UnitInGroupByName(array[i].name) and TitanGetVar(TITAN_ROLL_ID, "HighlightParty")) then
364 tooltipText = tooltipText..TitanUtils_GetHighlightText(array[i].rolled).."\n";
365 else
366 tooltipText = tooltipText..TitanUtils_GetGreenText(array[i].rolled).."\n";
367 end
368 else
369 tooltipText = tooltipText..TitanUtils_GetRedText(array[i].rolled.." ("..array[i].base.."-"..array[i].top..")").."\n";
370 end
371 else
372 if (array[i].onetohundred) then
373 tooltipText = tooltipText..array[i].rolled.."\n";
374 else
375 tooltipText = tooltipText..array[i].rolled.." ("..array[i].base.."-"..array[i].top..")\n";
376 end
377 end
378 end
379 if (tooltipLength~=TitanRollsCount) then
380 tooltipText = tooltipText..TitanUtils_GetRedText(TITANROLL_TTALERT).."\n";
381 end
382 return tooltipText;
383 end
384  
385 function TitanPanelRollButton_ResetSession()
386 TitanRollsCount = nil;
387 TitanRolls = {};
388 TimedOut = 0;
389 TitanPanelButton_UpdateButton(TITAN_ROLL_ID);
390 end
391  
392 function TitanPanelRollButton_TimeOutAll()
393 local i;
394 if (TitanGetVar(TITAN_ROLL_ID,"Timeout")==-1) then
395 TitanPanelRollButton_ResetSession();
396 else
397 for i = 1, TimedOut do
398 TitanRolls[i].since = TitanRolls[i].since - TitanGetVar(TITAN_ROLL_ID,"Timeout");
399 end
400 TitanPanelButton_SetTooltip(TITAN_ROLL_ID);
401 end
402 TitanPanelButton_UpdateButton(TITAN_ROLL_ID);
403 end
404  
405 function TitanRoll_AnnounceWinner()
406 local sendToChat = "";
407 local hasBadRoll = "";
408 local max = -1;
409 local maxloc = 0;
410 local winners = "";
411 local rollerList = "";
412 local annpattern = TitanGetVar(TITAN_ROLL_ID, "AnnouncePattern");
413 if(GetNumRaidMembers()>0) then
414 sendToChat = "/raid ";
415 elseif (GetNumPartyMembers()>0) then
416 sendToChat = "/p ";
417 else
418 sendToChat = "/s ";
419 end
420 if (TimedOut>0) then
421 for i = 1, TimedOut do
422 if (TitanRolls[i].rolled >= max) and (i <= TimedOut) and ((TitanGetVar(TITAN_ROLL_ID, "OnlyGoodRollsWin") and (TitanRolls[i].onetohundred)) or (not TitanGetVar(TITAN_ROLL_ID, "OnlyGoodRollsWin"))) then
423 if (max ~= tonumber(TitanRolls[i].rolled)) then
424 winners = TitanRolls[i].name;
425 else
426 winners = winners..", "..TitanRolls[i].name;
427 end
428 max = tonumber(TitanRolls[i].rolled);
429 maxloc = i;
430 end
431 if not (TitanRolls[i].onetohundred) and (i <= TimedOut) then
432 if (hasBadRoll~="") then
433 hasBadRoll = hasBadRoll..", ";
434 end
435 hasBadRoll = hasBadRoll..TitanRolls[i].name.." ("..TitanRolls[i].base.."-"..TitanRolls[i].top..")";
436 end
437 if (i~=1) then
438 rollerList = rollerList..", "
439 end
440 rollerList = rollerList..TitanRolls[i].name.." - "..TitanRolls[i].rolled
441 end
442 if (maxloc > 0) then
443 annpattern = string.gsub(annpattern, "$a(.+)$b", "");
444 annpattern = string.gsub(annpattern, "$w", winners);
445 annpattern = string.gsub(annpattern, "$l", rollerList);
446 annpattern = string.gsub(annpattern, "$r", TitanRolls[maxloc].rolled);
447 annpattern = string.gsub(annpattern, "$n", TimedOut);
448 if (hasBadRoll~="") then
449 annpattern = string.gsub(annpattern, "$c", "");
450 annpattern = string.gsub(annpattern, "$i", hasBadRoll)
451 else
452 annpattern = string.gsub(annpattern, "$c(.+)", "");
453 end
454 end
455 end
456 if (maxloc==0) then
457 annpattern = string.gsub(annpattern, "$a", " ");
458 annpattern = string.gsub(annpattern, "$b(.+)", " ");
459 end
460 sendToChat = sendToChat..annpattern;
461 local strLenToPrint = string.len(sendToChat)
462 while strLenToPrint > 255 do
463 TitanRoll_EditBox:SetText(string.sub(sendToChat,-strLenToPrint, -(strLenToPrint-255)));
464 ChatEdit_SendText(TitanRoll_EditBox);
465 strLenToPrint = strLenToPrint-255;
466 end
467 TitanRoll_EditBox:SetText(string.sub(sendToChat,-strLenToPrint));
468 ChatEdit_SendText(TitanRoll_EditBox);
469 end
470  
471 -- (Maybe in a future version) --
472 --function TitanRoll_AnnounceItem(itemlink)
473 -- local sendToChat = "";
474 --
475 -- if(GetNumRaidMembers()>0) then
476 -- sendToChat = "/raid ";
477 -- elseif (GetNumPartyMembers()>0) then
478 -- sendToChat = "/p ";
479 -- else
480 -- DEFAULT_CHAT_FRAME:AddMessage("TitanRoll: You're not in a group!")
481 -- end
482 --
483 -- sendToChat = sendToChat.."Please need roll on "..itemlink.."! You can pass by typing in the letter 'p'!";
484 --
485 -- TitanRoll_EditBox:SetText(sendToChat);
486 -- ChatEdit_SendText(TitanRoll_EditBox);
487 --end
488  
489 function TitanPanelRollButton_ChangeAction()
490 StaticPopupDialogs["TITANROLL_CHANGEACTION"]={
491 text=TEXT(TITANROLL_CURRENTACTION..TitanGetVar(TITAN_ROLL_ID, "PerformedRoll")),
492 button1=TEXT(ACCEPT),
493 button2=TEXT(CANCEL),
494 hasEditBox=1,
495 maxLetters=30,
496 OnAccept=function()
497 local editBox=getglobal(this:GetParent():GetName().."EditBox")
498 TitanSetVar(TITAN_ROLL_ID, "PerformedRoll", editBox:GetText());
499 end,
500 EditBoxOnEnterPressed=function()
501 local editBox=getglobal(this:GetParent():GetName().."EditBox")
502 TitanSetVar(TITAN_ROLL_ID, "PerformedRoll", editBox:GetText());
503 end,
504 timeout=0,
505 exclusive=1
506 }
507 StaticPopup_Show("TITANROLL_CHANGEACTION")
508  
509 end
510  
511 function TitanPanelRollButton_ChangeAnnounce()
512 StaticPopupDialogs["TITANROLL_CHANGEANNOUNCE"]={
513 text=TEXT(TITANROLL_CHATFORHELP),
514 button1=TEXT(ACCEPT),
515 button2=TEXT(CANCEL),
516 hasEditBox=1,
517 maxLetters=250,
518 OnAccept=function()
519 local editBox=getglobal(this:GetParent():GetName().."EditBox")
520 TitanSetVar(TITAN_ROLL_ID, "AnnouncePattern", editBox:GetText());
521 end,
522 EditBoxOnEnterPressed=function()
523 local editBox=getglobal(this:GetParent():GetName().."EditBox")
524 TitanSetVar(TITAN_ROLL_ID, "AnnouncePattern", editBox:GetText());
525 end,
526 timeout=0,
527 exclusive=1
528 }
529 DEFAULT_CHAT_FRAME:AddMessage(TITANROLL_ANNHELP01);
530 DEFAULT_CHAT_FRAME:AddMessage(TITANROLL_ANNHELP02..TitanGetVar(TITAN_ROLL_ID, "AnnouncePattern"));
531 DEFAULT_CHAT_FRAME:AddMessage(TITANROLL_ANNHELP03);
532 DEFAULT_CHAT_FRAME:AddMessage(TITANROLL_ANNHELP04);
533 DEFAULT_CHAT_FRAME:AddMessage(TITANROLL_ANNHELP05);
534 DEFAULT_CHAT_FRAME:AddMessage(TITANROLL_ANNHELP06);
535 DEFAULT_CHAT_FRAME:AddMessage(TITANROLL_ANNHELP07);
536 DEFAULT_CHAT_FRAME:AddMessage(TITANROLL_ANNHELP08);
537 DEFAULT_CHAT_FRAME:AddMessage(TITANROLL_ANNHELP09);
538 DEFAULT_CHAT_FRAME:AddMessage(TITANROLL_ANNHELP10);
539 DEFAULT_CHAT_FRAME:AddMessage(TITANROLL_ANNHELP11);
540 StaticPopup_Show("TITANROLL_CHANGEANNOUNCE")
541 getglobal(getglobal(StaticPopup_Visible("TITANROLL_CHANGEANNOUNCE")):GetName().."EditBox"):SetText(TitanGetVar(TITAN_ROLL_ID, "AnnouncePattern"))
542  
543 end
544  
545 function TitanPanelRollButton_SetListLength()
546 local i;
547 local length = this.value;
548 TitanSetVar(TITAN_ROLL_ID, "ListLength", length);
549 if (TitanRollsCount) and (TitanRollsCount > length) then
550 for i = length+1, TitanRollsCount do
551 TitanRolls[i] = nil;
552 end
553 TitanRollsCount = length;
554 end
555 if (TimedOut > length) then
556 TimedOut = length;
557 end
558 TitanPanelButton_UpdateButton(TITAN_ROLL_ID);
559 end
560  
561 function TitanPanelRollButton_SetTimeout()
562 TitanSetVar(TITAN_ROLL_ID, "Timeout", TITANROLL_TIMEOUTS[this.value]);
563 if (TitanRollsCount) then
564 TimedOut = TitanRollsCount;
565 else
566 TimedOut = 0;
567 end
568 TitanPanelButton_UpdateButton(TITAN_ROLL_ID);
569 TitanPanelButton_UpdateTooltip();
570 end
571  
572 function TitanPanelRightClickMenu_PrepareRollMenu()
573 local i;
574  
575 if (UIDROPDOWNMENU_MENU_LEVEL == 1) then
576  
577 TitanPanelRightClickMenu_AddTitle(TitanPlugins[TITAN_ROLL_ID].menuText);
578  
579 TitanPanelRightClickMenu_AddSpacer();
580 TitanPanelRightClickMenu_AddToggleVar(TITANROLL_TOGWINNER, TITAN_ROLL_ID, "ShowWinner");
581 TitanPanelRightClickMenu_AddToggleVar(TITANROLL_TOGREPLACE, TITAN_ROLL_ID, "ReplaceBadRolls");
582 TitanPanelRightClickMenu_AddToggleVar(TITANROLL_TOGIGNOREMUL, TITAN_ROLL_ID, "IgnoreMultiRoll");
583 TitanPanelRightClickMenu_AddToggleVar(TITANROLL_TOGSORTLIST, TITAN_ROLL_ID, "SortList");
584 TitanPanelRightClickMenu_AddToggleVar(TITANROLL_TOGGROUPACC, TITAN_ROLL_ID, "AcceptGroupOnly");
585 TitanPanelRightClickMenu_AddToggleVar(TITANROLL_TOGHIGHLIGHT, TITAN_ROLL_ID, "HighlightParty");
586 TitanPanelRightClickMenu_AddToggleVar(TITANROLL_TOGGOODWIN, TITAN_ROLL_ID, "OnlyGoodRollsWin");
587 TitanPanelRightClickMenu_AddToggleVar(TITANROLL_TOGSHOWTIME, TITAN_ROLL_ID, "ShowTimeOut");
588 TitanPanelRightClickMenu_AddToggleVar(TITANROLL_TOGERASETO, TITAN_ROLL_ID, "EraseTimedOutRolls");
589  
590 info = {};
591 info.text = TITANROLL_CHANGELENGTH;
592 info.hasArrow = 1;
593 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
594  
595 info = {};
596 info.text = TITANROLL_SETTIMEOUT;
597 info.hasArrow = 1;
598 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
599  
600 TitanPanelRightClickMenu_AddSpacer();
601 TitanPanelRightClickMenu_AddCommand(TITANROLL_PERFORMED, TITAN_ROLL_ID, "TitanPanelRollButton_ChangeAction");
602 TitanPanelRightClickMenu_AddCommand(TITANROLL_ANNOUNCE, TITAN_ROLL_ID, "TitanPanelRollButton_ChangeAnnounce");
603 TitanPanelRightClickMenu_AddCommand(TITANROLL_ERASELIST, TITAN_ROLL_ID, "TitanPanelRollButton_ResetSession");
604  
605 TitanPanelRightClickMenu_AddSpacer();
606 TitanPanelRightClickMenu_AddToggleIcon(TITAN_ROLL_ID);
607 TitanPanelRightClickMenu_AddToggleLabelText(TITAN_ROLL_ID);
608  
609 TitanPanelRightClickMenu_AddSpacer();
610 TitanPanelRightClickMenu_AddCommand(TITAN_PANEL_MENU_HIDE, TITAN_ROLL_ID, TITAN_PANEL_MENU_FUNC_HIDE);
611  
612 elseif (UIDROPDOWNMENU_MENU_LEVEL == 2) then
613  
614 if (UIDROPDOWNMENU_MENU_VALUE == TITANROLL_CHANGELENGTH) then
615 TitanPanelRightClickMenu_AddTitle(TITANROLL_CHANGELENGTH, UIDROPDOWNMENU_MENU_LEVEL);
616 for i = 5, 40, 5 do
617 info = {};
618 info.text = i;
619 info.func = TitanPanelRollButton_SetListLength;
620 info.checked = (i == TitanGetVar(TITAN_ROLL_ID, "ListLength"))
621 info.value = i;
622 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
623 end
624 elseif (UIDROPDOWNMENU_MENU_VALUE == TITANROLL_SETTIMEOUT) then
625 TitanPanelRightClickMenu_AddTitle(TITANROLL_SETTIMEOUT, UIDROPDOWNMENU_MENU_LEVEL);
626 for i = 1, 7 do
627 info = {}
628 info.text = TITANROLL_TIMEOUTS_TEXT[i];
629 info.func = TitanPanelRollButton_SetTimeout;
630 info.checked = (TITANROLL_TIMEOUTS[i] == TitanGetVar(TITAN_ROLL_ID, "Timeout"))
631 info.value = i;
632 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
633 end
634 end
635 end
636 end