lowercase

This commit is contained in:
Lilian Jónsdóttir 2020-10-04 21:35:18 -07:00
parent d69d63126f
commit 1a7ba84724
2 changed files with 13 additions and 12 deletions

View file

@ -4,8 +4,8 @@ local common = require("celediel.NPCsGoHome.common")
local defaultConfig = { local defaultConfig = {
-- general settings -- general settings
ignored = { ignored = {
["Balmora, Caius Cosades' House"] = true, ["balmora, caius cosades' house"] = true,
["Publican"] = true -- inns are public ["publican"] = true -- inns are public
}, },
closeTime = 21, closeTime = 21,
openTime = 7, openTime = 7,

View file

@ -201,7 +201,7 @@ this.isPublicHouse = function(cell)
for npc in cell:iterateReferences(tes3.objectType.npc) do for npc in cell:iterateReferences(tes3.objectType.npc) do
-- Check for NPCS of ignored classes first -- Check for NPCS of ignored classes first
if not this.isIgnoredNPC(npc) then if not this.isIgnoredNPC(npc) then
if npc.object.class and config.ignored[npc.object.class.id] then if npc.object.class and config.ignored[npc.object.class.id:lower()] then
log(common.logLevels.medium, "[CHECKS] NPC:\'%s\' of class:\'%s\' made %s public", npc.object.name, log(common.logLevels.medium, "[CHECKS] NPC:\'%s\' of class:\'%s\' made %s public", npc.object.name,
npc.object.class and npc.object.class.id or "none", cell.name) npc.object.class and npc.object.class.id or "none", cell.name)
@ -214,14 +214,15 @@ this.isPublicHouse = function(cell)
local faction = npc.object.faction local faction = npc.object.faction
if faction then if faction then
if not npcs.factions[faction.id] then local id = faction.id:lower()
npcs.factions[faction.id] = {ref = faction, total = 0, percentage = 0} if not npcs.factions[id] then
npcs.factions[id] = {ref = faction, total = 0, percentage = 0}
end end
if not npcs.factions[faction.id].master or npcs.factions[faction.id].master.object.factionIndex < if not npcs.factions[id].master or npcs.factions[id].master.object.factionIndex <
npc.object.factionIndex then npcs.factions[faction.id].master = npc end npc.object.factionIndex then npcs.factions[id].master = npc end
npcs.factions[faction.id].total = npcs.factions[faction.id].total + 1 npcs.factions[id].total = npcs.factions[id].total + 1
end end
npcs.total = npcs.total + 1 npcs.total = npcs.total + 1
@ -229,7 +230,7 @@ this.isPublicHouse = function(cell)
end end
-- Temples are always public -- Temples are always public
if npcs.factions["Temple"] and cell.name:lower():match("temple") then if npcs.factions["temple"] and cell.name:lower():match("temple") then
local master = npcs.factions["Temple"].master local master = npcs.factions["Temple"].master
log(common.logLevels.medium, "[CHECKS] %s is a temple, and %s, %s is the ranking member", cell.id, log(common.logLevels.medium, "[CHECKS] %s is a temple, and %s, %s is the ranking member", cell.id,
master.object.name, master.object.class) master.object.name, master.object.class)
@ -244,13 +245,13 @@ this.isPublicHouse = function(cell)
info.percentage = (info.total / npcs.total) * 100 info.percentage = (info.total / npcs.total) * 100
log(common.logLevels.large, log(common.logLevels.large,
"[CHECKS] No NPCs of ignored class in %s, checking faction %s (ignored: %s, player joined: %s) with %s (%s%%) vs total %s", "[CHECKS] No NPCs of ignored class in %s, checking faction %s (ignored: %s, player joined: %s) with %s (%s%%) vs total %s",
cell.name, faction, config.ignored[faction], info.ref.playerJoined, info.total, info.percentage, npcs.total) cell.name, faction, config.ignored[faction:lower()], info.ref.playerJoined, info.total, info.percentage, npcs.total)
-- log(common.logLevels.large, "[CHECKS] ignored or joined:%s, occupants or blades:%s, faction percent:%s", (config.ignored[faction.id] or faction.playerJoined), -- log(common.logLevels.large, "[CHECKS] ignored or joined:%s, occupants or blades:%s, faction percent:%s", (config.ignored[faction.id:lower()] or faction.playerJoined),
-- (npcs.total >= config.minimumOccupancy or faction == "Blades"), (info.percentage >= config.factionIgnorePercentage)) -- (npcs.total >= config.minimumOccupancy or faction == "Blades"), (info.percentage >= config.factionIgnorePercentage))
-- less than configured amount of NPCs can't be a public house unless it's a Blades house -- less than configured amount of NPCs can't be a public house unless it's a Blades house
if (config.ignored[faction] or info.ref.playerJoined) and if (config.ignored[faction:lower()] or info.ref.playerJoined) and
(npcs.total >= config.minimumOccupancy or faction == "Blades") and (npcs.total >= config.minimumOccupancy or faction == "Blades") and
(info.percentage >= config.factionIgnorePercentage) then (info.percentage >= config.factionIgnorePercentage) then
log(common.logLevels.medium, "[CHECKS] %s is %s%% faction %s, marking public.", cell.name, info.percentage, log(common.logLevels.medium, "[CHECKS] %s is %s%% faction %s, marking public.", cell.name, info.percentage,