Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 586 lines (532 sloc) 18.131 kB
891a0d8 @tekkub Build 10026
tekkub authored
1 MINIMAPPING_TIMER = 5.5;
d477ec9 @tekkub Build 7677
tekkub authored
2 MINIMAPPING_FADE_TIMER = 0.5;
5d1c420 @tekkub Build 13682
tekkub authored
3 MINIMAP_BOTTOM_EDGE_EXTENT = 192; -- pixels from the top of the screen to the bottom edge of the minimap, needed for UIParentManageFramePositions
1b16914 @tekkub Build 11927
tekkub authored
4
d477ec9 @tekkub Build 7677
tekkub authored
5 MINIMAP_RECORDING_INDICATOR_ON = false;
6
bd5b1d5 @tekkub Build 9614
tekkub authored
7 MINIMAP_EXPANDER_MAXSIZE = 28;
8
1b16914 @tekkub Build 11927
tekkub authored
9 function Minimap_OnLoad(self)
bd5b1d5 @tekkub Build 9614
tekkub authored
10 self.fadeOut = nil;
11 Minimap:SetPlayerTextureHeight(40);
12 Minimap:SetPlayerTextureWidth(40);
4ec3f81 @tekkub Build 8622
tekkub authored
13 self:RegisterEvent("MINIMAP_PING");
14 self:RegisterEvent("MINIMAP_UPDATE_ZOOM");
c066ee5 @tekkub Build 13739
tekkub authored
15 self:RegisterEvent("PLAYER_TARGET_CHANGED");
16 self:RegisterEvent("FOCUS_TARGET_CHANGED");
d477ec9 @tekkub Build 7677
tekkub authored
17 end
18
65a4b8a @haste Build 11573
haste authored
19 function ToggleMinimap()
20 if(Minimap:IsShown()) then
21 PlaySound("igMiniMapClose");
22 Minimap:Hide();
23 else
24 PlaySound("igMiniMapOpen");
25 Minimap:Show();
26 end
27 UpdateUIPanelPositions();
28 end
29
d477ec9 @tekkub Build 7677
tekkub authored
30 function Minimap_Update()
31 MinimapZoneText:SetText(GetMinimapZoneText());
32
33 local pvpType, isSubZonePvP, factionName = GetZonePVPInfo();
34 if ( pvpType == "sanctuary" ) then
35 MinimapZoneText:SetTextColor(0.41, 0.8, 0.94);
36 elseif ( pvpType == "arena" ) then
37 MinimapZoneText:SetTextColor(1.0, 0.1, 0.1);
38 elseif ( pvpType == "friendly" ) then
39 MinimapZoneText:SetTextColor(0.1, 1.0, 0.1);
40 elseif ( pvpType == "hostile" ) then
41 MinimapZoneText:SetTextColor(1.0, 0.1, 0.1);
42 elseif ( pvpType == "contested" ) then
43 MinimapZoneText:SetTextColor(1.0, 0.7, 0.0);
44 else
45 MinimapZoneText:SetTextColor(NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b);
46 end
47
48 Minimap_SetTooltip( pvpType, factionName );
49 end
50
51 function Minimap_SetTooltip( pvpType, factionName )
52 if ( GameTooltip:IsOwned(MinimapZoneTextButton) ) then
53 GameTooltip:SetOwner(MinimapZoneTextButton, "ANCHOR_LEFT");
54 local zoneName = GetZoneText();
55 local subzoneName = GetSubZoneText();
56 if ( subzoneName == zoneName ) then
57 subzoneName = "";
58 end
59 GameTooltip:AddLine( zoneName, 1.0, 1.0, 1.0 );
60 if ( pvpType == "sanctuary" ) then
61 GameTooltip:AddLine( subzoneName, 0.41, 0.8, 0.94 );
62 GameTooltip:AddLine(SANCTUARY_TERRITORY, 0.41, 0.8, 0.94);
63 elseif ( pvpType == "arena" ) then
64 GameTooltip:AddLine( subzoneName, 1.0, 0.1, 0.1 );
65 GameTooltip:AddLine(FREE_FOR_ALL_TERRITORY, 1.0, 0.1, 0.1);
66 elseif ( pvpType == "friendly" ) then
67 GameTooltip:AddLine( subzoneName, 0.1, 1.0, 0.1 );
68 GameTooltip:AddLine(format(FACTION_CONTROLLED_TERRITORY, factionName), 0.1, 1.0, 0.1);
69 elseif ( pvpType == "hostile" ) then
70 GameTooltip:AddLine( subzoneName, 1.0, 0.1, 0.1 );
71 GameTooltip:AddLine(format(FACTION_CONTROLLED_TERRITORY, factionName), 1.0, 0.1, 0.1);
72 elseif ( pvpType == "contested" ) then
73 GameTooltip:AddLine( subzoneName, 1.0, 0.7, 0.0 );
74 GameTooltip:AddLine(CONTESTED_TERRITORY, 1.0, 0.7, 0.0);
ce818cc @tekkub Build 8770
tekkub authored
75 elseif ( pvpType == "combat" ) then
76 GameTooltip:AddLine( subzoneName, 1.0, 0.1, 0.1 );
77 GameTooltip:AddLine(COMBAT_ZONE, 1.0, 0.1, 0.1);
d477ec9 @tekkub Build 7677
tekkub authored
78 else
79 GameTooltip:AddLine( subzoneName, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b );
80 end
81 GameTooltip:Show();
82 end
83 end
84
1b16914 @tekkub Build 11927
tekkub authored
85 function Minimap_OnEvent(self, event, ...)
c066ee5 @tekkub Build 13739
tekkub authored
86 if ( event == "PLAYER_TARGET_CHANGED" or event == "FOCUS_TARGET_CHANGED" ) then
87 self:UpdateBlips();
88 elseif ( event == "MINIMAP_PING" ) then
4ec3f81 @tekkub Build 8622
tekkub authored
89 local arg1, arg2, arg3 = ...;
d477ec9 @tekkub Build 7677
tekkub authored
90 Minimap_SetPing(arg2, arg3, 1);
91 elseif ( event == "MINIMAP_UPDATE_ZOOM" ) then
92 MinimapZoomIn:Enable();
93 MinimapZoomOut:Enable();
94 local zoom = Minimap:GetZoom();
95 if ( zoom == (Minimap:GetZoomLevels() - 1) ) then
96 MinimapZoomIn:Disable();
97 elseif ( zoom == 0 ) then
98 MinimapZoomOut:Disable();
99 end
100 end
101 end
102
103 function Minimap_SetPing(x, y, playSound)
1b16914 @tekkub Build 11927
tekkub authored
104 if ( playSound ) then
105 PlaySound("MapPing");
bd5b1d5 @tekkub Build 9614
tekkub authored
106 end
107 end
108
109 function MiniMapBattlefieldFrame_OnUpdate (self, elapsed)
110 if ( GameTooltip:IsOwned(self) ) then
3ade9a9 @tekkub Build 12759
tekkub authored
111 PVP_UpdateStatus(1);
bd5b1d5 @tekkub Build 9614
tekkub authored
112 if ( self.tooltip ) then
c75a470 @tekkub Build 13529
tekkub authored
113 GameTooltip:SetText(self.tooltip, nil, nil, nil, nil, 1);
bd5b1d5 @tekkub Build 9614
tekkub authored
114 end
d477ec9 @tekkub Build 7677
tekkub authored
115 end
116 end
117
118 function Minimap_ZoomInClick()
119 MinimapZoomOut:Enable();
120 PlaySound("igMiniMapZoomIn");
121 Minimap:SetZoom(Minimap:GetZoom() + 1);
122 if(Minimap:GetZoom() == (Minimap:GetZoomLevels() - 1)) then
123 MinimapZoomIn:Disable();
124 end
125 end
126
127 function Minimap_ZoomOutClick()
128 MinimapZoomIn:Enable();
129 PlaySound("igMiniMapZoomOut");
130 Minimap:SetZoom(Minimap:GetZoom() - 1);
131 if(Minimap:GetZoom() == 0) then
132 MinimapZoomOut:Disable();
133 end
134 end
135
4ec3f81 @tekkub Build 8622
tekkub authored
136 function Minimap_OnClick(self)
d477ec9 @tekkub Build 7677
tekkub authored
137 local x, y = GetCursorPosition();
4ec3f81 @tekkub Build 8622
tekkub authored
138 x = x / self:GetEffectiveScale();
139 y = y / self:GetEffectiveScale();
d477ec9 @tekkub Build 7677
tekkub authored
140
4ec3f81 @tekkub Build 8622
tekkub authored
141 local cx, cy = self:GetCenter();
d477ec9 @tekkub Build 7677
tekkub authored
142 x = x - cx;
143 y = y - cy;
4ec3f81 @tekkub Build 8622
tekkub authored
144 if ( sqrt(x * x + y * y) < (self:GetWidth() / 2) ) then
d477ec9 @tekkub Build 7677
tekkub authored
145 Minimap:PingLocation(x, y);
146 end
147 end
148
149 function Minimap_ZoomIn()
150 MinimapZoomIn:Click();
151 end
152
153 function Minimap_ZoomOut()
154 MinimapZoomOut:Click();
155 end
156
b5d7ab4 @tekkub Build 10712
tekkub authored
157 function EyeTemplate_OnUpdate(self, elapsed)
cb517b0 @tekkub Build 12942
tekkub authored
158 AnimateTexCoords(self.texture, 512, 256, 64, 64, 29, elapsed, 0.1)
b5d7ab4 @tekkub Build 10712
tekkub authored
159 end
160
161 function EyeTemplate_StartAnimating(eye)
162 eye:SetScript("OnUpdate", EyeTemplate_OnUpdate);
163 end
164
165 function EyeTemplate_StopAnimating(eye)
166 eye:SetScript("OnUpdate", nil);
167 if ( eye.texture.frame ) then
168 eye.texture.frame = 1; --To start the animation over.
169 end
170 eye.texture:SetTexCoord(0, 0.125, 0, .25);
171 end
172
173 function MiniMapLFG_UpdateIsShown()
174 local mode, submode = GetLFGMode();
175 if ( mode ) then
176 MiniMapLFGFrame:Show();
f1e5c3a @tekkub Build 10805
tekkub authored
177 if ( mode == "queued" or mode == "listed" or mode == "rolecheck" ) then
b5d7ab4 @tekkub Build 10712
tekkub authored
178 EyeTemplate_StartAnimating(MiniMapLFGFrame.eye);
179 else
180 EyeTemplate_StopAnimating(MiniMapLFGFrame.eye);
181 end
182 else
183 MiniMapLFGFrame:Hide();
184 end
185 end
186
187 function MiniMapLFGFrame_TeleportIn()
188 LFGTeleport(false);
189 end
190
191 function MiniMapLFGFrame_TeleportOut()
192 LFGTeleport(true);
193 end
194
0e2b95f @tekkub Build 10571
tekkub authored
195 function MiniMapLFGFrameDropDown_Update()
196 local info = UIDropDownMenu_CreateInfo();
197
b5d7ab4 @tekkub Build 10712
tekkub authored
198 local mode, submode = GetLFGMode();
0e2b95f @tekkub Build 10571
tekkub authored
199
200 --This one can appear in addition to others, so we won't just check the mode.
f1e5c3a @tekkub Build 10805
tekkub authored
201 if ( IsPartyLFG() ) then
202 local addButton = false;
b5d7ab4 @tekkub Build 10712
tekkub authored
203 if ( IsInLFGDungeon() ) then
204 info.text = TELEPORT_OUT_OF_DUNGEON;
205 info.func = MiniMapLFGFrame_TeleportOut;
f1e5c3a @tekkub Build 10805
tekkub authored
206 addButton = true;
207 elseif ((GetNumPartyMembers() > 0) or (GetNumRaidMembers() > 0)) then
b5d7ab4 @tekkub Build 10712
tekkub authored
208 info.text = TELEPORT_TO_DUNGEON;
209 info.func = MiniMapLFGFrame_TeleportIn;
f1e5c3a @tekkub Build 10805
tekkub authored
210 addButton = true;
211 end
212 if ( addButton ) then
213 UIDropDownMenu_AddButton(info);
b5d7ab4 @tekkub Build 10712
tekkub authored
214 end
0e2b95f @tekkub Build 10571
tekkub authored
215 end
216
217 if ( mode == "proposal" and submode == "unaccepted" ) then
218 info.text = ENTER_DUNGEON;
219 info.func = AcceptProposal;
220 UIDropDownMenu_AddButton(info);
221
222 info.text = LEAVE_QUEUE;
223 info.func = RejectProposal;
224 UIDropDownMenu_AddButton(info);
225 elseif ( mode == "queued" ) then
226 info.text = LEAVE_QUEUE;
227 info.func = LeaveLFG;
228 info.disabled = (submode == "unempowered");
229 UIDropDownMenu_AddButton(info);
b5d7ab4 @tekkub Build 10712
tekkub authored
230 elseif ( mode == "listed" ) then
231 if ((GetNumPartyMembers() > 0) or (GetNumRaidMembers() > 0)) then
232 info.text = UNLIST_MY_GROUP;
233 else
234 info.text = UNLIST_ME;
235 end
236 info.func = LeaveLFG;
237 info.disabled = (submode == "unempowered");
238 UIDropDownMenu_AddButton(info);
0e2b95f @tekkub Build 10571
tekkub authored
239 end
d477ec9 @tekkub Build 7677
tekkub authored
240 end
241
0e2b95f @tekkub Build 10571
tekkub authored
242 function MiniMapLFGFrame_OnClick(self, button)
b5d7ab4 @tekkub Build 10712
tekkub authored
243 local mode, submode = GetLFGMode();
f1e5c3a @tekkub Build 10805
tekkub authored
244 if ( button == "RightButton" or mode == "lfgparty" or mode == "abandonedInDungeon") then
0e2b95f @tekkub Build 10571
tekkub authored
245 --Display dropdown
f1e5c3a @tekkub Build 10805
tekkub authored
246 PlaySound("igMainMenuOpen");
f9687b7 @tekkub Build 10835
tekkub authored
247 --Weird hack so that the popup isn't under the queued status window (bug 184001)
248 local yOffset;
249 if ( mode == "queued" ) then
250 MiniMapLFGFrameDropDown.point = "BOTTOMRIGHT";
251 MiniMapLFGFrameDropDown.relativePoint = "TOPLEFT";
252 yOffset = 0;
253 else
254 MiniMapLFGFrameDropDown.point = nil;
255 MiniMapLFGFrameDropDown.relativePoint = nil;
256 yOffset = -5;
257 end
258 ToggleDropDownMenu(1, nil, MiniMapLFGFrameDropDown, "MiniMapLFGFrame", 0, yOffset);
a2cf4c3 @tekkub Build 10596
tekkub authored
259 elseif ( mode == "proposal" ) then
f9687b7 @tekkub Build 10835
tekkub authored
260 if ( not LFDDungeonReadyPopup:IsShown() ) then
261 PlaySound("igCharacterInfoTab");
262 StaticPopupSpecial_Show(LFDDungeonReadyPopup);
263 end
a2cf4c3 @tekkub Build 10596
tekkub authored
264 elseif ( mode == "queued" or mode == "rolecheck" ) then
bdffcab @tekkub Build 10623
tekkub authored
265 ToggleLFDParentFrame();
b5d7ab4 @tekkub Build 10712
tekkub authored
266 elseif ( mode == "listed" ) then
267 ToggleLFRParentFrame();
d477ec9 @tekkub Build 7677
tekkub authored
268 end
269 end
270
0e2b95f @tekkub Build 10571
tekkub authored
271 function MiniMapLFGFrame_OnEnter(self)
b5d7ab4 @tekkub Build 10712
tekkub authored
272 local mode, submode = GetLFGMode();
0e2b95f @tekkub Build 10571
tekkub authored
273 if ( mode == "queued" ) then
274 LFDSearchStatus:Show();
275 elseif ( mode == "proposal" ) then
b5d7ab4 @tekkub Build 10712
tekkub authored
276 GameTooltip:SetOwner(self, "ANCHOR_LEFT");
0e2b95f @tekkub Build 10571
tekkub authored
277 GameTooltip:SetText(LOOKING_FOR_DUNGEON);
278 GameTooltip:AddLine(DUNGEON_GROUP_FOUND_TOOLTIP, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1);
279 GameTooltip:AddLine(" ");
280 GameTooltip:AddLine(CLICK_HERE_FOR_MORE_INFO, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1);
281 GameTooltip:Show();
282 elseif ( mode == "rolecheck" ) then
b5d7ab4 @tekkub Build 10712
tekkub authored
283 GameTooltip:SetOwner(self, "ANCHOR_LEFT");
0e2b95f @tekkub Build 10571
tekkub authored
284 GameTooltip:SetText(LOOKING_FOR_DUNGEON);
285 GameTooltip:AddLine(ROLE_CHECK_IN_PROGRESS_TOOLTIP, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1);
286 GameTooltip:Show();
b5d7ab4 @tekkub Build 10712
tekkub authored
287 elseif ( mode == "listed" ) then
288 GameTooltip:SetOwner(self, "ANCHOR_LEFT");
289 GameTooltip:SetText(LOOKING_FOR_RAID);
290 GameTooltip:AddLine(YOU_ARE_LISTED_IN_LFR, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1);
291 GameTooltip:Show();
a2cf4c3 @tekkub Build 10596
tekkub authored
292 elseif ( mode == "lfgparty" ) then
b5d7ab4 @tekkub Build 10712
tekkub authored
293 GameTooltip:SetOwner(self, "ANCHOR_LEFT");
a2cf4c3 @tekkub Build 10596
tekkub authored
294 GameTooltip:SetText(LOOKING_FOR_DUNGEON);
295 GameTooltip:AddLine(YOU_ARE_IN_DUNGEON_GROUP, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1);
296 GameTooltip:Show();
0e2b95f @tekkub Build 10571
tekkub authored
297 end
298 end
299
300 function MiniMapLFGFrame_OnLeave(self)
301 GameTooltip:Hide();
302 LFDSearchStatus:Hide();
303 end
a2cf4c3 @tekkub Build 10596
tekkub authored
304
4ec3f81 @tekkub Build 8622
tekkub authored
305 function MinimapButton_OnMouseDown(self, button)
306 if ( self.isDown ) then
d477ec9 @tekkub Build 7677
tekkub authored
307 return;
308 end
891a0d8 @tekkub Build 10026
tekkub authored
309 local button = _G[self:GetName().."Icon"];
d477ec9 @tekkub Build 7677
tekkub authored
310 local point, relativeTo, relativePoint, offsetX, offsetY = button:GetPoint();
311 button:SetPoint(point, relativeTo, relativePoint, offsetX+1, offsetY-1);
4ec3f81 @tekkub Build 8622
tekkub authored
312 self.isDown = 1;
d477ec9 @tekkub Build 7677
tekkub authored
313 end
4ec3f81 @tekkub Build 8622
tekkub authored
314 function MinimapButton_OnMouseUp(self)
315 if ( not self.isDown ) then
d477ec9 @tekkub Build 7677
tekkub authored
316 return;
317 end
891a0d8 @tekkub Build 10026
tekkub authored
318 local button = _G[self:GetName().."Icon"];
d477ec9 @tekkub Build 7677
tekkub authored
319 local point, relativeTo, relativePoint, offsetX, offsetY = button:GetPoint();
320 button:SetPoint(point, relativeTo, relativePoint, offsetX-1, offsetY+1);
4ec3f81 @tekkub Build 8622
tekkub authored
321 self.isDown = nil;
d477ec9 @tekkub Build 7677
tekkub authored
322 end
323
324 function Minimap_UpdateRotationSetting()
325 if ( GetCVar("rotateMinimap") == "1" ) then
bd5b1d5 @tekkub Build 9614
tekkub authored
326 MinimapCompassTexture:Show();
d477ec9 @tekkub Build 7677
tekkub authored
327 MinimapNorthTag:Hide();
328 else
bd5b1d5 @tekkub Build 9614
tekkub authored
329 MinimapCompassTexture:Hide();
d477ec9 @tekkub Build 7677
tekkub authored
330 MinimapNorthTag:Show();
331 end
332 end
333
334 function ToggleMiniMapRotation()
335 local rotate = GetCVar("rotateMinimap");
336 if ( rotate == "1" ) then
337 rotate = "0";
338 else
339 rotate = "1";
340 end
341 SetCVar("rotateMinimap", rotate);
342 Minimap_UpdateRotationSetting();
343 end
344
345 function MinimapMailFrameUpdate()
65b8b0a @tekkub Build 9626
tekkub authored
346 local sender1,sender2,sender3 = GetLatestThreeSenders();
6f2e4c4 @tekkub Build 9742
tekkub authored
347 local toolText;
d477ec9 @tekkub Build 7677
tekkub authored
348
349 if( sender1 or sender2 or sender3 ) then
17948a3 @tekkub Build 8209
tekkub authored
350 toolText = HAVE_MAIL_FROM;
d477ec9 @tekkub Build 7677
tekkub authored
351 else
17948a3 @tekkub Build 8209
tekkub authored
352 toolText = HAVE_MAIL;
d477ec9 @tekkub Build 7677
tekkub authored
353 end
354
355 if( sender1 ) then
356 toolText = toolText.."\n"..sender1;
357 end
358 if( sender2 ) then
359 toolText = toolText.."\n"..sender2;
360 end
361 if( sender3 ) then
362 toolText = toolText.."\n"..sender3;
363 end
364 GameTooltip:SetText(toolText);
365 end
366
367 function MiniMapTracking_Update()
dddb3ed @tekkub Build 12065
tekkub authored
368 UIDropDownMenu_Refresh(MiniMapTrackingDropDown);
d477ec9 @tekkub Build 7677
tekkub authored
369 end
370
4ec3f81 @tekkub Build 8622
tekkub authored
371 function MiniMapTrackingDropDown_OnLoad(self)
372 UIDropDownMenu_Initialize(self, MiniMapTrackingDropDown_Initialize, "MENU");
dddb3ed @tekkub Build 12065
tekkub authored
373 self.noResize = true;
374 end
375
376 function MiniMapTracking_SetTracking (self, id, unused, on)
377 SetTracking(id, on);
378 UIDropDownMenu_Refresh(MiniMapTrackingDropDown);
4ec3f81 @tekkub Build 8622
tekkub authored
379 end
380
dddb3ed @tekkub Build 12065
tekkub authored
381 function MiniMapTrackingDropDownButton_IsActive(button)
382 local name, texture, active, category = GetTrackingInfo(button.arg1);
383 return active;
d477ec9 @tekkub Build 7677
tekkub authored
384 end
385
5d1c420 @tekkub Build 13682
tekkub authored
386 function MiniMapTrackingDropDown_IsNoTrackingActive()
387 local name, texture, active, category;
388 local count = GetNumTrackingTypes();
389 for id=1, count do
390 name, texture, active, category = GetTrackingInfo(id);
391 if (active) then
392 return false;
393 end
394 end
395 return true;
396 end
397
d477ec9 @tekkub Build 7677
tekkub authored
398 function MiniMapTrackingDropDown_Initialize()
399 local name, texture, active, category;
400 local count = GetNumTrackingTypes();
65b8b0a @tekkub Build 9626
tekkub authored
401 local info;
5d1c420 @tekkub Build 13682
tekkub authored
402
403 info = UIDropDownMenu_CreateInfo();
404 info.text=MINIMAP_TRACKING_NONE;
405 info.checked = MiniMapTrackingDropDown_IsNoTrackingActive;
406 info.func = ClearAllTracking;
407 info.icon = nil;
408 info.arg1 = nil;
409 info.isNotRadio = true;
410 info.keepShownOnClick = true;
411 UIDropDownMenu_AddButton(info);
412
d477ec9 @tekkub Build 7677
tekkub authored
413 for id=1, count do
414 name, texture, active, category = GetTrackingInfo(id);
415
416 info = UIDropDownMenu_CreateInfo();
417 info.text = name;
dddb3ed @tekkub Build 12065
tekkub authored
418 info.checked = MiniMapTrackingDropDownButton_IsActive;
4ec3f81 @tekkub Build 8622
tekkub authored
419 info.func = MiniMapTracking_SetTracking;
d477ec9 @tekkub Build 7677
tekkub authored
420 info.icon = texture;
421 info.arg1 = id;
3582a24 @tekkub Build 12803
tekkub authored
422 info.isNotRadio = true;
dddb3ed @tekkub Build 12065
tekkub authored
423 info.keepShownOnClick = true;
d477ec9 @tekkub Build 7677
tekkub authored
424 if ( category == "spell" ) then
425 info.tCoordLeft = 0.0625;
426 info.tCoordRight = 0.9;
427 info.tCoordTop = 0.0625;
428 info.tCoordBottom = 0.9;
429 else
430 info.tCoordLeft = 0;
431 info.tCoordRight = 1;
432 info.tCoordTop = 0;
433 info.tCoordBottom = 1;
434 end
435 UIDropDownMenu_AddButton(info);
436 end
437 end
438
439 function MiniMapTrackingShineFadeIn()
440 -- Fade in the shine and then fade it out with the ComboPointShineFadeOut function
441 local fadeInfo = {};
442 fadeInfo.mode = "IN";
443 fadeInfo.timeToFade = 0.5;
444 fadeInfo.finishedFunc = MiniMapTrackingShineFadeOut;
40c9336 @tekkub Build 8681
tekkub authored
445 UIFrameFade(MiniMapTrackingButtonShine, fadeInfo);
d477ec9 @tekkub Build 7677
tekkub authored
446 end
447
448 function MiniMapTrackingShineFadeOut()
40c9336 @tekkub Build 8681
tekkub authored
449 UIFrameFadeOut(MiniMapTrackingButtonShine, 0.5);
e339771 @tekkub Build 9733
tekkub authored
450 end
cb517b0 @tekkub Build 12942
tekkub authored
451
452 --
453 -- Dungeon Difficulty
454 --
a2cf4c3 @tekkub Build 10596
tekkub authored
455
43f08c2 @tekkub Build 10747
tekkub authored
456 local selectedRaidDifficulty;
457 local allowedRaidDifficulty;
cb517b0 @tekkub Build 12942
tekkub authored
458 local IS_GUILD_GROUP;
459
da29770 @tekkub Build 12984
tekkub authored
460 function MiniMapInstanceDifficulty_OnEvent(self, event, ...)
cb517b0 @tekkub Build 12942
tekkub authored
461 if ( event == "GUILD_PARTY_STATE_UPDATED" ) then
da29770 @tekkub Build 12984
tekkub authored
462 local isGuildGroup = ...;
463 if ( isGuildGroup ~= IS_GUILD_GROUP ) then
464 IS_GUILD_GROUP = isGuildGroup;
cb517b0 @tekkub Build 12942
tekkub authored
465 MiniMapInstanceDifficulty_Update();
466 end
467 elseif ( event == "PLAYER_DIFFICULTY_CHANGED" ) then
468 MiniMapInstanceDifficulty_Update();
469 elseif ( event == "UPDATE_INSTANCE_INFO" ) then
470 RequestGuildPartyState();
471 MiniMapInstanceDifficulty_Update();
472 elseif ( event == "PLAYER_GUILD_UPDATE" ) then
473 local tabard = GuildInstanceDifficulty;
474 SetSmallGuildTabardTextures("player", tabard.emblem, tabard.background, tabard.border);
475 if ( IsInGuild() ) then
476 RequestGuildPartyState();
477 else
478 IS_GUILD_GROUP = nil;
479 MiniMapInstanceDifficulty_Update();
480 end
481 else
482 RequestGuildPartyState();
483 end
484 end
485
486 function MiniMapInstanceDifficulty_Update()
43f08c2 @tekkub Build 10747
tekkub authored
487 local _, instanceType, difficulty, _, maxPlayers, playerDifficulty, isDynamicInstance = GetInstanceInfo();
da29770 @tekkub Build 12984
tekkub authored
488 if ( IS_GUILD_GROUP or ((instanceType == "party" or instanceType == "raid") and not (difficulty == 1 and maxPlayers == 5)) ) then
43f08c2 @tekkub Build 10747
tekkub authored
489 local isHeroic = false;
490 if ( instanceType == "party" and difficulty == 2 ) then
491 isHeroic = true;
492 elseif ( instanceType == "raid" ) then
493 if ( isDynamicInstance ) then
494 selectedRaidDifficulty = difficulty;
cb517b0 @tekkub Build 12942
tekkub authored
495 --if ( selectedRaidDifficulty > 1 ) then
496 -- isHeroic = true;
497 --end
43f08c2 @tekkub Build 10747
tekkub authored
498 -- if modified difficulty is normal then you are allowed to select heroic, and vice-versa
499 if ( selectedRaidDifficulty == 1 ) then
500 allowedRaidDifficulty = 3;
501 elseif ( selectedRaidDifficulty == 2 ) then
502 allowedRaidDifficulty = 4;
503 elseif ( selectedRaidDifficulty == 3 ) then
504 allowedRaidDifficulty = 1;
505 elseif ( selectedRaidDifficulty == 4 ) then
506 allowedRaidDifficulty = 2;
507 end
508 allowedRaidDifficulty = "RAID_DIFFICULTY"..allowedRaidDifficulty;
cb517b0 @tekkub Build 12942
tekkub authored
509 end
510 if ( difficulty > 2 ) then
43f08c2 @tekkub Build 10747
tekkub authored
511 isHeroic = true;
512 end
513 end
cb517b0 @tekkub Build 12942
tekkub authored
514 if ( IS_GUILD_GROUP ) then
da29770 @tekkub Build 12984
tekkub authored
515 if ( maxPlayers == 0 ) then
516 GuildInstanceDifficultyText:SetText("");
517 GuildInstanceDifficultyDarkBackground:SetAlpha(0);
518 GuildInstanceDifficulty.emblem:SetPoint("TOPLEFT", 12, -16);
519 else
520 GuildInstanceDifficultyText:SetText(maxPlayers);
521 GuildInstanceDifficultyDarkBackground:SetAlpha(0.7);
522 GuildInstanceDifficulty.emblem:SetPoint("TOPLEFT", 12, -10);
523 end
cb517b0 @tekkub Build 12942
tekkub authored
524 GuildInstanceDifficultyText:ClearAllPoints();
525 if ( isHeroic ) then
526 if ( maxPlayers > 10 ) then
527 GuildInstanceDifficultyHeroicTexture:SetPoint("BOTTOMLEFT", 8, 7);
528 GuildInstanceDifficultyText:SetPoint("BOTTOMLEFT", 20, 8);
529 else
530 GuildInstanceDifficultyHeroicTexture:SetPoint("BOTTOMLEFT", 11, 7);
531 GuildInstanceDifficultyText:SetPoint("BOTTOMLEFT", 23, 8);
532 end
533 GuildInstanceDifficultyHeroicTexture:Show();
534 else
535 GuildInstanceDifficultyHeroicTexture:Hide();
536 GuildInstanceDifficultyText:SetPoint("BOTTOM", 2, 8);
537 end
538 MiniMapInstanceDifficulty:Hide();
da29770 @tekkub Build 12984
tekkub authored
539 SetSmallGuildTabardTextures("player", GuildInstanceDifficulty.emblem, GuildInstanceDifficulty.background, GuildInstanceDifficulty.border);
cb517b0 @tekkub Build 12942
tekkub authored
540 GuildInstanceDifficulty:Show();
43f08c2 @tekkub Build 10747
tekkub authored
541 else
cb517b0 @tekkub Build 12942
tekkub authored
542 MiniMapInstanceDifficultyText:SetText(maxPlayers);
543 -- the 1 looks a little off when text is centered
544 local xOffset = 0;
545 if ( maxPlayers >= 10 and maxPlayers <= 19 ) then
546 xOffset = -1;
547 end
548 if ( isHeroic ) then
549 MiniMapInstanceDifficultyTexture:SetTexCoord(0, 0.25, 0.0703125, 0.4140625);
550 MiniMapInstanceDifficultyText:SetPoint("CENTER", xOffset, -9);
551 else
552 MiniMapInstanceDifficultyTexture:SetTexCoord(0, 0.25, 0.5703125, 0.9140625);
553 MiniMapInstanceDifficultyText:SetPoint("CENTER", xOffset, 5);
554 end
555 MiniMapInstanceDifficulty:Show();
556 GuildInstanceDifficulty:Hide();
43f08c2 @tekkub Build 10747
tekkub authored
557 end
a2cf4c3 @tekkub Build 10596
tekkub authored
558 else
cb517b0 @tekkub Build 12942
tekkub authored
559 MiniMapInstanceDifficulty:Hide();
560 GuildInstanceDifficulty:Hide();
a2cf4c3 @tekkub Build 10596
tekkub authored
561 end
43f08c2 @tekkub Build 10747
tekkub authored
562 end
563
564 function _GetPlayerDifficultyMenuOptions()
565 return selectedRaidDifficulty, allowedRaidDifficulty;
c75a470 @tekkub Build 13529
tekkub authored
566 end
567
568 function GuildInstanceDifficulty_OnEnter(self)
569 local guildName = GetGuildInfo("player");
570 local _, instanceType, _, _, maxPlayers = GetInstanceInfo();
571 local _, numGuildPresent, numGuildRequired, xpMultiplier = InGuildParty();
572 -- hack alert
573 if ( instanceType == "arena" ) then
574 maxPlayers = numGuildRequired;
575 end
576 GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT", 8, 8);
577 GameTooltip:SetText(GUILD_GROUP, 1, 1, 1);
578 if ( xpMultiplier < 1 ) then
579 GameTooltip:AddLine(string.format(GUILD_ACHIEVEMENTS_ELIGIBLE_MINXP, numGuildRequired, maxPlayers, guildName, xpMultiplier * 100), nil, nil, nil, 1);
580 elseif ( xpMultiplier > 1 ) then
581 GameTooltip:AddLine(string.format(GUILD_ACHIEVEMENTS_ELIGIBLE_MAXXP, guildName, xpMultiplier * 100), nil, nil, nil, 1);
582 else
583 GameTooltip:AddLine(string.format(GUILD_ACHIEVEMENTS_ELIGIBLE, numGuildRequired, maxPlayers, guildName), nil, nil, nil, 1);
584 end
585 GameTooltip:Show();
a2cf4c3 @tekkub Build 10596
tekkub authored
586 end
Something went wrong with that request. Please try again.