Thread Tools Display Modes
Prev Previous Post   Next Post Next
08-29-12, 12:16 PM   #1
Caetan0
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 99
Help [Edit this Addon]

Friends, I have this addon that modifies the action bar of my character in a way that I think great.

It is lightweight and leaves the action bar clean, however I updated yesterday to version 5.0 wow addon and showed some flaws.

Can someone help me to update this addon for it to function normally again?

Code:
	local SCALE = 0.61
	local FADE_BOX = 1
	local FADE_SIDEBAR = 1
	local SIDEBAR_Y = 0
	local BOX_X = 0
	local BOX_Y = 0
	local MicroButtons = {
		CharacterMicroButton,
		SpellbookMicroButton,
		TalentMicroButton,
		AchievementMicroButton,
		QuestLogMicroButton,
		GuildMicroButton,
		PVPMicroButton,
		LFDMicroButton,
		EJMicroButton,
		RaidMicroButton,
		MainMenuMicroButton,
		HelpMicroButton,
	}
	local BagButtons = {
		MainMenuBarBackpackButton,
		CharacterBag0Slot,
		CharacterBag1Slot,
		CharacterBag2Slot,
		CharacterBag3Slot,
	}
	function fade(frame,button)
		local function showhide(alpha)
			frame:SetAlpha(alpha)
		end
		frame:EnableMouse(true)
		frame:SetAlpha(0.1)
		frame:SetScript("OnEnter", function(self) showhide(1) end)
		frame:SetScript("OnLeave", function(self) showhide(0.1) end)
		button:HookScript("OnEnter", function(self) showhide(1) end)
		button:HookScript("OnLeave", function(self) showhide(0.1) end)
	end
	local function showbg(f)
		f:SetBackdrop( { bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",    edgeFile = "",    tile = false,
					tileSize = 0,edgeSize = 0,insets = {left = -10,right = -10,top = -10,bottom = -10,} }	)
		f:SetBackdropColor(1,0.8,1,0.6)
	end
	local function hide_blz()
		for _, texture in next, {
			ReputationWatchBarTexture0, ReputationWatchBarTexture1, ReputationWatchBarTexture2, ReputationWatchBarTexture3,
			ReputationXPBarTexture0, ReputationXPBarTexture1, ReputationXPBarTexture2, ReputationXPBarTexture3,
			ShapeshiftBarLeft, ShapeshiftBarMiddle, ShapeshiftBarRight,
			PossessBackground1, PossessBackground2,
			SlidingActionBarTexture0, SlidingActionBarTexture1,
			MainMenuXPBarTextureLeftCap,MainMenuXPBarTextureRightCap,MainMenuXPBarTextureMid,
			BonusActionBarFrameTexture1, BonusActionBarFrameTexture2,
			MainMenuMaxLevelBar0,MainMenuMaxLevelBar1,MainMenuMaxLevelBar2,MainMenuMaxLevelBar3,
			}
		do	texture:SetTexture(nil)		end
		for _,frame in next, {
			MainMenuBarTexture0,MainMenuBarTexture1,
			MainMenuBarTexture2,MainMenuBarTexture3,
			MainMenuBarLeftEndCap, MainMenuBarRightEndCap,
			MainMenuBarPageNumber,ActionBarUpButton,ActionBarDownButton,
			}
		do	frame:Hide()	end
		for i=1,19 do _G["MainMenuXPBarDiv"..i]:SetTexture(Empty_Art) end
	end
	local HEIGHT = 4
	local WIDTH = 512
	MainMenuBar:SetScale(SCALE)
	MainMenuBar:SetWidth( 512 )
	local function mainbars()
		if InCombatLockdown() then return end
		local y = 5
		local anchor = ActionButton1
		if ( MainMenuExpBar:IsShown() and ReputationWatchBar:IsShown() ) then
			y = 30
		elseif MainMenuExpBar:IsShown() then
			y = 20
		elseif  ReputationWatchBar:IsShown()  then
			y = 20
		end
		if  MultiBarBottomLeft:IsShown() then
			MultiBarBottomLeft:ClearAllPoints()
			MultiBarBottomLeft:SetPoint("BOTTOMLEFT", anchor, "TOPLEFT", 0, y)
			y = 5
			anchor = MultiBarBottomLeft
		end
		if MultiBarBottomRight:IsShown() then
			MultiBarBottomRight:ClearAllPoints()
			MultiBarBottomRight:SetPoint("BOTTOMLEFT", anchor, "TOPLEFT", 0, y)
			y= 5
			anchor = MultiBarBottomRightButton1
		end
		if ShapeshiftButton1:IsShown() then
			ShapeshiftButton1:ClearAllPoints()
			ShapeshiftButton1:SetPoint("BOTTOMLEFT", anchor, "TOPLEFT", 0, y)
		end
		MultiCastActionBarFrame.ignoreFramePositionManager = true
		MultiCastActionBarFrame:ClearAllPoints()
		MultiCastActionBarFrame:SetPoint("BOTTOMLEFT", anchor, "TOPLEFT", 0, y);
		MultiCastActionBarFrame.SetPoint = function() end
		local px = 64
		if MultiCastActionBarFrame:IsShown() or ShapeshiftButton1:IsShown() then
			if GetNumShapeshiftForms() < 4 then
				px = 128
			else
				px = 240
				local pet_fade_frame = CreateFrame("frame", nil, PetActionBarFrame)
				for i = 8, 10 do
					_G["PetActionButton"..i]:SetParent( pet_fade_frame );
					fade(pet_fade_frame, _G["PetActionButton"..i] );
				end
				PetActionButton8:ClearAllPoints()
				PetActionButton8:SetPoint("BOTTOMLEFT", PetActionButton5, "TOPLEFT", 0, y)
			end
		end
		PetActionButton1:ClearAllPoints()
		PetActionButton1:SetPoint("BOTTOMLEFT", anchor, "TOPLEFT", px, y)
		PossessButton1:ClearAllPoints();
		PossessButton1:SetPoint("BOTTOMLEFT", MultiBarBottomRightButton1, "TOPLEFT", 0, 4);
		hide_blz()
	end
	mainbars()
	hooksecurefunc("UIParent_ManageFramePosition",mainbars)
	hooksecurefunc("MainMenuBarVehicleLeaveButton_Update",function()
		MainMenuBarVehicleLeaveButton:ClearAllPoints()
		MainMenuBarVehicleLeaveButton:SetPoint("BOTTOMLEFT",MultiBarBottomRightButton1,"TOPLEFT", 382, 40)
	end )
	local box = CreateFrame("Frame","Micro_and_Bags_Frame",UIParent)
		box:SetWidth(210)
		box:SetHeight(55)
		box:SetPoint("BOTTOMRIGHT", UIParent, BOX_X, BOX_Y);
		box:SetScale(SCALE * 0.8)
	local function mybox()
		for _, button in pairs(BagButtons) do
			if button ~= MainMenuBarBackpackButton then
				button:Hide()
			else
				MainMenuBarBackpackButton:SetParent(box)
				MainMenuBarBackpackButton:SetScale( 2.2 )
			end
		end
		MainMenuBarBackpackButton:ClearAllPoints();
		MainMenuBarBackpackButton:SetPoint("BOTTOMRIGHT",box,0,0);
		for _, button in pairs(MicroButtons) do
			button:SetParent(box);
		end
		local x = -310
		CharacterMicroButton:ClearAllPoints();
		CharacterMicroButton:SetPoint("BOTTOMLEFT", MainMenuBarBackpackButton, x/2, 30);
		PVPMicroButton:ClearAllPoints();
		PVPMicroButton:SetPoint("TOPLEFT", CharacterMicroButton, "BOTTOMLEFT", 0, 25);
	end
	mybox()
	hooksecurefunc("UpdateMicroButtons",mybox)
	if FADE_BOX == 1 then 
		for _,button in pairs(MicroButtons) do fade(box,button) end
		for _,button in pairs(BagButtons) 	do fade(box,button) end
	end
	for _,f in next,{MultiBarLeft,MultiBarRight} 	do 	f:SetParent(MainMenuBar) 	end
	if SIDEBAR_Y ~= 0 then 
		MultiBarRight.ignoreFramePositionManager = true
		MultiBarRight:ClearAllPoints(); 	
		MultiBarRight:SetPoint("RIGHT", UIParent, -5,SIDEBAR_Y)
	end
	if FADE_SIDEBAR == 1 then
		for i = 1, 12 do
			fade( MultiBarLeft, _G["MultiBarLeftButton"..i] )
			fade( MultiBarRight, _G["MultiBarRightButton"..i] )
		end
	end
	MainMenuExpBar:SetWidth(WIDTH - 12)
	MainMenuExpBar:SetHeight(HEIGHT)
	MainMenuExpBar:ClearAllPoints()
	MainMenuExpBar:SetPoint("CENTER", MainMenuBar, "TOP", 0, -4.5)
	local fontFile, fontHeight, fontFlags = MainMenuBarExpText:GetFont()
	MainMenuBarExpText:SetFont(fontFile, floor(fontHeight / SCALE + 0.5), fontFlags)
	ExhaustionLevelFillBar:SetHeight(HEIGHT)
	ReputationWatchBar:SetWidth(WIDTH - 12)
	ReputationWatchBar:SetHeight(HEIGHT)
	ReputationWatchStatusBar:SetWidth(WIDTH - 12)
	local fontFile, fontHeight, fontFlags = ReputationWatchStatusBarText:GetFont()
	ReputationWatchStatusBarText:SetFont(fontFile, floor(fontHeight / SCALE + 0.5), fontFlags)
	local function ReputationWatchBar_Update_posthook(...)
		local name, reaction, _, _, value = GetWatchedFactionInfo()
		local hasExpBar = MainMenuExpBar:IsShown()
		local l = MainMenuExpBar:GetWidth()
		if ( not name ) then
			if ( hasExpBar ) then
				MainMenuBarExpText:ClearAllPoints()
				MainMenuBarExpText:SetPoint("CENTER", MainMenuExpBar, 0, 1)
			end
			return ...
		end
		ReputationWatchStatusBar:SetHeight(HEIGHT)
		ReputationWatchStatusBarText:SetText(ReputationWatchStatusBarText:GetText() .. " " .. GetText("FACTION_STANDING_LABEL" .. reaction, UnitSex("player")))
		ReputationWatchStatusBar:SetHeight(HEIGHT)
		if ( hasExpBar ) then
			ReputationWatchBar:ClearAllPoints()
			ReputationWatchBar:SetPoint("CENTER", MainMenuBar, "BOTTOM", 0, 55 + 4.5)
			ReputationWatchStatusBarText:ClearAllPoints()
			ReputationWatchStatusBarText:SetPoint("CENTER", ReputationWatchBarOverlayFrame,l / 4, 1)
			MainMenuBarExpText:ClearAllPoints()
			MainMenuBarExpText:SetPoint("CENTER", MainMenuExpBar, l / -4 , 1)
		else
			ReputationWatchBar:ClearAllPoints()
			ReputationWatchBar:SetPoint("CENTER", MainMenuBar, "BOTTOM", 0, 55 -4.5)
			ReputationWatchStatusBarText:ClearAllPoints()
			ReputationWatchStatusBarText:SetPoint("CENTER", ReputationWatchBarOverlayFrame, 0, 1)
		end
		if ( value == 28251 ) then
		end
		return ...
	end
	local ReputationWatchBar_Update_original = ReputationWatchBar_Update
	function ReputationWatchBar_Update(...)
		return ReputationWatchBar_Update_posthook(ReputationWatchBar_Update_original(...))
	end
	PetActionBarFrame:SetAttribute("unit", "pet")
	RegisterUnitWatch(PetActionBarFrame)
	local petframe = CreateFrame("frame", "petfrme_event", MainMenuBar)
	PetActionBarFrame:SetParent( petframe )
	RegisterStateDriver(petframe, "visibility", "[target=vehicle,exists] hide;show")
	MainMenuBarArtFrame:UnregisterAllEvents()
	VehicleMenuBar:UnregisterAllEvents()
	hooksecurefunc('TalentFrame_LoadUI', function()
		PlayerTalentFrame:UnregisterEvent('ACTIVE_TALENT_GROUP_CHANGED')	end)
	local mainnenubar = CreateFrame("Frame","rABS_MainMenuBar",UIParent, "SecureHandlerStateTemplate")
	mainnenubar:RegisterEvent("PLAYER_LOGIN")
	mainnenubar:RegisterEvent("KNOWN_CURRENCY_TYPES_UPDATE")
	mainnenubar:RegisterEvent("CURRENCY_DISPLAY_UPDATE")
	mainnenubar:RegisterEvent("BAG_UPDATE")
	mainnenubar:SetScript("OnEvent", function(self, event, ...)
	if event == "PLAYER_LOGIN" then
		local button, buttons
		for i = 1, NUM_ACTIONBAR_BUTTONS do
			button = _G["ActionButton"..i]
			self:SetFrameRef("ActionButton"..i, button)
		end
		self:Execute([[
			buttons = table.new()
			for i = 1, 12 do
				table.insert(buttons, self:GetFrameRef("ActionButton"..i))
			end
		]])
		self:SetAttribute("_onstate-page", [[
			for i, button in ipairs(buttons) do
				button:SetAttribute("actionpage", tonumber(newstate))
			end
		]])
		RegisterStateDriver(self, "page", "[bonusbar:5] 11; [bar:2] 2; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6;")
	else
		MainMenuBar_OnEvent(self, event, ...)
	end
	end)
  Reply With Quote
 

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Help [Edit this Addon]


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off