Quantcast
local T, C, L = unpack(Tukui)

local frames = {
	["TukuiRollAnchor"] = {"BOTTOM", TukuiChatBackgroundLeft or ChatFrame1, "TOP", 0, 5},
	["TukuiInfoLeft"] = {"TOPLEFT", UIParent, "TOPLEFT", 6, 3},
	["TukuiInfoRight"] = {"LEFT", TukuiInfoLeft, "RIGHT", 0, 0},
	["TukuiMinimapStatsLeft"] = {"LEFT", TukuiInfoRight, "RIGHT", 0, 0},
	["TukuiMinimapStatsRight"] = {"LEFT", TukuiMinimapStatsLeft, "RIGHT", 0, 0},
	["TukuiTooltipAnchor"] = {"BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", 0, 0},
	["TukuiBags"] = {"BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -6, 6},
	["TukuiMinimap"] = {"TOPRIGHT", UIParent, "TOPRIGHT", -4, -24},
	["TukuiAurasPlayerBuffs"] = {"TOPRIGHT", TukuiMinimap, "TOPLEFT", -6, 0},
}

local function FixVehicleButton()
	vehicleButton = TukuiExitVehicleButtonLeft
	vehicleButton:ClearAllPoints()
	vehicleButton:AllPoints(TukuiPlayer_Detail)
	vehicleButton:SetFrameLevel(TukuiPlayer_Detail:GetFrameLevel()+1)
	vehicleButton.text:SetFont(T.GetPixelFont())
end

local OnLoad = CreateFrame("Frame")
OnLoad:RegisterEvent("PLAYER_ENTERING_WORLD")
OnLoad:SetScript("OnEvent", function()
	for frame, point in pairs(frames) do
		if frame then
			if not _G[frame]:IsUserPlaced() then
				_G[frame]:ClearAllPoints()
				_G[frame]:SetPoint(unpack(point))
			end
		end
	end
	FixVehicleButton()
end)


hooksecurefunc(Stuffing, "CreateBagFrame", function(self, w)
	local f
	self:ClearAllPoints()
	if w == "Bank" then
		f = TukuiBank
		f:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 6, 6)
	else
		f = TukuiBags
		f:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -6, 6)
	end
	f:SetTemplate("Transparent")
	f:ThickBorder()
end)