WoWInterface SVN NeedToKnow-Updated

Compare Revisions

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

Rev 114 → Rev 113

trunk/NeedToKnow/NeedToKnow_Options.lua
728,9 → 728,7
{ Setting = "TOTEM", MenuText = NEEDTOKNOW.BARMENU_TOTEM },
{ Setting = "CASTCD", MenuText = NEEDTOKNOW.BARMENU_CASTCD },
{ Setting = "BUFFCD", MenuText = NEEDTOKNOW.BARMENU_BUFFCD },
-- 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 = "USABLE", MenuText = NEEDTOKNOW.BARMENU_USABLE },
{ Setting = "EQUIPSLOT", MenuText = NEEDTOKNOW.BARMENU_EQUIPSLOT },
},
TimeFormat = {
747,7 → 745,6
{ 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,15 → 68,9
},
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.03"
NEEDTOKNOW.VERSION = "4.0.02"
NEEDTOKNOW.UPDATE_INTERVAL = 0.05
NEEDTOKNOW.MAXBARS = 20
 
302,7 → 296,7
end
end
 
function NeedToKnow.ExecutiveFrame_UNIT_SPELLCAST_SENT(unit, spell, rank_str, tgt, serialno)
function NeedToKnow.ExecutiveFrame_UNIT_SPELLCAST_SENT(unit, spell, 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
316,16 → 310,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=tgt, serial=serialno }
r = { spell=spell, target=target, serial=serialno }
NeedToKnow.last_cast[NeedToKnow.last_cast_tail] = r
else
r.spell = spell
r.target = tgt
r.target = target
r.serial = serialno
end
NeedToKnow.last_cast_tail = NeedToKnow.last_cast_tail + 1
if ( NeedToKnow.last_cast_tail == 2 ) then
NeedToKnow.last_cast_head = 1
if ( NeedToKnow.last_cast_tail == 1 ) then
NeedToKnow.last_cast_head = 0
if ( NeedToKnow.last_guid[spell] ) then
NeedToKnow_ExecutiveFrame:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED")
NeedToKnow_ExecutiveFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
338,7 → 332,7
end
 
 
function NeedToKnow.ExecutiveFrame_UNIT_SPELLCAST_SUCCEEDED(unit, spell, rank_str, serialno, spellid)
function NeedToKnow.ExecutiveFrame_UNIT_SPELLCAST_SUCCEEDED(unit, spell, serialno, spellid)
if unit == "player" then
local found
local t = NeedToKnow.last_cast
350,19 → 344,17
break
end
end
 
if found then
if ( NeedToKnow.BarsForPSS ) then
local bar,one
for bar,one in pairs(NeedToKnow.BarsForPSS) do
local unitTarget = NeedToKnow.raid_members[t[found].target or ""]
NeedToKnow.Bar_OnEvent(bar, "PLAYER_SPELLCAST_SUCCEEDED", "player", spell, spellid, unitTarget);
NeedToKnow.Bar_OnEvent(bar, "PLAYER_SPELLCAST_SUCCEEDED", spell, spellid, t[i].target);
end
end
 
if ( found == last ) then
NeedToKnow.last_cast_tail = 1
NeedToKnow.last_cast_head = 1
NeedToKnow.last_cast_tail = 0
NeedToKnow.last_cast_head = 0
NeedToKnow_ExecutiveFrame:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED")
else
NeedToKnow.last_cast_head = found+1
392,8 → 384,7
if ( NeedToKnow.BarsForPSS ) then
local bar,one
for bar,one in pairs(NeedToKnow.BarsForPSS) do
local unitTarget = NeedToKnow.raid_members[t[found].target or ""]
NeedToKnow.Bar_OnEvent(bar, "PLAYER_SPELLCAST_SUCCEEDED", "player", spell, spellid, unitTarget);
NeedToKnow.Bar_OnEvent(bar, "PLAYER_SPELLCAST_SUCCEEDED", spell, spellid, t[i].target);
end
end
 
411,8 → 402,8
end
 
if ( found == last ) then
NeedToKnow.last_cast_tail = 1
NeedToKnow.last_cast_head = 1
NeedToKnow.last_cast_tail = 0
NeedToKnow.last_cast_head = 0
NeedToKnow_ExecutiveFrame:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
else
NeedToKnow.last_cast_head = found+1
429,8 → 420,8
end
 
NeedToKnow.last_cast = {} -- [n] = { spell, target, serial }
NeedToKnow.last_cast_head = 1
NeedToKnow.last_cast_tail = 1
NeedToKnow.last_cast_head = 0
NeedToKnow.last_cast_tail = 0
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 = {} }
460,8 → 451,6
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
473,7 → 462,6
NeedToKnow.ExecutiveFrame_PLAYER_LOGIN = nil
NeedToKnowLoader = nil
 
NeedToKnow.RefreshRaidMemberNames()
NeedToKnow.UpdateWeaponEnchants()
end
 
537,38 → 525,6
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
1182,8 → 1138,6
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
1303,7 → 1257,6
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
1311,6 → 1264,7
else
table.insert(bar.spells, { idxName=iSpell, name=barSpell } )
end
iSpell = iSpell+1
end
 
-- split the user name overrides
1326,7 → 1280,6
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
1467,7 → 1420,7
bar:RegisterEvent("SPELL_UPDATE_USABLE")
elseif ( "mhand" == bar.settings.Unit or "ohand" == bar.settings.Unit ) then
bar:RegisterEvent("UNIT_INVENTORY_CHANGED")
elseif ( bar.settings.Unit == "targettarget" ) then
elseif ( bar.unit == "targettarget" ) then
-- WORKAROUND: PLAYER_TARGET_CHANGED happens immediately, UNIT_TARGET every couple seconds
bar:RegisterEvent("PLAYER_TARGET_CHANGED")
bar:RegisterEvent("UNIT_TARGET")
1481,12 → 1434,6
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
 
1604,16 → 1551,9
elseif ( event == "UNIT_PET" and unit == "player" ) then
NeedToKnow.Bar_AuraCheck(self)
elseif ( event == "PLAYER_SPELLCAST_SUCCEEDED" ) then
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
--if ( self.settings.Unit == "lastcast" ) then
 
--end
elseif ( event == "START_AUTOREPEAT_SPELL" ) then
self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
elseif ( event == "STOP_AUTOREPEAT_SPELL" ) then
1720,9 → 1660,7
 
function NeedToKnow.PrettyName(barSettings)
if ( barSettings.BuffOrDebuff == "EQUIPSLOT" ) then
local idx = tonumber(barSettings.AuraName)
if idx then return NEEDTOKNOW.ITEM_NAMES[idx] end
return ""
return NEEDTOKNOW.ITEM_NAMES[tonumber(barSettings.AuraName)]
else
return barSettings.AuraName
end
2225,7 → 2163,7
local idxName = bar_entry.idxName
local func = bar.cd_functions[idxName]
if ( not func ) then
print("NTK ERROR setting up index",idxName,"on bar",bar:GetName(),bar.settings.AuraName);
trace("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)
2378,6 → 2316,7
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
2429,8 → 2368,6
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
2508,16 → 2445,14
local r = NeedToKnow.last_guid[buffName]
 
if ( not r[guidTarget] ) then -- Should only happen from /reload or /ntk while the aura is active
-- 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");
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
-- 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 > 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,7 → 52,6
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";