-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevl_Minimap.lua
More file actions
90 lines (71 loc) · 2.43 KB
/
evl_Minimap.lua
File metadata and controls
90 lines (71 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
local frame = CreateFrame("Frame", nil, Minimap)
local colorizePVPType = function(pvpType)
if pvpType == "sanctuary" then
return {r = 0.41, g = 0.8, b = 0.94}
elseif pvpType == "friendly" then
return {r = 0.1, g = 1.0, b = 0.1}
elseif pvpType == "arena" or pvpType == "hostile" then
return {r = 1.0, g = 0.1, b = 0.1}
elseif pvpType == "contested" then
return {r = 1.0, g = 0.7, b = 0.0}
else
return NORMAL_FONT_COLOR
end
end
local colorizeLatency = function(number)
if number <= 100 then
return {r = 0, g = 1, b = 0}
elseif number <= 200 then
return {r = 1, g = 1, b = 0}
else
return {r = 1, g = 0, b = 0}
end
end
local onEnter = function(self)
GameTooltip:SetOwner(TimeManagerClockButton, "ANCHOR_BOTTOMRIGHT")
local zoneName = GetZoneText()
local subzoneName = GetSubZoneText()
local zoneColor = colorizePVPType(GetZonePVPInfo())
if subzoneName == zoneName then
subzoneName = ""
end
GameTooltip:AddLine(zoneName, zoneColor.r, zoneColor.g, zoneColor.b)
GameTooltip:AddLine(subzoneName, 1, 1, 1)
SetMapToCurrentZone()
local x, y = GetPlayerMapPosition("player")
if x + y > 0 then
GameTooltip:AddLine(format("%.1f, %.1f", x * 100, y * 100), 0.7, 0.7, 0.7)
end
GameTooltip:AddLine("\n")
local latency = select(3, GetNetStats())
local latencyColor = colorizeLatency(latency)
GameTooltip:AddLine(string.format("Latency: %d ms", latency), latencyColor.r, latencyColor.g, latencyColor.b)
GameTooltip:AddLine(string.format("Framerate: %.1f", GetFramerate()), 1, 1, 1)
GameTooltip:Show()
end
local onMouseWheel = function(self, direction)
if not direction then return end
if direction > 0 and Minimap:GetZoom() < 5 then
Minimap:SetZoom(Minimap:GetZoom() + 1)
elseif direction < 0 and Minimap:GetZoom() > 0 then
Minimap:SetZoom(Minimap:GetZoom() - 1)
end
end
local onEvent = function(self, event)
frame:EnableMouse(false)
frame:SetPoint("TOPLEFT", Minimap, "TOPLEFT")
frame:SetPoint("BOTTOMRIGHT", Minimap, "BOTTOMRIGHT")
frame:EnableMouseWheel(true)
frame:SetScript("OnMouseWheel", onMouseWheel)
MinimapZoomIn:Hide()
MinimapZoomOut:Hide()
MiniMapWorldMapButton:Hide()
MinimapZoneTextButton:Hide()
MinimapBorderTop:Hide()
MinimapNorthTag:Hide()
-- Time
TimeManagerClockButton:SetScript("OnEnter", onEnter)
TimeManagerClockButton:SetScript("OnLeave", function() GameTooltip:Hide() end)
end
frame:SetScript("OnEvent", onEvent)
frame:RegisterEvent("PLAYER_ENTERING_WORLD")