Push to prepare v2

This commit is contained in:
Robin 2021-01-31 16:38:18 +01:00
parent 4a52e1c14d
commit ca3df09ad7
7 changed files with 175 additions and 190 deletions

View File

@ -45,12 +45,19 @@ local function GetDefaultSource(data, offset)
local offset = offset or 5 local offset = offset or 5
local src = CopyTable(defaultSource) local src = CopyTable(defaultSource)
if(data) then if(data) then
src['guid'] = data[offset] if(data:HasExtraSource()) then
src['name'] = data[offset + 1] offset = 16
src['flags'] = data[offset + 2] -- return GetDefaultSource(data, 16)
setClass(src, data[offset + 1], data[offset]) end
if(not src['name']) then src[1] = data[offset]
print("no src name", offset) src[2] = data[offset + 1]
src['guid'] = data[offset]
src['name'] = data[offset + 1]
src['flags'] = data[offset + 2]
setClass(src, data[offset + 1], data[offset])
if(not src[2]) then
print("no src name", offset, data:HasExtraSource())
print(unpack(data)) print(unpack(data))
end end
end end
@ -66,6 +73,8 @@ local defaultDestination = {
} }
local function GetDefaultDestination(data) local function GetDefaultDestination(data)
local dest = CopyTable(defaultDestination) local dest = CopyTable(defaultDestination)
dest[1] = data[9]
dest[2] = data[10]
dest['guid'] = data[9] dest['guid'] = data[9]
dest['name'] = data[10] dest['name'] = data[10]
dest['flags'] = data[11] dest['flags'] = data[11]
@ -170,8 +179,8 @@ function methods_store:GetSourceEmpty(data)
local guid = "Unknown" local guid = "Unknown"
self['source'][guid] = self['source'][guid] or GetDefaultSource(data) self['source'][guid] = self['source'][guid] or GetDefaultSource(data)
local src = self['source'][guid] local src = self['source'][guid]
src['name'] = "<Unknown>" src[2] = "<Unknown>"
src['guid'] = "Unknown" src[1] = "Unknown"
src['data'] = data src['data'] = data
for k, v in pairs(methods_source) do for k, v in pairs(methods_source) do
src[k] = v src[k] = v

View File

@ -52,18 +52,19 @@ UNITNAME_SUMMON_TITLE7 = "Konstrukt von %s";
UNITNAME_SUMMON_TITLE8 = "Gegner von %s"; UNITNAME_SUMMON_TITLE8 = "Gegner von %s";
UNITNAME_SUMMON_TITLE9 = "Fahrzeug von %s"; UNITNAME_SUMMON_TITLE9 = "Fahrzeug von %s";
]] ]]
local LibGUID = LibStub("LibGUID")
addon['LibGUID'] = LibGUID
local methods_guid = {} local methods_guid = {}
local scanIds = { 1, 2, 3, 7, 9, 26, 29} local scanIds = { 1, 2, 3, 7, 9, 26, 29}
local scanTip = CreateFrame("GameTooltip", format("%s_ScanTooltip",name), nil, "GameTooltipTemplate") local scanTip = CreateFrame("GameTooltip", format("%s_ScanTooltip",name), nil, "GameTooltipTemplate")
scanTip:SetOwner( WorldFrame, "ANCHOR_NONE" ) scanTip:SetOwner( WorldFrame, "ANCHOR_NONE" )
function methods_guid:scanTooltip() function methods_guid:scanTooltip()
if(self:HasOwner()) then return end if(self:HasOwner()) then return end
local guid = self['guid'] local guid = self[1]
local text = _G[format("%s_ScanTooltipTextLeft2",name)] local text = _G[format("%s_ScanTooltipTextLeft2",name)]
scanTip:SetOwner(WorldFrame, 'ANCHOR_NONE') scanTip:SetOwner(WorldFrame, 'ANCHOR_NONE')
scanTip:SetHyperlink('unit:' .. guid or '') scanTip:SetHyperlink('unit:' .. guid or '')
if(guid and text) then
if(text) then
local text2 = text:GetText() local text2 = text:GetText()
if(text2) then if(text2) then
for i = 1, #scanIds do for i = 1, #scanIds do
@ -98,30 +99,66 @@ local function GetGuid(unit)
end end
end end
function methods_guid:IsParty() function methods_guid:IsParty()
if(self['isParty'] ~= nil) then
-- return self['isParty']
end
if(self[3] and bit.band(self[3], COMBATLOG_OBJECT_AFFILIATION_OUTSIDER) == 0) then
self['isParty'] = true
else
self['isParty'] = false
end
return self['isParty'] return self['isParty']
end end
function methods_guid:SetName(newName) function methods_guid:SetName(newName)
self['name'] = newName self[2] = newName
local nameSplit, serverSplit = strsplit('-',self['name'],2) local nameSplit, serverSplit = strsplit('-',self[2],2)
if(not serverSplit) then if(not serverSplit) then
serverSplit = GetNormalizedRealmName() serverSplit = GetNormalizedRealmName()
end end
self['shortName'] = nameSplit self['shortName'] = nameSplit
self['shortRealm'] = serverSplit self['shortRealm'] = serverSplit
end end
local function processPet(self, clot)
if(guid) then
local gi = addon:GetGuidInfo(guid, UnitFlag, UnitName)
if(gi['isPet'] ~= nil) then
return gi['isPet']
end
if(UnitFlag and bit.band(UnitFlag, COMBATLOG_OBJECT_TYPE_PET) > 0) then
gi['isPet'] = true
return true
else
gi['isPet'] = false
end
end
end
local pet_clots = {COMBATLOG_OBJECT_TYPE_PET, COMBATLOG_OBJECT_TYPE_GUARDIAN, COMBATLOG_OBJECT_TYPE_OBJECT}
function methods_guid:IsPet() function methods_guid:IsPet()
if(self['isPet'] ~= nil) then
return self['isPet']
end
if(self[2]) then
for i = 1, #pet_clots do
if(UnitFlag and bit.band(self[2], COMBATLOG_OBJECT_TYPE_PET) > 0) then
self['isPet'] = true
break
else
self['isPet'] = false
end
end
end
return self['isPet'] return self['isPet']
end end
function methods_guid:HasOwner() function methods_guid:HasOwner()
return self['ownerName'] or false return self['ownerGuid'] or false
end end
function methods_guid:SetOwner(gi) function methods_guid:SetOwner(gi)
-- print("set owner", self['name'], gi['name']) -- print("set owner", self['name'], gi['name'])
self['isPet'] = true self['isPet'] = true
if(gi) then if(gi) then
self['ownerName'] = gi['name'] self['ownerName'] = gi[2]
self['ownerGuid'] = gi['guid'] self['ownerGuid'] = gi[1]
if(gi:IsParty())then if(gi:IsParty())then
self['isParty'] = true self['isParty'] = true
end end
@ -130,14 +167,13 @@ end
local function checkPet(unit) local function checkPet(unit)
local guid = GetGuid(unit) local guid = GetGuid(unit)
if(guid) then if(guid) then
local unitName, unitRealm = UnitFullName(unit) local o = addon:GetGuidInfo2(guid)
local _, unitClass = UnitClass(unit) o:SetUnit(unit)
local o = addon:GetGuidInfo(guid, nil, unitRealm and format("%s-%s", unitName, unitRealm) or unitName, unitClass)
o['isParty'] = true o['isParty'] = true
local pet = format("%sPET", unit) local pet = format("%sPET", unit)
local pguid = GetGuid(pet) local pguid = GetGuid(pet)
if(pguid) then if(pguid) then
local p = addon:GetGuidInfo(pguid) local p = addon:GetGuidInfo2(pguid)
p['isParty'] = true p['isParty'] = true
p:SetOwner(o) p:SetOwner(o)
end end
@ -145,8 +181,8 @@ local function checkPet(unit)
end end
end end
local function assocOwner(guid, petguid) local function assocOwner(guid, petguid)
local gio = addon:GetGuidInfo(guid) local gio = addon:GetGuidInfo2(guid)
local gip = addon:GetGuidInfo(petguid) local gip = addon:GetGuidInfo2(petguid)
gip:SetOwner(gio) gip:SetOwner(gio)
end end
local function group_helper(guids, endcount, unitbase) local function group_helper(guids, endcount, unitbase)
@ -202,7 +238,7 @@ function addon:UNIT_TARGET(event, unit)
if(guid) then if(guid) then
local _, class = UnitClass(trg) local _, class = UnitClass(trg)
local fullName, realm = UnitFullName(trg) local fullName, realm = UnitFullName(trg)
local gi = addon:GetGuidInfo(guid, nil, realm and format("%s-%s", fullName, realm) or fullName, class) local gi = addon:GetGuidInfo2(guid, class)
local clf = UnitClassification(trg) local clf = UnitClassification(trg)
-- print(trg, clf, UnitLevel(trg)) -- print(trg, clf, UnitLevel(trg))
if(clf == 'elite') then if(clf == 'elite') then
@ -216,7 +252,7 @@ function addon:UNIT_TARGET(event, unit)
-- print('find class') -- print('find class')
local _, class = UnitClass(trg) local _, class = UnitClass(trg)
if(class) then if(class) then
print('found class',class) -- print('found class',class)
gi['class'] = class gi['class'] = class
end end
end end
@ -264,10 +300,25 @@ function addon:PurgeGuidInfo()
if(not guids[k]) then if(not guids[k]) then
-- print(guidInfo[k]['name'],'purged') -- print(guidInfo[k]['name'],'purged')
guidInfo[k] = nil guidInfo[k] = nil
else
guidInfo[k]:Touch()
end end
end end
return guidInfo return guidInfo
end end
function rebuildGI()
local guids = addon:GetGroupGuid()
guids = addon:GetSegmentsGuid(guids)
for i = 1,#QuicklogDB['segments'] do
local store = addon:GetStore(addon:GetSegment(i))
for guid, data in pairs(store['source']) do
local obj = addon:GetGuidInfo2(data)
for dguid, ddata in pairs(data['dest']) do
local obj2 = addon:GetGuidInfo2(ddata)
end
end
end
end
function addon:GetGuidInfoDB() function addon:GetGuidInfoDB()
return guidInfo return guidInfo
end end
@ -275,61 +326,31 @@ function addon:SetGuidInfoDB(db)
if(db and type(db) == 'table') then if(db and type(db) == 'table') then
guidInfo = db guidInfo = db
end end
for guid, data in pairs(guidInfo) do
guidInfo[guid] = LibGUID:UpdateGUID(guid, data)
end
rebuildGI()
return guidInfo return guidInfo
end end
function addon:GetGuidInfo(guid, unitFlag, unitName, unitClass) function addon:GetGuidInfo2(obj, unitClass)
if(guid and guid ~= '') then obj = LibGUID:CreateGUIDObject(obj)
if(not guidInfo[guid] or not guidInfo[guid]['name']) then if(not obj) then return end
if(guid == 'Unknown') then -- local objDB = obj:GetNamespace(name)
guidInfo[guid] = { for k, v in pairs(methods_guid) do
['added'] = time(), obj[k] = v
['isParty'] = false,
['isPet'] = false,
['name'] = "<Unknown>",
['guid'] = guid,
['class'] = 'WARRIOR',
}
else --if(UnitFlag and bit.band(UnitFlag, COMBATLOG_OBJECT_TYPE_PLAYER) ~= 0) then
local localizedClass, englishClass, localizedRace, englishRace, sexGuid, nameGuid, realmGuid = GetPlayerInfoByGUID(guid)
-- print("gg",guid, unitFlag, unitName, " = ", nameGuid, realmGuid)
-- print(UnitName, nameGuid, realmGuid,format("%s-%s", nameGuid, realmGuid),format("%s-%s", nameGuid, realmGuid) ~= UnitName)
if(nameGuid) then
if(not realmGuid or realmGuid=='') then
realmGuid = GetNormalizedRealmName()
end
guidInfo[guid] = {
['added'] = time(),
['name'] = realmGuid and format("%s-%s", nameGuid, realmGuid) or nameGuid,
['guid'] = guid,
['class'] = englishClass,
['classLocal'] = localizedClass,
['race'] = englishRace,
['raceLocal'] = localizedRace,
}
end
end
if(not guidInfo[guid]) then
guidInfo[guid] = {
['added'] = time(),
['name'] = unitName,
['guid'] = guid,
['flags'] = unitFlag
}
end
end
for k, v in pairs(methods_guid) do
guidInfo[guid][k] = v
end
if(unitClass and not guidInfo[guid]['class']) then
guidInfo[guid]['class'] = unitClass
end
if(guidInfo[guid]['name'] and not guidInfo[guid]['shortName']) then
guidInfo[guid]:SetName(guidInfo[guid]['name'])
end
if(not guidInfo[guid]['classColor']) then
guidInfo[guid]['classColor'] = addon:GetClassColors(guidInfo[guid]['class'])
end
-- guidInfo[guid]:scanTooltip()
return guidInfo[guid]
end end
end if(obj[2]) then
obj:SetName(obj[2])
end
if(unitClass) then
obj['class'] = unitClass
end
if(obj['class'] and not obj['classColor']) then
obj['classColor'] = addon:GetClassColors(obj['class'])
end
guidInfo[obj[1]] = obj
return obj
end
LibGUID:RegisterPrune(function(self)
addon:PurgeGuidInfo()
end)

@ -1 +1 @@
Subproject commit b20f7ecfb0b98006d158ed372d0025fb9ec887bc Subproject commit 11219e3ffe8f3a442feb799aa58e2ea5aea743f7

View File

@ -15,7 +15,7 @@ local function purgeDB(tbl)
return tbl return tbl
end end
local dbdefaults = { local dbdefaults = {
['maxSegments'] = 5, ['maxSegments'] = 10,
['maxTooltipSpells'] = 6, ['maxTooltipSpells'] = 6,
['maxTooltipUnits'] = 5, ['maxTooltipUnits'] = 5,
['currentSegment'] = 0, ['currentSegment'] = 0,
@ -59,46 +59,6 @@ function addon:PLAYER_LOGOUT(event)
QuicklogDB = purgeDB(QuicklogDB) QuicklogDB = purgeDB(QuicklogDB)
-- QuicklogDB['GuidDB'] = nil -- QuicklogDB['GuidDB'] = nil
end end
local function processPet(UnitFlag, UnitName, guid, clot)
if(guid) then
local gi = addon:GetGuidInfo(guid, UnitFlag, UnitName)
if(gi['isPet'] ~= nil) then
return gi['isPet']
end
if(UnitFlag and bit.band(UnitFlag, COMBATLOG_OBJECT_TYPE_PET) > 0) then
gi['isPet'] = true
return true
else
gi['isPet'] = false
end
end
end
local pet_clots = {COMBATLOG_OBJECT_TYPE_PET, COMBATLOG_OBJECT_TYPE_GUARDIAN, COMBATLOG_OBJECT_TYPE_OBJECT}
function addon:IsPet(UnitFlag, UnitName, guid)
local gi = addon:GetGuidInfo(guid, UnitFlag, UnitName)
for i = 1, #pet_clots do
processPet(UnitFlag, UnitName, guid, pet_clots[i])
if(gi['isPet'] == true) then break end
end
return gi['isPet']
end
function addon:IsInParty(UnitFlag, UnitName, guid)
--print("UF", UnitFlag, guid, data)
if(guid) then
local gi = addon:GetGuidInfo(guid, UnitFlag, UnitName)
if(gi) then
if(gi['isParty'] ~= nil) then
return gi['isParty']
end
if(UnitFlag and bit.band(UnitFlag, COMBATLOG_OBJECT_AFFILIATION_OUTSIDER) == 0) then
gi['isParty'] = true
return true
else
gi['isParty'] = false
end
end
end
end
local function init(seg, data) local function init(seg, data)
print('initSeg', data and #data) print('initSeg', data and #data)
if(data) then if(data) then
@ -131,7 +91,15 @@ local function computeEvent(data, prefix, suffix)
if(canCompute(suffix)) then if(canCompute(suffix)) then
local res = addon:GetSegment() local res = addon:GetSegment()
local store = addon:GetStore(res) local store = addon:GetStore(res)
local source = store:GetSource(data[5], data)
local data_src = data:GetSource()
local gis = addon:GetGuidInfo2(data_src)
local source
if(data_src and gis:IsPet()) then
source = store:GetSource(data_src['ownerGuid'], data)
else
source = store:GetSource(data[5], data)
end
if(not source) then if(not source) then
source = NoSource(data) source = NoSource(data)
if(not source) then if(not source) then
@ -155,7 +123,7 @@ local function computeEvent(data, prefix, suffix)
amount = amount - overkill amount = amount - overkill
end end
if(resisted or blocked) then if(resisted or blocked) then
local destSource = store:GetSource(dest['guid'], data) local destSource = store:GetSource(dest[1], data)
if(resisted and resisted > 0) then if(resisted and resisted > 0) then
destSource:addTotal('totalAbsorbed', resisted) destSource:addTotal('totalAbsorbed', resisted)
end end
@ -168,8 +136,8 @@ local function computeEvent(data, prefix, suffix)
if(spellId) then if(spellId) then
dest:addSpell(spellId, spellName, spellSchool, amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing, isOffHand) dest:addSpell(spellId, spellName, spellSchool, amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing, isOffHand)
if(resisted or blocked) then if(resisted or blocked) then
local destSource = store:GetSource(dest['guid'], data) local destSource = store:GetSource(dest[1], data)
local destSourceDest = destSource:GetDestination(dest['guid']) local destSourceDest = destSource:GetDestination(dest[1])
if(resisted and resisted > 0) then if(resisted and resisted > 0) then
destSourceDest:addAbsorbSpell('RESISTED', 'RESISTED', 1, resisted) destSourceDest:addAbsorbSpell('RESISTED', 'RESISTED', 1, resisted)
end end
@ -179,8 +147,8 @@ local function computeEvent(data, prefix, suffix)
end end
end end
else else
print("no amount") -- print("no amount")
print(unpack(data)) -- print(unpack(data))
end end
elseif(suffix == 'ABSORBED') then elseif(suffix == 'ABSORBED') then
local spellId, spellName, spellSchool, extraGUID, extraName, extraFlags, extraRaidFlags, extraSpellID, extraSpellName, extraSchool, amount local spellId, spellName, spellSchool, extraGUID, extraName, extraFlags, extraRaidFlags, extraSpellID, extraSpellName, extraSchool, amount
@ -246,11 +214,12 @@ local function stopSegment(...)
end end
end end
local throttleUpdate,trottleDelay = time(), 0.4 local throttleUpdate,trottleDelay = time(), 0.4
function addon:summon(data, prefix, suffix) function addon:summon(event, data, prefix, suffix)
local summon = addon:GetGuidInfo(data[9], data[11], data[10]) self:CreateDataObject(data, prefix, suffix)
local summon = addon:GetGuidInfo2(data:GetDestination())
if(not summon:HasOwner()) then if(not summon:HasOwner()) then
summon:scanTooltip() -- summon:scanTooltip()
local owner = addon:GetGuidInfo(data[5], data[7], data[6]) local owner = addon:GetGuidInfo2(data:GetSource())
summon:SetOwner(owner) summon:SetOwner(owner)
end end
-- summon['isPet'] = true -- summon['isPet'] = true
@ -263,35 +232,16 @@ end
local function prepData(data, offset) local function prepData(data, offset)
local offset = offset or 5 local offset = offset or 5
if(data[offset + 1]) then if(data[offset + 1]) then
local gis = addon:GetGuidInfo(data[offset], data[offset + 2], data[offset + 1]) local gis = addon:GetGuidInfo2({data[offset], data[offset + 1], data[offset + 2]})
if(segStarted and gis['isBoss']) then if(segStarted and gis['isBoss']) then
QuicklogDB['segments'][#QuicklogDB['segments']]['hasBoss'] = true QuicklogDB['segments'][#QuicklogDB['segments']]['hasBoss'] = true
QuicklogDB['segments'][#QuicklogDB['segments']]['BossNames'][data[offset]] = data[offset + 1] QuicklogDB['segments'][#QuicklogDB['segments']]['BossNames'][data[offset]] = data[offset + 1]
end end
-- print('petc')
if(gis['isPet'] == nil) then
-- print('petc not yet',data[offset + 2], data[offset + 1], data[offset])
addon:IsPet(data[offset + 2], data[offset + 1], data[offset])
end
if(gis:IsPet()) then
-- print('pet found', gis['name'], gis['ownerName'])
if(not gis['ownerGuid']) then
-- print('pet found, no owner', gis['name'], gis['ownerName'])
gis:scanTooltip()
end
if(gis['ownerGuid']) then
-- print('rewrite', gis['name'], gis['ownerName'])
data[offset + 2] = gis['ownerFlags']
data[offset + 1] = gis['ownerName']
data[offset] = gis['ownerGuid']
end
else
-- print("no pet", gis['name'])
end
end end
return data return data
end end
function addon:dmg(data, prefix, suffix) function addon:dmg(event, data, prefix, suffix)
-- print(data, prefix, suffix)
--[[ [1] = event, --[[ [1] = event,
[2] = time, [2] = time,
[3] = type, [3] = type,
@ -305,22 +255,23 @@ function addon:dmg(data, prefix, suffix)
[11] = destFlags, [11] = destFlags,
[12] = destRaidFlags, [12] = destRaidFlags,
]] ]]
if(not segStarted and not data[6]) then self:CreateDataObject(data, prefix, suffix)
local data_src = data:GetSource()
local data_dest = data:GetDestination()
local data_extrasrc = data:GetExtraSource()
if(not segStarted and not data_src and not data_extrasrc) then
-- print('environmental/aoe?', data[3], data[10]) -- print('environmental/aoe?', data[3], data[10])
return return
end end
-- if(addon:IsInParty(data[7],data[5]) or addon:IsInParty(data[11], data[9])) then
data = prepData(data, 5) data = prepData(data, 5)
data = prepData(data, 9) data = prepData(data, 9)
if(not segStarted) then if(not segStarted) then
local gis = addon:GetGuidInfo(data[5], data[7], data[6]) local gis = addon:GetGuidInfo2(data_extrasrc and data_extrasrc or data_src)
if(gis and not gis['died'] and not (suffix == 'HEAL') and not(prefix == 'ENVIRONMENTAL')) then if(gis and not gis['died'] and not (suffix == 'HEAL') and not(prefix == 'ENVIRONMENTAL')) then
local gid = addon:GetGuidInfo(data[9], data[11], data[10]) local gid = addon:GetGuidInfo2(data_dest)
-- if(addon:IsInParty(data[7], data[6], data[5])) then
if(gis:IsParty()) then if(gis:IsParty()) then
if(gis['guid'] and gid['guid'] and gis['guid'] ~= gid['guid']) then if(gis[1] and gid[1] and gis[1] ~= gid[1]) then
startSegment(data) startSegment(data)
end end
end end
@ -338,14 +289,14 @@ function addon:BOSS_KILL(event, encounterID, encounterName)
print("boss kill", encounterID, encounterName) print("boss kill", encounterID, encounterName)
end end
function addon:ENCOUNTER_END(event, encounterID, encounterName, difficultyID, groupSize, success) function addon:ENCOUNTER_END(event, encounterID, encounterName, difficultyID, groupSize, success)
print(event, encounterID, encounterName, difficultyID, groupSize) -- print(event, encounterID, encounterName, difficultyID, groupSize)
addon:UpdateWindows() addon:UpdateWindows()
stopSegment(event, encounterID, encounterName, difficultyID, groupSize, success) stopSegment(event, encounterID, encounterName, difficultyID, groupSize, success)
self:UnregisterEvent(event) self:UnregisterEvent(event)
self:RegisterEvent('ENCOUNTER_START') self:RegisterEvent('ENCOUNTER_START')
end end
function addon:ENCOUNTER_START(event, encounterID, encounterName, difficultyID, groupSize) function addon:ENCOUNTER_START(event, encounterID, encounterName, difficultyID, groupSize)
print(event, encounterID, encounterName, difficultyID, groupSize) -- print(event, encounterID, encounterName, difficultyID, groupSize)
if(not segStarted) then if(not segStarted) then
startSegment() startSegment()
end end
@ -356,7 +307,7 @@ print(event, encounterID, encounterName, difficultyID, groupSize)
self:UnregisterEvent(event) self:UnregisterEvent(event)
end end
function addon:SCENARIO_COMPLETED(event, questID, xp, money) function addon:SCENARIO_COMPLETED(event, questID, xp, money)
print("scenario end", event, questID, xp, money) -- print("scenario end", event, questID, xp, money)
stopSegment(event, questID, xp, money) stopSegment(event, questID, xp, money)
end end
function addon:UNIT_EXITED_VEHICLE(event, unit) function addon:UNIT_EXITED_VEHICLE(event, unit)
@ -366,13 +317,13 @@ function addon:UNIT_EXITED_VEHICLE(event, unit)
end end
end end
function addon:UNIT_NAME_UPDATE(event, unit) function addon:UNIT_NAME_UPDATE(event, unit)
local gi = addon:GetGuidInfo(UnitGUID(unit)) local gi = addon:GetGuidInfo2(UnitGUID(unit))
if(gi) then if(gi) then
gi:SetName(UnitName(unit)) gi:SetName(UnitName(unit))
end end
end end
function addon:PLAYER_ENTERING_WORLD(event, isInitialLogin, isReloadingUi) function addon:PLAYER_ENTERING_WORLD(event, isInitialLogin, isReloadingUi)
print("PEW") -- print("PEW")
if(not isInitialLogin and not isReloadingUi) then if(not isInitialLogin and not isReloadingUi) then
stopSegment(event, isInitialLogin, isReloadingUi) stopSegment(event, isInitialLogin, isReloadingUi)
end end
@ -386,31 +337,30 @@ function addon:cmbStatus(event)
stopSegment(event) stopSegment(event)
end end
end end
addon['LibGUID']:PruneGUIDCache(600)
elseif(event=='PLAYER_REGEN_DISABLED') then elseif(event=='PLAYER_REGEN_DISABLED') then
if(not segStarted) then if(not segStarted) then
startSegment() startSegment()
end end
end end
end end
function addon:died(data) function addon:died(event, data, prefix, suffix)
-- print(unpack(data)) -- print(unpack(data))
if(data[9] and data[10]) then self:CreateDataObject(data, prefix, suffix)
local gi = addon:GetGuidInfo(data[9], data[11], data[10]) local gi = addon:GetGuidInfo2(data:GetDestination())
gi['died'] = gi['died'] or {} gi['died'] = gi['died'] or {}
gi['died'][#gi['died'] + 1] = data gi['died'][#gi['died'] + 1] = data
gi['dead'] = true gi['dead'] = true
end
end end
function addon:resurrect(data) function addon:resurrect(event, data)
-- local gis = addon:GetGuidInfo(data[5], data[7], data[6]) -- local gis = addon:GetGuidInfo(data[5], data[7], data[6])
-- print('res', gis['name']) -- print('res', gis['name'])
if(data[9] and data[10]) then self:CreateDataObject(data, prefix, suffix)
local gi = addon:GetGuidInfo(data[9], data[11], data[10]) local gi = addon:GetGuidInfo2(data:GetDestination())
-- print('res dest', gi['name']) -- print('res dest', gi['name'])
gi['resurrect'] = gi['resurrect'] or {} gi['resurrect'] = gi['resurrect'] or {}
gi['resurrect'][#gi['resurrect'] + 1] = data gi['resurrect'][#gi['resurrect'] + 1] = data
gi['dead'] = nil gi['dead'] = nil
end
end end
addon['f']:SetScript("OnEvent", function(self, event, arg1, ...) addon['f']:SetScript("OnEvent", function(self, event, arg1, ...)
if(event == "ADDON_LOADED" and arg1 == name) then if(event == "ADDON_LOADED" and arg1 == name) then
@ -436,6 +386,7 @@ addon['f']:SetScript("OnEvent", function(self, event, arg1, ...)
end end
LibStub("LibCombatLog"):Embed(addon) LibStub("LibCombatLog"):Embed(addon)
LibStub("LibCombatLog_data"):Embed(addon)
addon:RegisterCLEvent({'UNIT_DIED', 'UNIT_DESTROYED', 'UNIT_DISSIPATES'}, 'died') addon:RegisterCLEvent({'UNIT_DIED', 'UNIT_DESTROYED', 'UNIT_DISSIPATES'}, 'died')
addon:RegisterCLSuffix({'DAMAGE','HEAL','ABSORBED'}, 'dmg') addon:RegisterCLSuffix({'DAMAGE','HEAL','ABSORBED'}, 'dmg')
addon:RegisterCLSuffix({'SUMMON', 'CREATE'}, 'summon') addon:RegisterCLSuffix({'SUMMON', 'CREATE'}, 'summon')

View File

@ -2,6 +2,7 @@
## Name: Quicklog ## Name: Quicklog
## SavedVariables: QuicklogDB ## SavedVariables: QuicklogDB
## Description: Combatlog display ## Description: Combatlog display
## OptionalDeps: LibCombatlog, LibGUID, LibCombatlog_data
Libs/LibCombatlog/Libstub/Libstub.lua Libs/LibCombatlog/Libstub/Libstub.lua
Libs/LibCombatlog/LibCombatlog.lua Libs/LibCombatlog/LibCombatlog.lua
GuidInfo.lua GuidInfo.lua

View File

@ -56,11 +56,14 @@ end
function segfunc:GetSegmentGuid(guids) function segfunc:GetSegmentGuid(guids)
guids = guids or {} guids = guids or {}
for c, d in pairs(self['source']) do for c, d in pairs(self['source']) do
if(addon:IsInParty(d['flags'], d['name'], d['guid'])) then local gis = addon:GetGuidInfo2(d[1])
if(gis and gis:IsParty()) then
for k, v in pairs(d['dest']) do for k, v in pairs(d['dest']) do
guids[k] = true guids[k] = true
end end
guids[c] = true guids[c] = true
else
-- print("seg fault",d['guid'],d[1])
end end
end end
return guids return guids

View File

@ -53,7 +53,8 @@ local function defaultDisplay(win, total)
local src = {} local src = {}
local maxtotal = 0 local maxtotal = 0
for c, d in pairs(seg['source']) do for c, d in pairs(seg['source']) do
if(d[total] > 0 and addon:IsInParty(d['flags'], d['name'], d['guid'])) then local gis = addon:GetGuidInfo2(d)
if(gis and d[total] > 0 and gis:IsParty()) then
if(d[total]>maxtotal) then if(d[total]>maxtotal) then
maxtotal = d[total] maxtotal = d[total]
end end
@ -69,9 +70,9 @@ local function defaultDisplay(win, total)
for i = 1, #src do for i = 1, #src do
local d = src[i] local d = src[i]
local bar = win:GetBar(i) local bar = win:GetBar(i)
local guid = d['guid'] local guid = d[1]
bar['guid'] = guid bar['guid'] = guid
local gib = addon:GetGuidInfo(guid) local gib = addon:GetGuidInfo2(d)
if(bar['class'] ~= gib['class']) then if(bar['class'] ~= gib['class']) then
bar:SetColorByClass(gib['class']) bar:SetColorByClass(gib['class'])
end end
@ -82,7 +83,7 @@ local function defaultDisplay(win, total)
end end
bar:SetMinMaxValues(0, maxtotal) bar:SetMinMaxValues(0, maxtotal)
bar:SetValue(d[total]) bar:SetValue(d[total])
bar:SetText(gib['shortName'] and gib['shortName'] or gib['name'], d[total]) bar:SetText(gib['shortName'] and gib['shortName'] or gib[2], d[total])
last = bar last = bar
if(i >= maxBars) then if(i >= maxBars) then
break break
@ -131,11 +132,10 @@ local function defaultTooltip(tooltip, src, total, spells)
sort(dip, sorts[total]) sort(dip, sorts[total])
for i = 1, #dip do for i = 1, #dip do
local dest = dip[i] local dest = dip[i]
local gib = addon:GetGuidInfo(dest['guid']) local gib = addon:GetGuidInfo2(dest)
if(gib) then if(gib) then
local r, g, b, a, u = unpack(gib['classColor']) local r, g, b = unpack(gib['classColor'] or addon:GetClassColors(gib['class']))
tooltip:AddDoubleLine(gib['name'] and gib['name'] or '<Unbekannt>', dest[total], r, g, b, 1, 1, 1) tooltip:AddDoubleLine(gib[2] and gib[2] or '<Unbekannt>', dest[total], r, g, b, 1, 1, 1)
if(dest[spells]) then if(dest[spells]) then
local tip = {} local tip = {}
for _, spell in pairs(dest[spells]) do for _, spell in pairs(dest[spells]) do
@ -167,10 +167,10 @@ function window_methods:StatusBarOnEnter(bar)
local seg = self['seg'] local seg = self['seg']
local store = addon:GetStore(seg) local store = addon:GetStore(seg)
local src = store:GetSource(bar['guid'], nil, nil, true) local src = store:GetSource(bar['guid'], nil, nil, true)
if(not src or not src['name']) then bar:Release() return end if(not src or not src[2]) then bar:Release() return end
local display = self['settings']['display'] local display = self['settings']['display']
bar['tooltip']:AddLine(format("%s - %s", display, src['name']),1,1,1) bar['tooltip']:AddLine(format("%s - %s", display, src[2]),1,1,1)
if(display == 'DAMAGE') then if(display == 'DAMAGE') then
defaultTooltip(bar['tooltip'], src, 'total', 'spells') defaultTooltip(bar['tooltip'], src, 'total', 'spells')
elseif(display == 'HEAL') then elseif(display == 'HEAL') then