WoWInterface SVN fernir_UI

[/] [minimap.lua] - Rev 2

Compare with Previous | Blame | View Log

local settings = oUF_Settings

Minimap:SetScale(settings.MinimapScale)
--[[ Background ]]
local bg = Minimap:CreateTexture(nil, "BACKGROUND")
bg:SetPoint("TOPLEFT", Minimap, "TOPLEFT", -2, 2)
bg:SetPoint("BOTTOMRIGHT", Minimap, "BOTTOMRIGHT", 2, -2)
bg:SetTexture(1,1,1)

local ef = CreateFrame("frame")
ef:RegisterEvent("ADDON_LOADED")
ef:SetScript("OnEvent", function(self, event, addon)
    if event == "ADDON_LOADED" then
        if(addon=="Blizzard_TimeManager") then 
            bg:SetVertexColor(unpack(settings.ccolor))
            for i = 1, select('#', TimeManagerClockButton:GetRegions()) do
                local texture = select(i, TimeManagerClockButton:GetRegions())
                if (texture and texture:GetObjectType() == 'Texture') then
                    texture:SetTexture(nil)
                end
            end
        end
        TimeManagerClockButton:SetPoint("BOTTOM", Minimap, "BOTTOM", 0, -6)
    end
end)

if (not IsAddOnLoaded('Blizzard_TimeManager')) then
    LoadAddOn('Blizzard_TimeManager')
end

for i = 1, select('#', GameTimeFrame:GetRegions()) do
    local texture = select(i, GameTimeFrame:GetRegions())
    if (texture and texture:GetObjectType() == 'Texture') then
        texture:SetTexture(nil)
    end
end

GameTimeFrame:SetWidth(14)
GameTimeFrame:SetHeight(14)
GameTimeFrame:SetHitRectInsets(0, 0, 0, 0)
GameTimeFrame:ClearAllPoints()
GameTimeFrame:SetPoint('TOPRIGHT', Minimap, -3.5, -3.5)

GameTimeFrame:GetFontString():SetFont('Fonts\\ARIALN.ttf', 16, 'OUTLINE')
GameTimeFrame:GetFontString():SetShadowOffset(0, 0)
GameTimeFrame:GetFontString():SetPoint('TOPRIGHT', GameTimeFrame)

    
for _, texture in pairs({
    GameTimeCalendarEventAlarmTexture,
    GameTimeCalendarInvitesTexture,
    GameTimeCalendarInvitesGlow,
}) do
    texture.Show = function()
        GameTimeFrame:GetFontString():SetTextColor(1, 0, 1)
    end
    
    texture.Hide = function() 
        local classColor = RAID_CLASS_COLORS[select(2, UnitClass('player'))]
        GameTimeFrame:GetFontString():SetTextColor(classColor.r, classColor.g, classColor.b)
    end
end

MiniMapInstanceDifficulty:SetPoint("TOPLEFT", Minimap, "TOPLEFT", -10, 10)
MiniMapInstanceDifficulty:SetScale(.7)

MinimapZoomIn:Hide()
MinimapZoomOut:Hide()

MinimapBorder:Hide()
MinimapBorderTop:Hide()

MinimapZoneText:Hide()
MinimapZoneTextButton:Hide()

MiniMapWorldMapButton:Hide()

MiniMapLFGFrame:ClearAllPoints()
MiniMapLFGFrame:SetPoint('BOTTOMLEFT', Minimap, -2, -2)
MiniMapLFGFrame:SetScale(0.93)

MiniMapTracking:Hide()
MiniMapBattlefieldBorder:Hide()
MiniMapMailBorder:Hide()
BattlegroundShine:Hide()
DurabilityFrame:Hide()

MinimapNorthTag:SetAlpha(0)

MinimapCluster:SetScale(1.1)
MinimapCluster:EnableMouse(false)

Minimap:EnableMouseWheel(true)
Minimap:ClearAllPoints()
Minimap:SetPoint('TOPRIGHT', UIParent, -26, -26)
Minimap:SetMaskTexture('Interface\\ChatFrame\\ChatFrameBackground')

MiniMapMailText = MiniMapMailFrame:CreateFontString('MiniMapMailText', 'OVERLAY')
MiniMapMailText:SetParent(MiniMapMailFrame)
MiniMapMailText:SetFont('Fonts\\ARIALN.ttf', 16, 'OUTLINE')
MiniMapMailText:SetPoint('BOTTOMRIGHT', MiniMapMailFrame)
MiniMapMailText:SetTextColor(1, 0, 1)
MiniMapMailText:SetText('new')

MiniMapMailFrame:SetWidth((MiniMapMailText:GetStringWidth()))
MiniMapMailFrame:SetHeight(18)
MiniMapMailFrame:ClearAllPoints()
MiniMapMailFrame:SetPoint('BOTTOMRIGHT', Minimap, -4, 5)

MiniMapMailIcon:SetTexture(nil)

MiniMapBattlefieldFrame:ClearAllPoints()
MiniMapBattlefieldFrame:SetPoint('TOPLEFT', Minimap, -2, 1)

MinimapTrackingText = Minimap:CreateFontString('$parentTrackingText', 'OVERLAY')
MinimapTrackingText:SetFont('Fonts\\ARIALN.ttf', 15)
MinimapTrackingText:SetShadowOffset(1, -1)
MinimapTrackingText:SetPoint('CENTER', Minimap, 0, 35)
MinimapTrackingText:SetWidth((Minimap:GetWidth() - 25))
MinimapTrackingText:SetAlpha(0)

MiniMapLFGFrameBorder:SetAlpha(0)

Minimap:SetScript('OnMouseWheel', function()
    if (arg1 > 0) then
        Minimap_ZoomIn()
    else
        Minimap_ZoomOut()
    end
end)

hooksecurefunc(TicketStatusFrameButton, 'Show', function(self)
        TicketStatusFrameButton:SetBackdrop({
        bgFile = 'Interface\\Buttons\\WHITE8x8', 
        insets = {
            left = 3, 
            right = 3, 
            top = 3, 
            bottom = 3
        }
    })
    
    TicketStatusFrameButton:SetBackdropColor(0, 0, 0, 0.5)
end)

local function Minimap_CreateDropDown()
    local button = {
        { text = CHARACTER_BUTTON, func = function() ToggleCharacter('PaperDollFrame') end },
        { text = SPELLBOOK_ABILITIES_BUTTON, func = function() ToggleFrame(SpellBookFrame) end },
        { text = TALENTS_BUTTON, func = function() ToggleTalentFrame() end },
        { text = ACHIEVEMENT_BUTTON, func = function() ToggleAchievementFrame() end },
        { text = "Calendar", func = function() ToggleCalendar() end },
        { text = QUESTLOG_BUTTON, func = function() ToggleFrame(QuestLogFrame) end },
        { text = SOCIAL_BUTTON, func = function() ToggleFriendsFrame() end },
        { text = PLAYER_V_PLAYER, func = function() ToggleFrame(PVPParentFrame) end },
        { text = LFG_TITLE, func = function() ToggleLFDParentFrame() end },
        { text = HELP_BUTTON, func = function() ToggleHelpFrame() end },
    }
    
    for i=1, 10 do
                        UIDropDownMenu_AddButton(button[i])
    end
end 

Minimap:SetScript("OnMouseUp", function(self, button)
    if(button == 'RightButton') then
        ToggleDropDownMenu(1, nil, TimeManagerClockDropDown, self, -0, -0)
        GameTooltip:SetOwner(self, 'ANCHOR_BOTTOMLEFT')
    else
        ToggleDropDownMenu(1, nil, MiniMapTrackingDropDown, self, - (Minimap:GetWidth() * 0.7), -3)
    end
end)
    
TimeManagerClockDropDown = CreateFrame('Frame', 'TimeManagerClockDropDown', nil, 'UIDropDownMenuTemplate')
UIDropDownMenu_Initialize(TimeManagerClockDropDown, Minimap_CreateDropDown, 'MENU')

Compare with Previous | Blame