So I went ahead and forced ALL GROUPS and ALL PLAYERS to show during Test Mode. This will allow you to properly configure all aspects of the groups and their layouts during Test Mode.
Find UnitFrames.lua located Interface\AddOns\Enemy\Code\UnitFrames\UnitFrames.lua That's UnitFrames with an S at the end
Find the following:
Code: Select all
local function UpdateTestMode ()
if (config_dlg._prev_unitFramesTestMode == config_dlg.unitFramesTestMode) then return end
config_dlg._prev_unitFramesTestMode = config_dlg.unitFramesTestMode
config_dlg.testData = {}
for group_index = 1, Enemy.MaxGroups
do
local test_group = {}
tinsert (config_dlg.testData, test_group)
if (group_index ~= Enemy.groups.player.groupIndex and math.random (0, 5) == 3) then continue end
for index = 1, 6
do
if ((group_index == Enemy.groups.player.groupIndex and index == Enemy.groups.player.index)
or
math.random (0, 5) == 3) then continue end
test_group[index] = EnemyPlayer.GetRandomExample ()
test_group[index].isInPlayerGroup = (group_index == Enemy.groups.player.groupIndex)
test_group[index].isSelf = false
end
end
end
Code: Select all
local function UpdateTestMode ()
if (config_dlg._prev_unitFramesTestMode == config_dlg.unitFramesTestMode) then return end
config_dlg._prev_unitFramesTestMode = config_dlg.unitFramesTestMode
config_dlg.testData = {}
for group_index = 1, Enemy.MaxGroups
do
local test_group = {}
tinsert (config_dlg.testData, test_group)
for index = 1, 6
do
test_group[index] = EnemyPlayer.GetRandomExample (group_index, index)
test_group[index].isInPlayerGroup = (group_index == Enemy.groups.player.groupIndex)
test_group[index].isSelf = false
end
end
end
Code: Select all
function Enemy._UnitFramesUI_ConfigDialog_TestSettings ()
Enemy.ConfigurationWindowSaveData (config_dlg.cwnMain, config_dlg)
Enemy.ConfigurationWindowSaveData (config_dlg.cwnAppearance, config_dlg)
UpdateTestMode ()
if (config_dlg.unitFramesEnabled)
then
for group_index = 1, Enemy.MaxGroups
do
for index = 1, 6
do
g.frames[group_index][index]:Reset (true)
end
end
end
Enemy.UnitFrames_OnSettingsChanged (config_dlg)
if (config_dlg.unitFramesTestMode)
then
for group_index = 1, Enemy.MaxGroups
do
for index = 1, 6
do
local test_player = config_dlg.testData[group_index][index]
if (not test_player) then continue end
local frame = g.frames[group_index][index]
frame:Enable ()
frame:Update (test_player)
end
end
end
for group_index = 1, Enemy.MaxGroups
do
for index = 1, 6
do
g.frames[group_index][index]:BoundingBoxSetShowing (config_dlg.unitFramesShowBoundingBox)
end
end
Enemy._UnitFramesRecalculatePosititionMatrix ()
end
Code: Select all
function Enemy._UnitFramesUI_ConfigDialog_TestSettings ()
Enemy.ConfigurationWindowSaveData (config_dlg.cwnMain, config_dlg)
Enemy.ConfigurationWindowSaveData (config_dlg.cwnAppearance, config_dlg)
UpdateTestMode ()
if (config_dlg.unitFramesEnabled)
then
for group_index = 1, Enemy.MaxGroups
do
for index = 1, 6
do
g.frames[group_index][index]:Reset (true)
end
end
end
Enemy.UnitFrames_OnSettingsChanged (config_dlg)
if (config_dlg.unitFramesTestMode)
then
for group_index = 1, Enemy.MaxGroups
do
for index = 1, 6
do
local test_player = config_dlg.testData[group_index][index]
if (not test_player) then continue end
local frame = g.frames[group_index][index]
frame:Enable ()
frame:Update (test_player)
if index == 1 then
frame:_ShowAllEffectsIndicators ()
end
end
end
end
for group_index = 1, Enemy.MaxGroups
do
for index = 1, 6
do
g.frames[group_index][index]:BoundingBoxSetShowing (config_dlg.unitFramesShowBoundingBox)
end
end
Enemy._UnitFramesRecalculatePosititionMatrix (true)
end
Code: Select all
function Enemy._UnitFramesRecalculatePosititionMatrix ()
local max_groups = Enemy.UnitFramesGetMaxGroups ()
local archetype_sorting = {}
if (g.settings.unitFramesSortingEnabled)
then
for k = 1, 3
do
archetype_sorting[g.settings.unitFramesSorting[k]] = k
end
end
local global_scale = InterfaceCore.GetScale ()
local group_pos_matrix, group_max_x, group_max_y = Enemy.CalculatePositioningMatrix (
0, 0,
g.settings.unitFramesSize[1] * g.settings.unitFramesScale,
g.settings.unitFramesSize[2] * g.settings.unitFramesScale,
g.settings.unitFramesDirection1, g.settings.unitFramesPadding1, g.settings.unitFramesCount1,
g.settings.unitFramesDirection2, g.settings.unitFramesPadding2, mmax (1, mceil (6 / g.settings.unitFramesCount1))
)
local groups_pos_matrix, groups_max_x, groups_max_y = Enemy.CalculatePositioningMatrix (
0, 0,
group_max_x, group_max_y,
g.settings.unitFramesGroupsDirection1, g.settings.unitFramesGroupsPadding1, g.settings.unitFramesGroupsCount1,
g.settings.unitFramesGroupsDirection2, g.settings.unitFramesGroupsPadding2, mmax (1, mceil (max_groups / g.settings.unitFramesGroupsCount1))
)
g.positionMatrix = {}
local base_x = 10
local base_y = 10
local groups_indexes = {}
for _idx = 1, max_groups do tinsert (groups_indexes, _idx) end
local me = Enemy.groups.player
if (me and me:IsInGroup())
then
if (g.settings.unitFramesDetachMyGroup)
then
-- make our group last (prepare for detach)
tremove (groups_indexes, me.groupIndex)
tinsert (groups_indexes, max_groups, me.groupIndex)
else
if (g.settings.unitFramesMyGroupFirst and me.groupIndex ~= 1)
then
tremove (groups_indexes, me.groupIndex)
tinsert (groups_indexes, 1, me.groupIndex)
end
end
end
local pos_matrix_group_index = 1
for k = 1, max_groups
do
local group_index = groups_indexes[k]
local frames_group = g.frames[group_index]
local frames_group_pos = {}
if (Enemy.groups.groupsPlayersCount[group_index] > 0 and g.groupFilter[group_index])
then
local group_base_pos = nil
if (group_index == me.groupIndex and g.settings.unitFramesDetachMyGroup)
then
group_base_pos =
{
x = 0,
y = 0,
anchorWindow = g.anchorWindows[2]
}
else
group_base_pos = groups_pos_matrix[pos_matrix_group_index]
pos_matrix_group_index = pos_matrix_group_index + 1
end
local frames_indexes = { 1, 2, 3, 4, 5, 6 }
if (g.settings.unitFramesSortingEnabled)
then
tsort (frames_indexes, function (index1, index2)
local frame1 = frames_group[index1]
local frame2 = frames_group[index2]
local frame1_ok = frame1 and frame1:IsEnabled ()
local frame2_ok = frame2 and frame2:IsEnabled ()
if (frame1_ok and frame2_ok)
then
local a = archetype_sorting[Enemy.careerArchetypes[frame1.playerCareer]]
local b = archetype_sorting[Enemy.careerArchetypes[frame2.playerCareer]]
if (a == b)
then
return frame1.playerName < frame2.playerName
end
return a < b
elseif (not frame1_ok and not frame2_ok)
then
return index1 < index2
elseif (frame1_ok)
then
return true
end
return false
end)
end
for index = 1, 6
do
frames_group_pos[frames_indexes[index]] =
{
x = group_base_pos.x + base_x + group_pos_matrix[index].x,
y = group_base_pos.y + base_y + group_pos_matrix[index].y,
anchorWindow = group_base_pos.anchorWindow or g.anchorWindows[1]
}
end
end
g.positionMatrix[group_index] = frames_group_pos
end
for group_index = 1, max_groups
do
if (Enemy.groups.groupsPlayersCount[group_index] > 0)
then
for index = 1, 6
do
g.frames[group_index][index]:UpdatePosition ()
end
end
end
end
Code: Select all
function Enemy._UnitFramesRecalculatePosititionMatrix (isTestMode)
local max_groups = Enemy.UnitFramesGetMaxGroups ()
local doGroups = isTestMode
local archetype_sorting = {}
if (g.settings.unitFramesSortingEnabled)
then
for k = 1, 3
do
archetype_sorting[g.settings.unitFramesSorting[k]] = k
end
end
local global_scale = InterfaceCore.GetScale ()
local group_pos_matrix, group_max_x, group_max_y = Enemy.CalculatePositioningMatrix (
0, 0,
g.settings.unitFramesSize[1] * g.settings.unitFramesScale,
g.settings.unitFramesSize[2] * g.settings.unitFramesScale,
g.settings.unitFramesDirection1, g.settings.unitFramesPadding1, g.settings.unitFramesCount1,
g.settings.unitFramesDirection2, g.settings.unitFramesPadding2, mmax (1, mceil (6 / g.settings.unitFramesCount1))
)
local groups_pos_matrix, groups_max_x, groups_max_y = Enemy.CalculatePositioningMatrix (
0, 0,
group_max_x, group_max_y,
g.settings.unitFramesGroupsDirection1, g.settings.unitFramesGroupsPadding1, g.settings.unitFramesGroupsCount1,
g.settings.unitFramesGroupsDirection2, g.settings.unitFramesGroupsPadding2, mmax (1, mceil (max_groups / g.settings.unitFramesGroupsCount1))
)
g.positionMatrix = {}
local base_x = 10
local base_y = 10
local groups_indexes = {}
for _idx = 1, max_groups do tinsert (groups_indexes, _idx) end
local me = Enemy.groups.player
if (me and me:IsInGroup())
then
if (g.settings.unitFramesDetachMyGroup)
then
-- make our group last (prepare for detach)
tremove (groups_indexes, me.groupIndex)
tinsert (groups_indexes, max_groups, me.groupIndex)
else
if (g.settings.unitFramesMyGroupFirst and me.groupIndex ~= 1)
then
tremove (groups_indexes, me.groupIndex)
tinsert (groups_indexes, 1, me.groupIndex)
end
end
end
local pos_matrix_group_index = 1
for k = 1, max_groups
do
local group_index = groups_indexes[k]
local frames_group = g.frames[group_index]
local frames_group_pos = {}
doGroups = isTestMode
if not doGroups then
doGroups = (Enemy.groups.groupsPlayersCount[group_index] > 0 and g.groupFilter[group_index])
end
if (doGroups)
then
local group_base_pos = nil
if (group_index == me.groupIndex and g.settings.unitFramesDetachMyGroup)
then
group_base_pos =
{
x = 0,
y = 0,
anchorWindow = g.anchorWindows[2]
}
else
group_base_pos = groups_pos_matrix[pos_matrix_group_index]
pos_matrix_group_index = pos_matrix_group_index + 1
end
local frames_indexes = { 1, 2, 3, 4, 5, 6 }
if (g.settings.unitFramesSortingEnabled)
then
tsort (frames_indexes, function (index1, index2)
local frame1 = frames_group[index1]
local frame2 = frames_group[index2]
local frame1_ok = frame1 and frame1:IsEnabled ()
local frame2_ok = frame2 and frame2:IsEnabled ()
if (frame1_ok and frame2_ok)
then
local a = archetype_sorting[Enemy.careerArchetypes[frame1.playerCareer]]
local b = archetype_sorting[Enemy.careerArchetypes[frame2.playerCareer]]
if (a == b)
then
return frame1.playerName < frame2.playerName
end
return a < b
elseif (not frame1_ok and not frame2_ok)
then
return index1 < index2
elseif (frame1_ok)
then
return true
end
return false
end)
end
for index = 1, 6
do
frames_group_pos[frames_indexes[index]] =
{
x = group_base_pos.x + base_x + group_pos_matrix[index].x,
y = group_base_pos.y + base_y + group_pos_matrix[index].y,
anchorWindow = group_base_pos.anchorWindow or g.anchorWindows[1]
}
end
end
g.positionMatrix[group_index] = frames_group_pos
end
for group_index = 1, max_groups
do
doGroups = isTestMode
if not doGroups then
doGroups = (Enemy.groups.groupsPlayersCount[group_index] > 0)
end
if (doGroups)
then
for index = 1, 6
do
g.frames[group_index][index]:UpdatePosition ()
end
end
end
end
Find the following:
Code: Select all
function EnemyPlayer.GetRandomExample ()
local obj = EnemyPlayer.New (towstring (Enemy.capitalize (Enemy.GetRandomString2 (math.random (4, 15)))))
obj.career = math.random (24)
obj.level = math.random (40)
obj.hp = math.random (0, 100)
obj.ap = math.random (0, 100)
obj.morale = math.random (0, 4)
obj.distance = math.random (DISTANT_DISTANCE + 50)
obj.isOnline = math.random (0, 10) ~= 5
obj.isDistant = obj.distance >= DISTANT_DISTANCE
obj.isGroupLeader = math.random (0, 1) == 0
obj.isInPlayerGroup = math.random (0, 1) == 0
obj.isSelected = math.random (0, 3) == 2
obj.isLOS = math.random (0, 10) == 5
obj.isSelf = obj.isInPlayerGroup and (math.random (0, 1) == 0)
return obj
end
Code: Select all
function EnemyPlayer.GetRandomExample (group_index, index)
local prefix = ""
if group_index then prefix = prefix.."G:"..group_index end
if index then prefix = prefix.."P:"..index end
local obj = EnemyPlayer.New (towstring (Enemy.capitalize (prefix..(Enemy.GetRandomString2 (math.random (4, 15))) ) ))
obj.career = math.random (24)
obj.level = math.random (40)
obj.hp = math.random (0, 100)
obj.ap = math.random (0, 100)
obj.morale = math.random (0, 4)
obj.distance = math.random (DISTANT_DISTANCE + 50)
obj.isOnline = math.random (0, 10) ~= 5
obj.isDistant = obj.distance >= DISTANT_DISTANCE
obj.isGroupLeader = math.random (0, 1) == 0
obj.isInPlayerGroup = math.random (0, 1) == 0
obj.isSelected = math.random (0, 3) == 2
obj.isLOS = math.random (0, 10) == 5
obj.isSelf = obj.isInPlayerGroup and (math.random (0, 1) == 0)
return obj
end
Find the following:
Code: Select all
function EnemyUnitFrame:_HideAllEffectsIndicators ()
for _, effects_indicator in ipairs (self.effectsIndicators)
do
effects_indicator:Hide ()
end
end
Code: Select all
function EnemyUnitFrame:_ShowAllEffectsIndicators ()
for _, effects_indicator in ipairs (self.effectsIndicators)
do
effects_indicator:Show ()
end
end
If instead you want an already updated Enemy addon, here is the link. https://filebin.net/uv8wrnmqo65rc07s or https://easyupload.io/q1gi3y (these links do expire at some point)
BTW If you want to separate groups on the second anchor, you gotta play around with the "Groups Count 1" set it to how many columns of groups you want. Then set the "Groups Direction 1".
Example for set of 3 groups that extend to the right from Anchor 2.