Make sure the arena unit exists before continuing

This commit is contained in:
Tercio Jose
2021-04-08 11:00:16 -03:00
parent 5a1cef5001
commit 2d243d13b5
3 changed files with 72 additions and 14 deletions
+9 -9
View File
@@ -270,7 +270,7 @@
if (_detalhes.is_in_arena) then
local my_team_color = GetBattlefieldArenaFaction()
local my_team_color = GetBattlefieldArenaFaction and GetBattlefieldArenaFaction() or 0
if (novo_objeto.grupo) then --> is ally
novo_objeto.arena_ally = true
@@ -287,18 +287,18 @@
novo_objeto.role = arena_props.role
if (arena_props.role == "NONE") then
local role = UnitGroupRolesAssigned (nome)
if (role ~= "NONE") then
local role = UnitGroupRolesAssigned and UnitGroupRolesAssigned(nome)
if (role and role ~= "NONE") then
novo_objeto.role = role
end
end
else
local oponentes = GetNumArenaOpponentSpecs()
local oponentes = GetNumArenaOpponentSpecs and GetNumArenaOpponentSpecs() or 5
local found = false
for i = 1, oponentes do
local name = GetUnitName ("arena" .. i, true)
if (name == nome) then
local spec = GetArenaOpponentSpec (i)
local spec = GetArenaOpponentSpec and GetArenaOpponentSpec (i)
if (spec) then
local id, name, description, icon, role, class = DetailsFramework.GetSpecializationInfoByID (spec) --thanks pas06
novo_objeto.role = role
@@ -310,15 +310,15 @@
end
end
local role = UnitGroupRolesAssigned (nome)
if (role ~= "NONE") then
local role = UnitGroupRolesAssigned and UnitGroupRolesAssigned (nome)
if (role and role ~= "NONE") then
novo_objeto.role = role
found = true
end
if (not found and nome == _detalhes.playername) then
if (not found and nome == _detalhes.playername) then
local role = UnitGroupRolesAssigned ("player")
if (role ~= "NONE") then
if (role and role ~= "NONE") then
novo_objeto.role = role
end
end
+4 -4
View File
@@ -927,21 +927,21 @@
function Details:GetPlayersInArena()
local aliados = GetNumGroupMembers() -- LE_PARTY_CATEGORY_HOME
for i = 1, aliados-1 do
local role = UnitGroupRolesAssigned ("party" .. i)
if (role ~= "NONE") then
local role = UnitGroupRolesAssigned and UnitGroupRolesAssigned("party" .. i) or "DAMAGER"
if (role ~= "NONE" and UnitExists("party" .. i)) then
local name = GetUnitName ("party" .. i, true)
Details.arena_table [name] = {role = role}
end
end
local role = UnitGroupRolesAssigned ("player")
local role = UnitGroupRolesAssigned and UnitGroupRolesAssigned("player") or "DAMAGER"
if (role ~= "NONE") then
local name = GetUnitName ("player", true)
Details.arena_table [name] = {role = role}
end
--enemies
local enemiesAmount = GetNumArenaOpponentSpecs()
local enemiesAmount = GetNumArenaOpponentSpecs and GetNumArenaOpponentSpecs() or 5
table.wipe(_detalhes.arena_enemies)
for i = 1, enemiesAmount do
+59 -1
View File
@@ -532,9 +532,67 @@ function Details:StartMeUp() --I'll never stop!
end
if (DetailsFramework.IsTimewalkWoW()) then
Details:Msg("TBC Beta Version: 0008")
Details:Msg("TBC Beta Version: 0009")
end
if (DetailsFramework.IsTBCWow()) then
local originalPosition
local isOnOriginalPosition = true
local taintWarning = CreateFrame ("frame", nil, UIParent, "BackdropTemplate")
taintWarning:SetSize (500, 35)
taintWarning:SetFrameStrata ("low")
DetailsFramework:ApplyStandardBackdrop(taintWarning)
local warningMessage = taintWarning:CreateFontString (nil, "overlay", "GameFontNormal")
warningMessage:SetText ("< right click and choose 'Enter Battle' if 'Enter Battle' button does not work")
C_Timer.NewTicker(1, function()
if (StaticPopup1:IsShown()) then
if (StaticPopup1.which == "CONFIRM_BATTLEFIELD_ENTRY") then
if (StaticPopup2:IsShown()) then
if (StaticPopup2.which == "ADDON_ACTION_FORBIDDEN") then
StaticPopup_Hide("ADDON_ACTION_FORBIDDEN")
end
end
taintWarning:Show()
taintWarning:SetPoint ("topleft", StaticPopup1, "bottomleft", 0, -10)
if (MiniMapBattlefieldFrame:IsShown())then
if (not originalPosition) then
local a = {}
for i = 1, MiniMapBattlefieldFrame:GetNumPoints() do
a[#a + 1] = {MiniMapBattlefieldFrame:GetPoint(i)}
end
originalPosition = a
end
MiniMapBattlefieldFrame:ClearAllPoints()
MiniMapBattlefieldFrame:SetPoint("left", taintWarning, "left", 10, -2)
warningMessage:SetPoint ("left", MiniMapBattlefieldFrame, "right", 9, 0)
MiniMapBattlefieldFrame:SetFrameStrata("HIGH")
--
isOnOriginalPosition = false
end
end
else
if (originalPosition and not isOnOriginalPosition) then
MiniMapBattlefieldFrame:ClearAllPoints()
for i = 1, #originalPosition do
MiniMapBattlefieldFrame:SetPoint(unpack (originalPosition[i]))
end
taintWarning:Hide()
isOnOriginalPosition = true
end
end
end)
end
function Details:InstallOkey()
return true
end