Bashmatic/src/aliases/bashmatic/BM_Listtargets.lua
ccubed 89848ef20b
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Fix inconsistent config set behavior, add checks for input, ensure newlines exist on cechos
2024-06-17 13:14:00 -04:00

40 lines
1.3 KiB
Lua

if Bashmatic.enemies.group then
-- grouped by areas
local area = GetRoomAreaName(GetRoomArea(GetPlayerRoom())) or nil
if area == nil then
cecho("\n<firebrick>Bashmatic: We got an invalid area.\nWe Got: " .. area .. "<reset>")
return
end
if not table.contains(Bashmatic.enemies.targets, area) then
cecho("\n<firebrick>Bashmatic: No enemies added from the area " .. area .. "<reset>")
return
end
local size = table.size(Bashmatic.enemies.targets.area)
if size == 0 then
cecho("\n<firebrick>Bashmatic: No enemies added from the area " .. area .. "<reset>")
return
end
if size <= 15 then
-- fits on one page
displayAreaTargetList(area, 1, size, nil, nil)
else
-- paginator
local pages = math.floor(size/15)+1
displayAreaTargetList(area, 1, 15, 1, pages)
end
else
-- not grouped by area
local size = table.size(Bashmatic.enemies.targets)
if size == 0 then
cecho("\n<firebrick>Bashmatic: No enemies added.<reset>")
return
end
if size <= 15 then
-- fits on one page
displayTargetList(1, size, nil, nil)
else
-- paginator
local pages = math.floor(size/15)+1
displayTargetList(1, 15, 1, pages)
end
end