LeviLamina
Loading...
Searching...
No Matches
NpcComponent.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/entity/components_json_legacy/NpcGUIOffset.h"
7#include "mc/legacy/ActorUniqueID.h"
8#include "mc/world/actor/ActorDataIDs.h"
9#include "mc/world/actor/npc/ActionContainer.h"
10
11// auto generated forward declare list
12// clang-format off
13class Actor;
14class CompoundTag;
15class DataLoadHelper;
16class Interaction;
17class NpcI18nObserver;
18class Player;
19struct SkinData;
20namespace Json { class Value; }
21// clang-format on
22
23class NpcComponent {
24public:
25 // NpcComponent inner types define
26 using TextFilter = ::std::function<::std::string(::std::string const&)>;
27
28public:
29 // member variables
30 // NOLINTBEGIN
31 ::ll::TypedStorage<4, 4, int> mCurrentSkin;
32 ::ll::TypedStorage<4, 36, ::NpcGUIOffset> mPortraitOffsets;
33 ::ll::TypedStorage<4, 36, ::NpcGUIOffset> mPickerOffsets;
34 ::ll::TypedStorage<8, 24, ::std::vector<::SkinData>> mNPCSkins;
35 ::ll::TypedStorage<8, 48, ::npc::ActionContainer> mActionsContainer;
36 ::ll::TypedStorage<8, 64, ::std::unordered_map<::ActorUniqueID, ::std::string>> mPlayerSceneState;
37 ::ll::TypedStorage<8, 32, ::std::string> mDefaultSceneId;
38 ::ll::TypedStorage<8, 40, ::std::optional<::std::string>> mInteractText;
39 ::ll::TypedStorage<8, 64, ::std::function<::std::string(::std::string const&)>> mInteractTextFilter;
40 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::NpcI18nObserver>> mNpcI18nObserver;
41 ::ll::TypedStorage<1, 1, bool> mIsGloballyAccessed;
42 // NOLINTEND
43
44public:
45 // prevent constructor by default
46 NpcComponent& operator=(NpcComponent const&);
47 NpcComponent(NpcComponent const&);
48 NpcComponent();
49
50public:
51 // virtual functions
52 // NOLINTBEGIN
53 virtual ~NpcComponent();
54 // NOLINTEND
55
56public:
57 // member functions
58 // NOLINTBEGIN
59 MCAPI NpcComponent(::NpcComponent&& rhs);
60
61 MCAPI void _deserializeData(::Json::Value const& npcData);
62
63 MCAPI void _loadData(::Actor& owner);
64
65 MCAPI void addAdditionalSaveData(::CompoundTag& tag, ::Actor const& owner) const;
66
67 MCAPI ::std::vector<int> getCommandCounts() const;
68
69 MCAPI ::Interaction getInteraction(::Actor& owner, ::Player& player);
70
71#ifdef LL_PLAT_C
72 MCAPI ::std::string const& getInteractiveRawText(::Actor const& owner) const;
73#endif
74
75 MCAPI ::std::string const& getInteractiveText(::Actor& owner) const;
76
77#ifdef LL_PLAT_C
78 MCAPI ::std::string const& getName(::Actor const& owner) const;
79
80 MCAPI ::std::string const& getNameRawText(::Actor const& owner) const;
81#endif
82
83 MCAPI ::std::string const& getSceneStateForPlayer(::ActorUniqueID const& playerID) const;
84
85 MCAPI void initClientOnlyData(::Actor& owner);
86
87 MCAPI void initFromDefinition(::Actor& owner);
88
89 MCAPI void loadActions(::Actor& owner);
90
91 MCAPI void loadInteractiveRawText(::Actor& owner);
92
93 MCAPI void loadNameRawText(::Actor& owner);
94
95 MCAPI ::NpcComponent& operator=(::NpcComponent&& rhs);
96
97 MCAPI void readAdditionalSaveData(::Actor& owner, ::CompoundTag const& tag, ::DataLoadHelper& dataLoadHelper);
98
99 MCAPI ::std::string sanitizeRawText(::std::string const& rawText) const;
100
101 MCAPI void setDefaultSceneId(::std::string sceneId);
102
103 MCAPI bool setDialogueScene(::Actor& owner, ::std::string const& sceneName);
104
105 MCAPI void setInteractiveText(::Actor& owner, ::std::string const& text, bool setLocal);
106
107#ifdef LL_PLAT_C
108 MCAPI void
109 setInteractiveTextFilter(::std::function<::std::string(::std::string const&)> filter, bool shouldRunFilter);
110#endif
111
112 MCAPI void setName(::Actor& owner, ::std::string const& name, bool setLocal);
113
114 MCAPI void setSceneStateForPlayer(::Actor& owner, ::ActorUniqueID const& playerID, ::std::string const& sceneName);
115
116 MCAPI bool setSkinIndex(::Actor& owner, int skinIndex, bool setLocal);
117
118 MCAPI void syncActionsWithClient(::Actor& owner);
119
120#ifdef LL_PLAT_C
121 MCAPI void syncActionsWithServer(::Actor& owner) const;
122#endif
123 // NOLINTEND
124
125public:
126 // static functions
127 // NOLINTBEGIN
128 MCAPI static void _defineEntityDataString(::Actor& owner, ::ActorDataIDs id);
129
130 MCAPI static void
131 executeCommandAction(::Actor& owner, ::Player& sourcePlayer, int actionIndex, ::std::string const& sceneName);
132 // NOLINTEND
133
134public:
135 // static variables
136 // NOLINTBEGIN
137 MCAPI static ::std::string const& ACTIONS_TAG();
138
139 MCAPI static ::std::string const& INTERACTIVE_TAG();
140
141 MCAPI static ::std::string const& NAME_RAW_TEXT_TAG();
142
143 MCAPI static ::std::string const& PLAYER_ID_TAG();
144
145 MCAPI static ::std::string const& PLAYER_SCENE_MAPPING_TAG();
146
147 MCAPI static ::std::string const& SCENE_NAME_TAG();
148
149 MCAPI static ::std::string const& URL_TAG();
150 // NOLINTEND
151
152public:
153 // constructor thunks
154 // NOLINTBEGIN
155 MCAPI void* $ctor(::NpcComponent&& rhs);
156 // NOLINTEND
157
158public:
159 // destructor thunk
160 // NOLINTBEGIN
161 MCAPI void $dtor();
162 // NOLINTEND
163
164public:
165 // vftables
166 // NOLINTBEGIN
167 MCNAPI static void** $vftable();
168 // NOLINTEND
169};
Definition Actor.h:113
Definition CompoundTag.h:18
Definition DataLoadHelper.h:20
Definition Interaction.h:9
Definition Value.h:16
static MCAPI void ** $vftable()
Definition NpcI18nObserver.h:15
Definition Player.h:129
Definition ActorUniqueID.h:5
Definition SkinData.h:11