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/ScoreboardOperationResult.h"
16
17// auto generated forward declare list
18// clang-format off
19class Actor;
20class CompoundTag;
22class Objective;
24class PacketSender;
25class Player;
27struct ActorUniqueID;
28struct PlayerScore;
30struct ScoreInfo;
31struct ScoreboardId;
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 MCAPI_C bool clearScoreboardIdentity(::ScoreboardId const& scoreboardId);
125
126 MCAPI ::ObjectiveCriteria const&
127 createObjectiveCriteria(::std::string const& name, bool readOnly, ::ObjectiveRenderType renderType);
128
129 MCAPI ::ObjectiveCriteria* getCriteria(::std::string const& criteriaName) const;
130
131 MCAPI ::std::vector<::PlayerScore> getDisplayInfoFiltered(::std::string const& displaySlot) const;
132
133 MCAPI_C ::std::vector<::PlayerScore> getDisplayInfoSorted(
134 ::std::string const& displaySlot,
135 ::std::function<void(::ObjectiveSortOrder, ::std::vector<::PlayerScore>&)> sortMethod
136 ) const;
137
138 MCAPI ::DisplayObjective const* getDisplayObjective(::std::string const& displaySlotName) const;
139
140 MCAPI ::std::vector<::std::string> getDisplayObjectiveSlotNames() const;
141
142 MCAPI ::std::vector<::ScoreInfo> getIdScores(::ScoreboardId const& id) const;
143
144 MCAPI ::Objective* getObjective(::std::string const& name) const;
145
146 MCAPI ::std::vector<::std::string> getObjectiveNames() const;
147
148 MCAPI ::std::vector<::Objective const*> getObjectives() const;
149
150 MCAPI ::ScoreboardId const& getScoreboardId(::Actor const& entity) const;
151
152 MCAPI ::ScoreboardId const& getScoreboardId(::std::string const& name) const;
153
154 MCAPI ::ScoreboardId const& getScoreboardId(::Player const& player) const;
155
156 MCAPI ::std::vector<::ScoreboardIdentityRef> getScoreboardIdentityRefs() const;
157
158 MCAPI ::std::vector<::ScoreboardId> getTrackedIds() const;
159
160 MCAPI ::ScoreboardIdentityRef const& registerScoreboardIdentity(::CompoundTag const& loadedData);
161
162 MCAPI ::ScoreboardIdentityRef const&
163 registerScoreboardIdentity(::ScoreboardId const& scoreboardId, ::ActorUniqueID const& entityId);
164
165 MCAPI ::ScoreboardIdentityRef const&
166 registerScoreboardIdentity(::ScoreboardId const& scoreboardId, ::std::string const& name);
167
168 MCAPI ::ScoreboardIdentityRef const&
169 registerScoreboardIdentity(::ScoreboardId const& scoreboardId, ::PlayerScoreboardId const& playerId);
170
171 MCAPI bool removeObjective(::Objective* objective);
172
173 MCAPI void removeScoreListener(::Player const& player, ::std::string const& objective);
174
175 MCAPI bool resetPlayerScore(::ScoreboardId const& id, ::Objective& objective);
176
177 MCAPI void resetPlayerScore(::ScoreboardId const& id);
178 // NOLINTEND
179
180public:
181 // static variables
182 // NOLINTBEGIN
183 MCAPI static ::std::string const& DEFAULT_CRITERIA();
184
185 MCAPI static ::std::string const& DISPLAY_SLOT_BELOWNAME();
186
187 MCAPI static ::std::string const& DISPLAY_SLOT_LIST();
188
189 MCAPI static ::std::string const& DISPLAY_SLOT_SIDEBAR();
190
191 MCAPI static char const*& OBJECTIVES_ENUM();
192 // NOLINTEND
193
194public:
195 // constructor thunks
196 // NOLINTBEGIN
197 MCAPI void* $ctor(::CommandSoftEnumRegistry registry);
198 // NOLINTEND
199
200public:
201 // destructor thunk
202 // NOLINTBEGIN
203 MCAPI void $dtor();
204 // NOLINTEND
205
206public:
207 // virtual function thunks
208 // NOLINTBEGIN
209 MCAPI ::DisplayObjective const* $setDisplayObjective(
210 ::std::string const& displaySlotName,
211 ::Objective const& objective,
212 ::ObjectiveSortOrder const order
213 );
214
215 MCAPI ::Objective* $clearDisplayObjective(::std::string const& displaySlotName);
216
217 MCFOLD ::ScoreboardId const& $createScoreboardId(::Player const& player);
218
219 MCFOLD ::ScoreboardId const& $createScoreboardId(::Actor const& entity);
220
221 MCFOLD ::ScoreboardId const& $createScoreboardId(::std::string const& fakePlayer);
222
223 MCAPI void $onObjectiveAdded(::Objective const& objective);
224
225 MCAPI void $onObjectiveRemoved(::Objective& objective);
226
227 MCAPI void $onScoreChanged(::ScoreboardId const& id, ::Objective const& obj);
228
229 MCFOLD void $onPlayerScoreRemoved(::ScoreboardId const& id, ::Objective const& objective);
230
231 MCFOLD void $onPlayerJoined(::Player const& player);
232
233 MCFOLD void $onPlayerIdentityUpdated(::PlayerScoreboardId const& playerId);
234
235 MCFOLD void $tick();
236
237 MCFOLD void $setPacketSender(::PacketSender* sender);
238
239 MCFOLD void $writeToLevelStorage();
240
241 MCFOLD bool $isClientSide() const;
242
243
244 // NOLINTEND
245
246public:
247 // vftables
248 // NOLINTBEGIN
249 MCAPI static void** $vftable();
250 // NOLINTEND
251};
Definition Actor.h:105
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:125
Definition ScoreboardIdentityRef.h:18
Definition ActorUniqueID.h:5
Definition PlayerScore.h:8
Definition PlayerScoreboardId.h:6
Definition ScoreInfo.h:10
Definition ScoreboardId.h:11