Skip to content

Commit

Permalink
fix: otclient fixes and adjustments (opentibiabr#2573)
Browse files Browse the repository at this point in the history
  • Loading branch information
dudantas authored Apr 27, 2024
1 parent 6094875 commit 36b185b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/creatures/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/items/containers/container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/server/network/connection/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8772,7 +8772,7 @@ void ProtocolGame::parseSaveWheel(NetworkMessage &msg) {
}

void ProtocolGame::sendDisableLoginMusic() {
if (oldProtocol) {
if (oldProtocol || !player || player->getOperatingSystem() >= CLIENTOS_OTCLIENT_LINUX) {
return;
}

Expand Down

0 comments on commit 36b185b

Please sign in to comment.