-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathSqueenix.lua
163 lines (125 loc) · 5.11 KB
/
Squeenix.lua
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
local myname, Squeenix = ...
local f = CreateFrame("Frame")
f:SetScript("OnEvent", function(self, event, ...) if Squeenix[event] then return Squeenix[event](Squeenix, event, ...) end end)
f:RegisterEvent("ADDON_LOADED")
function Squeenix:ADDON_LOADED(event, addon)
if addon ~= myname then return end
SqueenixDB2 = SqueenixDB2 or {}
self.db = SqueenixDB2
MinimapBorder:SetTexture()
MinimapBorderTop:Hide()
Minimap:SetMaskTexture("Interface\\AddOns\\Squeenix\\Mask.blp")
MinimapZoneTextButton:ClearAllPoints()
MinimapZoneTextButton:SetPoint("BOTTOM", Minimap, "TOP", -8, 5)
MinimapZoneTextButton:SetScript("OnClick", ToggleMinimap)
MinimapZoneText:SetPoint("TOP", MinimapZoneTextButton, "TOP", 9, 1)
MiniMapTracking:ClearAllPoints()
MiniMapTracking:SetPoint("BOTTOMRIGHT", Minimap, "TOPLEFT", 5, -18)
QueueStatusMinimapButton:ClearAllPoints()
QueueStatusMinimapButton:SetPoint("TOPRIGHT", Minimap, "BOTTOMLEFT", 5, 18)
MiniMapWorldMapButton:ClearAllPoints()
MiniMapWorldMapButton:SetPoint("BOTTOMLEFT", Minimap, "BOTTOMLEFT", -11, -8)
MiniMapWorldMapButton:SetNormalTexture("Interface\\Addons\\Squeenix\\WorldMapSquare.tga")
MiniMapWorldMapButton:SetPushedTexture("Interface\\Addons\\Squeenix\\WorldMapSquare.tga")
MiniMapVoiceChatFrame:ClearAllPoints()
MiniMapVoiceChatFrame:SetPoint("BOTTOMRIGHT", Minimap, "BOTTOMLEFT", 5, 20)
MinimapZoomIn:ClearAllPoints()
MinimapZoomIn:SetPoint("LEFT", Minimap, "BOTTOMRIGHT", -10, 5)
MinimapZoomOut:ClearAllPoints()
MinimapZoomOut:SetPoint("TOP", Minimap, "BOTTOMRIGHT", -15, 0)
GameTimeFrame:ClearAllPoints()
GameTimeFrame:SetPoint("CENTER", Minimap, "TOPRIGHT", 5, -20)
GuildInstanceDifficulty:ClearAllPoints()
GuildInstanceDifficulty:SetPoint("TOPLEFT", Minimap, "TOPLEFT", -7, 8)
MiniMapInstanceDifficulty:ClearAllPoints()
MiniMapInstanceDifficulty:SetPoint("TOPLEFT", Minimap, "TOPLEFT", -7, 7)
GarrisonLandingPageMinimapButton:ClearAllPoints()
GarrisonLandingPageMinimapButton:SetPoint("BOTTOMRIGHT", Minimap, "BOTTOMLEFT", 10, 15)
GarrisonLandingPageMinimapButton:SetScale(0.60)
self:SetBorder()
self:HideButtons()
self:ShowCompass()
self:SetPosition()
self:SetScale()
self.ADDON_LOADED = self.ADDON_LOADED_2
if IsAddOnLoaded("Blizzard_TimeManager") then self:ADDON_LOADED(event, "Blizzard_TimeManager") end
end
function Squeenix:ADDON_LOADED_2(event, addon)
if addon ~= "Blizzard_TimeManager" then return end
TimeManagerClockButton:ClearAllPoints()
TimeManagerClockButton:SetPoint("CENTER", Minimap, "CENTER", 0, -85)
self:HideButtons()
f:UnregisterEvent("ADDON_LOADED")
self.ADDON_LOADED = nil
end
local rl = ReloadUI
function ReloadUI()
Minimap:SetMaskTexture("Textures\\MinimapMask")
rl()
end
-- Global function, tells others the minimap shape
-- http://wowwiki.com/GetMinimapShape
function GetMinimapShape() return "SQUARE" end
-------------------------
-- LDB feeds --
-------------------------
local function GetTipAnchor(frame)
local x,y = frame:GetCenter()
if not x or not y then return "TOPLEFT", "BOTTOMLEFT" end
local hhalf = (x > UIParent:GetWidth()*2/3) and "RIGHT" or (x < UIParent:GetWidth()/3) and "LEFT" or ""
local vhalf = (y > UIParent:GetHeight()/2) and "TOP" or "BOTTOM"
return vhalf..hhalf, frame, (vhalf == "TOP" and "BOTTOM" or "TOP")..hhalf
end
local ICON1 = "Interface\\Icons\\INV_Misc_PocketWatch_01"
local ICON2 = "Interface\\Icons\\INV_Misc_QuestionMark"
local timeobj = LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject("BlizzClock", {
type = "data source",
icon = ICON1,
text = "12:00",
OnClick = function()
if IsShiftKeyDown() then
GameTimeFrame_OnClick(GameTimeFrame)
else
if not IsAddOnLoaded("Blizzard_TimeManager") then LoadAddOn("Blizzard_TimeManager") end
if TimeManagerClockButton.alarmFiring then
PlaySound("igMainMenuQuit")
TimeManager_TurnOffAlarm()
else TimeManager_Toggle() end
end
end,
OnEnter = function(self)
if not IsAddOnLoaded("Blizzard_TimeManager") then LoadAddOn("Blizzard_TimeManager") end
GameTooltip:SetOwner(self, "ANCHOR_NONE")
GameTooltip:SetPoint(GetTipAnchor(self))
if TimeManagerClockButton.alarmFiring then
TimeManagerClockButton_UpdateTooltip()
else
GameTime_UpdateTooltip()
GameTooltip:AddDoubleLine("Daily quests reset in:", string.format("%.1fhr", GetQuestResetTime()/60/60), nil, nil, nil, 1,1,1)
GameTooltip:AddLine(" ")
GameTooltip:AddLine(GAMETIME_TOOLTIP_TOGGLE_CLOCK)
end
GameTooltip:AddLine("Shift-click to open calendar.")
local pending = CalendarGetNumPendingInvites()
if pending > 0 then
GameTooltip:AddLine(" ")
GameTooltip:AddLine("You have "..pending.." pending event invite"..(pending > 1 and "s" or ""), 1, 1, 1)
end
GameTooltip:Show()
end,
OnLeave = function() GameTooltip:Hide() end,
})
local elapsed = 0
f:SetScript("OnUpdate", function(self, elap)
elapsed = elapsed + elap
if elapsed < 0.5 then return end
elapsed = 0
local pending = CalendarGetNumPendingInvites()
if pending > 0 then
timeobj.icon = math.floor(GetTime())%4 < 2 and ICON1 or ICON2
timeobj.text = GameTime_GetTime(false)..(pending == 0 and "" or " ("..pending..")")
else
timeobj.icon = ICON1
timeobj.text = GameTime_GetTime(false)
end
end)