Skip to content

Commit

Permalink
post and show always up to date own covenant info
Browse files Browse the repository at this point in the history
  • Loading branch information
spromicky committed Nov 4, 2021
1 parent a8ab985 commit b4da47c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
2 changes: 0 additions & 2 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ frame:RegisterEvent("PLAYER_ENTERING_WORLD");


local function init()
local _, playerClass = UnitClass("player")
realmName = GetNormalizedRealmName()
dc.oribos:addCovenantForPlayer(C_Covenants.GetActiveCovenantID(), UnitName("player"), playerClass)

frame:RegisterEvent("GROUP_ROSTER_UPDATE");
frame:RegisterEvent("CHAT_MSG_ADDON")
Expand Down
35 changes: 25 additions & 10 deletions Oribos.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ local oribos = dc.oribos
oribos.emptyCovenants = {}
oribos.covenants = {}

local _, ownClass = UnitClass("player")

function oribos:getCovenantIcon(covenantID)
if covenantID > 0 and covenantID < 5 then
local covenantMap = {
Expand Down Expand Up @@ -49,10 +51,15 @@ function oribos:askCovenantInfo(playerName)
end

function oribos:sendCovenantInfo(playerName)
if playerName and oribos.covenants[playerName] then
local message = playerName..":"..oribos.covenants[playerName].covenantID..":"..oribos.covenants[playerName].class
C_ChatInfo.SendAddonMessage(dc.addonPrefix, message, "RAID")
end
if playerName then
if playerName == UnitName("player") then
local message = playerName..":"..C_Covenants.GetActiveCovenantID()..":"..ownClass
C_ChatInfo.SendAddonMessage(dc.addonPrefix, message, "RAID")
elseif oribos.covenants[playerName] then
local message = playerName..":"..oribos.covenants[playerName].covenantID..":"..oribos.covenants[playerName].class
C_ChatInfo.SendAddonMessage(dc.addonPrefix, message, "RAID")
end
end
end

function oribos:hasPlayerWithEmptyCovenant()
Expand Down Expand Up @@ -109,11 +116,19 @@ _G.Oribos = {}
local publicOribos = _G.Oribos

function publicOribos:getCovenantIconForPlayer(playerName)
local covenantData = oribos.covenants[playerName]
local covenantID = 0

if covenantData and covenantData.covenantID then
return oribos:getCovenantIcon(covenantData.covenantID)
else
return ""
end
if playerName == UnitName("player") then
covenantID = C_Covenants.GetActiveCovenantID()
else
local covenantData = oribos.covenants[playerName]

if covenantData and covenantData.covenantID then
covenantID = covenantData.covenantID
else
return ""
end
end

return oribos:getCovenantIcon(covenantID)
end

0 comments on commit b4da47c

Please sign in to comment.