This is what I used to move the durability man (
ArmoredMan - Ace3). To see the full code in use, download it. Hope this gives you an idea.
DurabilityFrame -> WorldStateCaptureBar
ArmoredMan -> Your AddOn Name
Code:
function ArmoredMan:OnEnable()
self:SecureHook("UIParent_ManageFramePositions", "setPosition")
end
function ArmoredMan:locked()
DurabilityFrame:SetMovable(true)
DurabilityFrame:EnableMouse(true)
DurabilityFrame:SetClampedToScreen(true)
DurabilityFrame:RegisterForDrag("LeftButton")
DurabilityFrame:SetScript("OnDragStart", function(frame) if not self.db.profile.locked then frame:StartMoving() end end)
DurabilityFrame:SetScript("OnDragStop", function(frame)
if self.db.profile.locked then return end
frame:StopMovingOrSizing()
self.db.profile.x, self.db.profile.y = frame:GetCenter()
self.db.profile.anchorframe, self.db.profile.anchor = "UIParent", "BOTTOMLEFT"
end)
DurabilityFrame:ClearAllPoints()
DurabilityFrame:SetPoint("CENTER", self.db.profile.anchorframe, self.db.profile.anchor, self.db.profile.x, self.db.profile.y)
end
function ArmoredMan:setPosition()
DurabilityFrame:ClearAllPoints()
DurabilityFrame:SetPoint("CENTER", self.db.profile.anchorframe, self.db.profile.anchor, self.db.profile.x, self.db.profile.y)
end