diff --git a/include/game/game_handler.hpp b/include/game/game_handler.hpp index 67e88844..24cbd3e6 100644 --- a/include/game/game_handler.hpp +++ b/include/game/game_handler.hpp @@ -1800,7 +1800,7 @@ public: const std::string& getFactionNamePublic(uint32_t factionId) const; uint32_t getWatchedFactionId() const { return watchedFactionId_; } - void setWatchedFactionId(uint32_t id) { watchedFactionId_ = id; } + void setWatchedFactionId(uint32_t factionId); uint32_t getLastContactListMask() const { return lastContactListMask_; } uint32_t getLastContactListCount() const { return lastContactListCount_; } bool isServerMovementAllowed() const { return serverMovementAllowed_; } diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index e542dbca..65e9350b 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -25737,6 +25737,21 @@ uint32_t GameHandler::getRepListIdByFactionId(uint32_t factionId) const { return (it != factionIdToRepList_.end()) ? it->second : 0xFFFFFFFFu; } +void GameHandler::setWatchedFactionId(uint32_t factionId) { + watchedFactionId_ = factionId; + if (state != WorldState::IN_WORLD || !socket) return; + // CMSG_SET_WATCHED_FACTION: int32 repListId (-1 = unwatch) + int32_t repListId = -1; + if (factionId != 0) { + uint32_t rl = getRepListIdByFactionId(factionId); + if (rl != 0xFFFFFFFFu) repListId = static_cast(rl); + } + network::Packet pkt(wireOpcode(Opcode::CMSG_SET_WATCHED_FACTION)); + pkt.writeUInt32(static_cast(repListId)); + socket->send(pkt); + LOG_DEBUG("CMSG_SET_WATCHED_FACTION: repListId=", repListId, " (factionId=", factionId, ")"); +} + std::string GameHandler::getFactionName(uint32_t factionId) const { auto it = factionNameCache_.find(factionId); if (it != factionNameCache_.end()) return it->second;