Class JobType
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
-
GenericDataHolderJobType
- 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
stringThe name of the job
icon
TextureRegionThis job type's icon.
hourlyPay
floatThe 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
Doctor
public static readonly JobType Doctor
Field Value
Firefighter
public static readonly JobType Firefighter
Field Value
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
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
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
PrimarySchoolStudent
public static readonly JobType PrimarySchoolStudent
Field Value
Programmer
public static readonly JobType Programmer
Field Value
RetailWorker
public static readonly JobType RetailWorker
Field Value
Scientist
public static readonly JobType Scientist
Field Value
Teacher
public static readonly JobType Teacher
Field Value
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
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
Properties
CanGetRaise
Whether a person can get a raise in this job. This value defaults to true.
public bool CanGetRaise { get; init; }
Property Value
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
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
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
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
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
MaxLevel
The maximum level of this job, which defaults to 9
public int MaxLevel { get; init; }
Property Value
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
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
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
SourceString
A (localized) string that is displayed when hovering over an EmotionModifier that has this source
public string SourceString { get; }
Property Value
Methods
Construct(Person, int)
Creates a new Job from this type's information
public Job Construct(Person person, int level = 0)
Parameters
person
PersonThe person that should have the job
level
intThe 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
PersonThe 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
JobThe 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
TimeSpanThe 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
JobThe job instance
levelDifference
intThe 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
JobThe 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
JobThe job instance
action
WorkActionThe 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
JobThe 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
JobThe job instance
action
WorkActionThe 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
JobThe job instance
Register(JobType)
Registers the given job type to the Types registry
public static JobType Register(JobType type)
Parameters
type
JobTypeThe type to register
Returns
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
JobThe job instance.
action
WorkActionThe action that is currently being executed.
passedInGame
TimeSpanThe amount of time that has passed in game since the last update.
speedMultiplier
floatThe game's current speed multiplier.