Skip to content

Commit

Permalink
fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
elsongabriel committed May 31, 2024
1 parent 7971d37 commit 181662b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/lua/functions/creatures/player/player_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2706,9 +2706,9 @@ int PlayerFunctions::luaPlayerGetTournamentCoins(lua_State* L) {
return 1;
}

auto [coins, result] = player->getAccount()->getCoins(account::CoinType::TOURNAMENT);
auto [coins, result] = player->getAccount()->getCoins(enumToValue(CoinType::Tournament));

if (result == account::ERROR_NO) {
if (result == enumToValue(AccountErrors_t::Ok)) {
lua_pushnumber(L, coins);
}

Expand All @@ -2727,17 +2727,17 @@ int PlayerFunctions::luaPlayerUpdateTournamentCoins(lua_State* L) {
std::string tournamentCoinName = asLowerCaseString(g_configManager().getString(TOURNAMENT_COINS_NAME, __FUNCTION__));
const std::string &action = getString(L, 3);
uint32_t amount = getNumber<uint32_t>(L, 2);
if (action == "add" && player->account->addCoins(account::CoinType::TOURNAMENT, amount, "", false) != account::ERROR_NO) {
if (action == "add" && player->account->addCoins(enumToValue(CoinType::Tournament), amount, "", false) != enumToValue(AccountErrors_t::Ok)) {
reportErrorFunc(fmt::format("Failed to update (add) {}", tournamentCoinName));
lua_pushnil(L);
return 1;
} else if (action == "remove" && player->account->removeCoins(account::CoinType::TOURNAMENT, amount) != account::ERROR_NO) {
} else if (action == "remove" && player->account->removeCoins(enumToValue(CoinType::Tournament), amount) != enumToValue(AccountErrors_t::Ok)) {
reportErrorFunc(fmt::format("Failed to update (remove) {}", tournamentCoinName));
lua_pushnil(L);
return 1;
}

if (player->getAccount()->save() != account::ERROR_NO) {
if (player->getAccount()->save() != enumToValue(AccountErrors_t::Ok)) {
reportErrorFunc("Failed to save account");
lua_pushnil(L);
return 1;
Expand Down

0 comments on commit 181662b

Please sign in to comment.