Table of Contents

Class JobType

Namespace
TinyLife.Goals
Assembly
Tiny Life.dll

A job type is a singleton containing various kinds of data for a Job instance. New jobs can be registered using Register(JobType).

[JsonConverter(typeof(MigratingStaticJsonConverter<JobType>), new object[] { typeof(JobType), "PrivateTypes", true })]
public class JobType : GenericDataHolder, IGenericDataHolder, IEmotionSource
Inheritance
GenericDataHolder
JobType
Implements
IGenericDataHolder
Derived
Inherited Members
GenericDataHolder.GetDataKeys()
Extension Methods

Constructors

JobType(string, TextureRegion, float, (int Start, int End), params DayOfWeek[])

Creates a new job type with the given settings

public JobType(string name, TextureRegion icon, float hourlyPay, (int Start, int End) workHours, params DayOfWeek[] offWorkDays)

Parameters

name string

The name of the job

icon TextureRegion

This job type's icon.

hourlyPay float

The hourly wage that this job yields

workHours (int Start, int End)

A range of hours to work each day

offWorkDays DayOfWeek[]

The days of the week that are off work

Fields

Businessperson

public static readonly JobType Businessperson

Field Value

JobType

Doctor

public static readonly JobType Doctor

Field Value

JobType

Firefighter

public static readonly JobType Firefighter

Field Value

JobType

HourlyPay

The amount of tiny bucks that being at the job for an hour pays. To get a modified default hourly pay that also takes Difficulty into account, use GetDefaultHourlyPay(Person).

public readonly float HourlyPay

Field Value

float

Icon

This job type's icon.

public readonly TextureRegion Icon

Field Value

TextureRegion

Name

The name of this job type

public readonly string Name

Field Value

string

OffWorkDays

A set of DayOfWeek values which are days off of this job. On days contained in this list, the WorkHours don't apply.

public readonly DayOfWeek[] OffWorkDays

Field Value

DayOfWeek[]

PrimarySchoolStudent

public static readonly JobType PrimarySchoolStudent

Field Value

JobType

Programmer

public static readonly JobType Programmer

Field Value

JobType

RetailWorker

public static readonly JobType RetailWorker

Field Value

JobType

Scientist

public static readonly JobType Scientist

Field Value

JobType

Teacher

public static readonly JobType Teacher

Field Value

JobType

Types

A registry of all JobType instances in the game and mods. Register new jobs using Register(JobType).

public static readonly ReadOnlyDictionary<string, JobType> Types

Field Value

ReadOnlyDictionary<string, JobType>

WorkHours

A Range of hours that this job requires each day. Note that the minimum (Start) value is inclusive, but the maximum (End) value is exclusive.

public readonly (int Start, int End) WorkHours

Field Value

(int Start, int End)

Properties

CanGetRaise

Whether a person can get a raise in this job. This value defaults to true.

public bool CanGetRaise { get; init; }

Property Value

bool

CanQuitOrBeFired

Whether a person can quit this job or be fired from it. This value defaults to true.

public bool CanQuitOrBeFired { get; init; }

Property Value

bool

ChoicePrompts

A set of ChoicePromptInfo instances that will randomly be displayed throughout this job type's work day.

public ChoicePromptInfo[] ChoicePrompts { get; init; }

Property Value

ChoicePromptInfo[]

DailyTaskImportance

The importance of the DailyTasks for job progress. This value defaults to 0.25, meaning the completion of this job's daily tasks make up 25% of the performance gained the next day.

public float DailyTaskImportance { get; init; }

Property Value

float

DailyTasks

A GoalSetInfo that determines the daily tasks for this job type. This value defaults to null, meaning the job will have no daily tasks.

public GoalSetInfo DailyTasks { get; init; }

Property Value

GoalSetInfo

HasSpecialLocalization

Whether this job has special localization info for promotion, demotion, going to work and getting home from work. This value defaults to false.

public bool HasSpecialLocalization { get; init; }

Property Value

bool

MaxLevel

The maximum level of this job, which defaults to 9

public int MaxLevel { get; init; }

Property Value

int

Migrations

The set of migrations that should be applied to Job instances of this type when loading from disk.

public List<Migration<Job>> Migrations { get; init; }

Property Value

List<Migration<Job>>

RequiredAges

The set of ages that a person can have to be able to do this job. This value defaults to ~Child, which is all age groups except for Child.

public AgeGroup RequiredAges { get; init; }

Property Value

AgeGroup

RequiredPromotionSkills

A set of skills and their level curves that are required for promotion to the next Level of this job type. The level curve is a multiplier for the job's current Level that yields the required skill level. Specifically, the required skill level for any given job level is calculated as (curve * (jobLevel + 1)).Floor().

public (SkillType Type, float LevelCurve)[] RequiredPromotionSkills { get; init; }

Property Value

(SkillType Type, float Amount)[]

SourceString

A (localized) string that is displayed when hovering over an EmotionModifier that has this source

public string SourceString { get; }

Property Value

string

Methods

Construct(Person, int)

Creates a new Job from this type's information

public Job Construct(Person person, int level = 0)

Parameters

person Person

The person that should have the job

level int

The level to start this job with, defaults to 0

Returns

Job

A new job instance

GetDefaultHourlyPay(Person)

Returns the default hourly pay for this job type, based on the HourlyPay, as well as the passed Person's Difficulty.

public virtual float GetDefaultHourlyPay(Person person)

Parameters

person Person

The person for which to return the default hourly pay.

Returns

float

The default hourly pay for the given person.

GetDisplayName(int?)

Returns the display name of this JobType, based on the given level. If no level is given, the job's regular name, without the level-based suffix, is returned.

public virtual string GetDisplayName(int? level = null)

Parameters

level int?

The level

Returns

string

A localized string representing this job's name

GetRequiredPromotionSkills(Job)

Returns the set of skills and levels that are required to promote from the given job's Level to the next level

public virtual IEnumerable<(SkillType Type, int Level)> GetRequiredPromotionSkills(Job job)

Parameters

job Job

The current job

Returns

IEnumerable<(SkillType Type, int Level)>

A set of skill types and their required levels for promotion

IsTimeToWork(TimeSpan)

Returns whether the given time (or the game's current time) is in the bounds of WorkHours and outside of the bounds of OffWorkDays. Note that this method does not check additional criteria like whether a person is on vacation, based on DaysOnVacation.

public virtual bool IsTimeToWork(TimeSpan time)

Parameters

time TimeSpan

The current time.

Returns

bool

true if it is time to work, false otherwise

OnLevelChanged(Job, int)

A method that is called when a Person is promoted or demoted for this job. By default, some emotion modifiers are applied.

public virtual void OnLevelChanged(Job job, int levelDifference)

Parameters

job Job

The job instance

levelDifference int

The level difference that was applied. If the person was demoted, this value is -1, else it is 1.

OnRaiseReceived(Job)

A method that is called when a Person receives a raise using GetRaise(). By default, some emotion modifiers are applied.

public virtual void OnRaiseReceived(Job job)

Parameters

job Job

The job instance

OnWorkFinished(Job, WorkAction)

A method that is called when a Person finishes a WorkAction for this job. By default, some emotion modifiers are randomly applied.

public virtual void OnWorkFinished(Job job, WorkAction action)

Parameters

job Job

The job instance

action WorkAction

The work action that was completed

OnWorkHoursOver(Job)

A method that is called when the work hours for the given Job instance are over for this job. Note that this method is also called if the person didn't go to work, is on vacation, or left early. By default, the DailyTasks are reset.

public virtual void OnWorkHoursOver(Job job)

Parameters

job Job

The job instance

OnWorkStarted(Job, WorkAction)

A method that is called when a Person starts a WorkAction for this job. By default, this method does nothing.

public virtual void OnWorkStarted(Job job, WorkAction action)

Parameters

job Job

The job instance

action WorkAction

The work action that was started

OnWorkStartsInAnHour(Job)

A method that is called when the given Job instance starts work in an hour for this job. By default, a notification is displayed that instructs the person to head to work soon.

public virtual void OnWorkStartsInAnHour(Job job)

Parameters

job Job

The job instance

Register(JobType)

Registers the given job type to the Types registry

public static JobType Register(JobType type)

Parameters

type JobType

The type to register

Returns

JobType

ToScheduleString(TimeSpan?)

Returns a string representation of the schedule. The string includes a line that states the WorkHours and a line that states the OffWorkDays.

public virtual string ToScheduleString(TimeSpan? currentTime = null)

Parameters

currentTime TimeSpan?

Returns

string

A string representation of this job's schedule

UpdateWorking(Job, WorkAction, TimeSpan, float)

Updates this job type's Job instance. By default, this method causes students to gain skills in StudentJobType. This is called in UpdateWorking(WorkAction, TimeSpan, float).

public virtual void UpdateWorking(Job job, WorkAction action, TimeSpan passedInGame, float speedMultiplier)

Parameters

job Job

The job instance.

action WorkAction

The action that is currently being executed.

passedInGame TimeSpan

The amount of time that has passed in game since the last update.

speedMultiplier float

The game's current speed multiplier.