diff --git a/pMinimap/pMinimap.lua b/pMinimap/pMinimap.lua
index 87a7b01..792b1a0 100644
--- a/pMinimap/pMinimap.lua
+++ b/pMinimap/pMinimap.lua
@@ -1,11 +1,15 @@
pMinimap = CreateFrame('Frame', 'pMinimap', UIParent)
-pMinimap:SetScript('OnEvent', function(self, event, ...) if(self[event]) then return self[event](self, event, ...) end end)
+pMinimap:SetScript('OnEvent', function(self, event, ...) self[event](self, event, ...) end)
pMinimap:RegisterEvent('ADDON_LOADED')
+pMinimap.Loader = CreateFrame('Frame', nil, InterfaceOptionsFrame)
+pMinimap.Loader:SetScript('OnShow', function(self) if(not IsAddOnLoaded('pMinimap_Config')) then LoadAddOn('pMinimap_Config') end self:SetScript('OnShow', nil) end)
+
+local total = 0
local defaults = {
coords = false,
clock = true,
- durabi = true,
+ dura = true,
mail = true,
subzone = false,
unlocked = false,
@@ -19,30 +23,122 @@ local defaults = {
colors = {0, 0, 0, 1},
}
-InterfaceOptionsDisplayPanelShowClock_SetFunc('1')
-InterfaceOptionsDisplayPanelShowClock_SetFunc = function() end
-for _, check in pairs{InterfaceOptionsDisplayPanelShowClock} do
- local f = check:CreateFontString(nil, 'OVERLAY', 'GameFontNormal')
- f:SetPoint('TOPLEFT', check, 0, 10)
- f:SetText('|cff00ff33OVERRID BY PMINIMAP!|r')
+function pMinimap:DisableBlizzard()
+ for k,v in pairs({InterfaceOptionsDisplayPanelShowClock}) do
+ local warning = v:CreateFontString(nil, 'OVERLAY', 'GameFontNormal')
+ warning:SetPoint('TOPLEFT', v, 0, 10)
+ warning:SetText('|cff00ff33OVERRID BY PMINIMAP!|r')
- check:Disable()
- check.Enable = function() end
-end
+ v:Disable()
+ v.Enable = v.Disable
+ end
-function pMinimap:ADDON_LOADED(event, addon)
- if(addon ~= 'pMinimap') then return end
+ InterfaceOptionsDisplayPanelShowClock_SetFunc('1')
+ InterfaceOptionsDisplayPanelShowClock_SetFunc = function() end
+end
+function pMinimap:LoadDefaults()
pMinimapDB = pMinimapDB or {}
for k,v in pairs(defaults) do
if(type(pMinimapDB[k]) == 'nil') then
pMinimapDB[k] = v
end
end
+end
+
+
+function pMinimap:CreateClock()
+ if(not IsAddOnLoaded('Blizzard_TimeManager')) then LoadAddOn('Blizzard_TimeManager') end
+
+ TimeManagerClockButton:SetWidth(40)
+ TimeManagerClockButton:SetHeight(14)
+ TimeManagerClockButton:ClearAllPoints()
+ TimeManagerClockButton:SetPoint(pMinimapDB.coords and 'BOTTOMLEFT' or 'BOTTOM', Minimap)
+ TimeManagerClockButton:GetRegions():Hide()
+ TimeManagerClockButton:Show()
+ TimeManagerClockButton:SetScript('OnClick', function(self, button)
+ if(self.alarmFiring) then
+ PlaySound('igMainMenuQuit')
+ TimeManager_TurnOffAlarm()
+ else
+ if(button == 'RightButton') then
+ if(not IsAddOnLoaded('Blizzard_Calendar')) then LoadAddOn('Blizzard_Calendar') end
+ ToggleCalendar()
+ else
+ ToggleTimeManager()
+ end
+ end
+ end)
+
+ TimeManagerClockTicker:SetPoint('CENTER', TimeManagerClockButton)
+ TimeManagerClockTicker:SetFont(pMinimapDB.font, pMinimapDB.fontsize, pMinimapDB.fontflag)
+
+ TimeManagerAlarmFiredTexture.Show = function() TimeManagerClockTicker:SetTextColor(1, 0, 0) end
+ TimeManagerAlarmFiredTexture.Hide = function() TimeManagerClockTicker:SetTextColor(1, 1, 1) end
+
+ GameTimeCalendarInvitesTexture.Show = function() TimeManagerClockTicker:SetTextColor(0, 1, 0) end
+ GameTimeCalendarInvitesTexture.Show = function() TimeManagerClockTicker:SetTextColor(1, 1, 1) end
+end
+
+function pMinimap:CreateCoords()
+ self.Coord = CreateFrame('Button', nil, Minimap)
+ self.Coord:SetPoint(pMinimapDB.clock and 'BOTTOMRIGHT' or 'BOTTOM', Minimap)
+ self.Coord:SetWidth(40)
+ self.Coord:SetHeight(14)
+ self.Coord:RegisterForClicks('AnyUp')
+
+ self.Coord.Text = self.Coord:CreateFontString(nil, 'OVERLAY')
+ self.Coord.Text:SetPoint('CENTER', self.Coord)
+ self.Coord.Text:SetFont(pMinimapDB.font, pMinimapDB.fontsize, pMinimapDB.fontflag)
+ self.Coord.Text:SetTextColor(1, 1, 1)
+
+ self.Coord:SetScript('OnClick', function() ToggleFrame(WorldMapFrame) end)
+ self.Coord:SetScript('OnUpdate', function(self, elapsed)
+ total = total + elapsed
+
+ if(total > 0.25) then
+ if(IsInInstance()) then
+ self.Text:SetText()
+ else
+ local x, y = GetPlayerMapPosition('player')
+ self.Text:SetFormattedText('%.0f,%.0f', x * 100, y * 100)
+ end
+ total = 0
+ end
+ end)
+end
+
+
+function pMinimap:ZONE_CHANGED_NEW_AREA()
+ SetMapToCurrentZone()
+end
+
+function pMinimap:UPDATE_INVENTORY_ALERTS()
+ local maxStatus = 0
+ for id in pairs(INVENTORY_ALERT_STATUS_SLOTS) do
+ local status = GetInventoryAlertStatus(id)
+ if(status > maxStatus) then
+ maxStatus = status
+ end
+ end
+
+ local color = INVENTORY_ALERT_COLORS[maxStatus]
+ if(color) then
+ Minimap:SetBackdropColor(color.r, color.g, color.b)
+ else
+ Minimap:SetBackdropColor(unpack(pMinimapDB.colors))
+ end
+end
+
+function pMinimap:ADDON_LOADED(event, addon)
+ if(addon ~= 'pMinimap') then return end
+
+ self:UnregisterEvent(event)
+ self:DisableBlizzard()
+ self:LoadDefaults()
pMinimapDB.unlocked = false
- self:UnregisterEvent(event)
MinimapZoomIn:Hide()
MinimapZoomOut:Hide()
@@ -77,11 +173,11 @@ function pMinimap:ADDON_LOADED(event, addon)
MiniMapMailFrame:SetPoint('TOP')
MiniMapMailFrame:SetHeight(8)
- MiniMapMailText = MiniMapMailFrame:CreateFontString(nil, 'OVERLAY')
- MiniMapMailText:SetFont(pMinimapDB.font, pMinimapDB.fontsize, pMinimapDB.fontflag)
- MiniMapMailText:SetPoint('BOTTOM', 0, 2)
- MiniMapMailText:SetText('New Mail!')
- MiniMapMailText:SetTextColor(1, 1, 1)
+ self.Mail = MiniMapMailFrame:CreateFontString(nil, 'OVERLAY')
+ self.Mail:SetFont(pMinimapDB.font, pMinimapDB.fontsize, pMinimapDB.fontflag)
+ self.Mail:SetPoint('BOTTOM', 0, 2)
+ self.Mail:SetText('New Mail!')
+ self.Mail:SetTextColor(1, 1, 1)
MinimapBorder:SetTexture('')
MinimapBorderTop:Hide()
@@ -92,7 +188,7 @@ function pMinimap:ADDON_LOADED(event, addon)
MiniMapWorldMapButton:Hide()
MiniMapMeetingStoneFrame:SetAlpha(0)
MiniMapVoiceChatFrame:Hide()
- MiniMapVoiceChatFrame.Show = function() end
+ MiniMapVoiceChatFrame.Show = MiniMapVoiceChatFrame.Hide
MinimapNorthTag:SetAlpha(0)
Minimap:SetScale(pMinimapDB.scale)
@@ -113,26 +209,43 @@ function pMinimap:ADDON_LOADED(event, addon)
end
end)
- if(pMinimapDB.dura and not IsAddOnLoaded('pMinimap_Durability')) then LoadAddOn('pMinimap_Durability') end
- if(pMinimapDB.coords and not IsAddOnLoaded('pMinimap_Coords')) then LoadAddOn('pMinimap_Coords') end
- if(pMinimapDB.clock and not IsAddOnLoaded('pMinimap_Clock')) then LoadAddOn('pMinimap_Clock') end
- if(not pMinimapDB.clock) then TimeManagerClockButton:Hide() end
+ if(pMinimapDB.dura) then
+ DurabilityFrame:SetAlpha(0)
+
+ self:RegisterEvent('UPDATE_INVENTORY_ALERTS')
+ self.UPDATE_INVENTORY_ALERTS()
+ end
+
+ if(pMinimapDB.coords) then
+ self:RegisterEvent('ZONE_CHANGED_NEW_AREA')
+ self:CreateCoords()
+ self.RunCoords = true
+ end
+
+ if(pMinimapDB.clock) then
+ self:CreateClock()
+ self.RunClock = true
+ else
+ TimeManagerClockButton:Hide()
+ end
+
if(not pMinimapDB.mail) then
MiniMapMailFrame:UnregisterEvent('UPDATE_PENDING_MAIL')
MiniMapMailFrame:Hide()
end
end
-CreateFrame('Frame', nil, InterfaceOptionsFrame):SetScript('OnShow', function(self)
-if(not IsAddOnLoaded('pMinimap_Config')) then LoadAddOn('pMinimap_Config') end self:SetScript('OnShow', nil) end)
+SLASH_PMMC1 = '/pmm'
+SLASH_PMMC2 = '/pminimap'
SlashCmdList.PMMC = function(str)
if(str == 'reset') then
pMinimapDB = {}
- print('|cffff6000p|rMinimap: |cff0090ffSavedvariables is now reset.|r')
+ pMinimap:LoadDefaults()
+ print('|cffff8080pMinimap:|r Savedvariables is now reset.')
elseif(str == 'refresh') then
Minimap:SetMaskTexture([=[Interface\ChatFrame\ChatFrameBackground]=])
- print('|cffff6000p|rMinimap: |cff0090ffMinimap mask is now refreshed.|r')
+ print('|cffff8080pMinimap:|r Minimap mask is now refreshed.')
else
if(not IsAddOnLoaded('pMinimap_Config')) then
LoadAddOn('pMinimap_Config')
@@ -140,8 +253,7 @@ SlashCmdList.PMMC = function(str)
InterfaceOptionsFrame_OpenToCategory('pMinimap')
end
end
-SLASH_PMMC1 = '/pminimap'
-SLASH_PMMC2 = '/pmm'
+
-- http://www.wowwiki.com/GetMinimapShape
function GetMinimapShape() return 'SQUARE' end
\ No newline at end of file