From 47cb9ddb041e6108f9b2a11609d88bac14c8bf43 Mon Sep 17 00:00:00 2001 From: kokekanon <114332266+kokekanon@users.noreply.github.com> Date: Mon, 18 Nov 2024 19:14:44 -0300 Subject: [PATCH 01/16] fix: packet cyclopedia house auction Canary PR # 3022 last commits 26a2d60 "Merge branch 'main' into test-house" on Nov 12, 2024, 02:28 PM --- src/client/const.h | 21 ++++++ src/client/game.cpp | 8 ++ src/client/game.h | 1 + src/client/luafunctions.cpp | 1 + src/client/protocolcodes.h | 4 + src/client/protocolgame.h | 5 ++ src/client/protocolgameparse.cpp | 126 +++++++++++++++++++++++++++++++ src/client/protocolgamesend.cpp | 45 +++++++++++ 8 files changed, 211 insertions(+) diff --git a/src/client/const.h b/src/client/const.h index 66a82f1821..bdc9346622 100644 --- a/src/client/const.h +++ b/src/client/const.h @@ -739,6 +739,27 @@ namespace Otc SUPPLY_STASH_ACTION_WITHDRAW = 3 }; + enum CyclopediaHouseState_t : uint8_t + { + CYCLOPEDIA_HOUSE_STATE_AVAILABLE = 0, + // 1 ? + CYCLOPEDIA_HOUSE_STATE_RENTED = 2, + CYCLOPEDIA_HOUSE_STATE_TRANSFER = 3, + CYCLOPEDIA_HOUSE_STATE_MOVEOUT = 4, + }; + + enum CyclopediaHouseAuctionType_t : uint8_t + { + CYCLOPEDIA_HOUSE_TYPE_NONE = 0, + CYCLOPEDIA_HOUSE_TYPE_BID = 1, + CYCLOPEDIA_HOUSE_TYPE_MOVEOUT = 2, + CYCLOPEDIA_HOUSE_TYPE_TRANSFER = 3, + CYCLOPEDIA_HOUSE_TYPE_CANCEL_MOVEOUT = 4, + CYCLOPEDIA_HOUSE_TYPE_CANCEL_TRANSFER = 5, + CYCLOPEDIA_HOUSE_TYPE_ACCEPT_TRANSFER = 6, + CYCLOPEDIA_HOUSE_TYPE_REFECT_TRANSFER = 7, + }; + enum CyclopediaCharacterInfoType_t : uint8_t { CYCLOPEDIA_CHARACTERINFO_BASEINFORMATION = 0, diff --git a/src/client/game.cpp b/src/client/game.cpp index ce86500c48..3780288580 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -1915,6 +1915,14 @@ void Game::requestSendCharacterInfo(const uint32_t playerId, const Otc::Cycloped m_protocolGame->sendCyclopediaRequestCharacterInfo(playerId, characterInfoType, entriesPerPage, page); } +void Game::requestSendCyclopediaHouseAuction(const Otc::CyclopediaHouseAuctionType_t type, const uint32_t houseId, const uint32_t timestamp, const uint64_t bidValue, const std::string_view& name) +{ + if (!canPerformGameAction()) + return; + + m_protocolGame->sendCyclopediaHouseAuction(type, houseId, timestamp, bidValue, name); +} + void Game::requestBosstiaryInfo() { if (!canPerformGameAction()) diff --git a/src/client/game.h b/src/client/game.h index 500bbe0f87..d23f88e62b 100644 --- a/src/client/game.h +++ b/src/client/game.h @@ -786,6 +786,7 @@ class Game void requestBestiarySearch(const uint16_t raceId); void requestSendBuyCharmRune(const uint8_t runeId, const uint8_t action, const uint16_t raceId); void requestSendCharacterInfo(const uint32_t playerId, const Otc::CyclopediaCharacterInfoType_t characterInfoType, const uint16_t entriesPerPage = 0, const uint16_t page = 0); + void requestSendCyclopediaHouseAuction(const Otc::CyclopediaHouseAuctionType_t type, const uint32_t houseId, const uint32_t timestamp = 0, const uint64_t bidValue = 0, const std::string_view& name = ""); void requestBosstiaryInfo(); void requestBossSlootInfo(); void requestBossSlotAction(const uint8_t action, const uint32_t raceId); diff --git a/src/client/luafunctions.cpp b/src/client/luafunctions.cpp index abe843ad15..f992fda244 100644 --- a/src/client/luafunctions.cpp +++ b/src/client/luafunctions.cpp @@ -379,6 +379,7 @@ void Client::registerLuaFunctions() g_lua.bindSingletonFunction("g_game", "requestBossSlootInfo", &Game::requestBossSlootInfo, &g_game); g_lua.bindSingletonFunction("g_game", "requestBossSlotAction", &Game::requestBossSlotAction, &g_game); g_lua.bindSingletonFunction("g_game", "sendStatusTrackerBestiary", &Game::sendStatusTrackerBestiary, &g_game); + g_lua.bindSingletonFunction("g_game", "sendCyclopediaHouseAuction", &Game::requestSendCyclopediaHouseAuction, &g_game); g_lua.bindSingletonFunction("g_game", "getWalkTurnDelay", &Game::getWalkTurnDelay, &g_game); g_lua.bindSingletonFunction("g_game", "getWalkFirstStepDelay", &Game::getWalkFirstStepDelay, &g_game); diff --git a/src/client/protocolcodes.h b/src/client/protocolcodes.h index 46e0c0e88e..e9f3bdc989 100644 --- a/src/client/protocolcodes.h +++ b/src/client/protocolcodes.h @@ -169,6 +169,9 @@ namespace Proto GameServerFloorChangeUp = 190, GameServerFloorChangeDown = 191, GameServerLootContainers = 192, + GameServerCyclopediaHouseAuctionMessage = 195, + GameServerCyclopediaHousesInfo = 198, + GameServerCyclopediaHouseList = 199, GameServerChooseOutfit = 200, GameServerSendUpdateImpactTracker = 204, GameServerSendItemsPrice = 205, @@ -301,6 +304,7 @@ namespace Proto ClientOpenOwnChannel = 170, ClientInviteToOwnChannel = 171, ClientExcludeFromOwnChannel = 172, + ClientCyclopediaHouseAuction = 173, ClientBosstiaryRequestInfo = 174, ClientBosstiaryRequestSlotInfo = 175, ClientBosstiaryRequestSlotAction = 176, diff --git a/src/client/protocolgame.h b/src/client/protocolgame.h index 2444df2267..bc6648a740 100644 --- a/src/client/protocolgame.h +++ b/src/client/protocolgame.h @@ -141,6 +141,7 @@ class ProtocolGame : public Protocol void sendRequestBestiarySearch(const uint16_t raceId); void sendBuyCharmRune(const uint8_t runeId, const uint8_t action, const uint16_t raceId); void sendCyclopediaRequestCharacterInfo(const uint32_t playerId, const Otc::CyclopediaCharacterInfoType_t characterInfoType, const uint16_t entriesPerPage, const uint16_t page); + void sendCyclopediaHouseAuction(const Otc::CyclopediaHouseAuctionType_t type, const uint32_t houseId, const uint32_t timestamp, const uint64_t bidValue, const std::string_view& name); void sendRequestBosstiaryInfo(); void sendRequestBossSlootInfo(); void sendRequestBossSlotAction(const uint8_t action, const uint32_t raceId); @@ -293,6 +294,10 @@ class ProtocolGame : public Protocol void parseTaskHuntingData(const InputMessagePtr& msg); void parseExperienceTracker(const InputMessagePtr& msg); void parseLootContainers(const InputMessagePtr& msg); + void parseCyclopediaHouseAuctionMessage(const InputMessagePtr& msg); + void parseCyclopediaHousesInfo(const InputMessagePtr& msg); + void parseCyclopediaHouseList(const InputMessagePtr& msg); + void parseSupplyStash(const InputMessagePtr& msg); void parseSpecialContainer(const InputMessagePtr& msg); void parsePartyAnalyzer(const InputMessagePtr& msg); diff --git a/src/client/protocolgameparse.cpp b/src/client/protocolgameparse.cpp index caf257752f..1fdf5a96b8 100644 --- a/src/client/protocolgameparse.cpp +++ b/src/client/protocolgameparse.cpp @@ -431,6 +431,15 @@ void ProtocolGame::parseMessage(const InputMessagePtr& msg) case Proto::GameServerLootContainers: parseLootContainers(msg); break; + case Proto::GameServerCyclopediaHouseAuctionMessage: + parseCyclopediaHouseAuctionMessage(msg); + break; + case Proto::GameServerCyclopediaHousesInfo: + parseCyclopediaHousesInfo(msg); + break; + case Proto::GameServerCyclopediaHouseList: + parseCyclopediaHouseList(msg); + break; case Proto::GameServerChooseOutfit: parseOpenOutfitWindow(msg); break; @@ -3798,6 +3807,123 @@ void ProtocolGame::parseLootContainers(const InputMessagePtr& msg) g_lua.callGlobalField("g_game", "onQuickLootContainers", quickLootFallbackToMainContainer, lootList); } +void ProtocolGame::parseCyclopediaHouseAuctionMessage(const InputMessagePtr& msg) +{ + msg->getU32(); // houseId + const uint8_t typeValue = msg->getU8(); // typeValue + + if (typeValue == 1) { + msg->getU8(); // 0x00 + } + + msg->getU8(); // index + // TODO Lua // Otui +} + +void ProtocolGame::parseCyclopediaHousesInfo(const InputMessagePtr& msg) +{ + msg->getU32(); // houseClientId + msg->getU8(); // 0x00 + + msg->getU8(); // accountHouseCount + + msg->getU8(); // 0x00 + + msg->getU8(); // 3 + msg->getU8(); // 3 + + msg->getU8(); // 0x01 + + msg->getU8(); // 0x01 + msg->getU32(); // houseClientId + + const uint16_t size = msg->getU16(); // g_game().map.houses.getHouses() + + for (auto i = 0; i < size; ++i) { + msg->getU32(); // getClientId + } + // TODO Lua // Otui +} + +void ProtocolGame::parseCyclopediaHouseList(const InputMessagePtr& msg) +{ + const uint16_t housesCount = msg->getU16(); // housesCount + for (int i = 0; i < housesCount; ++i) { + msg->getU32(); // clientId + msg->getU8(); // 0x00 = Renovation, 0x01 = Available + const auto type = static_cast(msg->getU8()); + switch (type) { + + case Otc::CYCLOPEDIA_HOUSE_STATE_AVAILABLE: { + std::string_view bidderName = msg->getString(); + const bool isBidder = static_cast(msg->getU8()); + msg->getU8(); // disableIndex + + if (!bidderName.empty()) { + msg->getU32(); // bidEndDate + msg->getU64(); // highestBid + if (isBidder) { + msg->getU64(); // bidHolderLimit + } + } + break; + } + + case Otc::CYCLOPEDIA_HOUSE_STATE_RENTED: { + msg->getString(); // ownerName + msg->getU32(); // paidUntil + const bool isRented = static_cast(msg->getU8()); + if (isRented) { + msg->getU8(); // unknown + msg->getU8(); // unknown + } + break; + } + + case Otc::CYCLOPEDIA_HOUSE_STATE_TRANSFER: { + msg->getString(); // ownerName + msg->getU32(); // paidUntil + const bool isOwner = static_cast(msg->getU8()); + if (isOwner) { + msg->getU8(); // unknown + msg->getU8(); // unknown + } + msg->getU32(); // bidEndDate + msg->getString(); // bidderName + msg->getU8(); // unknown + msg->getU64(); // internalBid + + const bool isNewOwner = static_cast(msg->getU8()); + if (isNewOwner) { + msg->getU8(); // acceptTransferError + msg->getU8(); // rejectTransferError + } + + if (isOwner) { + msg->getU8(); // cancelTransferError + } + break; + } + + case Otc::CYCLOPEDIA_HOUSE_STATE_MOVEOUT: { + msg->getString(); // ownerName + msg->getU32(); // paidUntil + const bool isOwner = static_cast(msg->getU8()); + if (isOwner) { + msg->getU8(); // unknown + msg->getU8(); // unknown + msg->getU32(); // bidEndDate + msg->getU8(); // unknown + } else { + msg->getU32(); // bidEndDate + } + break; + } + } + } + // TODO Lua // Otui +} + void ProtocolGame::parseSupplyStash(const InputMessagePtr& msg) { const uint16_t itemsCount = msg->getU16(); diff --git a/src/client/protocolgamesend.cpp b/src/client/protocolgamesend.cpp index 3ab53739af..9db5fc61bf 100644 --- a/src/client/protocolgamesend.cpp +++ b/src/client/protocolgamesend.cpp @@ -1058,6 +1058,51 @@ void ProtocolGame::sendCyclopediaRequestCharacterInfo(const uint32_t playerId, c send(msg); } +void ProtocolGame::sendCyclopediaHouseAuction(const Otc::CyclopediaHouseAuctionType_t type, const uint32_t houseId, const uint32_t timestamp, const uint64_t bidValue, const std::string_view& name) +{ + const auto& msg = std::make_shared(); + msg->addU8(Proto::ClientCyclopediaHouseAuction); + msg->addU8(type); + + switch (type) { + case Otc::CYCLOPEDIA_HOUSE_TYPE_NONE: // enum class HouseAuctionType : uint8_t { ? + msg->addString(name); // townName + break; + + case Otc::CYCLOPEDIA_HOUSE_TYPE_BID: + msg->addU32(houseId); + msg->addU64(bidValue); + break; + + case Otc::CYCLOPEDIA_HOUSE_TYPE_MOVEOUT: + msg->addU32(houseId); + msg->addU32(timestamp); + break; + + case Otc::CYCLOPEDIA_HOUSE_TYPE_TRANSFER: + msg->addU32(houseId); + msg->addU32(timestamp); + msg->addString(name); // newOwner + msg->addU64(bidValue); + break; + + case Otc::CYCLOPEDIA_HOUSE_TYPE_CANCEL_MOVEOUT: + msg->addU32(houseId); + break; + case Otc::CYCLOPEDIA_HOUSE_TYPE_CANCEL_TRANSFER: + msg->addU32(houseId); + break; + case Otc::CYCLOPEDIA_HOUSE_TYPE_ACCEPT_TRANSFER: + msg->addU32(houseId); + break; + case Otc::CYCLOPEDIA_HOUSE_TYPE_REFECT_TRANSFER: + msg->addU32(houseId); + break; + } + + send(msg); +} + void ProtocolGame::sendRequestBosstiaryInfo() { const auto& msg = std::make_shared(); From 06a34a3a79a7f453548ddac11835ccce6cfc2985 Mon Sep 17 00:00:00 2001 From: kokekanon <114332266+kokekanon@users.noreply.github.com> Date: Mon, 18 Nov 2024 19:53:06 -0300 Subject: [PATCH 02/16] fix: Sonarbot string_view to string --- src/client/protocolgameparse.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/protocolgameparse.cpp b/src/client/protocolgameparse.cpp index 1fdf5a96b8..e08c958d76 100644 --- a/src/client/protocolgameparse.cpp +++ b/src/client/protocolgameparse.cpp @@ -3855,7 +3855,7 @@ void ProtocolGame::parseCyclopediaHouseList(const InputMessagePtr& msg) switch (type) { case Otc::CYCLOPEDIA_HOUSE_STATE_AVAILABLE: { - std::string_view bidderName = msg->getString(); + std::string bidderName = msg->getString(); const bool isBidder = static_cast(msg->getU8()); msg->getU8(); // disableIndex From c58eb8fb72c546d0cd494548366cafab11af5b4b Mon Sep 17 00:00:00 2001 From: kokekanon <114332266+kokekanon@users.noreply.github.com> Date: Mon, 18 Nov 2024 22:23:42 -0300 Subject: [PATCH 03/16] fix: sonar (Auto | Use the init-statement to declare "isOwner" inside the if statement.) -Use the init-statement to declare "isOwner" inside the if statement. --- src/client/protocolgameparse.cpp | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/client/protocolgameparse.cpp b/src/client/protocolgameparse.cpp index e08c958d76..c48b778ab2 100644 --- a/src/client/protocolgameparse.cpp +++ b/src/client/protocolgameparse.cpp @@ -3810,14 +3810,11 @@ void ProtocolGame::parseLootContainers(const InputMessagePtr& msg) void ProtocolGame::parseCyclopediaHouseAuctionMessage(const InputMessagePtr& msg) { msg->getU32(); // houseId - const uint8_t typeValue = msg->getU8(); // typeValue - - if (typeValue == 1) { + if (const uint8_t typeValue = msg->getU8(); typeValue == 1) { msg->getU8(); // 0x00 } - msg->getU8(); // index - // TODO Lua // Otui + // TO-DO Lua - Otui } void ProtocolGame::parseCyclopediaHousesInfo(const InputMessagePtr& msg) @@ -3842,7 +3839,7 @@ void ProtocolGame::parseCyclopediaHousesInfo(const InputMessagePtr& msg) for (auto i = 0; i < size; ++i) { msg->getU32(); // getClientId } - // TODO Lua // Otui + // TO-DO Lua // Otui } void ProtocolGame::parseCyclopediaHouseList(const InputMessagePtr& msg) @@ -3856,7 +3853,7 @@ void ProtocolGame::parseCyclopediaHouseList(const InputMessagePtr& msg) case Otc::CYCLOPEDIA_HOUSE_STATE_AVAILABLE: { std::string bidderName = msg->getString(); - const bool isBidder = static_cast(msg->getU8()); + const auto isBidder = static_cast(msg->getU8()); msg->getU8(); // disableIndex if (!bidderName.empty()) { @@ -3872,7 +3869,7 @@ void ProtocolGame::parseCyclopediaHouseList(const InputMessagePtr& msg) case Otc::CYCLOPEDIA_HOUSE_STATE_RENTED: { msg->getString(); // ownerName msg->getU32(); // paidUntil - const bool isRented = static_cast(msg->getU8()); + const auto isRented = static_cast(msg->getU8()); if (isRented) { msg->getU8(); // unknown msg->getU8(); // unknown @@ -3883,7 +3880,7 @@ void ProtocolGame::parseCyclopediaHouseList(const InputMessagePtr& msg) case Otc::CYCLOPEDIA_HOUSE_STATE_TRANSFER: { msg->getString(); // ownerName msg->getU32(); // paidUntil - const bool isOwner = static_cast(msg->getU8()); + const auto isOwner = static_cast(msg->getU8()); if (isOwner) { msg->getU8(); // unknown msg->getU8(); // unknown @@ -3893,8 +3890,7 @@ void ProtocolGame::parseCyclopediaHouseList(const InputMessagePtr& msg) msg->getU8(); // unknown msg->getU64(); // internalBid - const bool isNewOwner = static_cast(msg->getU8()); - if (isNewOwner) { + if (const auto isNewOwner = static_cast(msg->getU8()); isNewOwner) { msg->getU8(); // acceptTransferError msg->getU8(); // rejectTransferError } @@ -3908,8 +3904,8 @@ void ProtocolGame::parseCyclopediaHouseList(const InputMessagePtr& msg) case Otc::CYCLOPEDIA_HOUSE_STATE_MOVEOUT: { msg->getString(); // ownerName msg->getU32(); // paidUntil - const bool isOwner = static_cast(msg->getU8()); - if (isOwner) { + + if (const auto isOwner = static_cast(msg->getU8()); isOwner) { msg->getU8(); // unknown msg->getU8(); // unknown msg->getU32(); // bidEndDate @@ -3917,11 +3913,12 @@ void ProtocolGame::parseCyclopediaHouseList(const InputMessagePtr& msg) } else { msg->getU32(); // bidEndDate } + break; } } } - // TODO Lua // Otui + // TO-DO Lua - Otui } void ProtocolGame::parseSupplyStash(const InputMessagePtr& msg) From 6ec2fe1c4bbd699e7efe1164bcf7d84e67f6e769 Mon Sep 17 00:00:00 2001 From: kokekanon <114332266+kokekanon@users.noreply.github.com> Date: Mon, 18 Nov 2024 22:36:04 -0300 Subject: [PATCH 04/16] fix: sonar Use the init-statement to declare "isRented" inside the if statement. --- src/client/protocolgameparse.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/protocolgameparse.cpp b/src/client/protocolgameparse.cpp index c48b778ab2..96d20fc157 100644 --- a/src/client/protocolgameparse.cpp +++ b/src/client/protocolgameparse.cpp @@ -3869,8 +3869,8 @@ void ProtocolGame::parseCyclopediaHouseList(const InputMessagePtr& msg) case Otc::CYCLOPEDIA_HOUSE_STATE_RENTED: { msg->getString(); // ownerName msg->getU32(); // paidUntil - const auto isRented = static_cast(msg->getU8()); - if (isRented) { + + if (const auto isRented = static_cast(msg->getU8()); isRented) { msg->getU8(); // unknown msg->getU8(); // unknown } From 48c964553282bb357fa4e8379f93fd150f32d4f2 Mon Sep 17 00:00:00 2001 From: kokekanon <114332266+kokekanon@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:10:06 -0300 Subject: [PATCH 05/16] Update src/client/protocolgame.h Co-authored-by: Luan Luciano --- src/client/protocolgame.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/protocolgame.h b/src/client/protocolgame.h index 5077db5c38..e41980e8df 100644 --- a/src/client/protocolgame.h +++ b/src/client/protocolgame.h @@ -141,7 +141,7 @@ class ProtocolGame : public Protocol void sendRequestBestiarySearch(const uint16_t raceId); void sendBuyCharmRune(const uint8_t runeId, const uint8_t action, const uint16_t raceId); void sendCyclopediaRequestCharacterInfo(const uint32_t playerId, const Otc::CyclopediaCharacterInfoType_t characterInfoType, const uint16_t entriesPerPage, const uint16_t page); - void sendCyclopediaHouseAuction(const Otc::CyclopediaHouseAuctionType_t type, const uint32_t houseId, const uint32_t timestamp, const uint64_t bidValue, const std::string_view& name); + void sendCyclopediaHouseAuction(const Otc::CyclopediaHouseAuctionType_t type, const uint32_t houseId, const uint32_t timestamp, const uint64_t bidValue, const std::string_view name); void sendRequestBosstiaryInfo(); void sendRequestBossSlootInfo(); void sendRequestBossSlotAction(const uint8_t action, const uint32_t raceId); From 79fd22208baa851d202daec02a816c3d8db08645 Mon Sep 17 00:00:00 2001 From: kokekanon <114332266+kokekanon@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:10:18 -0300 Subject: [PATCH 06/16] Update src/client/game.cpp Co-authored-by: Luan Luciano --- src/client/game.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/game.cpp b/src/client/game.cpp index 3780288580..f33cb050fe 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -1915,7 +1915,7 @@ void Game::requestSendCharacterInfo(const uint32_t playerId, const Otc::Cycloped m_protocolGame->sendCyclopediaRequestCharacterInfo(playerId, characterInfoType, entriesPerPage, page); } -void Game::requestSendCyclopediaHouseAuction(const Otc::CyclopediaHouseAuctionType_t type, const uint32_t houseId, const uint32_t timestamp, const uint64_t bidValue, const std::string_view& name) +void Game::requestSendCyclopediaHouseAuction(const Otc::CyclopediaHouseAuctionType_t type, const uint32_t houseId, const uint32_t timestamp, const uint64_t bidValue, const std::string_view name) { if (!canPerformGameAction()) return; From d6bcada91f2e2eee25423a1574f93b74a3cdab71 Mon Sep 17 00:00:00 2001 From: kokekanon <114332266+kokekanon@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:10:27 -0300 Subject: [PATCH 07/16] Update src/client/game.h Co-authored-by: Luan Luciano --- src/client/game.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/game.h b/src/client/game.h index d23f88e62b..e1fbc0d9cd 100644 --- a/src/client/game.h +++ b/src/client/game.h @@ -786,7 +786,7 @@ class Game void requestBestiarySearch(const uint16_t raceId); void requestSendBuyCharmRune(const uint8_t runeId, const uint8_t action, const uint16_t raceId); void requestSendCharacterInfo(const uint32_t playerId, const Otc::CyclopediaCharacterInfoType_t characterInfoType, const uint16_t entriesPerPage = 0, const uint16_t page = 0); - void requestSendCyclopediaHouseAuction(const Otc::CyclopediaHouseAuctionType_t type, const uint32_t houseId, const uint32_t timestamp = 0, const uint64_t bidValue = 0, const std::string_view& name = ""); + void requestSendCyclopediaHouseAuction(const Otc::CyclopediaHouseAuctionType_t type, const uint32_t houseId, const uint32_t timestamp = 0, const uint64_t bidValue = 0, const std::string_view name = ""); void requestBosstiaryInfo(); void requestBossSlootInfo(); void requestBossSlotAction(const uint8_t action, const uint32_t raceId); From 7d4df98d1711bb3bdb2f9e79fadae94af2ac3cd5 Mon Sep 17 00:00:00 2001 From: kokekanon <114332266+kokekanon@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:11:04 -0300 Subject: [PATCH 08/16] Update src/client/protocolgameparse.cpp Co-authored-by: Luan Luciano --- src/client/protocolgameparse.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/client/protocolgameparse.cpp b/src/client/protocolgameparse.cpp index 9ec205f108..ccf2bcf3ed 100644 --- a/src/client/protocolgameparse.cpp +++ b/src/client/protocolgameparse.cpp @@ -3829,9 +3829,8 @@ void ProtocolGame::parseCyclopediaHousesInfo(const InputMessagePtr& msg) msg->getU8(); // 0x01 msg->getU32(); // houseClientId - const uint16_t size = msg->getU16(); // g_game().map.houses.getHouses() - - for (auto i = 0; i < size; ++i) { + const uint16_t housesList = msg->getU16(); // g_game().map.houses.getHouses() + for (auto i = 0; i < housesList; ++i) { msg->getU32(); // getClientId } // TO-DO Lua // Otui From 55f6a1e296e22ae783eb6d4381a73ace3a65226d Mon Sep 17 00:00:00 2001 From: kokekanon <114332266+kokekanon@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:17:14 -0300 Subject: [PATCH 09/16] Update src/client/protocolgameparse.cpp Co-authored-by: Luan Luciano --- src/client/protocolgameparse.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/client/protocolgameparse.cpp b/src/client/protocolgameparse.cpp index ccf2bcf3ed..4a54b6a5c4 100644 --- a/src/client/protocolgameparse.cpp +++ b/src/client/protocolgameparse.cpp @@ -3839,12 +3839,12 @@ void ProtocolGame::parseCyclopediaHousesInfo(const InputMessagePtr& msg) void ProtocolGame::parseCyclopediaHouseList(const InputMessagePtr& msg) { const uint16_t housesCount = msg->getU16(); // housesCount - for (int i = 0; i < housesCount; ++i) { + for (auto i = 0; i < housesCount; ++i) { msg->getU32(); // clientId msg->getU8(); // 0x00 = Renovation, 0x01 = Available + const auto type = static_cast(msg->getU8()); switch (type) { - case Otc::CYCLOPEDIA_HOUSE_STATE_AVAILABLE: { std::string bidderName = msg->getString(); const auto isBidder = static_cast(msg->getU8()); @@ -3859,18 +3859,17 @@ void ProtocolGame::parseCyclopediaHouseList(const InputMessagePtr& msg) } break; } - case Otc::CYCLOPEDIA_HOUSE_STATE_RENTED: { msg->getString(); // ownerName msg->getU32(); // paidUntil - - if (const auto isRented = static_cast(msg->getU8()); isRented) { + + const auto isRented = static_cast(msg->getU8()); + if (isRented) { msg->getU8(); // unknown msg->getU8(); // unknown } break; } - case Otc::CYCLOPEDIA_HOUSE_STATE_TRANSFER: { msg->getString(); // ownerName msg->getU32(); // paidUntil @@ -3883,8 +3882,9 @@ void ProtocolGame::parseCyclopediaHouseList(const InputMessagePtr& msg) msg->getString(); // bidderName msg->getU8(); // unknown msg->getU64(); // internalBid - - if (const auto isNewOwner = static_cast(msg->getU8()); isNewOwner) { + + const auto isNewOwner = static_cast(msg->getU8()); + if (isNewOwner) { msg->getU8(); // acceptTransferError msg->getU8(); // rejectTransferError } @@ -3894,12 +3894,12 @@ void ProtocolGame::parseCyclopediaHouseList(const InputMessagePtr& msg) } break; } - case Otc::CYCLOPEDIA_HOUSE_STATE_MOVEOUT: { msg->getString(); // ownerName msg->getU32(); // paidUntil - if (const auto isOwner = static_cast(msg->getU8()); isOwner) { + const auto isOwner = static_cast(msg->getU8()); + if (isOwner) { msg->getU8(); // unknown msg->getU8(); // unknown msg->getU32(); // bidEndDate From 793c2d4717f518561f1ac3e1cbd3bd987c359474 Mon Sep 17 00:00:00 2001 From: kokekanon <114332266+kokekanon@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:17:24 -0300 Subject: [PATCH 10/16] Update src/client/protocolgamesend.cpp Co-authored-by: Luan Luciano --- src/client/protocolgamesend.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/protocolgamesend.cpp b/src/client/protocolgamesend.cpp index 9db5fc61bf..ebba3b07b7 100644 --- a/src/client/protocolgamesend.cpp +++ b/src/client/protocolgamesend.cpp @@ -1058,7 +1058,7 @@ void ProtocolGame::sendCyclopediaRequestCharacterInfo(const uint32_t playerId, c send(msg); } -void ProtocolGame::sendCyclopediaHouseAuction(const Otc::CyclopediaHouseAuctionType_t type, const uint32_t houseId, const uint32_t timestamp, const uint64_t bidValue, const std::string_view& name) +void ProtocolGame::sendCyclopediaHouseAuction(const Otc::CyclopediaHouseAuctionType_t type, const uint32_t houseId, const uint32_t timestamp, const uint64_t bidValue, const std::string_view name) { const auto& msg = std::make_shared(); msg->addU8(Proto::ClientCyclopediaHouseAuction); From b9e17888d46034bff01ad555362efcf9849f88c1 Mon Sep 17 00:00:00 2001 From: kokekanon <114332266+kokekanon@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:17:39 -0300 Subject: [PATCH 11/16] Update src/client/protocolgamesend.cpp Co-authored-by: Luan Luciano --- src/client/protocolgamesend.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/client/protocolgamesend.cpp b/src/client/protocolgamesend.cpp index ebba3b07b7..c354b54782 100644 --- a/src/client/protocolgamesend.cpp +++ b/src/client/protocolgamesend.cpp @@ -1085,7 +1085,6 @@ void ProtocolGame::sendCyclopediaHouseAuction(const Otc::CyclopediaHouseAuctionT msg->addString(name); // newOwner msg->addU64(bidValue); break; - case Otc::CYCLOPEDIA_HOUSE_TYPE_CANCEL_MOVEOUT: msg->addU32(houseId); break; From e41f07da37641f0f51a1b7b8c1720f620bcba719 Mon Sep 17 00:00:00 2001 From: kokekanon <114332266+kokekanon@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:17:49 -0300 Subject: [PATCH 12/16] Update src/client/protocolgamesend.cpp Co-authored-by: Luan Luciano --- src/client/protocolgamesend.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/client/protocolgamesend.cpp b/src/client/protocolgamesend.cpp index c354b54782..4ec60f9cdc 100644 --- a/src/client/protocolgamesend.cpp +++ b/src/client/protocolgamesend.cpp @@ -1068,7 +1068,6 @@ void ProtocolGame::sendCyclopediaHouseAuction(const Otc::CyclopediaHouseAuctionT case Otc::CYCLOPEDIA_HOUSE_TYPE_NONE: // enum class HouseAuctionType : uint8_t { ? msg->addString(name); // townName break; - case Otc::CYCLOPEDIA_HOUSE_TYPE_BID: msg->addU32(houseId); msg->addU64(bidValue); From f5e8b4025ebe2c5a26b0dc5b1a7b5d15d6337324 Mon Sep 17 00:00:00 2001 From: kokekanon <114332266+kokekanon@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:17:54 -0300 Subject: [PATCH 13/16] Update src/client/protocolgamesend.cpp Co-authored-by: Luan Luciano --- src/client/protocolgamesend.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/client/protocolgamesend.cpp b/src/client/protocolgamesend.cpp index 4ec60f9cdc..b343686ab5 100644 --- a/src/client/protocolgamesend.cpp +++ b/src/client/protocolgamesend.cpp @@ -1072,7 +1072,6 @@ void ProtocolGame::sendCyclopediaHouseAuction(const Otc::CyclopediaHouseAuctionT msg->addU32(houseId); msg->addU64(bidValue); break; - case Otc::CYCLOPEDIA_HOUSE_TYPE_MOVEOUT: msg->addU32(houseId); msg->addU32(timestamp); From 2149b6f556388a122b92d4a73a75f38174fe31e6 Mon Sep 17 00:00:00 2001 From: kokekanon <114332266+kokekanon@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:17:59 -0300 Subject: [PATCH 14/16] Update src/client/protocolgamesend.cpp Co-authored-by: Luan Luciano --- src/client/protocolgamesend.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/client/protocolgamesend.cpp b/src/client/protocolgamesend.cpp index b343686ab5..57240df54e 100644 --- a/src/client/protocolgamesend.cpp +++ b/src/client/protocolgamesend.cpp @@ -1076,7 +1076,6 @@ void ProtocolGame::sendCyclopediaHouseAuction(const Otc::CyclopediaHouseAuctionT msg->addU32(houseId); msg->addU32(timestamp); break; - case Otc::CYCLOPEDIA_HOUSE_TYPE_TRANSFER: msg->addU32(houseId); msg->addU32(timestamp); From 8fa02197e1c7677457454b29672425dfeac99845 Mon Sep 17 00:00:00 2001 From: kokekanon <114332266+kokekanon@users.noreply.github.com> Date: Tue, 31 Dec 2024 15:46:47 -0300 Subject: [PATCH 15/16] Update src/client/protocolgameparse.cpp Co-authored-by: Luan Luciano --- src/client/protocolgameparse.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client/protocolgameparse.cpp b/src/client/protocolgameparse.cpp index a30e1a1f4f..4604e0fe31 100644 --- a/src/client/protocolgameparse.cpp +++ b/src/client/protocolgameparse.cpp @@ -3801,7 +3801,8 @@ void ProtocolGame::parseLootContainers(const InputMessagePtr& msg) void ProtocolGame::parseCyclopediaHouseAuctionMessage(const InputMessagePtr& msg) { msg->getU32(); // houseId - if (const uint8_t typeValue = msg->getU8(); typeValue == 1) { + const uint8_t typeValue = msg->getU8(); + if (typeValue == 1) { msg->getU8(); // 0x00 } msg->getU8(); // index From 005111a4f7c46eb76145b242af85c89099ffda09 Mon Sep 17 00:00:00 2001 From: kokekanon <114332266+kokekanon@users.noreply.github.com> Date: Tue, 31 Dec 2024 15:54:17 -0300 Subject: [PATCH 16/16] Update protocolgamesend.cpp --- src/client/protocolgamesend.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/protocolgamesend.cpp b/src/client/protocolgamesend.cpp index 8016066d52..9a93dd66ae 100644 --- a/src/client/protocolgamesend.cpp +++ b/src/client/protocolgamesend.cpp @@ -1063,7 +1063,7 @@ void ProtocolGame::sendCyclopediaHouseAuction(const Otc::CyclopediaHouseAuctionT msg->addU8(type); switch (type) { - case Otc::CYCLOPEDIA_HOUSE_TYPE_NONE: // enum class HouseAuctionType : uint8_t { ? + case Otc::CYCLOPEDIA_HOUSE_TYPE_NONE: msg->addString(name); // townName break; case Otc::CYCLOPEDIA_HOUSE_TYPE_BID: