diff --git a/Libs/LibOpenRaid/Functions.lua b/Libs/LibOpenRaid/Functions.lua index 5822b9570..acb215eaa 100644 --- a/Libs/LibOpenRaid/Functions.lua +++ b/Libs/LibOpenRaid/Functions.lua @@ -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 @@ -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) diff --git a/Libs/LibOpenRaid/LibOpenRaid.lua b/Libs/LibOpenRaid/LibOpenRaid.lua index acce5ce5c..17db0e874 100644 --- a/Libs/LibOpenRaid/LibOpenRaid.lua +++ b/Libs/LibOpenRaid/LibOpenRaid.lua @@ -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 @@ -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 @@ -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 {} diff --git a/Libs/LibOpenRaid/docs.txt b/Libs/LibOpenRaid/docs.txt index 514aa1d2e..543b9d2e6 100644 --- a/Libs/LibOpenRaid/docs.txt +++ b/Libs/LibOpenRaid/docs.txt @@ -90,6 +90,7 @@ playerGear = { .itemName = string .enchantId = number .gemId = number + .isTier = boolean } } } diff --git a/core/gears.lua b/core/gears.lua index 645ea47d6..23421e756 100644 --- a/core/gears.lua +++ b/core/gears.lua @@ -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 @@ -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 diff --git a/core/parser.lua b/core/parser.lua index 062bdac9f..23f9f0ce4 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -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 = {} @@ -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) @@ -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 = { @@ -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 @@ -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 @@ -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 diff --git a/functions/loaddata.lua b/functions/loaddata.lua index ceeb9bf32..95e6fa7dd 100644 --- a/functions/loaddata.lua +++ b/functions/loaddata.lua @@ -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 \ No newline at end of file