Make sure the arena unit exists before continuing
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user