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>
impl<'a> UtcSnapshot<'a>
Sourcepub fn race_label(&self) -> Option<&str>
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.
Sourcepub fn appearance_label(&self) -> Option<&str>
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.
Sourcepub fn portrait_label(&self) -> Option<&str>
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.
Sourcepub fn soundset_label(&self) -> Option<&str>
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.
Sourcepub fn alignment(&self) -> u8
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.
Sourcepub fn classes(&self) -> &[DecodedClass]
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.
Sourcepub fn total_level(&self) -> i32
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.
Sourcepub fn has_class(&self, filter: ClassKindFilter) -> bool
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.
Sourcepub fn is_force_user(&self) -> bool
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).
Sourcepub fn is_droid(&self) -> bool
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).
Sourcepub fn feats(&self) -> &[DecodedFeat]
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.
Sourcepub fn has_feat(&self, filter: FeatKindFilter) -> bool
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.
Sourcepub fn special_abilities(&self) -> &[DecodedSpecialAbility]
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.
Sourcepub fn equipment(&self) -> &[UtcEquipmentItem]
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.
Sourcepub fn inventory(&self) -> &[UtcInventoryItem]
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.