LeviLamina
Loading...
Searching...
No Matches
Scoreboard.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4#include "mc/world/scores/PlayerScoreSetFunction.h"
5
6// auto generated inclusion list
7#include "mc/deps/core/utility/NonOwnerPointer.h"
8#include "mc/server/commands/CommandOperator.h"
9#include "mc/server/commands/CommandSoftEnumRegistry.h"
10#include "mc/world/events/PlayerScoreboardEventListener.h"
11#include "mc/world/events/ScoreboardEventCoordinator.h"
12#include "mc/world/scores/IdentityDictionary.h"
13#include "mc/world/scores/ObjectiveRenderType.h"
14#include "mc/world/scores/ObjectiveSortOrder.h"
15#include "mc/world/scores/ScoreboardId.h"
16#include "mc/world/scores/ScoreboardOperationResult.h"
17
18// auto generated forward declare list
19// clang-format off
20class Actor;
21class CompoundTag;
23class Objective;
25class PacketSender;
26class Player;
28struct ActorUniqueID;
29struct PlayerScore;
31struct ScoreInfo;
32// clang-format on
33
34class Scoreboard {
35public:
36 // member variables
37 // NOLINTBEGIN
38 ::ll::TypedStorage<8, 8, ::CommandSoftEnumRegistry> mRegistry;
39 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::DisplayObjective>> mDisplayObjectives;
40 ::ll::TypedStorage<8, 256, ::IdentityDictionary> mIdentityDict;
41 ::ll::TypedStorage<8, 64, ::std::unordered_map<::ScoreboardId, ::ScoreboardIdentityRef>> mIdentityRefs;
42 ::ll::TypedStorage<1, 1, bool> mShouldUpdateUI;
43 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::std::unique_ptr<::Objective>>> mObjectives;
44 ::ll::TypedStorage<8, 64, ::std::unordered_map<uint64, ::Bedrock::NonOwnerPointer<::Objective>>>
45 mObjectivesHashLookup;
46 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::std::unique_ptr<::ObjectiveCriteria>>> mCriteria;
47 ::ll::TypedStorage<8, 96, ::ScoreboardEventCoordinator> mScoreboardEventCoordinator;
48 ::ll::TypedStorage<8, 72, ::PlayerScoreboardEventListener> mPlayerListener;
49 // NOLINTEND
50
51public:
52 // prevent constructor by default
53 Scoreboard();
54
55public:
56 LLAPI int modifyPlayerScore(
57 ScoreboardOperationResult& result,
58 ScoreboardId const& id,
59 Objective& objective,
60 int scoreValue,
61 PlayerScoreSetFunction action
62 );
63
64public:
65 // virtual functions
66 // NOLINTBEGIN
67 virtual ~Scoreboard();
68
69 virtual ::DisplayObjective const* setDisplayObjective(
70 ::std::string const& displaySlotName,
71 ::Objective const& objective,
72 ::ObjectiveSortOrder const order
73 );
74
75 virtual ::Objective* clearDisplayObjective(::std::string const& displaySlotName);
76
77 virtual ::ScoreboardId const& createScoreboardId(::Player const& player);
78
79 virtual ::ScoreboardId const& createScoreboardId(::Actor const& entity);
80
81 virtual ::ScoreboardId const& createScoreboardId(::std::string const& fakePlayer);
82
83 virtual void onObjectiveAdded(::Objective const& objective);
84
85 virtual void onObjectiveRemoved(::Objective& objective);
86
87 virtual void onScoreChanged(::ScoreboardId const& id, ::Objective const& obj);
88
89 virtual void onPlayerScoreRemoved(::ScoreboardId const& id, ::Objective const& objective);
90
91 virtual void onPlayerJoined(::Player const& player);
92
93 virtual void onPlayerIdentityUpdated(::PlayerScoreboardId const& playerId);
94
95 virtual void tick();
96
97 virtual void setPacketSender(::PacketSender* sender);
98
99 virtual void writeToLevelStorage();
100
101 virtual bool isClientSide() const;
102 // NOLINTEND
103
104public:
105 // member functions
106 // NOLINTBEGIN
107 MCAPI explicit Scoreboard(::CommandSoftEnumRegistry registry);
108
109 MCAPI ::Objective*
110 addObjective(::std::string const& name, ::std::string const& displayName, ::ObjectiveCriteria const& criteria);
111
112 MCAPI void addScoreListener(::Player& player, ::std::string const& objective);
113
114 MCAPI int applyPlayerOperation(
115 ::ScoreboardOperationResult& result,
116 ::std::vector<::ScoreboardId>& sourceErrorIds,
117 ::ScoreboardId const& target,
118 ::Objective& targetObjective,
119 ::std::vector<::ScoreboardId>& selector,
120 ::Objective& objective,
121 ::CommandOperator opCode
122 );
123
124#ifdef LL_PLAT_C
125 MCAPI bool clearScoreboardIdentity(::ScoreboardId const& scoreboardId);
126#endif
127
128 MCAPI ::ObjectiveCriteria const&
129 createObjectiveCriteria(::std::string const& name, bool readOnly, ::ObjectiveRenderType renderType);
130
131 MCAPI ::ObjectiveCriteria* getCriteria(::std::string const& criteriaName) const;
132
133 MCAPI ::std::vector<::PlayerScore> getDisplayInfoFiltered(::std::string const& displaySlot) const;
134
135#ifdef LL_PLAT_C
136 MCAPI ::std::vector<::PlayerScore> getDisplayInfoSorted(
137 ::std::string const& displaySlot,
138 ::std::function<void(::ObjectiveSortOrder, ::std::vector<::PlayerScore>&)> sortMethod
139 ) const;
140#endif
141
142 MCAPI ::DisplayObjective const* getDisplayObjective(::std::string const& displaySlotName) const;
143
144 MCAPI ::std::vector<::std::string> getDisplayObjectiveSlotNames() const;
145
146 MCAPI ::std::vector<::ScoreInfo> getIdScores(::ScoreboardId const& id) const;
147
148 MCAPI ::Objective* getObjective(::std::string const& name) const;
149
150 MCAPI ::std::vector<::std::string> getObjectiveNames() const;
151
152 MCAPI ::std::vector<::Objective const*> getObjectives() const;
153
154 MCAPI ::ScoreboardId const& getScoreboardId(::Actor const& entity) const;
155
156 MCAPI ::ScoreboardId const& getScoreboardId(::std::string const& name) const;
157
158 MCAPI ::ScoreboardId const& getScoreboardId(::Player const& player) const;
159
160 MCAPI ::std::vector<::ScoreboardIdentityRef> getScoreboardIdentityRefs() const;
161
162 MCAPI ::std::vector<::ScoreboardId> getTrackedIds() const;
163
164 MCAPI ::ScoreboardIdentityRef const& registerScoreboardIdentity(::CompoundTag const& loadedData);
165
166 MCAPI ::ScoreboardIdentityRef const&
167 registerScoreboardIdentity(::ScoreboardId const& scoreboardId, ::ActorUniqueID const& entityId);
168
169 MCAPI ::ScoreboardIdentityRef const&
170 registerScoreboardIdentity(::ScoreboardId const& scoreboardId, ::std::string const& name);
171
172 MCAPI ::ScoreboardIdentityRef const&
173 registerScoreboardIdentity(::ScoreboardId const& scoreboardId, ::PlayerScoreboardId const& playerId);
174
175 MCAPI bool removeObjective(::Objective* objective);
176
177 MCAPI void removeScoreListener(::Player const& player, ::std::string const& objective);
178
179 MCAPI bool resetPlayerScore(::ScoreboardId const& id, ::Objective& objective);
180
181 MCAPI void resetPlayerScore(::ScoreboardId const& id);
182 // NOLINTEND
183
184public:
185 // static variables
186 // NOLINTBEGIN
187 MCAPI static ::std::string const& DEFAULT_CRITERIA();
188
189 MCAPI static ::std::string const& DISPLAY_SLOT_BELOWNAME();
190
191 MCAPI static ::std::string const& DISPLAY_SLOT_LIST();
192
193 MCAPI static ::std::string const& DISPLAY_SLOT_SIDEBAR();
194 // NOLINTEND
195
196public:
197 // constructor thunks
198 // NOLINTBEGIN
199 MCAPI void* $ctor(::CommandSoftEnumRegistry registry);
200 // NOLINTEND
201
202public:
203 // destructor thunk
204 // NOLINTBEGIN
205 MCAPI void $dtor();
206 // NOLINTEND
207
208public:
209 // virtual function thunks
210 // NOLINTBEGIN
211 MCAPI ::DisplayObjective const* $setDisplayObjective(
212 ::std::string const& displaySlotName,
213 ::Objective const& objective,
214 ::ObjectiveSortOrder const order
215 );
216
217 MCAPI ::Objective* $clearDisplayObjective(::std::string const& displaySlotName);
218
219 MCFOLD ::ScoreboardId const& $createScoreboardId(::Player const& player);
220
221 MCFOLD ::ScoreboardId const& $createScoreboardId(::Actor const& entity);
222
223 MCFOLD ::ScoreboardId const& $createScoreboardId(::std::string const& fakePlayer);
224
225 MCAPI void $onObjectiveAdded(::Objective const& objective);
226
227 MCAPI void $onObjectiveRemoved(::Objective& objective);
228
229 MCAPI void $onScoreChanged(::ScoreboardId const& id, ::Objective const& obj);
230
231 MCFOLD void $onPlayerScoreRemoved(::ScoreboardId const& id, ::Objective const& objective);
232
233 MCFOLD void $onPlayerJoined(::Player const& player);
234
235 MCFOLD void $onPlayerIdentityUpdated(::PlayerScoreboardId const& playerId);
236
237 MCFOLD void $tick();
238
239 MCFOLD void $setPacketSender(::PacketSender* sender);
240
241 MCFOLD void $writeToLevelStorage();
242
243 MCFOLD bool $isClientSide() const;
244
245
246 // NOLINTEND
247
248public:
249 // vftables
250 // NOLINTBEGIN
251 MCAPI static void** $vftable();
252 // NOLINTEND
253};
Definition Actor.h:106
Definition CommandSoftEnumRegistry.h:10
Definition CompoundTag.h:23
Definition DisplayObjective.h:14
Definition ObjectiveCriteria.h:13
Definition Objective.h:17
Definition PacketSender.h:17
Definition Player.h:129
Definition ScoreboardIdentityRef.h:18
Definition ActorUniqueID.h:5
Definition PlayerScore.h:8
Definition PlayerScoreboardId.h:6
Definition ScoreInfo.h:10
Definition ScoreboardId.h:11