Skip to content

Commit

Permalink
fix: compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
dudantas committed Oct 9, 2024
1 parent 13d7a47 commit c55498c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
11 changes: 4 additions & 7 deletions src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1046,9 +1046,6 @@ void ProtocolGame::parsePacketFromDispatcher(NetworkMessage &msg, uint8_t recvby
case 0xCA:
parseUpdateContainer(msg);
break;
case 0xE8:
parseDebugAssert(msg);
break;
case 0xA1:
sendCancelTarget();
break;
Expand Down Expand Up @@ -9472,16 +9469,16 @@ bool ProtocolGame::canWatchCast(const std::shared_ptr<Player> &foundPlayer, cons
}

auto playersByIP = foundPlayer->client->getLivestreamViewersByIP(getIP());
int32_t maxViewersPerIP = g_configManager().getNumber(LIVESTREAM_MAXIMUM_VIEWERS_PER_IP, __FUNCTION__);
int32_t maxViewersPerIP = g_configManager().getNumber(LIVESTREAM_MAXIMUM_VIEWERS_PER_IP);
if (static_cast<int32_t>(playersByIP.size()) >= maxViewersPerIP) {
disconnectClient("Livestream viewer limit per IP reached. Please try again later.");
return false;
}

// Get the base viewer limit from configManager for regular accounts
int32_t baseMaxViewers = g_configManager().getNumber(LIVESTREAM_MAXIMUM_VIEWERS, __FUNCTION__);
int32_t baseMaxViewers = g_configManager().getNumber(LIVESTREAM_MAXIMUM_VIEWERS);
// Get the viewer limit for premium accounts from configManager
int32_t premiumMaxViewers = g_configManager().getNumber(LIVESTREAM_PREMIUM_MAXIMUM_VIEWERS, __FUNCTION__);
int32_t premiumMaxViewers = g_configManager().getNumber(LIVESTREAM_PREMIUM_MAXIMUM_VIEWERS);
// Determine the allowed number of viewers based on whether the player has a premium account
int32_t maxViewersAllowed = foundPlayer->isPremium() ? premiumMaxViewers : baseMaxViewers;
// Check if the current number of viewers exceeds the allowed limit
Expand All @@ -9491,7 +9488,7 @@ bool ProtocolGame::canWatchCast(const std::shared_ptr<Player> &foundPlayer, cons
}

// Check caster's minimum level requirement
int32_t casterMinLevel = g_configManager().getNumber(LIVESTREAM_CASTER_MIN_LEVEL, __FUNCTION__);
int32_t casterMinLevel = g_configManager().getNumber(LIVESTREAM_CASTER_MIN_LEVEL);
if (foundPlayer->getLevel() < casterMinLevel) {
disconnectClient("The caster does not meet the minimum level requirement to broadcast.");
return false;
Expand Down
12 changes: 6 additions & 6 deletions src/server/network/protocol/protocollogin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,19 +209,19 @@ void ProtocolLogin::getLivestreamViewersList(const std::string &password) {

auto output = OutputMessagePool::getOutputMessage();
output->addByte(HEADER_BYTE);
output->addString(fmt::format("{}\nWelcome to Cast System!", normal_random(MIN_RANDOM_VALUE, MAX_RANDOM_VALUE)), "ProtocolLogin::getLivestreamViewersList - Welcome to Cast System!')");
output->addString(fmt::format("{}\nWelcome to Cast System!", normal_random(MIN_RANDOM_VALUE, MAX_RANDOM_VALUE)));

output->addByte(SESSION_KEY_BYTE);
output->addString(fmt::format("@livestream\n{}", password), "ProtocolLogin::getCharacterList - accountDescriptor + password");
output->addString(fmt::format("@livestream\n{}", password));

output->addByte(uint8_t());
output->addByte(NUMBER_OF_WORLDS);

output->addByte(uint8_t());
output->addString(g_configManager().getString(SERVER_NAME, __FUNCTION__), "ProtocolLogin::getLivestreamViewersList - _configManager().getString(SERVER_NAME)");
output->addString(g_configManager().getString(IP, __FUNCTION__), "ProtocolLogin::getLivestreamViewersList - g_configManager().getString(IP)");
output->addString(g_configManager().getString(SERVER_NAME));
output->addString(g_configManager().getString(IP));

output->add<uint16_t>(g_configManager().getNumber(GAME_PORT, __FUNCTION__));
output->add<uint16_t>(g_configManager().getNumber(GAME_PORT));

output->addByte(uint8_t());

Expand All @@ -241,7 +241,7 @@ void ProtocolLogin::getLivestreamViewersList(const std::string &password) {

for (const auto &player : players) {
output->addByte(uint8_t());
output->addString(player->getName(), "ProtocolLogin::getLivestreamViewersList - player->getName()");
output->addString(player->getName());
}

output->addByte(uint8_t());
Expand Down

0 comments on commit c55498c

Please sign in to comment.