From 36b185b2d2d79510a8695a45cbe3ff7658ae1598 Mon Sep 17 00:00:00 2001 From: Eduardo Dantas <eduardo.dantas@hotmail.com.br> Date: Sat, 27 Apr 2024 14:08:40 -0300 Subject: [PATCH] fix: otclient fixes and adjustments (#2573) --- src/creatures/creature.cpp | 3 ++- src/items/containers/container.cpp | 8 ++++---- src/server/network/connection/connection.cpp | 4 ++-- src/server/network/protocol/protocolgame.cpp | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/creatures/creature.cpp b/src/creatures/creature.cpp index 6101ff0473d..9684e03b6d2 100644 --- a/src/creatures/creature.cpp +++ b/src/creatures/creature.cpp @@ -805,7 +805,8 @@ bool Creature::dropCorpse(std::shared_ptr<Creature> lastHitCreature, std::shared auto monster = getMonster(); if (monster && !monster->isRewardBoss()) { std::ostringstream lootMessage; - lootMessage << "Loot of " << getNameDescription() << ": " << corpseContainer->getContentDescription(player->getProtocolVersion() < 1200) << "."; + auto collorMessage = player->getProtocolVersion() < 1200 || player->getOperatingSystem() >= CLIENTOS_OTCLIENT_LINUX; + lootMessage << "Loot of " << getNameDescription() << ": " << corpseContainer->getContentDescription(collorMessage) << "."; auto suffix = corpseContainer->getAttribute<std::string>(ItemAttribute_t::LOOTMESSAGE_SUFFIX); if (!suffix.empty()) { lootMessage << suffix; diff --git a/src/items/containers/container.cpp b/src/items/containers/container.cpp index 7bd7dcef2c9..5d2ffd98769 100644 --- a/src/items/containers/container.cpp +++ b/src/items/containers/container.cpp @@ -218,7 +218,7 @@ std::string Container::getContentDescription(bool oldProtocol) { return getContentDescription(os, oldProtocol).str(); } -std::ostringstream &Container::getContentDescription(std::ostringstream &os, bool oldProtocol) { +std::ostringstream &Container::getContentDescription(std::ostringstream &os, bool sendColoredMessage) { bool firstitem = true; for (ContainerIterator it = iterator(); it.hasNext(); it.advance()) { std::shared_ptr<Item> item = *it; @@ -234,10 +234,10 @@ std::ostringstream &Container::getContentDescription(std::ostringstream &os, boo os << ", "; } - if (oldProtocol) { - os << item->getNameDescription(); - } else { + if (sendColoredMessage) { os << "{" << item->getID() << "|" << item->getNameDescription() << "}"; + } else { + os << item->getNameDescription(); } } diff --git a/src/server/network/connection/connection.cpp b/src/server/network/connection/connection.cpp index cc27eb0e9eb..1c575ff00d0 100644 --- a/src/server/network/connection/connection.cpp +++ b/src/server/network/connection/connection.cpp @@ -399,9 +399,9 @@ void Connection::handleTimeout(ConnectionWeak_ptr connectionWeak, const std::err if (auto connection = connectionWeak.lock()) { if (!error) { - g_logger().warn("Connection Timeout, IP: {}", convertIPToString(connection->getIP())); + g_logger().debug("Connection Timeout, IP: {}", convertIPToString(connection->getIP())); } else { - g_logger().warn("Connection Timeout or error: {}, IP: {}", error.message(), convertIPToString(connection->getIP())); + g_logger().debug("Connection Timeout or error: {}, IP: {}", error.message(), convertIPToString(connection->getIP())); } connection->close(FORCE_CLOSE); } diff --git a/src/server/network/protocol/protocolgame.cpp b/src/server/network/protocol/protocolgame.cpp index 13b328dd2cf..22b032f5bc4 100644 --- a/src/server/network/protocol/protocolgame.cpp +++ b/src/server/network/protocol/protocolgame.cpp @@ -8772,7 +8772,7 @@ void ProtocolGame::parseSaveWheel(NetworkMessage &msg) { } void ProtocolGame::sendDisableLoginMusic() { - if (oldProtocol) { + if (oldProtocol || !player || player->getOperatingSystem() >= CLIENTOS_OTCLIENT_LINUX) { return; }