diff --git a/Details.toc b/Details.toc index 72ecdb33..fe39b459 100644 --- a/Details.toc +++ b/Details.toc @@ -34,6 +34,7 @@ core\util.lua functions\mixin.lua API.lua +functions\ej_cache.lua functions\events.lua functions\private.lua functions\profiles.lua diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 3e503259..4569b380 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 490 +local dversion = 491 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) @@ -313,23 +313,51 @@ function DF.GetSpecializationRole(...) return nil end +--[=[ dump of C_EncounterJournal + ["GetEncountersOnMap"] = function, + ["SetPreviewMythicPlusLevel"] = function, + ["GetLootInfoByIndex"] = function, + ["GetSlotFilter"] = function, + ["IsEncounterComplete"] = function, + ["SetTab"] = function, + ["ResetSlotFilter"] = function, + ["OnOpen"] = function, + ["InstanceHasLoot"] = function, + ["GetSectionIconFlags"] = function, + ["SetPreviewPvpTier"] = function, + ["GetEncounterJournalLink"] = function, + ["GetInstanceForGameMap"] = function, + ["GetSectionInfo"] = function, + ["GetLootInfo"] = function, + ["GetDungeonEntrancesForMap"] = function, + ["OnClose"] = function, + ["SetSlotFilter"] = function, +--]=] + --build dummy encounter journal functions if they doesn't exists --this is done for compatibility with classic and if in the future EJ_ functions are moved to C_ +---@class EncounterJournal : table +---@field EJ_GetInstanceForMap fun(mapId: number) +---@field EJ_GetInstanceInfo fun(journalInstanceID: number) +---@field EJ_SelectInstance fun(journalInstanceID: number) +---@field EJ_GetEncounterInfoByIndex fun(index: number, journalInstanceID: number?) +---@field EJ_GetEncounterInfo fun(journalEncounterID: number) +---@field EJ_SelectEncounter fun(journalEncounterID: number) +---@field EJ_GetSectionInfo fun(sectionID: number) +---@field EJ_GetCreatureInfo fun(index: number, journalEncounterID: number?) +---@field EJ_SetDifficulty fun(difficultyID: number) +---@field EJ_GetNumLoot fun(): number DF.EncounterJournal = { - EJ_GetCurrentInstance = EJ_GetCurrentInstance or function() return nil end, EJ_GetInstanceForMap = EJ_GetInstanceForMap or function() return nil end, EJ_GetInstanceInfo = EJ_GetInstanceInfo or function() return nil end, EJ_SelectInstance = EJ_SelectInstance or function() return nil end, - EJ_GetEncounterInfoByIndex = EJ_GetEncounterInfoByIndex or function() return nil end, EJ_GetEncounterInfo = EJ_GetEncounterInfo or function() return nil end, EJ_SelectEncounter = EJ_SelectEncounter or function() return nil end, - EJ_GetSectionInfo = EJ_GetSectionInfo or function() return nil end, EJ_GetCreatureInfo = EJ_GetCreatureInfo or function() return nil end, EJ_SetDifficulty = EJ_SetDifficulty or function() return nil end, EJ_GetNumLoot = EJ_GetNumLoot or function() return 0 end, - EJ_GetLootInfoByIndex = EJ_GetLootInfoByIndex or function() return nil end, } --will always give a very random name for our widgets diff --git a/Libs/DF/loadconditions.lua b/Libs/DF/loadconditions.lua index bea2e91b..a4bbd50d 100644 --- a/Libs/DF/loadconditions.lua +++ b/Libs/DF/loadconditions.lua @@ -100,20 +100,19 @@ local default_load_conditions_frame_options = { function detailsFramework:CreateLoadFilterParser(callback) local filterFrame = CreateFrame("frame") - filterFrame:RegisterEvent("PLAYER_ENTERING_WORLD") - + if IS_WOW_PROJECT_MAINLINE then filterFrame:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED") + filterFrame:RegisterEvent("TRAIT_CONFIG_LIST_UPDATED") + filterFrame:RegisterEvent("CHALLENGE_MODE_START") + else + filterFrame:RegisterEvent("PLAYER_ENTERING_WORLD") filterFrame:RegisterEvent("PLAYER_TALENT_UPDATE") end filterFrame:RegisterEvent("PLAYER_ROLES_ASSIGNED") filterFrame:RegisterEvent("ZONE_CHANGED_NEW_AREA") - if IS_WOW_PROJECT_MAINLINE then - filterFrame:RegisterEvent("CHALLENGE_MODE_START") - end - filterFrame:RegisterEvent("ENCOUNTER_START") filterFrame:RegisterEvent("PLAYER_REGEN_ENABLED") filterFrame:RegisterEvent("PLAYER_REGEN_DISABLED") diff --git a/Libs/LibOpenRaid/GetPlayerInformation.lua b/Libs/LibOpenRaid/GetPlayerInformation.lua index a019b031..07e87652 100644 --- a/Libs/LibOpenRaid/GetPlayerInformation.lua +++ b/Libs/LibOpenRaid/GetPlayerInformation.lua @@ -711,9 +711,10 @@ local bIsNewUnitAuraAvailable = C_UnitAuras and C_UnitAuras.GetAuraDataBySlot an local auraSpellID local auraDurationTime +local auraUnitId local handleBuffAura = function(aura) - local auraInfo = C_UnitAuras.GetAuraDataByAuraInstanceID("player", aura.auraInstanceID) + local auraInfo = C_UnitAuras.GetAuraDataByAuraInstanceID(auraUnitId, aura.auraInstanceID) if (auraInfo) then local spellId = auraInfo.spellId if (auraSpellID == spellId) then @@ -724,7 +725,7 @@ local handleBuffAura = function(aura) end end -local getAuraDuration = function(spellId) +local getAuraDuration = function(spellId, unitId) --some auras does not have the same spellId of the cast as the spell for its aura duration --in these cases, it's necessary to declare the buff spellId which tells the duration of the effect by adding 'durationSpellId = spellId' within the cooldown data if (not LIB_OPEN_RAID_PLAYERCOOLDOWNS[spellId]) then @@ -740,8 +741,9 @@ local getAuraDuration = function(spellId) local bUsePackedAura = true auraSpellID = customBuffDuration or spellId auraDurationTime = 0 --reset duration + auraUnitId = unitId or "player" - AuraUtil.ForEachAura("player", "HELPFUL", bBatchCount, handleBuffAura, bUsePackedAura) --check auras to find a buff for the spellId + AuraUtil.ForEachAura(auraUnitId, "HELPFUL", bBatchCount, handleBuffAura, bUsePackedAura) --check auras to find a buff for the spellId if (auraDurationTime == 0) then --if the buff wasn't found, attempt to get the duration from the file return LIB_OPEN_RAID_PLAYERCOOLDOWNS[spellId].duration or 0 @@ -754,9 +756,10 @@ end ---get the duration of a buff placed by a spell ---@param spellId number +---@param unitId string? ---@return number duration -function openRaidLib.CooldownManager.GetSpellBuffDuration(spellId) - return getAuraDuration(spellId) +function openRaidLib.CooldownManager.GetSpellBuffDuration(spellId, unitId) + return getAuraDuration(spellId, unitId) end ---check if a player cooldown is ready or if is in cooldown @@ -856,6 +859,51 @@ do end +do + local getUnitName = function(unitId) + local unitName, realmName = UnitName(unitId) + if (unitName) then + if (realmName and realmName ~= "") then + unitName = unitName .. "-" .. realmName + end + return unitName + end + end + + local predicateFunc = function(spellIdToFind, casterName, _, name, icon, applications, dispelName, duration, expirationTime, sourceUnitId, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod, applications) + if (spellIdToFind == spellId and UnitExists(sourceUnitId)) then + if (casterName == getUnitName(sourceUnitId)) 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 openRaidLib.AuraTracker.FindBuffDuration(unitId, casterName, spellId) + local name, texture, count, buffType, duration, expirationTime = AuraUtil.FindAura(predicateFunc, unitId, "HELPFUL", spellId, casterName) + if (name) then + return duration, expirationTime + end + end + + ---find the duration of a buff placed by a unit + ---@param targetString string + ---@param casterString string + ---@param spellId number + function openRaidLib.AuraTracker.FindBuffDurationByUnitName(targetString, casterString, spellId) + local targetName = Ambiguate(targetString, "none") + local casterName = Ambiguate(casterString, "none") + return openRaidLib.AuraTracker.FindBuffDuration(targetName, casterName, spellId) + end + +end + + --which is the main attribute of each spec --1 Intellect diff --git a/Libs/LibOpenRaid/LibOpenRaid.lua b/Libs/LibOpenRaid/LibOpenRaid.lua index 4e8f217e..287556c0 100644 --- a/Libs/LibOpenRaid/LibOpenRaid.lua +++ b/Libs/LibOpenRaid/LibOpenRaid.lua @@ -23,6 +23,10 @@ BUGS: --]=] +---@alias castername string +---@alias castspellid string +---@alias schedulename string + LIB_OPEN_RAID_CAN_LOAD = false local versionString, revision, launchDate, gameVersion = GetBuildInfo() @@ -39,7 +43,7 @@ if (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE and not isExpansion_Dragonflight()) t end local major = "LibOpenRaid-1.0" -local CONST_LIB_VERSION = 114 +local CONST_LIB_VERSION = 115 if (LIB_OPEN_RAID_MAX_VERSION) then if (CONST_LIB_VERSION <= LIB_OPEN_RAID_MAX_VERSION) then @@ -114,8 +118,8 @@ end local CONST_SPECIALIZATION_VERSION_CLASSIC = 0 local CONST_SPECIALIZATION_VERSION_MODERN = 1 - local CONST_COOLDOWN_CHECK_INTERVAL = CONST_ONE_SECOND - local CONST_COOLDOWN_TIMELEFT_HAS_CHANGED = CONST_ONE_SECOND + local CONST_COOLDOWN_CHECK_INTERVAL = CONST_THREE_SECONDS + local CONST_COOLDOWN_TIMELEFT_HAS_CHANGED = CONST_THREE_SECONDS local CONST_COOLDOWN_INDEX_TIMELEFT = 1 local CONST_COOLDOWN_INDEX_CHARGES = 2 @@ -126,6 +130,8 @@ end local CONST_COOLDOWN_INFO_SIZE = 6 + local CONST_USE_DEFAULT_SCHEDULE_TIME = true + local GetContainerNumSlots = GetContainerNumSlots or C_Container.GetContainerNumSlots local GetContainerItemID = GetContainerItemID or C_Container.GetContainerItemID local GetContainerItemLink = GetContainerItemLink or C_Container.GetContainerItemLink @@ -474,6 +480,34 @@ end end end + ---@class commdata : table + ---@field data string + ---@field channel string + + ---@type {}[] + local commScheduler = {} + + do + --if there's an old version that already registered the comm ticker, cancel it + if (LIB_OPEN_RAID_COMM_SCHEDULER) then + LIB_OPEN_RAID_COMM_SCHEDULER:Cancel() + end + + --make the lib throttle the comms to one per second + local newTickerHandle = C_Timer.NewTicker(1, function() + for i = #commScheduler, 1, -1 do + local commData = commScheduler[i] + if (commData) then + sendData(commData.data, commData.channel) + table.remove(commScheduler, i) + return + end + end + end) + + LIB_OPEN_RAID_COMM_SCHEDULER = newTickerHandle + end + function openRaidLib.commHandler.SendCommData(data, flags) local LibDeflate = LibStub:GetLibrary("LibDeflate") local dataCompressed = LibDeflate:CompressDeflate(data, {level = 9}) @@ -482,34 +516,56 @@ end if (flags) then if (bit.band(flags, CONST_COMM_SENDTO_PARTY)) then --send to party if (IsInGroup() and not IsInRaid()) then - sendData(dataEncoded, IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and "INSTANCE_CHAT" or "PARTY") + ---@type commdata + local commData = {data = dataEncoded, channel = IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and "INSTANCE_CHAT" or "PARTY"} + table.insert(commScheduler, commData) end end if (bit.band(flags, CONST_COMM_SENDTO_RAID)) then --send to raid if (IsInRaid()) then - sendData(dataEncoded, IsInRaid(LE_PARTY_CATEGORY_INSTANCE) and "INSTANCE_CHAT" or "RAID") + local commData = {data = dataEncoded, channel = IsInRaid(LE_PARTY_CATEGORY_INSTANCE) and "INSTANCE_CHAT" or "RAID"} + table.insert(commScheduler, commData) end end if (bit.band(flags, CONST_COMM_SENDTO_GUILD)) then --send to guild if (IsInGuild()) then - sendData(dataEncoded, "GUILD") + local commData = {data = dataEncoded, channel = "GUILD"} + table.insert(commScheduler, commData) end end else if (IsInGroup() and not IsInRaid()) then --in party only - sendData(dataEncoded, IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and "INSTANCE_CHAT" or "PARTY") + local commData = {data = dataEncoded, channel = IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and "INSTANCE_CHAT" or "PARTY"} + table.insert(commScheduler, commData) elseif (IsInRaid()) then - sendData(dataEncoded, IsInRaid(LE_PARTY_CATEGORY_INSTANCE) and "INSTANCE_CHAT" or "RAID") + local commData = {data = dataEncoded, channel = IsInRaid(LE_PARTY_CATEGORY_INSTANCE) and "INSTANCE_CHAT" or "RAID"} + table.insert(commScheduler, commData) end end end - -------------------------------------------------------------------------------------------------------------------------------- --~schedule ~timers + ---@type table + local defaultScheduleCooldownTimeByScheduleName = { + ["sendAllPlayerCooldownsFromTalentChange_Schedule"] = 2, + ["talentChangedCallback_Schedule"] = 20, + ["sendFullData_Schedule"] = 25, + ["sendAllPlayerCooldowns_Schedule"] = 23, + ["sendDurability_Schedule"] = 10, + ["sendAllGearInfo_Schedule"] = 20, + ["petStatus_Schedule"] = 8, + ["updatePlayerData_Schedule"] = 22, + ["sendTalent_Schedule"] = 20, + ["sendPvPTalent_Schedule"] = 14, + ["leaveCombat_Schedule"] = 18, + ["encounterEndCooldownsCheck_Schedule"] = 24, + ["sendKeystoneInfoToParty_Schedule"] = 7, + ["sendKeystoneInfoToGuild_Schedule"] = 7, + } openRaidLib.Schedules = { registeredUniqueTimers = {} @@ -526,6 +582,11 @@ end openRaidLib.Schedules.CancelUniqueTimer(namespace, scheduleName) end + --check if the player is still in group + if (not openRaidLib.IsInGroup()) then + return + end + local result, errortext = xpcall(callback, geterrorhandler(), unpack(payload)) if (not result) then sendChatMessage("openRaidLib: error on scheduler:", tickerObject.scheduleName, tickerObject.stack) @@ -547,7 +608,15 @@ end --create an unique schedule --if a schedule already exists, cancels it and make a new function openRaidLib.Schedules.NewUniqueTimer(time, callback, namespace, scheduleName, ...) - openRaidLib.Schedules.CancelUniqueTimer(namespace, scheduleName) + --the the schedule uses a default time, get it from the table, if the timer already exists, quit + if (time == CONST_USE_DEFAULT_SCHEDULE_TIME) then + if (openRaidLib.Schedules.IsUniqueTimerOnCooldown(namespace, scheduleName)) then + return + end + time = defaultScheduleCooldownTimeByScheduleName[scheduleName] + else + openRaidLib.Schedules.CancelUniqueTimer(namespace, scheduleName) + end local newTimer = openRaidLib.Schedules.NewTimer(time, callback, ...) newTimer.namespace = namespace @@ -560,6 +629,17 @@ end registeredUniqueTimers[namespace][scheduleName] = newTimer end + --does timer by schedule name exists? + function openRaidLib.Schedules.IsUniqueTimerOnCooldown(namespace, scheduleName) + local registeredUniqueTimers = openRaidLib.Schedules.registeredUniqueTimers + local currentSchedule = registeredUniqueTimers[namespace] and registeredUniqueTimers[namespace][scheduleName] + + if (currentSchedule) then + return true + end + return false + end + --cancel an unique schedule function openRaidLib.Schedules.CancelUniqueTimer(namespace, scheduleName) local registeredUniqueTimers = openRaidLib.Schedules.registeredUniqueTimers @@ -642,7 +722,7 @@ end local eventCallbacks = openRaidLib.publicCallback.events[event] for i = 1, #eventCallbacks do - local thisCallback = eventCallbacks[i] --got a case where this was nil, which is kinda impossible? | event: CooldownUpdate + local thisCallback = eventCallbacks[i] --got a case where this was nil, which is kinda impossible? | event: CooldownUpdate local addonObject = thisCallback[1] --670: attempt to index local 'thisCallback' (a nil value) local functionName = thisCallback[2] @@ -654,8 +734,8 @@ end (for index) = 2 (for limit) = 2 (for step) = 1 - i = 2 - + i = 2 + thisCallback = nil --]=] @@ -757,7 +837,7 @@ end openRaidLib.internalCallback.TriggerEvent("talentUpdate") end local delayedTalentChange = function() - openRaidLib.Schedules.NewUniqueTimer(math.random(3, 6), talentChangedCallback, "TalentChangeEventGroup", "talentChangedCallback_Schedule") + openRaidLib.Schedules.NewUniqueTimer(math.random(4, 8), talentChangedCallback, "TalentChangeEventGroup", "talentChangedCallback_Schedule") end local eventFunctions = { @@ -2058,7 +2138,7 @@ end openRaidLib.CooldownManager.UpdatePlayerCooldownsLocally() --schedule send to the group, using a large delay to send due to the player might change more talents at once - openRaidLib.Schedules.NewUniqueTimer(4 + math.random(0, 1), openRaidLib.CooldownManager.SendAllPlayerCooldowns, "CooldownManager", "sendAllPlayerCooldowns_Schedule") + openRaidLib.Schedules.NewUniqueTimer(4 + math.random(0, 1), openRaidLib.CooldownManager.SendAllPlayerCooldowns, "CooldownManager", "sendAllPlayerCooldownsFromTalentChange_Schedule") end --check cooldown reset after a raid encounter ends finishing ongoing timeLeft tickers @@ -2693,45 +2773,59 @@ openRaidLib.commHandler.RegisterComm(CONST_COMM_COOLDOWNREQUEST_PREFIX, openRaid -------------------------------------------------------------------------------------------------------------------------------- --data ---vintage cooldown tracker and interrupt tracker -C_Timer.After(0.1, function() - local vintageCDTrackerFrame = CreateFrame("frame") - vintageCDTrackerFrame:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED") +local createLocalCooldownTracker = function() + local cdTrackerFrame = CreateFrame("frame") + cdTrackerFrame:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED") local allCooldownsFromLib = LIB_OPEN_RAID_COOLDOWNS_INFO + + ---@type table> local recentCastedSpells = {} - vintageCDTrackerFrame:SetScript("OnEvent", function(self, event, ...) + cdTrackerFrame:SetScript("OnEvent", function(self, event, ...) if (event == "UNIT_SPELLCAST_SUCCEEDED") then - local unit, castGUID, spellId = ... + local unitId, castGUID, spellId = ... - local unitIsThePlayer = UnitIsUnit(unit, "player") - if (not unitIsThePlayer) then - local unitName = GetUnitName(unit, true) - local hasLib = openRaidLib.CooldownManager.HasFullCooldownList[unitName] - if (unitName and not hasLib) then - local unitInGroup = UnitInParty(unit) or UnitInRaid(unit) + --don't track spells casted by the player + local bUnitIsThePlayer = UnitIsUnit(unitId, "player") + if (not bUnitIsThePlayer) then + --get the caster name and check if it's a unit in the group + local casterName = GetUnitName(unitId, true) + if (casterName) then + local unitInGroup = UnitInParty(unitId) or UnitInRaid(unitId) if (unitInGroup) then + --check if the library has the spell in the list of cooldowns local spellData = allCooldownsFromLib[spellId] - if (spellData) then -- and not openRaidLib.GetUnitCooldown(unitName) - --check for cast_success spam from channel spells - local unitCastCooldown = recentCastedSpells[unitName] + + --check for overwrite spell ids + + if (spellData) then + --check for cast_success spam from channel spells using a cooldown timer + local unitCastCooldown = recentCastedSpells[casterName] if (not unitCastCooldown) then unitCastCooldown = {} - recentCastedSpells[unitName] = unitCastCooldown + recentCastedSpells[casterName] = unitCastCooldown end + --don't register the cooldown if the spell was casted recently if (not unitCastCooldown[spellId] or unitCastCooldown[spellId]+5 < GetTime()) then unitCastCooldown[spellId] = GetTime() + --local auraName, texture, count, auraType, auraDuration, expirationTime = openRaidLib.AuraTracker.FindBuffDurationByUnitName(casterName, casterName, spellId) + local auraDuration = openRaidLib.CooldownManager.GetSpellBuffDuration(spellId, unitId) + --trigger a cooldown usage - local duration = spellData.duration - --time left, charges, startTimeOffset, duration - openRaidLib.CooldownManager.CooldownSpellUpdate(unitName, spellId, duration, 0, 0, duration, 0) - local cooldownInfo = cooldownGetSpellInfo(unitName, spellId) - local unitCooldownsTable = openRaidLib.GetUnitCooldowns(unitName) + local timeLeft = spellData.cooldown + local duration = spellData.duration or 0 + local newCharges = 0 + local startTimeOffset = 0 + local buffDuration = auraDuration or spellData.duration or 0 + + openRaidLib.CooldownManager.CooldownSpellUpdate(casterName, spellId, timeLeft, newCharges, startTimeOffset, duration, buffDuration) + local cooldownInfo = cooldownGetSpellInfo(casterName, spellId) + local unitCooldownsTable = openRaidLib.GetUnitCooldowns(casterName) --trigger a public callback - openRaidLib.publicCallback.TriggerCallback("CooldownUpdate", openRaidLib.GetUnitID(unitName), spellId, cooldownInfo, unitCooldownsTable, openRaidLib.CooldownManager.UnitData) + openRaidLib.publicCallback.TriggerCallback("CooldownUpdate", openRaidLib.GetUnitID(casterName), spellId, cooldownInfo, unitCooldownsTable, openRaidLib.CooldownManager.UnitData) end end end @@ -2739,19 +2833,11 @@ C_Timer.After(0.1, function() end end end) +end + +--vintage cooldown tracker and interrupt tracker +C_Timer.After(0.1, function() + createLocalCooldownTracker() end) tempCache.RestoreData() - - ---[=[ -3x ...ns/Details/Libs/LibOpenRaid/GetPlayerInformation.lua:603: attempt to index field '?' (a nil value) -[string "@Interface/AddOns/Details/Libs/LibOpenRaid/GetPlayerInformation.lua"]:634: in function `GetPlayerCooldownStatus' -[string "@Interface/AddOns/Details/Libs/LibOpenRaid/LibOpenRaid.lua"]:1696: in function `CleanupCooldownTickers' -[string "@Interface/AddOns/Details/Libs/LibOpenRaid/LibOpenRaid.lua"]:1925: in function <...face/AddOns/Details/Libs/LibOpenRaid/LibOpenRaid.lua:1924> -[string "=[C]"]: in function `xpcall' -[string "@Interface/AddOns/Details/Libs/LibOpenRaid/LibOpenRaid.lua"]:506: in function <...face/AddOns/Details/Libs/LibOpenRaid/LibOpenRaid.lua:496> - - - -]=] diff --git a/Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua b/Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua index eb9cd63e..377b9859 100644 --- a/Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua +++ b/Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua @@ -340,23 +340,23 @@ do [59542] = {cooldown = 180, duration = 0, specs = {}, talent = false, charges = 1, raceid = {[11] = true}, race = "Draenei", class = "", type = 9}, --Gift of the Naaru (Draenei) --interrupts - [6552] = {class = "WARRIOR", specs = {71, 72, 73}, cooldown = 15, silence = 4, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Pummel - [2139] = {class = "MAGE", specs = {62, 63, 64}, cooldown = 24, silence = 6, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Counterspell - [15487] = {class = "PRIEST", specs = {258}, cooldown = 45, silence = 4, talent = false, cooldownWithTalent = 30, cooldownTalentId = 23137, type = 6, charges = 1}, --Silence (shadow) Last Word Talent to reduce cooldown in 15 seconds - [1766] = {class = "ROGUE", specs = {259, 260, 261}, cooldown = 15, silence = 5, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Kick - [96231] = {class = "PALADIN", specs = {66, 70}, cooldown = 15, silence = 4, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Rebuke (protection and retribution) - [116705] = {class = "MONK", specs = {268, 269}, cooldown = 15, silence = 4, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Spear Hand Strike (brewmaster and windwalker) - [57994] = {class = "SHAMAN", specs = {262, 263, 264}, cooldown = 12, silence = 3, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Wind Shear - [47528] = {class = "DEATHKNIGHT", specs = {250, 251, 252}, cooldown = 15, silence = 3, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Mind Freeze - [106839] = {class = "DRUID", specs = {103, 104}, cooldown = 15, silence = 4, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Skull Bash (feral, guardian) - [78675] = {class = "DRUID", specs = {102}, cooldown = 60, silence = 8, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Solar Beam (balance) - [147362] = {class = "HUNTER", specs = {253, 254}, cooldown = 24, silence = 3, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Counter Shot (beast mastery, marksmanship) - [187707] = {class = "HUNTER", specs = {255}, cooldown = 15, silence = 3, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Muzzle (survival) - [183752] = {class = "DEMONHUNTER", specs = {577, 581}, cooldown = 15, silence = 3, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Disrupt - [19647] = {class = "WARLOCK", specs = {265, 266, 267}, cooldown = 24, silence = 6, talent = false, cooldownWithTalent = false, cooldownTalentId = false, pet = 417, type = 6, charges = 1}, --Spell Lock (pet felhunter ability) - [132409] = {class = "WARLOCK", specs = {}, cooldown = 24, silence = 4, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Spell Lock with felhunter Sacrified by Grimeoire of Sacrifice - [89766] = {class = "WARLOCK", specs = {266}, cooldown = 30, silence = 4, talent = false, cooldownWithTalent = false, cooldownTalentId = false, pet = 17252, type = 6, charges = 1}, --Axe Toss (pet felguard ability) - [351338] = {class = "EVOKER", specs = {1467, 1468}, cooldown = 40, silence = 4, talent = false, cooldownWithTalent = false, cooldownTalentId = false, charges = 1, type = 6}, --Quell (Evoker) + [6552] = {duration = 0, class = "WARRIOR", specs = {71, 72, 73}, cooldown = 15, silence = 4, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Pummel + [2139] = {duration = 0, class = "MAGE", specs = {62, 63, 64}, cooldown = 24, silence = 6, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Counterspell + [15487] = {duration = 0, class = "PRIEST", specs = {258}, cooldown = 45, silence = 4, talent = false, cooldownWithTalent = 30, cooldownTalentId = 23137, type = 6, charges = 1}, --Silence (shadow) Last Word Talent to reduce cooldown in 15 seconds + [1766] = {duration = 0, class = "ROGUE", specs = {259, 260, 261}, cooldown = 15, silence = 5, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Kick + [96231] = {duration = 0, class = "PALADIN", specs = {66, 70}, cooldown = 15, silence = 4, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Rebuke (protection and retribution) + [116705] = {duration = 0, class = "MONK", specs = {268, 269}, cooldown = 15, silence = 4, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Spear Hand Strike (brewmaster and windwalker) + [57994] = {duration = 0, class = "SHAMAN", specs = {262, 263, 264}, cooldown = 12, silence = 3, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Wind Shear + [47528] = {duration = 0, class = "DEATHKNIGHT", specs = {250, 251, 252}, cooldown = 15, silence = 3, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Mind Freeze + [106839] = {duration = 0, class = "DRUID", specs = {103, 104}, cooldown = 15, silence = 4, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Skull Bash (feral, guardian) + [78675] = {duration = 0, class = "DRUID", specs = {102}, cooldown = 60, silence = 8, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Solar Beam (balance) + [147362] = {duration = 0, class = "HUNTER", specs = {253, 254}, cooldown = 24, silence = 3, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Counter Shot (beast mastery, marksmanship) + [187707] = {duration = 0, class = "HUNTER", specs = {255}, cooldown = 15, silence = 3, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Muzzle (survival) + [183752] = {duration = 0, class = "DEMONHUNTER", specs = {577, 581}, cooldown = 15, silence = 3, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Disrupt + [19647] = {duration = 0, class = "WARLOCK", specs = {265, 266, 267}, cooldown = 24, silence = 6, talent = false, cooldownWithTalent = false, cooldownTalentId = false, pet = 417, type = 6, charges = 1}, --Spell Lock (pet felhunter ability) + [132409] = {duration = 0, class = "WARLOCK", specs = {}, cooldown = 24, silence = 4, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Spell Lock with felhunter Sacrified by Grimeoire of Sacrifice + [89766] = {duration = 0, class = "WARLOCK", specs = {266}, cooldown = 30, silence = 4, talent = false, cooldownWithTalent = false, cooldownTalentId = false, pet = 17252, type = 6, charges = 1}, --Axe Toss (pet felguard ability) + [351338] = {duration = 0, class = "EVOKER", specs = {1467, 1468}, cooldown = 40, silence = 4, talent = false, cooldownWithTalent = false, cooldownTalentId = false, charges = 1, type = 6}, --Quell (Evoker) --~paladin -- 65 - Holy diff --git a/boot.lua b/boot.lua index 1b37a680..82466141 100644 --- a/boot.lua +++ b/boot.lua @@ -13,8 +13,8 @@ local addonName, Details222 = ... local version, build, date, tocversion = GetBuildInfo() - Details.build_counter = 12097 - Details.alpha_build_counter = 12097 --if this is higher than the regular counter, use it instead + Details.build_counter = 12109 + Details.alpha_build_counter = 12109 --if this is higher than the regular counter, use it instead Details.dont_open_news = true Details.game_version = version Details.userversion = version .. " " .. Details.build_counter @@ -125,6 +125,8 @@ Details222.CurrentDPS = { Cache = {} } + --store all data from the encounter journal + Details222.EncounterJournalDump = {} ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --initialization stuff @@ -141,6 +143,14 @@ do --]=] local news = { + {"v10.2.0.12109.155", "December 14th, 2023"}, + "Classic now uses the same combat log reader as retail (Flamanis).", + "Merged Rage of Fyr'alath spells (equara)", + "Added Rogue Ambushes to merged spells (WillowGryph).", + "The Remove Common Segments option now also removes segments trash between raid bosses.", + "Fixed an issue where auras applied before combat start, such as Power Infusion and Prescience, which are counted towards the target, were not being accounted for.", + "Added to Combat Class: classCombat:GetRunTimeNoDefault(). This returns the run time of the Mythic+ if available, nil otherwise.", + {"v10.2.0.12096.155", "December 1st, 2023"}, "Added Mythic+ Overall DPS calculation options: 'Use Total Combat Time' and 'Use Run Time'. These options are available in the Mythic Dungeon section of the options panel. The option 'Use Run Time', takes the player's damage and divide by the total elapsed time of the run.", "Added reset options: 'Remove Common Segments' and 'Reset, but keep Mythic+ Overall Segments'.", diff --git a/classes/class_utility.lua b/classes/class_utility.lua index 348352c0..a47769c3 100644 --- a/classes/class_utility.lua +++ b/classes/class_utility.lua @@ -1463,14 +1463,14 @@ function _detalhes:CatchRaidDebuffUptime (in_or_out) -- "DEBUFF_UPTIME_IN" end --this shouldn't be hardcoded -local runes_id = { +local runeIds = { [175457] = true, -- focus [175456] = true, --hyper [175439] = true, --stout } --called from control on leave / enter combat -function _detalhes:CatchRaidBuffUptime(in_or_out) +function _detalhes:CatchRaidBuffUptime(sOperationType) if (IsInRaid()) then local potUsage = {} local focusAugmentation = {} @@ -1490,13 +1490,13 @@ function _detalhes:CatchRaidBuffUptime(in_or_out) for buffIndex = 1, 41 do local name, _, _, _, _, _, unitCaster, _, _, spellId = _UnitAura(unitId, buffIndex, nil, "HELPFUL") if (name and unitCaster and UnitExists(unitCaster) and UnitExists(unitId) and UnitIsUnit(unitCaster, unitId)) then - _detalhes.parser:add_buff_uptime(nil, cacheGetTime, playerGUID, playerName, 0x00000514, playerGUID, playerName, 0x00000514, 0x0, spellId, name, in_or_out) + _detalhes.parser:add_buff_uptime(nil, cacheGetTime, playerGUID, playerName, 0x00000514, playerGUID, playerName, 0x00000514, 0x0, spellId, name, sOperationType) - if (in_or_out == "BUFF_UPTIME_IN") then + if (sOperationType == "BUFF_UPTIME_IN") then if (_detalhes.PotionList[spellId]) then potUsage[playerName] = spellId - elseif(runes_id[spellId]) then + elseif(runeIds[spellId]) then focusAugmentation[playerName] = true end end @@ -1505,7 +1505,7 @@ function _detalhes:CatchRaidBuffUptime(in_or_out) end end - if (in_or_out == "BUFF_UPTIME_IN") then + if (sOperationType == "BUFF_UPTIME_IN") then local string_output = "pre-potion: " --localize-me for playername, potspellid in pairs(potUsage) do @@ -1529,74 +1529,92 @@ function _detalhes:CatchRaidBuffUptime(in_or_out) --party members for groupIndex = 1, GetNumGroupMembers() - 1 do + local unitId = "party" .. groupIndex for buffIndex = 1, 41 do - local unitId = "party" .. groupIndex - local name, _, _, _, _, _, unitCaster, _, _, spellId = _UnitAura(unitId, buffIndex, nil, "HELPFUL") + if (UnitExists(unitId)) then + local auraName, _, _, _, _, _, unitCaster, _, _, spellId = UnitBuff(unitId, buffIndex) + if (auraName) then + if (UnitExists(unitCaster)) then + local bBuffIsPlacedOnTarget = Details.CreditBuffToTarget[spellId] + if (UnitIsUnit(unitCaster, unitId) or bBuffIsPlacedOnTarget) then + if (bBuffIsPlacedOnTarget and not UnitIsUnit(unitCaster, unitId)) then + --could be prescince, ebom might or power infusion; casted on a target instead of the caster + local sourceSerial = UnitGUID(unitCaster) + local sourceName = Details:GetFullName(unitCaster) + local sourceFlags = 0x514 + local targetSerial = UnitGUID(unitId) + local targetName = Details:GetFullName(unitId) + local targetFlags = 0x514 + local targetFlags2 = 0x0 + local spellName = auraName + --print(targetName, "already had", spellName, "at first of a combat") + Details.parser:buff("SPELL_AURA_APPLIED", time(), sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetFlags2, spellId, spellName, 0x4, "BUFF", 0) + else + local playerGUID = UnitGUID(unitId) + if (playerGUID) then + local playerName = Details:GetFullName(unitId) + if (sOperationType == "BUFF_UPTIME_IN") then + if (_detalhes.PotionList[spellId]) then + potUsage[playerName] = spellId + elseif (runeIds[spellId]) then + focusAugmentation [playerName] = true + end + end - local bBuffIsOnTarget = Details.CreditBuffToTarget[spellId] - - if (name and unitCaster and UnitExists(unitCaster) and UnitExists(unitId) and (UnitIsUnit(unitCaster, unitId) or bBuffIsOnTarget)) then - if (bBuffIsOnTarget and not UnitIsUnit(unitCaster, unitId)) then - --could be prescince, ebom might or power infusion - local sourceSerial = UnitGUID(unitCaster) - local sourceName = Details:GetFullName(unitCaster) - local sourceFlags = 0x518 - local targetSerial = UnitGUID(unitId) - local targetName = Details:GetFullName(unitId) - local targetFlags = 0x518 - local targetFlags2 = 0x0 - local spellName = name - Details.parser:buff("SPELL_AURA_APPLIED", time(), sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetFlags2, spellId, spellName, 0x4, "BUFF", 0) - --Details:Msg("Adding aura already existing in the target:", spellName, spellId, sourceName, targetName) - else - local playerName, realmName = _UnitName(unitId) - local playerGUID = UnitGUID(unitId) - - if (playerGUID) then - if (realmName and realmName ~= "") then - playerName = playerName .. "-" .. realmName - end - - if (in_or_out == "BUFF_UPTIME_IN") then - if (_detalhes.PotionList[spellId]) then - potUsage[playerName] = spellId - elseif (runes_id[spellId]) then - focusAugmentation [playerName] = true + _detalhes.parser:add_buff_uptime(nil, GetTime(), playerGUID, playerName, 0x00000417, playerGUID, playerName, 0x00000417, 0x0, spellId, auraName, sOperationType) + end end end - - _detalhes.parser:add_buff_uptime(nil, GetTime(), playerGUID, playerName, 0x00000417, playerGUID, playerName, 0x00000417, 0x0, spellId, name, in_or_out) end end end end end - --player it self + --player it self (while in a party that isn't a raid group) + local unitId = "player" for buffIndex = 1, 41 do - local name, _, _, _, _, _, unitCaster, _, _, spellid = _UnitAura ("player", buffIndex, nil, "HELPFUL") - if (name and unitCaster and UnitExists(unitCaster) and UnitIsUnit(unitCaster, "player")) then - local playerName = Details.playername - local playerGUID = UnitGUID("player") - if (playerGUID) then - if (in_or_out == "BUFF_UPTIME_IN") then - if (_detalhes.PotionList [spellid]) then - potUsage [playerName] = spellid - elseif (runes_id [spellid]) then - focusAugmentation [playerName] = true + local auraName, _, _, _, _, _, unitCaster, _, _, spellId = UnitBuff(unitId, buffIndex) + if (auraName) then + if (UnitExists(unitCaster)) then -- and unitCaster and UnitExists(unitCaster) and UnitIsUnit(unitCaster, unitId) + local bBuffIsPlacedOnTarget = Details.CreditBuffToTarget[spellId] + if (UnitIsUnit(unitCaster, unitId) or bBuffIsPlacedOnTarget) then + if (bBuffIsPlacedOnTarget and not UnitIsUnit(unitCaster, unitId)) then + --could be prescince, ebom might or power infusion; casted on a target instead of the caster + local sourceSerial = UnitGUID(unitCaster) + local sourceName = Details:GetFullName(unitCaster) + local sourceFlags = 0x514 + local targetSerial = UnitGUID(unitId) + local targetName = Details:GetFullName(unitId) + local targetFlags = 0x514 + local targetFlags2 = 0x0 + local spellName = auraName + Details.parser:buff("SPELL_AURA_APPLIED", time(), sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetFlags2, spellId, spellName, 0x4, "BUFF", 0) + else + local playerName = Details:GetFullName(unitId) + local playerGUID = UnitGUID(unitId) + if (playerGUID) then + if (sOperationType == "BUFF_UPTIME_IN") then + if (_detalhes.PotionList[spellId]) then + potUsage [playerName] = spellId + elseif (runeIds[spellId]) then + focusAugmentation[playerName] = true + end + end + + _detalhes.parser:add_buff_uptime(nil, GetTime(), playerGUID, playerName, 0x00000417, playerGUID, playerName, 0x00000417, 0x0, spellId, auraName, sOperationType) + end end end - - _detalhes.parser:add_buff_uptime (nil, GetTime(), playerGUID, playerName, 0x00000417, playerGUID, playerName, 0x00000417, 0x0, spellid, name, in_or_out) end end end - if (in_or_out == "BUFF_UPTIME_IN") then + if (sOperationType == "BUFF_UPTIME_IN") then local string_output = "pre-potion: " for playername, potspellid in pairs(potUsage) do - local name, _, icon = _GetSpellInfo(potspellid) + local auraName, _, icon = _GetSpellInfo(potspellid) local unitClass = Details:GetUnitClass(playername) local class_color = "" if (unitClass and RAID_CLASS_COLORS[unitClass]) then @@ -1609,35 +1627,35 @@ function _detalhes:CatchRaidBuffUptime(in_or_out) _detalhes:SendEvent("COMBAT_PREPOTION_UPDATED", nil, potUsage, focusAugmentation) end - else - + else --end of IsInGroup + --player alone local pot_usage = {} local focus_augmentation = {} for buffIndex = 1, 41 do - local name, _, _, _, _, _, unitCaster, _, _, spellid = _UnitAura ("player", buffIndex, nil, "HELPFUL") - if (name and unitCaster and UnitExists(unitCaster) and UnitIsUnit(unitCaster, "player")) then + local auraName, _, _, _, _, _, unitCaster, _, _, spellid = _UnitAura ("player", buffIndex, nil, "HELPFUL") + if (auraName and unitCaster and UnitExists(unitCaster) and UnitIsUnit(unitCaster, "player")) then local playerName = Details.playername local playerGUID = UnitGUID("player") if (playerGUID) then - if (in_or_out == "BUFF_UPTIME_IN") then + if (sOperationType == "BUFF_UPTIME_IN") then if (_detalhes.PotionList [spellid]) then pot_usage [playerName] = spellid - elseif (runes_id [spellid]) then + elseif (runeIds [spellid]) then focus_augmentation [playerName] = true end end - _detalhes.parser:add_buff_uptime (nil, GetTime(), playerGUID, playerName, 0x00000417, playerGUID, playerName, 0x00000417, 0x0, spellid, name, in_or_out) + _detalhes.parser:add_buff_uptime (nil, GetTime(), playerGUID, playerName, 0x00000417, playerGUID, playerName, 0x00000417, 0x0, spellid, auraName, sOperationType) end end end --[ - if (in_or_out == "BUFF_UPTIME_IN") then + if (sOperationType == "BUFF_UPTIME_IN") then local string_output = "pre-potion: " for playername, potspellid in pairs(pot_usage) do - local name, _, icon = _GetSpellInfo(potspellid) + local auraName, _, icon = _GetSpellInfo(potspellid) local unitClass = Details:GetUnitClass(playername) local class_color = "" if (unitClass and RAID_CLASS_COLORS[unitClass]) then diff --git a/core/control.lua b/core/control.lua index 71062720..57b9b3d3 100644 --- a/core/control.lua +++ b/core/control.lua @@ -24,20 +24,19 @@ local IsShiftKeyDown = IsShiftKeyDown local IsControlKeyDown = IsControlKeyDown - local atributo_damage = Details.atributo_damage --details local - local atributo_heal = Details.atributo_heal --details local - local atributo_energy = Details.atributo_energy --details local - local atributo_misc = Details.atributo_misc --details local - local atributo_custom = Details.atributo_custom --details local - local breakdownWindowFrame = Details.BreakdownWindowFrame --details local + local atributo_damage = Details.atributo_damage + local atributo_heal = Details.atributo_heal + local atributo_energy = Details.atributo_energy + local atributo_misc = Details.atributo_misc + local atributo_custom = Details.atributo_custom local UnitGroupRolesAssigned = DetailsFramework.UnitGroupRolesAssigned ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --constants - local modo_GROUP = Details.modos.group - local modo_ALL = Details.modos.all - local class_type_dano = Details.atributos.dano + local groupMode = Details.modos.group + local everythingMode = Details.modos.all + local attributeDamage = Details.atributos.dano local OBJECT_TYPE_PETS = 0x00003000 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -51,12 +50,11 @@ --try to find the opponent of last fight, can be called during a fight as well function Details:FindEnemy() - local ZoneName, InstanceType, DifficultyID, _, _, _, _, ZoneMapID = GetInstanceInfo() - local in_instance = IsInInstance() --garrison returns party as instance type. - - if ((InstanceType == "party" or InstanceType == "raid") and in_instance) then - if (InstanceType == "party") then - if (Details:GetBossNames (Details.zone_id)) then + local zoneName, instanceType = GetInstanceInfo() + local bIsInInstance = IsInInstance() --garrison returns party as instance type + if ((instanceType == "party" or instanceType == "raid") and bIsInInstance) then + if (instanceType == "party") then + if (Details:GetBossNames(Details.zone_id)) then return Loc ["STRING_SEGMENT_TRASH"] end else @@ -64,45 +62,43 @@ end end - for _, actor in ipairs(Details.tabela_vigente[class_type_dano]._ActorTable) do + local currentCombat = Details:GetCurrentCombat() + for _, actor in ipairs(currentCombat[attributeDamage]._ActorTable) do if (not actor.grupo and not actor.owner and not actor.nome:find("[*]") and bitBand(actor.flag_original, 0x00000060) ~= 0) then --0x20+0x40 neutral + enemy reaction for name, _ in pairs(actor.targets) do if (name == Details.playername) then return actor.nome else - local _target_actor = Details.tabela_vigente (class_type_dano, name) - if (_target_actor and _target_actor.grupo) then + local targetActor = currentCombat(attributeDamage, name) + if (targetActor and targetActor.grupo) then return actor.nome end end end end - end - for _, actor in ipairs(Details.tabela_vigente[class_type_dano]._ActorTable) do - + for _, actor in ipairs(currentCombat[attributeDamage]._ActorTable) do if (actor.grupo and not actor.owner) then - for target_name, _ in pairs(actor.targets) do - return target_name + for targetName, _ in pairs(actor.targets) do + return targetName end end - end return Loc ["STRING_UNKNOW"] end - -- try get the current encounter name during the encounter - local boss_found_not_registered = function(t, ZoneName, ZoneMapID, DifficultyID) - local boss_table = { + --try get the current encounter name during the encounter + local createBossTable = function(t, zoneName, zoneMapID, difficultyID) + local bossTable = { index = 0, name = t[1], encounter = t[1], - zone = ZoneName, - mapid = ZoneMapID, - diff = DifficultyID, + zone = zoneName, + mapid = zoneMapID, + diff = difficultyID, diff_string = select(4, GetInstanceInfo()), ej_instance_id = t[5], id = t[2], @@ -110,18 +106,22 @@ unixtime = time(), } - Details.tabela_vigente.is_boss = boss_table + local currentCombat = Details:GetCurrentCombat() + currentCombat.is_boss = bossTable end - local boss_found = function(index, name, zone, mapid, diff, encounterid) - local mapID = C_Map.GetBestMapForUnit ("player") + local foundEncounterInfo = function(index, name, zone, mapId, diff, encounterid) + local mapID = C_Map.GetBestMapForUnit("player") local ejid + + if true then return end --@@@disabled for science + if (mapID) then - ejid = DetailsFramework.EncounterJournal.EJ_GetInstanceForMap (mapID) + ejid = DetailsFramework.EncounterJournal.EJ_GetInstanceForMap(mapID) --using the framework to prevent errors on classic versions of the game end + if (not mapID) then - --print("Details! exeption handled: zone has no map") return end @@ -129,12 +129,12 @@ ejid = Details:GetInstanceEJID() end - local boss_table = { + local bossTable = { index = index, name = name, encounter = name, zone = zone, - mapid = mapid, + mapid = mapId, diff = diff, diff_string = select(4, GetInstanceInfo()), ej_instance_id = ejid, @@ -142,107 +142,66 @@ unixtime = time(), } - if (not Details:IsRaidRegistered(mapid) and Details.zone_type == "raid") then - local boss_list = Details:GetCurrentDungeonBossListFromEJ() - if (boss_list) then - local ActorsContainer = Details.tabela_vigente[class_type_dano]._ActorTable - if (ActorsContainer) then - for index, Actor in ipairs(ActorsContainer) do - if (not Actor.grupo) then - if (boss_list[Actor.nome]) then - Actor.boss = true - boss_table.bossimage = boss_list[Actor.nome][4] + local currentCombat = Details:GetCurrentCombat() + + if (not Details:IsRaidRegistered(mapId) and Details.zone_type == "raid") then + --[=[ + local bossList = Details:GetCurrentDungeonBossListFromEJ() --function name miss match, filtering raid only, calling dungeon only function + if (bossList) then + local actorContainer = currentCombat[attributeDamage]._ActorTable + if (actorContainer) then + for index, actorObject in ipairs(actorContainer) do + if (not actorObject.grupo) then + if (bossList[actorObject.nome]) then + actorObject.boss = true + bossTable.bossimage = bossList[actorObject.nome][4] break end end end end end + --]=] end - Details.tabela_vigente.is_boss = boss_table - - if (Details.in_combat and not Details.leaving_combat) then - - --catch boss function if any - local bossFunction, bossFunctionType = Details:GetBossFunction (ZoneMapID, BossIndex) - if (bossFunction) then - if (bitBand(bossFunctionType, 0x1) ~= 0) then --realtime - Details.bossFunction = bossFunction - Details.tabela_vigente.bossFunction = Details:ScheduleTimer("bossFunction", 1) - end - end - - if (Details.zone_type ~= "raid") then - local endType, endData = Details:GetEncounterEnd (ZoneMapID, BossIndex) - if (endType and endData) then - - if (Details.debug) then - Details:Msg("(debug) setting boss end type to:", endType) - end - - Details.encounter_end_table.type = endType - Details.encounter_end_table.killed = {} - Details.encounter_end_table.data = {} - - if (type(endData) == "table") then - if (Details.debug) then - Details:Msg("(debug) boss type is table:", endType) - end - if (endType == 1 or endType == 2) then - for _, npcID in ipairs(endData) do - Details.encounter_end_table.data [npcID] = false - end - end - else - if (endType == 1 or endType == 2) then - Details.encounter_end_table.data [endData] = false - end - end - end - end - end + currentCombat.is_boss = bossTable --we the boss was found during the combat table creation, we must postpone the event trigger - if (not Details.tabela_vigente.IsBeingCreated) then + if (not currentCombat.IsBeingCreated) then Details:SendEvent("COMBAT_BOSS_FOUND", nil, index, name) Details:CheckFor_SuppressedWindowsOnEncounterFound() end - return boss_table + return bossTable end function Details:ReadBossFrames() + local currentCombat = Details:GetCurrentCombat() - if (Details.tabela_vigente.is_boss) then + if (currentCombat.is_boss) then return --no need to check end if (Details.encounter_table.name) then local encounter_table = Details.encounter_table - return boss_found (encounter_table.index, encounter_table.name, encounter_table.zone, encounter_table.mapid, encounter_table.diff, encounter_table.id) + return foundEncounterInfo(encounter_table.index, encounter_table.name, encounter_table.zone, encounter_table.mapid, encounter_table.diff, encounter_table.id) end - for index = 1, 5, 1 do - if (UnitExists("boss"..index)) then - local guid = UnitGUID("boss"..index) - if (guid) then - local serial = Details:GetNpcIdFromGuid (guid) - + for index = 1, 5 do + if (UnitExists("boss" .. index)) then + local bossGuid = UnitGUID("boss" .. index) + if (bossGuid) then + local serial = Details:GetNpcIdFromGuid(bossGuid) if (serial) then - - local ZoneName, _, DifficultyID, _, _, _, _, ZoneMapID = GetInstanceInfo() - - local BossIds = Details:GetBossIds (ZoneMapID) - if (BossIds) then - local BossIndex = BossIds [serial] - - if (BossIndex) then + local zoneName, _, difficultyID, _, _, _, _, zoneMapID = GetInstanceInfo() + local bossIds = Details:GetBossIds(zoneMapID) + if (bossIds) then + local bossIndex = bossIds[serial] + if (bossIndex) then if (Details.debug) then - Details:Msg("(debug) boss found:",Details:GetBossName (ZoneMapID, BossIndex)) + Details:Msg("(debug) boss found:", Details:GetBossName(zoneMapID, bossIndex)) end - - return boss_found (BossIndex, Details:GetBossName (ZoneMapID, BossIndex), ZoneName, ZoneMapID, DifficultyID) + return foundEncounterInfo(bossIndex, Details:GetBossName(zoneMapID, bossIndex), zoneName, zoneMapID, difficultyID) end end end @@ -252,29 +211,27 @@ end --try to get the encounter name after the encounter (can be called during the combat as well) - function Details:FindBoss (noJournalSearch) - + function Details:FindBoss(noJournalSearch) if (Details.encounter_table.name) then local encounter_table = Details.encounter_table - return boss_found (encounter_table.index, encounter_table.name, encounter_table.zone, encounter_table.mapid, encounter_table.diff, encounter_table.id) + return foundEncounterInfo(encounter_table.index, encounter_table.name, encounter_table.zone, encounter_table.mapid, encounter_table.diff, encounter_table.id) end - local ZoneName, InstanceType, DifficultyID, _, _, _, _, ZoneMapID = GetInstanceInfo() - local BossIds = Details:GetBossIds (ZoneMapID) + local currentCombat = Details:GetCurrentCombat() + local zoneName, instanceType, difficultyID, _, _, _, _, zoneMapID = GetInstanceInfo() + local bossIds = Details:GetBossIds(zoneMapID) - if (BossIds) then - local BossIndex = nil - local ActorsContainer = Details.tabela_vigente [class_type_dano]._ActorTable - - if (ActorsContainer) then - for index, Actor in ipairs(ActorsContainer) do - if (not Actor.grupo) then - local serial = Details:GetNpcIdFromGuid (Actor.serial) + if (bossIds) then + local actorContainer = currentCombat[attributeDamage]._ActorTable + if (actorContainer) then + for index, actorObject in ipairs(actorContainer) do + if (not actorObject.grupo) then + local serial = Details:GetNpcIdFromGuid(actorObject.serial) if (serial) then - BossIndex = BossIds [serial] - if (BossIndex) then - Actor.boss = true - return boss_found (BossIndex, Details:GetBossName (ZoneMapID, BossIndex), ZoneName, ZoneMapID, DifficultyID) + local bossIndex = bossIds[serial] + if (bossIndex) then + actorObject.boss = true + return foundEncounterInfo(bossIndex, Details:GetBossName(zoneMapID, bossIndex), zoneName, zoneMapID, difficultyID) end end end @@ -286,16 +243,16 @@ if (not noJournalSearch) then local in_instance = IsInInstance() --garrison returns party as instance type. - if ((InstanceType == "party" or InstanceType == "raid") and in_instance) then + if ((instanceType == "party" or instanceType == "raid") and in_instance) then local boss_list = Details:GetCurrentDungeonBossListFromEJ() if (boss_list) then - local ActorsContainer = Details.tabela_vigente [class_type_dano]._ActorTable + local ActorsContainer = currentCombat[attributeDamage]._ActorTable if (ActorsContainer) then for index, Actor in ipairs(ActorsContainer) do if (not Actor.grupo) then if (boss_list [Actor.nome]) then Actor.boss = true - return boss_found_not_registered (boss_list [Actor.nome], ZoneName, ZoneMapID, DifficultyID) + return createBossTable (boss_list [Actor.nome], zoneName, zoneMapID, difficultyID) end end end @@ -426,7 +383,7 @@ if (Details.encounter_table.id and Details.encounter_table ["start"] >= GetTime() - 3 and not Details.encounter_table ["end"]) then local encounter_table = Details.encounter_table --boss_found will trigger "COMBAT_BOSS_FOUND" event, but at this point of the combat creation is safe to send it - boss_found (encounter_table.index, encounter_table.name, encounter_table.zone, encounter_table.mapid, encounter_table.diff, encounter_table.id) + foundEncounterInfo (encounter_table.index, encounter_table.name, encounter_table.zone, encounter_table.mapid, encounter_table.diff, encounter_table.id) else --if we don't have this infor right now, lets check in few seconds dop if (Details.EncounterInformation [Details.zone_id]) then @@ -465,7 +422,7 @@ --hide / alpha / switch in combat for index, instancia in ipairs(Details.tabela_instancias) do if (instancia.ativa) then - instancia:CheckSwitchOnCombatStart (true) + instancia:CheckSwitchOnCombatStart(true) end end @@ -482,7 +439,7 @@ end Details:CheckSwitchToCurrent() - Details:CheckForTextTimeCounter (true) + Details:CheckForTextTimeCounter(true) --stop bar testing if any Details:StopTestBarUpdate() @@ -552,11 +509,11 @@ --still didn't find the boss if (not currentCombat.is_boss) then local ZoneName, _, DifficultyID, _, _, _, _, ZoneMapID = GetInstanceInfo() - local findboss = Details:GetRaidBossFindFunction (ZoneMapID) + local findboss = Details:GetRaidBossFindFunction(ZoneMapID) if (findboss) then local BossIndex = findboss() if (BossIndex) then - boss_found (BossIndex, Details:GetBossName (ZoneMapID, BossIndex), ZoneName, ZoneMapID, DifficultyID) + foundEncounterInfo(BossIndex, Details:GetBossName(ZoneMapID, BossIndex), ZoneName, ZoneMapID, DifficultyID) end end end @@ -577,11 +534,11 @@ --get waste shields if (Details.close_shields) then - Details:CloseShields (currentCombat) + Details:CloseShields(currentCombat) end --salva hora, minuto, segundo do fim da luta - currentCombat:seta_data (Details._detalhes_props.DATA_TYPE_END) + currentCombat:seta_data(Details._detalhes_props.DATA_TYPE_END) currentCombat:seta_tempo_decorrido() --drop last events table to garbage collector @@ -596,18 +553,18 @@ if (encounterID) then local ZoneName, InstanceType, DifficultyID, DifficultyName, _, _, _, ZoneMapID = GetInstanceInfo() - local mapID = C_Map.GetBestMapForUnit ("player") + local mapID = C_Map.GetBestMapForUnit("player") if (not mapID) then mapID = 0 end - local ejid = DetailsFramework.EncounterJournal.EJ_GetInstanceForMap (mapID) + --local ejid = DetailsFramework.EncounterJournal.EJ_GetInstanceForMap(mapID) --@@@disabled for science + --if (ejid == 0) then + -- ejid = Details:GetInstanceEJID() + --end - if (ejid == 0) then - ejid = Details:GetInstanceEJID() - end - local _, boss_index = Details:GetBossEncounterDetailsFromEncounterId (ZoneMapID, encounterID) + local _, boss_index = Details:GetBossEncounterDetailsFromEncounterId(ZoneMapID, encounterID) currentCombat.is_boss = { index = boss_index or 0, @@ -703,11 +660,9 @@ end Details:SendEvent("COMBAT_BOSS_DEFEATED", nil, currentCombat) - Details:CheckFor_TrashSuppressionOnEncounterEnd() else Details:SendEvent("COMBAT_BOSS_WIPE", nil, currentCombat) - --add to storage if (not InCombatLockdown() and not UnitAffectingCombat("player") and not Details.logoff_saving_data) then local successful, errortext = pcall(Details.Database.StoreWipe) @@ -720,7 +675,6 @@ end currentCombat.is_boss.index = currentCombat.is_boss.index or 1 - currentCombat.enemy = currentCombat.is_boss.encounter if (currentCombat.instance_type == "raid") then @@ -744,19 +698,6 @@ currentCombat:SetEndTime(Details.encounter_table["end"] or GetTime()) end - --encounter boss function - local bossFunction, bossFunctionType = Details:GetBossFunction(currentCombat.is_boss.mapid or 0, currentCombat.is_boss.index or 0) - if (bossFunction) then - if (bitBand(bossFunctionType, 0x2) ~= 0) then --end of combat - if (not Details.logoff_saving_data) then - local successful, errortext = pcall(bossFunction, currentCombat) - if (not successful) then - Details:Msg("error occurred on Encounter Boss Function:", errortext) - end - end - end - end - if (currentCombat.instance_type == "raid") then Details:CaptureSet(false, "damage", false, 15) Details:CaptureSet(false, "energy", false, 15) @@ -1410,7 +1351,7 @@ instancia:TrocaTabela(instancia, instancia.segmento, instancia.atributo, instancia.sub_atributo, true) end else - if (instancia.modo == modo_GROUP or instancia.modo == modo_ALL) then + if (instancia.modo == groupMode or instancia.modo == everythingMode) then instancia:TrocaTabela(instancia, instancia.segmento, instancia.atributo, instancia.sub_atributo, true) end end @@ -1621,10 +1562,10 @@ GameCooltip:SetBackdrop(1, Details.cooltip_preset2_backdrop, bgColor, borderColor) end - function Details:BuildInstanceBarTooltip (frame) + function Details:BuildInstanceBarTooltip(frame) local GameCooltip = GameCooltip Details:FormatCooltipForSpells() - GameCooltip:SetOption("MinWidth", _math_max (230, self.baseframe:GetWidth()*0.98)) + GameCooltip:SetOption("MinWidth", _math_max(230, self.baseframe:GetWidth()*0.98)) local myPoint = Details.tooltip.anchor_point local anchorPoint = Details.tooltip.anchor_relative @@ -1633,9 +1574,9 @@ if (Details.tooltip.anchored_to == 1) then - GameCooltip:SetHost (frame, myPoint, anchorPoint, x_Offset, y_Offset) + GameCooltip:SetHost(frame, myPoint, anchorPoint, x_Offset, y_Offset) else - GameCooltip:SetHost (DetailsTooltipAnchor, myPoint, anchorPoint, x_Offset, y_Offset) + GameCooltip:SetHost(DetailsTooltipAnchor, myPoint, anchorPoint, x_Offset, y_Offset) end end @@ -1683,7 +1624,7 @@ if (bTooltipBuilt) then if (object.serial and object.serial ~= "") then - local avatar = NickTag:GetNicknameTable(object.serial, true) + local avatar = NickTag:GetNicknameTable(object:Name(), true) if (avatar and not Details.ignore_nicktag) then if (avatar[2] and avatar[4] and avatar[1]) then GameCooltip:SetBannerImage(1, 1, avatar [2], 80, 40, avatarPoint, avatarTexCoord, nil) --overlay [2] avatar path @@ -1697,7 +1638,7 @@ end end - function Details.gump:UpdateTooltip (whichRowLine, esta_barra, instancia) + function Details.gump:UpdateTooltip(whichRowLine, esta_barra, instancia) if (IsShiftKeyDown()) then return instancia:MontaTooltip(esta_barra, whichRowLine, "shift") elseif (IsControlKeyDown()) then @@ -1709,34 +1650,32 @@ end end - function Details:EndRefresh (instancia, total, combatTable, showing) + function Details:EndRefresh(instancia, total, combatTable, showing) Details:HideBarsNotInUse(instancia, showing) end - function Details:HideBarsNotInUse(instancia, showing) - --primeira atualiza��o ap�s uma mudan�a de segmento -- verifica se h� mais barras sendo mostradas do que o necess�rio - -------------------- - if (instancia.v_barras) then - --print("mostrando", instancia.rows_showing, instancia.rows_created) - for barra_numero = instancia.rows_showing+1, instancia.rows_created do - Details.FadeHandler.Fader(instancia.barras[barra_numero], "in") - end - instancia.v_barras = false + function Details:HideBarsNotInUse(instance, showing) + if (instance.v_barras) then + --print("mostrando", instancia.rows_showing, instancia.rows_created) + for barra_numero = instance.rows_showing+1, instance.rows_created do + Details.FadeHandler.Fader(instance.barras[barra_numero], "in") + end + instance.v_barras = false - if (instancia.rows_showing == 0 and instancia:GetSegment() == -1) then -- -1 overall data - if (not instancia:IsShowingOverallDataWarning()) then - local tutorial = Details:GetTutorialCVar("OVERALLDATA_WARNING1") or 0 - if ((type(tutorial) == "number") and (tutorial < 60)) then - Details:SetTutorialCVar ("OVERALLDATA_WARNING1", tutorial + 1) - instancia:ShowOverallDataWarning (true) - end - end - else - if (instancia:IsShowingOverallDataWarning()) then - instancia:ShowOverallDataWarning (false) + if (instance.rows_showing == 0 and instance:GetSegment() == -1) then -- -1 overall data + if (not instance:IsShowingOverallDataWarning()) then + local tutorial = Details:GetTutorialCVar("OVERALLDATA_WARNING1") or 0 + if ((type(tutorial) == "number") and (tutorial < 60)) then + Details:SetTutorialCVar ("OVERALLDATA_WARNING1", tutorial + 1) + instance:ShowOverallDataWarning (true) end end + else + if (instance:IsShowingOverallDataWarning()) then + instance:ShowOverallDataWarning (false) + end end + end return showing end @@ -1884,8 +1823,7 @@ - overall data only - current data only - both - - --=]=] + --]=] local text = Details.gump:CreateLabel(panel, Loc ["STRING_OPTIONS_CONFIRM_ERASE"], nil, nil, "GameFontNormal") text:SetPoint("center", panel, "center") @@ -1893,18 +1831,18 @@ local no = Details.gump:CreateButton(panel, function() panel:Hide() end, 90, 20, Loc ["STRING_NO"]) no:SetPoint("bottomleft", panel, "bottomleft", 30, 10) - no:InstallCustomTexture (nil, nil, nil, nil, true) + no:InstallCustomTexture(nil, nil, nil, nil, true) local yes = Details.gump:CreateButton(panel, function() panel:Hide(); Details.tabela_historico:ResetAllCombatData() end, 90, 20, Loc ["STRING_YES"]) yes:SetPoint("bottomright", panel, "bottomright", -30, 10) - yes:InstallCustomTexture (nil, nil, nil, nil, true) + yes:InstallCustomTexture(nil, nil, nil, nil, true) end panel:Show() end - function Details:CheckForAutoErase (mapid) - if (Details.last_instance_id ~= mapid) then + function Details:CheckForAutoErase(mapId) + if (Details.last_instance_id ~= mapId) then Details.tabela_historico:ResetOverallData() if (Details.segments_auto_erase == 2) then --ask to erase @@ -1926,9 +1864,8 @@ end end - Details.last_instance_id = mapid + Details.last_instance_id = mapId Details.last_instance_time = _tempo - --Details.last_instance_time = 0 --debug end function Details:UpdateControl() diff --git a/core/parser.lua b/core/parser.lua index 14d5ba39..b00896a2 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -190,9 +190,9 @@ ---@field key7 number local augmentation_aura_list = { - [395152] = true, + [395152] = true,--ebon might (evoker 10.1.5) 395296 = the evoker buff on it self [413984] = true, - [410089] = true, + [410089] = true,--prescience (evoker 10.1.5) [409560] = true, [360827] = true, [410263] = true, @@ -222,6 +222,8 @@ infernobless = {}, } + Details.augmentation_cache = augmentation_cache + Details222.SpecHelpers[1473].augmentation_cache = augmentation_cache local empower_cache = {} @@ -1334,8 +1336,8 @@ 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 bHasFourPieces = gearCache[evokerSourceSerial] and gearCache[evokerSourceSerial].tierAmount >= 4 + local tierPieceMultiplier = 1 --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) @@ -1344,9 +1346,11 @@ if (Details.zone_type == "raid") then --0x410b predictedAmount = amount * (0.06947705 * tierPieceMultiplier * itemLevelMultiplier) else - predictedAmount = amount * (0.08416225 * tierPieceMultiplier * itemLevelMultiplier) + predictedAmount = amount * (0.07590444 * tierPieceMultiplier * itemLevelMultiplier) end + --local damageSpellName = GetSpellInfo(spellId) + --print("EbonMight Cache:", Details.augmentation_cache, evokerSourceSerial, floor(amount), floor(predictedAmount), floor(predictedAmount/amount*100) .. "%", damageSpellName) evokerActor.total_extra = evokerActor.total_extra + predictedAmount augmentedSpell.total = augmentedSpell.total + predictedAmount augmentedSpell.targets[sourceName] = (augmentedSpell.targets[sourceName] or 0) + predictedAmount diff --git a/frames/window_cdtracker.lua b/frames/window_cdtracker.lua index 0eb732e3..0e0fe72a 100644 --- a/frames/window_cdtracker.lua +++ b/frames/window_cdtracker.lua @@ -147,7 +147,17 @@ end if (cooldownLine) then --get the cooldown time from the lib, it return data ready to use on statusbar - local isReady, normalizedPercent, timeLeft, charges, minValue, maxValue, currentValue = openRaidLib.GetCooldownStatusFromCooldownInfo(cooldownInfo) + + local isReady, normalizedPercent, timeLeft, charges, minValue, maxValue, currentValue + local bRunOkay, errorText = pcall(function() + isReady, normalizedPercent, timeLeft, charges, minValue, maxValue, currentValue = openRaidLib.GetCooldownStatusFromCooldownInfo(cooldownInfo) + end) + if (not bRunOkay) then + local spellName = GetSpellInfo(spellId) + --print("error on cooldown update:", unitName, spellName, errorText) + return + end + if (not isReady) then cooldownLine:SetTimer(currentValue, minValue, maxValue) else diff --git a/functions/boss.lua b/functions/boss.lua index 409481d4..4dd47c73 100644 --- a/functions/boss.lua +++ b/functions/boss.lua @@ -115,26 +115,6 @@ do end end - --return the table which contain information about the end of a encounter - function Details:GetEncounterEndInfo (mapid, encounterid) - local bossindex = Details.EncounterInformation [mapid] and Details.EncounterInformation [mapid].encounter_ids and Details.EncounterInformation [mapid].encounter_ids [encounterid] - if (bossindex) then - return Details.EncounterInformation [mapid].encounters [bossindex] and Details.EncounterInformation [mapid].encounters [bossindex].encounter_end - end - end - - --return the function for the boss - function Details:GetEncounterEnd (mapid, bossindex) - local t = Details.EncounterInformation [mapid] and Details.EncounterInformation [mapid].encounters [bossindex] - if (t) then - local _end = t.combat_end - if (_end) then - return unpack(_end) - end - end - return - end - --generic boss find function function Details:GetRaidBossFindFunction (mapid) return Details.EncounterInformation [mapid] and Details.EncounterInformation [mapid].find_boss_encounter @@ -145,15 +125,6 @@ do return Details.EncounterInformation [mapid] and Details.EncounterInformation [mapid].encounters [bossindex] and Details.EncounterInformation [mapid].encounters [bossindex].equalize end - --return the function for the boss - function Details:GetBossFunction (mapid, bossindex) - local func = Details.EncounterInformation [mapid] and Details.EncounterInformation [mapid].encounters [bossindex] and Details.EncounterInformation [mapid].encounters [bossindex].func - if (func) then - return func, Details.EncounterInformation [mapid].encounters [bossindex].funcType - end - return - end - --return the boss table with information about name, adds, spells, etc function Details:GetBossDetails (mapid, bossindex) return Details.EncounterInformation [mapid] and Details.EncounterInformation [mapid].encounters [bossindex] @@ -199,13 +170,13 @@ do end --return a table with all encounter names present in raid instance - function Details:GetBossNames (mapid) - return Details.EncounterInformation [mapid] and Details.EncounterInformation [mapid].boss_names + function Details:GetBossNames(mapId) + return Details.EncounterInformation[mapId] and Details.EncounterInformation[mapId].boss_names end --return the encounter name - function Details:GetBossName (mapid, bossindex) - return Details.EncounterInformation [mapid] and Details.EncounterInformation [mapid].boss_names [bossindex] + function Details:GetBossName(mapid, bossindex) + return Details.EncounterInformation[mapid] and Details.EncounterInformation[mapid].boss_names[bossindex] end --same thing as GetBossDetails, just a alias @@ -382,48 +353,45 @@ do return actors end - function Details:GetInstanceEJID (mapid) - mapid = mapid or select(8, GetInstanceInfo()) - if (mapid) then - local instance_info = Details.EncounterInformation [mapid] - if (instance_info) then - return instance_info.ej_id or 0 + function Details:GetInstanceEJID(mapId) + mapId = mapId or select(8, GetInstanceInfo()) + if (mapId) then + local instanceInfo = Details.EncounterInformation[mapId] + if (instanceInfo) then + return instanceInfo.ej_id or 0 end end return 0 end function Details:GetCurrentDungeonBossListFromEJ() - local mapID = C_Map.GetBestMapForUnit ("player") if (not mapID) then - --print("Details! exeption handled: zone has no map") return end - local EJ_CInstance = DetailsFramework.EncounterJournal.EJ_GetInstanceForMap(mapID) + local instanceId = DetailsFramework.EncounterJournal.EJ_GetInstanceForMap(mapID) - if (EJ_CInstance and EJ_CInstance ~= 0) then - if (Details.encounter_dungeons [EJ_CInstance]) then - return Details.encounter_dungeons [EJ_CInstance] + if (instanceId and instanceId ~= 0) then + if (Details.encounter_dungeons[instanceId]) then + return Details.encounter_dungeons[instanceId] end - DetailsFramework.EncounterJournal.EJ_SelectInstance (EJ_CInstance) + DetailsFramework.EncounterJournal.EJ_SelectInstance(instanceId) + local name, description, bgImage, buttonImage, loreImage, dungeonAreaMapID, link = DetailsFramework.EncounterJournal.EJ_GetInstanceInfo(instanceId) - local name, description, bgImage, buttonImage, loreImage, dungeonAreaMapID, link = DetailsFramework.EncounterJournal.EJ_GetInstanceInfo (EJ_CInstance) - - local boss_list = { - [EJ_CInstance] = {name, description, bgImage, buttonImage, loreImage, dungeonAreaMapID, link} + local bossList = { + [instanceId] = {name, description, bgImage, buttonImage, loreImage, dungeonAreaMapID, link} } for i = 1, 20 do - local encounterName, description, encounterID, rootSectionID, link = DetailsFramework.EncounterJournal.EJ_GetEncounterInfoByIndex (i, EJ_CInstance) + local encounterName, description, encounterID, rootSectionID, link = DetailsFramework.EncounterJournal.EJ_GetEncounterInfoByIndex(i, instanceId) if (encounterName) then for o = 1, 6 do - local id, creatureName, creatureDescription, displayInfo, iconImage = DetailsFramework.EncounterJournal.EJ_GetCreatureInfo (o, encounterID) + local id, creatureName, creatureDescription, displayInfo, iconImage = DetailsFramework.EncounterJournal.EJ_GetCreatureInfo(o, encounterID) if (id) then - boss_list [creatureName] = {encounterName, encounterID, creatureName, iconImage, EJ_CInstance} + bossList[creatureName] = {encounterName, encounterID, creatureName, iconImage, instanceId} else break end @@ -433,14 +401,13 @@ do end end - Details.encounter_dungeons [EJ_CInstance] = boss_list - - return boss_list + Details.encounter_dungeons[instanceId] = bossList + return bossList end end - function Details:IsRaidRegistered(mapid) - return Details.EncounterInformation [mapid] and true + function Details:IsRaidRegistered(mapId) + return Details.EncounterInformation[mapId] and true end --this cache is local and isn't shared with other components of the addon @@ -629,14 +596,6 @@ do --delay the cache createation as it is not needed right away --createEJCache() will check if encounter journal is loaded, if not it will load it and then create the cache local createEJCache = function() - --check if the encounter journal added is loaded - if (not EncounterJournal) then - --local startTime = debugprofilestop() - --[[EncounterJournal_LoadUI()]] - --local endTime = debugprofilestop() - --print("DE loading EJ:", endTime - startTime) - end - --[[hooksecurefunc("EncounterJournal_OpenJournalLink", Details222.EJCache.OnClickEncounterJournalLink)]] ---iterate among all raid instances, by passing true in the second argument of EJ_GetInstanceByIndex, indicates to the API we want to get raid instances @@ -653,12 +612,12 @@ do ---increment this each expansion ---@type number - local currentTierId = 10 --maintenance + local currentTierId = 10 --maintenance | 10 is "Dragonflight" ---is the id of where it shows the mythic+ dungeons available for the season ---can be found in the adventure guide in the dungeons tab > dropdown ---@type number - local currentMythicPlusTierId = 11 --maintenance + local currentMythicPlusTierId = 11 --maintenance | 11 is "Current Season" ---maximum amount of raid tiers in the expansion ---@type number @@ -753,8 +712,6 @@ do do --get current expansion dungeon instances data and mythic+ data bGetRaidInstances = false - --EncounterJournalDungeonTab:Click() - --EncounterJournal_TierDropDown_Select(_, 11) --select mythic+ --get mythic+ dungeon data EJ_SelectTier(currentMythicPlusTierId) @@ -762,8 +719,6 @@ do for instanceIndex = maxAmountOfDungeons, 1, -1 do local journalInstanceID, instanceName, description, bgImage, buttonImage1, loreImage, buttonImage2, dungeonAreaMapID = EJ_GetInstanceByIndex(instanceIndex, bGetRaidInstances) if (journalInstanceID) then - --tell the encounter journal to display the dungeon instance by the instanceId - --EncounterJournal_DisplayInstance(journalInstanceID) EJ_SelectInstance(journalInstanceID) --build a table with data of the raid instance @@ -828,7 +783,6 @@ do end end - --EncounterJournal_TierDropDown_Select(_, 10) --select Dragonflight --get current expansion dungeons data EJ_SelectTier(currentTierId) @@ -837,7 +791,6 @@ do if (journalInstanceID and not Details222.EJCache.CacheDungeonData_ByInstanceId[journalInstanceID]) then --tell the encounter journal to display the dungeon instance by the instanceId - --EncounterJournal_DisplayInstance(journalInstanceID) EJ_SelectInstance(journalInstanceID) --build a table with data of the raid instance @@ -909,17 +862,13 @@ do EncounterJournal_ResetDisplay(nil, "none") end end) - - --EncounterJournal_OpenJournalLink(tag, jtype, id, difficultyID) - --EncounterJournal_OpenJournal(difficultyID, instanceID, encounterID, sectionID, creatureID, itemID, tierIndex) end - --todo: should run one second after the player_login event or entering_world + --todo: should run one second after the player_login event or entering_world | 2023-12-05: already executing on the player_login event C_Timer.After(1, function() if (not EncounterJournal_LoadUI) then return end - createEJCache() end) end diff --git a/functions/ej_cache.lua b/functions/ej_cache.lua new file mode 100644 index 00000000..627d8e17 --- /dev/null +++ b/functions/ej_cache.lua @@ -0,0 +1,58 @@ + +local Details = _G.Details +local addonName, Details222 = ... +local ipairs = ipairs --lua local +local detailsFramework = DetailsFramework + +local ejTable = Details222.EncounterJournalDump + + +function Details.CreateEncounterJournalDump() + local data = {} + + ---iterate among all raid instances, by passing true in the second argument of EJ_GetInstanceByIndex, indicates to the API we want to get raid instances + ---@type boolean + local bGetRaidInstances = true + + ---returns the number of valid encounter journal tier indices + ---@type number + local tierAmount = EJ_GetNumTiers() + + ---returns the currently active encounter journal tier index + ---@type number + local currentTier = EJ_GetCurrentTier() + + ---increment this each expansion + ---@type number + local currentTierId = 10 --maintenance | 10 is "Dragonflight" + + ---is the id of where it shows the mythic+ dungeons available for the season + ---can be found in the adventure guide in the dungeons tab > dropdown + ---@type number + local currentMythicPlusTierId = 11 --maintenance | 11 is "Current Season" + + ---maximum amount of raid tiers in the expansion + ---@type number + local maxAmountOfRaidTiers = 10 + + ---maximum amount of dungeons in the expansion + ---@type number + local maxAmountOfDungeons = 20 + + ---the index of the first raid tier in the expansion, ignoring the first tier as it is open world bosses + ---@type number + local raidTierStartIndex = 2 + + ---max amount of bosses which a raid tier can have + ---@type number + local maxRaidBosses = 20 + + + + + + + + + +end \ No newline at end of file diff --git a/functions/journal.lua b/functions/journal.lua index 39a1d2f4..fbef7d2b 100644 --- a/functions/journal.lua +++ b/functions/journal.lua @@ -25,7 +25,7 @@ end ---@param tag any tag isn't used ---@param journalTypeString string ---@param idString string -function Details222.EJCache.OnClickEncounterJournalLink(tag, journalTypeString, idString) +function Details222.EJCache.OnClickEncounterJournalLink(tag, journalTypeString, idString) --not in use local journalType = tonumber(journalTypeString) local id = tonumber(idString) diff --git a/functions/slash.lua b/functions/slash.lua index 8a6ecaea..58f6842b 100644 --- a/functions/slash.lua +++ b/functions/slash.lua @@ -577,11 +577,6 @@ function SlashCmdList.DETAILS (msg, editbox) end end - elseif (msg == "teste") then - - local a, b = Details:GetEncounterEnd (1098, 3) - print(a, unpack(b)) - elseif (msg == "yesno") then --_detalhes:Show() @@ -1042,33 +1037,7 @@ function SlashCmdList.DETAILS (msg, editbox) 1 --school = ) - elseif (msg == "ejloot") then - DetailsFramework.EncounterJournal.EJ_SelectInstance (669) -- hellfire citadel - DetailsFramework.EncounterJournal.EJ_SetDifficulty (16) - - local r = {} - local total = 0 - - for i = 1, 100 do - local name, description, encounterID, rootSectionID, link = DetailsFramework.EncounterJournal.EJ_GetEncounterInfoByIndex (i, 669) - if (name) then - DetailsFramework.EncounterJournal.EJ_SelectEncounter (encounterID) - print(name, encounterID, DetailsFramework.EncounterJournal.EJ_GetNumLoot()) - - for o = 1, DetailsFramework.EncounterJournal.EJ_GetNumLoot() do - local name, icon, slot, armorType, itemID, link, encounterID = DetailsFramework.EncounterJournal.EJ_GetLootInfoByIndex (o) - r[slot] = r[slot] or {} - table.insert(r[slot], {itemID, encounterID}) - total = total + 1 - end - end - end - - print("total loot", total) - _detalhes_global.ALOOT = r - elseif (msg == "ilvl" or msg == "itemlevel" or msg == "ilevel") then - local item_amount = 16 local item_level = 0 local failed = 0 diff --git a/functions/spec_augmentation.lua b/functions/spec_augmentation.lua index a2bd9b69..e0392435 100644 --- a/functions/spec_augmentation.lua +++ b/functions/spec_augmentation.lua @@ -16,6 +16,10 @@ local playerRealmName = GetRealmName() function augmentationFunctions.BuffIn(token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetFlags2, spellId, spellName, spellschool, auraType, amount) + if (not UnitAffectingCombat("player")) then --need documentation + return + end + 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 @@ -24,6 +28,7 @@ function augmentationFunctions.BuffIn(token, time, sourceSerial, sourceName, sou augmentationCache.ebon_might[targetSerial] = augmentationCache.ebon_might[targetSerial] or {} local evokerInfo = {sourceSerial, sourceName, sourceFlags, attributeGained} table.insert(augmentationCache.ebon_might[targetSerial], evokerInfo) + --print("ebom might added, cache:", Details.augmentation_cache, #augmentationCache.ebon_might[targetSerial]) end elseif (spellId == 413984) then --ss @@ -37,12 +42,12 @@ function augmentationFunctions.BuffIn(token, time, sourceSerial, sourceName, sou end end - elseif (spellId == 410089) then + elseif (spellId == 410089) then --prescience augmentationCache.prescience[targetSerial] = augmentationCache.prescience[targetSerial] or {} local evokerInfo = {sourceSerial, sourceName, sourceFlags, amount} table.insert(augmentationCache.prescience[targetSerial], evokerInfo) - elseif (spellId == 409560) then + elseif (spellId == 409560) then --eons breath local unitIDAffected = Details:FindUnitIDByUnitSerial(targetSerial) if (unitIDAffected) then local duration, expirationTime = Details:FindDebuffDuration(unitIDAffected, spellId, Details:Ambiguate(sourceName)) @@ -59,12 +64,12 @@ function augmentationFunctions.BuffIn(token, time, sourceSerial, sourceName, sou end end - elseif (spellId == 360827) then + elseif (spellId == 360827) then --tank shield augmentationCache.shield[targetSerial] = augmentationCache.shield[targetSerial] or {} local evokerInfo = {sourceSerial, sourceName, sourceFlags, amount} table.insert(augmentationCache.shield[targetSerial], evokerInfo) - elseif (spellId == 410263) then + elseif (spellId == 410263) then --inferno bless augmentationCache.infernobless[targetSerial] = augmentationCache.infernobless[targetSerial] or {} local evokerInfo = {sourceSerial, sourceName, sourceFlags} table.insert(augmentationCache.infernobless[targetSerial], evokerInfo) @@ -140,18 +145,21 @@ end -function augmentationFunctions.BuffOut(token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetFlags2, spellid, spellName, spellSchool, tipo, amount) - if (spellid == 395152) then +function augmentationFunctions.BuffOut(token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetFlags2, spellId, spellName, spellSchool, tipo, amount) + if (spellId == 395152) then if (augmentationCache.ebon_might[targetSerial]) then + --print("tinha buff", targetName, targetSerial) for index, evokerInfo in ipairs(augmentationCache.ebon_might[targetSerial]) do if (evokerInfo[1] == sourceSerial) then + --print("ebom might finished, removing from cache:", Details.augmentation_cache, #augmentationCache.ebon_might[targetSerial]) table.remove(augmentationCache.ebon_might[targetSerial], index) + --print("ebom might finished, removing from cache:", Details.augmentation_cache, #augmentationCache.ebon_might[targetSerial]) break end end end - elseif (spellid == 413984) then + elseif (spellId == 413984) then if (augmentationCache.ss[targetSerial]) then for index, evokerInfo in ipairs(augmentationCache.ss[targetSerial]) do if (evokerInfo[1] == sourceSerial) then @@ -161,7 +169,7 @@ function augmentationFunctions.BuffOut(token, time, sourceSerial, sourceName, so end end - elseif (spellid == 410089) then + elseif (spellId == 410089) then if (augmentationCache.prescience[targetSerial]) then for index, evokerInfo in ipairs(augmentationCache.prescience[targetSerial]) do if (evokerInfo[1] == sourceSerial) then @@ -171,7 +179,7 @@ function augmentationFunctions.BuffOut(token, time, sourceSerial, sourceName, so end end - elseif (spellid == 360827) then + elseif (spellId == 360827) then if (augmentationCache.shield[targetSerial]) then for index, evokerInfo in ipairs(augmentationCache.shield[targetSerial]) do if (evokerInfo[1] == sourceSerial) then @@ -181,7 +189,7 @@ function augmentationFunctions.BuffOut(token, time, sourceSerial, sourceName, so end end - elseif (spellid == 410263) then + elseif (spellId == 410263) then if (augmentationCache.infernobless[targetSerial]) then for index, evokerInfo in ipairs(augmentationCache.infernobless[targetSerial]) do if (evokerInfo[1] == sourceSerial) then