WoWInterface SVN zz_DaVis

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 9 to Rev 8
    Reverse comparison

Rev 9 → Rev 8

zz_DaVis/pack.xml New file
0,0 → 1,3
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
<Script file="core.lua"/>
</Ui>
\ No newline at end of file
zz_DaVis/zz_DaVis.toc New file
0,0 → 1,10
## Interface: 60200
## Title: zz_DaVis
## Notes: Damage Visualization
## Author: Rilgamon
## X-WoWI-ID:
## SavedVariables: zz_DaVisDB
## OptionalDeps: Ace3, zzLibCommon
Common\common.xml
LibCombatLog.lua
pack.xml
zz_DaVis/LibCombatLog.lua New file
0,0 → 1,42
local name, addon = ...
local embed = addon['LibInit']("LibCombatLog", 5, {"RegisterCLEvent", "UnRegisterCLEvent"})
if(type(embed) ~= 'function') then return end
local pairs = pairs
local LibCombatLog = LibStub("LibCombatLog")
LibCombatLog['regs'] = LibCombatLog['regs'] or {}
local function combatLog(...)
if(LibCombatLog['regs'][select(4,...)]) then
for k, v in pairs(LibCombatLog['regs'][select(4,...)]) do
k[v](...)
end
end
end
LibCombatLog['frame'] = LibCombatLog['frame'] or addon['RegisterFunc']({'PLAYER_ENTERING_WORLD'},"OnEvent", function(self,event,arg1)
self:UnregisterEvent(event)
self:SetScript("OnEvent", combatLog)
self:RegisterEvent('COMBAT_LOG_EVENT_UNFILTERED')
end)
local lib = {
['RegisterCLEvent'] = function(self,event,funcName)
if(type(event) ~= "string" and funcName) then
funcName = funcName or event[1]
for _,v in pairs(event) do
LibCombatLog['regs'][v] = LibCombatLog['regs'][v] or {}
LibCombatLog['regs'][v][self] = funcName
end
else
funcName = funcName or event
LibCombatLog['regs'][event] = LibCombatLog['regs'][event] or {}
LibCombatLog['regs'][event][self] = funcName
end
end,
['UnRegisterCLEvent'] = function(self, event)
if(LibCombatLog['regs'][event]) then
if(LibCombatLog['regs'][event][self]) then
LibCombatLog['regs'][event][self] = nil
end
end
end,
}
 
embed(lib)
zz_DaVis/license.txt New file
0,0 → 1,6
The following license excludes the libraries (Libs) included. See the libraries directory or website.
 
This AddOn is public domain. That means you can change it, rename it or paint it yellow.
My name (Rilgamon) is valid only for WoWInterface.com and curse.com.
If you use/offer this addon on another website please remove my name.
If you want to give me credit you can replace it with a link to my profile on WoWInterface.com.
\ No newline at end of file
zz_DaVis/icon2.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
zz_DaVis/core.lua New file
0,0 → 1,392
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),
['resisted'] = CreateFrame("StatusBar",nil,f),
['blocked'] = CreateFrame("StatusBar",nil,f),
['absorbed'] = CreateFrame("StatusBar",nil,f),
},
['SPELL'] = {
['amount'] = CreateFrame("StatusBar",nil,f),
['resisted'] = CreateFrame("StatusBar",nil,f),
['blocked'] = CreateFrame("StatusBar",nil,f),
['absorbed'] = CreateFrame("StatusBar",nil,f),
}
}
 
local texts = {
['SWING'] = {},
['SPELL'] = {},
}
local last = f
local units = {}
units[#units+1] = CreateFrame("Button",name..'player',f, "SecureUnitButtonTemplate")
units[#units]:SetAttribute("unit","playertarget")
for a = 1,4 do
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 function updateHealth(self, event, unit)
if(event=="UNIT_TARGET") then
unit = unit.."target"
end
if(UnitIsUnit(self:GetAttribute("unit"), unit)) then
local h = UnitHealth(unit)
local m = UnitHealthMax(unit)
local p = h / (m/100)
self['text']:SetText(addon['colorize'](format("%.0f%%",p),healers[UnitName(unit)] and "00ff00" or "ffffff"))
end
end
for _, u in pairs(units) do
u:SetWidth(w)
u:SetHeight(20)
u:ClearAllPoints()
u:SetPoint("BOTTOMLEFT",f,"TOPLEFT",a,0)
u:SetBackdrop({
bgFile = "Interface/Tooltips/UI-Tooltip-Background",
tile = true,
tileSize = 1,
edgeSize = 4,
insets = { left = 0, right = 0, top = 0, 0 }
})
u:SetBackdropBorderColor(1,1,1,1)
u:SetBackdropColor(0,0,0,.5)
u:RegisterEvent("UNIT_HEALTH")
u:RegisterEvent("UNIT_TARGET")
u:HookScript("OnEvent", updateHealth)
local c = u:CreateFontString(nil,"OVERLAY","CombatLogFont")
c:ClearAllPoints()
c:SetAllPoints(u)
c:SetJustifyH("CENTER")
c:SetText("100")
u['text'] = c
ClickCastFrames = ClickCastFrames or {}
ClickCastFrames[u] = true
RegisterUnitWatch(u)
a = a + w
end
local function valchange(self)
local a = tonumber(self:GetValue())==0 and self:Hide() or self:Show()
end
local c = 1
for k,v in pairs(bars) do
for a,b in pairs(v) do
b:SetStatusBarTexture("Interface\\TargetingFrame\\UI-StatusBar")
b:GetStatusBarTexture():SetHorizTile(false)
b:SetValue(100)
b:SetWidth(200)
b:SetHeight(10)
b:SetScript("OnValueChanged", valchange)
b:SetPoint(c==1 and "TOPLEFT" or "BOTTOMLEFT",last,"TOPLEFT",0,c==1 and -80 or 0)
texts[k][a] = b:CreateFontString(nil, "OVERLAY", "TextStatusBarText")
texts[k][a]:ClearAllPoints()
texts[k][a]:SetAllPoints(b)
texts[k][a]:SetText(a.." 0")
last = b
c = nil
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)
bars['SWING']['absorbed']:SetStatusBarColor(.6, .8, .3)
bars['SPELL']['amount']:SetStatusBarColor(0, 0, 1)
bars['SPELL']['resisted']:SetStatusBarColor(.2, .8, .3)
bars['SPELL']['blocked']:SetStatusBarColor(.4, .8, .3)
bars['SPELL']['absorbed']:SetStatusBarColor(.6, .8, .3)
local function updateBars()
local total = 0
for k,v in pairs(dmginc) do
total = total + (dmginc[k] and dmginc[k]['amount'] or 0)
end
for k,v in pairs(bars) do
for a,b in pairs(v) do
local maxval = dmginc[k] and dmginc[k]['amount'] or 0
b:SetMinMaxValues(0, a=='amount' and total or maxval)
b:SetValue(dmginc[k] and dmginc[k][a] or 0)
texts[k][a]:SetText(a .. " " .. (dmginc[k] and dmginc[k][a] or 0))
end
end
end
local function resetBars()
for k,v in pairs(dmginc) do
for a,b in pairs(v) do
dmginc[k][a] = 0
end
end
updateBars()
hw:Hide()
cTip:Hide()
end
f:SetScript("OnEvent", function(self, event)
resetBars()
end)
local function getPref(pref)
return db[pref[#pref]]
end
 
local function setPref(pref,value)
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(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(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
 
local function init()
addon['RegisterCLEvent'](addon,subevents,"CLParse")
options = addon['InitConfig'](addon, name, true, {
['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
addon['AddDrag'](f,"BOX2")
end
addon['startup'](addon, name, name, init, true, defaults)
\ No newline at end of file
zz_DaVis Property changes : Added: svn:externals + svn://svn.wowinterface.com/zzcommon-841/trunk/LibCommon Common