CommonLibSSE NG
Loading...
Searching...
No Matches
ActorValueList.h
Go to the documentation of this file.
1#pragma once
2
4#include "RE/A/ActorValues.h"
5
6namespace RE
7{
9 {
10 public:
11 [[nodiscard]] static ActorValueList* GetSingleton()
12 {
13 REL::Relocation<ActorValueList**> singleton{ RELOCATION_ID(514139, 400267) };
14 return *singleton;
15 }
16
17 [[nodiscard]] ActorValueInfo* GetActorValue(ActorValue a_actorValue) const;
18 [[nodiscard]] ActorValue LookupActorValueByName(std::string_view a_enumName) const;
19
20 // members
21 std::uint32_t unk00; // 00
22 std::uint32_t pad04; // 04
23 ActorValueInfo* actorValues[stl::to_underlying(ActorValue::kTotal)]; // 08
24 };
25}
26
27namespace std
28{
29 [[nodiscard]] inline std::string to_string(RE::ActorValue a_actorValue)
30 {
31 auto* info = RE::ActorValueList::GetSingleton()->GetActorValue(a_actorValue);
32 return info ? info->enumName : "None";
33 }
34
35#ifdef __cpp_lib_format
36 template <class CharT>
37 struct formatter<RE::ActorValue, CharT> : formatter<std::string_view, CharT>
38 {
39 template <class FormatContext>
40 auto format(RE::ActorValue a_actorValue, FormatContext& a_ctx)
41 {
42 auto* info = RE::ActorValueList::GetSingleton()->GetActorValue(a_actorValue);
43 return formatter<std::string_view, CharT>::format(info ? info->enumName : "None", a_ctx);
44 }
45 };
46#endif
47}
48
49namespace fmt
50{
51 template <>
52 struct formatter<RE::ActorValue>
53 {
54 template <class ParseContext>
55 constexpr auto parse(ParseContext& a_ctx)
56 {
57 return a_ctx.begin();
58 }
59
60 template <class FormatContext>
61 auto format(const RE::ActorValue& a_actorValue, FormatContext& a_ctx)
62 {
63 auto* info = RE::ActorValueList::GetSingleton()->GetActorValue(a_actorValue);
64 return fmt::format_to(a_ctx.out(), "{}", info ? info->enumName : "None");
65 }
66 };
67}
#define RELOCATION_ID(a_se, a_ae)
Definition PCH.h:794
Definition ActorValueInfo.h:19
const char * enumName
Definition ActorValueInfo.h:54
Definition ActorValueList.h:9
ActorValue LookupActorValueByName(std::string_view a_enumName) const
std::uint32_t unk00
Definition ActorValueList.h:21
ActorValueInfo * GetActorValue(ActorValue a_actorValue) const
static ActorValueList * GetSingleton()
Definition ActorValueList.h:11
ActorValueInfo * actorValues[stl::to_underlying(ActorValue::kTotal)]
Definition ActorValueList.h:23
std::uint32_t pad04
Definition ActorValueList.h:22
Definition Relocation.h:1638
Definition AbsorbEffect.h:6
ActorValue
Definition ActorValues.h:6
constexpr auto to_underlying(Enum a_val) noexcept
Definition PCH.h:728
Definition ActorValueList.h:50
Definition ActorValueList.h:28
std::string to_string(RE::ActorValue a_actorValue)
Definition ActorValueList.h:29
constexpr auto parse(ParseContext &a_ctx)
Definition ActorValueList.h:55
auto format(const RE::ActorValue &a_actorValue, FormatContext &a_ctx)
Definition ActorValueList.h:61