vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | local L = AceLibrary("AceLocale-2.0"):new("FuBar_LocationFu") |
2 | local Tourist = AceLibrary("Tourist-2.0") |
||
3 | local Tablet = AceLibrary("Tablet-2.0") |
||
4 | local Jostle = AceLibrary("Jostle-2.0") |
||
5 | |||
6 | LocationFu = AceLibrary("AceAddon-2.0"):new("FuBarPlugin-2.0", "AceEvent-2.0", "AceConsole-2.0", "AceDB-2.0") |
||
7 | |||
8 | LocationFu.version = "2.0" .. string.sub("$Revision: 7853 $", 12, -3) |
||
9 | LocationFu.date = string.sub("$Date: 2006-08-12 12:15:59 -1000 (Sat, 12 Aug 2006) $", 8, 17) |
||
10 | LocationFu.hasIcon = true |
||
11 | |||
12 | local table_insert = table.insert |
||
13 | |||
14 | LocationFu:RegisterDB("LocationFuDB") |
||
15 | LocationFu:RegisterDefaults("profile", { |
||
16 | showMapCoords = true, |
||
17 | showCoords = true, |
||
18 | showSubZoneName = true, |
||
19 | showZoneName = false, |
||
20 | showRecZones = true, |
||
21 | showMapOverlay = true, |
||
22 | showLevelRange = true, |
||
23 | }) |
||
24 | function LocationFu:IsShowingCoords() |
||
25 | return self.db.profile.showCoords |
||
26 | end |
||
27 | |||
28 | function LocationFu:ToggleShowingCoords() |
||
29 | self.db.profile.showCoords = not self.db.profile.showCoords |
||
30 | self:UpdateText() |
||
31 | end |
||
32 | |||
33 | function LocationFu:IsShowingZoneName() |
||
34 | return self.db.profile.showZoneName |
||
35 | end |
||
36 | |||
37 | function LocationFu:ToggleShowingZoneName() |
||
38 | self.db.profile.showZoneName = not self.db.profile.showZoneName |
||
39 | self:UpdateText() |
||
40 | end |
||
41 | |||
42 | function LocationFu:IsShowingSubZoneName() |
||
43 | return self.db.profile.showSubZoneName |
||
44 | end |
||
45 | |||
46 | function LocationFu:ToggleShowingSubZoneName() |
||
47 | self.db.profile.showSubZoneName = not self.db.profile.showSubZoneName |
||
48 | self:UpdateText() |
||
49 | end |
||
50 | |||
51 | function LocationFu:IsShowingLevelRange() |
||
52 | return self.db.profile.showLevelRange |
||
53 | end |
||
54 | |||
55 | function LocationFu:ToggleShowingLevelRange() |
||
56 | self.db.profile.showLevelRange = not self.db.profile.showLevelRange |
||
57 | self:UpdateText() |
||
58 | end |
||
59 | |||
60 | function LocationFu:IsShowingMinimapBar() |
||
61 | return self.db.profile.minimapBar |
||
62 | end |
||
63 | |||
64 | function LocationFu:ToggleShowingMinimapBar() |
||
65 | self.db.profile.minimapBar = not self.db.profile.minimapBar |
||
66 | if not self.db.profile.minimapBar then |
||
67 | MinimapBorderTop:Hide() |
||
68 | MinimapToggleButton:Hide() |
||
69 | MinimapZoneTextButton:Hide() |
||
70 | else |
||
71 | MinimapBorderTop:Show() |
||
72 | MinimapToggleButton:Show() |
||
73 | MinimapZoneTextButton:Show() |
||
74 | end |
||
75 | Jostle:Refresh() |
||
76 | end |
||
77 | |||
78 | function LocationFu:IsShowingMapCoords() |
||
79 | return self.db.profile.showMapCoords |
||
80 | end |
||
81 | |||
82 | function LocationFu:ToggleShowingMapCoords() |
||
83 | self.db.profile.showMapCoords = not self.db.profile.showMapCoords |
||
84 | if not self.db.profile.showMapCoords then |
||
85 | LocationFuMapFrameCursorCoords:Hide() |
||
86 | LocationFuMapFramePlayerCoords:Hide() |
||
87 | else |
||
88 | LocationFuMapFrameCursorCoords:Show() |
||
89 | LocationFuMapFramePlayerCoords:Show() |
||
90 | end |
||
91 | end |
||
92 | |||
93 | function LocationFu:IsShowingRecommendedZones() |
||
94 | return self.db.profile.showRecZones |
||
95 | end |
||
96 | |||
97 | function LocationFu:ToggleShowingRecommendedZones() |
||
98 | self.db.profile.showRecZones = not self.db.profile.showRecZones |
||
99 | self:UpdateTooltip() |
||
100 | end |
||
101 | |||
102 | function LocationFu:IsShowingMapOverlay() |
||
103 | return self.db.profile.showMapOverlay |
||
104 | end |
||
105 | |||
106 | function LocationFu:ToggleShowingMapOverlay() |
||
107 | self.db.profile.showMapOverlay = not self.db.profile.showMapOverlay |
||
108 | if not self.db.profile.showMapOverlay then |
||
109 | LocationFuMapFrameText:Hide() |
||
110 | WorldMapFrameAreaLabel:SetTextColor(1, 1, 1) |
||
111 | else |
||
112 | LocationFuMapFrameText:Show() |
||
113 | end |
||
114 | return self.db.profile.showMapOverlay |
||
115 | end |
||
116 | |||
117 | function LocationFu:OnInitialize() |
||
118 | local mapFrame = CreateFrame("Frame", "LocationFuMapFrame", WorldMapFrame) |
||
119 | mapFrame:SetScript("OnUpdate", self.MapFrame_OnUpdate) |
||
120 | local cursorCoords = mapFrame:CreateFontString("LocationFuMapFrameCursorCoords", "ARTWORK") |
||
121 | cursorCoords:SetFont(GameFontNormal:GetFont()) |
||
122 | cursorCoords:SetTextColor(GameFontNormal:GetTextColor()) |
||
123 | cursorCoords:SetShadowColor(GameFontNormal:GetShadowColor()) |
||
124 | cursorCoords:SetShadowOffset(GameFontNormal:GetShadowOffset()) |
||
125 | cursorCoords:SetPoint("RIGHT", WorldMapFrame, "CENTER", -80, -367) |
||
126 | |||
127 | local playerCoords = mapFrame:CreateFontString("LocationFuMapFramePlayerCoords", "ARTWORK") |
||
128 | playerCoords:SetFont(GameFontNormal:GetFont()) |
||
129 | playerCoords:SetTextColor(GameFontNormal:GetTextColor()) |
||
130 | playerCoords:SetShadowColor(GameFontNormal:GetShadowColor()) |
||
131 | playerCoords:SetShadowOffset(GameFontNormal:GetShadowOffset()) |
||
132 | playerCoords:SetPoint("RIGHT", WorldMapFrame, "CENTER", 80, -367) |
||
133 | |||
134 | local text = mapFrame:CreateFontString("LocationFuMapFrameText", "OVERLAY") |
||
135 | local font, size = GameFontHighlightLarge:GetFont() |
||
136 | text:SetFont(font, size, "OUTLINE") |
||
137 | text:SetTextColor(GameFontHighlightLarge:GetTextColor()) |
||
138 | text:SetShadowColor(GameFontHighlightLarge:GetShadowColor()) |
||
139 | text:SetShadowOffset(GameFontHighlightLarge:GetShadowOffset()) |
||
140 | text:SetPoint("TOP", WorldMapFrameAreaDescription, "BOTTOM", 0, -5) |
||
141 | end |
||
142 | |||
143 | function LocationFu:OnEnable() |
||
144 | self:RegisterEvent("ZONE_CHANGED", "UpdateData") |
||
145 | self:RegisterEvent("ZONE_CHANGED_INDOORS", "UpdateData") |
||
146 | self:RegisterEvent("ZONE_CHANGED_NEW_AREA") |
||
147 | self:RegisterEvent("MINIMAP_ZONE_CHANGED", "UpdateData") |
||
148 | self:RegisterEvent("PLAYER_ENTERING_WORLD") |
||
149 | |||
150 | if not self:IsShowingMinimapBar() then |
||
151 | self.db.profile.minimapBar = not self.db.profile.minimapBar |
||
152 | self:ToggleShowingMinimapBar() |
||
153 | end |
||
154 | |||
155 | if not self:IsShowingMapCoords() then |
||
156 | self.db.profile.showMapCoords = not self.db.profile.showMapCoords |
||
157 | self:ToggleShowingMapCoords() |
||
158 | end |
||
159 | |||
160 | local x, y = GetPlayerMapPosition("player") |
||
161 | if x == 0 and y == 0 then -- instance |
||
162 | self:ScheduleRepeatingEvent("LocationFu", self.UpdateDisplay, 60, self) |
||
163 | else |
||
164 | self:ScheduleRepeatingEvent("LocationFu", self.UpdateDisplay, 0.1, self) |
||
165 | end |
||
166 | end |
||
167 | |||
168 | function LocationFu:OnDisable() |
||
169 | if not self:IsShowingMinimapBar() then |
||
170 | self:ToggleShowingMinimapBar() |
||
171 | self.db.profile.minimapBar = not self.db.profile.minimapBar |
||
172 | end |
||
173 | if self:IsShowingMapCoords() then |
||
174 | self:ToggleShowingMapCoords() |
||
175 | self.db.profile.showMapCoords = not self.db.profile.showMapCoords |
||
176 | end |
||
177 | LocationFuMapFrameText:SetText("") |
||
178 | end |
||
179 | |||
180 | local options = { |
||
181 | type = 'group', |
||
182 | args = { |
||
183 | map = { |
||
184 | order = 97, |
||
185 | type = 'execute', |
||
186 | name = L"Open world map", |
||
187 | desc = L"Open world map", |
||
188 | func = function() ToggleWorldMap() end |
||
189 | }, |
||
190 | atlas = { |
||
191 | order = 98, |
||
192 | type = 'execute', |
||
193 | name = L"Open Atlas", |
||
194 | desc = L"Open Atlas", |
||
195 | func = function() Atlas_Toggle() end, |
||
196 | hidden = function() return not Atlas_Toggle end, |
||
197 | }, |
||
198 | ["-blank-"] = { |
||
199 | order = 99, |
||
200 | type = 'header', |
||
201 | }, |
||
202 | coords = { |
||
203 | type = 'toggle', |
||
204 | name = L"Show coordinates", |
||
205 | desc = L"Toggle the coordinates in the text of this plugin", |
||
206 | get = "IsShowingCoords", |
||
207 | set = "ToggleShowingCoords", |
||
208 | }, |
||
209 | subzone = { |
||
210 | type = 'toggle', |
||
211 | name = L"Show subzone name", |
||
212 | desc = L"Show subzone name", |
||
213 | get = "IsShowingSubZoneName", |
||
214 | set = "ToggleShowingSubZoneName", |
||
215 | }, |
||
216 | zone = { |
||
217 | type = 'toggle', |
||
218 | name = L"Show zone name", |
||
219 | desc = L"Toggle the zone name in the text of this plugin", |
||
220 | get = "IsShowingZoneName", |
||
221 | set = "ToggleShowingZoneName", |
||
222 | }, |
||
223 | levelRange = { |
||
224 | type = 'toggle', |
||
225 | name = L"Show level range", |
||
226 | desc = L"Show level range", |
||
227 | get = "IsShowingLevelRange", |
||
228 | set = "ToggleShowingLevelRange", |
||
229 | }, |
||
230 | minimapBar = { |
||
231 | type = 'toggle', |
||
232 | name = L"Show minimap bar", |
||
233 | desc = L"Show the bar above the minimap that tells the location and allows you to close minimap", |
||
234 | get = "IsShowingMinimapBar", |
||
235 | set = "ToggleShowingMinimapBar", |
||
236 | }, |
||
237 | mapCoords = { |
||
238 | type = 'toggle', |
||
239 | name = L"Show coodinates on map", |
||
240 | desc = L"Show the coordinates of your cursor and your player on the world map", |
||
241 | get = "IsShowingMapCoords", |
||
242 | set = "ToggleShowingMapCoords", |
||
243 | }, |
||
244 | overlay = { |
||
245 | type = 'toggle', |
||
246 | name = L"Show map overlay", |
||
247 | desc = L"Show the overlay on the map which shows the level range and instances available", |
||
248 | get = "IsShowingMapOverlay", |
||
249 | set = "ToggleShowingMapOverlay", |
||
250 | }, |
||
251 | recommend = { |
||
252 | type = 'toggle', |
||
253 | name = L"Show recommended zones", |
||
254 | desc = L"Show your recommended zones in the tooltip", |
||
255 | get = "IsShowingRecommendedZones", |
||
256 | set = "ToggleShowingRecommendedZones", |
||
257 | }, |
||
258 | } |
||
259 | } |
||
260 | LocationFu:RegisterChatCommand(L:GetTable("AceConsole-options"), options) |
||
261 | LocationFu.OnMenuRequest = options |
||
262 | |||
263 | function LocationFu:ZONE_CHANGED_NEW_AREA() |
||
264 | SetMapToCurrentZone() |
||
265 | self:UpdateData() |
||
266 | end |
||
267 | |||
268 | function LocationFu:PLAYER_ENTERING_WORLD() |
||
269 | self:UpdateData() |
||
270 | local x, y = GetPlayerMapPosition("player") |
||
271 | if x == 0 and y == 0 then -- instance |
||
272 | self:ScheduleRepeatingEvent("LocationFu", self.UpdateDisplay, 60, self) |
||
273 | else |
||
274 | self:ScheduleRepeatingEvent("LocationFu", self.UpdateDisplay, 0.1, self) |
||
275 | end |
||
276 | self:UpdateDisplay() |
||
277 | end |
||
278 | |||
279 | local subZoneText, zoneText, zoneColor, pvpType, isArena |
||
280 | |||
281 | function LocationFu:OnDataUpdate() |
||
282 | subZoneText = GetSubZoneText() |
||
283 | zoneText = GetZoneText() |
||
284 | if subZoneText == "" then |
||
285 | subZoneText = zoneText |
||
286 | end |
||
287 | zoneColor = "YELLOW" |
||
288 | pvpType,_,isArena = GetZonePVPInfo() |
||
289 | local faction = UnitFactionGroup("player") |
||
290 | if isArena or pvpType == "hostile" then |
||
291 | zoneColor = "RED" |
||
292 | elseif pvpType == "friendly" then |
||
293 | zoneColor = "GREEN" |
||
294 | elseif Tourist:IsHostile(zoneText) then |
||
295 | zoneColor = "RED" |
||
296 | elseif Tourist:IsFriendly(zoneText) then |
||
297 | zoneColor = "GREEN" |
||
298 | end |
||
299 | if Atlas_Toggle and Tourist:IsInstance(zoneText) then |
||
300 | self:SetIcon("Interface\\AddOns\\Atlas\\Images\\AtlasIcon") |
||
301 | else |
||
302 | self:SetIcon(true) |
||
303 | end |
||
304 | end |
||
305 | |||
306 | local t = {} |
||
307 | function LocationFu:OnTextUpdate() |
||
308 | local text |
||
309 | local r, g, b = Tourist:GetFactionColor(zoneText) |
||
310 | if self:IsShowingZoneName() and self:IsShowingSubZoneName() then |
||
311 | if subZoneText == zoneText then |
||
312 | table_insert(t, string.format("|cff%02x%02x%02x%s|r", r*255, g*255, b*255, zoneText)) |
||
313 | else |
||
314 | table_insert(t, string.format("|cff%02x%02x%02x%s: %s|r", r*255, g*255, b*255, zoneText, subZoneText)) |
||
315 | end |
||
316 | elseif self:IsShowingZoneName() then |
||
317 | table_insert(t, string.format("|cff%02x%02x%02x%s|r", r*255, g*255, b*255, zoneText)) |
||
318 | elseif self:IsShowingSubZoneName() then |
||
319 | table_insert(t, string.format("|cff%02x%02x%02x%s|r", r*255, g*255, b*255, subZoneText)) |
||
320 | end |
||
321 | local x, y = GetPlayerMapPosition("player") |
||
322 | if self:IsShowingCoords() and x ~= 0 and y ~= 0 then |
||
323 | table_insert(t, string.format("|cff%02x%02x%02x(%.0f, %.0f)|r", r*255, g*255, b*255, x * 100, y * 100)) |
||
324 | end |
||
325 | local low, high = Tourist:GetLevel(zoneText) |
||
326 | if self:IsShowingLevelRange() and low > 0 and high > 0 then |
||
327 | local r, g, b = Tourist:GetLevelColor(zoneText) |
||
328 | table_insert(t, string.format("|cff%02x%02x%02x[%d-%d]|r", r*255, g*255, b*255, low, high)) |
||
329 | end |
||
330 | self:SetText(table.concat(t, " ")) |
||
331 | for k in pairs(t) do |
||
332 | t[k] = nil |
||
333 | end |
||
334 | table.setn(t, 0) |
||
335 | end |
||
336 | |||
337 | function LocationFu:OnTooltipUpdate() |
||
338 | local cat = Tablet:AddCategory( |
||
339 | 'columns', 2, |
||
340 | 'child_textR', 1, |
||
341 | 'child_textG', 1, |
||
342 | 'child_textB', 0, |
||
343 | 'child_text2R', 1, |
||
344 | 'child_text2G', 1, |
||
345 | 'child_text2B', 1 |
||
346 | ) |
||
347 | |||
348 | cat:AddLine( |
||
349 | 'text', L"Zone:", |
||
350 | 'text2', zoneText |
||
351 | ) |
||
352 | |||
353 | if subZoneText ~= zoneText then |
||
354 | cat:AddLine( |
||
355 | 'text', L"Subzone:", |
||
356 | 'text2', subZoneText |
||
357 | ) |
||
358 | end |
||
359 | |||
360 | local text |
||
361 | local r, g, b = 1, 1, 0 |
||
362 | if isArena then |
||
363 | text = L"Arena" |
||
364 | g = 0 |
||
365 | elseif zoneColor == "GREEN" then |
||
366 | text = L"Friendly" |
||
367 | r = 0 |
||
368 | elseif zoneColor == "YELLOW" then |
||
369 | text = L"Contested" |
||
370 | elseif zoneColor == "RED" then |
||
371 | text = L"Hostile" |
||
372 | g = 0 |
||
373 | end |
||
374 | |||
375 | cat:AddLine( |
||
376 | 'text', L"Status:", |
||
377 | 'text2', text, |
||
378 | 'text2R', r, |
||
379 | 'text2G', g, |
||
380 | 'text2B', b |
||
381 | ) |
||
382 | |||
383 | local x, y = GetPlayerMapPosition("player") |
||
384 | cat:AddLine( |
||
385 | 'text', L"Coordinates:", |
||
386 | 'text2', string.format("%.0f, %.0f", x*100, y*100) |
||
387 | ) |
||
388 | |||
389 | local low, high = Tourist:GetLevel(zoneText) |
||
390 | if low >= 1 and high >= 1 then |
||
391 | local r, g, b = Tourist:GetLevelColor(zoneText) |
||
392 | cat:AddLine( |
||
393 | 'text', L"Level range:", |
||
394 | 'text2', string.format("%d-%d", low, high), |
||
395 | 'text2R', r, |
||
396 | 'text2G', g, |
||
397 | 'text2B', b |
||
398 | ) |
||
399 | end |
||
400 | |||
401 | if Tourist:DoesZoneHaveInstances(zoneText) then |
||
402 | cat = Tablet:AddCategory( |
||
403 | 'columns', 2, |
||
404 | 'text', L"Instances", |
||
405 | 'child_textR', 1, |
||
406 | 'child_textG', 1, |
||
407 | 'child_textB', 0 |
||
408 | ) |
||
409 | |||
410 | for instance in Tourist:IterateZoneInstances(zoneText) do |
||
411 | local low, high = Tourist:GetLevel(instance) |
||
412 | local r, g, b = Tourist:GetLevelColor(instance) |
||
413 | cat:AddLine( |
||
414 | 'text', instance, |
||
415 | 'text2', string.format("%d-%d", low, high), |
||
416 | 'text2R', r, |
||
417 | 'text2G', g, |
||
418 | 'text2B', b |
||
419 | ) |
||
420 | end |
||
421 | end |
||
422 | if self:IsShowingRecommendedZones() then |
||
423 | cat = Tablet:AddCategory( |
||
424 | 'columns', 2, |
||
425 | 'text', L"Recommended zones" |
||
426 | ) |
||
427 | |||
428 | for zone in Tourist:IterateRecommendedZones() do |
||
429 | local low, high = Tourist:GetLevel(zone) |
||
430 | local r1, g1, b1 = Tourist:GetFactionColor(zone) |
||
431 | local r2, g2, b2 = Tourist:GetLevelColor(zone) |
||
432 | cat:AddLine( |
||
433 | 'text', zone, |
||
434 | 'textR', r1, |
||
435 | 'textG', g1, |
||
436 | 'textB', b1, |
||
437 | 'text2', string.format("%d-%d", low, high), |
||
438 | 'text2R', r2, |
||
439 | 'text2G', g2, |
||
440 | 'text2B', b2 |
||
441 | ) |
||
442 | end |
||
443 | |||
444 | if Tourist:HasRecommendedInstances() then |
||
445 | cat = Tablet:AddCategory( |
||
446 | 'columns', 2, |
||
447 | 'text', L"Recommended instances" |
||
448 | ) |
||
449 | |||
450 | for instance in Tourist:IterateRecommendedInstances() do |
||
451 | local low, high = Tourist:GetLevel(instance) |
||
452 | local r1, g1, b1 = Tourist:GetFactionColor(instance) |
||
453 | local r2, g2, b2 = Tourist:GetLevelColor(instance) |
||
454 | cat:AddLine( |
||
455 | 'text', instance, |
||
456 | 'textR', r1, |
||
457 | 'textG', g1, |
||
458 | 'textB', b1, |
||
459 | 'text2', string.format("%d-%d", low, high), |
||
460 | 'text2R', r2, |
||
461 | 'text2G', g2, |
||
462 | 'text2B', b2 |
||
463 | ) |
||
464 | end |
||
465 | end |
||
466 | end |
||
467 | |||
468 | if Atlas_Toggle then |
||
469 | if Tourist:IsInstance(zoneText) then |
||
470 | Tablet:SetHint(L"Atlas-hint" .. "\n" .. L"Shift-hint" .. "\n" .. L"Ctrl-hint") |
||
471 | else |
||
472 | Tablet:SetHint(L"Standard-hint" .. "\n" .. L"Shift-hint" .. "\n" .. L"Ctrl-Atlas-hint") |
||
473 | end |
||
474 | else |
||
475 | Tablet:SetHint(L"Standard-hint" .. "\n" .. L"Shift-hint") |
||
476 | end |
||
477 | end |
||
478 | |||
479 | local lastZone |
||
480 | |||
481 | function LocationFu.MapFrame_OnUpdate(t) |
||
482 | local self = LocationFu |
||
483 | if self:IsActive() then |
||
484 | if self:IsShowingMapCoords() then |
||
485 | local OFFSET_X = 0.0022 |
||
486 | local OFFSET_Y = -0.0262 |
||
487 | |||
488 | local x, y = GetCursorPosition() |
||
489 | x = x / WorldMapFrame:GetScale() |
||
490 | y = y / WorldMapFrame:GetScale() |
||
491 | |||
492 | local px, py = GetPlayerMapPosition("player") |
||
493 | local centerX, centerY = WorldMapFrame:GetCenter() |
||
494 | local width = WorldMapButton:GetWidth() |
||
495 | local height = WorldMapButton:GetHeight() |
||
496 | local adjustedX = (x - (centerX - (width/2))) / width |
||
497 | local adjustedY = (centerY + (height/2) - y ) / height |
||
498 | local cx = (adjustedX + OFFSET_X) |
||
499 | local cy = (adjustedY + OFFSET_Y) |
||
500 | |||
501 | local cursorCoordsText = string.format("%.0f, %.0f", 100 * cx, 100 * cy) |
||
502 | local playerCoordsText = string.format("%.0f, %.0f", 100 * px, 100 * py); |
||
503 | LocationFuMapFrameCursorCoords:SetText(format("%s: %.0f, %.0f", L"Cursor:", 100 * cx, 100 * cy)) |
||
504 | LocationFuMapFramePlayerCoords:SetText(format("%s: %.0f, %.0f", L"Player:", 100 * px, 100 * py)) |
||
505 | end |
||
506 | |||
507 | if self:IsShowingMapOverlay() then |
||
508 | local underAttack = false |
||
509 | local zone = WorldMapFrameAreaLabel:GetText() |
||
510 | if zone then |
||
511 | zone = string.gsub(WorldMapFrameAreaLabel:GetText(), " |cff.+$", "") |
||
512 | if WorldMapFrameAreaDescription:GetText() then |
||
513 | underAttack = true |
||
514 | zone = string.gsub(WorldMapFrameAreaDescription:GetText(), " |cff.+$", "") |
||
515 | end |
||
516 | end |
||
517 | if GetCurrentMapContinent() == 0 then |
||
518 | local c1, c2 = GetMapContinents() |
||
519 | if zone == c1 or zone == c2 then |
||
520 | WorldMapFrameAreaLabel:SetTextColor(1, 1, 1) |
||
521 | LocationFuMapFrameText:SetText("") |
||
522 | return |
||
523 | end |
||
524 | end |
||
525 | if not zone or not Tourist:IsZoneOrInstance(zone) then |
||
526 | zone = WorldMapFrame.areaName |
||
527 | end |
||
528 | WorldMapFrameAreaLabel:SetTextColor(1, 1, 1) |
||
529 | if zone ~= nil and Tourist:IsZoneOrInstance(zone) then |
||
530 | if not underAttack then |
||
531 | WorldMapFrameAreaLabel:SetTextColor(Tourist:GetFactionColor(zone)) |
||
532 | WorldMapFrameAreaDescription:SetTextColor(1, 1, 1) |
||
533 | else |
||
534 | WorldMapFrameAreaLabel:SetTextColor(1, 1, 1) |
||
535 | WorldMapFrameAreaDescription:SetTextColor(Tourist:GetFactionColor(zone)) |
||
536 | end |
||
537 | local low, high = Tourist:GetLevel(zone) |
||
538 | if low ~= nil and high ~= nil and low ~= -6 and high ~= -6 then |
||
539 | local r, g, b = Tourist:GetLevelColor(zone) |
||
540 | if not underAttack then |
||
541 | local text = string.gsub(WorldMapFrameAreaLabel:GetText(), " |cff.+$", "") |
||
542 | text = text .. string.format(" |cff%02x%02x%02x(%d-%d)|r", r * 255, g * 255, b * 255, low, high) |
||
543 | WorldMapFrameAreaLabel:SetText(text) |
||
544 | else |
||
545 | local text = string.gsub(WorldMapFrameAreaDescription:GetText(), " |cff.+$", "") |
||
546 | text = text .. string.format(" |cff%02x%02x%02x(%d-%d)|r", r * 255, g * 255, b * 255, low, high) |
||
547 | WorldMapFrameAreaDescription:SetText(text) |
||
548 | end |
||
549 | end |
||
550 | |||
551 | if Tourist:DoesZoneHaveInstances(zone) then |
||
552 | if lastZone ~= zone then |
||
553 | lastZone = zone |
||
554 | local mapText = string.format("|cffffff00%s:|r", L"Instances") |
||
555 | for instance in Tourist:IterateZoneInstances(zone) do |
||
556 | local low, high = Tourist:GetLevel(instance) |
||
557 | local r1, g1, b1 = Tourist:GetFactionColor(instance) |
||
558 | local r2, g2, b2 = Tourist:GetLevelColor(instance) |
||
559 | mapText = mapText .. "\n" .. string.format("|cff%02x%02x%02x%s|r |cff%02x%02x%02x(%d-%d)|r", r1 * 255, g1 * 255, b1 * 255, instance, r2 * 255, g2 * 255, b2 * 255, low, high) |
||
560 | end |
||
561 | LocationFuMapFrameText:SetText(mapText) |
||
562 | end |
||
563 | else |
||
564 | lastZone = nil |
||
565 | LocationFuMapFrameText:SetText("") |
||
566 | end |
||
567 | elseif zone == nil then |
||
568 | lastZone = nil |
||
569 | LocationFuMapFrameText:SetText("") |
||
570 | end |
||
571 | end |
||
572 | end |
||
573 | end |
||
574 | |||
575 | function LocationFu:OnClick() |
||
576 | if IsShiftKeyDown() then |
||
577 | if ChatFrameEditBox:IsVisible() then |
||
578 | local x, y = GetPlayerMapPosition("player") |
||
579 | local message |
||
580 | local coords = string.format("%.0f, %.0f", x * 100, y * 100) |
||
581 | if not self:IsShowingZoneName() and not self:IsShowingSubZoneName() then |
||
582 | message = coords |
||
583 | elseif self:IsShowingZoneName() and self:IsShowingSubZoneName() then |
||
584 | if zoneText ~= subZoneText then |
||
585 | message = string.format("%s: %s (%s)", zoneText, subZoneText, coords) |
||
586 | else |
||
587 | message = string.format("%s (%s)", zoneText, coords) |
||
588 | end |
||
589 | elseif self:IsShowingZoneName() then |
||
590 | message = string.format("%s (%s)", zoneText, coords) |
||
591 | elseif self:IsShowingSubZoneName() then |
||
592 | message = string.format("%s (%s)", subZoneText, coords) |
||
593 | end |
||
594 | ChatFrameEditBox:Insert(message) |
||
595 | end |
||
596 | elseif Atlas_Toggle then |
||
597 | if IsControlKeyDown() then |
||
598 | if not Tourist:IsInstance(zoneText) then |
||
599 | Atlas_Toggle() |
||
600 | else |
||
601 | ToggleWorldMap() |
||
602 | end |
||
603 | else |
||
604 | if Tourist:IsInstance(zoneText) then |
||
605 | Atlas_Toggle() |
||
606 | else |
||
607 | ToggleWorldMap() |
||
608 | end |
||
609 | end |
||
610 | else |
||
611 | ToggleWorldMap() |
||
612 | end |
||
613 | end |