Skip to content

Commit

Permalink
fix(server/inventory): dumpster loot generation
Browse files Browse the repository at this point in the history
Resolves #1563.
  • Loading branch information
thelindat committed Dec 20, 2023
1 parent 58b0bbc commit dbd5fad
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions modules/inventory/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ function Inventory.Create(id, label, invType, slots, weight, maxWeight, owner, i
end

if not items then
self.items, self.weight = Inventory.Load(self.dbId, invType, owner, self.datastore)
self.items, self.weight = Inventory.Load(self.dbId, invType, owner)
elseif weight == 0 and next(items) then
self.weight = Inventory.CalculateWeight(items)
end
Expand Down Expand Up @@ -768,8 +768,7 @@ end
---@param id string|number
---@param invType string
---@param owner string | number | boolean
---@param datastore? boolean
function Inventory.Load(id, invType, owner, datastore)
function Inventory.Load(id, invType, owner)
if not invType then return end

local result
Expand All @@ -784,14 +783,12 @@ function Inventory.Load(id, invType, owner, datastore)
else
result = result[invType]
end
elseif id then
if invType == 'dumpster' then
if server.randomloot then
return generateItems(id, invType)
end
elseif not datastore then
result = db.loadStash(owner or '', id)
elseif invType == 'dumpster' then
if server.randomloot then
return generateItems(id, invType)
end
elseif id then
result = db.loadStash(owner or '', id)
end

local returnData, weight = {}, 0
Expand Down

0 comments on commit dbd5fad

Please sign in to comment.