Skip to content

Commit

Permalink
Added new plugin to update the comparison window
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Nov 27, 2022
1 parent e3161ff commit 25cb9e8
Show file tree
Hide file tree
Showing 11 changed files with 2,203 additions and 35 deletions.
1 change: 1 addition & 0 deletions Details.toc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ functions\deathmenu.lua
functions\macros.lua
functions\testbars.lua
functions\editmode.lua
functions\warcraftlogs.lua

core\timemachine.lua

Expand Down
61 changes: 61 additions & 0 deletions Libs/LibOpenRaid/GetPlayerInformation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,67 @@ function openRaidLib.CooldownManager.GetPlayerCooldownStatus(spellId)
end
end

do
--make new namespace
openRaidLib.AuraTracker = {}

function openRaidLib.AuraTracker.ScanCallback(aura)
local unitId = openRaidLib.AuraTracker.CurrentUnitId
local thisUnitAuras = openRaidLib.AuraTracker.CurrentAuras[unitId]

local auraInfo = C_UnitAuras.GetAuraDataByAuraInstanceID(unitId, aura.auraInstanceID)
if (auraInfo) then
local spellId = auraInfo.spellId
if (spellId) then
thisUnitAuras[spellId] = true
openRaidLib.AuraTracker.AurasFoundOnScan[spellId] = true
end
end
end

function openRaidLib.AuraTracker.ScanPlayerAuras(unitId)
local batchCount = nil
local usePackedAura = true
openRaidLib.AuraTracker.CurrentUnitId = unitId

openRaidLib.AuraTracker.AurasFoundOnScan = {}
AuraUtil.ForEachAura(unitId, "HELPFUL", batchCount, openRaidLib.AuraTracker.ScanCallback, usePackedAura)

local thisUnitAuras = openRaidLib.AuraTracker.CurrentAuras[unitId]
for spellId in pairs(thisUnitAuras) do
if (not openRaidLib.AuraTracker.AurasFoundOnScan[spellId]) then
--aura removed
openRaidLib.internalCallback.TriggerEvent("unitAuraRemoved", unitId, spellId)
end
end
end

--run when the open raid lib loads
function openRaidLib.AuraTracker.StartScanUnitAuras(unitId)
openRaidLib.AuraTracker.CurrentAuras = {
[unitId] = {}
}

local auraFrameEvent = CreateFrame("frame")
auraFrameEvent:RegisterUnitEvent("UNIT_AURA", unitId)

auraFrameEvent:SetScript("OnEvent", function()
openRaidLib.AuraTracker.ScanPlayerAuras(unitId)
end)
end

--test case:
local debugModule = {}
function debugModule.AuraRemoved(event, unitId, spellId)
local spellName = GetSpellInfo(spellId)
--print("aura removed:", unitId, spellId, spellName)
end
openRaidLib.internalCallback.RegisterCallback("unitAuraRemoved", debugModule.AuraRemoved)

end



--which is the main attribute of each spec
--1 Intellect
--2 Agility
Expand Down
39 changes: 36 additions & 3 deletions Libs/LibOpenRaid/LibOpenRaid.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ if (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE and not isExpansion_Dragonflight()) t
end

local major = "LibOpenRaid-1.0"
local CONST_LIB_VERSION = 81
local CONST_LIB_VERSION = 82

if (not LIB_OPEN_RAID_MAX_VERSION) then
LIB_OPEN_RAID_MAX_VERSION = CONST_LIB_VERSION
Expand Down Expand Up @@ -726,6 +726,7 @@ end
["mythicDungeonStart"] = {},
["playerPetChange"] = {},
["mythicDungeonEnd"] = {},
["unitAuraRemoved"] = {},
}

openRaidLib.internalCallback.RegisterCallback = function(event, func)
Expand Down Expand Up @@ -804,10 +805,12 @@ end

["PLAYER_ENTERING_WORLD"] = function(...)
--has the selected character just loaded?
if (not openRaidLib.isFirstEnteringWorld) then
if (not openRaidLib.bHasEnteredWorld) then
--register events
openRaidLib.OnEnterWorldRegisterEvents()

--openRaidLib.AuraTracker.StartScanUnitAuras("player")

if (IsInGroup()) then
openRaidLib.RequestAllData()
openRaidLib.UpdateUnitIDCache()
Expand Down Expand Up @@ -845,7 +848,7 @@ end
detailsEventListener:RegisterEvent("UNIT_TALENTS", "UnitTalentsFound")
end

openRaidLib.isFirstEnteringWorld = true
openRaidLib.bHasEnteredWorld = true
end

openRaidLib.internalCallback.TriggerEvent("onEnterWorld")
Expand Down Expand Up @@ -1984,6 +1987,35 @@ end
openRaidLib.CooldownManager.CheckCooldownChanges()
end

function openRaidLib.CooldownManager.OnAuraRemoved(event, unitId, spellId)
--under development ~aura
local timeLeft, charges, startTimeOffset, duration, auraDuration = openRaidLib.CooldownManager.GetPlayerCooldownStatus(spellId)

--do need to update?
if (not timeLeft or timeLeft < 1 or not auraDuration or auraDuration < 1) then
return
end

local latencyCompensation = 1

if (spellId) then
if (auraDuration > latencyCompensation) then
--cooldown aura got removed before expiration
local newAuraDuration = 0
local unitName = GetUnitName(unitId, true) or unitId
openRaidLib.CooldownManager.CooldownSpellUpdate(unitName, spellId, timeLeft, charges, startTimeOffset, duration, newAuraDuration)

--trigger a public callback
local playerCooldownTable = openRaidLib.GetUnitCooldowns(unitName)
local cooldownInfo = cooldownGetSpellInfo(unitName, spellId)
openRaidLib.publicCallback.TriggerCallback("CooldownUpdate", "player", spellId, cooldownInfo, playerCooldownTable, openRaidLib.CooldownManager.UnitData)

--send to comm
openRaidLib.CooldownManager.SendPlayerCooldownUpdate(spellId, timeLeft, charges, startTimeOffset, duration, newAuraDuration)
end
end
end

openRaidLib.internalCallback.RegisterCallback("onLeaveGroup", openRaidLib.CooldownManager.OnPlayerLeaveGroup)
openRaidLib.internalCallback.RegisterCallback("playerCast", openRaidLib.CooldownManager.OnPlayerCast)
openRaidLib.internalCallback.RegisterCallback("onPlayerRess", openRaidLib.CooldownManager.OnPlayerRess)
Expand All @@ -1992,6 +2024,7 @@ end
openRaidLib.internalCallback.RegisterCallback("onLeaveCombat", openRaidLib.CooldownManager.OnEncounterEnd)
openRaidLib.internalCallback.RegisterCallback("mythicDungeonStart", openRaidLib.CooldownManager.OnMythicPlusStart)
openRaidLib.internalCallback.RegisterCallback("playerPetChange", openRaidLib.CooldownManager.OnPlayerPetChanged)
openRaidLib.internalCallback.RegisterCallback("unitAuraRemoved", openRaidLib.CooldownManager.OnAuraRemoved)

--send a list through comm with cooldowns added or removed
function openRaidLib.CooldownManager.CheckCooldownChanges()
Expand Down
53 changes: 53 additions & 0 deletions Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,59 @@ do
--191427 havoc
}

LIB_OPEN_RAID_SPECID_TO_CLASSID = {
[577] = 12,
[581] = 12,

[250] = 6,
[251] = 6,
[252] = 6,

[71] = 1,
[72] = 1,
[73] = 1,

[62] = 8,
[63] = 8,
[64] = 8,

[259] = 4,
[260] = 4,
[261] = 4,

[102] = 11,
[103] = 11,
[104] = 11,
[105] = 11,

[253] = 3,
[254] = 3,
[255] = 3,

[262] = 7,
[263] = 7,
[264] = 7,

[256] = 5,
[257] = 5,
[258] = 5,

[265] = 9,
[266] = 9,
[267] = 9,

[65] = 2,
[66] = 2,
[70] = 2,

[268] = 10,
[269] = 10,
[270] = 10,

[1467] = 13,
[1468] = 13,
}

LIB_OPEN_RAID_DATABASE_LOADED = true
end

Expand Down
4 changes: 2 additions & 2 deletions boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
local addonName, Details222 = ...
local version, build, date, tocversion = GetBuildInfo()

_detalhes.build_counter = 10289
_detalhes.alpha_build_counter = 10289 --if this is higher than the regular counter, use it instead
_detalhes.build_counter = 10290
_detalhes.alpha_build_counter = 10290 --if this is higher than the regular counter, use it instead
_detalhes.dont_open_news = true
_detalhes.game_version = version
_detalhes.userversion = version .. " " .. _detalhes.build_counter
Expand Down
4 changes: 4 additions & 0 deletions classes/class_combat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@
return self.is_boss and self.is_boss.diff
end

function combate:GetEncounterCleuID()
return self.is_boss and self.is_boss.id
end

function combate:GetBossInfo()
return self.is_boss
end
Expand Down
18 changes: 18 additions & 0 deletions core/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5326,6 +5326,24 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
end

--tag item level of all players
local openRaidLib = LibStub:GetLibrary("LibOpenRaid-1.0")
local allUnitsInfo = openRaidLib.GetAllUnitsInfo()
local allPlayersGear = openRaidLib.GetAllUnitsGear()

local status = xpcall(function()
for actorIndex, actorObject in Details:GetCurrentCombat():GetContainer(DETAILS_ATTRIBUTE_DAMAGE):ListActors() do
local gearInfo = allPlayersGear[actorObject:Name()]
if (gearInfo) then
actorObject.ilvl = gearInfo.ilevel
end
end
end, geterrorhandler())

if (not status) then
Details:Msg("ilvl error:", status)
end

_detalhes:SendEvent("COMBAT_ENCOUNTER_END", nil, ...)

wipe(_detalhes.encounter_table)
Expand Down
Loading

0 comments on commit 25cb9e8

Please sign in to comment.