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