SuperSelfCast = {}

    SuperSelfCast.Obj = AceAddon:new({
    name          = "SuperSelfCast",
    version       = "1.4",
    releaseDate   = "10-02-2005",
    aceCompatible = 102,
    author        = "Thalinon, template by Neriak",
    email         = "bunjiro@gmail.com",
    category      = "combat",     
    defaults      = {},
    cmd           = AceChatCmd:new({"/superselfcast", "/ssc"}, {}),

	Enable = function(self)
		self:Hook("UseAction")
	end,

UseAction = function (self, id, type, me)
   self:CallHook("UseAction", id, type, me) 		      
        if(UnitExists("target")) then
            if(UnitIsFriend("player","target") and SpellIsTargeting() and SpellCanTargetUnit("player")) then
                UIErrorsFrame:AddMessage(ERR_SPELL_OUT_OF_RANGE, 1.0, 0.1, 0.1, 1.0, 1)
                SpellStopTargeting()
            elseif(not UnitIsFriend("player","target") and SpellIsTargeting() and SpellCanTargetUnit("player")) then
                SpellTargetUnit("player")
            end
        elseif(SpellIsTargeting() and SpellCanTargetUnit("player")) then
            SpellTargetUnit("player")		
        end
		end
})

  SuperSelfCast.Obj:RegisterForLoad()



