CommonLibVR
TESFaction.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/A/AITimeStamp.h"
4 #include "RE/B/BSFixedString.h"
5 #include "RE/B/BSTHashMap.h"
6 #include "RE/B/BSTList.h"
7 #include "RE/F/FightReactions.h"
8 #include "RE/F/FormTypes.h"
9 #include "RE/T/TESForm.h"
10 #include "RE/T/TESFullName.h"
11 #include "RE/T/TESReactionForm.h"
12 #include "RE/T/TESTexture.h"
13 
14 namespace RE
15 {
16  class TESCondition;
17  class PackageLocation;
18 
19  struct FACTION_DATA
20  {
21  enum Flag : std::uint32_t
22  {
23  kNone = 0,
24  kHiddenFromNPC = 1 << 0,
25  kSpecialCombat = 1 << 1,
27  kPlayerIsEnemy = 1 << 3,
28  kTrackCrime = 1 << 6,
36  kVendor = 1 << 14,
37  kCanBeOwner = 1 << 15,
38  kIgnoresCrimes_Werewolf = 1 << 16
39  };
40 
41  Flag flags; // 0
42  };
43  static_assert(sizeof(FACTION_DATA) == 0x4);
44 
46  {
47  public:
48  // members
49  bool arrest; // 00
50  bool attackOnSight; // 01
51  std::uint16_t murderCrimeGold; // 02
52  std::uint16_t assaultCrimeGold; // 04
53  std::uint16_t trespassCrimeGold; // 06
54  std::uint16_t pickpocketCrimeGold; // 08
55  std::uint16_t pad0A; // 0A
56  float stealCrimeGoldMult; // 0C
57  std::uint16_t escapeCrimeGold; // 10
58  std::uint16_t werewolfCrimeGold; // 12
59  };
60  static_assert(sizeof(FACTION_CRIME_DATA_VALUES) == 0x14);
61 
63  {
64  public:
65  // members
70  BGSListForm* crimeGroup; // 20 - CRGR
71  BGSOutfit* jailOutfit; // 28 - JOUT
73  std::uint32_t pad44; // 44
74  };
75  static_assert(sizeof(FACTION_CRIME_DATA) == 0x48);
76 
78  {
79  public:
80  // members
81  std::uint16_t startHour; // 0
82  std::uint16_t endHour; // 2
83  std::uint32_t locationRadius; // 4
84  bool buysStolen; // 8
85  bool notBuySell; // 9
86  bool buysNonStolen; // A
87  std::uint8_t padB; // B
88  };
89  static_assert(sizeof(FACTION_VENDOR_DATA_VALUES) == 0xC);
90 
91  struct FACTION_VENDOR_DATA // VENV
92  {
93  public:
94  // members
96  std::uint32_t pad0C; // 0C
101  std::uint32_t lastDayReset; // 30
102  std::uint32_t pad34; // 34
103  };
104  static_assert(sizeof(FACTION_VENDOR_DATA) == 0x38);
105 
106  struct RANK_DATA
107  {
108  public:
109  // members
112  TESTexture textureInsignia; // 10 - INAM - unused
113  };
114  static_assert(sizeof(RANK_DATA) == 0x20);
115 
116  class TESFaction :
117  public TESForm, // 000
118  public TESFullName, // 020
119  public TESReactionForm // 030
120  {
121  public:
122  inline static constexpr auto RTTI = RTTI_TESFaction;
123  inline static constexpr auto VTABLE = VTABLE_TESFaction;
124  inline static constexpr auto FORMTYPE = FormType::Faction;
125 
126  struct ChangeFlags
127  {
128  enum ChangeFlag : std::uint32_t
129  {
130  kFactionFlags = 1 << 1,
132  kFactionCrimeCounts = (std::uint32_t)1 << 31
133  };
134  };
135 
136  struct RecordFlags
137  {
138  enum RecordFlag : std::uint32_t
139  {
140  kDeleted = 1 << 5,
141  kIgnored = 1 << 12
142  };
143  };
144 
145  ~TESFaction() override; // 00
146 
147  // override (TESForm)
148  void InitializeData() override; // 04
149  void ClearData() override; // 05
150  bool Load(TESFile* a_mod) override; // 06
151  void SaveGame(BGSSaveFormBuffer* a_buf) override; // 0E
152  void LoadGame(BGSLoadFormBuffer* a_buf) override; // 0F
153  void Revert(BGSLoadFormBuffer* a_buf) override; // 12
154  void InitItemImpl() override; // 13
155 
156  [[nodiscard]] bool CanBeOwner() const;
157  [[nodiscard]] bool CanPayCrimeGold() const;
158  [[nodiscard]] std::int32_t GetCrimeGold() const;
159  [[nodiscard]] std::int32_t GetCrimeGoldNonViolent() const;
160  [[nodiscard]] std::int32_t GetCrimeGoldViolent() const;
161  [[nodiscard]] std::int32_t GetInfamy() const;
162  [[nodiscard]] std::int32_t GetInfamyNonViolent() const;
163  [[nodiscard]] std::int32_t GetInfamyViolent() const;
164  [[nodiscard]] std::int32_t GetStolenItemValueCrime() const;
165  [[nodiscard]] std::int32_t GetStolenItemValueNoCrime() const;
166  [[nodiscard]] bool HasSpecialCombatState() const;
167  [[nodiscard]] bool HasStealMultiplier() const;
168  [[nodiscard]] bool HiddenFromNPC() const;
169  [[nodiscard]] bool IgnoresAssault() const;
170  [[nodiscard]] bool IgnoresMurder() const;
171  [[nodiscard]] bool IgnoresPickpocket() const;
172  [[nodiscard]] bool IgnoresStealing() const;
173  [[nodiscard]] bool IgnoresTrespass() const;
174  [[nodiscard]] bool IgnoresWerewolf() const;
175  bool IsFactionInCrimeGroup(const TESFaction* a_other) const;
176  [[nodiscard]] bool IsPlayerEnemy() const;
177  [[nodiscard]] bool IsPlayerExpelled() const;
178  [[nodiscard]] bool IsVendor() const;
179  void ModCrimeGold(std::int32_t a_amount, bool a_violent);
180  bool OffersServices() const;
181  void PlayerPayCrimeGold(bool a_removeStolenItems = true, bool a_goToJail = true);
182  [[nodiscard]] bool ReportsCrimesAgainstMembers() const;
183  void SendPlayerToJail(bool a_removeInventory = true, bool a_realJail = true);
184  void SetAlly(TESFaction* a_other, bool a_selfIsFriendToOther = false, bool a_otherIsFriendToSelf = false);
185  void SetCrimeGold(std::int32_t a_gold);
186  void SetCrimeGoldViolent(std::int32_t a_gold);
187  void SetEnemy(TESFaction* a_other, bool a_selfIsNeutralToOther = false, bool a_otherIsNeutralToSelf = false);
188  void SetFactionFightReaction(TESFaction* a_faction, FIGHT_REACTION a_fightReaction);
189  [[nodiscard]] bool TracksCrimes() const;
190  [[nodiscard]] bool UsesCrimeGoldDefaults() const;
191 
192  // members
194  FACTION_DATA data; // 058 - DATA
195  std::uint32_t pad05C; // 05C
199  std::int32_t majorCrime; // 0F0
200  std::int32_t minorCrime; // 0F4
202  float pcEnemyFlagTimeStamp; // 0FC - current game time in hours
203  private:
204  KEEP_FOR_RE()
205  };
206  static_assert(sizeof(TESFaction) == 0x100);
207 }
#define KEEP_FOR_RE()
Definition: PCH.h:713
Definition: BGSListForm.h:11
Definition: BGSLoadFormBuffer.h:11
Definition: BGSOutfit.h:11
Definition: BGSSaveFormBuffer.h:8
Definition: BSTList.h:10
Definition: BSTHashMap.h:21
Definition: PackageLocation.h:11
Definition: TESCondition.h:992
Definition: TESFaction.h:120
void SetEnemy(TESFaction *a_other, bool a_selfIsNeutralToOther=false, bool a_otherIsNeutralToSelf=false)
bool IsFactionInCrimeGroup(const TESFaction *a_other) const
bool HiddenFromNPC() const
bool IsVendor() const
~TESFaction() override
std::int32_t GetInfamy() const
std::int32_t GetInfamyNonViolent() const
bool UsesCrimeGoldDefaults() const
std::int32_t GetStolenItemValueNoCrime() const
bool OffersServices() const
BSTHashMap< const TESNPC *, std::uint32_t > * crimeGoldMap
Definition: TESFaction.h:193
void PlayerPayCrimeGold(bool a_removeStolenItems=true, bool a_goToJail=true)
void InitItemImpl() override
std::int32_t minorCrime
Definition: TESFaction.h:200
void InitializeData() override
BSSimpleList< RANK_DATA * > rankData
Definition: TESFaction.h:198
static constexpr auto RTTI
Definition: TESFaction.h:122
std::int32_t GetStolenItemValueCrime() const
std::int32_t GetCrimeGoldNonViolent() const
bool IgnoresPickpocket() const
bool IgnoresWerewolf() const
void SetFactionFightReaction(TESFaction *a_faction, FIGHT_REACTION a_fightReaction)
void SendPlayerToJail(bool a_removeInventory=true, bool a_realJail=true)
void ClearData() override
bool IgnoresAssault() const
static constexpr auto VTABLE
Definition: TESFaction.h:123
bool ReportsCrimesAgainstMembers() const
void SetCrimeGoldViolent(std::int32_t a_gold)
void ModCrimeGold(std::int32_t a_amount, bool a_violent)
void SetCrimeGold(std::int32_t a_gold)
bool IgnoresMurder() const
bool TracksCrimes() const
bool IsPlayerEnemy() const
AITimeStamp resistArrestTimeStamp
Definition: TESFaction.h:201
bool IgnoresStealing() const
bool Load(TESFile *a_mod) override
std::int32_t GetInfamyViolent() const
std::int32_t GetCrimeGoldViolent() const
void LoadGame(BGSLoadFormBuffer *a_buf) override
bool IsPlayerExpelled() const
bool HasStealMultiplier() const
FACTION_CRIME_DATA crimeData
Definition: TESFaction.h:196
void SaveGame(BGSSaveFormBuffer *a_buf) override
FACTION_VENDOR_DATA vendorData
Definition: TESFaction.h:197
static constexpr auto FORMTYPE
Definition: TESFaction.h:124
bool CanBeOwner() const
std::int32_t majorCrime
Definition: TESFaction.h:199
bool IgnoresTrespass() const
void Revert(BGSLoadFormBuffer *a_buf) override
std::uint32_t pad05C
Definition: TESFaction.h:195
void SetAlly(TESFaction *a_other, bool a_selfIsFriendToOther=false, bool a_otherIsFriendToSelf=false)
bool HasSpecialCombatState() const
bool CanPayCrimeGold() const
FACTION_DATA data
Definition: TESFaction.h:194
float pcEnemyFlagTimeStamp
Definition: TESFaction.h:202
std::int32_t GetCrimeGold() const
Definition: TESFile.h:17
Definition: TESForm.h:40
Definition: TESFullName.h:9
Definition: TESObjectREFR.h:113
Definition: TESReactionForm.h:19
Definition: TESTexture.h:10
Definition: AbsorbEffect.h:6
constexpr REL::ID RTTI_TESFaction(static_cast< std::uint64_t >(513906))
constexpr std::array< REL::ID, 3 > VTABLE_TESFaction
Definition: Offsets_VTABLE.h:12824
FIGHT_REACTION
Definition: FightReactions.h:6
Definition: AITimeStamp.h:6
Definition: TESFaction.h:46
std::uint16_t assaultCrimeGold
Definition: TESFaction.h:52
std::uint16_t pad0A
Definition: TESFaction.h:55
std::uint16_t escapeCrimeGold
Definition: TESFaction.h:57
std::uint16_t murderCrimeGold
Definition: TESFaction.h:51
std::uint16_t trespassCrimeGold
Definition: TESFaction.h:53
std::uint16_t pickpocketCrimeGold
Definition: TESFaction.h:54
std::uint16_t werewolfCrimeGold
Definition: TESFaction.h:58
bool arrest
Definition: TESFaction.h:49
bool attackOnSight
Definition: TESFaction.h:50
float stealCrimeGoldMult
Definition: TESFaction.h:56
Definition: TESFaction.h:63
TESObjectREFR * factionWaitMarker
Definition: TESFaction.h:67
std::uint32_t pad44
Definition: TESFaction.h:73
FACTION_CRIME_DATA_VALUES crimevalues
Definition: TESFaction.h:72
BGSListForm * crimeGroup
Definition: TESFaction.h:70
BGSOutfit * jailOutfit
Definition: TESFaction.h:71
TESObjectREFR * factionStolenContainer
Definition: TESFaction.h:68
TESObjectREFR * factionPlayerInventoryContainer
Definition: TESFaction.h:69
TESObjectREFR * factionJailMarker
Definition: TESFaction.h:66
Definition: TESFaction.h:20
Flag flags
Definition: TESFaction.h:41
Flag
Definition: TESFaction.h:22
@ kIgnoresCrimes_Stealing
Definition: TESFaction.h:31
@ kPlayerIsExpelled
Definition: TESFaction.h:26
@ kTrackCrime
Definition: TESFaction.h:28
@ kCanBeOwner
Definition: TESFaction.h:37
@ kHiddenFromNPC
Definition: TESFaction.h:24
@ kSpecialCombat
Definition: TESFaction.h:25
@ kNone
Definition: TESFaction.h:23
@ kPlayerIsEnemy
Definition: TESFaction.h:27
@ kIgnoresCrimes_Werewolf
Definition: TESFaction.h:38
@ kDoNotReportCrimesAgainstMembers
Definition: TESFaction.h:33
@ kIngoresCrimes_Trespass
Definition: TESFaction.h:32
@ kCrimeGold_UseDefaults
Definition: TESFaction.h:34
@ kIgnoresCrimes_Murder
Definition: TESFaction.h:29
@ kVendor
Definition: TESFaction.h:36
@ kIgnoresCrimes_Assult
Definition: TESFaction.h:30
@ kIgnoresCrimes_Pickpocket
Definition: TESFaction.h:35
Definition: TESFaction.h:78
bool notBuySell
Definition: TESFaction.h:85
bool buysStolen
Definition: TESFaction.h:84
bool buysNonStolen
Definition: TESFaction.h:86
std::uint16_t endHour
Definition: TESFaction.h:82
std::uint32_t locationRadius
Definition: TESFaction.h:83
std::uint16_t startHour
Definition: TESFaction.h:81
std::uint8_t padB
Definition: TESFaction.h:87
Definition: TESFaction.h:92
TESObjectREFR * merchantContainer
Definition: TESFaction.h:100
std::uint32_t lastDayReset
Definition: TESFaction.h:101
FACTION_VENDOR_DATA_VALUES vendorValues
Definition: TESFaction.h:95
std::uint32_t pad34
Definition: TESFaction.h:102
TESCondition * vendorConditions
Definition: TESFaction.h:98
std::uint32_t pad0C
Definition: TESFaction.h:96
PackageLocation * vendorLocation
Definition: TESFaction.h:97
BGSListForm * vendorSellBuyList
Definition: TESFaction.h:99
Definition: TESFaction.h:107
TESTexture textureInsignia
Definition: TESFaction.h:112
BSFixedString femaleRankTitle
Definition: TESFaction.h:111
BSFixedString maleRankTitle
Definition: TESFaction.h:110
Definition: TESFaction.h:127
ChangeFlag
Definition: TESFaction.h:129
@ kFactionFlags
Definition: TESFaction.h:130
@ kFactionReactions
Definition: TESFaction.h:131
@ kFactionCrimeCounts
Definition: TESFaction.h:132
Definition: TESFaction.h:137
RecordFlag
Definition: TESFaction.h:139
@ kIgnored
Definition: TESFaction.h:141
@ kDeleted
Definition: TESFaction.h:140