diff --git a/dGame/dGameMessages/GameMessageHandler.cpp b/dGame/dGameMessages/GameMessageHandler.cpp index 261a3105..53cce60e 100644 --- a/dGame/dGameMessages/GameMessageHandler.cpp +++ b/dGame/dGameMessages/GameMessageHandler.cpp @@ -30,7 +30,7 @@ using namespace std; void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const SystemAddress& sysAddr, LWOOBJID objectID, GAME_MSG messageID) { - + CBITSTREAM // Get the entity @@ -38,19 +38,19 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System User * usr = UserManager::Instance()->GetUser(sysAddr); - if (!entity) - { + if (!entity) + { Game::logger->Log("GameMessageHandler", "Failed to find associated entity (%llu), aborting GM (%X)!\n", objectID, messageID); - return; - } + return; + } - switch (messageID) { + switch (messageID) { - case GAME_MSG_PLAY_EMOTE: { - GameMessages::HandlePlayEmote(inStream, entity); - break; - } + case GAME_MSG_PLAY_EMOTE: { + GameMessages::HandlePlayEmote(inStream, entity); + break; + } case GAME_MSG_MOVE_ITEM_IN_INVENTORY: { GameMessages::HandleMoveItemInInventory(inStream, entity); @@ -69,27 +69,27 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System case GAME_MSG_UN_EQUIP_ITEM: GameMessages::HandleUnequipItem(inStream, entity); break; - - case GAME_MSG_RESPOND_TO_MISSION: { - GameMessages::HandleRespondToMission(inStream, entity); - break; - } - - case GAME_MSG_REQUEST_USE: { - GameMessages::HandleRequestUse(inStream, entity, sysAddr); - break; - } - - case GAME_MSG_SET_FLAG: { - GameMessages::HandleSetFlag(inStream, entity); - break; - } - - case GAME_MSG_HAS_BEEN_COLLECTED: { - GameMessages::HandleHasBeenCollected(inStream, entity); - break; - } - + + case GAME_MSG_RESPOND_TO_MISSION: { + GameMessages::HandleRespondToMission(inStream, entity); + break; + } + + case GAME_MSG_REQUEST_USE: { + GameMessages::HandleRequestUse(inStream, entity, sysAddr); + break; + } + + case GAME_MSG_SET_FLAG: { + GameMessages::HandleSetFlag(inStream, entity); + break; + } + + case GAME_MSG_HAS_BEEN_COLLECTED: { + GameMessages::HandleHasBeenCollected(inStream, entity); + break; + } + case GAME_MSG_PLAYER_LOADED: { GameMessages::SendRestoreToPostLoadStats(entity, sysAddr); entity->SetPlayerReadyForUpdates(); @@ -160,57 +160,57 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System Game::logger->Log("GameMessageHandler", "Player %s (%llu) loaded.\n", entity->GetCharacter()->GetName().c_str(), entity->GetObjectID()); // After we've done our thing, tell the client they're ready - GameMessages::SendPlayerReady(dZoneManager::Instance()->GetZoneControlObject(), sysAddr); - GameMessages::SendPlayerReady(entity, sysAddr); + GameMessages::SendPlayerReady(dZoneManager::Instance()->GetZoneControlObject(), sysAddr); + GameMessages::SendPlayerReady(entity, sysAddr); - break; - } - - case GAME_MSG_REQUEST_LINKED_MISSION: { - GameMessages::HandleRequestLinkedMission(inStream, entity); - break; - } - - case GAME_MSG_MISSION_DIALOGUE_OK: { - GameMessages::HandleMissionDialogOK(inStream, entity); - break; - } + break; + } + + case GAME_MSG_REQUEST_LINKED_MISSION: { + GameMessages::HandleRequestLinkedMission(inStream, entity); + break; + } + + case GAME_MSG_MISSION_DIALOGUE_OK: { + GameMessages::HandleMissionDialogOK(inStream, entity); + break; + } case GAME_MSG_MISSION_DIALOGUE_CANCELLED: { //This message is pointless for our implementation, as the client just carries on after //rejecting a mission offer. We dont need to do anything. This is just here to remove a warning in our logs :) break; } - - case GAME_MSG_REQUEST_PLATFORM_RESYNC: { - GameMessages::HandleRequestPlatformResync(inStream, entity, sysAddr); - break; - } - - case GAME_MSG_FIRE_EVENT_SERVER_SIDE: { + + case GAME_MSG_REQUEST_PLATFORM_RESYNC: { + GameMessages::HandleRequestPlatformResync(inStream, entity, sysAddr); + break; + } + + case GAME_MSG_FIRE_EVENT_SERVER_SIDE: { GameMessages::HandleFireEventServerSide(inStream, entity, sysAddr); - break; - } + break; + } - case GAME_MSG_SEND_ACTIVITY_SUMMARY_LEADERBOARD_DATA: { - GameMessages::HandleActivitySummaryLeaderboardData(inStream, entity, sysAddr); - break; - } + case GAME_MSG_SEND_ACTIVITY_SUMMARY_LEADERBOARD_DATA: { + GameMessages::HandleActivitySummaryLeaderboardData(inStream, entity, sysAddr); + break; + } - case GAME_MSG_REQUEST_ACTIVITY_SUMMARY_LEADERBOARD_DATA: { - GameMessages::HandleRequestActivitySummaryLeaderboardData(inStream, entity, sysAddr); - break; - } + case GAME_MSG_REQUEST_ACTIVITY_SUMMARY_LEADERBOARD_DATA: { + GameMessages::HandleRequestActivitySummaryLeaderboardData(inStream, entity, sysAddr); + break; + } - case GAME_MSG_ACTIVITY_STATE_CHANGE_REQUEST: { - GameMessages::HandleActivityStateChangeRequest(inStream, entity); - break; - } - - case GAME_MSG_PARSE_CHAT_MESSAGE: { - GameMessages::HandleParseChatMessage(inStream, entity, sysAddr); - break; - } + case GAME_MSG_ACTIVITY_STATE_CHANGE_REQUEST: { + GameMessages::HandleActivityStateChangeRequest(inStream, entity); + break; + } + + case GAME_MSG_PARSE_CHAT_MESSAGE: { + GameMessages::HandleParseChatMessage(inStream, entity, sysAddr); + break; + } case GAME_MSG_NOTIFY_SERVER_LEVEL_PROCESSING_COMPLETE: { GameMessages::HandleNotifyServerLevelProcessingComplete(inStream, entity); @@ -228,8 +228,8 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System } case GAME_MSG_RESURRECT: { - GameMessages::HandleResurrect(inStream, entity); - break; + GameMessages::HandleResurrect(inStream, entity); + break; } case GAME_MSG_REQUEST_RESURRECT: { @@ -243,10 +243,14 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System }*/ break; } + case GAME_MSG_HANDLE_HOT_PROPERTY_DATA: { + GameMessages::HandleGetHotPropertyData(inStream, entity, sysAddr); + break; + } - case GAME_MSG_REQUEST_SERVER_PROJECTILE_IMPACT: - { - auto message = GameMessages::RequestServerProjectileImpact(); + case GAME_MSG_REQUEST_SERVER_PROJECTILE_IMPACT: + { + auto message = GameMessages::RequestServerProjectileImpact(); message.Deserialize(inStream); @@ -260,10 +264,10 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System delete bs; } - - break; - } - + + break; + } + case GAME_MSG_START_SKILL: { GameMessages::StartSkill startSkill = GameMessages::StartSkill(); startSkill.Deserialize(inStream); // inStream replaces &bitStream @@ -279,7 +283,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System unsigned int behaviorId = skillTable->GetSkillByID(startSkill.skillID).behaviorID; bool success = false; - + if (behaviorId > 0) { RakNet::BitStream * bs = new RakNet::BitStream((unsigned char *)startSkill.sBitStream.c_str(), startSkill.sBitStream.size(), false); @@ -374,7 +378,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System case GAME_MSG_MODULAR_BUILD_FINISH: GameMessages::HandleModularBuildFinish(inStream, entity, sysAddr); break; - + case GAME_MSG_PUSH_EQUIPPED_ITEMS_STATE: GameMessages::HandlePushEquippedItemsState(inStream, entity); break; @@ -486,7 +490,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System GameMessages::HandleChoiceBoxRespond(inStream, entity, sysAddr); break; - // Property + // Property case GAME_MSG_QUERY_PROPERTY_DATA: GameMessages::HandleQueryPropertyData(inStream, entity, sysAddr); break; @@ -531,7 +535,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System GameMessages::HandleBBBLoadItemRequest(inStream, entity, sysAddr); break; - case GAME_MSG_BBB_SAVE_REQUEST: + case GAME_MSG_BBB_SAVE_REQUEST: GameMessages::HandleBBBSaveRequest(inStream, entity, sysAddr); break; @@ -554,7 +558,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System case GAME_MSG_UPDATE_PROPERTY_OR_MODEL_FOR_FILTER_CHECK: GameMessages::HandleUpdatePropertyOrModelForFilterCheck(inStream, entity, sysAddr); break; - + case GAME_MSG_SET_PROPERTY_ACCESS: GameMessages::HandleSetPropertyAccess(inStream, entity, sysAddr); break; @@ -620,41 +624,41 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System GameMessages::HandleSetGhostReferencePosition(inStream, entity, sysAddr); break; - case GAME_MSG_READY_FOR_UPDATES: - //We don't really care about this message, as it's simply here to inform us that the client is done loading an object. - //In the event we _do_ send an update to an object that hasn't finished loading, the client will handle it anyway. - break; + case GAME_MSG_READY_FOR_UPDATES: + //We don't really care about this message, as it's simply here to inform us that the client is done loading an object. + //In the event we _do_ send an update to an object that hasn't finished loading, the client will handle it anyway. + break; case GAME_MSG_REPORT_BUG: GameMessages::HandleReportBug(inStream, entity); break; - case GAME_MSG_CLIENT_RAIL_MOVEMENT_READY: - GameMessages::HandleClientRailMovementReady(inStream, entity, sysAddr); - break; - - case GAME_MSG_CANCEL_RAIL_MOVEMENT: - GameMessages::HandleCancelRailMovement(inStream, entity, sysAddr); - break; - - case GAME_MSG_PLAYER_RAIL_ARRIVED_NOTIFICATION: - GameMessages::HandlePlayerRailArrivedNotification(inStream, entity, sysAddr); - break; - - case GAME_MSG_CINEMATIC_UPDATE: - GameMessages::HandleCinematicUpdate(inStream, entity, sysAddr); - break; - - case GAME_MSG_MODIFY_PLAYER_ZONE_STATISTIC: - GameMessages::HandleModifyPlayerZoneStatistic(inStream, entity); - break; - - case GAME_MSG_UPDATE_PLAYER_STATISTIC: - GameMessages::HandleUpdatePlayerStatistic(inStream, entity); - break; - - default: - //Game::logger->Log("GameMessageHandler", "Unknown game message ID: %X\n", messageID); + case GAME_MSG_CLIENT_RAIL_MOVEMENT_READY: + GameMessages::HandleClientRailMovementReady(inStream, entity, sysAddr); break; - } + + case GAME_MSG_CANCEL_RAIL_MOVEMENT: + GameMessages::HandleCancelRailMovement(inStream, entity, sysAddr); + break; + + case GAME_MSG_PLAYER_RAIL_ARRIVED_NOTIFICATION: + GameMessages::HandlePlayerRailArrivedNotification(inStream, entity, sysAddr); + break; + + case GAME_MSG_CINEMATIC_UPDATE: + GameMessages::HandleCinematicUpdate(inStream, entity, sysAddr); + break; + + case GAME_MSG_MODIFY_PLAYER_ZONE_STATISTIC: + GameMessages::HandleModifyPlayerZoneStatistic(inStream, entity); + break; + + case GAME_MSG_UPDATE_PLAYER_STATISTIC: + GameMessages::HandleUpdatePlayerStatistic(inStream, entity); + break; + + default: + //Game::logger->Log("GameMessageHandler", "Unknown game message ID: %X\n", messageID); + break; + } } diff --git a/dGame/dGameMessages/GameMessages.cpp b/dGame/dGameMessages/GameMessages.cpp index a971b723..2f193170 100644 --- a/dGame/dGameMessages/GameMessages.cpp +++ b/dGame/dGameMessages/GameMessages.cpp @@ -170,14 +170,14 @@ void GameMessages::SendPlayerReady(Entity* entity, const SystemAddress& sysAddr) } void GameMessages::SendPlayerAllowedRespawn(LWOOBJID entityID, bool doNotPromptRespawn, const SystemAddress &sysAddr) { - CBITSTREAM - CMSGHEADER; + CBITSTREAM + CMSGHEADER; - bitStream.Write(entityID); - bitStream.Write(GAME_MSG::GAME_MSG_SET_PLAYER_ALLOWED_RESPAWN); - bitStream.Write(doNotPromptRespawn); + bitStream.Write(entityID); + bitStream.Write(GAME_MSG::GAME_MSG_SET_PLAYER_ALLOWED_RESPAWN); + bitStream.Write(doNotPromptRespawn); - SEND_PACKET; + SEND_PACKET; } void GameMessages::SendInvalidZoneTransferList(Entity* entity, const SystemAddress& sysAddr, const std::u16string& feedbackURL, const std::u16string& invalidMapTransferList, bool feedbackOnExit, bool feedbackOnInvalidTransfer) { @@ -266,7 +266,7 @@ void GameMessages::SendStartArrangingWithItem( } void GameMessages::SendPlayerSetCameraCyclingMode(const LWOOBJID& objectID, const SystemAddress& sysAddr, - bool bAllowCyclingWhileDeadOnly, eCyclingMode cyclingMode) { + bool bAllowCyclingWhileDeadOnly, eCyclingMode cyclingMode) { CBITSTREAM CMSGHEADER @@ -277,7 +277,7 @@ void GameMessages::SendPlayerSetCameraCyclingMode(const LWOOBJID& objectID, cons bitStream.Write(cyclingMode != ALLOW_CYCLE_TEAMMATES); if (cyclingMode != ALLOW_CYCLE_TEAMMATES) { - bitStream.Write(cyclingMode); + bitStream.Write(cyclingMode); } SEND_PACKET @@ -672,7 +672,7 @@ void GameMessages::SendStopFXEffect(Entity* entity, bool killImmediate, std::str bitStream.Write(entity->GetObjectID()); bitStream.Write(GAME_MSG::GAME_MSG_STOP_FX_EFFECT); - bitStream.Write(killImmediate); + bitStream.Write(killImmediate); bitStream.Write(name.size()); bitStream.Write(name.c_str(), name.size()); @@ -1456,76 +1456,76 @@ void GameMessages::SendMatchUpdate(Entity* entity, const SystemAddress& sysAddr, } void GameMessages::SendRequestActivitySummaryLeaderboardData(const LWOOBJID& objectID, const LWOOBJID& targetID, - const SystemAddress& sysAddr, const int32_t& gameID, - const int32_t& queryType, const int32_t& resultsEnd, - const int32_t& resultsStart, bool weekly) { - CBITSTREAM - CMSGHEADER + const SystemAddress& sysAddr, const int32_t& gameID, + const int32_t& queryType, const int32_t& resultsEnd, + const int32_t& resultsStart, bool weekly) { + CBITSTREAM + CMSGHEADER - bitStream.Write(objectID); - bitStream.Write(GAME_MSG::GAME_MSG_REQUEST_ACTIVITY_SUMMARY_LEADERBOARD_DATA); + bitStream.Write(objectID); + bitStream.Write(GAME_MSG::GAME_MSG_REQUEST_ACTIVITY_SUMMARY_LEADERBOARD_DATA); - bitStream.Write(gameID != 0); - if (gameID != 0) { - bitStream.Write(gameID); - } + bitStream.Write(gameID != 0); + if (gameID != 0) { + bitStream.Write(gameID); + } - bitStream.Write(queryType != 1); - if (queryType != 1) { - bitStream.Write(queryType); - } + bitStream.Write(queryType != 1); + if (queryType != 1) { + bitStream.Write(queryType); + } - bitStream.Write(resultsEnd != 10); - if (resultsEnd != 10) { - bitStream.Write(resultsEnd); - } + bitStream.Write(resultsEnd != 10); + if (resultsEnd != 10) { + bitStream.Write(resultsEnd); + } - bitStream.Write(resultsStart != 0); - if (resultsStart != 0) { - bitStream.Write(resultsStart); - } + bitStream.Write(resultsStart != 0); + if (resultsStart != 0) { + bitStream.Write(resultsStart); + } - bitStream.Write(targetID); - bitStream.Write(weekly); + bitStream.Write(targetID); + bitStream.Write(weekly); - SEND_PACKET + SEND_PACKET } void GameMessages::SendActivityPause(LWOOBJID objectId, bool pause, const SystemAddress& sysAddr) { - CBITSTREAM - CMSGHEADER + CBITSTREAM + CMSGHEADER - bitStream.Write(objectId); - bitStream.Write(GAME_MSG::GAME_MSG_ACTIVITY_PAUSE); - bitStream.Write(pause); + bitStream.Write(objectId); + bitStream.Write(GAME_MSG::GAME_MSG_ACTIVITY_PAUSE); + bitStream.Write(pause); - if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST; - SEND_PACKET + if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST; + SEND_PACKET } void GameMessages::SendStartActivityTime(LWOOBJID objectId, float_t startTime, const SystemAddress& sysAddr) { - CBITSTREAM - CMSGHEADER + CBITSTREAM + CMSGHEADER - bitStream.Write(objectId); - bitStream.Write(GAME_MSG::GAME_MSG_START_ACTIVITY_TIME); - bitStream.Write(startTime); + bitStream.Write(objectId); + bitStream.Write(GAME_MSG::GAME_MSG_START_ACTIVITY_TIME); + bitStream.Write(startTime); - if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST; - SEND_PACKET + if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST; + SEND_PACKET } void GameMessages::SendRequestActivityEnter(LWOOBJID objectId, const SystemAddress& sysAddr, bool bStart, LWOOBJID userID) { - CBITSTREAM - CMSGHEADER + CBITSTREAM + CMSGHEADER - bitStream.Write(objectId); - bitStream.Write(GAME_MSG::GAME_MSG_REQUEST_ACTIVITY_ENTER); - bitStream.Write(bStart); + bitStream.Write(objectId); + bitStream.Write(GAME_MSG::GAME_MSG_REQUEST_ACTIVITY_ENTER); + bitStream.Write(bStart); bitStream.Write(userID); - if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST; - SEND_PACKET + if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST; + SEND_PACKET } void GameMessages::NotifyLevelRewards(LWOOBJID objectID, const SystemAddress& sysAddr, int level, bool sending_rewards) { @@ -1614,87 +1614,87 @@ void GameMessages::HandleUpdateShootingGalleryRotation(RakNet::BitStream* inStre void GameMessages::HandleActivitySummaryLeaderboardData(RakNet::BitStream* instream, Entity* entity, - const SystemAddress& sysAddr) { - Game::logger->Log("AGS", "We got mail!\n"); + const SystemAddress& sysAddr) { + Game::logger->Log("AGS", "We got mail!\n"); } void GameMessages::SendActivitySummaryLeaderboardData(const LWOOBJID& objectID, const Leaderboard* leaderboard, const SystemAddress& sysAddr) { - CBITSTREAM - CMSGHEADER + CBITSTREAM + CMSGHEADER - bitStream.Write(objectID); - bitStream.Write(GAME_MSG::GAME_MSG_SEND_ACTIVITY_SUMMARY_LEADERBOARD_DATA); + bitStream.Write(objectID); + bitStream.Write(GAME_MSG::GAME_MSG_SEND_ACTIVITY_SUMMARY_LEADERBOARD_DATA); - bitStream.Write(leaderboard->GetGameID()); - bitStream.Write(leaderboard->GetInfoType()); + bitStream.Write(leaderboard->GetGameID()); + bitStream.Write(leaderboard->GetInfoType()); - // Leaderboard is written back as LDF string - const auto leaderboardString = leaderboard->ToString(); - bitStream.Write(leaderboardString.size()); - for (const auto c : leaderboardString) { - bitStream.Write(c); - } - if (!leaderboardString.empty()) bitStream.Write(uint16_t(0)); + // Leaderboard is written back as LDF string + const auto leaderboardString = leaderboard->ToString(); + bitStream.Write(leaderboardString.size()); + for (const auto c : leaderboardString) { + bitStream.Write(c); + } + if (!leaderboardString.empty()) bitStream.Write(uint16_t(0)); - bitStream.Write0(); - bitStream.Write0(); + bitStream.Write0(); + bitStream.Write0(); - SEND_PACKET + SEND_PACKET } void GameMessages::HandleRequestActivitySummaryLeaderboardData(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { - int32_t gameID = 0; - if (inStream->ReadBit()) inStream->Read(gameID); + int32_t gameID = 0; + if (inStream->ReadBit()) inStream->Read(gameID); - int32_t queryType = 1; - if (inStream->ReadBit()) inStream->Read(queryType); + int32_t queryType = 1; + if (inStream->ReadBit()) inStream->Read(queryType); - int32_t resultsEnd = 10; - if (inStream->ReadBit()) inStream->Read(resultsEnd); + int32_t resultsEnd = 10; + if (inStream->ReadBit()) inStream->Read(resultsEnd); - int32_t resultsStart = 0; - if (inStream->ReadBit()) inStream->Read(resultsStart); + int32_t resultsStart = 0; + if (inStream->ReadBit()) inStream->Read(resultsStart); - LWOOBJID target {}; - inStream->Read(target); + LWOOBJID target {}; + inStream->Read(target); - bool weekly = inStream->ReadBit(); + bool weekly = inStream->ReadBit(); - const auto* leaderboard = LeaderboardManager::GetLeaderboard(gameID, (InfoType)queryType, weekly, entity->GetObjectID()); - SendActivitySummaryLeaderboardData(entity->GetObjectID(), leaderboard, sysAddr); - delete leaderboard; + const auto* leaderboard = LeaderboardManager::GetLeaderboard(gameID, (InfoType)queryType, weekly, entity->GetObjectID()); + SendActivitySummaryLeaderboardData(entity->GetObjectID(), leaderboard, sysAddr); + delete leaderboard; } void GameMessages::HandleActivityStateChangeRequest(RakNet::BitStream *inStream, Entity *entity) { - LWOOBJID objectID; - inStream->Read(objectID); + LWOOBJID objectID; + inStream->Read(objectID); - int32_t value1; - inStream->Read(value1); + int32_t value1; + inStream->Read(value1); - int32_t value2; - inStream->Read(value2); + int32_t value2; + inStream->Read(value2); - uint32_t stringValueLength; - inStream->Read(stringValueLength); + uint32_t stringValueLength; + inStream->Read(stringValueLength); - std::u16string stringValue; - for (uint32_t i = 0; i < stringValueLength; ++i) { - uint16_t character; - inStream->Read(character); - stringValue.push_back(character); - } + std::u16string stringValue; + for (uint32_t i = 0; i < stringValueLength; ++i) { + uint16_t character; + inStream->Read(character); + stringValue.push_back(character); + } auto* assosiate = EntityManager::Instance()->GetEntity(objectID); - Game::logger->Log("Activity State Change", "%s [%i, %i] from %i to %i\n", GeneralUtils::UTF16ToWTF8(stringValue).c_str(), value1, value2, entity->GetLOT(), assosiate != nullptr ? assosiate->GetLOT() : 0); + Game::logger->Log("Activity State Change", "%s [%i, %i] from %i to %i\n", GeneralUtils::UTF16ToWTF8(stringValue).c_str(), value1, value2, entity->GetLOT(), assosiate != nullptr ? assosiate->GetLOT() : 0); std::vector scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_SHOOTING_GALLERY); for (Entity* scriptEntity : scriptedActs) { scriptEntity->OnActivityStateChangeRequest(objectID, value1, value2, stringValue); } - entity->OnActivityStateChangeRequest(objectID, value1, value2, stringValue); + entity->OnActivityStateChangeRequest(objectID, value1, value2, stringValue); } void GameMessages::SendStartCelebrationEffect(Entity* entity, const SystemAddress& sysAddr, int celebrationID) { @@ -1727,99 +1727,99 @@ void GameMessages::SendStartCelebrationEffect(Entity* entity, const SystemAddres void GameMessages::SendSetRailMovement(const LWOOBJID& objectID, bool pathGoForward, std::u16string pathName, - uint32_t pathStart, const SystemAddress& sysAddr, int32_t railActivatorComponentID, - LWOOBJID railActivatorObjectID) { - CBITSTREAM; - CMSGHEADER; + uint32_t pathStart, const SystemAddress& sysAddr, int32_t railActivatorComponentID, + LWOOBJID railActivatorObjectID) { + CBITSTREAM; + CMSGHEADER; - bitStream.Write(objectID); - bitStream.Write(GAME_MSG::GAME_MSG_SET_RAIL_MOVEMENT); + bitStream.Write(objectID); + bitStream.Write(GAME_MSG::GAME_MSG_SET_RAIL_MOVEMENT); - bitStream.Write(pathGoForward); + bitStream.Write(pathGoForward); - bitStream.Write(uint32_t(pathName.size())); - for (auto character : pathName) { - bitStream.Write(character); - } + bitStream.Write(uint32_t(pathName.size())); + for (auto character : pathName) { + bitStream.Write(character); + } - bitStream.Write(pathStart); + bitStream.Write(pathStart); - const auto componentIDIsDefault = railActivatorComponentID == -1; - bitStream.Write(!componentIDIsDefault); - if (!componentIDIsDefault) - bitStream.Write(railActivatorComponentID); + const auto componentIDIsDefault = railActivatorComponentID == -1; + bitStream.Write(!componentIDIsDefault); + if (!componentIDIsDefault) + bitStream.Write(railActivatorComponentID); - const auto activatorObjectIDIsDefault = railActivatorObjectID == LWOOBJID_EMPTY; - bitStream.Write(!activatorObjectIDIsDefault); - if (!activatorObjectIDIsDefault) - bitStream.Write(railActivatorObjectID); + const auto activatorObjectIDIsDefault = railActivatorObjectID == LWOOBJID_EMPTY; + bitStream.Write(!activatorObjectIDIsDefault); + if (!activatorObjectIDIsDefault) + bitStream.Write(railActivatorObjectID); - if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST; - SEND_PACKET; + if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST; + SEND_PACKET; } void GameMessages::SendStartRailMovement(const LWOOBJID &objectID, std::u16string pathName, std::u16string startSound, - std::u16string loopSound, std::u16string stopSound, const SystemAddress& sysAddr, - uint32_t pathStart, bool goForward, bool damageImmune, bool noAggro, bool notifyActor, - bool showNameBillboard, bool cameraLocked, bool collisionEnabled, bool useDB, - int32_t railComponentID, LWOOBJID railActivatorObjectID) { - CBITSTREAM; - CMSGHEADER; + std::u16string loopSound, std::u16string stopSound, const SystemAddress& sysAddr, + uint32_t pathStart, bool goForward, bool damageImmune, bool noAggro, bool notifyActor, + bool showNameBillboard, bool cameraLocked, bool collisionEnabled, bool useDB, + int32_t railComponentID, LWOOBJID railActivatorObjectID) { + CBITSTREAM; + CMSGHEADER; - bitStream.Write(objectID); - bitStream.Write(GAME_MSG::GAME_MSG_START_RAIL_MOVEMENT); + bitStream.Write(objectID); + bitStream.Write(GAME_MSG::GAME_MSG_START_RAIL_MOVEMENT); - bitStream.Write(damageImmune); - bitStream.Write(noAggro); - bitStream.Write(notifyActor); - bitStream.Write(showNameBillboard); - bitStream.Write(cameraLocked); - bitStream.Write(collisionEnabled); + bitStream.Write(damageImmune); + bitStream.Write(noAggro); + bitStream.Write(notifyActor); + bitStream.Write(showNameBillboard); + bitStream.Write(cameraLocked); + bitStream.Write(collisionEnabled); - bitStream.Write(uint32_t(loopSound.size())); - for (auto character : loopSound) { - bitStream.Write(character); - } + bitStream.Write(uint32_t(loopSound.size())); + for (auto character : loopSound) { + bitStream.Write(character); + } - bitStream.Write(goForward); + bitStream.Write(goForward); - bitStream.Write(uint32_t(pathName.size())); - for (auto character : pathName) { - bitStream.Write(character); - } + bitStream.Write(uint32_t(pathName.size())); + for (auto character : pathName) { + bitStream.Write(character); + } - const auto pathStartIsDefault = pathStart == 0; - bitStream.Write(!pathStartIsDefault); - if (!pathStartIsDefault) { - bitStream.Write(pathStart); - } + const auto pathStartIsDefault = pathStart == 0; + bitStream.Write(!pathStartIsDefault); + if (!pathStartIsDefault) { + bitStream.Write(pathStart); + } - const auto railComponentIDIsDefault = railComponentID == -1; - bitStream.Write(!railComponentIDIsDefault); - if (!railComponentIDIsDefault) { - bitStream.Write(railComponentID); - } + const auto railComponentIDIsDefault = railComponentID == -1; + bitStream.Write(!railComponentIDIsDefault); + if (!railComponentIDIsDefault) { + bitStream.Write(railComponentID); + } - const auto railObjectIDIsDefault = railActivatorObjectID == LWOOBJID_EMPTY; - bitStream.Write(!railObjectIDIsDefault); - if (!railObjectIDIsDefault) { - bitStream.Write(railActivatorObjectID); - } + const auto railObjectIDIsDefault = railActivatorObjectID == LWOOBJID_EMPTY; + bitStream.Write(!railObjectIDIsDefault); + if (!railObjectIDIsDefault) { + bitStream.Write(railActivatorObjectID); + } - bitStream.Write(uint32_t(startSound.size())); - for (auto character : startSound) { - bitStream.Write(character); - } + bitStream.Write(uint32_t(startSound.size())); + for (auto character : startSound) { + bitStream.Write(character); + } - bitStream.Write(uint32_t(stopSound.size())); - for (auto character : stopSound) { - bitStream.Write(character); - } + bitStream.Write(uint32_t(stopSound.size())); + for (auto character : stopSound) { + bitStream.Write(character); + } - bitStream.Write(useDB); + bitStream.Write(useDB); - if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST; - SEND_PACKET; + if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST; + SEND_PACKET; } void GameMessages::SendNotifyClientObject(const LWOOBJID& objectID, std::u16string name, int param1, int param2, const LWOOBJID& paramObj, std::string paramStr, const SystemAddress& sysAddr) { @@ -2865,48 +2865,48 @@ void GameMessages::SendEndCinematic(LWOOBJID objectId, std::u16string pathName, } void GameMessages::HandleCinematicUpdate(RakNet::BitStream *inStream, Entity *entity, const SystemAddress &sysAddr) { - eCinematicEvent event; - if (!inStream->ReadBit()) { - event = STARTED; - } else { - inStream->Read(event); - } + eCinematicEvent event; + if (!inStream->ReadBit()) { + event = STARTED; + } else { + inStream->Read(event); + } - float_t overallTime; - if (!inStream->ReadBit()) { - overallTime = -1.0f; - } else { - inStream->Read(overallTime); - } + float_t overallTime; + if (!inStream->ReadBit()) { + overallTime = -1.0f; + } else { + inStream->Read(overallTime); + } - uint32_t pathNameLength; - inStream->Read(pathNameLength); + uint32_t pathNameLength; + inStream->Read(pathNameLength); - std::u16string pathName; - for (size_t i = 0; i < pathNameLength; i++) { - char16_t character; - inStream->Read(character); - pathName.push_back(character); - } + std::u16string pathName; + for (size_t i = 0; i < pathNameLength; i++) { + char16_t character; + inStream->Read(character); + pathName.push_back(character); + } - float_t pathTime; - if (!inStream->ReadBit()) { - pathTime = -1.0f; - } else { - inStream->Read(pathTime); - } + float_t pathTime; + if (!inStream->ReadBit()) { + pathTime = -1.0f; + } else { + inStream->Read(pathTime); + } - int32_t waypoint; - if (!inStream->ReadBit()) { - waypoint = -1; - } else { - inStream->Read(waypoint); - } + int32_t waypoint; + if (!inStream->ReadBit()) { + waypoint = -1; + } else { + inStream->Read(waypoint); + } - std::vector scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_SCRIPT); - for (Entity* scriptEntity : scriptedActs) { - scriptEntity->OnCinematicUpdate(scriptEntity, entity, event, pathName, pathTime, overallTime, waypoint); - } + std::vector scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_SCRIPT); + for (Entity* scriptEntity : scriptedActs) { + scriptEntity->OnCinematicUpdate(scriptEntity, entity, event, pathName, pathTime, overallTime, waypoint); + } } void GameMessages::SendSetStunned(LWOOBJID objectId, eStunState stateChangeType, const SystemAddress& sysAddr, @@ -4290,10 +4290,10 @@ void GameMessages::HandleVehicleNotifyHitImaginationServer(RakNet::BitStream* in } } - auto* characterComponent = entity->GetComponent(); - if (characterComponent != nullptr) { - characterComponent->UpdatePlayerStatistic(RacingImaginationPowerUpsCollected); - } + auto* characterComponent = entity->GetComponent(); + if (characterComponent != nullptr) { + characterComponent->UpdatePlayerStatistic(RacingImaginationPowerUpsCollected); + } pickup->OnFireEventServerSide(entity, "powerup"); @@ -4541,9 +4541,9 @@ void GameMessages::SendVehicleNotifyFinishedRace(LWOOBJID objectId, const System } void GameMessages::SendAddBuff(LWOOBJID& objectID, const LWOOBJID& casterID, uint32_t buffID, uint32_t msDuration, - bool addImmunity, bool cancelOnDamaged, bool cancelOnDeath, bool cancelOnLogout, - bool cancelOnRemoveBuff, bool cancelOnUi, bool cancelOnUnequip, bool cancelOnZone, - const SystemAddress& sysAddr) { + bool addImmunity, bool cancelOnDamaged, bool cancelOnDeath, bool cancelOnLogout, + bool cancelOnRemoveBuff, bool cancelOnUi, bool cancelOnUnequip, bool cancelOnZone, + const SystemAddress& sysAddr) { CBITSTREAM; CMSGHEADER; @@ -4735,11 +4735,11 @@ void GameMessages::HandleBuyFromVendor(RakNet::BitStream* inStream, Entity* enti Character* character = player->GetCharacter(); if (!character) return; - // Extra currency that needs to be deducted in case of crafting - auto craftingCurrencies = CDItemComponentTable::ParseCraftingCurrencies(itemComp); - for (const auto& craftingCurrency : craftingCurrencies) { - inv->RemoveItem(craftingCurrency.first, craftingCurrency.second * count); - } + // Extra currency that needs to be deducted in case of crafting + auto craftingCurrencies = CDItemComponentTable::ParseCraftingCurrencies(itemComp); + for (const auto& craftingCurrency : craftingCurrencies) { + inv->RemoveItem(craftingCurrency.first, craftingCurrency.second * count); + } if (isCommendationVendor) { @@ -5035,7 +5035,7 @@ void GameMessages::HandleFireEventServerSide(RakNet::BitStream* inStream, Entity }); } - entity->OnFireEventServerSide(sender, GeneralUtils::UTF16ToWTF8(args), param1, param2, param3); + entity->OnFireEventServerSide(sender, GeneralUtils::UTF16ToWTF8(args), param1, param2, param3); } void GameMessages::HandleRequestPlatformResync(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { @@ -5867,21 +5867,21 @@ void GameMessages::HandlePickupItem(RakNet::BitStream* inStream, Entity* entity) } void GameMessages::HandleResurrect(RakNet::BitStream* inStream, Entity* entity) { - bool immediate = inStream->ReadBit(); + bool immediate = inStream->ReadBit(); - Entity* zoneControl = EntityManager::Instance()->GetZoneControlEntity(); - for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControl)) { - script->OnPlayerResurrected(zoneControl, entity); - } + Entity* zoneControl = EntityManager::Instance()->GetZoneControlEntity(); + for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControl)) { + script->OnPlayerResurrected(zoneControl, entity); + } - std::vector scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_SCRIPTED_ACTIVITY); - for (Entity* scriptEntity : scriptedActs) { - if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds - for (CppScripts::Script* script : CppScripts::GetEntityScripts(scriptEntity)) { - script->OnPlayerResurrected(scriptEntity, entity); - } - } - } + std::vector scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_SCRIPTED_ACTIVITY); + for (Entity* scriptEntity : scriptedActs) { + if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds + for (CppScripts::Script* script : CppScripts::GetEntityScripts(scriptEntity)) { + script->OnPlayerResurrected(scriptEntity, entity); + } + } + } } void GameMessages::HandlePushEquippedItemsState(RakNet::BitStream* inStream, Entity* entity) { @@ -5923,7 +5923,7 @@ void GameMessages::HandleClientItemConsumed(RakNet::BitStream* inStream, Entity* auto* missions = static_cast(entity->GetComponent(COMPONENT_TYPE_MISSION)); if (missions != nullptr) { - missions->Progress(MissionTaskType::MISSION_TASK_TYPE_FOOD, item->GetLot()); + missions->Progress(MissionTaskType::MISSION_TASK_TYPE_FOOD, item->GetLot()); } } @@ -5995,6 +5995,51 @@ void GameMessages::HandleMatchRequest(RakNet::BitStream* inStream, Entity* entit } } +void GameMessages::HandleGetHotPropertyData(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { + SendGetHotPropertyData(inStream, entity, sysAddr); +} + +void GameMessages::SendGetHotPropertyData(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { + CBITSTREAM + CMSGHEADER + /** + * [u32] - Number of properties + * [objid] - property id + * [objid] - property owner id + * [wstring] - property owner name + * [u64] - total reputation + * [i32] - property template id + * [wstring] - property name + * [wstring] - property description + * [float] - performance cost + * [timestamp] - time last published + * [cloneid] - clone id + * + */ + // TODO This needs to be implemented when reputation is implemented for getting hot properties. + /** + bitStream.Write(entity->GetObjectID()); + bitStream.Write(GAME_MSG::GAME_MSG_SEND_HOT_PROPERTY_DATA); + std::vector t = {25166, 25188, 25191, 25194}; + bitStream.Write(4); + for (uint8_t i = 0; i < 4; i++) { + bitStream.Write(entity->GetObjectID()); + bitStream.Write(entity->GetObjectID()); + bitStream.Write(1); + bitStream.Write('c'); + bitStream.Write(42069); + bitStream.Write(t[i]); + bitStream.Write(1); + bitStream.Write('c'); + bitStream.Write(1); + bitStream.Write('c'); + bitStream.Write(420.69f); + bitStream.Write(1658376385); + bitStream.Write(25166); + } + SEND_PACKET*/ +} + void GameMessages::HandleReportBug(RakNet::BitStream* inStream, Entity* entity) { //Definitely not stolen from autogenerated code, no sir: std::u16string body; @@ -6060,25 +6105,25 @@ void GameMessages::HandleReportBug(RakNet::BitStream* inStream, Entity* entity) void GameMessages::HandleClientRailMovementReady(RakNet::BitStream *inStream, Entity *entity, const SystemAddress &sysAddr) { - const auto possibleRails = EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_RAIL_ACTIVATOR); - for (const auto* possibleRail : possibleRails) { - const auto* rail = possibleRail->GetComponent(); - if (rail != nullptr) { - rail->OnRailMovementReady(entity); - } - } + const auto possibleRails = EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_RAIL_ACTIVATOR); + for (const auto* possibleRail : possibleRails) { + const auto* rail = possibleRail->GetComponent(); + if (rail != nullptr) { + rail->OnRailMovementReady(entity); + } + } } void GameMessages::HandleCancelRailMovement(RakNet::BitStream *inStream, Entity *entity, const SystemAddress &sysAddr) { - const auto immediate = inStream->ReadBit(); + const auto immediate = inStream->ReadBit(); - const auto possibleRails = EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_RAIL_ACTIVATOR); - for (const auto* possibleRail : possibleRails) { - auto* rail = possibleRail->GetComponent(); - if (rail != nullptr) { - rail->OnCancelRailMovement(entity); - } - } + const auto possibleRails = EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_RAIL_ACTIVATOR); + for (const auto* possibleRail : possibleRails) { + auto* rail = possibleRail->GetComponent(); + if (rail != nullptr) { + rail->OnCancelRailMovement(entity); + } + } } void GameMessages::HandlePlayerRailArrivedNotification(RakNet::BitStream *inStream, Entity *entity, @@ -6105,43 +6150,43 @@ void GameMessages::HandlePlayerRailArrivedNotification(RakNet::BitStream *inStre } void GameMessages::HandleModifyPlayerZoneStatistic(RakNet::BitStream *inStream, Entity *entity) { - const auto set = inStream->ReadBit(); - const auto statisticsName = GeneralUtils::ReadWString(inStream); + const auto set = inStream->ReadBit(); + const auto statisticsName = GeneralUtils::ReadWString(inStream); - int32_t value; - if (inStream->ReadBit()) { - inStream->Read(value); - } else { - value = 0; - } + int32_t value; + if (inStream->ReadBit()) { + inStream->Read(value); + } else { + value = 0; + } - LWOMAPID zone; - if (inStream->ReadBit()) { - inStream->Read(zone); - } else { - zone = LWOMAPID_INVALID; - } + LWOMAPID zone; + if (inStream->ReadBit()) { + inStream->Read(zone); + } else { + zone = LWOMAPID_INVALID; + } - // Notify the character component that something's changed - auto* characterComponent = entity->GetComponent(); - if (characterComponent != nullptr) { - characterComponent->HandleZoneStatisticsUpdate(zone, statisticsName, value); - } + // Notify the character component that something's changed + auto* characterComponent = entity->GetComponent(); + if (characterComponent != nullptr) { + characterComponent->HandleZoneStatisticsUpdate(zone, statisticsName, value); + } } void GameMessages::HandleUpdatePlayerStatistic(RakNet::BitStream* inStream, Entity* entity) { - int32_t updateID; - inStream->Read(updateID); + int32_t updateID; + inStream->Read(updateID); - int64_t updateValue; - if (inStream->ReadBit()) { - inStream->Read(updateValue); - } else { - updateValue = 1; - } + int64_t updateValue; + if (inStream->ReadBit()) { + inStream->Read(updateValue); + } else { + updateValue = 1; + } - auto* characterComponent = entity->GetComponent(); - if (characterComponent != nullptr) { - characterComponent->UpdatePlayerStatistic((StatisticID) updateID, (uint64_t) std::max(updateValue, int64_t(0))); - } + auto* characterComponent = entity->GetComponent(); + if (characterComponent != nullptr) { + characterComponent->UpdatePlayerStatistic((StatisticID) updateID, (uint64_t) std::max(updateValue, int64_t(0))); + } } diff --git a/dGame/dGameMessages/GameMessages.h b/dGame/dGameMessages/GameMessages.h index fc49ad70..c5b7888d 100644 --- a/dGame/dGameMessages/GameMessages.h +++ b/dGame/dGameMessages/GameMessages.h @@ -24,7 +24,7 @@ namespace GameMessages { class PropertyDataMessage; void SendFireEventClientSide(const LWOOBJID& objectID, const SystemAddress& sysAddr, std::u16string args, const LWOOBJID& object, int64_t param1, int param2, const LWOOBJID& sender); void SendTeleport(const LWOOBJID& objectID, const NiPoint3& pos, const NiQuaternion& rot, const SystemAddress& sysAddr, bool bSetRotation = false, bool noGravTeleport = true); - void SendPlayAnimation(Entity* entity, const std::u16string& animationName, float fPriority = 0.0f, float fScale = 1.0f); + void SendPlayAnimation(Entity* entity, const std::u16string& animationName, float fPriority = 0.0f, float fScale = 1.0f); void SendPlayerReady(Entity * entity, const SystemAddress& sysAddr); void SendPlayerAllowedRespawn(LWOOBJID entityID, bool doNotPromptRespawn, const SystemAddress& systemAddress); void SendInvalidZoneTransferList(Entity * entity, const SystemAddress& sysAddr, const std::u16string& feedbackURL, const std::u16string& invalidMapTransferList, bool feedbackOnExit, bool feedbackOnInvalidTransfer); @@ -47,27 +47,27 @@ namespace GameMessages { ); void SendPlayerSetCameraCyclingMode(const LWOOBJID& objectID, const SystemAddress& sysAddr, - bool bAllowCyclingWhileDeadOnly = true, eCyclingMode cyclingMode = ALLOW_CYCLE_TEAMMATES); + bool bAllowCyclingWhileDeadOnly = true, eCyclingMode cyclingMode = ALLOW_CYCLE_TEAMMATES); void SendPlayNDAudioEmitter(Entity* entity, const SystemAddress& sysAddr, std::string audioGUID); void SendStartPathing(Entity* entity); void SendPlatformResync(Entity* entity, const SystemAddress& sysAddr, bool bStopAtDesiredWaypoint = false, - int iIndex = 0, int iDesiredWaypointIndex = 1, int nextIndex = 1, - MovementPlatformState movementState = MovementPlatformState::Moving); - + int iIndex = 0, int iDesiredWaypointIndex = 1, int nextIndex = 1, + MovementPlatformState movementState = MovementPlatformState::Moving); + void SendRestoreToPostLoadStats(Entity * entity, const SystemAddress& sysAddr); void SendServerDoneLoadingAllObjects(Entity * entity, const SystemAddress& sysAddr); - void SendGMLevelBroadcast(const LWOOBJID& objectID, uint8_t level); - void SendChatModeUpdate(const LWOOBJID& objectID, uint8_t level); - + void SendGMLevelBroadcast(const LWOOBJID& objectID, uint8_t level); + void SendChatModeUpdate(const LWOOBJID& objectID, uint8_t level); + void SendAddItemToInventoryClientSync(Entity* entity, const SystemAddress& sysAddr, Item* item, const LWOOBJID& objectID, bool showFlyingLoot, int itemCount, LWOOBJID subKey = LWOOBJID_EMPTY, eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE); - void SendNotifyClientFlagChange(const LWOOBJID& objectID, int iFlagID, bool bFlag, const SystemAddress& sysAddr); + void SendNotifyClientFlagChange(const LWOOBJID& objectID, int iFlagID, bool bFlag, const SystemAddress& sysAddr); void SendChangeObjectWorldState(const LWOOBJID& objectID, int state, const SystemAddress& sysAddr); - void SendOfferMission(const LWOOBJID& entity, const SystemAddress& sysAddr, int32_t missionID, const LWOOBJID& offererID); - void SendNotifyMission(Entity * entity, const SystemAddress& sysAddr, int missionID, int missionState, bool sendingRewards); - void SendNotifyMissionTask(Entity * entity, const SystemAddress& sysAddr, int missionID, int taskMask, std::vector updates); + void SendOfferMission(const LWOOBJID& entity, const SystemAddress& sysAddr, int32_t missionID, const LWOOBJID& offererID); + void SendNotifyMission(Entity * entity, const SystemAddress& sysAddr, int missionID, int missionState, bool sendingRewards); + void SendNotifyMissionTask(Entity * entity, const SystemAddress& sysAddr, int missionID, int taskMask, std::vector updates); void NotifyLevelRewards(LWOOBJID objectID, const SystemAddress& sysAddr, int level, bool sending_rewards); void SendModifyLEGOScore(Entity* entity, const SystemAddress& sysAddr, int64_t score, eLootSourceType sourceType); @@ -92,7 +92,7 @@ namespace GameMessages { void SendSetInventorySize(Entity* entity, int invType, int size); void SendSetEmoteLockState(Entity* entity, bool bLock, int emoteID); - void SendSetJetPackMode(Entity* entity, bool use, bool bypassChecks = false, bool doHover = false, int effectID = -1, float airspeed = 10, float maxAirspeed = 15, float verticalVelocity = 1, int warningEffectID = -1); + void SendSetJetPackMode(Entity* entity, bool use, bool bypassChecks = false, bool doHover = false, int effectID = -1, float airspeed = 10, float maxAirspeed = 15, float verticalVelocity = 1, int warningEffectID = -1); void SendResurrect(Entity* entity); void SendStop2DAmbientSound(Entity* entity, bool force, std::string audioGUID, bool result = false); void SendPlay2DAmbientSound(Entity* entity, std::string audioGUID, bool result = false); @@ -157,15 +157,15 @@ namespace GameMessages { // Rails stuff void SendSetRailMovement(const LWOOBJID& objectID, bool pathGoForward, std::u16string pathName, uint32_t pathStart, - const SystemAddress& sysAddr = UNASSIGNED_SYSTEM_ADDRESS, - int32_t railActivatorComponentID = -1, LWOOBJID railActivatorObjectID = LWOOBJID_EMPTY); + const SystemAddress& sysAddr = UNASSIGNED_SYSTEM_ADDRESS, + int32_t railActivatorComponentID = -1, LWOOBJID railActivatorObjectID = LWOOBJID_EMPTY); void SendStartRailMovement(const LWOOBJID& objectID, std::u16string pathName, std::u16string startSound, - std::u16string loopSound, std::u16string stopSound, const SystemAddress& sysAddr = UNASSIGNED_SYSTEM_ADDRESS, - uint32_t pathStart = 0, bool goForward = true, bool damageImmune = true, bool noAggro = true, - bool notifyActor = false, bool showNameBillboard = true, bool cameraLocked = true, - bool collisionEnabled = true, bool useDB = true, int32_t railComponentID = -1, - LWOOBJID railActivatorObjectID = LWOOBJID_EMPTY); + std::u16string loopSound, std::u16string stopSound, const SystemAddress& sysAddr = UNASSIGNED_SYSTEM_ADDRESS, + uint32_t pathStart = 0, bool goForward = true, bool damageImmune = true, bool noAggro = true, + bool notifyActor = false, bool showNameBillboard = true, bool cameraLocked = true, + bool collisionEnabled = true, bool useDB = true, int32_t railComponentID = -1, + LWOOBJID railActivatorObjectID = LWOOBJID_EMPTY); void HandleClientRailMovementReady(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); void HandleCancelRailMovement(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); @@ -180,9 +180,9 @@ namespace GameMessages { void SendBBBSaveResponse(const LWOOBJID& objectId, const LWOOBJID& localID, unsigned char* buffer, uint32_t bufferSize, const SystemAddress& sysAddr); void SendAddBuff(LWOOBJID& objectID, const LWOOBJID& casterID, uint32_t buffID, uint32_t msDuration, - bool addImmunity = false, bool cancelOnDamaged = false, bool cancelOnDeath = true, - bool cancelOnLogout = false, bool cancelOnRemoveBuff = true, bool cancelOnUi = false, - bool cancelOnUnequip = false, bool cancelOnZone = false, const SystemAddress& sysAddr = UNASSIGNED_SYSTEM_ADDRESS); + bool addImmunity = false, bool cancelOnDamaged = false, bool cancelOnDeath = true, + bool cancelOnLogout = false, bool cancelOnRemoveBuff = true, bool cancelOnUi = false, + bool cancelOnUnequip = false, bool cancelOnZone = false, const SystemAddress& sysAddr = UNASSIGNED_SYSTEM_ADDRESS); void SendToggleGMInvis(LWOOBJID objectId, bool enabled, const SystemAddress& sysAddr); @@ -252,7 +252,7 @@ namespace GameMessages { bool lockPlayer = true, bool result = false, bool skipIfSamePath = false, float startTimeAdvance = 0); void SendEndCinematic(LWOOBJID objectID, std::u16string pathName, const SystemAddress& sysAddr = UNASSIGNED_SYSTEM_ADDRESS, - float leadOut = -1.0f, bool leavePlayerLocked = false); + float leadOut = -1.0f, bool leavePlayerLocked = false); void HandleCinematicUpdate(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); void SendSetStunned(LWOOBJID objectId, eStunState stateChangeType, const SystemAddress& sysAddr, @@ -389,6 +389,38 @@ namespace GameMessages { */ void HandleAcknowledgePossession(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); + /** + * @brief A request from a client to get the hot properties that would appear on the news feed + * This incoming message has NO DATA and is simply a request that expects to send a reply to the sender. + * + * @param inStream packet of data + * @param entity The Entity that sent the request + * @param sysAddr The SystemAddress of the Entity that sent the request + */ + void HandleGetHotPropertyData(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); + + /** + * @brief A request from a client to get the hot properties that would appear on the news feed + * The struct of data to send is as follows + * + * [u32] - Number of properties + * [objid] - property id + * [objid] - property owner id + * [wstring] - property owner name + * [u64] - total reputation + * [i32] - property template id + * [wstring] - property name + * [wstring] - property description + * [float] - performance cost + * [timestamp] - time last published + * [cloneid] - clone id + * + * @param inStream packet of data + * @param entity The Entity that sent the request + * @param sysAddr The SystemAddress of the Entity that sent the request + */ + void SendGetHotPropertyData(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); + //Racing: void HandleModuleAssemblyQueryData(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); @@ -459,16 +491,16 @@ namespace GameMessages { void SendUpdateReputation(const LWOOBJID objectId, const int64_t reputation, const SystemAddress& sysAddr); - // Leaderboards - void SendActivitySummaryLeaderboardData(const LWOOBJID& objectID, const Leaderboard* leaderboard, - const SystemAddress& sysAddr = UNASSIGNED_SYSTEM_ADDRESS); - void HandleActivitySummaryLeaderboardData(RakNet::BitStream* instream, Entity* entity, const SystemAddress& sysAddr); - void SendRequestActivitySummaryLeaderboardData(const LWOOBJID& objectID, const LWOOBJID& targetID, - const SystemAddress& sysAddr, const int32_t& gameID = 0, - const int32_t& queryType = 1, const int32_t& resultsEnd = 10, - const int32_t& resultsStart = 0, bool weekly = false); - void HandleRequestActivitySummaryLeaderboardData(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); - void HandleActivityStateChangeRequest(RakNet::BitStream* inStream, Entity* entity); + // Leaderboards + void SendActivitySummaryLeaderboardData(const LWOOBJID& objectID, const Leaderboard* leaderboard, + const SystemAddress& sysAddr = UNASSIGNED_SYSTEM_ADDRESS); + void HandleActivitySummaryLeaderboardData(RakNet::BitStream* instream, Entity* entity, const SystemAddress& sysAddr); + void SendRequestActivitySummaryLeaderboardData(const LWOOBJID& objectID, const LWOOBJID& targetID, + const SystemAddress& sysAddr, const int32_t& gameID = 0, + const int32_t& queryType = 1, const int32_t& resultsEnd = 10, + const int32_t& resultsStart = 0, bool weekly = false); + void HandleRequestActivitySummaryLeaderboardData(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); + void HandleActivityStateChangeRequest(RakNet::BitStream* inStream, Entity* entity); void SendVehicleAddPassiveBoostAction(LWOOBJID objectId, const SystemAddress& sysAddr); @@ -482,8 +514,8 @@ namespace GameMessages { void SendShowActivityCountdown(LWOOBJID objectId, bool bPlayAdditionalSound, bool bPlayCountdownSound, std::u16string sndName, int32_t stateToPlaySoundOn, const SystemAddress& sysAddr); - //Handlers: - + //Handlers: + void HandleToggleGhostReferenceOverride(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); void HandleSetGhostReferencePosition(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); @@ -491,19 +523,19 @@ namespace GameMessages { void HandleSellToVendor(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); void HandleBuybackFromVendor(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); void HandleParseChatMessage(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); - void HandleToggleGhostReffrenceOverride(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); - void HandleSetGhostReffrenceOverride(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); - void HandleFireEventServerSide(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); - void HandleRequestPlatformResync(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); + void HandleToggleGhostReffrenceOverride(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); + void HandleSetGhostReffrenceOverride(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); + void HandleFireEventServerSide(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); + void HandleRequestPlatformResync(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); void HandleRebuildCancel(RakNet::BitStream* inStream, Entity* entity); - void HandleRequestUse(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); - void HandlePlayEmote(RakNet::BitStream* inStream, Entity* entity); + void HandleRequestUse(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); + void HandlePlayEmote(RakNet::BitStream* inStream, Entity* entity); void HandleModularBuildConvertModel(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); - void HandleSetFlag(RakNet::BitStream* inStream, Entity* entity); - void HandleRespondToMission(RakNet::BitStream* inStream, Entity* entity); - void HandleMissionDialogOK(RakNet::BitStream* inStream, Entity* entity); - void HandleRequestLinkedMission(RakNet::BitStream* inStream, Entity* entity); - void HandleHasBeenCollected(RakNet::BitStream* inStream, Entity* entity); + void HandleSetFlag(RakNet::BitStream* inStream, Entity* entity); + void HandleRespondToMission(RakNet::BitStream* inStream, Entity* entity); + void HandleMissionDialogOK(RakNet::BitStream* inStream, Entity* entity); + void HandleRequestLinkedMission(RakNet::BitStream* inStream, Entity* entity); + void HandleHasBeenCollected(RakNet::BitStream* inStream, Entity* entity); void HandleNotifyServerLevelProcessingComplete(RakNet::BitStream* inStream, Entity* entity); void HandlePickupCurrency(RakNet::BitStream* inStream, Entity* entity); void HandleRequestDie(RakNet::BitStream* inStream, Entity* entity); @@ -537,7 +569,7 @@ namespace GameMessages { class EchoSyncSkill { static const GAME_MSG MsgID = GAME_MSG_ECHO_SYNC_SKILL; - public: + public: EchoSyncSkill() { bDone = false; } @@ -598,7 +630,7 @@ namespace GameMessages { class SyncSkill { static const GAME_MSG MsgID = GAME_MSG_SYNC_SKILL; - public: + public: SyncSkill() { bDone = false; } @@ -659,7 +691,7 @@ namespace GameMessages { class RequestServerProjectileImpact { static const GAME_MSG MsgID = GAME_MSG_REQUEST_SERVER_PROJECTILE_IMPACT; - public: + public: RequestServerProjectileImpact() { i64LocalID = LWOOBJID_EMPTY; i64TargetID = LWOOBJID_EMPTY; @@ -728,7 +760,7 @@ namespace GameMessages { class DoClientProjectileImpact { static const GAME_MSG MsgID = GAME_MSG_DO_CLIENT_PROJECTILE_IMPACT; - public: + public: DoClientProjectileImpact() { i64OrgID = LWOOBJID_EMPTY; i64OwnerID = LWOOBJID_EMPTY; @@ -1078,7 +1110,4 @@ namespace GameMessages { }; }; - - - #endif // GAMEMESSAGES_H diff --git a/dNet/dMessageIdentifiers.h b/dNet/dMessageIdentifiers.h index cb46b5d1..4e88a9af 100644 --- a/dNet/dMessageIdentifiers.h +++ b/dNet/dMessageIdentifiers.h @@ -354,8 +354,8 @@ enum GAME_MSG : unsigned short { GAME_MSG_REGISTER_PET_ID = 565, GAME_MSG_REGISTER_PET_DBID = 566, GAME_MSG_SHOW_ACTIVITY_COUNTDOWN = 568, - GAME_MSG_START_ACTIVITY_TIME = 576, - GAME_MSG_ACTIVITY_PAUSE = 602, + GAME_MSG_START_ACTIVITY_TIME = 576, + GAME_MSG_ACTIVITY_PAUSE = 602, GAME_MSG_USE_NON_EQUIPMENT_ITEM = 603, GAME_MSG_USE_ITEM_RESULT = 607, GAME_MSG_COMMAND_PET = 640, @@ -386,14 +386,14 @@ enum GAME_MSG : unsigned short { GAME_MSG_PROPERTY_EDITOR_BEGIN = 724, GAME_MSG_PROPERTY_EDITOR_END = 725, GAME_MSG_START_PATHING = 735, - GAME_MSG_NOTIFY_CLIENT_ZONE_OBJECT = 737, + GAME_MSG_NOTIFY_CLIENT_ZONE_OBJECT = 737, GAME_MSG_UPDATE_REPUTATION = 746, GAME_MSG_PROPERTY_RENTAL_RESPONSE = 750, GAME_MSG_REQUEST_PLATFORM_RESYNC = 760, GAME_MSG_PLATFORM_RESYNC = 761, GAME_MSG_PLAY_CINEMATIC = 762, GAME_MSG_END_CINEMATIC = 763, - GAME_MSG_CINEMATIC_UPDATE = 764, + GAME_MSG_CINEMATIC_UPDATE = 764, GAME_MSG_TOGGLE_GHOST_REFERENCE_OVERRIDE = 767, GAME_MSG_SET_GHOST_REFERENCE_POSITION = 768, GAME_MSG_FIRE_EVENT_SERVER_SIDE = 770, @@ -438,8 +438,8 @@ enum GAME_MSG : unsigned short { GAME_MSG_BBB_SAVE_RESPONSE = 1006, GAME_MSG_NOTIFY_CLIENT_OBJECT = 1042, GAME_MSG_DISPLAY_ZONE_SUMMARY = 1043, - GAME_MSG_ACTIVITY_STATE_CHANGE_REQUEST = 1053, - GAME_MSG_MODIFY_PLAYER_ZONE_STATISTIC = 1046, + GAME_MSG_ACTIVITY_STATE_CHANGE_REQUEST = 1053, + GAME_MSG_MODIFY_PLAYER_ZONE_STATISTIC = 1046, GAME_MSG_START_BUILDING_WITH_ITEM = 1057, GAME_MSG_START_ARRANGING_WITH_ITEM = 1061, GAME_MSG_FINISH_ARRANGING_WITH_ITEM = 1062, @@ -460,7 +460,7 @@ enum GAME_MSG : unsigned short { GAME_MSG_REQUEST_SERVER_PROJECTILE_IMPACT = 1148, GAME_MSG_DO_CLIENT_PROJECTILE_IMPACT = 1151, GAME_MSG_MODULAR_BUILD_CONVERT_MODEL = 1155, - GAME_MSG_SET_PLAYER_ALLOWED_RESPAWN = 1165, + GAME_MSG_SET_PLAYER_ALLOWED_RESPAWN = 1165, GAME_MSG_UI_MESSAGE_SERVER_TO_SINGLE_CLIENT = 1184, GAME_MSG_UI_MESSAGE_SERVER_TO_ALL_CLIENTS = 1185, GAME_MSG_PET_TAMING_TRY_BUILD = 1197, @@ -515,10 +515,10 @@ enum GAME_MSG : unsigned short { GAME_MSG_RESTORE_TO_POST_LOAD_STATS = 1468, GAME_MSG_SET_RAIL_MOVEMENT = 1471, GAME_MSG_START_RAIL_MOVEMENT = 1472, - GAME_MSG_CANCEL_RAIL_MOVEMENT = 1474, - GAME_MSG_CLIENT_RAIL_MOVEMENT_READY = 1476, - GAME_MSG_PLAYER_RAIL_ARRIVED_NOTIFICATION = 1477, - GAME_MSG_UPDATE_PLAYER_STATISTIC = 1481, + GAME_MSG_CANCEL_RAIL_MOVEMENT = 1474, + GAME_MSG_CLIENT_RAIL_MOVEMENT_READY = 1476, + GAME_MSG_PLAYER_RAIL_ARRIVED_NOTIFICATION = 1477, + GAME_MSG_UPDATE_PLAYER_STATISTIC = 1481, GAME_MSG_MODULAR_ASSEMBLY_NIF_COMPLETED = 1498, GAME_MSG_NOTIFY_NOT_ENOUGH_INV_SPACE = 1516, GAME_MSG_TEAM_SET_LEADER = 0x0615, @@ -527,11 +527,13 @@ enum GAME_MSG : unsigned short { GAME_MSG_TEAM_ADD_PLAYER = 0x061a, GAME_MSG_TEAM_REMOVE_PLAYER = 0x061b, GAME_MSG_START_CELEBRATION_EFFECT = 1618, - GAME_MSG_ADD_BUFF = 1647, + GAME_MSG_ADD_BUFF = 1647, GAME_MSG_SERVER_DONE_LOADING_ALL_OBJECTS = 1642, GAME_MSG_PLACE_PROPERTY_MODEL = 1170, GAME_MSG_VEHICLE_NOTIFY_HIT_IMAGINATION_SERVER = 1606, GAME_MSG_ADD_RUN_SPEED_MODIFIER = 1505, + GAME_MSG_HANDLE_HOT_PROPERTY_DATA = 1511, + GAME_MSG_SEND_HOT_PROPERTY_DATA = 1510, GAME_MSG_REMOVE_RUN_SPEED_MODIFIER = 1506, GAME_MSG_UPDATE_PROPERTY_PERFORMANCE_COST = 1547, GAME_MSG_PROPERTY_ENTRANCE_BEGIN = 1553, @@ -544,4 +546,4 @@ enum GAME_MSG : unsigned short { GAME_MSG_DISMOUNT_COMPLETE = 1756, GAME_MSG_MARK_INVENTORY_ITEM_AS_ACTIVE = 1767, END -}; \ No newline at end of file +};