Skip to content

Commit 744a0ae

Browse files
committed
fix: fix transMoney
1 parent 8e072df commit 744a0ae

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/legacy/api/PlayerAPI.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3175,18 +3175,21 @@ Local<Value> PlayerClass::transMoney(const Arguments& args) {
31753175
try {
31763176
Player* player = get();
31773177
if (!player) return Local<Value>();
3178-
auto xuid = player->getXuid();
3179-
string targetXuid;
3180-
string note;
3181-
if (args[0].getKind() == ValueKind::kString) targetXuid = args[0].toStr();
3182-
else targetXuid = PlayerClass::extract(args[0])->getXuid();
3178+
std::string xuid = player->getXuid();
3179+
std::string targetXuid;
3180+
std::string note;
3181+
if (args[0].getKind() == ValueKind::kString) {
3182+
targetXuid = args[0].toStr();
3183+
} else {
3184+
targetXuid = PlayerClass::extract(args[0])->getXuid();
3185+
}
31833186
if (args.size() >= 3) {
31843187
CHECK_ARG_TYPE(args[2], ValueKind::kString);
31853188
note = args[2].toStr();
31863189
}
31873190
return xuid.empty()
31883191
? Local<Value>()
3189-
: Boolean::newBoolean(EconomySystem::transMoney(xuid, targetXuid, args[0].asNumber().toInt64(), note));
3192+
: Boolean::newBoolean(EconomySystem::transMoney(xuid, targetXuid, args[1].asNumber().toInt64(), note));
31903193
}
31913194
CATCH("Fail in transMoney!");
31923195
}

0 commit comments

Comments
 (0)