WoWInterface SVN zz_DaVis

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 6 to Rev 7
    Reverse comparison

Rev 6 → Rev 7

trunk/zz_DaVis/core.lua
1,21 → 1,95
local name, addon = ...
 
local cTip = CreateFrame("GameTooltip",name.."Tooltip",nil,"GameTooltipTemplate")
local defaults,dmginc,options,db,data,guid,sp = {
},{}
local prefix = {"SWING","RANGE","SPELL","SPELL_PERIODIC","SPELL_BUILDING","ENVIRONMENTAL"}
local suffix = {"DAMAGE","HEAL"}
local subevents = {}
local healers = {}
local spamDelay = 10
local spamShow = false
local realm = GetRealmName()
local tank = UnitName("player")
local taunts = {
['355'] = true, -- Warrior taunt
['49576'] = true, -- DK death grip
['56222'] = true, -- DK dark command
['62124'] = true, -- Paladin hand of reckoning
['31789'] = true, -- Paladin righteous defense
['6795'] = true, -- Druid growl
['20736'] = true, -- Hunter distracting shot
['2649'] = true,-- Hunter pet growl rank 1
['17735'] = true, -- Warlock pet suffering rank 1
['115543'] = true, -- Monk Glyph of the ox
['115546'] = true, -- Monk provoke
}
 
local dontspam = {
['2649'] = true,-- Hunter pet growl rank 1
['17735'] = true, -- Warlock pet suffering rank 1
}
 
local spammer = {}
 
local L = GetLocale() == 'deDE' and {
['New Tank'] = function(tank)
return string.format("Neuer Tank: |cffffff00%s|r",tank)
end,
["Taunted Fail"] = function(src,dest,spell)
dest = dest or ""
return string.format("|cffff0000Achtung!|r Spott von %s auf %s fehlgeschlagen (%s).",src or "",dest or "",spell or "")
end,
["Taunted"] = function(src,dest,spell)
dest = dest or ""
return string.format("%s hat %s mit %s gespottet.",src,dest,spell)
end,
['Tank'] = "Tank",
} or {
['New Tank'] = function(tank)
return string.format("New Tank: |cffffff00%s|r",tank)
end,
["Taunted Fail"] = function(src,dest,spell)
dest = dest or ""
return string.format("|cffff0000Danger!|r Taunt of %s failed on %s (%s).",src or "",dest or "",spell or "")
end,
["Taunted"] = function(src,dest,spell) dest = dest or ""
return string.format("%s taunted %s using %s.",src,dest,spell)
end,
['Tank'] = "Tank",
}
for _,a in pairs(prefix) do
for _,b in pairs(suffix) do
subevents[#subevents + 1] = a .. "_" .. b
end
end
subevents[#subevents + 1] = "SPELL_CAST_SUCCESS"
subevents[#subevents + 1] = "SPELL_MISSED"
 
local f = CreateFrame("Frame",name,UIParent)
f:SetWidth(100)
f:SetHeight(100)
f:SetPoint("CENTER")
f:RegisterEvent("PLAYER_REGEN_DISABLED")
 
local hw = CreateFrame("Frame",name.."Healwarning",f)
hw:SetWidth(32)
hw:SetHeight(32)
hw:SetScript("OnEnter", function(self)
cTip:SetOwner(self, "BOTTOMRIGHT");
cTip:ClearLines()
cTip:AddLine("Healerlist")
for k in pairs(healers) do
cTip:AddLine(k)
end
cTip:Show()
end)
hw:SetScript("OnLeave", function()
cTip:Hide()
end)
hw:SetPoint("BOTTOMRIGHT",f,"TOPLEFT")
local tex = hw:CreateTexture()
tex:SetTexture("Interface/Icons/spell_holy_renew")
tex:SetAllPoints(hw)
hw:Hide()
local bars = {
['SWING'] = {
['amount'] = CreateFrame("StatusBar",nil,f),
40,15 → 114,36
units[#units+1] = CreateFrame("Button",name..'player',f, "SecureUnitButtonTemplate")
units[#units]:SetAttribute("unit","playertarget")
for a = 1,4 do
unit = "party"..a.."target"
local unit = "party"..a.."target"
local b = CreateFrame("Button",name..unit,f, "SecureUnitButtonTemplate")
b:SetAttribute("unit",unit)
units[#units+1] = b
end
 
local function getUnitId(name)
if(GetNumGroupMembers() > 0) then
for i = 1,MAX_RAID_MEMBERS do
if(UnitName("raid"..i) == name) then
return "raid"..i
end
end
else
for i = 1,4 do
if(UnitName("party"..i) == name) then
return "party"..i
end
end
for i = 1,4 do
if(UnitName("partypet"..i) == name) then
return "partypet"..i
end
end
end
if(name == UnitName('pet')) then return 'pet' end
return "player"
end
local a = 0
local w = 40
local healers = {}
 
local function updateHealth(self, event, unit)
if(event=="UNIT_TARGET") then
unit = unit.."target"
110,6 → 205,48
end
 
end
--[[local AceGUI = LibStub("AceGUI-3.0")
local agf = AceGUI:Create("Frame")
-- agf:SetTitle("Example Frame")
agf:SetStatusText(name)
agf:SetCallback("OnClose", function(widget) AceGUI:Release(widget) end)
agf:SetLayout("Fill")
]]
local scroll
scroll = CreateFrame("ScrollingMessageFrame","AGTest",last)
scroll:SetFontObject("GameFontNormalSmall")
scroll:SetHyperlinksEnabled(true)
scroll:SetSize(200,200)
-- scroll:ClearAllPoints()
scroll:SetPoint("TOP",last,"BOTTOM")
--[[local agl = {
["tab1"] = function(self)
local ags = AceGUI:Create("ScrollFrame")
scroll = CreateFrame("ScrollingMessageFrame","AGTest",ags.frame)
scroll:SetFontObject("GameFontNormalSmall")
scroll:SetHyperlinksEnabled(true)
-- scroll:SetSize(200,200)
-- scroll:ClearAllPoints()
 
self:AddChild(ags)
scroll:SetAllPoints(ags.frame)
end,
["tab2"] = function(self)
 
end,
}
local agt = AceGUI:Create("TabGroup")
agt:SetLayout("Fill")
agt:SetTabs({{text="Info", value="tab1"}, {text="Dmg", value="tab2"}})
agt:SetCallback("OnGroupSelected", function (container, event, group)
container:ReleaseChildren()
if(group and type(agl[group])=='function') then
agl[group](container)
end
end)
agt:SelectTab("tab1")
agf:AddChild(agt)
]]--
bars['SWING']['amount']:SetStatusBarColor(1, 1, 0)
bars['SWING']['resisted']:SetStatusBarColor(.2, .8, .3)
bars['SWING']['blocked']:SetStatusBarColor(.4, .8, .3)
139,6 → 276,8
end
end
updateBars()
hw:Hide()
cTip:Hide()
end
f:SetScript("OnEvent", function(self, event)
resetBars()
151,36 → 290,89
db[pref[#pref]] = value
end
 
local function NameIsTank(tank)
if(IsInRaid()) then
for i = 1,MAX_RAID_MEMBERS do
local name, _, _, _, _, _, _, _, _, role, _, combatRole = GetRaidRosterInfo(i)
if(name and (role == "maintank" or combatRole == 'TANK')) then
local c,r = UnitName("raid"..i)
r = r or realm
if(c and r and c.."-"..r == tank) then
return true
end
end
end
else
for i = 1,4 do
local isTank, isHeal, isDPS = UnitGroupRolesAssigned("party"..i)
if(isTank) then
local c,r = UnitName("party"..i)
r = r or realm
if(c and r and c.."-"..r == tank) then
return true
end
end
end
return UnitGroupRolesAssigned("player")
end
end
 
addon['CLParse'] = function(self, ...)
-- local event,timestamp, eventtype, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, spellId,spellName,spellSchool = ...
-- 16 amount overkill school resisted blocked absorbed critical glancing crushing isOffHand multistrike
data = {...}
sp = {strsplit("_",data[3])}
if(guid == data[9]) then
if(sp[1] and sp[#sp] == "DAMAGE") then
local offset = sp[1] == 'SWING' and 13 or 16
local isPhysical = bit.band(data[15],0x1)
local store = isPhysical>0 and "SWING" or "SPELL"
dmginc[store] = dmginc[store] or {
['amount'] = 0,
['resisted'] = 0,
['blocked'] = 0,
['absorbed'] = 0,
}
dmginc[store]['amount'] = dmginc[store]['amount'] + tonumber(data[offset] or 0)
dmginc[store]['resisted'] = dmginc[store]['resisted'] + tonumber(data[offset+3] or 0)
dmginc[store]['blocked'] = dmginc[store]['blocked'] + tonumber(data[offset+4] or 0)
dmginc[store]['absorbed'] = dmginc[store]['absorbed'] + tonumber(data[offset+5] or 0)
updateBars()
if(data[3] == "SPELL_CAST_SUCCESS" or data[3] == "SPELL_MISSED") then
local name = tostring(data[6])
if not (UnitPlayerOrPetInParty(name) or UnitPlayerOrPetInRaid(name) or UnitIsUnit("player",name) or UnitIsUnit("pet",name)) then return end
if(taunts[tostring(data[13])]) then
if(data[3] == "SPELL_CAST_SUCCESS") then
spammer[name] = spammer[name] or { ['count'] = 0, ['lastMessage'] = - spamDelay}
spammer[name]['count'] = spammer[name]['count'] + 1
if(spammer[name]['count'] > spammer[name]['lastMessage'] + spamDelay) then
spamShow = true
spammer[name]['lastMessage'] = spammer[name]['count']
end
if NameIsTank(name) and addon['db']['profile']['ignoreTanks'] then return end
if(not dontspam[tostring(data[13])] or spamShow) then
-- addon['Print'](L["Taunted"](name,data[10],data[14]))
scroll:AddMessage(L["Taunted"](name,data[10],GetSpellLink(data[13])))
end
spamShow = false
else
-- addon['Print'](L["Taunted Fail"](name,data[10],data[14]))
scroll:AddMessage(L["Taunted Fail"](name,data[10],GetSpellLink(data[13])))
end
end
else
if(sp[#sp] == "HEAL") then
local isHostile = bit.band(data[11],COMBATLOG_OBJECT_REACTION_HOSTILE)
if(isHostile>0) then
healers[data[6]] = true
print("Healalarm", data[6],data[14])
if(guid == data[9]) then
if(sp[1] and sp[#sp] == "DAMAGE") then
local offset = sp[1] == 'SWING' and 13 or 16
local isPhysical = bit.band(data[15],0x1)
local store = isPhysical>0 and "SWING" or "SPELL"
dmginc[store] = dmginc[store] or {
['amount'] = 0,
['resisted'] = 0,
['blocked'] = 0,
['absorbed'] = 0,
}
dmginc[store]['amount'] = dmginc[store]['amount'] + tonumber(data[offset] or 0)
dmginc[store]['resisted'] = dmginc[store]['resisted'] + tonumber(data[offset+3] or 0)
dmginc[store]['blocked'] = dmginc[store]['blocked'] + tonumber(data[offset+4] or 0)
dmginc[store]['absorbed'] = dmginc[store]['absorbed'] + tonumber(data[offset+5] or 0)
updateBars()
end
else
if(sp[#sp] == "HEAL") then
local isHostile = bit.band(data[11],COMBATLOG_OBJECT_REACTION_HOSTILE)
local isNPC = bit.band(data[11],COMBATLOG_OBJECT_TYPE_NPC)
if(data[6] and isHostile>0 and isNPC>0) then
healers[data[6]] = true
hw:Show()
-- print("Healalarm", data[6],data[14])
scroll:AddMessage("Healalarm "..data[6].." "..GetSpellLink(data[13]))
end
end
end
end
end
191,6 → 383,7
['type'] = "data source",
}, getPref, setPref)
db = addon['db']['profile'][name]
addon['AddConfigEntry'](addon, name, 'toggle', 'ignoreTanks', 'Ignore Tanks', 'Dont show taunts of tanks.', 1)
guid = UnitGUID("player")
f.db = db
f.dragAble = function() return true end
trunk/zz_DaVis/zz_DaVis.toc
1,4 → 1,4
## Interface: 60000
## Interface: 60200
## Title: zz_DaVis
## Notes: Damage Visualization
## Author: Rilgamon