Skip to content

Commit

Permalink
Don't refresh nicknames if nicknames are disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed May 29, 2022
1 parent 0bb2a71 commit 53798fb
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 53 deletions.
26 changes: 19 additions & 7 deletions Libs/LibOpenRaid/GetPlayerInformation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -291,17 +291,29 @@ function openRaidLib.CooldownManager.GetPlayerCooldownList()
if (cooldownInfo) then
--does this cooldown is based on a talent?
local talentId = cooldownInfo.talent
if (talentId) then
--check if the player has the talent selected
if (talentsHash[talentId]) then

--check if the player has a talent which makes this cooldown unavailable
local ignoredByTalentId = cooldownInfo.ignoredIfTalent
local isIgnoredByTalentId = false
if (ignoredByTalentId) then
if (talentsHash[ignoredByTalentId]) then
isIgnoredByTalentId = true
end
end

if (not isIgnoredByTalentId) then
if (talentId) then
--check if the player has the talent selected
if (talentsHash[talentId]) then
if (canAddCooldown(cooldownInfo)) then
addCooldownToTable(cooldowns, cooldownsHash, cooldownSpellId, timeNow)
end
end
else
if (canAddCooldown(cooldownInfo)) then
addCooldownToTable(cooldowns, cooldownsHash, cooldownSpellId, timeNow)
end
end
else
if (canAddCooldown(cooldownInfo)) then
addCooldownToTable(cooldowns, cooldownsHash, cooldownSpellId, timeNow)
end
end
end
end
Expand Down
24 changes: 17 additions & 7 deletions Libs/LibOpenRaid/LibOpenRaid.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Code Rules:
- Public callbacks are callbacks registered by an external addon.
Change Log:
- if Ace Comm is installed, use it
- added "KeystoneWipe" callback
- finished keystone info, see docs
- added interrupts to cooldown tracker, new filter: "interrupt"
Expand Down Expand Up @@ -46,7 +47,7 @@ if (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE) then
end

local major = "LibOpenRaid-1.0"
local CONST_LIB_VERSION = 39
local CONST_LIB_VERSION = 41
LIB_OPEN_RAID_CAN_LOAD = false

--declae the library within the LibStub
Expand Down Expand Up @@ -233,35 +234,44 @@ LIB_OPEN_RAID_CAN_LOAD = false
--0x1: to party
--0x2: to raid
--0x4: to guild
local sendData = function(dataEncoded, channel)
local aceComm = LibStub:GetLibrary("AceComm-3.0")
if (aceComm) then
aceComm:SendCommMessage(CONST_COMM_PREFIX, dataEncoded, channel, nil, "ALERT")
else
C_ChatInfo.SendAddonMessage(CONST_COMM_PREFIX, dataEncoded, channel)
end
end

function openRaidLib.commHandler.SendCommData(data, flags)
local LibDeflate = LibStub:GetLibrary("LibDeflate")
local dataCompressed = LibDeflate:CompressDeflate(data, {level = 9})
local dataEncoded = LibDeflate:EncodeForWoWAddonChannel(dataCompressed)

if (flags) then
if (bit.band(flags, CONST_COMM_SENDTO_PARTY)) then --send to party
if (IsInGroup() and not IsInRaid()) then
C_ChatInfo.SendAddonMessage(CONST_COMM_PREFIX, dataEncoded, IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and "INSTANCE_CHAT" or "PARTY")
if (IsInGroup() and not IsInRaid()) then
sendData(dataEncoded, IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and "INSTANCE_CHAT" or "PARTY")
end
end

if (bit.band(flags, CONST_COMM_SENDTO_RAID)) then --send to raid
if (IsInRaid()) then
C_ChatInfo.SendAddonMessage(CONST_COMM_PREFIX, dataEncoded, IsInRaid(LE_PARTY_CATEGORY_INSTANCE) and "INSTANCE_CHAT" or "RAID")
sendData(dataEncoded, IsInRaid(LE_PARTY_CATEGORY_INSTANCE) and "INSTANCE_CHAT" or "RAID")
end
end

if (bit.band(flags, CONST_COMM_SENDTO_GUILD)) then --send to guild
if (IsInGuild()) then
C_ChatInfo.SendAddonMessage(CONST_COMM_PREFIX, dataEncoded, "GUILD")
sendData(dataEncoded, "GUILD")
end
end
else
if (IsInGroup() and not IsInRaid()) then --in party only
C_ChatInfo.SendAddonMessage(CONST_COMM_PREFIX, dataEncoded, IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and "INSTANCE_CHAT" or "PARTY")
sendData(dataEncoded, IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and "INSTANCE_CHAT" or "PARTY")

elseif (IsInRaid()) then
C_ChatInfo.SendAddonMessage(CONST_COMM_PREFIX, dataEncoded, IsInRaid(LE_PARTY_CATEGORY_INSTANCE) and "INSTANCE_CHAT" or "RAID")
sendData(dataEncoded, IsInRaid(LE_PARTY_CATEGORY_INSTANCE) and "INSTANCE_CHAT" or "RAID")
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions Libs/LibOpenRaid/ThingsToMantain.lua
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,8 @@ LIB_OPEN_RAID_COOLDOWNS_INFO = {

--priest
[10060] = {cooldown = 120, duration = 20, talent = false, charges = 1, class = "PRIEST", type = 1}, --Power Infusion
[34433] = {cooldown = 180, duration = 15, talent = false, charges = 1, class = "PRIEST", type = 1}, --Shadowfiend
[34433] = {cooldown = 180, duration = 15, talent = false, charges = 1, class = "PRIEST", type = 1, ignoredIfTalent = 21719}, --Shadowfiend
[200174] = {cooldown = 60, duration = 15, talent = 21719, charges = 1, class = "PRIEST", type = 1}, --Mindbender (talent)
[123040] = {cooldown = 60, duration = 12, talent = 22094, charges = 1, class = "PRIEST", type = 1}, --Mindbender (talent)
[33206] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "PRIEST", type = 3}, --Pain Suppression
[62618] = {cooldown = 180, duration = 10, talent = false, charges = 1, class = "PRIEST", type = 4}, --Power Word: Barrier
Expand All @@ -917,7 +918,6 @@ LIB_OPEN_RAID_COOLDOWNS_INFO = {
[265202] = {cooldown = 720, duration = false, talent = 23145, charges = 1, class = "PRIEST", type = 4}, --Holy Word: Salvation (talent)
[109964] = {cooldown = 60, duration = 12, talent = 21184, charges = 1, class = "PRIEST", type = 4}, --Spirit Shell (talent)
[8122] = {cooldown = 60, duration = 8, talent = false, charges = 1, class = "PRIEST", type = 5}, --Psychic Scream
[200174] = {cooldown = 60, duration = 15, talent = 21719, charges = 1, class = "PRIEST", type = 1}, --Mindbender (talent)
[193223] = {cooldown = 240, duration = 60, talent = 21979, charges = 1, class = "PRIEST", type = 1}, --Surrender to Madness (talent)
[47585] = {cooldown = 120, duration = 6, talent = false, charges = 1, class = "PRIEST", type = 2}, --Dispersion
[15286] = {cooldown = 120, duration = 15, talent = false, charges = 1, class = "PRIEST", type = 4}, --Vampiric Embrace
Expand Down
3 changes: 2 additions & 1 deletion frames/window_cdtracker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ end
--create the screen panel, goes into the UIParent and show cooldowns
function Details.CooldownTracking.CreateScreenFrame()
DetailsOnlineCDTrackerScreenPanel = CreateFrame("frame", "DetailsOnlineCDTrackerScreenPanel", UIParent, "BackdropTemplate")
screenPanel = DetailsOnlineCDTrackerScreenPanel
local screenPanel = DetailsOnlineCDTrackerScreenPanel
screenPanel:Hide()
screenPanel:SetSize(Details.ocd_tracker.width, Details.ocd_tracker.height)
screenPanel:SetPoint("center", 0, 0)
Expand Down Expand Up @@ -184,6 +184,7 @@ end
if (unitCooldowns) then
local unitInfo = openRaidLib.GetUnitInfo(unitId)
if (unitInfo) then
local screenPanel = DetailsOnlineCDTrackerScreenPanel
for spellId, cooldownInfo in pairs(unitCooldowns) do
--get a bar
local cooldownFrame = Details.CooldownTracking.GetOrCreateNewCooldownFrame(screenPanel, screenPanel.statusBarFrameIndex)
Expand Down
62 changes: 33 additions & 29 deletions functions/slash.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2237,42 +2237,46 @@ if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
local isInMyParty = UnitInParty(unitName) and (string.byte(unitName, 1) + string.byte(unitName, 2)) or 0
local isGuildMember = guildName and guildUsers[unitName] and true

local keystoneTable = {
unitName,
keystoneInfo.level,
keystoneInfo.mapID,
keystoneInfo.challengeMapID,
keystoneInfo.classID,
keystoneInfo.rating,
keystoneInfo.mythicPlusMapID,
classIcon,
coords[class],
mapName, --10
isInMyParty,
isOnline, --is false when the unit is from the cache
isGuildMember, --is a guild member
--mapNameChallenge,
}

newData[#newData+1] = keystoneTable --this is the table added into the keystone cache
unitsAdded[unitName] = true

--is this unitName listed as a player in the player's guild?
if (isGuildMember) then
--store the player information into a cache
keystoneTable.guild_name = guildName
keystoneTable.date = time()
Details.keystone_cache[unitName] = keystoneTable
if (keystoneInfo.level > 0 or keystoneInfo.rating > 0) then
local keystoneTable = {
unitName,
keystoneInfo.level,
keystoneInfo.mapID,
keystoneInfo.challengeMapID,
keystoneInfo.classID,
keystoneInfo.rating,
keystoneInfo.mythicPlusMapID,
classIcon,
coords[class],
mapName, --10
isInMyParty,
isOnline, --is false when the unit is from the cache
isGuildMember, --is a guild member
--mapNameChallenge,
}

newData[#newData+1] = keystoneTable --this is the table added into the keystone cache
unitsAdded[unitName] = true

--is this unitName listed as a player in the player's guild?
if (isGuildMember) then
--store the player information into a cache
keystoneTable.guild_name = guildName
keystoneTable.date = time()
Details.keystone_cache[unitName] = keystoneTable
end
end
end

local cutoffDate = time() - (86400 * 7) --7 days
for unitName, keystoneTable in pairs(Details.keystone_cache) do
--this unit in the cache isn't shown?
if (not unitsAdded[unitName] and keystoneTable.guild_name == guildName and keystoneTable.date > cutoffDate) then
keystoneTable[12] = false --isOnline
newData[#newData+1] = keystoneTable
unitsAdded[unitName] = true
if (keystoneTable[2] > 0 or keystoneTable[6] > 0) then
keystoneTable[12] = false --isOnline
newData[#newData+1] = keystoneTable
unitsAdded[unitName] = true
end
end
end
end
Expand Down
16 changes: 9 additions & 7 deletions startup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,15 @@ function Details:StartMeUp() --I'll never stop!
function self:RefreshAfterStartup()

--repair nicknames
local currentCombat = Details:GetCurrentCombat()
local containerDamage = currentCombat:GetContainer(DETAILS_ATTRIBUTE_DAMAGE)
for _, actorObject in containerDamage:ListActors() do
--get the actor nickname
local nickname = Details:GetNickname(actorObject:Name(), false, true)
if (nickname) then
actorObject.displayName = nickname
if (not _detalhes.ignore_nicktag) then
local currentCombat = Details:GetCurrentCombat()
local containerDamage = currentCombat:GetContainer(DETAILS_ATTRIBUTE_DAMAGE)
for _, actorObject in containerDamage:ListActors() do
--get the actor nickname
local nickname = Details:GetNickname(actorObject:Name(), false, true)
if (nickname) then
actorObject.displayName = nickname
end
end
end

Expand Down

0 comments on commit 53798fb

Please sign in to comment.