From c72e30771ba75361ba85da0d4922963116286e64 Mon Sep 17 00:00:00 2001 From: brightrim Date: Tue, 29 Aug 2023 20:14:46 +0200 Subject: [PATCH] Allow anyone to see the entire housing catalogue --- housing/construction.lua | 35 +++++++++++++++++------------------ housing/itemList.lua | 2 +- housing/utility.lua | 2 +- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/housing/construction.lua b/housing/construction.lua index eef9a9be4..6391b40c7 100644 --- a/housing/construction.lua +++ b/housing/construction.lua @@ -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 @@ -103,7 +102,6 @@ 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 @@ -111,7 +109,6 @@ local function showCategory(user, skill, category) 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 @@ -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) @@ -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 diff --git a/housing/itemList.lua b/housing/itemList.lua index 085d0b5b3..f28dfd5aa 100644 --- a/housing/itemList.lua +++ b/housing/itemList.lua @@ -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}) diff --git a/housing/utility.lua b/housing/utility.lua index 5b68d37ba..725d558c6 100644 --- a/housing/utility.lua +++ b/housing/utility.lua @@ -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