WoWInterface SVN NeedToKnow-Updated

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 113 to Rev 114
    Reverse comparison

Rev 113 → Rev 114

trunk/NeedToKnow/NeedToKnow_Options.lua
728,7 → 728,9
{ Setting = "TOTEM", MenuText = NEEDTOKNOW.BARMENU_TOTEM },
{ Setting = "CASTCD", MenuText = NEEDTOKNOW.BARMENU_CASTCD },
{ Setting = "BUFFCD", MenuText = NEEDTOKNOW.BARMENU_BUFFCD },
{ Setting = "USABLE", MenuText = NEEDTOKNOW.BARMENU_USABLE },
-- Now that Victory Rush adds a buff when you can use it, this confusing option is being removed.
-- The code that drives it remains so that any existing users' bars won't break.
-- { Setting = "USABLE", MenuText = NEEDTOKNOW.BARMENU_USABLE },
{ Setting = "EQUIPSLOT", MenuText = NEEDTOKNOW.BARMENU_EQUIPSLOT },
},
TimeFormat = {
745,6 → 747,7
{ Setting = "vehicle", MenuText = NEEDTOKNOW.BARMENU_VEHICLE },
{ Setting = "mhand", MenuText = NEEDTOKNOW.BARMENU_MAIN_HAND },
{ Setting = "ohand", MenuText = NEEDTOKNOW.BARMENU_OFF_HAND },
{ Setting = "lastraid", MenuText = NEEDTOKNOW.BARMENU_LAST_RAID },
},
DebuffUnit = {
{ Setting = "player", MenuText = NEEDTOKNOW.BARMENU_PLAYER },
trunk/NeedToKnow/NeedToKnow.lua
68,9 → 68,15
},
total = 0
}
NeedToKnow.scratch.bar_entry =
{
idxName = 0,
barSpell = "",
isSpellID = false,
}
-- NEEDTOKNOW = {} is defined in the localization file, which must be loaded before this file
 
NEEDTOKNOW.VERSION = "4.0.02"
NEEDTOKNOW.VERSION = "4.0.03"
NEEDTOKNOW.UPDATE_INTERVAL = 0.05
NEEDTOKNOW.MAXBARS = 20
 
296,7 → 302,7
end
end
 
function NeedToKnow.ExecutiveFrame_UNIT_SPELLCAST_SENT(unit, spell, tgt, serialno)
function NeedToKnow.ExecutiveFrame_UNIT_SPELLCAST_SENT(unit, spell, rank_str, tgt, serialno)
if unit == "player" then
-- TODO: I hate to pay this memory cost for every "spell" ever cast.
-- Would be nice to at least garbage collect this data at some point, but that
310,16 → 316,16
if ( NeedToKnow.last_guid[spell] or NeedToKnow.BarsForPSS ) then
local r = NeedToKnow.last_cast[NeedToKnow.last_cast_tail]
if not r then
r = { spell=spell, target=target, serial=serialno }
r = { spell=spell, target=tgt, serial=serialno }
NeedToKnow.last_cast[NeedToKnow.last_cast_tail] = r
else
r.spell = spell
r.target = target
r.target = tgt
r.serial = serialno
end
NeedToKnow.last_cast_tail = NeedToKnow.last_cast_tail + 1
if ( NeedToKnow.last_cast_tail == 1 ) then
NeedToKnow.last_cast_head = 0
if ( NeedToKnow.last_cast_tail == 2 ) then
NeedToKnow.last_cast_head = 1
if ( NeedToKnow.last_guid[spell] ) then
NeedToKnow_ExecutiveFrame:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED")
NeedToKnow_ExecutiveFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
332,7 → 338,7
end
 
 
function NeedToKnow.ExecutiveFrame_UNIT_SPELLCAST_SUCCEEDED(unit, spell, serialno, spellid)
function NeedToKnow.ExecutiveFrame_UNIT_SPELLCAST_SUCCEEDED(unit, spell, rank_str, serialno, spellid)
if unit == "player" then
local found
local t = NeedToKnow.last_cast
344,17 → 350,19
break
end
end
 
if found then
if ( NeedToKnow.BarsForPSS ) then
local bar,one
for bar,one in pairs(NeedToKnow.BarsForPSS) do
NeedToKnow.Bar_OnEvent(bar, "PLAYER_SPELLCAST_SUCCEEDED", spell, spellid, t[i].target);
local unitTarget = NeedToKnow.raid_members[t[found].target or ""]
NeedToKnow.Bar_OnEvent(bar, "PLAYER_SPELLCAST_SUCCEEDED", "player", spell, spellid, unitTarget);
end
end
 
if ( found == last ) then
NeedToKnow.last_cast_tail = 0
NeedToKnow.last_cast_head = 0
NeedToKnow.last_cast_tail = 1
NeedToKnow.last_cast_head = 1
NeedToKnow_ExecutiveFrame:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED")
else
NeedToKnow.last_cast_head = found+1
384,7 → 392,8
if ( NeedToKnow.BarsForPSS ) then
local bar,one
for bar,one in pairs(NeedToKnow.BarsForPSS) do
NeedToKnow.Bar_OnEvent(bar, "PLAYER_SPELLCAST_SUCCEEDED", spell, spellid, t[i].target);
local unitTarget = NeedToKnow.raid_members[t[found].target or ""]
NeedToKnow.Bar_OnEvent(bar, "PLAYER_SPELLCAST_SUCCEEDED", "player", spell, spellid, unitTarget);
end
end
 
402,8 → 411,8
end
 
if ( found == last ) then
NeedToKnow.last_cast_tail = 0
NeedToKnow.last_cast_head = 0
NeedToKnow.last_cast_tail = 1
NeedToKnow.last_cast_head = 1
NeedToKnow_ExecutiveFrame:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
else
NeedToKnow.last_cast_head = found+1
420,8 → 429,8
end
 
NeedToKnow.last_cast = {} -- [n] = { spell, target, serial }
NeedToKnow.last_cast_head = 0
NeedToKnow.last_cast_tail = 0
NeedToKnow.last_cast_head = 1
NeedToKnow.last_cast_tail = 1
NeedToKnow.last_guid = {} -- [spell][guidTarget] = { time, dur, expiry }
NeedToKnow.totem_drops = {} -- array 1-4 of precise times the totems appeared
NeedToKnow.weapon_enchants = { mhand = {}, ohand = {} }
451,6 → 460,8
NeedToKnow_ExecutiveFrame:RegisterEvent("UNIT_TARGET")
NeedToKnow_ExecutiveFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
NeedToKnow_ExecutiveFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
NeedToKnow_ExecutiveFrame:RegisterEvent("PARTY_MEMBERS_CHANGED")
 
if ( NeedToKnow.is_DK ) then
NeedToKnow.RegisterSpellcastSent();
end
462,6 → 473,7
NeedToKnow.ExecutiveFrame_PLAYER_LOGIN = nil
NeedToKnowLoader = nil
 
NeedToKnow.RefreshRaidMemberNames()
NeedToKnow.UpdateWeaponEnchants()
end
 
525,6 → 537,38
end
 
 
function NeedToKnow.RefreshRaidMemberNames()
NeedToKnow.raid_members = {}
 
if GetNumRaidMembers() > 0 then
for i = 1, 40 do
local unit = "raid"..i
local name = UnitName(unit)
if ( name ) then NeedToKnow.raid_members[name] = unit end
end
elseif GetNumPartyMembers() > 0 then
for i = 1, 5 do
local unit = "party"..i
local name = UnitName(unit)
if ( name ) then NeedToKnow.raid_members[name] = unit end
end
end
local unit = "player"
local name = UnitName(unit)
NeedToKnow.raid_members[name] = unit
unit = "pet"
name = UnitName(unit)
if ( name ) then
NeedToKnow.raid_members[name] = unit
end
end
 
 
function NeedToKnow.ExecutiveFrame_PARTY_MEMBERS_CHANGED()
NeedToKnow.RefreshRaidMemberNames();
end
 
 
function NeedToKnow.ExecutiveFrame_PLAYER_REGEN_DISABLED(unitTargeting)
NeedToKnow.bInCombat = true
NeedToKnow.bCombatWithBoss = false
1138,6 → 1182,8
bar.cd_functions[idx] = NeedToKnow.GetSpellCooldown
elseif not GetSpellCooldown(name) then
bar.cd_functions[idx] = NeedToKnow.GetUnresolvedCooldown
else
bar.cd_functions[idx] = NeedToKnow.GetSpellCooldown
end
end
end
1257,6 → 1303,7
bar.cd_functions = {}
local iSpell = 0
for barSpell in bar.auraName:gmatch("([^,]+)") do
iSpell = iSpell+1
barSpell = strtrim(barSpell)
local _, nDigits = barSpell:find("^%d+")
if ( nDigits == barSpell:len() ) then
1264,7 → 1311,6
else
table.insert(bar.spells, { idxName=iSpell, name=barSpell } )
end
iSpell = iSpell+1
end
 
-- split the user name overrides
1280,6 → 1326,7
bar.reset_start = {}
iSpell = 0
for resetSpell in barSettings.buffcd_reset_spells:gmatch("([^,]+)") do
iSpell = iSpell+1
resetSpell = strtrim(resetSpell)
local _, nDigits = resetSpell:find("^%d+")
if ( nDigits == resetSpell:len() ) then
1420,7 → 1467,7
bar:RegisterEvent("SPELL_UPDATE_USABLE")
elseif ( "mhand" == bar.settings.Unit or "ohand" == bar.settings.Unit ) then
bar:RegisterEvent("UNIT_INVENTORY_CHANGED")
elseif ( bar.unit == "targettarget" ) then
elseif ( bar.settings.Unit == "targettarget" ) then
-- WORKAROUND: PLAYER_TARGET_CHANGED happens immediately, UNIT_TARGET every couple seconds
bar:RegisterEvent("PLAYER_TARGET_CHANGED")
bar:RegisterEvent("UNIT_TARGET")
1434,6 → 1481,12
bar:RegisterEvent("PLAYER_TARGET_CHANGED")
elseif ( bar.unit == "pet" ) then
bar:RegisterEvent("UNIT_PET")
elseif ( "lastraid" == bar.settings.Unit ) then
if ( not NeedToKnow.BarsForPSS ) then
NeedToKnow.BarsForPSS = {}
end
NeedToKnow.BarsForPSS[bar] = true
NeedToKnow.RegisterSpellcastSent()
end
end
 
1551,9 → 1604,16
elseif ( event == "UNIT_PET" and unit == "player" ) then
NeedToKnow.Bar_AuraCheck(self)
elseif ( event == "PLAYER_SPELLCAST_SUCCEEDED" ) then
--if ( self.settings.Unit == "lastcast" ) then
 
--end
local spellName, spellID, tgt = select(1,...)
local i,entry
for i,entry in ipairs(self.spells) do
if entry.id == spellID or entry.name == spellName then
self.unit = tgt or "unknown"
--trace("Updating",self:GetName(),"since it was recast on",self.unit)
NeedToKnow.Bar_AuraCheck(self)
break;
end
end
elseif ( event == "START_AUTOREPEAT_SPELL" ) then
self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
elseif ( event == "STOP_AUTOREPEAT_SPELL" ) then
1660,7 → 1720,9
 
function NeedToKnow.PrettyName(barSettings)
if ( barSettings.BuffOrDebuff == "EQUIPSLOT" ) then
return NEEDTOKNOW.ITEM_NAMES[tonumber(barSettings.AuraName)]
local idx = tonumber(barSettings.AuraName)
if idx then return NEEDTOKNOW.ITEM_NAMES[idx] end
return ""
else
return barSettings.AuraName
end
2163,7 → 2225,7
local idxName = bar_entry.idxName
local func = bar.cd_functions[idxName]
if ( not func ) then
trace("ERROR setting up index",idxName,"on bar",bar:GetName(),bar.settings.AuraName);
print("NTK ERROR setting up index",idxName,"on bar",bar:GetName(),bar.settings.AuraName);
return;
end
local start, cd_len, should_cooldown, buffName, iconPath = func(bar, bar_entry)
2316,7 → 2378,6
else
local buffName, _ , iconPath, count, _, duration, expirationTime, caster
= UnitAura(bar.unit, bar_entry.name, nil, filter)
 
AddInstanceToStacks( all_stacks, bar_entry,
duration, -- duration
buffName, -- name
2368,6 → 2429,8
bUnitExists = true
elseif "player" == settings.Unit then
bUnitExists = true
elseif "lastraid" == settings.Unit then
bUnitExists = bar.unit and UnitExists(bar.unit)
else
bUnitExists = UnitExists(settings.Unit)
end
2445,14 → 2508,16
local r = NeedToKnow.last_guid[buffName]
 
if ( not r[guidTarget] ) then -- Should only happen from /reload or /ntk while the aura is active
trace("WARNING! allocating guid slot for ", buffName, "on", guidTarget, "due to UNIT_AURA");
-- This went off for me, but I don't know a repro yet. I suspect it has to do with bear/cat switching
--trace("WARNING! allocating guid slot for ", buffName, "on", guidTarget, "due to UNIT_AURA");
r[guidTarget] = { time=curStart, dur=duration, expiry=expirationTime }
else
r = r[guidTarget]
local oldExpiry = r.expiry
if ( oldExpiry > 0 and oldExpiry < curStart ) then
trace("WARNING! stale entry for ",buffName,"on",guidTarget,curStart-r.time,curStart-oldExpiry)
end
-- This went off for me, but I don't know a repro yet. I suspect it has to do with bear/cat switching
--if ( oldExpiry > 0 and oldExpiry < curStart ) then
--trace("WARNING! stale entry for ",buffName,"on",guidTarget,curStart-r.time,curStart-oldExpiry)
--end
 
if ( oldExpiry < curStart ) then
r.time = curStart
trunk/NeedToKnow/NeedToKnow_Localization.lua
52,6 → 52,7
NEEDTOKNOW.BARMENU_VEHICLE = "Vehicle";
NEEDTOKNOW.BARMENU_TARGETTARGET = "Target of Target";
NEEDTOKNOW.BARMENU_BUFFORDEBUFF = "Bar Type";
NEEDTOKNOW.BARMENU_LAST_RAID = "Last Raid Recipient";
NEEDTOKNOW.BARMENU_SPELLID = "Use SpellID";
NEEDTOKNOW.BARMENU_HELPFUL = "Buff";
NEEDTOKNOW.BARMENU_HARMFUL = "Debuff";