Skip to content

Commit

Permalink
Fix sturgeon roe id
Browse files Browse the repository at this point in the history
  • Loading branch information
jhaakma committed May 16, 2023
1 parent 81556d4 commit ac10a0a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
35 changes: 22 additions & 13 deletions Data Files/MWSE/mods/mer/fishing/Harvest/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ local function getHarvestablesDescription(harvestables)
local obj = tes3.getObject(harvestable.id)
if not obj then
logger:error("Harvestable object %s does not exist", harvestable.id)
return ""
else
description = description .. string.format("- %s (%s-%s)\n", obj.name, harvestable.min, harvestable.max)
end
description = description .. string.format("- %s (%s-%s)\n", obj.name, harvestable.min, harvestable.max)
end
description = description:sub(1, -2)
return description
end

local function getReceivedItemsMessage(harvestables)
local function getReceivedItemsMessage(harvested)
local message = "You received the following: \n"
for _, harvestable in ipairs(harvestables) do
local obj = tes3.getObject(harvestable.id)
message = message .. string.format("- %s\n", obj.name, harvestable.min, harvestable.max)
for id, count in pairs(harvested) do
local obj = tes3.getObject(id)
message = message .. string.format("- %dx %s\n", count, obj.name)
end
message = message:sub(1, -2)
return message
Expand Down Expand Up @@ -70,16 +70,25 @@ function Harvest.registerFish(fishType)
craftCallback = function(_, _)
--add each harvestable to inventory
local item
local harvested = {}
for _, harvestable in ipairs(fishType.harvestables) do
local count = math.random(harvestable.min, harvestable.max)
item = tes3.addItem{
reference = tes3.player,
item = harvestable.id,
count = count,
playSound = false
}--[[@as tes3misc]]
local obj = tes3.getObject(harvestable.id) --[[@as tes3ingredient]]
if count > 0 and obj then
item = tes3.addItem{
reference = tes3.player,
item = obj,
count = count,
playSound = false
}--[[@as tes3misc]]
harvested[harvestable.id] = count
end
end
if table.size(harvested) == 0 then
tes3.messageBox("You failed to harvest anything.")
return
end
tes3.messageBox(getReceivedItemsMessage(fishType.harvestables))
tes3.messageBox(getReceivedItemsMessage(harvested))
tes3.playItemPickupSound{ reference = tes3.player, item = item}
end,
materials = {
Expand Down
3 changes: 1 addition & 2 deletions Data Files/MWSE/mods/mer/fishing/integrations/fishTypes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,9 @@ local rareFish = {
isMeat = true,
},
{
id = "ab_ingcrea_sturgeonroe01",
id = "ab_ingcrea_sturgeonroe",
min = 0,
max = 1,
isMeat = false,
}
},
},
Expand Down

0 comments on commit ac10a0a

Please sign in to comment.