All pastes #95023 Raw Edit

Unnamed

public text v1 · immutable
#95023 ·published 2006-07-21 18:36 UTC
rendered paste body
Hitman = AceLibrary("AceAddon-2.0"):new("AceEvent-2.0", "AceConsole-2.0")
function Hitman:OnEnable()
        self:RegisterEvent("PLAYER_ENTER_COMBAT")
        self:RegisterEvent("PLAYER_LEAVE_COMBAT")
end
local frame
function Hitman:OnInitialize()
        local frame = CreateFrame("MessageFrame", "HitmanFrame", UIParent)
        frame:SetWidth(100)
        frame:SetHeight(20)
        frame:SetPoint("CENTER", UIParent, "CENTER")
        frame:SetFontObject(NumberFontNormal)
        frame:SetFrameStrata("LOW")
        frame:SetTimeVisible(1)
        frame:RegisterForDrag("LeftButton")
	frame:SetScript("OnDragStart",function() self:OnDragStart(arg1) end)
	frame:SetScript("OnDragStop",function() self:OnDragStop(arg1) end)
end
 
function Hitman:PLAYER_ENTER_COMBAT()
        if not self.inCombat then
                self.inCombat = true
        end
        self:Output("|cffff0000Aggressive|r")
end
 
function Hitman:PLAYER_LEAVE_COMBAT()
        if self.inCombat then
                self.inCombat = false
         end
        self:Output("|cffffff00Passive|r")
end
function Hitman:Output(text)
        if MikSBT then
                MikSBT.DisplayMessage(text, MikSBT.DISPLAYTYPE_NOTIFICATION, false)
        elseif SCT_Display then
                SCT_Display(text)
        else
                frame:AddMessage(text, 1, 0, 0)
        end
end

function Hitman:OnDragStart(button)
	if ( button == "LeftButton" ) and locked == false then
		self.frame:StartMoving()
	end
end

function Hitman:OnDragStop(button)
	self.frame:StopMovingOrSizing()
end