Hitman = AceLibrary("AceAddon-2.0"):new("AceEvent-2.0", "AceConsole-2.0", "AceDB-2.0") Hitman:RegisterDB("HitmanDB") Hitman:RegisterDefaults('profile', {fontSize = 16}) function Hitman:OnEnable() self:RegisterEvent("PLAYER_ENTER_COMBAT") self:RegisterEvent("PLAYER_LEAVE_COMBAT") self:RegisterEvent("SPECIAL_ALTKEY_DOWN", "AltDrag") self:RegisterEvent("SPECIAL_ALTKEY_UP", "AltDrag") end function Hitman:OnInitialize() local frame = CreateFrame("MessageFrame", "HitmanFrame", UIParent) local f, _, _ = GameFontHighlightSmall:GetFont() frame:SetFont(f, self.db.profile.fontSize) frame:SetWidth(100) frame:SetHeight(20) frame:SetPoint("CENTER", UIParent, "CENTER") frame:SetFrameStrata("LOW") frame:SetTimeVisible(1) frame:SetMovable(true) frame:RegisterForDrag("LeftButton") frame:SetScript("OnDragStart",function() this:StartMoving() end) frame:SetScript("OnDragStop",function() this:StopMovingOrSizing() end) end function Hitman:PLAYER_ENTER_COMBAT() if not self.inCombat then self.inCombat = true self:Output("|cffff0000+Attack|r") end end function Hitman:PLAYER_LEAVE_COMBAT() if self.inCombat then self.inCombat = false self:Output("|cffffff00-Attack|r") end end function Hitman:Output(text) if MikSBT then MikSBT.DisplayMessage(text, MikSBT.DISPLAYTYPE_NOTIFICATION, false) elseif SCT_Display then SCT_Display(text) else HitmanFrame:AddMessage(text, 1, 0, 0) end end function Hitman:AltDrag() if AltKeyIsDown() then frame:EnableMouse(true) else frame:EnableMouse(false) end end