vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 function SmartPet_BuildTooltip(id)
2 SmartPet_UpdateActionIcons(true);
3 if (SmartPet_Config.ToolTips) then
4 if (id == SmartPet_Actions["Taunt"].index) then
5 SmartPet_BuildGrowlTooltip();
6 elseif (id == SmartPet_Actions["Detaunt"].index) then
7 SmartPet_BuildCowerTooltip();
8 elseif (id == SmartPet_Actions["Burst"].index) then
9 SmartPet_BuildClawTooltip();
10 elseif (id == SmartPet_Actions["Sustain"].index) then
11 SmartPet_BuildBiteTooltip();
12 elseif (id == SmartPet_Actions["Nochase"].index) then
13 SmartPet_BuildNoChaseTooltip();
14 end
15 end
16 end
17  
18 function SmartPet_BuildGrowlTooltip()
19 GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
20 GameTooltip:SetText(COLOR_WHITE .. SMARTPET_ACTIONS_GROWL .. " " .. SMARTPET_TOOLTIP_MANAGEMENT .. COLOR_CLOSE);
21 if (SmartPet_Config.TauntMan) then
22 if (SmartPet_Config.UseTaunt) then
23 GameTooltip:AddLine(SMARTPET_TOOLTIP_GROWL1);
24 if (SmartPet_Config.AutoCower) then
25 if (SmartPet_Actions["Detaunt"].index < 1) then
26 GameTooltip:AddLine(COLOR_RED .. SMARTPET_TOOLTIP_GROWL2 .. COLOR_CLOSE);
27 else
28 GameTooltip:AddLine(COLOR_GREEN .. string.gsub(SMARTPET_TOOLTIP_AUTOCOWER, '%%h', SmartPet_Config.CowerHealth) .. COLOR_CLOSE);
29 end
30 end
31 elseif (SmartPet_Config.UseDetaunt) then
32 GameTooltip:AddLine(COLOR_RED .. SMARTPET_TOOLTIP_GROWL3 .. COLOR_CLOSE);
33 end
34 else
35 if (SmartPet_Config.AutoCower) then
36 GameTooltip:AddLine(COLOR_GREEN .. string.gsub(SMARTPET_TOOLTIP_AUTOCOWER, '%%h', SmartPet_Config.CowerHealth) .. COLOR_CLOSE);
37 else
38 GameTooltip:AddLine(SMARTPET_TOOLTIP_GROWL4);
39 end
40 end
41 GameTooltip:Show();
42 end
43  
44 function SmartPet_BuildCowerTooltip()
45 GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
46 GameTooltip:SetText(COLOR_WHITE .. SMARTPET_ACTIONS_COWER .. " " .. SMARTPET_TOOLTIP_MANAGEMENT .. COLOR_CLOSE);
47 if (SmartPet_Config.TauntMan) then
48 if (SmartPet_Config.UseDetaunt) then
49 GameTooltip:AddLine(SMARTPET_TOOLTIP_COWER1);
50 elseif (SmartPet_Config.UseTaunt) then
51 GameTooltip:AddLine(COLOR_RED .. SMARTPET_TOOLTIP_COWER3 .. COLOR_CLOSE);
52 if (SmartPet_Config.AutoCower) then
53 GameTooltip:AddLine(COLOR_GREEN .. string.gsub(SMARTPET_TOOLTIP_AUTOCOWER, '%%h', SmartPet_Config.CowerHealth) .. COLOR_CLOSE);
54 end
55 end
56 else
57 if (SmartPet_Config.AutoCower) then
58 GameTooltip:AddLine(COLOR_GREEN .. string.gsub(SMARTPET_TOOLTIP_AUTOCOWER, '%%h', SmartPet_Config.CowerHealth) .. COLOR_CLOSE);
59 else
60 GameTooltip:AddLine(SMARTPET_TOOLTIP_COWER4);
61 end
62 end
63 GameTooltip:Show();
64 end
65  
66 function SmartPet_BuildClawTooltip()
67 GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
68 GameTooltip:SetText(COLOR_WHITE .. SMARTPET_ACTIONS_CLAW .. " " .. SMARTPET_TOOLTIP_MANAGEMENT .. COLOR_CLOSE);
69 if (SmartPet_Config.TauntMan) then
70 if (SmartPet_Config.UseBurst) then
71 local mainAction;
72 if (SmartPet_Config.UseTaunt) then
73 mainAction = SmartPet_Actions["Taunt"].name;
74 else
75 mainAction = SmartPet_Actions["Detaunt"].name;
76 end
77 GameTooltip:AddLine(string.gsub(SMARTPET_TOOLTIP_CLAW1, '%%a', mainAction));
78 else
79 GameTooltip:AddLine(COLOR_RED .. SMARTPET_TOOLTIP_CLAW2 .. COLOR_CLOSE);
80 end
81 end
82 if (SmartPet_Config.SmartFocus) then
83 if (not SmartPet_Config.UseBurst or not SmartPet_Config.UseSustain) then
84 GameTooltip:AddLine(COLOR_RED .. SMARTPET_TOOLTIP_SMARTFOCUS2 .. COLOR_CLOSE);
85 else
86 GameTooltip:AddLine(COLOR_BLUE .. SMARTPET_TOOLTIP_SMARTFOCUS1 .. COLOR_CLOSE);
87 end
88 end
89 GameTooltip:Show();
90 end
91  
92 function SmartPet_BuildBiteTooltip()
93 GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
94 GameTooltip:SetText(COLOR_WHITE .. SMARTPET_ACTIONS_BITE .. " " .. SMARTPET_TOOLTIP_MANAGEMENT .. COLOR_CLOSE);
95 if (SmartPet_Config.TauntMan) then
96 if (SmartPet_Config.UseSustain) then
97 local mainAction;
98 if (SmartPet_Config.UseTaunt) then
99 mainAction = SmartPet_Actions["Taunt"].name;
100 else
101 mainAction = SmartPet_Actions["Detaunt"].name;
102 end
103 GameTooltip:AddLine(string.gsub(SMARTPET_TOOLTIP_BITE1, '%%a', mainAction));
104 else
105 GameTooltip:AddLine(COLOR_RED .. SMARTPET_TOOLTIP_BITE2 .. COLOR_CLOSE);
106 end
107 end
108 if (SmartPet_Config.SmartFocus) then
109 if (not SmartPet_Config.UseBurst or not SmartPet_Config.UseSustain) then
110 GameTooltip:AddLine(COLOR_RED .. SMARTPET_TOOLTIP_SMARTFOCUS2 .. COLOR_CLOSE);
111 else
112 GameTooltip:AddLine(COLOR_BLUE .. SMARTPET_TOOLTIP_SMARTFOCUS1 .. COLOR_CLOSE);
113 end
114 end
115 GameTooltip:Show();
116 end
117  
118 function SmartPet_BuildNoChaseTooltip()
119 GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
120 GameTooltip:SetText(COLOR_WHITE .. SMARTPET_NOCHASE .. " " .. SMARTPET_TOOLTIP_MANAGEMENT .. COLOR_CLOSE);
121 if (SmartPet_Config.NoChase) then
122 GameTooltip:AddLine(SMARTPET_TOOLTIP_NOCHASE1);
123 else
124 GameTooltip:AddLine(SMARTPET_TOOLTIP_NOCHASE2);
125 end
126 GameTooltip:Show();
127 end
128  
129 function SmartPet_DefaultTooltip(tooltipID)
130 GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
131 GameTooltip:SetText(COLOR_WHITE .. SMARTPET_NOCHASE .. " " .. SMARTPET_TOOLTIP_MANAGEMENT .. COLOR_CLOSE);
132 if (SmartPet_Config.NoChase) then
133 GameTooltip:AddLine(tooltipID..1);
134 else
135 GameTooltip:AddLine(tooltipID..2);
136 end
137 GameTooltip:Show();
138 end
139  
140 -- Adds a formatted informational message
141 function SmartPet_AddInfoMessage(message)
142 DEFAULT_CHAT_FRAME:AddMessage(COLOR_YELLOW..message..COLOR_CLOSE);
143 end
144  
145  
146 -- Adds a formatted help message
147 function SmartPet_AddHelpMessage(command, detail, status, enabled)
148 message = COLOR_WHITE..command..": "..COLOR_CLOSE..COLOR_GREEN..detail..COLOR_CLOSE;
149  
150 if (enabled == nil) then
151 DEFAULT_CHAT_FRAME:AddMessage(message);
152 return;
153 end
154  
155 if (status == "" or status == nil) then
156 if (enabled) then
157 DEFAULT_CHAT_FRAME:AddMessage(message..COLOR_WHITE.." (" .. SMARTPET_USAGE_ENABLED.. ")"..COLOR_CLOSE);
158 else
159 DEFAULT_CHAT_FRAME:AddMessage(message..COLOR_GREY.." (" .. SMARTPET_USAGE_DISABLED .. ")"..COLOR_CLOSE);
160 end
161 else
162 if (enabled) then
163 DEFAULT_CHAT_FRAME:AddMessage(message..COLOR_WHITE..status..COLOR_CLOSE);
164 else
165 DEFAULT_CHAT_FRAME:AddMessage(message..COLOR_GREY..status..COLOR_CLOSE);
166 end
167 end
168 end
169  
170 --Prints Messages to help in debuging
171 function SmartPet_AddDebugMessage(message, style)
172 if (not SmartPet_Config.ShowDebug) then
173 return;
174 end
175  
176 if (strfind (SmartPet_Config.ShowDebugString, style)) then
177 DEFAULT_CHAT_FRAME:AddMessage(COLOR_RED..message..COLOR_CLOSE);
178 end
179 end
180  
181