Skip to content

Commit

Permalink
Changes from using RCD during a few raids.
Browse files Browse the repository at this point in the history
- Reduce some debug spam
- Attempt to fix the disable/enable when leaving/joining a raid.
  • Loading branch information
rspeicher committed Apr 27, 2009
1 parent 3cf3285 commit e0723b0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Cooldowns.lua
Expand Up @@ -49,7 +49,7 @@ local cooldowns = {
[GetSpellInfo(64901)] = { id = 64901, cd = 360 }, -- Hymn of Hope
[GetSpellInfo(33206)] = { id = 33206, cd = 180 }, -- Pain Suppression
--@debug@
[GetSpellInfo(48066)] = { id = 48066, cd = 4 }, -- Power Word: Shield (Debug)
--[GetSpellInfo(48066)] = { id = 48066, cd = 4 }, -- Power Word: Shield (Debug)
--@end-debug@
},
["ROGUE"] = {
Expand Down
14 changes: 7 additions & 7 deletions Display.lua
Expand Up @@ -73,20 +73,22 @@ function mod:OnEnable()

optFrame = AceConfig:AddToBlizOptions(L["RaidCooldowns"], L["RaidCooldowns"])

self:UnregisterAllEvents()
self:RegisterEvent("PLAYER_LOGIN")
--self:UnregisterAllEvents()
--self:RegisterEvent("PLAYER_LOGIN")

playerName = UnitName("player")

self:CreateFrame()
self:SetAnchors(true)
self:UpdateDisplay()
end

function mod:OnDisable()
--@debug@
self:Print("OnDisable()")
--@end-debug@

self:UnregisterAllEvents()
--self:UnregisterAllEvents()
barGroup = nil
end

Expand Down Expand Up @@ -136,11 +138,9 @@ end

function mod:PLAYER_LOGIN()
--@debug@
self:Print("PLAYER_LOGIN()")
--self:Print("PLAYER_LOGIN()")
--@end-debug@
self:SetAnchors(true)
self:UpdateDisplay()
self:UnregisterEvent("PLAYER_LOGIN")
--self:UnregisterEvent("PLAYER_LOGIN")
end

--[[ Configuration Methods ]]--
Expand Down
4 changes: 2 additions & 2 deletions ModuleBase.lua
Expand Up @@ -90,11 +90,11 @@ function base:Sync(data, cooldown)
end

--@debug@
self:Print("Sync(", id, cooldown, ")")
--self:Print("Sync(", id, cooldown, ")")
--@end-debug@

--@debug@
RaidCooldowns:SendCommMessage(RaidCooldowns.prefix, (id .. " " .. cooldown), "WHISPER", UnitName("player"))
--RaidCooldowns:SendCommMessage(RaidCooldowns.prefix, (id .. " " .. cooldown), "WHISPER", UnitName("player"))
--@end-debug@
--@non-debug@
RaidCooldowns:SendCommMessage(RaidCooldowns.prefix, (id .. " " .. cooldown), "RAID")
Expand Down
39 changes: 18 additions & 21 deletions RaidCooldowns.lua
Expand Up @@ -7,29 +7,25 @@ local UnitName = _G.UnitName

function RaidCooldowns:OnInitialize()
self:UnregisterAllEvents()
-- self:SetEnabledState(false) -- Enabled when we join a raid
self:SetEnabledState(false) -- Enabled when we join a raid

--@debug@
self:Print("OnInitialize")
--@end-debug@

self.prefix = "RCD2"

self:RegisterEvent("PLAYER_LOGIN")
end

function RaidCooldowns:OnEnable()
self:RegisterComm(self.prefix)
self:RegisterComm("oRA")
self:RegisterComm("CTRA")

self:RegisterEvent("RAID_ROSTER_UPDATE")
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")

-- Logged in or reloaded in a raid; fake a RAID_ROSTER_UPDATE
if UnitInRaid("player") then
self:RAID_ROSTER_UPDATE()
end
end

function RaidCooldowns:OnEnable()
self:RegisterComm(self.prefix)

local name, module
for name, module in self:IterateModules() do
if not module:IsEnabled() then
Expand All @@ -39,22 +35,27 @@ function RaidCooldowns:OnEnable()
end

function RaidCooldowns:OnDisable()
--[[
local name, module
for name, module in self:IterateModules() do
self:DisableModule(name)
end
]]
end

--------------[[ Events ]]--------------

function RaidCooldowns:PLAYER_LOGIN()
-- Logged in or reloaded in a raid; fake a RAID_ROSTER_UPDATE
if UnitInRaid("player") then
self:RAID_ROSTER_UPDATE()
end
end

-- oRA2
do
local inRaid = false
function RaidCooldowns:RAID_ROSTER_UPDATE()
--@debug@
self:Print("RAID_ROSTER_UPDATE")
--@end-debug@

local inRaidNow = UnitInRaid("player")
if not inRaid and inRaidNow then
--@debug@
Expand All @@ -79,9 +80,6 @@ function RaidCooldowns:COMBAT_LOG_EVENT_UNFILTERED(event, _, eventType, _, srcNa
if self.cooldowns[c] then
local spells = self.cooldowns[c]
if spells[spellName] then
--@debug@
self:Print("Starting cooldown from CLEU", srcName, spellName)
--@end-debug@
self:GetModule("Display"):StartCooldown(srcName, spellId, spells[spellName].cd)
return
end
Expand All @@ -95,10 +93,6 @@ end
function RaidCooldowns:OnCommReceived(prefix, msg, distro, sender)
if self:GetModule("Display").db.profile.hideSelf and sender == playerName then return end

--@debug@
self:Print("OnCommReceived(", prefix, msg, distro, sender, ")")
--@end-debug@

local spellId, cooldown = 0, 0

if prefix == "oRA" or prefix == "CTRA" then
Expand All @@ -120,6 +114,9 @@ function RaidCooldowns:OnCommReceived(prefix, msg, distro, sender)
end
end
else
--@debug@
self:Print("OnCommReceived(", prefix, msg, distro, sender, ")")
--@end-debug@
spellId, cooldown = select(3, msg:find("(%d+) (%d+)"))
spellId = tonumber(spellId)
cooldown = tonumber(cooldown)
Expand Down

0 comments on commit e0723b0

Please sign in to comment.