CommonLibSSE NG
Loading...
Searching...
No Matches
ScriptEventSourceHolder.h
Go to the documentation of this file.
1#pragma once
2
3#include "RE/B/BSTEvent.h"
5
6namespace RE
7{
8 class TESObjectREFR;
9 struct BGSEventProcessedEvent;
10 struct TESActivateEvent;
11 struct TESActiveEffectApplyRemoveEvent;
12 struct TESActorLocationChangeEvent;
13 struct TESBookReadEvent;
14 struct TESCellAttachDetachEvent;
15 struct TESCellFullyLoadedEvent;
16 struct TESCellReadyToApplyDecalsEvent;
17 struct TESCombatEvent;
18 struct TESContainerChangedEvent;
19 struct TESDeathEvent;
20 struct TESDestructionStageChangedEvent;
21 struct TESEnterBleedoutEvent;
22 struct TESEquipEvent;
23 struct TESFastTravelEndEvent;
24 struct TESFormDeleteEvent;
25 struct TESFurnitureEvent;
26 struct TESGrabReleaseEvent;
27 struct TESHitEvent;
28 struct TESInitScriptEvent;
29 struct TESLoadGameEvent;
30 struct TESLockChangedEvent;
31 struct TESMagicEffectApplyEvent;
32 struct TESMagicWardHitEvent;
33 struct TESMoveAttachDetachEvent;
34 struct TESObjectLoadedEvent;
35 struct TESObjectREFRTranslationEvent;
36 struct TESOpenCloseEvent;
37 struct TESPackageEvent;
38 struct TESPerkEntryRunEvent;
39 struct TESPlayerBowShotEvent;
40 struct TESQuestInitEvent;
41 struct TESQuestStageEvent;
42 struct TESQuestStageItemDoneEvent;
43 struct TESQuestStartStopEvent;
44 struct TESResetEvent;
45 struct TESResolveNPCTemplatesEvent;
46 struct TESSceneActionEvent;
47 struct TESSceneEvent;
48 struct TESScenePhaseEvent;
49 struct TESSellEvent;
50 struct TESSleepStartEvent;
51 struct TESSleepStopEvent;
52 struct TESSpellCastEvent;
53 struct TESSwitchRaceCompleteEvent;
54 struct TESTopicInfoEvent;
55 struct TESTrackedStatsEvent;
56 struct TESTrapHitEvent;
57 struct TESTriggerEnterEvent;
58 struct TESTriggerEvent;
59 struct TESTriggerLeaveEvent;
60 struct TESUniqueIDChangeEvent;
61 struct TESWaitStartEvent;
62 struct TESWaitStopEvent;
63
65 public BSTEventSource<BGSEventProcessedEvent>, // 0000
66 public BSTEventSource<TESActivateEvent>, // 0058
67 public BSTEventSource<TESActiveEffectApplyRemoveEvent>, // 00B0
68 public BSTEventSource<TESActorLocationChangeEvent>, // 0108
69 public BSTEventSource<TESBookReadEvent>, // 0160
70 public BSTEventSource<TESCellAttachDetachEvent>, // 01B8
71 public BSTEventSource<TESCellFullyLoadedEvent>, // 0210
72 public BSTEventSource<TESCellReadyToApplyDecalsEvent>, // 0268
73 public BSTEventSource<TESCombatEvent>, // 02C0
74 public BSTEventSource<TESContainerChangedEvent>, // 0318
75 public BSTEventSource<TESDeathEvent>, // 0370
76 public BSTEventSource<TESDestructionStageChangedEvent>, // 03C8
77 public BSTEventSource<TESEnterBleedoutEvent>, // 0420
78 public BSTEventSource<TESEquipEvent>, // 0478
79 public BSTEventSource<TESFormDeleteEvent>, // 04D0
80 public BSTEventSource<TESFurnitureEvent>, // 0528
81 public BSTEventSource<TESGrabReleaseEvent>, // 0580
82 public BSTEventSource<TESHitEvent>, // 05D8
83 public BSTEventSource<TESInitScriptEvent>, // 0630
84 public BSTEventSource<TESLoadGameEvent>, // 0688
85 public BSTEventSource<TESLockChangedEvent>, // 06E0
86 public BSTEventSource<TESMagicEffectApplyEvent>, // 0738
87 public BSTEventSource<TESMagicWardHitEvent>, // 0790
88 public BSTEventSource<TESMoveAttachDetachEvent>, // 07E8
89 public BSTEventSource<TESObjectLoadedEvent>, // 0840
90 public BSTEventSource<TESObjectREFRTranslationEvent>, // 0898
91 public BSTEventSource<TESOpenCloseEvent>, // 08F0
92 public BSTEventSource<TESPackageEvent>, // 0948
93 public BSTEventSource<TESPerkEntryRunEvent>, // 09A0
94 public BSTEventSource<TESQuestInitEvent>, // 09F8
95 public BSTEventSource<TESQuestStageEvent>, // 0A50
96 public BSTEventSource<TESQuestStageItemDoneEvent>, // 0AA8
97 public BSTEventSource<TESQuestStartStopEvent>, // 0B00
98 public BSTEventSource<TESResetEvent>, // 0B58
99 public BSTEventSource<TESResolveNPCTemplatesEvent>, // 0BB0
100 public BSTEventSource<TESSceneEvent>, // 0C08
101 public BSTEventSource<TESSceneActionEvent>, // 0C60
102 public BSTEventSource<TESScenePhaseEvent>, // 0CB8
103 public BSTEventSource<TESSellEvent>, // 0D10
104 public BSTEventSource<TESSleepStartEvent>, // 0D68
105 public BSTEventSource<TESSleepStopEvent>, // 0DC0
106 public BSTEventSource<TESSpellCastEvent>, // 0E18
107 public BSTEventSource<TESPlayerBowShotEvent>, // 0E70
108 public BSTEventSource<TESTopicInfoEvent>, // 0EC8
109 public BSTEventSource<TESTrackedStatsEvent>, // 0F20
110 public BSTEventSource<TESTrapHitEvent>, // 0F78
111 public BSTEventSource<TESTriggerEvent>, // 0FD0
112 public BSTEventSource<TESTriggerEnterEvent>, // 1028
113 public BSTEventSource<TESTriggerLeaveEvent>, // 1080
114 public BSTEventSource<TESUniqueIDChangeEvent>, // 10D8
115 public BSTEventSource<TESWaitStartEvent>, // 1130 - ?
116 public BSTEventSource<TESWaitStopEvent>, // 1188 - ?
117#ifndef ENABLE_SKYRIM_VR
118 public BSTEventSource<TESSwitchRaceCompleteEvent>, // 11E0
119 public BSTEventSource<TESFastTravelEndEvent> // 1238
120#else
121 public BSTEventSource<TESSwitchRaceCompleteEvent> // 11E0
122#endif
123 {
124 public:
126
127 void SendActivateEvent(const NiPointer<TESObjectREFR>& a_objectActivated, const NiPointer<TESObjectREFR>& a_actionRef);
128 void SendOpenCloseEvent(const NiPointer<TESObjectREFR>& a_ref, const NiPointer<TESObjectREFR>& a_activeRef, bool a_isOpened);
129 void SendSpellCastEvent(const NiPointer<TESObjectREFR>& a_object, FormID a_formID);
130
131 template <class T>
133 {
134 return static_cast<BSTEventSource<T>*>(this);
135 }
136
137 template <>
139 {
141 }
142
144 {
146 return nullptr;
147 } else {
148 return &REL::RelocateMember<BSTEventSource<TESFastTravelEndEvent>>(this, 0x1238, 0);
149 }
150 }
151
152 template <class T>
153 inline void AddEventSink(BSTEventSink<T>* a_sink)
154 {
155 GetEventSource<T>()->AddEventSink(a_sink);
156 }
157
158 template <class T>
159 inline void RemoveEventSink(BSTEventSink<T>* a_sink)
160 {
161 GetEventSource<T>()->RemoveEventSink(a_sink);
162 }
163
164 template <class T>
165 inline void SendEvent(const T* a_event)
166 {
167 GetEventSource<T>()->SendEvent(a_event);
168 }
169 };
170#ifndef ENABLE_SKYRIM_VR
171 static_assert(sizeof(ScriptEventSourceHolder) == 0x1290);
172#elif !defined(ENABLE_SKYRIM_AE) && !defined(ENABLE_SKYRIM_SE)
173 static_assert(sizeof(ScriptEventSourceHolder) == 0x1238);
174#endif
175}
#define SKYRIM_REL_CONSTEXPR
Definition Relocation.h:105
Definition BSTEvent.h:143
Definition BSTEvent.h:19
Definition NiSmartPointer.h:9
Definition ScriptEventSourceHolder.h:123
BSTEventSource< TESFastTravelEndEvent > * AsTESFastTravelEndEventSource() noexcept
Definition ScriptEventSourceHolder.h:143
BSTEventSource< TESFastTravelEndEvent > * GetEventSource() noexcept
Definition ScriptEventSourceHolder.h:138
void SendEvent(const T *a_event)
Definition ScriptEventSourceHolder.h:165
BSTEventSource< T > * GetEventSource() noexcept
Definition ScriptEventSourceHolder.h:132
void SendOpenCloseEvent(const NiPointer< TESObjectREFR > &a_ref, const NiPointer< TESObjectREFR > &a_activeRef, bool a_isOpened)
void SendSpellCastEvent(const NiPointer< TESObjectREFR > &a_object, FormID a_formID)
static ScriptEventSourceHolder * GetSingleton()
void SendActivateEvent(const NiPointer< TESObjectREFR > &a_objectActivated, const NiPointer< TESObjectREFR > &a_actionRef)
void AddEventSink(BSTEventSink< T > *a_sink)
Definition ScriptEventSourceHolder.h:153
void RemoveEventSink(BSTEventSink< T > *a_sink)
Definition ScriptEventSourceHolder.h:159
static SKYRIM_REL_VR bool IsVR() noexcept
Definition Relocation.h:821
Definition AbsorbEffect.h:6
std::uint32_t FormID
Definition BSCoreTypes.h:5