Added a search box into the '/details scroll' command

This commit is contained in:
Tercio Jose
2022-04-26 12:43:37 -03:00
parent aa1b97b4c9
commit 3afc9ce24d
10 changed files with 117 additions and 20 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
local dversion = 306
local dversion = 307
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)
+4
View File
@@ -5394,6 +5394,8 @@ DF.IconRowFunctions = {
--add the spell into the cache
self.AuraCache [spellId or -1] = true
self.AuraCache [spellName] = true
self.AuraCache.canStealOrPurge = self.AuraCache.canStealOrPurge or canStealOrPurge
self.AuraCache.hasEnrage = self.AuraCache.hasEnrage or debuffType == "" --yes, enrages are empty-string...
--> show the frame
self:Show()
@@ -5448,6 +5450,8 @@ DF.IconRowFunctions = {
else
self.AuraCache [iconPool[i].spellId] = true
self.AuraCache [iconPool[i].spellName] = true
self.AuraCache.canStealOrPurge = self.AuraCache.canStealOrPurge or iconPool[i].canStealOrPurge
self.AuraCache.hasEnrage = self.AuraCache.hasEnrage or iconPool[i].debuffType == "" --yes, enrages are empty-string...
countStillShown = countStillShown + 1
end
end
+31
View File
@@ -216,4 +216,35 @@ function openRaidLib.FilterCooldowns(unitName, allCooldowns, filters)
end
return resultFilters
end
--compare the current list of spells of the player with a new spell list generated
--add or remove spells from the current list, make the cache dirt and return a table with spells removed or added
function openRaidLib.CooldownManager.CheckForSpellsAdeedOrRemoved()
local playerName = UnitName("player")
local currentCooldowns = openRaidLib.CooldownManager.UnitData[playerName]
local _, newCooldownList = openRaidLib.CooldownManager.GetPlayerCooldownList()
local spellsAdded, spellsRemoved = {}, {}
for spellId, cooldownInfo in pairs(newCooldownList) do
if (not currentCooldowns[spellId]) then
--a spell has been added
currentCooldowns[spellId] = cooldownInfo
spellsAdded[#spellsAdded+1] = {spellId}
--mark the filter cache of this unit as dirt
openRaidLib.CooldownManager.NeedRebuildFilters[playerName] = true
end
end
for spellId, cooldownInfo in pairs(currentCooldowns) do
if (not newCooldownList[spellId]) then
--a spell has been removed
currentCooldowns[spellId] = nil
spellsRemoved[#spellsRemoved+1] = {spellId}
--mark the filter cache of this unit as dirt
openRaidLib.CooldownManager.NeedRebuildFilters[playerName] = true
end
end
return spellsAdded, spellsRemoved
end
+20 -4
View File
@@ -24,10 +24,13 @@ Change Log:
- player information is always available even when not in a group.
TODO:
- track interrupts (interrupt list is done, need to tracker the use of the spell and share it)
- need to finish the CheckForSpellsAdeedOrRemoved(), need to send the comm, need to create the local callbacks
- create comm to add or remove a cooldown from an unit
- add unit_connected through comm to know if a unit disconnected
- keystone info (portion of the logic is implemented, need to share the information)
- raid lockouts normal-heroic-mythic
- soulbind character (covenant choise) - probably not used in 10.0
- add into gear info how many tier set parts the player has
- (bug) after a /reload, it is not starting new tickers for spells under cooldown
--]=]
@@ -57,10 +60,15 @@ LIB_OPEN_RAID_CAN_LOAD = false
local CONST_COMM_PREFIX = "LRS"
local CONST_COMM_FULLINFO_PREFIX = "F"
local CONST_COMM_COOLDOWNUPDATE_PREFIX = "U"
local CONST_COMM_COOLDOWNFULLLIST_PREFIX = "C"
local CONST_COMM_COOLDOWNADDSPELL_PREFIX = "S"
local CONST_COMM_COOLDOWNREMOVESPELL_PREFIX = "E"
local CONST_COMM_GEARINFO_FULL_PREFIX = "G"
local CONST_COMM_GEARINFO_DURABILITY_PREFIX = "R"
local CONST_COMM_PLAYER_DEAD_PREFIX = "D"
local CONST_COMM_PLAYER_ALIVE_PREFIX = "A"
local CONST_COMM_PLAYERINFO_PREFIX = "P"
@@ -1450,7 +1458,7 @@ end
currentValue = 1
end
return timeLeft <= 2, percent, timeLeft, charges, minValue, maxValue, min(currentValue, maxValue)
return timeLeft <= 2, percent, timeLeft, charges, minValue, maxValue, min(currentValue, maxValue), duration
end
--return the values to be use on a progress bar or cooldown frame
@@ -1481,7 +1489,7 @@ end
end
--> internals
function openRaidLib.CooldownManager.OnPlayerCast(event, spellId, isPlayerPet)
function openRaidLib.CooldownManager.OnPlayerCast(event, spellId, isPlayerPet) --~cast
--player casted a spell, check if the spell is registered as cooldown
local playerSpec = openRaidLib.GetPlayerSpecId()
if (playerSpec) then
@@ -1552,7 +1560,15 @@ end
end
function openRaidLib.CooldownManager.OnPlayerPetChanged()
openRaidLib.Schedules.NewUniqueTimer(0.5, openRaidLib.CooldownManager.SendAllPlayerCooldowns, "CooldownManager", "sendAllPlayerCooldowns_Schedule")
--local spellsAdded, spellsRemoved = openRaidLib.CooldownManager.CheckForSpellsAdeedOrRemoved()
--and send a comm telling this player has a new spell instead of sending all the list of spells
-- local dataToSend = CONST_COMM_COOLDOWNFULLLIST_PREFIX .. ","
-- openRaidLib.commHandler.SendCommData(dataToSend)
--openRaidLib.Schedules.NewUniqueTimer(0.5, openRaidLib.CooldownManager.SendAllPlayerCooldowns, "CooldownManager", "sendAllPlayerCooldowns_Schedule")
end
openRaidLib.internalCallback.RegisterCallback("onLeaveGroup", openRaidLib.CooldownManager.OnPlayerLeaveGroup)
+6 -6
View File
@@ -456,7 +456,7 @@ LIB_OPEN_RAID_COOLDOWNS_BY_SPEC = {
--> DEMON HUNTER
--havoc
[577] = {
[200166] = 1, --Metamorphosis
[191427] = 1, --Metamorphosis
[198589] = 2, --Blur
[196555] = 2, --Netherwalk (talent)
[196718] = 4, --Darkness
@@ -595,7 +595,7 @@ LIB_OPEN_RAID_COOLDOWNS_BY_SPEC = {
},
--marksmanship
[254] = {
[193526] = 1, --Trueshot
[288613] = 1, --Trueshot
[186265] = 2, --Aspect of the Turtle
[199483] = 2, --Camouflage (talent)
[109304] = 2, --Exhilaration
@@ -685,7 +685,7 @@ LIB_OPEN_RAID_COOLDOWNS_BY_SPEC = {
--restoration
[264] = {
[108271] = 2, --Astral Shift
[114052] = 2, --Ascendance (talent)
[114052] = 4, --Ascendance (talent)
[98008] = 4, --Spirit Link Totem
[108280] = 4, --Healing Tide Totem
[16191] = 4, --Mana Tide Totem
@@ -780,7 +780,7 @@ LIB_OPEN_RAID_COOLDOWNS_INFO = {
[51533] = {cooldown = 120, duration = 15, talent = false, charges = 1, class = "SHAMAN", type = 1}, --Feral Spirit
[114050] = {cooldown = 180, duration = 15, talent = 21675, charges = 1, class = "SHAMAN", type = 1}, --Ascendance (talent)
[114051] = {cooldown = 180, duration = 15, talent = 21972, charges = 1, class = "SHAMAN", type = 1}, --Ascendance (talent)
[114052] = {cooldown = 180, duration = 15, talent = 22359, charges = 1, class = "SHAMAN", type = 2}, --Ascendance (talent)
[114052] = {cooldown = 180, duration = 15, talent = 22359, charges = 1, class = "SHAMAN", type = 4}, --Ascendance (talent)
[98008] = {cooldown = 180, duration = 6, talent = false, charges = 1, class = "SHAMAN", type = 4}, --Spirit Link Totem
[108280] = {cooldown = 180, duration = 10, talent = false, charges = 1, class = "SHAMAN", type = 4}, --Healing Tide Totem
[207399] = {cooldown = 240, duration = 30, talent = 22323, charges = 1, class = "SHAMAN", type = 4}, --Ancestral Protection Totem (talent)
@@ -814,7 +814,7 @@ LIB_OPEN_RAID_COOLDOWNS_INFO = {
[193530] = {cooldown = 120, duration = 20, talent = false, charges = 1, class = "HUNTER", type = 1}, --Aspect of the Wild
[19574] = {cooldown = 90, duration = 12, talent = false, charges = 1, class = "HUNTER", type = 1}, --Bestial Wrath
[201430] = {cooldown = 180, duration = 12, talent = 23044, charges = 1, class = "HUNTER", type = 1}, --Stampede (talent)
[193526] = {cooldown = 180, duration = 15, talent = false, charges = 1, class = "HUNTER", type = 1}, --Trueshot
[288613] = {cooldown = 180, duration = 15, talent = false, charges = 1, class = "HUNTER", type = 1}, --Trueshot
[199483] = {cooldown = 60, duration = 60, talent = 23100, charges = 1, class = "HUNTER", type = 2}, --Camouflage (talent)
[281195] = {cooldown = 180, duration = 6, talent = false, charges = 1, class = "HUNTER", type = 2}, --Survival of the Fittest
[266779] = {cooldown = 120, duration = 20, talent = false, charges = 1, class = "HUNTER", type = 1}, --Coordinated Assault
@@ -869,7 +869,7 @@ LIB_OPEN_RAID_COOLDOWNS_INFO = {
[212552] = {cooldown = 60, duration = 4, talent = 19228, charges = 1, class = "DEATHKNIGHT", type = 5}, --Wraith walk (talent)
--demon hunter
[200166] = {cooldown = 240, duration = 30, talent = false, charges = 1, class = "DEMONHUNTER", type = 1}, --Metamorphosis
[191427] = {cooldown = 240, duration = 30, talent = false, charges = 1, class = "DEMONHUNTER", type = 1}, --Metamorphosis
[198589] = {cooldown = 60, duration = 10, talent = false, charges = 1, class = "DEMONHUNTER", type = 2}, --Blur
[196555] = {cooldown = 120, duration = 5, talent = 21865, charges = 1, class = "DEMONHUNTER", type = 2}, --Netherwalk (talent)
[187827] = {cooldown = 180, duration = 15, talent = false, charges = 1, class = "DEMONHUNTER", type = 2}, --Metamorphosis
+4 -3
View File
@@ -33,13 +33,14 @@ do
local Loc = _G.LibStub("AceLocale-3.0"):GetLocale( "Details" )
local news = {
{"v9.2.0.9778.146", "April 23th, 2022"},
"A cooldown tracker experiment has been added, its options is visible at the Options Panel.",
{"v9.2.0.9778.146", "April 26th, 2022"},
--"A cooldown tracker experiment has been added, its options is visible at the Options Panel.",
"Added a search box in the '/details scroll' feature.",
"When using Details! Death Recap, a message is now printed to chat showing what killed you accordingly to Blizzard Death Recap.",
"Fixed some errors while using Mind Control on an arena match.",
"Fixed encounter phase detection while using voice packs for boss mods addons.",
"Fixed an error after killing a boss encounter on heroic dificulty for the first time.",
"Attempt to fix the issue of skins installed after the window has been loaded and the skin was not found at that time.",
"Fixed the issue of skins installed after the window has been loaded and the skin was not found at that time.",
"API: added 'UNIT_SPEC' and 'UNIT_TALENTS' event to details! event listener.",
"API: added Details:GetUnitId(unitName) which return the unitId for a given player name.",
+1
View File
@@ -46,6 +46,7 @@ end
--@unitCooldows: a table with [spellId] = cooldownInfo
--@allUnitsCooldowns: a table containing all units [unitName] = {[spellId] = cooldownInfo}
function Details.CooldownTracking.OnReceiveUnitFullCooldownList(unitId, unitCooldows, allUnitsCooldowns)
--print("|cFFFFFF00received full cooldown list|r from:", unitId)
Details.CooldownTracking.RefreshCooldownFrames()
end
+47 -3
View File
@@ -38,7 +38,7 @@ function Details:ScrollDamage()
--header
local headerTable = {
{text = "Icon", width = 32},
{text = "Icon", width = 24},
{text = "Spell Name", width = 100},
{text = "Amount", width = 60},
@@ -53,11 +53,36 @@ function Details:ScrollDamage()
DetailsScrollDamage.Header = DetailsFramework:CreateHeader(DetailsScrollDamage, headerTable, headerOptions)
DetailsScrollDamage.Header:SetPoint("topleft", DetailsScrollDamage, "topleft", 5, headerY)
DetailsScrollDamage.searchText = ""
DetailsScrollDamage.searchCache = {}
local scroll_refresh = function (self, data, offset, total_lines)
local ToK = _detalhes:GetCurrentToKFunction()
local dataFiltered = {}
DetailsScrollDamage.searchText = DetailsScrollDamage.searchText:lower()
if (DetailsScrollDamage.searchText ~= "") then
local searchInCache = DetailsScrollDamage.searchCache[DetailsScrollDamage.searchText]
if (searchInCache) then
dataFiltered = searchInCache
data = dataFiltered
else
for index, spellTable in ipairs(data) do
local time, token, hidding, sourceSerial, sourceName, sourceFlag, sourceFlag2, targetSerial, targetName, targetFlag, targetFlag2, spellId, spellName, spellType, amount, overKill, school, resisted, blocked, absorbed, isCritical = unpack(spellTable)
spellName = spellName:lower()
if (spellName:find(DetailsScrollDamage.searchText)) then
dataFiltered[#dataFiltered+1] = spellTable
end
end
DetailsScrollDamage.searchCache[DetailsScrollDamage.searchText] = dataFiltered
data = dataFiltered
end
else
wipe(DetailsScrollDamage.searchCache)
end
for i = 1, total_lines do
local index = i + offset
local spellTable = data [index]
@@ -206,6 +231,7 @@ function Details:ScrollDamage()
DetailsScrollDamage.Data.Started = time()
end
tinsert (DetailsScrollDamage.Data, 1, {timew, token, hidding, sourceSerial, sourceName, sourceFlag, sourceFlag2, targetSerial, targetName, targetFlag, targetFlag2, spellID, spellName, spellType, amount, overKill or 0, school or 1, resisted or 0, blocked or 0, absorbed or 0, isCritical})
wipe(DetailsScrollDamage.searchCache)
damageScroll:Refresh()
elseif (token == "SWING_DAMAGE") then
@@ -243,6 +269,24 @@ function Details:ScrollDamage()
local autoOpenText = DetailsFramework:CreateLabel(statusBar, "Auto Open on Training Dummy")
autoOpenText:SetPoint("left", autoOpenCheckbox, "right", 2, 0)
--search bar
local searchBox = DF:CreateTextEntry(statusBar, function()end, 150, 20, _, _, _, DF:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
searchBox:SetPoint("bottomright", statusBar, "bottomright", -2, 0)
local searchLabel = DF:CreateLabel(searchBox, "search", DF:GetTemplate("font", "ORANGE_FONT_TEMPLATE"))
searchLabel:SetPoint("left", searchBox, "left", 3, 0)
searchBox:SetHook("OnTextChanged", function()
if (searchBox.text ~= "") then
searchLabel:Hide()
end
DetailsScrollDamage.searchText = searchBox.text
damageScroll:Refresh()
end)
--DetailsScrollDamage.searchText
end
DetailsScrollDamage:Show()
+1 -1
View File
@@ -1131,7 +1131,7 @@ local default_player_data = {
only_in_group = true,
only_inside_instance = true,
},
show_options = true,
show_options = false,
current_cooldowns = {},
framme_locked = false,
filters = {
+2 -2
View File
@@ -54,9 +54,9 @@ function Details:StartMeUp() --I'll never stop!
self:InitializePlaterIntegrationWindow()
self:InitializeMacrosWindow()
--if (self.ocd_tracker.show_options) then
if (self.ocd_tracker.show_options) then
self:InitializeCDTrackerWindow()
--end
end
--custom window
self.custom = self.custom or {}