From e1faa1f5bc1e7eb53982c6b20431a23e5adfe3f7 Mon Sep 17 00:00:00 2001 From: Aluisio Penna Date: Tue, 30 Apr 2024 18:15:14 -0300 Subject: [PATCH 1/4] fix: equipping two-handed distance weapons via action bar removes quiver if equipped (#2587) --- src/game/game.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/game/game.cpp b/src/game/game.cpp index 6670575d991..b1d76f9f760 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -3199,7 +3199,13 @@ void Game::playerEquipItem(uint32_t playerId, uint16_t itemId, bool hasTier /* = } else { const int32_t &slotPosition = equipItem->getSlotPosition(); // Checks if a two-handed item is being equipped in the left slot when the right slot is already occupied and move to backpack - if (slotPosition & SLOTP_LEFT && rightItem && (slotPosition & SLOTP_TWO_HAND)) { + if ( + (slotPosition & SLOTP_LEFT) + && (slotPosition & SLOTP_TWO_HAND) + && rightItem + && !(it.weaponType == WEAPON_DISTANCE) + && !rightItem->isQuiver() + ) { ret = internalCollectManagedItems(player, rightItem, getObjectCategory(rightItem), false); } From c3076740f29eb7df44837ec3052ca4c2ef72594a Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Tue, 30 Apr 2024 18:16:59 -0300 Subject: [PATCH 2/4] fix: oldProtocol compatibility in sendTextMessage (#2510) --- src/server/network/protocol/protocolgame.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/server/network/protocol/protocolgame.cpp b/src/server/network/protocol/protocolgame.cpp index 1748699ab34..c822ff4af7c 100644 --- a/src/server/network/protocol/protocolgame.cpp +++ b/src/server/network/protocol/protocolgame.cpp @@ -4088,11 +4088,11 @@ void ProtocolGame::sendTextMessage(const TextMessage &message) { break; } case MESSAGE_MARKET: { - internalType = MESSAGE_GAME_HIGHLIGHT; + internalType = MESSAGE_EVENT_ADVANCE; break; } case MESSAGE_MANA: { - internalType = MESSAGE_THANK_YOU; + internalType = MESSAGE_HEALED; break; } case MESSAGE_BEYOND_LAST: { @@ -4100,7 +4100,7 @@ void ProtocolGame::sendTextMessage(const TextMessage &message) { break; } case MESSAGE_ATTENTION: { - internalType = MESSAGE_DAMAGE_DEALT; + internalType = MESSAGE_EVENT_ADVANCE; break; } case MESSAGE_BOOSTED_CREATURE: { @@ -4143,11 +4143,9 @@ void ProtocolGame::sendTextMessage(const TextMessage &message) { } case MESSAGE_HEALED: case MESSAGE_HEALED_OTHERS: { - if (!oldProtocol) { - msg.addPosition(message.position); - msg.add(message.primary.value); - msg.addByte(message.primary.color); - } + msg.addPosition(message.position); + msg.add(message.primary.value); + msg.addByte(message.primary.color); break; } case MESSAGE_EXPERIENCE: From 38b13e478251f9a4943f2e4caefd2b215008ce3e Mon Sep 17 00:00:00 2001 From: Elson Costa Date: Thu, 2 May 2024 15:02:13 -0300 Subject: [PATCH 3/4] resolving conversations. --- src/canary_server.cpp | 2 +- .../players/cyclopedia/player_badge.cpp | 4 ++-- src/game/game.cpp | 23 +++++++++++++++---- src/game/game.hpp | 5 ++-- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/canary_server.cpp b/src/canary_server.cpp index ac981e06768..bfabbf51ab8 100644 --- a/src/canary_server.cpp +++ b/src/canary_server.cpp @@ -376,7 +376,7 @@ void CanaryServer::loadModules() { g_game().loadBoostedCreature(); g_ioBosstiary().loadBoostedBoss(); g_ioprey().initializeTaskHuntOptions(); - g_game().getCyclopediaStatistics(); + g_game().logCyclopediaStats(); } void CanaryServer::modulesLoadHelper(bool loaded, std::string moduleName) { diff --git a/src/creatures/players/cyclopedia/player_badge.cpp b/src/creatures/players/cyclopedia/player_badge.cpp index b9b1b0feedb..9b892a6164c 100644 --- a/src/creatures/players/cyclopedia/player_badge.cpp +++ b/src/creatures/players/cyclopedia/player_badge.cpp @@ -38,7 +38,7 @@ bool PlayerBadge::add(uint8_t id, uint32_t timestamp /* = 0*/) { return false; } - const Badge &badge = g_game().getBadgeByIdOrName(id); + const Badge &badge = g_game().getBadgeById(id); if (badge.m_id == 0) { return false; } @@ -86,7 +86,7 @@ void PlayerBadge::loadUnlockedBadges() { const auto &unlockedBadges = getUnlockedKV()->keys(); g_logger().debug("[{}] - Loading unlocked badges: {}", __FUNCTION__, unlockedBadges.size()); for (const auto &badgeName : unlockedBadges) { - const Badge &badge = g_game().getBadgeByIdOrName(0, badgeName); + const Badge &badge = g_game().getBadgeByName(badgeName); if (badge.m_id == 0) { g_logger().error("[{}] - Badge {} not found.", __FUNCTION__, badgeName); continue; diff --git a/src/game/game.cpp b/src/game/game.cpp index 3a909b93a80..05d6b6cfe3f 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -10557,7 +10557,7 @@ std::map Game::getAchievements() { return m_achievements; } -void Game::getCyclopediaStatistics() { +void Game::logCyclopediaStats() { g_logger().info("Loaded {} badges from Badge System", m_badges.size()); // todo in title system: g_logger().info("Loaded {} titles from Title system", m_titles.size()); } @@ -10566,12 +10566,25 @@ std::unordered_set Game::getBadges() { return m_badges; } -Badge Game::getBadgeByIdOrName(uint8_t id, const std::string &name /*= ""*/) { - if (id == 0 && name.empty()) { +Badge Game::getBadgeById(uint8_t id) { + if (id == 0) { + return {}; + } + auto it = std::find_if(m_badges.begin(), m_badges.end(), [id](const Badge &b) { + return b.m_id == id; + }); + if (it != m_badges.end()) { + return *it; + } + return {}; +} + +Badge Game::getBadgeByName(const std::string &name) { + if (name.empty()) { return {}; } - auto it = std::find_if(m_badges.begin(), m_badges.end(), [id, name](const Badge &b) { - return id != 0 ? b.m_id == id : b.m_name == name; + auto it = std::find_if(m_badges.begin(), m_badges.end(), [name](const Badge &b) { + return b.m_name == name; }); if (it != m_badges.end()) { return *it; diff --git a/src/game/game.hpp b/src/game/game.hpp index ce03980f498..9d743895c4c 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -99,7 +99,7 @@ class Game { void forceRemoveCondition(uint32_t creatureId, ConditionType_t type, ConditionId_t conditionId); - void getCyclopediaStatistics(); + void logCyclopediaStats(); /** * Load the main map @@ -723,7 +723,8 @@ class Game { std::map getAchievements(); std::unordered_set getBadges(); - Badge getBadgeByIdOrName(uint8_t id, const std::string &name = ""); + Badge getBadgeById(uint8_t id); + Badge getBadgeByName(const std::string &name); private: std::map m_achievements; From 9f74b27eff36c4e2774e635dc52baf8655e47c6b Mon Sep 17 00:00:00 2001 From: Eduardo Dantas Date: Thu, 2 May 2024 22:38:51 -0300 Subject: [PATCH 4/4] fix: colored loot on cip client and disable chain system (#2600) --- config.lua.dist | 4 ++-- src/creatures/creature.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config.lua.dist b/config.lua.dist index 0507b652e29..b731fadbcd7 100644 --- a/config.lua.dist +++ b/config.lua.dist @@ -397,7 +397,6 @@ resetSessionsOnStartup = false -- Misc. -- NOTE: experienceDisplayRates: set to false to ignore exp rate or true to include exp rate -- NOTE: disableLegacyRaids: set to true to disable legacy XML raids --- NOTE: combatChainDelay: set to minimum 50 miliseconds allowChangeOutfit = true toggleMountInProtectionZone = false freePremium = false @@ -430,7 +429,8 @@ maxElementalResistance = 200 maxDamageReflection = 200 -- Chain system -toggleChainSystem = true +-- NOTE: combatChainDelay: set to minimum 50 miliseconds +toggleChainSystem = false combatChainDelay = 50 combatChainTargets = 5 combatChainSkillFormulaAxe = 0.9 diff --git a/src/creatures/creature.cpp b/src/creatures/creature.cpp index 9684e03b6d2..fd78e33ecf4 100644 --- a/src/creatures/creature.cpp +++ b/src/creatures/creature.cpp @@ -805,7 +805,7 @@ bool Creature::dropCorpse(std::shared_ptr lastHitCreature, std::shared auto monster = getMonster(); if (monster && !monster->isRewardBoss()) { std::ostringstream lootMessage; - auto collorMessage = player->getProtocolVersion() < 1200 || player->getOperatingSystem() >= CLIENTOS_OTCLIENT_LINUX; + auto collorMessage = player->getProtocolVersion() > 1200 && player->getOperatingSystem() < CLIENTOS_OTCLIENT_LINUX; lootMessage << "Loot of " << getNameDescription() << ": " << corpseContainer->getContentDescription(collorMessage) << "."; auto suffix = corpseContainer->getAttribute(ItemAttribute_t::LOOTMESSAGE_SUFFIX); if (!suffix.empty()) {