commonlibsse_ng\re\s/
SpellItem.rs

1use crate::re::BGSEquipType::{BGSEquipType, BGSEquipTypeVtbl};
2use crate::re::BGSMenuDisplayObject::{BGSMenuDisplayObject, BGSMenuDisplayObjectVtbl};
3use crate::re::BGSPerk::BGSPerk;
4use crate::re::FormTypes::FormType;
5use crate::re::MagicItem::{MagicItem, MagicItemVtbl};
6use crate::re::MagicSystem;
7use crate::re::TESDescription::{TESDescription, TESDescriptionVtbl};
8use crate::re::offsets_rtti::RTTI_SpellItem;
9use crate::re::offsets_vtable::VTABLE_SpellItem;
10use crate::rel::id::VariantID;
11
12#[repr(C)]
13#[derive(Debug)]
14pub struct SpellItem {
15    pub __base: MagicItem,             // 0x00
16    pub __base1: BGSEquipType,         // 0x90
17    pub __base2: BGSMenuDisplayObject, // 0xA0
18    pub __base3: TESDescription,       // 0xB0
19    pub data: Data,                    // 0xC0
20}
21const _: () = assert!(core::mem::size_of::<SpellItem>() == 0xE8);
22
23impl SpellItem {
24    /// Address & offset of the runtime type information (RTTI) identifier.
25    pub const RTTI: VariantID = RTTI_SpellItem;
26
27    /// Address & offset of the virtual function table.
28    ///
29    /// The number of tables is the same as the number of classes with inherited virtual functions.
30    pub const VTABLE: [VariantID; 6] = VTABLE_SpellItem;
31
32    /// The `FormType` value for SpellItem.
33    pub const FORM_TYPE: FormType = FormType::Spell;
34}
35
36#[repr(C)]
37pub struct SpellItemVtbl {
38    pub __base: MagicItemVtbl,
39    pub __base1: BGSEquipTypeVtbl,
40    pub __base2: BGSMenuDisplayObjectVtbl,
41    pub __base3: TESDescriptionVtbl,
42}
43
44#[derive(Debug, Clone, PartialEq)]
45pub struct Data {
46    costOverride: i32,                     // 0x00
47    flags: SpellFlag,                      // 0x04
48    spellType: MagicSystem::SpellType,     // 0x08
49    chargeTime: f32,                       // 0x0C
50    castingType: MagicSystem::CastingType, // 0x10
51    delivery: MagicSystem::Delivery,       // 0x14
52    castDuration: f32,                     // 0x18
53    range: f32,                            // 0x1C
54    castingPerk: *mut BGSPerk,             // 0x20
55}
56const _: () = assert!(core::mem::size_of::<Data>() == 0x28);
57
58#[commonlibsse_ng_derive_internal::to_bitflags]
59#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
60#[repr(u32)]
61pub enum SpellFlag {
62    None = 0,
63    CostOverride = 1 << 0,
64    FoodItem = 1 << 1,
65    ExtendDuration = 1 << 3,
66    PCStartSpell = 1 << 17,
67    InstantCast = 1 << 18,
68    IgnoreLOSCheck = 1 << 19,
69    IgnoreResistance = 1 << 20,
70    NoAbsorb = 1 << 21,
71    NoDualCastMods = 1 << 23,
72}
73
74#[commonlibsse_ng_derive_internal::to_bitflags]
75#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
76#[repr(u32)]
77pub enum RecordFlag {
78    Deleted = 1 << 5,
79    Ignored = 1 << 12,
80}