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/world/actor/ActorDataIDs.h"
7
8// auto generated forward declare list
9// clang-format off
10class Actor;
12class CompoundTag;
13class DataLoadHelper;
14class NpcI18nObserver;
15class Player;
16struct ActorUniqueID;
17struct NpcGUIOffset;
18struct SkinData;
19namespace Json { class Value; }
20namespace npc { struct ActionContainer; }
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 // NOLINTEND
44
45public:
46 // prevent constructor by default
47 NpcComponent& operator=(NpcComponent const&);
49
50public:
51 // virtual functions
52 // NOLINTBEGIN
53 // vIndex: 0
54 virtual ~NpcComponent();
55 // NOLINTEND
56
57public:
58 // member functions
59 // NOLINTBEGIN
60 MCAPI NpcComponent();
61
62 MCAPI NpcComponent(::NpcComponent&& rhs);
63
64 MCAPI void _defineEntityDataString(::Actor& owner, ::ActorDataIDs id);
65
66 MCAPI void _deserializeData(::Json::Value const& npcData);
67
68 MCAPI void _loadData(::Actor& owner);
69
70 MCAPI void addAdditionalSaveData(::CompoundTag& tag, ::Actor const& owner) const;
71
72 MCAPI void executeClosingCommands(::Actor& owner, ::Player& sourcePlayer, ::std::string const& sceneName);
73
74 MCAPI void
75 executeCommandAction(::Actor& owner, ::Player& sourcePlayer, int actionIndex, ::std::string const& sceneName);
76
77 MCAPI void executeOpeningCommands(::Actor& owner, ::Player& sourcePlayer, ::std::string const& sceneName);
78
79 MCAPI ::std::vector<int> getCommandCounts() const;
80
81 MCAPI bool getInteraction(::Actor& owner, ::Player& player, ::ActorInteraction& interaction);
82
83 MCAPI ::std::string const& getInteractiveText(::Actor& owner) 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 ::NpcComponent& operator=(::NpcComponent&& rhs);
94
95 MCAPI void readAdditionalSaveData(::Actor& owner, ::CompoundTag const& tag, ::DataLoadHelper& dataLoadHelper);
96
97 MCAPI ::std::string sanitizeRawText(::std::string const& rawText) const;
98
99 MCAPI void
100 setActions(::Actor& owner, ::std::vector<::std::variant<::npc::CommandAction, ::npc::UrlAction>>&& newActions);
101
102 MCAPI bool setDialogueScene(::Actor& owner, ::std::string const& sceneName);
103
104 MCAPI void setInteractiveText(::Actor& owner, ::std::string const& text, bool setLocal);
105
106 MCAPI void setName(::Actor& owner, ::std::string const& name, bool setLocal);
107
108 MCAPI bool setSkinIndex(::Actor& owner, int skinIndex, bool setLocal);
109 // NOLINTEND
110
111public:
112 // static variables
113 // NOLINTBEGIN
114 MCAPI static ::std::string const& ACTIONS_TAG();
115
116 MCAPI static ::std::string const& INTERACTIVE_TAG();
117
118 MCAPI static ::std::string const& NAME_RAW_TEXT_TAG();
119
120 MCAPI static ::std::string const& PLAYER_ID_TAG();
121
122 MCAPI static ::std::string const& PLAYER_SCENE_MAPPING_TAG();
123
124 MCAPI static ::std::string const& SCENE_NAME_TAG();
125
126 MCAPI static ::std::string const& URL_TAG();
127 // NOLINTEND
128
129public:
130 // constructor thunks
131 // NOLINTBEGIN
132 MCAPI void* $ctor();
133
134 MCAPI void* $ctor(::NpcComponent&& rhs);
135 // NOLINTEND
136
137public:
138 // destructor thunk
139 // NOLINTBEGIN
140 MCAPI void $dtor();
141 // NOLINTEND
142
143public:
144 // vftables
145 // NOLINTBEGIN
146 MCAPI static void** $vftable();
147 // NOLINTEND
148};
Definition ActorInteraction.h:5
Definition Actor.h:104
Definition CompoundTag.h:13
Definition DataLoadHelper.h:20
Definition Value.h:16
Definition NpcComponent.h:25
Definition NpcI18nObserver.h:13
Definition Player.h:119
Definition ActorUniqueID.h:5
Definition NpcGUIOffset.h:5
Definition SkinData.h:5