View Single Post
03-08-12, 08:54 AM   #2
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Originally Posted by Qupe View Post
I'm using a version of Wanderlust that I've modified (haphazard and inexperienced-ly modified).

I've moved the addon to the top left corner and the mouse over tooltips for dungeons/raid finder/pvp queue are aligned like the addon is still in the top right corner (ie moving off-screen to the left).

I really don't have a lot of lua know-how and basically am able to blindy stumble over code to change what I want.

I need to anchor the mouse over tooltips to act like the addon is in the top left corner and I don't know how to make that happen.

Code as follows (not sure how to make it "lua code" as opposed to the basic "code" bubble):

Code:
--[[Local horror]]
local Scale = 0.9
local r, g, b, a = 0, 0, 0, 1
local BGThickness = 1
local OffsetX, OffsetY = 16, -16
local Point, AnchorPoint = "TOPLEFT", "TOPLEFT"
local trackingsize = 14
local trackingfontflag = "THINOUTLINE"
local trackingowncolor = {0.41, 0.8, 0.94}

--[[ Loading ]]
Wanderlust = CreateFrame("Frame", "Wanderlust", UIParent)
Wanderlust:RegisterEvent("ADDON_LOADED")
Wanderlust:SetScript("OnEvent", function(self, event, addon)
    if(addon~="Wanderlust") then return end

    
    --[[ Carbonite hint ]]
    local total = 0
    local SetTextureTrick = function(self, elapsed)
        total = total + elapsed
        if(total > 2) then
            Minimap:SetMaskTexture("Interface\\Buttons\\WHITE8X8")
            Wanderlust:SetScript("OnUpdate", nil)
        end
    end
    Wanderlust:SetScript("OnUpdate", SetTextureTrick)
    
    --[[ Location and scale ]]
    Minimap:ClearAllPoints()
	Minimap:SetScale(Scale)
    Minimap:SetPoint(Point, UIParent, AnchorPoint, OffsetX / Scale, OffsetY / Scale)
    MinimapCluster:EnableMouse(false)

    --[[ Background ]]
    Minimap:SetBackdrop({bgFile = "Interface\\ChatFrame\\ChatFrameBackground", insets = {
        top = -BGThickness / Scale,
        left = -BGThickness / Scale,
        bottom = -BGThickness / Scale,
        right = -BGThickness / Scale
    }})
     Minimap:SetBackdropColor(r, g, b, a)

    --[[ Click func ]]
    
    local oldOnClick = Minimap:GetScript("OnMouseUp")
    Minimap:SetScript("OnMouseUp", function(self,click)
	    if(click=="RightButton") then
		    ToggleDropDownMenu(1, nil, MiniMapTrackingDropDown, "cursor", 0, 0)
	    elseif(click=="MiddleButton") then
		    if (not CalendarFrame) then LoadAddOn("Blizzard_Calendar") end Calendar_Toggle() 
	    else 
		    oldOnClick(self)
	    end
    end)

    --[[ Tracking ]]
	MiniMapTracking:ClearAllPoints()
	MiniMapTracking:SetParent(Minimap)
	MiniMapTracking:SetPoint('TOPLEFT', 0, -2)
	MiniMapTracking:SetAlpha(0)
	MiniMapTrackingBackground:Hide()
	MiniMapTrackingButtonBorder:SetTexture(nil)
	MiniMapTrackingButton:SetHighlightTexture(nil)
	MiniMapTrackingIconOverlay:SetTexture(nil)
	MiniMapTrackingIcon:SetTexCoord(0.065, 0.935, 0.065, 0.935)
	MiniMapTrackingIcon:SetWidth(20)
	MiniMapTrackingIcon:SetHeight(20)
	
    Wanderlust.tracking = CreateFrame("Frame", nil, Minimap)
    -- Wanderlust.tracking:SetPoint("BOTTOM", 0, 20)
    
    -- local t = Wanderlust.tracking:CreateFontString(nil, "OVERLAY")
    -- t:SetFont("Fonts\\FRIZQT__.ttf", trackingsize, trackingfontflag)
    -- t:SetPoint("RIGHT")
    -- t:SetPoint("LEFT")
    
    --t:SetTextColor(unpack(trackingowncolor))
    
    -- local function UpdateTrackignText()
        -- for i = 1, GetNumTrackingTypes() do
            -- local name, texture, active = GetTrackingInfo(i)
            -- if(active) then
                -- t:SetText(name)
                -- Wanderlust.tracking:SetWidth(t:GetStringWidth()>140 and 140 or t:GetStringWidth())
                -- Wanderlust.tracking:SetHeight(t:GetStringHeight())
                -- return
            -- end
        -- end
        -- t:SetText("")
    -- end

--[[ Instance Difficulty - should work now finally]]

local _, class = UnitClass("player")
local color = RAID_CLASS_COLORS[class]
local id = CreateFrame("Frame", nil, UIParent)
id:SetPoint("TOP", Minimap, "TOP")
id:RegisterEvent("PLAYER_ENTERING_WORLD")
id:RegisterEvent("PLAYER_DIFFICULTY_CHANGED")

local idtext = id:CreateFontString(nil, "OVERLAY")
idtext:SetPoint("TOP", Minimap, "TOP", 0, -4)
idtext:SetFont("Interface\\addons\\sharedmedia\\fonts\\iflash705.ttf", 8, "OUTLINEMONOCHROME")
idtext:SetTextColor(1,1,1)

function indiff()
	local inInstance, instancetype = IsInInstance()
	local _, _, difficultyIndex, _, _, playerDifficulty, isDynamic = GetInstanceInfo()
	if inInstance and instancetype == "raid" then
		if isDynamic and difficultyIndex == 4 then
			if playerDifficulty == 0 then
				idtext:SetText("25H")
			end
		end
		if isDynamic and difficultyIndex == 3 then
			if playerDifficulty == 0 then
				idtext:SetText("10H")
			end
		end
		if isDynamic and difficultyIndex == 2 then
			if playerDifficulty == 0 then
				idtext:SetText("25")
			end
			if playerDifficulty == 1 then
				idtext:SetText("25H") 
			end
		end
		if isDynamic and difficultyIndex == 1 then
			if playerDifficulty == 0 then
				idtext:SetText("10") 
			end
			if playerDifficulty == 1 then
				idtext:SetText("10H") 
			end
		end
		if not isDynamic then
			if difficultyIndex == 1 then
				idtext:SetText("10") 
			end
			if difficultyIndex == 2 then
				idtext:SetText("25") 
			end
			if difficultyIndex == 3 then
				idtext:SetText("10H") 
			end
			if difficultyIndex == 4 then
				idtext:SetText("25H") 
			end
		end
	end
	if not inInstance then
		idtext:SetText("") 
	end
end
id:SetScript("OnEvent", function() indiff() end)

    -- Minimap:SetScript("OnEnter", function()
        -- UpdateTrackignText()
		-- MiniMapTracking:SetAlpha(1)
        -- Wanderlust.tracking:SetAlpha(1)
    -- end)
	
		
	MiniMapTrackingButton:SetScript("OnEnter",function()
		--UpdateTrackignText()
		MiniMapTracking:SetAlpha(1)
        Wanderlust.tracking:SetAlpha(1)
	end)

    Minimap:SetScript("OnLeave", function()
        MiniMapTracking:SetAlpha(0)
        Wanderlust.tracking:SetAlpha(0)
    end)
	
	MiniMapTrackingButton:SetScript("OnLeave", function()
        MiniMapTracking:SetAlpha(0)
        Wanderlust.tracking:SetAlpha(0)
    end)
	
	MiniMapTrackingButton:SetScript("OnMouseUp", function(self,click)
	    if(click=="RightButton") then
		    ToggleDropDownMenu(1, nil, MiniMapTrackingDropDown, "cursor", 0, 0)
		elseif(click=="MiddleButton") then
			if (not CalendarFrame) then LoadAddOn("Blizzard_Calendar") end Calendar_Toggle() 
		end
	end)


    Wanderlust.tracking.text = t
	
--[[ Clock ]]
if not IsAddOnLoaded("Blizzard_TimeManager") then
	LoadAddOn("Blizzard_TimeManager")
end
local clockFrame, clockTime = TimeManagerClockButton:GetRegions()
clockFrame:Hide()
clockTime:SetFont("Fonts\\FRIZQT__.ttf", 12, "THINOUTLINE")
clockTime:SetTextColor(1, 1, 1)
TimeManagerClockButton:ClearAllPoints()
TimeManagerClockButton:SetPoint("BOTTOM", Minimap, "BOTTOM", 0, 2000)
TimeManagerClockButton:SetScript('OnShow', nil)
TimeManagerClockButton:Show()
TimeManagerClockButton:SetScript('OnClick', function(self, button)
	 if(button=="RightButton") then
		    ToggleDropDownMenu(1, nil, MiniMapTrackingDropDown, "cursor", 0, 0)
	 elseif(button == 'MiddleButton') then
		ToggleCalendar()
	else
		if(self.alarmFiring) then
			PlaySound('igMainMenuQuit')
			TimeManager_TurnOffAlarm()
		else
			ToggleTimeManager()
		end
	end
end)

    
--[[ Calendar ]]

-- Slahscommand for calendar
SlashCmdList["CALENDAR"] = function()
	ToggleCalendar()
end
SLASH_CALENDAR1 = "/cl"
SLASH_CALENDAR2 = "/calendar"

local cal = CreateFrame("Frame", nil, Minimap)
GameTimeFrame:HookScript("OnShow", cal.Show)
GameTimeFrame:SetScript("OnEvent", function(self, event, addon)
	if CalendarGetNumPendingInvites() ~= 0 then
		clockTime:SetTextColor(0, 1, 0)
	else
		clockTime:SetTextColor(1, 1, 1)
	end
end)

    self:UnregisterEvent(event)
end)

function GetMinimapShape() return "SQUARE" end

--[[ Hiding ugly things	]]
local dummy = function() end
local frames = {
    "MiniMapVoiceChatFrame",
    "MiniMapWorldMapButton",
    "MinimapZoneTextButton",
    "MiniMapMailFrame",
    "MinimapBorderTop",
    "MiniMapInstanceDifficulty",
    "MinimapNorthTag",
    "MinimapZoomOut",
    "MinimapZoomIn",
    "MinimapBorder",
    "GameTimeFrame",
    "MiniMapBattlefieldBorder",
	"MiniMapLFGFrameBorder",
	"GuildInstanceDifficulty",
--    "Boss1TargetFrame",
--    "Boss2TargetFrame",
--    "Boss3TargetFrame",
--    "Boss4TargetFrame"
}
GameTimeFrame:SetAlpha(0)
GameTimeFrame:EnableMouse(false)
GameTimeCalendarInvitesTexture:SetParent("Minimap")

for i in pairs(frames) do
    _G[frames[i]]:Hide()
    _G[frames[i]].Show = dummy
end

--[[ Mousewheel zoom ]]
Minimap:EnableMouseWheel(true)
Minimap:SetScript("OnMouseWheel", function(_, zoom)
    if zoom > 0 then
        Minimap_ZoomIn()
    else
        Minimap_ZoomOut()
    end
end)

--[[ BG icon ]]
MiniMapBattlefieldFrame:ClearAllPoints()
MiniMapBattlefieldFrame:SetParent(Minimap)
MiniMapBattlefieldFrame:SetPoint('TOPRIGHT', 2, -2)
MiniMapBattlefieldBorder:SetTexture(nil)
BattlegroundShine:Hide()

--[[ Random Group icon ]]
MiniMapLFGFrame:ClearAllPoints()
MiniMapLFGFrame:SetParent(Minimap)
MiniMapLFGFrame:SetPoint('TOPRIGHT', 2, -2)
MiniMapLFGFrame:SetHighlightTexture(nil)

--[[ Mail icon ]]
-- MiniMapMailFrame:ClearAllPoints()
-- MiniMapMailFrame:SetPoint("BOTTOMRIGHT", Minimap, "BOTTOMRIGHT", 6, -8)
-- MiniMapMailIcon:SetTexture("Interface\\AddOns\\Wanderlust\\mail")
-- MiniMapMailIcon:SetAlpha(0)
Again, if anyone knows how to accomplish this task, I'd be appreciative if you could treat me like an idiot that doesn't understand most of the basics of the language. I really just don't know as much as I sincerely wish I knew.

(I'm also assuming I've hack'n'slashed some of the code to hide the clock and mail frame. If there's a better way to hide those properly I'd be happy to make it happen)

Fast SS, just to clarify (I'm bad at explaining this stuff):

Topleft corner, that tooltip is all over the left edge of the screen =(
This should do it.

LFGSearchStatus:SetFrameStrata("HIGH")
LFGSearchStatus:SetFrameLevel(25)
  Reply With Quote