CommonLibSSE NG
TrainingMenu.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/A/ActorValues.h"
4 #include "RE/B/BSTEvent.h"
5 #include "RE/G/GFxValue.h"
6 #include "RE/I/IMenu.h"
7 
8 namespace RE
9 {
10  class MenuOpenCloseEvent;
11 
12  // menuDepth = 3
13  // flags = kPausesGame | kUsesMenuContext | kUpdateUsesCursor
14  // kUsesCursor if gamepad disabled
15  // context = kNone
16  class TrainingMenu :
17 #ifndef SKYRIM_CROSS_VR
18  public IMenu, // 00
19  public BSTEventSink<MenuOpenCloseEvent> // 30
20 #else
21  public IMenu // 00
22 #endif
23  {
24  public:
25  inline static constexpr auto RTTI = RTTI_TrainingMenu;
26  constexpr static std::string_view MENU_NAME = "Training Menu";
27 
28  struct RUNTIME_DATA
29  {
30 #define RUNTIME_DATA_CONTENT \
31  Actor* trainer; /* 38 - smart ptr */ \
32  ActorValue skill; /* 40 */ \
33  std::uint32_t unk44; /* 44 */ \
34  GFxValue trainingMenuObj; /* 48 - MovieClip */ \
35  GFxValue skillName; /* 60 - TextField */ \
36  GFxValue skillMeter; /* 78 - Components.Meter */ \
37  GFxValue trainerSkill; /* 90 - TextField */ \
38  GFxValue timesTrained; /* A8 - TextField */ \
39  GFxValue trainCost; /* C0 - TextField */ \
40  GFxValue currentGold; /* D8 - TextField */
41 
43  };
44  static_assert(sizeof(RUNTIME_DATA) == 0xB8);
45 
46  ~TrainingMenu() override; // 00
47 
48  // override (IMenu)
49  void Accept(CallbackProcessor* a_cbReg) override; // 01
50  UI_MESSAGE_RESULTS ProcessMessage(UIMessage& a_message) override; // 04
51 
52 #ifndef SKYRIM_CROSS_VR
53  // override (BSTEventSink<MenuOpenCloseEvent>)
55 #endif
56 
58  {
59  return &REL::RelocateMember<BSTEventSink<MenuOpenCloseEvent>>(this, 0x30, 0x40);
60  }
61 
62  [[nodiscard]] const BSTEventSink<MenuOpenCloseEvent>* AsMenuOpenCloseEventSink() const noexcept
63  {
64  return const_cast<TrainingMenu*>(this)->AsMenuOpenCloseEventSink();
65  }
66 
67  [[nodiscard]] inline RUNTIME_DATA& GetRuntimeData() noexcept
68  {
69  return REL::RelocateMember<RUNTIME_DATA>(this, 0x38, 0x48);
70  }
71 
72  [[nodiscard]] inline const RUNTIME_DATA& GetRuntimeData() const noexcept
73  {
74  return REL::RelocateMember<RUNTIME_DATA>(this, 0x38, 0x48);
75  }
76 
77  // members
78 #ifndef SKYRIM_CROSS_VR
79  RUNTIME_DATA_CONTENT // 38, 48
80 #endif
81  };
82 #ifndef ENABLE_SKYRIM_VR
83  static_assert(sizeof(TrainingMenu) == 0x0F0);
84 #elif !defined(ENABLE_SKYRIM_AE) && !defined(ENABLE_SKYRIM_SE)
85  static_assert(sizeof(TrainingMenu) == 0x100);
86 #endif
87 }
88 
89 #undef RUNTIME_DATA_CONTENT
#define RUNTIME_DATA_CONTENT
Definition: TrainingMenu.h:30
Definition: BSTEvent.h:143
Definition: FxDelegateHandler.h:19
Definition: IMenu.h:55
Definition: MenuOpenCloseEvent.h:8
Definition: TrainingMenu.h:23
static constexpr auto RTTI
Definition: TrainingMenu.h:25
~TrainingMenu() override
const BSTEventSink< MenuOpenCloseEvent > * AsMenuOpenCloseEventSink() const noexcept
Definition: TrainingMenu.h:62
void Accept(CallbackProcessor *a_cbReg) override
constexpr static std::string_view MENU_NAME
Definition: TrainingMenu.h:26
RUNTIME_DATA & GetRuntimeData() noexcept
Definition: TrainingMenu.h:67
BSEventNotifyControl ProcessEvent(const MenuOpenCloseEvent *a_event, BSTEventSource< MenuOpenCloseEvent > *a_eventSource) override
UI_MESSAGE_RESULTS ProcessMessage(UIMessage &a_message) override
const RUNTIME_DATA & GetRuntimeData() const noexcept
Definition: TrainingMenu.h:72
BSTEventSink< MenuOpenCloseEvent > * AsMenuOpenCloseEventSink() noexcept
Definition: TrainingMenu.h:57
Definition: UIMessage.h:28
Definition: AbsorbEffect.h:6
UI_MESSAGE_RESULTS
Definition: IMenu.h:48
constexpr REL::VariantID RTTI_TrainingMenu(688920, 396775, 0x1f47a20)
BSEventNotifyControl
Definition: BSTEvent.h:12
Definition: TrainingMenu.h:29