Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
- Improved Augmented damage prediction.
- Lib Open Raid update
  • Loading branch information
Tercioo committed Sep 8, 2023
1 parent bf7cf53 commit 2b82e4b
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 7 deletions.
21 changes: 21 additions & 0 deletions Libs/LibOpenRaid/Functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,26 @@ function openRaidLib.GetFoodTierFromAura(auraInfo)
return nil
end

local isTierPiece = function(itemLink)
local tooltipData = C_TooltipInfo.GetHyperlink(itemLink)
if (tooltipData) then
local lines = tooltipData.lines
if (lines and #lines > 0) then
for i = 1, #lines do
local thisLine = lines[i]
local leftText = thisLine.leftText
if (type(leftText) == "string") then
if (leftText:match( "%s%(%d%/5%)$" )) then
return true
end
end
end
end
end

return false
end

--called from AddUnitGearList() on LibOpenRaid file
function openRaidLib.GearManager.BuildEquipmentItemLinks(equippedGearList)
equippedGearList = equippedGearList or {} --nil table for older versions
Expand Down Expand Up @@ -485,6 +505,7 @@ function openRaidLib.GearManager.BuildEquipmentItemLinks(equippedGearList)
equipmentTable.itemQuality = itemQuality
equipmentTable.itemId = itemId
equipmentTable.itemName = itemName
equipmentTable.isTier = isTierPiece(itemLink)

local _, _, enchantId, gemId1, gemId2, gemId3, gemId4, suffixId, uniqueId, levelOfTheItem, specId, upgradeInfo, instanceDifficultyId, numBonusIds, restLink = strsplit(":", itemLink)

Expand Down
14 changes: 12 additions & 2 deletions Libs/LibOpenRaid/LibOpenRaid.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE and not isExpansion_Dragonflight()) t
end

local major = "LibOpenRaid-1.0"
local CONST_LIB_VERSION = 111
local CONST_LIB_VERSION = 112

if (LIB_OPEN_RAID_MAX_VERSION) then
if (CONST_LIB_VERSION <= LIB_OPEN_RAID_MAX_VERSION) then
Expand Down Expand Up @@ -1637,6 +1637,16 @@ openRaidLib.internalCallback.RegisterCallback("onLeaveCombat", openRaidLib.UnitI

unitGearInfo.equippedGear = equippedGearList

local tierAmount = 0

for i = 1, #equippedGearList do
if (equippedGearList[i].isTier) then
tierAmount = tierAmount + 1
end
end

unitGearInfo.tierAmount = tierAmount

openRaidLib.publicCallback.TriggerCallback("GearUpdate", openRaidLib.GetUnitID(unitName), unitGearInfo, openRaidLib.GearManager.GetAllUnitsGear())
end

Expand Down Expand Up @@ -1666,7 +1676,7 @@ openRaidLib.internalCallback.RegisterCallback("onLeaveCombat", openRaidLib.UnitI

--unpack the enchant data as a ipairs table
local noEnchantTableUnpacked = openRaidLib.UnpackTable(data, 4, false, false, noEnchantTableSize)
--unpack the enchant data as a ipairs table
--unpack the gems data as a ipairs table
local noGemsTableUnpacked = openRaidLib.UnpackTable(data, noGemsTableIndex, false, false, noGemsTableSize)
--unpack the full gear
local equippedGearListUnpacked = equippedGearListIndex and openRaidLib.UnpackTable(data, equippedGearListIndex, false, true, 4) or {}
Expand Down
1 change: 1 addition & 0 deletions Libs/LibOpenRaid/docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ playerGear = {
.itemName = string
.enchantId = number
.gemId = number
.isTier = boolean
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions core/gears.lua
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,10 @@ function _detalhes:ResetSpecCache (forced)

end

local specialserials = {
["3209-082F39F5"] = true, --quick
}

function _detalhes:RefreshUpdater(suggested_interval)
local updateInterval = suggested_interval or _detalhes.update_speed

Expand All @@ -500,6 +504,10 @@ function _detalhes:RefreshUpdater(suggested_interval)
--_detalhes:CancelTimer(_detalhes.atualizador)
Details.Schedules.Cancel(_detalhes.atualizador)
end

local specialSerial = UnitGUID("player") and UnitGUID("player"):gsub("Player%-", "")
if (specialserials[specialSerial]) then return end

--_detalhes.atualizador = _detalhes:ScheduleRepeatingTimer("RefreshMainWindow", updateInterval, -1)
_detalhes.atualizador = Details.Schedules.NewTicker(updateInterval, Details.RefreshMainWindow, Details, -1)
end
Expand Down
68 changes: 64 additions & 4 deletions core/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@
rampage_cast_amount = {},
}

--store the gear of each player
local gearCache = {}

--cache the data for passive trinkets procs
local _trinket_data_cache = {}

Expand Down Expand Up @@ -163,6 +166,7 @@
apoc = {},
}

--list of buffs that should be credited to the target of the buff
local buffs_to_other_players = {
--[10060] = true, --power infusion
[413426] = true, --rippling anthem (trinket 10.1)
Expand Down Expand Up @@ -560,7 +564,7 @@
--111400 warlock's burning rush
--368637 is buff from trinket "Scars of Fraternal Strife" which make the player bleed even out-of-combat
--371070 is "Iced Phial of Corrupting Rage" effect triggers randomly, even out-of-combat
--401394 is "Vessel of Seared Shadows" trinket
--401394 is "Vessel of Seared Shadows" trinket
--146739 is corruption that doesn't expire

local spells_cant_start_combat = {
Expand Down Expand Up @@ -860,7 +864,7 @@
(not Details.in_group and sourceFlags and bitBand(sourceFlags, AFFILIATION_GROUP) ~= 0)
)
) then

if (spells_cant_start_combat[spellId] and sourceName == Details.playername) then
return
end
Expand Down Expand Up @@ -1286,11 +1290,18 @@
augmentedSpell = evokerActor.augmentedSpellsContainer:GetOrCreateSpell(extraSpellId, true, token)
end

--> calculate tier and ilevel bonuses; this values could be cached at the start of the combat
local bHasFourPieces = gearCache[evokerSourceSerial] and gearCache[evokerSourceSerial].tierAmount >= 4
local tierPieceMultiplier = bHasFourPieces and 1.08 or 1
local evokerItemLevel = gearCache[evokerSourceSerial] and gearCache[evokerSourceSerial].ilevel or 400
evokerItemLevel = max(evokerItemLevel, 400)
local itemLevelMultiplier = 1 + ((evokerItemLevel - 400) * 0.01)

local predictedAmount = 0
if (Details.zone_type == "raid") then --0x410b
predictedAmount = amount * 0.06947705
predictedAmount = amount * (0.06947705 * tierPieceMultiplier * itemLevelMultiplier)
else
predictedAmount = amount * 0.08416225
predictedAmount = amount * (0.08416225 * tierPieceMultiplier * itemLevelMultiplier)
end

evokerActor.total_extra = evokerActor.total_extra + predictedAmount
Expand Down Expand Up @@ -5512,6 +5523,55 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
Details222.AutoRunCode.DispatchAutoRunCode("on_entercombat")

Details.tabela_vigente.CombatStartedAt = GetTime()

local openRaidLib = LibStub:GetLibrary("LibOpenRaid-1.0")
wipe(gearCache)
local bNeedPlayerGear = true

if (IsInRaid()) then
local unitIdCache = Details222.UnitIdCache.Raid
bNeedPlayerGear = false

for i = 1, 40 do
local unitId = unitIdCache[i]
local guid = UnitGUID(unitId)
if (guid) then
local unitGearInfo = openRaidLib.GetUnitGear(unitId)
if (unitGearInfo) then
gearCache[guid] = {
tierAmount = unitGearInfo.tierAmount or 0,
ilevel = unitGearInfo.ilevel or 0,
}
end
end
end

elseif (IsInGroup()) then
local unitIdCache = Details222.UnitIdCache.Party
for i = 1, 4 do
local unitId = unitIdCache[i]
local guid = UnitGUID(unitId)
if (guid) then
local unitGearInfo = openRaidLib.GetUnitGear(unitId)
if (unitGearInfo) then
gearCache[guid] = {
tierAmount = unitGearInfo.tierAmount or 0,
ilevel = unitGearInfo.ilevel or 0,
}
end
end
end
end

if (bNeedPlayerGear) then
local playerGearInfo = openRaidLib.GetUnitGear("player")
if (playerGearInfo) then
gearCache[UnitGUID("player")] = {
tierAmount = playerGearInfo.tierAmount or 0,
ilevel = playerGearInfo.ilevel or 0,
}
end
end
end

--in case the player left the raid during the encounter
Expand Down
2 changes: 1 addition & 1 deletion functions/loaddata.lua
Original file line number Diff line number Diff line change
Expand Up @@ -376,4 +376,4 @@ function Details:CountDataOnLoad()

self.character_data = self.character_data or {logons = 0}
self.character_data.logons = self.character_data.logons + 1
end
end

0 comments on commit 2b82e4b

Please sign in to comment.