diff --git a/core/parser.lua b/core/parser.lua index 477ac3583..457e88e96 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -2811,7 +2811,7 @@ end if (override_aura_spellid[spellId] and UnitIsUnit(sourceName, "player")) then - local auraName, texture, count, auraType, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod, v1, v2, v3, v4, v5 = Details:FindBuffCastedBy(sourceName, spellId, sourceName) + local auraName, texture, count, auraType, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod, v1, v2, v3, v4, v5 = Details:FindBuffCastedByUnitName(sourceName, spellId, sourceName) if (auraName) then local overrideTable = override_aura_spellid[spellId] if (overrideTable.CanOverride(auraName, texture, count, auraType, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod, v1, v2, v3, v4, v5)) then diff --git a/core/util.lua b/core/util.lua index d84a00abf..add6fa160 100644 --- a/core/util.lua +++ b/core/util.lua @@ -31,49 +31,96 @@ local UnitAffectingCombat = UnitAffectingCombat --wow api local local _InCombatLockdown = InCombatLockdown --wow api local - local gump = Details.gump --details local + local playerRealmName = GetRealmName() + local gump = Details.gump --details local local predicateFunc = function(spellIdToFind, casterName, _, name, icon, applications, dispelName, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod, applications) - --print(name, texture, count, debuffType, duration, expirationTime, spellID) if (spellIdToFind == spellId and UnitExists(sourceUnit)) then - local spellname = GetSpellInfo(spellId) - if (casterName == GetUnitName(sourceUnit, true)) then + if (casterName == Details:GetFullName(sourceUnit)) then return true end end end - ---find the duration of a debuff by passing the spellId and the caster name - ---@param unitId unit - ---@param spellId spellid - ---@param casterName actorname - ---@return auraduration|nil auraDuration - ---@return number|nil expirationTime - function Details:FindDebuffDuration(unitId, spellId, casterName) - local name, texture, count, debuffType, duration, expirationTime = AuraUtil.FindAura(predicateFunc, unitId, "HARMFUL", spellId, casterName) - if (name) then - return duration, expirationTime + do + function Details:FindDebuffDurationByUnitName(targetString, spellId, casterString) + local targetName, targetRealm = strsplit("-", targetString) + if (playerRealmName ~= targetRealm) then + targetName = targetString + end + + local casterName, casterRealm = strsplit("-", casterString) + if (playerRealmName ~= casterRealm) then + casterName = casterString + end + + return Details:FindDebuffDuration(targetName, spellId, casterName) + end + + ---find the duration of a debuff by passing the spellId and the caster name + ---@param unitId unit + ---@param spellId spellid + ---@param casterName actorname + ---@return auraduration|nil auraDuration + ---@return number|nil expirationTime + function Details:FindDebuffDuration(unitId, spellId, casterName) + local name, texture, count, debuffType, duration, expirationTime = AuraUtil.FindAura(predicateFunc, unitId, "HARMFUL", spellId, casterName) + if (name) then + return duration, expirationTime + end end end - ---find the duration of a buff by passing the spellId and the caster name - ---@param unitId unit - ---@param spellId spellid - ---@param casterName actorname - ---@return auraduration|nil auraDuration - ---@return number|nil expirationTime - function Details:FindBuffDuration(unitId, spellId, casterName) - local name, texture, count, debuffType, duration, expirationTime = AuraUtil.FindAura(predicateFunc, unitId, "HELPFUL", spellId, casterName) - if (name) then - return duration, expirationTime + do + function Details:FindBuffDurationByUnitName(targetString, spellId, casterString) + local targetName, targetRealm = strsplit("-", targetString) + if (playerRealmName ~= targetRealm) then + targetName = targetString + end + + local casterName, casterRealm = strsplit("-", casterString) + if (playerRealmName ~= casterRealm) then + casterName = casterString + end + + return Details:FindBuffDuration(targetName, spellId, casterName) + end + + ---find the duration of a buff by passing the spellId and the caster name + ---@param unitId unit + ---@param spellId spellid + ---@param casterName actorname + ---@return auraduration|nil auraDuration + ---@return number|nil expirationTime + function Details:FindBuffDuration(unitId, spellId, casterName) + local name, texture, count, debuffType, duration, expirationTime = AuraUtil.FindAura(predicateFunc, unitId, "HELPFUL", spellId, casterName) + if (name) then + return duration, expirationTime + end end end - function Details:FindBuffCastedBy(unitId, buffSpellId, casterName) - local auraName, texture, count, auraType, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod, v1, v2, v3, v4, v5 = AuraUtil.FindAura(predicateFunc, unitId, "HELPFUL", buffSpellId, casterName) - if (auraName) then - return auraName, texture, count, auraType, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod, v1, v2, v3, v4, v5 + do + function Details:FindBuffCastedByUnitName(targetString, buffSpellId, casterString) + local targetName, targetRealm = strsplit("-", targetString) + if (playerRealmName ~= targetRealm) then + targetName = targetString + end + + local casterName, casterRealm = strsplit("-", casterString) + if (playerRealmName ~= casterRealm) then + casterName = casterString + end + + return Details:FindBuffCastedBy(targetName, buffSpellId, casterName) + end + + function Details:FindBuffCastedBy(unitId, buffSpellId, casterName) + local auraName, texture, count, auraType, duration, expTime, sourceUnit, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossAura, playerOrPet, nameplateShowAll, timeMod, v1, v2, v3, v4, v5 = AuraUtil.FindAura(predicateFunc, unitId, "HELPFUL", buffSpellId, casterName) + if (auraName) then + return auraName, texture, count, auraType, duration, expTime, sourceUnit, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossAura, playerOrPet, nameplateShowAll, timeMod, v1, v2, v3, v4, v5 + end end end diff --git a/functions/spec_augmentation.lua b/functions/spec_augmentation.lua index f0a4a79b4..9c9f72dc3 100644 --- a/functions/spec_augmentation.lua +++ b/functions/spec_augmentation.lua @@ -10,8 +10,8 @@ local augmentationFunctions = Details222.SpecHelpers[1473] local augmentationCache = Details222.SpecHelpers[1473].augmentation_cache function augmentationFunctions.BuffIn(token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetFlags2, spellId, spellName, spellschool, auraType, amount) - if (spellId == 395152) then - local auraName, texture, count, auraType, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod, v1, v2, v3, v4, v5 = Details:FindBuffCastedBy(targetName, spellId, sourceName) + if (spellId == 395152) then --ebom might on third parties + local auraName, texture, count, auraType, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod, v1, v2, v3, v4, v5 = Details:FindBuffCastedByUnitName(targetName, spellId, sourceName) local attributeGained = v2 if (type(attributeGained) == "number") then @@ -20,25 +20,9 @@ function augmentationFunctions.BuffIn(token, time, sourceSerial, sourceName, sou table.insert(augmentationCache.ebon_might[targetSerial], evokerInfo) end - - - - - - - - - - - - - - - - elseif (spellId == 413984) then --ss if (UnitExists(targetName) and not UnitIsUnit("player", targetName)) then - local auraName, texture, count, auraType, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod, v1, v2, v3, v4, v5 = Details:FindBuffCastedBy(targetName, spellId, sourceName) + local auraName, texture, count, auraType, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod, v1, v2, v3, v4, v5 = Details:FindBuffCastedByUnitName(targetName, spellId, sourceName) local versaGained = v1 if (type(versaGained) == "number") then augmentationCache.ss[targetSerial] = augmentationCache.ss[targetSerial] or {} @@ -88,7 +72,7 @@ function augmentationFunctions.BuffRefresh(token, time, sourceSerial, sourceName for index, evokerInfo in ipairs(augmentationCache.ebon_might[targetSerial]) do if (evokerInfo[1] == sourceSerial) then - local auraName, texture, count, auraType, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, auraSpellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod, v1, v2, v3, v4, v5 = Details:FindBuffCastedBy(targetName, spellId, sourceName) + local auraName, texture, count, auraType, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, auraSpellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod, v1, v2, v3, v4, v5 = Details:FindBuffCastedByUnitName(targetName, spellId, sourceName) local attributeGained = v2 if (type(attributeGained) == "number") then @@ -100,7 +84,7 @@ function augmentationFunctions.BuffRefresh(token, time, sourceSerial, sourceName end if (not bFound) then - local auraName, texture, count, auraType, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, auraSpellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod, v1, v2, v3, v4, v5 = Details:FindBuffCastedBy(targetName, spellId, sourceName) + local auraName, texture, count, auraType, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, auraSpellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod, v1, v2, v3, v4, v5 = Details:FindBuffCastedByUnitName(targetName, spellId, sourceName) local attributeGained = v2 if (type(attributeGained) == "number") then table.insert(augmentationCache.ebon_might[targetSerial], {sourceSerial, sourceName, sourceFlags, attributeGained}) @@ -109,7 +93,7 @@ function augmentationFunctions.BuffRefresh(token, time, sourceSerial, sourceName elseif (spellId == 413984) then --ss if (UnitExists(targetName) and not UnitIsUnit("player", targetName)) then - local auraName, texture, count, auraType, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod, v1, v2, v3, v4, v5 = Details:FindBuffCastedBy(targetName, spellId, sourceName) + local auraName, texture, count, auraType, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod, v1, v2, v3, v4, v5 = Details:FindBuffCastedByUnitName (targetName, spellId, sourceName) local versaGained = v1 if (type(versaGained) == "number") then