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