Skip to content

Commit

Permalink
Merge branch 'main' into feature/badge-system
Browse files Browse the repository at this point in the history
  • Loading branch information
elsongabriel authored Apr 27, 2024
2 parents b54710c + 36b185b commit b59dbc7
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion data/scripts/actions/items/exercise_training_weapons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ end
local exerciseTraining = Action()

function exerciseTraining.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if not target or not target:getId() then
if not target or type(target) == "table" or not target:getId() then
return true
end

Expand Down
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 @@ -8829,7 +8829,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 b59dbc7

Please sign in to comment.