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
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&);
50
51public:
52 // virtual functions
53 // NOLINTBEGIN
54 // vIndex: 0
55 virtual ~NpcComponent();
56 // NOLINTEND
57
58public:
59 // member functions
60 // NOLINTBEGIN
61 MCAPI NpcComponent();
62
63 MCAPI NpcComponent(::NpcComponent&& rhs);
64
65 MCAPI void _defineEntityDataString(::Actor& owner, ::ActorDataIDs id);
66
67 MCAPI void _deserializeData(::Json::Value const& npcData);
68
69 MCAPI void _loadData(::Actor& owner);
70
71 MCAPI void addAdditionalSaveData(::CompoundTag& tag, ::Actor const& owner) const;
72
73 MCAPI void executeClosingCommands(::Actor& owner, ::Player& sourcePlayer, ::std::string const& sceneName);
74
75 MCAPI void
76 executeCommandAction(::Actor& owner, ::Player& sourcePlayer, int actionIndex, ::std::string const& sceneName);
77
78 MCAPI void executeOpeningCommands(::Actor& owner, ::Player& sourcePlayer, ::std::string const& sceneName);
79
80 MCAPI ::std::vector<int> getCommandCounts() const;
81
82 MCAPI bool getInteraction(::Actor& owner, ::Player& player, ::ActorInteraction& interaction);
83
84 MCAPI ::std::string const& getInteractiveText(::Actor& owner) const;
85
86 MCAPI ::std::string const& getSceneStateForPlayer(::ActorUniqueID const& playerID) const;
87
88 MCAPI void initClientOnlyData(::Actor& owner);
89
90 MCAPI void initFromDefinition(::Actor& owner);
91
92 MCAPI void loadActions(::Actor& owner);
93
94 MCAPI void loadInteractiveRawText(::Actor& owner);
95
96 MCAPI ::NpcComponent& operator=(::NpcComponent&& rhs);
97
98 MCAPI void readAdditionalSaveData(::Actor& owner, ::CompoundTag const& tag, ::DataLoadHelper& dataLoadHelper);
99
100 MCAPI ::std::string sanitizeRawText(::std::string const& rawText) const;
101
102 MCAPI void
103 setActions(::Actor& owner, ::std::vector<::std::variant<::npc::CommandAction, ::npc::UrlAction>>&& newActions);
104
105 MCAPI bool setDialogueScene(::Actor& owner, ::std::string const& sceneName);
106
107 MCAPI void setInteractiveText(::Actor& owner, ::std::string const& text, bool setLocal);
108
109 MCAPI void setName(::Actor& owner, ::std::string const& name, bool setLocal);
110
111 MCAPI bool setSkinIndex(::Actor& owner, int skinIndex, bool setLocal);
112 // NOLINTEND
113
114public:
115 // static variables
116 // NOLINTBEGIN
117 MCAPI static ::std::string const& ACTIONS_TAG();
118
119 MCAPI static ::std::string const& INTERACTIVE_TAG();
120
121 MCAPI static ::std::string const& NAME_RAW_TEXT_TAG();
122
123 MCAPI static ::std::string const& PLAYER_ID_TAG();
124
125 MCAPI static ::std::string const& PLAYER_SCENE_MAPPING_TAG();
126
127 MCAPI static ::std::string const& SCENE_NAME_TAG();
128
129 MCAPI static ::std::string const& URL_TAG();
130 // NOLINTEND
131
132public:
133 // constructor thunks
134 // NOLINTBEGIN
135 MCAPI void* $ctor();
136
137 MCAPI void* $ctor(::NpcComponent&& rhs);
138 // NOLINTEND
139
140public:
141 // destructor thunk
142 // NOLINTBEGIN
143 MCAPI void $dtor();
144 // NOLINTEND
145
146public:
147 // vftables
148 // NOLINTBEGIN
149 MCNAPI static void** $vftable();
150 // NOLINTEND
151};
Definition ActorInteraction.h:5
Definition Actor.h:103
Definition CompoundTag.h:13
Definition DataLoadHelper.h:20
Definition Value.h:16
Definition NpcComponent.h:25
static MCAPI void ** $vftable()
Definition NpcI18nObserver.h:13
Definition Player.h:119
Definition ActorUniqueID.h:5
Definition SkinData.h:5