Skip to content

Commit

Permalink
new covenant swap system
Browse files Browse the repository at this point in the history
  • Loading branch information
spromicky committed Nov 3, 2021
1 parent 147c4ee commit 5032ca0
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 43 deletions.
22 changes: 13 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
##### v1.3.0 New covenant swap system

- remove caching for detected covenants, because of new covenant swap system

##### v1.2.1 Fix errors in Skada

- fix [#9](https://github.com/spromicky/Details_Covenants/issues/9) errors for Skada
Expand All @@ -8,21 +12,21 @@

##### v1.1.0

- add option to align covenant icon [#8](https://github.com/spromicky/Details_Covenants/issues/8). Now you can choose on which side of name covenant icon will be show.
- update checking for own messages
- update `.toc` for 9.1
- add option to align covenant icon [#8](https://github.com/spromicky/Details_Covenants/issues/8). Now you can choose on which side of name covenant icon will be show.
- update checking for own messages
- update `.toc` for 9.1

##### v1.0.0

- other addons can acdess to covenants info (`_G.Oribos:getCovenantIconForPlayer(<playerName>)`)
- improve detections of character's covenants, now players with this addon share they covenants
- add commads to control chat log and print all collected data
- add spellId for venthyr protection warrior
- other addons can acdess to covenants info (`_G.Oribos:getCovenantIconForPlayer(<playerName>)`)
- improve detections of character's covenants, now players with this addon share they covenants
- add commads to control chat log and print all collected data
- add spellId for venthyr protection warrior

##### v0.0.2

- implements Skada support as well
- implements Skada support as well

##### v0.0.1

- first version of addon
- first version of addon
43 changes: 13 additions & 30 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,6 @@ local realmName = ""
local frame = CreateFrame("FRAME", "DetailsCovenantFrame");
frame:RegisterEvent("PLAYER_ENTERING_WORLD");

local function registerCombatEvent()
if dc.oribos:hasPlayerWithEmptyCovenant() then
frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
else
frame:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
end
end

local function updateGroupRoster()
dc.oribos:fillCovenants()

registerCombatEvent()
end

local function init()
local _, playerClass = UnitClass("player")
Expand All @@ -37,35 +24,31 @@ local function init()
frame:RegisterEvent("GROUP_ROSTER_UPDATE");
frame:RegisterEvent("CHAT_MSG_ADDON")
C_ChatInfo.RegisterAddonMessagePrefix(dc.addonPrefix)

updateGroupRoster()
frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
end

local function eventHandler(self, event, ...)
if event == "COMBAT_LOG_EVENT_UNFILTERED" then
local _, subevent, _, sourceGUID, sourceName = CombatLogGetCurrentEventInfo()

if dc.oribos:hasPlayerWithEmptyCovenant() and dc.oribos.emptyCovenants[sourceName] then
if subevent == "SPELL_CAST_SUCCESS" then
local _, englishClass = GetPlayerInfoByGUID(sourceGUID)
local classAbilityMap = dc.spellMaps.abilityMap[englishClass]
if subevent == "SPELL_CAST_SUCCESS" then
local _, englishClass = GetPlayerInfoByGUID(sourceGUID)
local classAbilityMap = dc.spellMaps.abilityMap[englishClass]

if classAbilityMap then
local spellID = select(12, CombatLogGetCurrentEventInfo())
local covenantIDByAbility = classAbilityMap[spellID]
local covenantIDByUtility = dc.spellMaps.utilityMap[spellID]
if classAbilityMap then
local spellID = select(12, CombatLogGetCurrentEventInfo())
local covenantIDByAbility = classAbilityMap[spellID]
local covenantIDByUtility = dc.spellMaps.utilityMap[spellID]

dc.oribos:logNewPlayer(covenantIDByAbility, sourceName, englishClass, spellID)
dc.oribos:addCovenantForPlayer(covenantIDByAbility, sourceName, englishClass)
dc.oribos:logNewPlayer(covenantIDByAbility, sourceName, englishClass, spellID)
dc.oribos:addCovenantForPlayer(covenantIDByAbility, sourceName, englishClass)

dc.oribos:logNewPlayer(covenantIDByUtility, sourceName, englishClass, spellID)
dc.oribos:addCovenantForPlayer(covenantIDByUtility, sourceName, englishClass)
registerCombatEvent()
end
dc.oribos:logNewPlayer(covenantIDByUtility, sourceName, englishClass, spellID)
dc.oribos:addCovenantForPlayer(covenantIDByUtility, sourceName, englishClass)
end
end
elseif event == "GROUP_ROSTER_UPDATE" then
updateGroupRoster()
dc.oribos:fillCovenants()
elseif event == "CHAT_MSG_ADDON" then
local prefix, messageText, _, sender = ...

Expand Down
4 changes: 2 additions & 2 deletions Details_Covenants.toc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Interface: 90100
## Interface: 90105
## Title: Details!|Skada Covenants
## Notes: Show covenant icon
## Author: Toenak
## Version: 1.2.1
## Version: 1.3.0
## X-License: MIT
## X-Curse-Project-ID: 431558
## SavedVariablesPerCharacter: DCovenant, DCovenantLog
Expand Down
4 changes: 2 additions & 2 deletions Oribos.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function oribos:fillCovenants()
for groupindex = 1, numGroupMembers do
local name = GetRaidRosterInfo(groupindex)

if name and not oribos.covenants[name] and not oribos.emptyCovenants[name]then
if name and not oribos.covenants[name] and not oribos.emptyCovenants[name] then
oribos.emptyCovenants[name] = 0
oribos:askCovenantInfo(name)
end
Expand Down Expand Up @@ -61,7 +61,7 @@ end

-- Loggers
function oribos:logNewPlayer(covenantID, playerName, playerClass, spellID)
if DCovenantLog and covenantID and playerName ~= UnitName("player") and not oribos.covenants[playerName] then
if DCovenantLog and covenantID and playerName ~= UnitName("player") and (not oribos.covenants[playerName] or oribos.covenants[playerName].covenantID ~= covenantID) then
local coloredName = "|CFFe5a472Details_Covenants|r"
local _, _, _, classColor = GetClassColor(playerClass)
local byMessage = ""
Expand Down

0 comments on commit 5032ca0

Please sign in to comment.