formatting

This commit is contained in:
Lilian Jónsdóttir 2020-10-04 01:14:37 -07:00
parent 3aae6144ee
commit 1830d1313c
2 changed files with 21 additions and 16 deletions

View file

@ -50,8 +50,8 @@ local this = {}
this.isInteriorCell = function(cell) this.isInteriorCell = function(cell)
if not cell then return end if not cell then return end
log(common.logLevels.large, "[CHECKS] Cell %s: interior: %s, behaves as exterior: %s therefore returning %s", cell.id, log(common.logLevels.large, "[CHECKS] Cell %s: interior: %s, behaves as exterior: %s therefore returning %s",
cell.isInterior, cell.behavesAsExterior, cell.isInterior and not cell.behavesAsExterior) cell.id, cell.isInterior, cell.behavesAsExterior, cell.isInterior and not cell.behavesAsExterior)
return cell.isInterior and not cell.behavesAsExterior return cell.isInterior and not cell.behavesAsExterior
end end
@ -69,8 +69,8 @@ this.isCityCell = function(internalCellId, externalCellId)
local _, _, externalCity = string.find(externalCellId, cityMatch) local _, _, externalCity = string.find(externalCellId, cityMatch)
if externalCity and externalCity == internalCity then if externalCity and externalCity == internalCity then
log(common.logLevels.large, "[CHECKS] hard mode city: %s in %s, %s == %s", internalCellId, externalCellId, externalCity, log(common.logLevels.large, "[CHECKS] hard mode city: %s in %s, %s == %s", internalCellId, externalCellId,
internalCity) externalCity, internalCity)
return true return true
end end
@ -80,8 +80,9 @@ this.isCityCell = function(internalCellId, externalCellId)
end end
this.isIgnoredCell = function(cell) this.isIgnoredCell = function(cell)
log(common.logLevels.large, "[CHECKS] %s is %s, %s is %s", cell.id, config.ignored[cell.id] and "ignored" or "not ignored", log(common.logLevels.large, "[CHECKS] %s is %s, %s is %s", cell.id,
cell.sourceMod, config.ignored[cell.sourceMod] and "ignored" or "not ignored") config.ignored[cell.id] and "ignored" or "not ignored", cell.sourceMod,
config.ignored[cell.sourceMod] and "ignored" or "not ignored")
-- don't do things in the wilderness -- don't do things in the wilderness
-- local wilderness = false -- local wilderness = false
@ -222,7 +223,9 @@ 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 npcs.factions[faction.id] = {ref = faction, total = 0, percentage = 0} end if not npcs.factions[faction.id] then
npcs.factions[faction.id] = {ref = faction, total = 0, percentage = 0}
end
if not npcs.factions[faction.id].master or npcs.factions[faction.id].master.object.factionIndex < if not npcs.factions[faction.id].master or npcs.factions[faction.id].master.object.factionIndex <
npc.object.factionIndex then npcs.factions[faction.id].master = npc end npc.object.factionIndex then npcs.factions[faction.id].master = npc end
@ -237,7 +240,8 @@ this.isPublicHouse = function(cell)
-- 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, master.object.name, master.object.class) log(common.logLevels.medium, "[CHECKS] %s is a temple, and %s, %s is the ranking member", cell.id,
master.object.name, master.object.class)
dataTables.createPublicHouseTableEntry(cell, master, city, publicHouseName, dataTables.createPublicHouseTableEntry(cell, master, city, publicHouseName,
cellEvaluators.calculateCellWorth(cell), cellEvaluators.calculateCellWorth(cell),
cellEvaluators.pickCellFaction(cell)) cellEvaluators.pickCellFaction(cell))
@ -249,8 +253,7 @@ 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, cell.name, faction, config.ignored[faction], info.ref.playerJoined, info.total, info.percentage, npcs.total)
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] 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))
@ -259,7 +262,8 @@ this.isPublicHouse = function(cell)
if (config.ignored[faction] or info.ref.playerJoined) and if (config.ignored[faction] 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, faction) log(common.logLevels.medium, "[CHECKS] %s is %s%% faction %s, marking public.", cell.name, info.percentage,
faction)
dataTables.createPublicHouseTableEntry(cell, npcs.factions[faction].master, city, publicHouseName, dataTables.createPublicHouseTableEntry(cell, npcs.factions[faction].master, city, publicHouseName,
cellEvaluators.calculateCellWorth(cell), cellEvaluators.calculateCellWorth(cell),
@ -326,8 +330,8 @@ this.isInclementWeather = function()
local index = tes3.getCurrentWeather().index local index = tes3.getCurrentWeather().index
local isBad = index >= config.worstWeather local isBad = index >= config.worstWeather
log(common.logLevels.large, "[CHECKS] Weather in %s: current:%s >= configured worst:%s, weather is %s", tes3.getRegion().id, index, log(common.logLevels.large, "[CHECKS] Weather in %s: current:%s >= configured worst:%s, weather is %s",
config.worstWeather, isBad and "bad" or "great") tes3.getRegion().id, index, config.worstWeather, isBad and "bad" or "great")
return isBad return isBad
end end
@ -337,7 +341,8 @@ this.isBadWeatherNPC = function(npc)
log(common.logLevels.large, "[CHECKS] NPC Inclement Weather: %s is %s%s", npc.object.name, npc.object.race.id, log(common.logLevels.large, "[CHECKS] NPC Inclement Weather: %s is %s%s", npc.object.name, npc.object.race.id,
this.offersTravel(npc) and ", travel agent" or "") this.offersTravel(npc) and ", travel agent" or "")
return this.offersTravel(npc) or config.badWeatherClassRace[npc.object.race.id] or config.badWeatherClassRace[npc.object.class.id] return this.offersTravel(npc) or config.badWeatherClassRace[npc.object.race.id] or
config.badWeatherClassRace[npc.object.class.id]
end end
return this return this

View file

@ -70,8 +70,8 @@ this.createHomedNPCTableEntry = function(npc, home, startingPlace, isHome, posit
return entry return entry
end end
this.createPublicHouseTableEntry = function(publicCell, proprietor, city, name, cellWorth, cellFaction) this.createPublicHouseTableEntry = function(publicCell, proprietor, city, name, cellWorth, cellFaction, type)
local typeOfPub = common.pickPublicHouseType(publicCell) local typeOfPub = type or common.pickPublicHouseType(publicCell) -- use shitty type picker if none specified
local proprietorName = proprietor and proprietor.object.name or "no one" local proprietorName = proprietor and proprietor.object.name or "no one"