Skip to content

Commit

Permalink
Allow anyone to see the entire housing catalogue
Browse files Browse the repository at this point in the history
  • Loading branch information
brightrim committed Aug 29, 2023
1 parent 8f7610b commit c72e307
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
35 changes: 17 additions & 18 deletions housing/construction.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,13 @@ end
local function showObject(user, object, category, skill, carpentryEstateCatalogue)

if carpentryEstateCatalogue ~= nil
and ((carpentryEstateCatalogue and object.typeOf ~= "Estate")
or (not carpentryEstateCatalogue and object.typeOf == "Estate"))
then return false
and ((carpentryEstateCatalogue and object.typeOf ~= "Estate")
or (not carpentryEstateCatalogue and object.typeOf == "Estate"))
then return false
end

if category.nameEN == object.category
and object.skill == skill.name
and object.level <= skill.level
and (object.typeOf ~= "Estate" or utility.checkIfEstate(user))
then return true
end
Expand Down Expand Up @@ -103,15 +102,13 @@ local function showCategory(user, skill, category)
for _, item in ipairs(itemList.items) do
if category.categoryEn == item.category
and skill.name == item.skill
and skill.level >= item.level
and (not category.Estate or utility.checkIfEstate(user))
then return true, false
end
end
for _, tile in ipairs(itemList.tiles) do
if category.categoryEn == tile.category
and skill.name == tile.skill
and skill.level >= tile.level
and (not category.Estate or utility.checkIfEstate(user))
then return true, true
end
Expand Down Expand Up @@ -185,20 +182,16 @@ local function loadDialog(user, dialog, skill, categories, products)
end

for index , product in ipairs(products) do
local requirement = product.difficulty

if requirement <= skill.level then

local time = loadCraftingTime(product.level)
local category = categoryList[product.category]
local categoryId = category.id
local name = loadProductName(user, product.id, category.tile)
local productId = product.id
if category.tile then
productId = utility.getTileGraphic(product.id)
end
dialog:addCraftable( index, categoryId , productId, name, time, 1)
local time = loadCraftingTime(product.level)
local category = categoryList[product.category]
local categoryId = category.id
local name = loadProductName(user, product.id, category.tile)
local productId = product.id
if category.tile then
productId = utility.getTileGraphic(product.id)
end
dialog:addCraftable( index, categoryId , productId, name, time, 1)

for _, ingredient in ipairs(product.ingredients) do
dialog:addCraftableIngredient(ingredient.id, ingredient.quantity)
Expand Down Expand Up @@ -477,9 +470,15 @@ function M.showDialog(user, skillName, carpentryEstateCatalogue)
local product = products[productIndex]
local foodOK = utility.checkRequiredFood(user, loadCraftingTime(product.level))
local canWork = utility.allowBuilding(user) and foodOK
local hasSkillLevel = product.level <= skill.level

local frontPos = common.GetFrontPosition(user)

if not hasSkillLevel then
common.HighInformNLS(user, "GERMAN TRANSLATION", "You need level "..product.level.." in "..user:getSkillName(Character[skill.name]).." to craft that. You could always seek out someone else to build it for you.")
return false
end

if not utility.wallWindowPermissions(user, frontPos, product.id) or not hasMaterials(user, product) then
canWork = false
end
Expand Down
2 changes: 1 addition & 1 deletion housing/itemList.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ table.insert(M.skills, {name = "pottery", displayDe = "Maurern", displayEn = "Cl
table.insert(M.skills, {name = "digging", displayDe = "Graben", displayEn = "Digging", sfx = 0, level = 1, estate = true})
table.insert(M.skills, {name = "herblore", displayDe = "Gartenarbeit", displayEn = "Gardening", sfx = 0, level = 50 })
table.insert(M.skills, {name = "glassBlowing", displayDe = "Glasblasen", displayEn = "Glassblowing", sfx = 7, level = 50 })
table.insert(M.skills, {name = "woodcutting", displayDe = "Sägen", displayEn = "Woodcutting", sfx = 14, level = 20 })
table.insert(M.skills, {name = "woodcutting", displayDe = "Sägen", displayEn = "Woodcutting", sfx = 14, level = 20, estate = true})
table.insert(M.skills, {name = "misc", displayDe = "Keine", displayEn = "None", sfx = 0, level = 0})


Expand Down
2 changes: 1 addition & 1 deletion housing/utility.lua
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ end

function M.checkIfSkillIsShown(user, skill)

if M.checkIfPlayerKnowsSkillByName(user, skill) and (not M.checkIfSkillOnlyHasEstateContents(skill) or M.checkIfEstate(user)) then
if not M.checkIfSkillOnlyHasEstateContents(skill) or M.checkIfEstate(user) then
return true
end

Expand Down

0 comments on commit c72e307

Please sign in to comment.