Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions modules/bridge/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ function client.hasGroup(group)
if not PlayerData.loaded then return end

if type(group) == 'table' then
for name, rank in pairs(group) do
for name, req in pairs(group) do
local groupRank = PlayerData.groups[name]
if groupRank and groupRank >= (rank or 0) then
return name, groupRank
end
if type(req) == 'table' then
if groupRank and lib.table.contains(req, groupRank) then
return name, groupRank
end
elseif type(req) == 'number' then
if groupRank and groupRank >= req then
return name, groupRank
end
end
end
else
local groupRank = PlayerData.groups[group]
Expand Down
32 changes: 19 additions & 13 deletions modules/bridge/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,25 @@
---starting to get bulky

function server.hasGroup(inv, group)
if type(group) == 'table' then
for name, rank in pairs(group) do
local groupRank = inv.player.groups[name]
if groupRank and groupRank >= (rank or 0) then
return name, groupRank
end
end
else
local groupRank = inv.player.groups[group]
if groupRank then
return group, groupRank
end
end
if type(group) == 'table' then
for name, req in pairs(group) do
local groupRank = inv.player.groups[name]
if type(req) == 'table' then
if groupRank and lib.table.contains(req, groupRank) then
return name, groupRank
end
elseif type(req) == 'number' then
if groupRank and groupRank >= req then
return name, groupRank
end
end
end
else
local groupRank = inv.player.groups[group]
if groupRank then
return group, groupRank
end
end
end

---@diagnostic disable-next-line: duplicate-set-field
Expand Down