diff --git a/src/game/game.cpp b/src/game/game.cpp index 38a2cad..1b2333d 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -9058,12 +9058,13 @@ void Game::playerCreateMarketOffer(uint32_t playerId, uint8_t type, uint16_t ite } uint64_t totalPrice = price * amount; - uint64_t totalFee = totalPrice * 0.02; - uint64_t maxFee = std::min(1000000, totalFee); - uint64_t fee = std::max(20, totalFee); + uint64_t totalFee = totalPrice * 0.02; // 2% fee + uint64_t maxFee = std::min(1000000, totalFee); // Max fee is 1kk + uint64_t fee = std::clamp(totalFee, uint64_t(20), maxFee); // Limit between 20 and maxFee if (type == MARKETACTION_SELL) { - if (fee > (player->getBankBalance() + player->getMoney())) { + uint64_t totalPriceWithFee = totalPrice + fee; + if (totalPriceWithFee > (player->getMoney() + player->getBankBalance())) { offerStatus << "Fee is greater than player money"; return; } diff --git a/src/map/spectators.cpp b/src/map/spectators.cpp index e286023..097272a 100644 --- a/src/map/spectators.cpp +++ b/src/map/spectators.cpp @@ -67,14 +67,14 @@ bool Spectators::checkCache(const SpectatorsCache::FloorData &specData, bool onl for (const auto &creature : *list) { const auto &specPos = creature->getPosition(); if ((centerPos.x - specPos.x >= minRangeX - && centerPos.y - specPos.y >= minRangeY - && centerPos.x - specPos.x <= maxRangeX - && centerPos.y - specPos.y <= maxRangeY - && (multifloor || specPos.z == centerPos.z) - && ((onlyPlayers && creature->getPlayer()) - || (onlyMonsters && creature->getMonster()) - || (onlyNpcs && creature->getNpc())) - || (!onlyPlayers && !onlyMonsters && !onlyNpcs))) { + && centerPos.y - specPos.y >= minRangeY + && centerPos.x - specPos.x <= maxRangeX + && centerPos.y - specPos.y <= maxRangeY + && (multifloor || specPos.z == centerPos.z) + && ((onlyPlayers && creature->getPlayer()) + || (onlyMonsters && creature->getMonster()) + || (onlyNpcs && creature->getNpc()))) + || (!onlyPlayers && !onlyMonsters && !onlyNpcs)) { spectators.emplace_back(creature); } } @@ -265,7 +265,7 @@ Spectators Spectators::excludePlayerMaster() const { specs.creatures.reserve(creatures.size()); for (const auto &c : creatures) { - if ((c->getMonster() != nullptr && !c->getMaster() || !c->getMaster()->getPlayer())) { + if ((c->getMonster() != nullptr && !c->getMaster()) || (!c->getMaster() || !c->getMaster()->getPlayer())) { specs.insert(c); } }