oRA_Cooldowns= oRA_CoreModuleClass:new({ type = "cooldown", name = oRA_COOLDOWNS_NAME, desc = oRA_COOLDOWNS_DESCRIPTION, cmdOptions = oRA_COOLDOWNS_CMD_OPTIONS, --db = AceDbClass:new("oRA_Cooldowns"), spell = nil, SSCasting = nil, ResCasting = nil, InnCasting = nil, Enable = function(self) local _, c = UnitClass("player") if(c == "DRUID" or c == "WARLOCK") then self:RegisterEvent("SPELLCAST_START") self:RegisterEvent("SPELLCAST_INTERRUPTED", "spellFailed") self:RegisterEvent("SPELLCAST_FAILED", "spellFailed") self:RegisterEvent("SPELLCAST_STOP") self:RegisterEvent("CHAT_MSG_SPELL_SELF_BUFF", "buffCast") self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS", "buffGain") if c == "WARLOCK" then self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_FRIENDLYPLAYER_BUFFS", "checkSummon") self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS", "checkSummon") self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_PARTY_BUFFS", "checkSummon") end elseif (c == "SHAMAN") then self:Hook("UseSoulstone") end end, Disable = function(self) self:UnregisterAllEvents() end, buffCast = function(self) self.spell = arg1 if ( self.spell == oRA_COOLDOWNS_CONST.Spells.CastInnervate ) then self.InnCasting = 1 end end, buffGain = function(self) if (self.InnCasting) then self.spell = arg1 if ( self.spell == oRA_COOLDOWNS_CONST.Spells.GainInnervate ) then self.InnCasting = nil self.spell = nil oRA_Core:Send("CD 4 6") end end end, SPELLCAST_START = function(self) self.spell = arg1 if ( self.spell == oRA_COOLDOWNS_CONST.Spells.Soulstone ) then self.SSCasting = 1 elseif ( self.spell == oRA_COOLDOWNS_CONST.Spells.Rebirth ) then self.ResCasting = 1 end end, SPELLCAST_STOP = function(self) if ( self.spell == oRA_COOLDOWNS_CONST.Spells.Rebirth ) then self.ResCasting = nil self.spell = nil oRA_Core:Send("CD 1 30") end end, spellFailed = function(self) if ( self.spell == oRA_COOLDOWNS_CONST.Spells.Rebirth ) then self.ResCasting = nil end if ( self.spell == oRA_COOLDOWNS_CONST.Spells.Soulstone ) then self.SSCasting = nil end end, UseSoulstone = function(self) local text = HasSoulstone() if ( text and text == oRA_COOLDOWNS_CONST.Spells.Ankh ) then local cooldown for i = 1, GetNumTalentTabs(), 1 do for y = 1, GetNumTalents(i), 1 do local name, _, _, _, currRank = GetTalentInfo(i, y) if ( name == oRA_COOLDOWNS_CONST.Talent.ImpAnkh ) then cooldown = 60 - (currRank*10) break end end if ( cooldown ) then break end end if ( not cooldown ) then cooldown = 60 end oRA_Core:Send("CD 2 " .. cooldown) end self.Hooks["UseSoulstone"].orig() end, checkSummon = function(self) if(self.SSCasting)then if(string.find(arg1, oRA_COOLDOWNS_CONST.Pattern.GainSS) or string.find(arg1, oRA_COOLDOWNS_CONST.Pattern.YouGainSS))then self.spell = nil self.SSCasting = nil oRA_Core:Send("CD 3 30") end end end, ---------------------------- -- Chat -- ---------------------------- }) ---------------------------------- -- Load this bitch up! -- ---------------------------------- oRA_Core:Register(oRA_Cooldowns)