notes for Cataclysm Classic 4.0.4, this has been ported from BF Retail version v1.2.2.4


Look for the following comments in the files changed

 -- changed for Cata 
 -- removed for Cata 
 -- added for Cata 

 
replaced all the Retail flyout code from wrath BF 04/27/2024
 
---------------------------------------------------------------------------------------------------------

ButtonForge.toc

---- Updated with
## Interface: 40400
## Title: Button Forge |cff69ccf0(Classic-Cata)|r
## Version: 1.0.22-classic-Cata
## Author: Massiner of Nathrezim, Albirew, Sunnova

---------------------------------------------------------------------------------------------------------

Const.lua

Const.Version				= 1.0;        -- changed for Cata 04/04/2024
Const.VersionMinor			= 0.22;   -- changed for Cata 04/04/2024

Const.ButtonGap 			= 6;		--BG		 -- changed for Cata 04/04/2024
Const.ButtonSize 			= 36;		--BS     -- changed for Cata 04/04/2024

---------------------------------------------------------------------------------------------------------

Button.lua

-- 04/30/2024

-- 04/29/2024
-- migration code added to clear BattlePet entries to avoid a corrupt action being set for the BattlePet 



changed from:

function Button.CreateButtonWidget(Parent)
	local Name = Const.ButtonNaming..Const.ButtonSeq;
	local Widget = CreateFrame("CheckButton", Name, Parent, "SecureActionButtonTemplate, ActionButtonTemplate");
	Const.ButtonSeq = Const.ButtonSeq + 1;
	Widget:SetAttribute("checkselfcast", true);
	Widget:SetAttribute("checkfocuscast", true);
	Widget:SetAttribute("checkmouseovercast", true);
	Widget:RegisterForDrag("LeftButton", "RightButton");

	Widget:SetScript("OnReceiveDrag", Button.OnReceiveDrag);
	Widget:SetScript("OnDragStart", Button.OnDragStart);
	
	Widget:SetScript("PostClick", Button.PostClick);
	Widget:SetScript("PreClick", Button.PreClick);

	
	--_G[Widget:GetName().."HotKey"]:ClearAllPoints();
	--_G[Widget:GetName().."HotKey"]:SetPoint("TOPLEFT", Widget, "TOPLEFT", 1, -2);
	Widget.action = 10000;
	if (Util.LBFMasterGroup) then
		Util.LBFMasterGroup:AddButton(Widget);
	end
	-- Widget.UpdateFlyout = Widget_UpdateFlyout; -- removed for cata 04/27/2024
	return Widget;
end

to:

unction Button.CreateButtonWidget(Parent)
	local Name = Const.ButtonNaming..Const.ButtonSeq;
	local Widget = CreateFrame("CheckButton", Name, Parent, "SecureActionButtonTemplate, ActionButtonTemplate");
	Const.ButtonSeq = Const.ButtonSeq + 1;

	local Background = Widget:CreateTexture(Widget:GetName() .. "FloatingBG", "BACKGROUND", nil, -1)
	Background:SetTexture("Interface\\Buttons\\UI-Quickslot")
	Background:SetAlpha(0.4)
	Background:SetPoint("TOPLEFT", -15, 15)
	Background:SetPoint("BOTTOMRIGHT", 15, -15)
	-- For some reason Blizz set the alpha to 0.5 via this vertexcolor call in code instead of setting alpha in the xml template (we just replicate it here)
	_G[Name .. "NormalTexture"]:SetVertexColor(1.0, 1.0, 1.0, 0.5)

	Widget:SetAttribute("checkselfcast", true);
	Widget:SetAttribute("checkfocuscast", true);
	Widget:SetAttribute("checkmouseovercast", true);
	Widget:RegisterForDrag("LeftButton", "RightButton");

	Widget:SetScript("OnReceiveDrag", Button.OnReceiveDrag);
	Widget:SetScript("OnDragStart", Button.OnDragStart);
	
	Widget:SetScript("PostClick", Button.PostClick);
	Widget:SetScript("PreClick", Button.PreClick);

	
	--_G[Widget:GetName().."HotKey"]:ClearAllPoints();
	--_G[Widget:GetName().."HotKey"]:SetPoint("TOPLEFT", Widget, "TOPLEFT", 1, -2);
	Widget.action = 10000;
	if (Util.LBFMasterGroup) then
		Util.LBFMasterGroup:AddButton(Widget);
	end
	-- Widget.UpdateFlyout = Widget_UpdateFlyout; -- removed for cata 04/27/2024
	return Widget;
end



changed from:

function Button:SetEnvBattlePet(Id)

	self.UpdateTexture 	= Button.Empty;

to:

function Button:SetEnvBattlePet(Id)
  if Id == nil then  -- added for Cata 04/04/, nil check, conversion needed to update existing pets to BattlePetId stored on BF bars
    return
  end
	self.UpdateTexture 	= Button.Empty;


changed from:

	self.Widget:SetAttribute("id", nil);
	self.Widget:SetAttribute("IsEmpowerSpell", nil);

	--Now if a valid type is passed in set it

to:

	self.Widget:SetAttribute("id", nil);
	-- self.Widget:SetAttribute("IsEmpowerSpell", nil); -- removed for Cata 04/04/2024

  if Value == nil then -- added for Cata 04/04/2024
    return
  end
	
	--Now if a valid type is passed in set it


changed from:

			self.Widget:SetAttribute("type", Type);
			self.Widget:SetAttribute("typerelease", Type);
			self.Widget:SetAttribute(Type, SpellName);
			self.Widget:SetAttribute("IsEmpowerSpell", IsPressHoldReleaseSpell(SpellId));

		-- fallback to the old method if the name cannot be resolved

to:
			self.Widget:SetAttribute("type", Type);
			self.Widget:SetAttribute("typerelease", Type);
			self.Widget:SetAttribute(Type, SpellName);
			-- self.Widget:SetAttribute("IsEmpowerSpell", IsPressHoldReleaseSpell(SpellId));  -- removed for Cata 04/04/2024

		-- fallback to the old method if the name cannot be resolved


changed from:

function Button:UpdateCooldownItem()
	Util.CooldownFrame_SetTimer(self.WCooldown, GetItemCooldown(self.ItemId)); -- removed for Cata 04/04/2024
end

to:

function Button:UpdateCooldownItem()
	-- Util.CooldownFrame_SetTimer(self.WCooldown, GetItemCooldown(self.ItemId)); -- removed for Cata 04/04/2024
end


Removed Item Range checking
changed from:

function Button:UpdateRangeTimerItem()
	if (IsItemInRange(self.ItemId, self.Target)) then
		if (not self.RangeTimerOn) then
	  	self:AddToRangeTimer();
	  end
	elseif (self.RangeTimerOn) then
	  self:RemoveFromRangeTimer();
	end
end

to:

function Button:UpdateRangeTimerItem()
	--if (IsItemInRange(self.ItemId, self.Target)) then
	--	if (not self.RangeTimerOn) then
	--		self:AddToRangeTimer();
	--	end
	--elseif (self.RangeTimerOn) then
	--	self:RemoveFromRangeTimer();
	--end
end


changed from:

--[[ Set up the buttons action based on the triplet of data provided from the cursor --]]
function Button:SetCommandFromTriplet(Command, Data, Subvalue, Subsubvalue)
	if (InCombatLockdown()) then
		return false;
	end
	
	local OldMode = self.Mode;
	
	if (Command == "spell") then
		self:SetCommandSpell(Subsubvalue);  --Data = Index, Subvalue = Book (spell/pet)
	elseif (Command == "petaction") then
		if (Data > 5) then
			-- "Assist, Attack, Defensive, Passive, Follow, Move To, Stay" cause issues so lets ignore them for now. They all have their id between 0 and 5.
			self:SetCommandSpell(Data);
		else
			return false;
		end
	elseif (Command == "item") then
		self:SetCommandItem(Data, Subvalue);   --Data = Id, Subvalue = Link
	elseif (Command == "macro") then
		self:SetCommandMacro(Data);            --Data = Index
    elseif (Command == "mount") then
        self:SetCommandCompanion(Data);	-- Data = MountID, Subvalue = ???
	elseif (Command == "equipmentset") then
		self:SetCommandEquipmentSet(Data);			--Data = Name
	elseif (Command == "bonusaction") then
		self:SetCommandBonusAction(Data);			--Data = Id (1 to 12)
	elseif (Command == "flyout") then
		self:SetCommandFlyout(Data);		--Data = Id
	elseif (Command == "customaction") then
		self:SetCommandCustomAction(Data);			--Data = Action
	elseif (Command == "battlepet") then
		self:SetCommandBattlePet(Data);
	elseif (Command == nil or Command == "") then
		self:ClearCommand();
	else
		return false;
	end
	
	self:FullRefresh();
	return true;
end

to:

--[[ Set up the buttons action based on the triplet of data provided from the cursor --]]
function Button:SetCommandFromTriplet(Command, Data, Subvalue, Subsubvalue)
	if (InCombatLockdown()) then
		return false;
	end
	
	local OldMode = self.Mode;
	
	if (Command == "spell") then
		self:SetCommandSpell(Subsubvalue);  --Data = Index, Subvalue = Book (spell/pet)
	elseif (Command == "petaction") then
		if (Data > 5) then
			-- "Assist, Attack, Defensive, Passive, Follow, Move To, Stay" cause issues so lets ignore them for now. They all have their id between 0 and 5.
			self:SetCommandSpell(Data);
		else
			return false;
		end
	elseif (Command == "companion") then
		if (Subvalue == "CRITTER") then
			if Util.HeldBattlePetID then
				self:SetCommandBattlePet(Util.HeldBattlePetID)
			else
				return false
			end
		elseif (Subvalue == "MOUNT") then
			if Util.HeldMountID then
				self:SetCommandCompanion(Util.HeldMountID)
			else
				return false
			end
		end
	elseif (Command == "item") then
		self:SetCommandItem(Data, Subvalue);   --Data = Id, Subvalue = Link
	elseif (Command == "macro") then
		self:SetCommandMacro(Data);            --Data = Index
    elseif (Command == "mount") then
        self:SetCommandCompanion(Data);	-- Data = MountID, Subvalue = ???
	elseif (Command == "equipmentset") then
		self:SetCommandEquipmentSet(Data);			--Data = Name
	elseif (Command == "bonusaction") then
		self:SetCommandBonusAction(Data);			--Data = Id (1 to 12)
	elseif (Command == "flyout") then
		self:SetCommandFlyout(Data);		--Data = Id
	elseif (Command == "customaction") then
		self:SetCommandCustomAction(Data);			--Data = Action
	elseif (Command == "battlepet") then
		self:SetCommandBattlePet(Data);
	elseif (Command == nil or Command == "") then
		self:ClearCommand();
	else
		return false;
	end
	
	self:FullRefresh();
	return true;
end


changed from

		self.Widget:SetAttribute("macrotext", "/summonpet "..Value);

to:

		self.Widget:SetAttribute("macrotext", string.format("/run local petID = \"%s\" if C_PetJournal.IsCurrentlySummoned(petID) then C_PetJournal.DismissSummonedPet(petID) elseif not InCombatLockdown() then C_PetJournal.SummonPetByGUID(petID) end", Value))



changed from:

function Button:SetupActionButtonClick()
	local Widget = self.Widget;
		
	SecureClickWrapperFrame:UnwrapScript(Widget, "OnClick");
	
	-- WoW v10 (probably earlier) ActionButtonUseKeyDown does not seem to be a setting in the panel anymore - the player could still toggle it though using the below (defaults to 1 or true)
		-- empowerTapControls is new and is exposed in the settings panel, this setting changes empower spells, between using the default hold and release (setting is false), to a double tap scheme.
		-- /run SetCVar("ActionButtonUseKeyDown", 1)
		-- /run SetCVar("empowerTapControls", 0)

	Widget:SetAttribute("pressAndHoldAction", true);
	Widget:RegisterForClicks("AnyUp", "AnyDown");
	local SecurePreClickSnippet =
		[[
			SpellFlyout:Hide();
			if (self:GetAttribute("type") ~= "attribute") then 
				ButtonForge_SpellFlyout:Hide();
			end

			if (button == "KeyBind") then

				local IsEmpowerSpell = self:GetAttribute("IsEmpowerSpell");
				if (down) then
					if (ActionButtonUseKeyDown or IsEmpowerSpell) then
						return "LeftButton";
					else
						return false;
					end
				else
					if ((not ActionButtonUseKeyDown and not IsEmpowerSpell) or (IsEmpowerSpell and not empowerTapControls)) then
						return "LeftButton";
					else
						return false;
					end
				end

			elseif (down) then

				return false;

			end
		]];

	SecureClickWrapperFrame:WrapScript(Widget, "OnClick", SecurePreClickSnippet);
	
end

to:

function Button:SetupActionButtonClick()
	local Widget = self.Widget;
	
	-- This particular setting will only gets set at login (if the player changes it they must log out and back in)
	if (Util.ForceOffCastOnKeyDown) then
		Widget:RegisterForClicks("AnyUp");
		return;
	end
	
	SecureClickWrapperFrame:UnwrapScript(Widget, "OnClick");
	
	if (GetCVarBool("ActionButtonUseKeyDown")) then
		Widget:RegisterForClicks("AnyUp", "AnyDown");
		local SecurePreClickSnippet =
			[[if (down and button == "KeyBind") then
				return "LeftButton";
			end
			if ((not down) and button ~= "KeyBind") then
				return;
			end
			return false;]];
		SecureClickWrapperFrame:WrapScript(Widget, "OnClick", SecurePreClickSnippet);
		
	else
		Widget:RegisterForClicks("AnyUp");
		local SecurePreClickSnippet = 
			[[if (button == "KeyBind") then
				return "LeftButton";
			end]];
		SecureClickWrapperFrame:WrapScript(Widget, "OnClick", SecurePreClickSnippet);
	end
	
end


changed from:

	elseif (Type == "flyout") then
		--self.Widget:SetAttribute("type", "flyout");
		self.Widget:SetAttribute("type", "attribute");
		self.Widget:SetAttribute("typerelease", "attribute");
		self.Widget:SetAttribute("attribute-frame", ButtonForge_SpellFlyout);
		self.Widget:SetAttribute("attribute-name", "flyoutbuttonname");
		self.Widget:SetAttribute("attribute-value", self.Widget:GetName());
		self.Widget:SetAttribute("spell", Value);

to:

	elseif (Type == "flyout") then
		--self.Widget:SetAttribute("type", "flyout");
		self.Widget:SetAttribute("type", "attribute");
		self.Widget:SetAttribute("typerelease", "attribute");
		self.Widget:SetAttribute("attribute-frame", ButtonForge_SpellFlyout);
		self.Widget:SetAttribute("attribute-name", "flyoutbuttonname");
		self.Widget:SetAttribute("attribute-value", self.Widget:GetName());
		self.Widget:SetAttribute("spell", Value);


changed from:

--Copied and adapted from Blizz's coding (too bad they Assume there is an action associated with the button!!!)
--This is currently coded to always be up... this will probably need to be adaptable down the track
function Button:UpdateFlyout(isButtonDownOverride)
	local Widget = self.Widget;

	if (not Widget.FlyoutArrowContainer or
		not Widget.FlyoutBorderShadow) then
		return;
	end

	if (self.Mode ~= "flyout") then
		Widget.FlyoutBorderShadow:Hide();
		Widget.FlyoutArrowContainer:Hide();
		return;
	end

	-- Update border
	local isMouseOverButton =  GetMouseFocus() == Widget;
	--local isFlyoutShown = SpellFlyout and SpellFlyout:IsShown() and SpellFlyout:GetParent() == Widget;
	local isFlyoutShown = ButtonForge_SpellFlyout and ButtonForge_SpellFlyout:IsShown() and ButtonForge_SpellFlyout:GetParent() == Widget;
	if (isFlyoutShown or isMouseOverButton) then
		Widget.FlyoutBorderShadow:Show();
	else
		Widget.FlyoutBorderShadow:Hide();
	end

	-- Update arrow
	local isButtonDown;
	if (isButtonDownOverride ~= nil) then
		isButtonDown = isButtonDownOverride;
	else
		isButtonDown = Widget:GetButtonState() == "PUSHED";
	end

	local flyoutArrowTexture = Widget.FlyoutArrowContainer.FlyoutArrowNormal;

	if (isButtonDown) then
		flyoutArrowTexture = Widget.FlyoutArrowContainer.FlyoutArrowPushed;

		Widget.FlyoutArrowContainer.FlyoutArrowNormal:Hide();
		Widget.FlyoutArrowContainer.FlyoutArrowHighlight:Hide();
	elseif (isMouseOverButton) then
		flyoutArrowTexture = Widget.FlyoutArrowContainer.FlyoutArrowHighlight;

		Widget.FlyoutArrowContainer.FlyoutArrowNormal:Hide();
		Widget.FlyoutArrowContainer.FlyoutArrowPushed:Hide();
	else
		Widget.FlyoutArrowContainer.FlyoutArrowHighlight:Hide();
		Widget.FlyoutArrowContainer.FlyoutArrowPushed:Hide();
	end

	Widget.FlyoutArrowContainer:Show();
	flyoutArrowTexture:Show();
	flyoutArrowTexture:ClearAllPoints();

	local arrowDirection = Widget:GetAttribute("flyoutDirection");
	local arrowDistance = isFlyoutShown and 1 or 4;

	-- If you are on an action bar then base your direction based on the action bar's orientation
	local actionBar = Widget:GetParent();
	if (actionBar.actionButtons) then
		arrowDirection = actionBar.isHorizontal and "UP" or "LEFT";
	end

	if (arrowDirection == "LEFT") then
		SetClampedTextureRotation(flyoutArrowTexture, isFlyoutShown and 90 or 270);
		flyoutArrowTexture:SetPoint("LEFT", Widget, "LEFT", -arrowDistance, 0);
	elseif (arrowDirection == "RIGHT") then
		SetClampedTextureRotation(flyoutArrowTexture, isFlyoutShown and 270 or 90);
		flyoutArrowTexture:SetPoint("RIGHT", Widget, "RIGHT", arrowDistance, 0);
	elseif (arrowDirection == "DOWN") then
		SetClampedTextureRotation(flyoutArrowTexture, isFlyoutShown and 0 or 180);
		flyoutArrowTexture:SetPoint("BOTTOM", Widget, "BOTTOM", 0, -arrowDistance);
	else
		SetClampedTextureRotation(flyoutArrowTexture, isFlyoutShown and 180 or 0);
		flyoutArrowTexture:SetPoint("TOP", Widget, "TOP", 0, arrowDistance);
	end
end

to:

--Copied and adapted from Blizz's coding (too bad they Assume there is an action associated with the button!!!)
--This is currently coded to always be up... this will probably need to be adaptable down the track
function Button:UpdateFlyout()
	local Widget = self.Widget;
	if (self.Mode == "flyout") then
		-- Update border and determine arrow position
		local arrowDistance;
		if (SpellFlyout:GetParent() == Widget) then
		--	SpellFlyout.isActionBar = false;
		end
		if ((SpellFlyout and SpellFlyout:IsShown() and SpellFlyout:GetParent() == Widget) or GetMouseFocus() == Widget) then
			Widget.FlyoutBorder:Show();
			Widget.FlyoutBorderShadow:Show();
			arrowDistance = 5;
		else
			Widget.FlyoutBorder:Hide();
			Widget.FlyoutBorderShadow:Hide();
			arrowDistance = 2;
		end
		
		-- Update arrow
		Widget.FlyoutArrow:Show();
		Widget.FlyoutArrow:ClearAllPoints();
		local direction = self.Widget:GetAttribute("flyoutDirection");
		if (direction == "LEFT") then
			Widget.FlyoutArrow:SetPoint("LEFT", Widget, "LEFT", -arrowDistance, 0);
			SetClampedTextureRotation(Widget.FlyoutArrow, 270);
		elseif (direction == "RIGHT") then
			Widget.FlyoutArrow:SetPoint("RIGHT", Widget, "RIGHT", arrowDistance, 0);
			SetClampedTextureRotation(Widget.FlyoutArrow, 90);
		elseif (direction == "DOWN") then
			Widget.FlyoutArrow:SetPoint("BOTTOM", Widget, "BOTTOM", 0, -arrowDistance);
			SetClampedTextureRotation(Widget.FlyoutArrow, 180);
		else
			Widget.FlyoutArrow:SetPoint("TOP", Widget, "TOP", 0, arrowDistance);
			SetClampedTextureRotation(Widget.FlyoutArrow, 0);
		end
	else
		Widget.FlyoutBorder:Hide();
		Widget.FlyoutBorderShadow:Hide();
		Widget.FlyoutArrow:Hide();
	end
end


---------------------------------------------------------------------------------------------------------

EventManager.lua


changed from:

Misc:RegisterEvent("SUPER_TRACKING_CHANGED");

to:

-- Misc:RegisterEvent("SUPER_TRACKING_CHANGED");


changed from:

	elseif (Event == "ZONE_CHANGED" or Event == "ZONE_CHANGED_INDOORS" or Event == "ZONE_CHANGED_NEW_AREA") then
		Util.TriggerZoneChanged();

to:

	elseif (Event == "ZONE_CHANGED" or Event == "ZONE_CHANGED_INDOORS" or Event == "ZONE_CHANGED_NEW_AREA") then
		-- Util.TriggerZoneChanged(); 


changed from:

	elseif (Event == "CVAR_UPDATE") then
		local Name = ...;
		if (Name == "ActionButtonUseKeyDown" or Name == "empowerTapControls") then
			self.UpdateSecureWrapperCVars = true;
			self:SetScript("OnUpdate", self.OnUpdate);
		end

to:

	elseif (Event == "CVAR_UPDATE") then
		local Name = ...;
		if (Name == "ActionButtonUseKeyDown") then
			self.UpdateSecureWrapperCVars = true;
			self:SetScript("OnUpdate", self.OnUpdate);
		end



---------------------------------------------------------------------------------------------------------

Util.lua

-- 04/30/2024
-- 1_22 migration code added


-- 04/29/2024
-- 1_20 migration code added to clear BattlePet entries to avoid a corrupt action being set for the BattlePet 



changed from:

DefaultBarSave["ButtonGap"] 	= 2;


DefaultBonusBarSave["ButtonGap"] 		= 2;


to:

DefaultBarSave["ButtonGap"] 	= 6;

DefaultBonusBarSave["ButtonGap"] 		= 6;



changed from:

function Util.AddSpell(Value)
	if (not Util.FindInTable(Util.ActiveSpells, Value)) then
		table.insert(Util.ActiveSpells, Value);
		Util.RefreshZoneAbility(); 
	end
end

to:

function Util.AddSpell(Value)
	if (not Util.FindInTable(Util.ActiveSpells, Value)) then
		table.insert(Util.ActiveSpells, Value);
		-- Util.RefreshZoneAbility(); 
	end
end


changed from:

function Util.RemoveSpell(Value)
	local Index = Util.FindInTable(Util.ActiveSpells, Value);
	if (Index) then
		table.remove(Util.ActiveSpells, Index);
		Util.RefreshZoneAbility();
	end
end

to:

function Util.RemoveSpell(Value)
	local Index = Util.FindInTable(Util.ActiveSpells, Value);
	if (Index) then
		table.remove(Util.ActiveSpells, Index);
		-- Util.RefreshZoneAbility(); -- removed for Cata 04/04/2024
	end
end



changed from:

function Util.CacheBagItems()
	local BagItemNameIndexes = {};
	local BagItemIdIndexes = {};
	local BagItemNameId = {};
	local ItemId;
	local ItemName;
	for b = BACKPACK_CONTAINER, NUM_TOTAL_EQUIPPED_BAG_SLOTS do
		for s = 1, C_Container.GetContainerNumSlots(b) do
			ItemId = C_Container.GetContainerItemID(b, s);
			ItemName = GetItemInfo(ItemId or "");
			if (ItemName ~= nil and ItemName ~= "") then
				BagItemNameIndexes[ItemName] = {b, s};
				BagItemIdIndexes[ItemId] = {b, s};
				BagItemNameId[ItemName] = ItemId;
			end
		end
	end
	
to:

function Util.CacheBagItems()
	local BagItemNameIndexes = {};
	local BagItemIdIndexes = {};
	local BagItemNameId = {};
	local ItemId;
	local ItemName;
	for b = 4, 0, -1 do 
		  -- for s = 1, C_Container.GetContainerNumSlots(b) do
			for s =  C_Container.GetContainerNumSlots(b), 1, -1 do
			ItemId = C_Container.GetContainerItemID(b, s);
			ItemName = GetItemInfo(ItemId or "");
			if (ItemName ~= nil and ItemName ~= "") then
				BagItemNameIndexes[ItemName] = {b, s};
				BagItemIdIndexes[ItemId] = {b, s};
				BagItemNameId[ItemName] = ItemId;
			end
		end
	end
	

added:

--[[---------------------------------------
	HookSecureFunc_C_PetJournal_PickupPet 

	Quick Hack to catch what pet is picked up from the Pet Journal
	needed since GetCursorInfo does not currently provide the required BattlePet info
-------------------------------------------]]
function Util.HookSecureFunc_C_PetJournal_PickupPet(petID)
	-- petID is the GUID, we retain this until the cusor changes
	Util.HeldBattlePetID = petID
end
hooksecurefunc(C_PetJournal, "PickupPet", Util.HookSecureFunc_C_PetJournal_PickupPet)


function Util.HookSecureFunc_GameTooltip_SetAction(_, slot)
	if slot == nil or slot < 1 or slot > 1000 then
		return
	end
	local command, data, subvalue = GetActionInfo(slot)
	--Util.PreHeldMountID = nil
	--Util.PreHeldBattlePetID = nil
	if command == "companion" and subvalue == "MOUNT" then
		Util.PreHeldMountID = C_MountJournal.GetMountFromSpell(data)
	elseif command == "companion" and subvalue == "CRITTER" then
		local name = GetSpellInfo(data)
		local _, petID = C_PetJournal.FindPetIDByName(name)
		Util.PreHeldBattlePetID = petID
	end
end
hooksecurefunc(GameTooltip, "SetAction", Util.HookSecureFunc_GameTooltip_SetAction)


function Util.HookSecureFunc_PickupAction(slot)
	Util.HeldMountID = Util.PreHeldMountID
	Util.HeldBattlePetID = Util.PreHeldBattlePetID
end
hooksecurefunc(_G, "PickupAction", Util.HookSecureFunc_PickupAction)


changed from:

function Button:UpdateCheckedBattlePet()
	local Active = self.BattlePetId == C_PetJournal.GetSummonedPetGUID();
	self.Widget:SetChecked(Active);
end

to:

function Button:UpdateCheckedBattlePet()
	self.Widget:SetChecked(C_PetJournal.IsCurrentlySummoned(self.BattlePetId))
end

changed from:

function Button:UpdateCooldownBattlePet()
	--CooldownFrame_SetTimer(self.WCooldown, GetCompanionCooldown(self.CompanionType, self.CompanionIndex));
	--as of 5.0.4 doesn't appear to exist anymore?!
end

to:

function Button:UpdateCooldownBattlePet()
	local Start, Duration, Enable = C_PetJournal.GetPetCooldownByGUID(self.BattlePetId)
	if Start ~= nil then
		Util.CooldownFrame_SetTimer(self.WCooldown, Start, Duration, Enable)
	else
		Util.CooldownFrame_SetTimer(self.WCooldown, 0, 0, 0)
		self.WCooldown:Hide()
	end
end


---------------------------------------------------------------------------------------------------------

Bar.lua


changed from:


		-- a bit hacky - but to get this out sooner rather than a bigger refactor
			local NumSpecs = GetNumSpecializations() 
			
			for i = 1, NumSpecs do
			
to:


		-- a bit hacky - but to get this out sooner rather than a bigger refactor
			local NumSpecs = GetNumTalentGroups()
			
			for i = 1, NumSpecs do

---------------------------------------------------------------------------------------------------------