preparing for better picking of public house type

This commit is contained in:
Lilian Jónsdóttir 2020-08-22 13:55:59 -07:00
parent 968fb3b7af
commit dafb4af875

View file

@ -161,12 +161,12 @@ local function checkManor(cellName, npcName)
end end
-- todo: pick this better -- todo: pick this better
local function pickPublicHouseType(cellName) local function pickPublicHouseType(cell)
if cellName:match("Guild") then if cell.id:match("Guild") then
return publicHouseTypes.guildhalls return publicHouseTypes.guildhalls
elseif cellName:match("Temple") then elseif cell.id:match("Temple") then
return publicHouseTypes.temples return publicHouseTypes.temples
-- elseif cellName:match("House") then -- elseif cell.id:match("House") then
-- return publicHouseTypes.houses -- return publicHouseTypes.houses
else else
return publicHouseTypes.inns return publicHouseTypes.inns
@ -281,7 +281,7 @@ local function createHomedNPCTableEntry(npc, home, startingPlace, isHome, positi
end end
local function createPublicHouseTableEntry(publicCell, proprietor, city, name) local function createPublicHouseTableEntry(publicCell, proprietor, city, name)
local typeOfPub = pickPublicHouseType(publicCell.name) local typeOfPub = pickPublicHouseType(publicCell)
local worth = 0 local worth = 0
@ -467,7 +467,7 @@ local function isPublicHouse(cell)
-- only interior cells are public "houses" -- only interior cells are public "houses"
if not isInteriorCell(cell) then return false end if not isInteriorCell(cell) then return false end
local typeOfPub = pickPublicHouseType(cell.name) local typeOfPub = pickPublicHouseType(cell)
local city, publicHouseName local city, publicHouseName
if cell.name and string.match(cell.name, ",") then if cell.name and string.match(cell.name, ",") then
@ -620,7 +620,7 @@ local function checkEnteredNPCHome(cell)
end end
local function checkEnteredPublicHouse(cell, city) local function checkEnteredPublicHouse(cell, city)
local typeOfPub = pickPublicHouseType(cell.name) local typeOfPub = pickPublicHouseType(cell)
local publicHouse = publicHouses[city] and (publicHouses[city][typeOfPub] and publicHouses[city][typeOfPub][cell.name]) local publicHouse = publicHouses[city] and (publicHouses[city][typeOfPub] and publicHouses[city][typeOfPub][cell.name])