Details_Covenants/Skada.lua

Created Diff never expires
1 removal
Lines
Total
Removed
Words
Total
Removed
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
66 lines
42 additions
Lines
Total
Added
Words
Total
Added
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
103 lines
local _, dc = ...
local _, dc = ...
local oribos = _G.Oribos
local oribos = _G.Oribos
local detalhes = _G._detalhes


function dc:replaceSkadaImplmentation()
function dc:replaceSkadaImplmentation()
if _G.Skada then
if _G.Skada then
_G.Skada.get_player = function(self, set, playerid, playername)
_G.Skada.get_player = function(self, set, playerid, playername)
local covenantPrefix = ""
local covenantPrefix = ""
local covenantSuffix = ""
local covenantSuffix = ""


if DCovenant["iconAlign"] == "right" then
if DCovenant["iconAlign"] == "right" then
covenantSuffix = " "..oribos:getCovenantIconForPlayer(playername)
covenantSuffix = " "..oribos:getCovenantIconForPlayer(playername)
else
else
covenantPrefix = oribos:getCovenantIconForPlayer(playername).." "
covenantPrefix = oribos:getCovenantIconForPlayer(playername).." "
end
end
-- Add player to set if it does not exist.
-- Add player to set if it does not exist.
local player = Skada:find_player(set, playerid)
local player = Skada:find_player(set, playerid)


if not player then
if not player then
-- If we do not supply a playername (often the case in submodes), we can not create an entry.
-- If we do not supply a playername (often the case in submodes), we can not create an entry.
if not playername then
if not playername then
return
return
end
end


local _, playerClass = UnitClass(playername)
local _, playerClass = UnitClass(playername)
local playerRole = UnitGroupRolesAssigned(playername)
local playerRole = UnitGroupRolesAssigned(playername)
player = {id = playerid, class = playerClass, role = playerRole, name = playername, first = time(), ["time"] = 0}
player = {id = playerid, class = playerClass, role = playerRole, name = playername, first = time(), ["time"] = 0}


-- Tell each mode to apply its needed attributes.
-- Tell each mode to apply its needed attributes.
for i, mode in ipairs(_G.Skada:GetModes(nil)) do
for i, mode in ipairs(_G.Skada:GetModes(nil)) do
if mode.AddPlayerAttributes ~= nil then
if mode.AddPlayerAttributes ~= nil then
mode:AddPlayerAttributes(player, set)
mode:AddPlayerAttributes(player, set)
end
end
end
end


-- Strip realm name
-- Strip realm name
-- This is done after module processing due to cross-realm names messing with modules (death log for example, which needs to do UnitHealthMax on the playername).
-- This is done after module processing due to cross-realm names messing with modules (death log for example, which needs to do UnitHealthMax on the playername).
local player_name, realm = string.split("-", playername, 2)
-- code from Details.lua in this folder
if _G.NickTag and detalhes then
local _table = NickTag:GetNicknameTable(playername)

if (not _table) then
player_name = playername:gsub(("%-.*"), "")
end

if _table and _table[1] then
if TemniUgolok_SetEmojiToDetails then
player_name = TemniUgolok_SetEmojiToDetails(_table[1])
else
player_name = _table[1]
end
end

else
local player_name, realm = string.split("-", playername, 2)
end

player.name = covenantPrefix..(player_name or playername)..covenantSuffix
player.name = covenantPrefix..(player_name or playername)..covenantSuffix

tinsert(set.players, player)
tinsert(set.players, player)
end
end


if player.name == UNKNOWN and playername ~= UNKNOWN then -- fixup players created before we had their info
if player.name == UNKNOWN and playername ~= UNKNOWN then -- fixup players created before we had their info
local player_name, realm = string.split("-", playername, 2)
if _G.NickTag and detalhes then
local _table = NickTag:GetNicknameTable(playername)

if (not _table) then
player_name = playername:gsub(("%-.*"), "")
end

if _table and _table[1] then
if TemniUgolok_SetEmojiToDetails then
player_name = TemniUgolok_SetEmojiToDetails(_table[1])
else
player_name = _table[1]
end
end

else
local player_name, realm = string.split("-", playername, 2)
end

player.name = covenantPrefix..(player_name or playername)..covenantSuffix
player.name = covenantPrefix..(player_name or playername)..covenantSuffix
local _, playerClass = UnitClass(playername)
local _, playerClass = UnitClass(playername)
local playerRole = UnitGroupRolesAssigned(playername)
local playerRole = UnitGroupRolesAssigned(playername)
player.class = playerClass
player.class = playerClass
player.role = playerRole
player.role = playerRole
end
end




-- The total set clears out first and last timestamps.
-- The total set clears out first and last timestamps.
if not player.first then
if not player.first then
player.first = time()
player.first = time()
end
end


-- Mark now as the last time player did something worthwhile.
-- Mark now as the last time player did something worthwhile.
player.last = time()
player.last = time()
changed = true
changed = true
return player
return player
end
end
end
end
end
end