Skip to main content

UtcSnapshot

Struct UtcSnapshot 

Source
pub struct UtcSnapshot<'a> { /* private fields */ }
Expand description

Snapshot view over a Utc, resolved against a per-scope context.

Built by UtcProjection::snapshot (or Utc::snapshot as a single-scope shortcut). Carries the source Utc plus cached scalar-id resolutions (race, appearance, portrait, soundset) and the typed-variant projection of ClassList.

All query methods take &self and read from the cached snapshot. The snapshot does not retain the TwoDaCache borrow once constructed; to query under a different scope, build a fresh snapshot from the same projection.

Implementations§

Source§

impl<'a> UtcSnapshot<'a>

Source

pub fn as_utc(&self) -> &'a Utc

Returns a reference to the source UTC.

Source

pub fn race_label(&self) -> Option<&str>

Returns the label cell from racialtypes.2da at the UTC’s race_id row.

Returns None when racialtypes.2da is unavailable, the race_id does not resolve to a row, or the cell is missing.

Source

pub fn appearance_label(&self) -> Option<&str>

Returns the label cell from appearance.2da at the UTC’s appearance_id row.

Returns None when appearance.2da is unavailable, the appearance_id does not resolve to a row, or the cell is missing.

Source

pub fn portrait_label(&self) -> Option<&str>

Returns the label cell from portraits.2da at the UTC’s portrait_id row.

Returns None when portraits.2da is unavailable, the portrait_id does not resolve to a row, or the cell is missing.

Source

pub fn soundset_label(&self) -> Option<&str>

Returns the label cell from soundset.2da at the UTC’s soundset_id row.

Returns None when soundset.2da is unavailable, the soundset_id does not resolve to a row, or the cell is missing.

Source

pub fn alignment(&self) -> u8

Returns the UTC’s alignment (good / evil axis), clamped to the engine’s hard maximum of 100.

The engine’s UTC loader applies the same clamp on read (see CSWSCreatureStats::ReadStatsFromGff in the UTC engine audit), so any UTC carrying a raw value above 100 will display as 100 at runtime regardless of what the GFF says.

Source

pub fn classes(&self) -> &[DecodedClass]

Returns the typed-variant decoded class entries as a borrowed slice.

The order matches the source Utc::classes ordering; callers iterate or filter the slice. Multi-class characters surface as multiple entries in source order; the engine load path caps at two distinct class types per UTC, but this slice faithfully reflects whatever the GFF carries.

Source

pub fn total_level(&self) -> i32

Sums the class_level across every decoded class entry, regardless of typed variant or DecodedClass::Unknown status. Returns the character’s effective total level.

Computed in i32 so accumulation of multiple class entries cannot overflow the i16 per-entry level type.

Source

pub fn has_class(&self, filter: ClassKindFilter) -> bool

Returns true when any decoded class entry matches the given ClassKindFilter.

Unknown class entries never match a typed-variant filter; callers wanting to inspect unknown class kinds walk Self::classes directly.

Source

pub fn is_force_user(&self) -> bool

Returns true when the character carries any Jedi class entry (JediGuardian, JediConsular, or JediSentinel). Convenience wrapper over has_class(ClassKindFilter::AnyJedi).

Source

pub fn is_droid(&self) -> bool

Returns true when the character carries any droid class entry (CombatDroid or ExpertDroid). Convenience wrapper over has_class(ClassKindFilter::AnyDroid).

Source

pub fn feats(&self) -> &[DecodedFeat]

Returns the typed-variant decoded feat entries as a borrowed slice.

The order matches the source Utc::feats ordering. The engine load path appends every entry without deduplication, so a UTC carrying duplicate feat_ids surfaces as N separate slots. Each entry carries the raw feat_id regardless of dispatch outcome; callers wanting the resolved label for an Unknown walk the slice directly.

Source

pub fn has_feat(&self, filter: FeatKindFilter) -> bool

Returns true when any decoded feat entry matches the given FeatKindFilter.

Unknown feat entries never match a typed-variant filter; callers wanting to inspect unknown feat labels walk Self::feats directly.

Source

pub fn special_abilities(&self) -> &[DecodedSpecialAbility]

Returns the typed-variant decoded special-ability entries as a borrowed slice.

The order matches the source Utc::special_abilities ordering. The engine load path appends every entry without deduplication (see the “Vanilla Data Anomalies” subsection of the UTC engine audit), so a UTC carrying duplicate entries of the same spell_id (e.g. the Bastila variants’ 99 stacked BodyFuel entries) surfaces as N separate slots in this slice.

Source

pub fn equipment(&self) -> &[UtcEquipmentItem]

Returns the source UTC’s Equip_ItemList as a borrowed slice, exposing slot id + UTI resref + drop flag per entry.

Resolution of each resref to a UtiSnapshot is a cross-resource walk (it requires a Resolver to fetch the referenced UTI’s bytes) and lives in the cross-resource lint scope rather than in the UTC decoded view. This accessor exists so consumers can route equipment access through the snapshot for API consistency with the rest of the query surface; the data itself is the raw UtcEquipmentItem slice from the source UTC.

Source

pub fn inventory(&self) -> &[UtcInventoryItem]

Returns the source UTC’s ItemList as a borrowed slice, exposing entry id + UTI resref + drop flag + grid position per entry.

Same cross-resource caveat as Self::equipment: resolving each resref to a UtiSnapshot requires a Resolver and lives in cross-resource lint scope.

Trait Implementations§

Source§

impl<'a> Debug for UtcSnapshot<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for UtcSnapshot<'a>

§

impl<'a> RefUnwindSafe for UtcSnapshot<'a>

§

impl<'a> Send for UtcSnapshot<'a>

§

impl<'a> Sync for UtcSnapshot<'a>

§

impl<'a> Unpin for UtcSnapshot<'a>

§

impl<'a> UnsafeUnpin for UtcSnapshot<'a>

§

impl<'a> UnwindSafe for UtcSnapshot<'a>

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> 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> StrictAs for T

Source§

fn strict_as<Dst>(self) -> Dst
where T: StrictCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> StrictCastFrom<Src> for Dst
where Src: StrictCast<Dst>,

Source§

fn strict_cast_from(src: Src) -> Dst

Casts the value.
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.