WoWInterface SVN zz_DaVis

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 4 to Rev 5
    Reverse comparison

Rev 4 → Rev 5

zz_DaVis/core.lua
1,8 → 1,93
local name, addon = ...
 
local defaults,options,db,data,guid = {
local defaults,dmginc,options,db,data,guid,sp = {
},{}
local prefix = {"SWING","RANGE","SPELL","SPELL_PERIODIC","SPELL_BUILDING","ENVIRONMENTAL"}
local suffix = {"DAMAGE","HEAL"}
local subevents = {}
for _,a in pairs(prefix) do
for _,b in pairs(suffix) do
subevents[#subevents + 1] = a .. "_" .. b
end
end
local f = CreateFrame("Frame",name,UIParent)
f:SetWidth(100)
f:SetHeight(100)
f:SetPoint("CENTER")
f:RegisterEvent("PLAYER_REGEN_DISABLED")
 
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 function valchange(self)
local a = tonumber(self:GetValue())==0 and self:Hide() or self:Show()
end
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("BOTTOMLEFT",last,"TOPLEFT")
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
end
end
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()
end
f:SetScript("OnEvent", function(self, event)
resetBars()
end)
local function getPref(pref)
return db[pref[#pref]]
end
11,31 → 96,53
db[pref[#pref]] = value
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
print(data[3])
if(sp[1] and sp[#sp] == "DAMAGE") then
dmginc[sp[1]] = dmginc[sp[1]] or {
['amount'] = 0,
['resisted'] = 0,
['blocked'] = 0,
['absorbed'] = 0,
 
}
 
local offset = 16
if(sp[1] == 'SWING') then
offset = 13
end
local isPhysical = bit.band(data[15],0x1)
local store = isPhysical>0 and "SWING" or "SPELL"
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)
if(isHostile>0) then
print("Healalarm", data[6],data[14])
end
end
end
end
local prefix = {"SWING","RANGE","SPELL","SPELL_PERIODIC","SPELL_BUILDING","ENVIRONMENTAL"}
local suffix = {"DAMAGE"}
local subevents = {}
for _,a in pairs(prefix) do
for _,b in pairs(suffix) do
subevents[#subevents + 1] = a .. "_" .. b
end
end
 
local function init()
local f = CreateFrame("Frame",name,UIParent)
f:SetWidth(100)
f:SetHeight(100)
f:SetPoint("CENTER")
addon['RegisterCLEvent'](addon,subevents,"CLParse")
options = addon['InitConfig'](addon, name, true, {
['type'] = "data source",
}, getPref, setPref)
db = addon['db']['profile'][name]
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/zz_DaVis.toc
6,4 → 6,5
## SavedVariables: zz_DaVisDB
## OptionalDeps: Ace3, zzLibCommon
Common\common.xml
LibCombatLog.lua
pack.xml