CommonLibSSE (Parapets fork)
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/BSSimpleList.h"
6 #include "RE/B/BSTHashMap.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 FORMTYPE = FormType::Faction;
124 
125  struct ChangeFlags
126  {
127  enum ChangeFlag : std::uint32_t
128  {
129  kFactionFlags = 1 << 1,
131  kFactionCrimeCounts = (std::uint32_t)1 << 31
132  };
133  };
134 
135  struct RecordFlags
136  {
137  enum RecordFlag : std::uint32_t
138  {
139  kDeleted = 1 << 5,
140  kIgnored = 1 << 12
141  };
142  };
143 
144  ~TESFaction() override; // 00
145 
146  // override (TESForm)
147  void InitializeData() override; // 04
148  void ClearData() override; // 05
149  bool Load(TESFile* a_mod) override; // 06
150  void SaveGame(BGSSaveFormBuffer* a_buf) override; // 0E
151  void LoadGame(BGSLoadFormBuffer* a_buf) override; // 0F
152  void Revert(BGSLoadFormBuffer* a_buf) override; // 12
153  void InitItemImpl() override; // 13
154 
155  [[nodiscard]] bool CanBeOwner() const;
156  [[nodiscard]] bool CanPayCrimeGold() const;
157  [[nodiscard]] std::int32_t GetCrimeGold() const;
158  [[nodiscard]] std::int32_t GetCrimeGoldNonViolent() const;
159  [[nodiscard]] std::int32_t GetCrimeGoldViolent() const;
160  [[nodiscard]] std::int32_t GetInfamy() const;
161  [[nodiscard]] std::int32_t GetInfamyNonViolent() const;
162  [[nodiscard]] std::int32_t GetInfamyViolent() const;
163  [[nodiscard]] std::int32_t GetStolenItemValueCrime() const;
164  [[nodiscard]] std::int32_t GetStolenItemValueNoCrime() const;
165  [[nodiscard]] bool HasSpecialCombatState() const;
166  [[nodiscard]] bool HasStealMultiplier() const;
167  [[nodiscard]] bool HiddenFromNPC() const;
168  [[nodiscard]] bool IgnoresAssault() const;
169  [[nodiscard]] bool IgnoresMurder() const;
170  [[nodiscard]] bool IgnoresPickpocket() const;
171  [[nodiscard]] bool IgnoresStealing() const;
172  [[nodiscard]] bool IgnoresTrespass() const;
173  [[nodiscard]] bool IgnoresWerewolf() const;
174  bool IsFactionInCrimeGroup(const TESFaction* a_other) const;
175  [[nodiscard]] bool IsPlayerEnemy() const;
176  [[nodiscard]] bool IsPlayerExpelled() const;
177  [[nodiscard]] bool IsVendor() const;
178  void ModCrimeGold(std::int32_t a_amount, bool a_violent);
179  void PlayerPayCrimeGold(bool a_removeStolenItems = true, bool a_goToJail = true);
180  [[nodiscard]] bool ReportsCrimesAgainstMembers() const;
181  void SendPlayerToJail(bool a_removeInventory = true, bool a_realJail = true);
182  void SetAlly(TESFaction* a_other, bool a_selfIsFriendToOther = false, bool a_otherIsFriendToSelf = false);
183  void SetCrimeGold(std::int32_t a_gold);
184  void SetCrimeGoldViolent(std::int32_t a_gold);
185  void SetEnemy(TESFaction* a_other, bool a_selfIsNeutralToOther = false, bool a_otherIsNeutralToSelf = false);
186  void SetFactionFightReaction(TESFaction* a_faction, FIGHT_REACTION a_fightReaction);
187  [[nodiscard]] bool TracksCrimes() const;
188  [[nodiscard]] bool UsesCrimeGoldDefaults() const;
189 
190  // members
192  FACTION_DATA data; // 058 - DATA
193  std::uint32_t pad05C; // 05C
197  std::int32_t majorCrime; // 0F0
198  std::int32_t minorCrime; // 0F4
200  float pcEnemyFlagTimeStamp; // 0FC - current game time in hours
201  };
202  static_assert(sizeof(TESFaction) == 0x100);
203 }
Definition: BGSListForm.h:10
Definition: BGSOutfit.h:10
Definition: BSSimpleList.h:10
Definition: BSTHashMap.h:21
Definition: PackageLocation.h:11
Definition: TESCondition.h:989
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
BSTHashMap< const TESNPC *, std::uint32_t > * crimeGoldMap
Definition: TESFaction.h:191
void PlayerPayCrimeGold(bool a_removeStolenItems=true, bool a_goToJail=true)
void InitItemImpl() override
std::int32_t minorCrime
Definition: TESFaction.h:198
void InitializeData() override
BSSimpleList< RANK_DATA * > rankData
Definition: TESFaction.h:196
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
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:199
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:194
void SaveGame(BGSSaveFormBuffer *a_buf) override
FACTION_VENDOR_DATA vendorData
Definition: TESFaction.h:195
static constexpr auto FORMTYPE
Definition: TESFaction.h:123
bool CanBeOwner() const
std::int32_t majorCrime
Definition: TESFaction.h:197
bool IgnoresTrespass() const
void Revert(BGSLoadFormBuffer *a_buf) override
std::uint32_t pad05C
Definition: TESFaction.h:193
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:192
float pcEnemyFlagTimeStamp
Definition: TESFaction.h:200
std::int32_t GetCrimeGold() const
Definition: TESFile.h:14
Definition: TESForm.h:34
Definition: TESFullName.h:9
Definition: TESObjectREFR.h:105
Definition: TESReactionForm.h:19
Definition: TESTexture.h:10
Definition: AbsorbEffect.h:6
constexpr REL::ID RTTI_TESFaction
Definition: Offsets_RTTI.h:5992
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:126
ChangeFlag
Definition: TESFaction.h:128
@ kFactionFlags
Definition: TESFaction.h:129
@ kFactionReactions
Definition: TESFaction.h:130
@ kFactionCrimeCounts
Definition: TESFaction.h:131
Definition: TESFaction.h:136
RecordFlag
Definition: TESFaction.h:138
@ kIgnored
Definition: TESFaction.h:140
@ kDeleted
Definition: TESFaction.h:139