vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --[[ |
2 | |||
3 | Titan Panel [Parchment] |
||
4 | |||
5 | Titan Panel support for Parchment |
||
6 | |||
7 | Author: Valnar (AKA: Thor) |
||
8 | Website: www.destroyersofhope.com |
||
9 | Email: thor@destroyersofhope.com |
||
10 | Patch Notes: Located in the PatchNotes.txt file |
||
11 | |||
12 | --]] |
||
13 | |||
14 | TITAN_PARCHMENT_ID = "Parchment"; |
||
15 | TITAN_PARCHMENT_MENU_TEXT = "Parchment"; |
||
16 | TITAN_PARCHMENT_BUTTON_LABEL = "Parchment"; |
||
17 | TITAN_PARCHMENT_TOOLTIP = "Tacked Chapters"; |
||
18 | TITAN_PARCHMENT_MENU_TACK = "Show Tack Window"; |
||
19 | TITAN_PARCHMENT_MENU_LABEL = "Show Label"; |
||
20 | TITAN_PARCHMENT_MENU_ICON = "Show Icon"; |
||
21 | TITAN_PARCHMENT_MENU_REALMS = "View All Realms"; |
||
22 | |||
23 | function TitanPanelParchmentButton_OnLoad() |
||
24 | this.registry = { |
||
25 | id = TITAN_PARCHMENT_ID, |
||
26 | menuText = TITAN_PARCHMENT_MENU_TEXT, |
||
27 | buttonTextFunction = "TitanPanelParchmentButton_GetButtonText", |
||
28 | tooltipTitle = TITAN_PARCHMENT_TOOLTIP, |
||
29 | tooltipTextFunction = "TitanPanelParchmentButton_GetTooltipText", |
||
30 | frequency = 1, |
||
31 | icon = "Interface\\AddOns\\Parchment\\ParchmentButton", |
||
32 | iconWidth = 16, |
||
33 | savedVariables = { |
||
34 | ShowLabelText = 1, |
||
35 | ShowIcon = 1, |
||
36 | ShowTack = TITAN_NIL, |
||
37 | ShowAllRealms = false, |
||
38 | } |
||
39 | }; |
||
40 | end |
||
41 | |||
42 | function TitanPanelParchmentButton_GetButtonText(id) |
||
43 | local id = TitanUtils_GetButton(id, true); |
||
44 | |||
45 | if(TitanGetVar(TITAN_PARCHMENT_ID, "ShowLabelText")) then |
||
46 | return TITAN_PARCHMENT_BUTTON_LABEL; |
||
47 | elseif(not(TitanGetVar(TITAN_PARCHMENT_ID, "ShowLabelText")) and not TitanGetVar(TITAN_PARCHMENT_ID, "ShowIcon")) then |
||
48 | return TITAN_PARCHMENT_BUTTON_LABEL; |
||
49 | end |
||
50 | end |
||
51 | |||
52 | function TitanPanelParchmentButton_GetTooltipText() |
||
53 | if(TitanGetVar(TITAN_PARCHMENT_ID, "ShowTack")) then |
||
54 | local temp_string = ""; |
||
55 | local thisRealm = nil; |
||
56 | local character = nil; |
||
57 | |||
58 | for key, value in Parchment_Data do |
||
59 | character = nil; |
||
60 | |||
61 | if(Parchment_Data[key].tacked) then |
||
62 | thisRealm = Parchment_Split(key, "|")[2]; |
||
63 | |||
64 | if(thisRealm) then |
||
65 | if(TitanGetVar(TITAN_PARCHMENT_ID, "ShowAllRealms")) then |
||
66 | character = Parchment_Split(key,"|")[1].." of "..Parchment_Split(key,"|")[2]; |
||
67 | else |
||
68 | if(thisRealm == GetCVar("realmName")) then |
||
69 | character = Parchment_Split(key,"|")[1]; |
||
70 | end |
||
71 | end |
||
72 | else |
||
73 | character = key; |
||
74 | end |
||
75 | |||
76 | if(character ~= nil) then |
||
77 | temp_string = "|c00FFFFFF- "..character.."|r\n"..Parchment_Data[key].text.."\n\n".. temp_string; |
||
78 | end |
||
79 | end |
||
80 | end |
||
81 | |||
82 | return temp_string; |
||
83 | end |
||
84 | end |
||
85 | |||
86 | function TitalPanelParchmentButton_OnClick(button) |
||
87 | if(button == "LeftButton") then |
||
88 | ParchmentButton_OnClick(); |
||
89 | end |
||
90 | end |
||
91 | |||
92 | function TitanPanelRightClickMenu_PrepareParchmentMenu() |
||
93 | local info; |
||
94 | |||
95 | TitanPanelRightClickMenu_AddTitle(TitanPlugins[TITAN_PARCHMENT_ID].menuText); |
||
96 | TitanPanelRightClickMenu_AddToggleIcon(TITAN_PARCHMENT_ID); |
||
97 | TitanPanelRightClickMenu_AddToggleLabelText(TITAN_PARCHMENT_ID); |
||
98 | |||
99 | info = {}; |
||
100 | info.text = TITAN_PARCHMENT_MENU_TACK; |
||
101 | info.func = TitanParchment_Tack; |
||
102 | info.checked = TitanGetVar(TITAN_PARCHMENT_ID, "ShowTack"); |
||
103 | UIDropDownMenu_AddButton(info); |
||
104 | |||
105 | info = {}; |
||
106 | info.text = TITAN_PARCHMENT_MENU_REALMS; |
||
107 | info.func = TitanParchment_Realms; |
||
108 | info.checked = TitanGetVar(TITAN_PARCHMENT_ID, "ShowAllRealms"); |
||
109 | UIDropDownMenu_AddButton(info); |
||
110 | |||
111 | TitanPanelRightClickMenu_AddSpacer(); |
||
112 | TitanPanelRightClickMenu_AddCommand(TITAN_PANEL_MENU_HIDE, TITAN_PARCHMENT_ID, TITAN_PANEL_MENU_FUNC_HIDE); |
||
113 | end |
||
114 | |||
115 | function TitanParchment_Tack() |
||
116 | TitanToggleVar(TITAN_PARCHMENT_ID, "ShowTack"); |
||
117 | end |
||
118 | |||
119 | function TitanParchment_Realms() |
||
120 | TitanToggleVar(TITAN_PARCHMENT_ID, "ShowAllRealms"); |
||
121 | end |