All pastes #30800 Raw Edit

Something

public text v1 · immutable
#30800 ·published 2005-11-24 00:55 UTC
rendered paste body
--[[
	----------------------------------------------------------------------
	AceAdlibber

	By Tasaxkal / Paz <Doomcraft> (Daggerspine) {Europe}
	----------------------------------------------------------------------
	Description:

	This mod is designed to create some general combat "chatter" while
	the player is executing their special skills and using items etc.
	e.g. when casting fireball, you might declare in /say "Firum Ballum!"

	If you like this mod, feel free to reward me in any way you see fit.
	Money / Items in game, money / gifts in real life, or even just a good
	old thanks go a long way!
	----------------------------------------------------------------------
	Usage:
		"/adlib enable|disable|toggle" to change the state of the mod
		"/adlib cooldown <X>" sets the min-time between chatter.
		"/adlib prechatter <X>" sets the % chance of pre-chatter.
		"/adlib postchatter <x>" sets the % chance of post-chatter.
		"/adlib exclusion on|off" turns on / off exclusion mode
	----------------------------------------------------------------------
	Version History:
	v0.6.1800
		Updated to Latest Blizzard Patch
	v0.5.1300
		Added AdLibber_Exclusion_Mode - won't trigger a post if the
		 pre-text triggered.
		Correctly checks for cooldown on the actionbutton itself.
		Added 'Ignore_Cooldown' option. (so you can have rare spells
		 with their own large cooldowns always do their thing, even
		 if other spells wouldn't 'chatter' yet.)
	v0.4.1300
		Added 'Chance' for Pre and Post chatter
		Added 'Always_Chatter' chance for skill declarations
		Note: Cooldown overrides always trigger which overrides chance
		 thus, Always_Chatter with a Pre will mean no Post event ever.
	v0.3.1300
		Moved tooltip abuse into its own custom tooltip (away from the
		 shopping tooltips which were being abused before)
	v0.2.1300
		Scrapped SPELLCAST_START as it isn't called for instant casts.
		Added a hook to UseAction (the function for clicking buttons)
		Tooltip abuse used to extract the skill-name (!!) and trigger
		 the correct start phrase(s) where needed.
		UseAction is a pain to use - having to pre-define which rules
		 to check for which action.
	v0.1.1300
		Hooked events SPELLCAST_START and SPELLCAST_STOP
		Added Slashcommand "/adlib"
		Table-Layout defined for skills and classes.
	----------------------------------------------------------------------
	Plans:
		Save the adlibber texts
		slashcommands for adding and removing
		UI Frame Config?
		Channelling spells? (murmuring while channeling)
		Interrupted spells?
		Reuse SPELLCAST_START for tradeskills?
		Inventory Items
	----------------------------------------------------------------------
]]

AceAdlibber = {}

if not ace:LoadTranslation("AceAdlibber") then

    AceAdlibber.Const = {

        ChatCmd = { "/adlib" },

        ChatOpt = {
            {
                option = "options",
                desc = "set mod options.",
                method = "Options",
                args = {
                    {
                        option = "help",
                        desc = "set up the adlibber options, e.g. cooldown, phrases."
                    }
                }
            }
        },
        Title = "AceAdlibber",
        Version = "v0.6.1800",
        Desc = "Adds random skill-based chatter to your character.",
        Chat = {
            Enable = "Adlibber enabled",
            Disable = "Adlibber disabled"
        }
    }

end

local const = AceAdlibber.Const

AceAdlibber.Obj = AceAddon:new({
        name          = const.Title,
        description   = const.Desc,
        version       = const.Version,
        releaseDate   = "11-19-2005",
        aceCompatible = "102",
        author        = "Tasaxkal / Paz",
        email         = "wowaddons@matryx.org.uk",
        website       = "http://",
        category      = "others",
        optionsFrame  = "AceAdlibberOptionsFrame",
        db            = AceDatabase:new("AceAdlibberDB"),
        defaults      = const.Defaults,
        cmd           = AceChatCmd:new(const.ChatCmd, const.ChatOpt),


        Initialize = function(self)
        end,

        Enable = function(self)
            self:RegisterEvent("SPELLCAST_STOP")
            self:Set("LastAdlib",0)
            self:Msg(const.Chat.Enable)
            self:Hook("UseAction","OnUseAction")
        end,

        Disable = function(self)
            self:UnregisterEvent("SPELLCAST_STOP")
            self:Set("LastAdlib",0)
            self:Msg(const.Chat.Disable)
        end,

        Options = function(self)
        end,

        OnUseAction = function(a,b,c)
            ace:print("testing")
            self:CallHook("UseAction",a,b,c)
        end
    })


    AceAdlibber.Obj:RegisterForLoad()

ace:RegisterFunctions(AceAdlibber.Obj, {
   version = 1.0,

--<< ================================================= >>--
-- Page I: The Addon Closures.                           --
--<< ================================================= >>--

   Msg   = function(self, ...)
      self.cmd:msg(unpack(arg))
   end,
   Get   = function(self, var)
      return self.db:get(self.profilePath, var)
   end,
   Set   = function(self, var, val)
      self.db:set(self.profilePath, var, val)
   end,
   Reset = function(self, i)
      if i == "" then self:Msg(ACEG_RESETINFO,
                               self.cmd._cmdList[1])
      else self:Msg(ACEG_DORESET)
         self.db:reset(self.profilePath,
                       self.defaults)
      end
   end,

--<< ================================================= >>--
-- Page II: The String Handlers.                        --
--<< ================================================= >>--

   ExecuteChatCommand = function(...)
      if not DEFAULT_CHAT_FRAME then return end
      DEFAULT_CHAT_FRAME.editBox:SetText(ace.concat(arg))
      ChatEdit_SendText(DEFAULT_CHAT_FRAME.editBox)
   end

--<< ================================================= >>--
-- Page Omega: Closure.                                  --
--<< ================================================= >>--

})