public
Description: WoW Addon - Square Minimap and more
Homepage: http://www.tekkub.net/
Clone URL: git://github.com/tekkub/squeenix.git
Click here to lend your support to: squeenix and make a donation at www.pledgie.com !
squeenix / Squeenix.lua
100644 133 lines (100 sloc) 4.089 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
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
Squeenix = {}
local Squeenix, f = Squeenix, 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()
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)
 
MiniMapBattlefieldFrame:ClearAllPoints()
MiniMapBattlefieldFrame:SetPoint("TOPLEFT", Minimap, "BOTTOMLEFT", 13, 0)
 
MiniMapWorldMapButton:ClearAllPoints()
MiniMapWorldMapButton:SetPoint("TOPRIGHT", Minimap, "TOPLEFT", 5, -22)
 
MiniMapMeetingStoneFrame:ClearAllPoints()
MiniMapMeetingStoneFrame:SetPoint("TOPRIGHT", Minimap, "TOPLEFT", 5, -53)
 
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)
 
MinimapToggleButton:ClearAllPoints()
MinimapToggleButton:SetPoint("LEFT", MinimapZoneText, "RIGHT", -2, 0)
 
self:SetBorder()
self:HideButtons()
self:ShowCompass()
self:SetPosition()
self:SetScale()
 
LibStub("tekKonfig-AboutPanel").new("Squeenix", "Squeenix")
 
f:UnregisterEvent("ADDON_LOADED")
self.ADDON_LOADED = nil
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))
 
TimeManagerClockButton_UpdateTooltip()
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)