Table of Contents

Class TimbnNpcs

Namespace
Timbn.GraveyardKeeperTwo.Core.Framework
Assembly
Timbn.GraveyardKeeperTwo.Core.dll

Reads the game's own lists of places people go, so a mod never writes a list of point ids, and what the game keeps about a person, such as their reputation resource. To move someone, use the plugin's Npcs property.

public static class TimbnNpcs
Inheritance
TimbnNpcs
Inherited Members

Methods

FacingAt(string)

The way a person faces when they stop on a point, such as Left for a seat at the end of a table, or null when the point does not exist or at the main menu. Use it to pick who goes to a point or what they play there.

public static Direction? FacingAt(string pointId)

Parameters

pointId string

The point's id.

Returns

Direction?

The point's facing, or null.

Examples

if (TimbnNpcs.FacingAt("npc_sim_village_tavern_06") == Direction.Left)
    kind = TimbnGameIds.Npcs.Fisherman01;

GroupMemberIds(string)

The kinds of people the game itself placed in one of its life simulator groups, one entry per person, such as the villagers of the village day group. People a plugin added with Npcs.Spawn are left out.

public static IReadOnlyList<string> GroupMemberIds(string groupId)

Parameters

groupId string

The group's id, from TimbnGameIds.Groups.

Returns

IReadOnlyList<string>

Definition ids in id order, empty when the group is missing or empty, or at the main menu.

Examples

foreach (var kind in TimbnNpcs.GroupMemberIds(TimbnGameIds.Groups.VillagersDayAll))
    Npcs.AddVillager(kind);

GroupPoints(string, string?)

The points of one of the game's life simulator groups, the places it sends villagers to, such as the tavern seats in the village group.

public static IReadOnlyList<string> GroupPoints(string groupId, string? prefix = null)

Parameters

groupId string

The group's id, from TimbnGameIds.Groups.

prefix string

Keeps only the points whose id starts with this. Leave it out for every point.

Returns

IReadOnlyList<string>

The point ids in id order, empty when the group is missing or at the main menu.

Examples

var seats = TimbnNpcs.GroupPoints(TimbnGameIds.Groups.VillagersDayAll, "npc_sim_village_tavern_");

IsFree(string)

Whether a point is free for anyone, meaning it exists, is switched on, nobody claimed it and nobody stands on it. Use it to pick a point before you know who goes there. A person's own IsFree also counts their own claim as free.

public static bool IsFree(string pointId)

Parameters

pointId string

The point's id.

Returns

bool

False when the point is taken, missing or switched off, and at the main menu.

ReputationOf(string)

The id of the player's resource that holds their reputation with an NPC, such as rep_larry for Larry, or null for someone the game keeps no reputation with. Read it with GetResource(string) to gate on reputation outside a quest, where TimbnNeeds.Reputation does it for you.

public static string? ReputationOf(string npcId)

Parameters

npcId string

The NPC, from TimbnGameIds.Npcs.

Returns

string

The resource id, or null when the NPC has no reputation or the balance is not loaded.

Examples

var liked = TimbnNpcs.ReputationOf(TimbnGameIds.Npcs.Larry) is { } rep && TimbnPlayer.GetResource(rep) >= 20f;