Skip to main content

Utc

Struct Utc 

Source
pub struct Utc {
Show 95 fields pub max_hp: i16, pub first_name: GffLocalizedString, pub last_name: GffLocalizedString, pub description: GffLocalizedString, pub is_pc: bool, pub tag: String, pub conversation: ResRef, pub interruptable: bool, pub age: i32, pub gender_id: u8, pub starting_package: u8, pub race_id: u8, pub subrace_name: String, pub subrace_id: u8, pub deity: String, pub strength: u8, pub dexterity: u8, pub intelligence: u8, pub wisdom: u8, pub constitution: u8, pub charisma: u8, pub natural_ac: u8, pub soundset_id: u16, pub gold: u32, pub invulnerable: bool, pub plot: bool, pub min1_hp: bool, pub party_interact: bool, pub not_reorienting: bool, pub disarmable: bool, pub experience: u32, pub portrait_id: u16, pub portrait_resref: ResRef, pub alignment: u8, pub color_skin: u8, pub color_hair: u8, pub color_tattoo1: u8, pub color_tattoo2: u8, pub phenotype_id: i32, pub appearance_id: u16, pub appearance_head: u8, pub duplicating_head: u8, pub use_backup_head: u8, pub faction_id: u16, pub challenge_rating: f32, pub ai_state: u16, pub bodybag_id: u8, pub perception_id: u8, pub willpower_bonus: i16, pub fortitude_bonus: i16, pub reflex_bonus: i16, pub hp: i16, pub max_fp: i16, pub current_hp: i16, pub fp: i16, pub skill_points: u16, pub movement_rate: u8, pub walkrate_id: i32, pub on_heartbeat: ResRef, pub on_notice: ResRef, pub on_spell: ResRef, pub on_attacked: ResRef, pub on_damaged: ResRef, pub on_disturbed: ResRef, pub on_end_round: ResRef, pub on_dialog: ResRef, pub on_spawn: ResRef, pub on_rested: ResRef, pub on_death: ResRef, pub on_user_defined: ResRef, pub on_blocked: ResRef, pub on_end_dialog: ResRef, pub classes: Vec<UtcClass>, pub feats: Vec<u16>, pub skills: UtcSkills, pub equipment: Vec<UtcEquipmentItem>, pub inventory: Vec<UtcInventoryItem>, pub special_abilities: Vec<UtcSpecialAbility>, pub template_resref: ResRef, pub comment: String, pub palette_id: u8, pub save_will: u8, pub save_fortitude: u8, pub body_variation: u8, pub texture_variation: u8, pub morale: u8, pub morale_recovery: u8, pub morale_breakpoint: u8, pub blindspot: f32, pub multiplier_set: u8, pub no_perm_death: bool, pub ignore_cre_path: bool, pub hologram: bool, pub will_not_render: bool, pub lawfulness: u8,
}
Expand description

Typed UTC model built from/to Gff data.

Fields§

§max_hp: i16

Maximum hit points (MaxHitPoints).

§first_name: GffLocalizedString

Localized first name (FirstName).

§last_name: GffLocalizedString

Localized last name (LastName).

§description: GffLocalizedString

Deprecated localized description (Description).

§is_pc: bool

Player-character flag (IsPC).

§tag: String

Creature tag (Tag).

§conversation: ResRef

Conversation resref (Conversation).

§interruptable: bool

Interruptable flag (Interruptable).

§age: i32

Age (Age).

§gender_id: u8

Gender ID (Gender). Natively clamped by the engine to a maximum of 4.

§starting_package: u8

Starting package ID (StartingPackage).

§race_id: u8

Race ID (Race).

§subrace_name: String

Deprecated textual subrace (Subrace).

§subrace_id: u8

Subrace ID (SubraceIndex).

§deity: String

Deprecated deity field (Deity).

§strength: u8

Strength (Str).

§dexterity: u8

Dexterity (Dex).

§intelligence: u8

Intelligence (Int).

§wisdom: u8

Wisdom (Wis).

§constitution: u8

Constitution (Con).

§charisma: u8

Charisma (Cha).

§natural_ac: u8

Natural armor class (NaturalAC).

§soundset_id: u16

Sound-set ID (SoundSetFile).

§gold: u32

Gold carried (Gold).

§invulnerable: bool

Invulnerability flag (Invulnerable).

§plot: bool

Plot flag (Plot).

§min1_hp: bool

Min-1HP flag (Min1HP).

§party_interact: bool

Party-interact flag (PartyInteract).

§not_reorienting: bool

Non-reorienting flag (NotReorienting).

§disarmable: bool

Disarmable flag (Disarmable).

§experience: u32

Accumulated experience (Experience).

§portrait_id: u16

Portrait ID (PortraitId).

§portrait_resref: ResRef

Portrait resref override (Portrait).

§alignment: u8

Good/Evil alignment (GoodEvil). Natively clamped by the engine to a maximum of 100.

§color_skin: u8

Skin color index (Color_Skin).

§color_hair: u8

Hair color index (Color_Hair).

§color_tattoo1: u8

First tattoo color index (Color_Tattoo1).

§color_tattoo2: u8

Second tattoo color index (Color_Tattoo2).

§phenotype_id: i32

Deprecated phenotype (Phenotype).

§appearance_id: u16

Appearance ID (Appearance_Type).

§appearance_head: u8

Head appearance index (Appearance_Head). If 0, the engine forces this to 1 at runtime.

§duplicating_head: u8

Duplicating-head index (DuplicatingHead).

§use_backup_head: u8

Backup-head flag (UseBackupHead).

§faction_id: u16

Faction ID (FactionID).

§challenge_rating: f32

Challenge rating (ChallengeRating).

§ai_state: u16

AI state flags (AIState).

§bodybag_id: u8

Body-bag ID (BodyBag).

§perception_id: u8

Perception range ID (PerceptionRange).

§willpower_bonus: i16

Will save bonus (willbonus).

§fortitude_bonus: i16

Fortitude save bonus (fortbonus).

§reflex_bonus: i16

Reflex save bonus (refbonus).

§hp: i16

Base hit points (HitPoints).

§max_fp: i16

Maximum force points (ForcePoints).

§current_hp: i16

Current hit points (CurrentHitPoints).

§fp: i16

Current force points (CurrentForce).

§skill_points: u16

Unspent skill points (SkillPoints).

§movement_rate: u8

Movement rate ID (MovementRate).

§walkrate_id: i32

Walk-rate ID (WalkRate).

§on_heartbeat: ResRef

On-heartbeat script (ScriptHeartbeat).

§on_notice: ResRef

On-notice script (ScriptOnNotice).

§on_spell: ResRef

On-spell-at script (ScriptSpellAt).

§on_attacked: ResRef

On-attacked script (ScriptAttacked).

§on_damaged: ResRef

On-damaged script (ScriptDamaged).

§on_disturbed: ResRef

On-disturbed script (ScriptDisturbed).

§on_end_round: ResRef

On-end-round script (ScriptEndRound).

§on_dialog: ResRef

On-dialogue script (ScriptDialogue).

§on_spawn: ResRef

On-spawn script (ScriptSpawn).

§on_rested: ResRef

On-rested script (ScriptRested).

§on_death: ResRef

On-death script (ScriptDeath).

§on_user_defined: ResRef

On-user-defined script (ScriptUserDefine).

§on_blocked: ResRef

On-blocked script (ScriptOnBlocked).

§on_end_dialog: ResRef

On-end-dialog script (ScriptEndDialogu).

§classes: Vec<UtcClass>

Class entries from ClassList.

A creature object carries two class slots, so a longer list has nowhere to put the rest. What the loader does with a third valid entry is not traced; see docs/src/formats/gff/utc.md. A duplicate or out-of-range class id is traced, and both crash the engine with 0x5f7.

§feats: Vec<u16>

Feat identifiers from FeatList (Feat).

§skills: UtcSkills

Skill ranks from SkillList.

§equipment: Vec<UtcEquipmentItem>

Equipped-item entries from Equip_ItemList.

§inventory: Vec<UtcInventoryItem>

Inventory entries from ItemList.

§special_abilities: Vec<UtcSpecialAbility>

Special abilities from SpecAbilityList.

§template_resref: ResRef

Creature template resref (TemplateResRef).

§comment: String

Toolset/comment field (Comment). Never read by the K1 engine.

§palette_id: u8

Palette ID (PaletteID). Never read by the K1 engine.

§save_will: u8

Will save (SaveWill). Strictly ignored by the KOTOR engine; reads willbonus instead.

§save_fortitude: u8

Fortitude save (SaveFortitude). Strictly ignored by the KOTOR engine; reads fortbonus instead.

§body_variation: u8

Body variation (BodyVariation). Never read by the K1 engine.

§texture_variation: u8

Texture variation (TextureVar). Never read by the K1 engine.

§morale: u8

Morale (Morale). Never read by the K1 engine.

§morale_recovery: u8

Morale recovery (MoraleRecovery). Never read by the K1 engine.

§morale_breakpoint: u8

Morale breakpoint (MoraleBreakpoint). Never read by the K1 engine.

§blindspot: f32

Blind-spot value (BlindSpot). Never read by the K1 engine.

§multiplier_set: u8

Multiplier-set ID (MultiplierSet). Never read by the K1 engine.

§no_perm_death: bool

Permanent-death disabled flag (NoPermDeath). Never read by the K1 engine.

§ignore_cre_path: bool

Ignore creature pathing (IgnoreCrePath). Never read by the K1 engine.

§hologram: bool

Hologram flag (Hologram). Never read by the K1 engine.

§will_not_render: bool

Will-not-render flag (WillNotRender). Never read by the K1 engine.

§lawfulness: u8

Deprecated lawfulness alignment (LawfulChaotic). Never read by the K1 engine.

Implementations§

Source§

impl Utc

Source

pub const SCHEMA: [Field; 109]

This view’s schema, one entry per declared field.

Source

pub const PARTS: &'static [&'static [Field]]

This type’s schema in parts, which is what a container holding it references.

Own fields first, then one part per flattened child in the order they are declared.

Source

pub fn read_declared(root: &GffStruct) -> Self

Reads every declared field off root.

Absent fields take the entry’s own answer, so a fallback is derived from the declaration rather than restated beside it.

A field declaring a hand-written read is left at that answer for the view to overwrite.

Source

pub fn write_declared(&self, root: &mut GffStruct)

Writes every declared field onto root, leaving out the ones their entry says the engine’s own writer leaves out.

A field declaring a hand-written write is not touched here.

Source§

impl Utc

Source

pub fn new() -> Self

Creates an empty UTC value.

Source

pub fn from_gff(gff: &Gff) -> Result<Self, UtcError>

Builds typed UTC data from a parsed GFF container.

§Errors

Returns UtcError::UnsupportedFileType for a container that is neither UTC nor the generic GFF form.

Source

pub fn to_gff(&self) -> Gff

Converts this typed UTC value into a GFF container.

Trait Implementations§

Source§

impl Clone for Utc

Source§

fn clone(&self) -> Utc

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Utc

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Utc

Source§

fn default() -> Self

What a file omitting every label loads to, which is what makes an authored file land in a known state rather than at zero.

Source§

impl FromGff for Utc

Source§

const MAGIC: [u8; 4]

The four bytes a container of this format carries. Read more
Source§

type Error = UtcError

What reading this view out of a tree can fail with.
Source§

fn from_gff(gff: &Gff) -> Result<Self, Self::Error>

Reads the view. Anything the view does not model stays in gff. Read more
Source§

impl HasSchema for Utc

Source§

fn schema() -> &'static [Field]

The root field schema for this resource type.
Source§

fn parts() -> &'static [&'static [Field]]

The same schema in parts, own fields first. Read more
Source§

impl PartialEq for Utc

Source§

fn eq(&self, other: &Utc) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Utc

Auto Trait Implementations§

§

impl Freeze for Utc

§

impl RefUnwindSafe for Utc

§

impl Send for Utc

§

impl Sync for Utc

§

impl Unpin for Utc

§

impl UnsafeUnpin for Utc

§

impl UnwindSafe for Utc

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.