View Single Post
11-03-11, 01:50 PM   #1
unlimit
Lookin' Good
 
unlimit's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 484
Updated Cooldowns (Engine/Feature)

In \RDX\RosterMgr\Cooldown\Core.lua it reads:

-- A cooldown database is created using the registererCoodldown(spellid, duration, group) function
-- -> the duration is not really accurate, because some duration could change with talent + glyph
-- A local engine will store real cooldown per character (duration + timeleft)
-- this local engine is sync with all members of the raid
If we use GetSpellCooldown, though, we can find out the duration left on any (personal) ability. I'm not too sure if it works outside of just the player uid.

Using this, wouldn't it be possible to change the cooldown variable in \RDX\Designs\Variables\CooldownVariables.lua to refelct something like this?

Code:
local name = GetSpellInfo(12043);
local start, duration, enabled = GetSpellCooldown(name);
if enabled == 0 then
	DEFAULT_CHAT_FRAME:AddMessage(.. name .. " is currently active, use it and wait " .. duration .. " seconds for the next one.");
elseif ( start > 0 and duration > 1.5) then
	DEFAULT_CHAT_FRAME:AddMessage(.. name .. " is cooling down, wait " .. (start + duration - GetTime()) .. " seconds for the next one.");
else
	DEFAULT_CHAT_FRAME:AddMessage(.. name .. " is ready.");
end
How \RDX\RosterMgr\Cooldown\Core.lua could possibly be changed:

Code:
function RDXCD.RegisterCooldown(race, boss, class, talent, spellid, dduration, group, event)
	if not spellid then VFL.print(VFLI.i18n("|cFFFF0000[RDX]|r Info : Attempt to register an anonymous omni cooldown.")); return; end
	if cd[spellid] then VFL.print(VFLI.i18n("|cFFFF0000[RDX]|r Info : Attempt to register duplicate object type ") .. spellid .. "."); return; end 
	local spellname, _, icon = GetSpellInfo(spellid);
	if not spellname then VFL.print(VFLI.i18n("|cFFFF0000[RDX]|r Info : unknown spellid ") .. spellid .. "."); return; end
	local start, duration, enabled = GetSpellCooldown(spellname);
	if not dduration then dduration = duration; end
	-- Duration Defined:  RDXCD.RegisterCooldown(nil, nil, "PALADIN", nil, 85673, 20, nil, "SPELL_CAST_SUCCESS");
	-- Duration Default:  RDXCD.RegisterCooldown(nil, nil, "PALADIN", nil, 85673, nil, nil, "SPELL_CAST_SUCCESS");
	local text = "";
	if race then text = text .. race .. ":"; end
	if boss then text = text .. boss .. ":"; end
	if class then text = text .. class .. ":"; end
	if talent then text = text .. talent .. ":"; end
	text = text .. spellname;
	local cdtemp = {
		text = text;
		race = race;
		class = class;
		talent = talent;
		spellid = spellid;
		spellname = spellname;
		start = start;
		duration = dduration;
		enabled = enabled;
		icon = icon;
		group = group;
	};
	cd[spellid] = cdtemp;
	if boss then cdb[spellid] = cdtemp; end
	if talent then cdt[spellid] = cdtemp; end
	if not talent and not boss then cdc[spellid] = cdtemp; end
	if event ==  "SPELL_CAST_SUCCESS" then cdcastspell[spellid] = true;
	elseif event ==  "SPELL_DAMAGE" then cddmgspell[spellid] = true;
	elseif event ==  "SPELL_HEAL" then cdhealspell[spellid] = true;
	elseif event ==  "SPELL_AURA_APPLIED" then cdauraAspell[spellid] = true;
	elseif event ==  "SPELL_AURA_REMOVED" then cdauraRspell[spellid] = true;
	elseif event ==  "SPELL_RESURRECT" then cdresuspell[spellid] = true;
	elseif event ==  "SPELL_SUMMON" then cdsumspell[spellid] = true;
	end
	return true;
end
I realize that the "duration defined" bit is not correct LUA, it was just there as an example: it's pretty easy to realize what it means, but just in case:

If a time is defined on a cooldown, ie:
Code:
RDXCD.RegisterCooldown(nil, nil, "PALADIN", nil, 85673, 20, nil, "SPELL_CAST_SUCCESS");
Then that time will be used instead.

If a time is NOT defined on a cooldown, ie:
Code:
RDXCD.RegisterCooldown(nil, nil, "PALADIN", nil, 85673, nil, nil, "SPELL_CAST_SUCCESS");
Then the duration from:
Code:
local start, duration, enabled = GetSpellCooldown(spellname);
Should be used instead.
__________________


kúdan: im playing pantheon
JRCapablanca: no youre not
** Pantheon has been Banned. **

Last edited by unlimit : 11-03-11 at 06:51 PM.
  Reply With Quote