|
28 | 28 | #include "lse/api/MoreGlobal.h" |
29 | 29 | #include "lse/api/NetworkPacket.h" |
30 | 30 | #include "lse/api/PlayerHelper.h" |
| 31 | +#include "lse/api/ScoreboardHelper.h" |
31 | 32 | #include "main/EconomicSystem.h" |
32 | 33 | #include "main/SafeGuardRecord.h" |
33 | 34 | #include "mc/certificates/WebToken.h" |
34 | 35 | #include "mc/deps/core/math/Vec2.h" |
35 | | -#include "mc/deps/core/string/HashedString.h" |
36 | 36 | #include "mc/deps/core/utility/MCRESULT.h" |
37 | 37 | #include "mc/entity/components/ActorRotationComponent.h" |
38 | 38 | #include "mc/entity/components/InsideBlockComponent.h" |
39 | 39 | #include "mc/entity/components/IsOnHotBlockFlagComponent.h" |
40 | 40 | #include "mc/entity/components/TagsComponent.h" |
41 | 41 | #include "mc/entity/utilities/ActorMobilityUtils.h" |
42 | | -#include "mc/legacy/ActorRuntimeID.h" |
43 | 42 | #include "mc/legacy/ActorUniqueID.h" |
44 | 43 | #include "mc/nbt/CompoundTag.h" |
45 | 44 | #include "mc/nbt/ListTag.h" |
|
76 | 75 | #include "mc/world/actor/Actor.h" |
77 | 76 | #include "mc/world/actor/ActorDamageByActorSource.h" |
78 | 77 | #include "mc/world/actor/BuiltInActorComponents.h" |
79 | | -#include "mc/world/actor/SynchedActorData.h" |
80 | 78 | #include "mc/world/actor/SynchedActorDataEntityWrapper.h" |
81 | 79 | #include "mc/world/actor/ai/util/BossBarColor.h" |
82 | 80 | #include "mc/world/actor/ai/util/BossEventUpdateType.h" |
|
91 | 89 | #include "mc/world/attribute/Attribute.h" |
92 | 90 | #include "mc/world/attribute/AttributeInstance.h" |
93 | 91 | #include "mc/world/attribute/AttributeModificationContext.h" |
94 | | -#include "mc/world/attribute/MutableAttributeWithContext.h" |
95 | 92 | #include "mc/world/attribute/SharedAttributes.h" |
96 | 93 | #include "mc/world/effect/EffectDuration.h" |
97 | 94 | #include "mc/world/effect/MobEffectInstance.h" |
|
124 | 121 | #include <vector> |
125 | 122 |
|
126 | 123 | using lse::api::AttributeHelper; |
| 124 | +using lse::api::ScoreboardHelper; |
127 | 125 | using lse::form::FormCancelReason; |
128 | 126 |
|
129 | 127 | //////////////////// Class Definition //////////////////// |
@@ -502,8 +500,8 @@ Local<Value> McClass::getPlayerScore(const Arguments& args) { |
502 | 500 | return Number::newNumber(0); |
503 | 501 | } |
504 | 502 | int64 uniqueId = serverIdTag->at("UniqueID"); |
505 | | - ScoreboardId sid = scoreboard.getScoreboardId(PlayerScoreboardId(uniqueId)); |
506 | | - if (!sid.isValid() || !objective->hasScore(sid)) { |
| 503 | + ScoreboardId sid = ScoreboardHelper::getId(scoreboard, PlayerScoreboardId(uniqueId)); |
| 504 | + if (sid.mRawID == ScoreboardId::INVALID().mRawID || !objective->hasScore(sid)) { |
507 | 505 | return Number::newNumber(0); |
508 | 506 | } |
509 | 507 | return Number::newNumber(objective->getPlayerScore(sid).mValue); |
@@ -537,8 +535,8 @@ Local<Value> McClass::setPlayerScore(const Arguments& args) { |
537 | 535 | return Boolean::newBoolean(false); |
538 | 536 | } |
539 | 537 | int64 uniqueId = serverIdTag->at("UniqueID"); |
540 | | - ScoreboardId sid = scoreboard.getScoreboardId(PlayerScoreboardId(uniqueId)); |
541 | | - if (!sid.isValid()) { |
| 538 | + ScoreboardId sid = ScoreboardHelper::getId(scoreboard, PlayerScoreboardId(uniqueId)); |
| 539 | + if (sid.mRawID == ScoreboardId::INVALID().mRawID) { |
542 | 540 | return Boolean::newBoolean(false); |
543 | 541 | } |
544 | 542 | bool isSuccess = false; |
@@ -575,8 +573,8 @@ Local<Value> McClass::addPlayerScore(const Arguments& args) { |
575 | 573 | return Boolean::newBoolean(false); |
576 | 574 | } |
577 | 575 | int64 uniqueId = serverIdTag->at("UniqueID"); |
578 | | - ScoreboardId sid = scoreboard.getScoreboardId(PlayerScoreboardId(uniqueId)); |
579 | | - if (!sid.isValid()) { |
| 576 | + ScoreboardId sid = ScoreboardHelper::getId(scoreboard, PlayerScoreboardId(uniqueId)); |
| 577 | + if (sid.mRawID == ScoreboardId::INVALID().mRawID) { |
580 | 578 | return Boolean::newBoolean(false); |
581 | 579 | } |
582 | 580 | bool isSuccess = false; |
@@ -613,8 +611,8 @@ Local<Value> McClass::reducePlayerScore(const Arguments& args) { |
613 | 611 | return Boolean::newBoolean(false); |
614 | 612 | } |
615 | 613 | int64 uniqueId = serverIdTag->at("UniqueID"); |
616 | | - ScoreboardId sid = scoreboard.getScoreboardId(PlayerScoreboardId(uniqueId)); |
617 | | - if (!sid.isValid()) { |
| 614 | + ScoreboardId sid = ScoreboardHelper::getId(scoreboard, PlayerScoreboardId(uniqueId)); |
| 615 | + if (sid.mRawID == ScoreboardId::INVALID().mRawID) { |
618 | 616 | return Boolean::newBoolean(false); |
619 | 617 | } |
620 | 618 | bool isSuccess = false; |
@@ -655,8 +653,8 @@ Local<Value> McClass::deletePlayerScore(const Arguments& args) { |
655 | 653 | return Boolean::newBoolean(false); |
656 | 654 | } |
657 | 655 | int64 uniqueId = serverIdTag->at("UniqueID"); |
658 | | - ScoreboardId sid = scoreboard.getScoreboardId(PlayerScoreboardId(uniqueId)); |
659 | | - if (!sid.isValid()) { |
| 656 | + ScoreboardId sid = ScoreboardHelper::getId(scoreboard, PlayerScoreboardId(uniqueId)); |
| 657 | + if (sid.mRawID == ScoreboardId::INVALID().mRawID) { |
660 | 658 | return Boolean::newBoolean(false); |
661 | 659 | } |
662 | 660 | scoreboard.resetPlayerScore(sid, *objective); |
|
0 commit comments