vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | TITAN_TIMERS_ID = "Timers"; |
2 | TITAN_TIMERS_FREQUENCY = 1; |
||
3 | |||
4 | function TitanPanelTimersButton_OnLoad() |
||
5 | this.registry = { |
||
6 | id = TITAN_TIMERS_ID, |
||
7 | menuText = "Advanced Timers", |
||
8 | buttonTextFunction = "TitanPanelTimersButton_GetButtonText", |
||
9 | tooltipTitle = "Advanced Timers", |
||
10 | tooltipTextFunction = "TitanPanelTimersButton_GetTooltipText", |
||
11 | frequency = TITAN_TIMERS_FREQUENCY, |
||
12 | updateType = TITAN_PANEL_UPDATE_ALL, |
||
13 | savedVariables = { |
||
14 | ShowLabelText = 0, |
||
15 | HideName = 1 |
||
16 | } |
||
17 | }; |
||
18 | end |
||
19 | |||
20 | function TitanPanelTimersButton_OnUpdate() |
||
21 | if (TitanPanelButton_UpdateButton ~= nil) then |
||
22 | TitanPanelButton_UpdateButton(TITAN_TIMERS_ID); |
||
23 | end |
||
24 | if GameTooltip:IsVisible() and GameTooltip:IsOwned(TitanUtils_GetButton(TITAN_TIMERS_ID)) then |
||
25 | TitanPanelButton_SetTooltip(TITAN_TIMERS_ID); |
||
26 | end |
||
27 | end |
||
28 | |||
29 | function TitanPanelTimersButton_OnClick() |
||
30 | if not TimersMainFrame:IsVisible() then |
||
31 | Timers_ShowMainPanel(); |
||
32 | end |
||
33 | end |
||
34 | |||
35 | function TitanPanelTimersButton_GetButtonText(id) |
||
36 | local time = TimersString_Replace_tNext(); |
||
37 | if time == 0 then |
||
38 | if table.getn(timerdata) == 0 then |
||
39 | return TIMERS_LOC_NO_TIMERS; |
||
40 | else |
||
41 | local time = timerdata[1].time; |
||
42 | for i=2, table.getn(timerdata) do |
||
43 | if timerdata[i].time > time then |
||
44 | time = timerdata[i].time; |
||
45 | end |
||
46 | end |
||
47 | return TitanUtils_GetRedText(Timers_TimeToText(time-Timers_GetLocalTime())); |
||
48 | end |
||
49 | else |
||
50 | if not (TitanGetVar(TITAN_TIMERS_ID, "HideName")) then |
||
51 | time = TimersString_Replace_nNext()..": "..time; |
||
52 | end |
||
53 | return time; |
||
54 | end |
||
55 | end |
||
56 | |||
57 | function TitanPanelTimersButton_GetTooltipText() |
||
58 | local ToolTip = "\n"; |
||
59 | if table.getn(timerdata) == 0 then |
||
60 | ToolTip = ToolTip..TIMERS_LOC_NO_TIMERS; |
||
61 | else |
||
62 | local clonedTable = Timers_cloneTable(timerdata); |
||
63 | table.sort(clonedTable,TitanPanelTimers_CompareTime); |
||
64 | for i=1 , table.getn(clonedTable) do |
||
65 | ToolTip = ToolTip..clonedTable[i].name.."\t"; |
||
66 | if clonedTable[i].time-Timers_GetLocalTime() < 0 then |
||
67 | ToolTip = ToolTip..TitanUtils_GetRedText(Timers_TimeToText(clonedTable[i].time-Timers_GetLocalTime()).."\n"); |
||
68 | else |
||
69 | ToolTip = ToolTip..TitanUtils_GetHighlightText(Timers_TimeToText(clonedTable[i].time-Timers_GetLocalTime()).."\n"); |
||
70 | end |
||
71 | end |
||
72 | end |
||
73 | return ToolTip; |
||
74 | end |
||
75 | |||
76 | function TitanPanelTimers_CompareTime(item1, item2) |
||
77 | return tonumber(item1.time) < tonumber(item2.time); |
||
78 | end |
||
79 | |||
80 | function TitanPanelRightClickMenu_PrepareTimersMenu() |
||
81 | TitanPanelRightClickMenu_AddTitle(TitanPlugins[TITAN_TIMERS_ID].menuText); |
||
82 | TitanPanelRightClickMenu_AddCommand(TIMERS_LOC_DELETEXPIRED, TITAN_TIMERS_ID, "TimersEdit_DeleteExpired"); |
||
83 | TitanPanelRightClickMenu_AddCommand(TIMERS_LOC_DELETALL, TITAN_TIMERS_ID, "TimersEdit_DeleteAllTimer"); |
||
84 | TitanPanelRightClickMenu_AddSpacer(); |
||
85 | TitanPanelRightClickMenu_AddToggleVar(TIMERS_TITAN_HIDE_NAME, TITAN_TIMERS_ID, "HideName"); |
||
86 | TitanPanelRightClickMenu_AddSpacer(); |
||
87 | TitanPanelRightClickMenu_AddCommand(TITAN_PANEL_MENU_HIDE, TITAN_TIMERS_ID, TITAN_PANEL_MENU_FUNC_HIDE); |
||
88 | end |