All pastes #104506 Raw Edit

cladhaire

public text v1 · immutable
#104506 ·published 2006-07-28 22:45 UTC
rendered paste body
-- Create a new plugin for Clique, with the shortname "test"
local Plugin = Clique:NewModule("selfcast")
Plugin.fullname = "Cast-on-self"

-- Plugin:Test() is called anytime the mod tries to enable.  It is optional
-- but it will be checked if it exists.  Will typically be based off some global
-- or the state of the addon itself.
local SELF_CLICKS = "Cast-on-self"

function Plugin:OnEnable()
    Clique.db.char[SELF_CLICKS] = Clique.db.char[SELF_CLICKS] or {}
end

function Plugin:_OnClick(button, unit)
    unit = unit or Clique.unit
    local friendly = Clique:GetFriendlyUnit(unit)

    if unit == "player" or friendly == "player" then   
        Clique.set = SELF_CLICKS
        return true
    end
end