mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-18 10:42:49 +00:00
refactor: mission, flag and collectible game messages as structs
Converts OfferMission, NotifyMission, NotifyMissionTask, ResetMissions,
NotifyClientFlagChange and NotifyLevelRewards (sent with SendToClient:
the old functions never broadcast) and the received RespondToMission,
MissionDialogueOK, RequestLinkedMission, SetFlag and HasBeenCollected
to NetGameMsgs in MissionMessages.{h,cpp}. Callers are switched,
OfferMission's send-it-twice behaviour moves to MissionOfferComponent,
the received messages are registered in GameMessageHandler's map and
the old functions are deleted. Handlers are copied verbatim. The
byte-equality helper can now compare SendToClient messages.
No wire change and no change in recipients. Verified byte for byte
against a frozen verbatim copy of the old functions over an input grid
(including OfferMission's two packets), received messages compared with
the old handlers' read sequences and every truncated payload rejected,
hand computed golden bytes and round trips. Layouts confirmed against
the 1.10.64 client in Ghidra.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "Entity.h"
|
||||
#include "EntityManager.h"
|
||||
#include "GameMessages.h"
|
||||
#include "MissionMessages.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "dZoneManager.h"
|
||||
#include "dServer.h"
|
||||
@@ -393,7 +394,11 @@ void Character::SetPlayerFlag(const uint32_t flagId, const bool value) {
|
||||
}
|
||||
}
|
||||
// Notify the client that a flag has changed server-side
|
||||
GameMessages::SendNotifyClientFlagChange(m_ObjectID, flagId, value, m_ParentUser->GetSystemAddress());
|
||||
GameMessages::NotifyClientFlagChange flagChange;
|
||||
flagChange.target = m_ObjectID;
|
||||
flagChange.iFlagID = flagId;
|
||||
flagChange.bFlag = value;
|
||||
flagChange.SendToClient(m_ParentUser->GetSystemAddress());
|
||||
}
|
||||
|
||||
bool Character::GetPlayerFlag(const uint32_t flagId) const {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "LevelProgressionComponent.h"
|
||||
#include "MissionMessages.h"
|
||||
#include "ControllablePhysicsComponent.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "CharacterComponent.h"
|
||||
@@ -53,8 +54,13 @@ void LevelProgressionComponent::HandleLevelUp() {
|
||||
auto* controllablePhysicsComponent = m_Parent->GetComponent<ControllablePhysicsComponent>();
|
||||
|
||||
if (!inventoryComponent || !controllablePhysicsComponent) return;
|
||||
GameMessages::NotifyLevelRewards levelRewards;
|
||||
levelRewards.target = m_Parent->GetObjectID();
|
||||
levelRewards.level = m_Level;
|
||||
|
||||
// Tell the client we beginning to send level rewards.
|
||||
if (rewardingItem) GameMessages::NotifyLevelRewards(m_Parent->GetObjectID(), m_Parent->GetSystemAddress(), m_Level, rewardingItem);
|
||||
levelRewards.sendingRewards = rewardingItem;
|
||||
if (rewardingItem) levelRewards.SendToClient(m_Parent->GetSystemAddress());
|
||||
|
||||
for (const auto& reward : rewards) {
|
||||
switch (reward.rewardType) {
|
||||
@@ -79,7 +85,8 @@ void LevelProgressionComponent::HandleLevelUp() {
|
||||
}
|
||||
}
|
||||
// Tell the client we have finished sending level rewards.
|
||||
if (rewardingItem) GameMessages::NotifyLevelRewards(m_Parent->GetObjectID(), m_Parent->GetSystemAddress(), m_Level, !rewardingItem);
|
||||
levelRewards.sendingRewards = !rewardingItem;
|
||||
if (rewardingItem) levelRewards.SendToClient(m_Parent->GetSystemAddress());
|
||||
}
|
||||
|
||||
void LevelProgressionComponent::SetRetroactiveBaseSpeed(){
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "CDMissionTasksTable.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "GameMessages.h"
|
||||
#include "MissionMessages.h"
|
||||
#include "Game.h"
|
||||
#include "Amf3.h"
|
||||
#include "dZoneManager.h"
|
||||
@@ -570,7 +571,10 @@ void MissionComponent::ResetMission(const int32_t missionId) {
|
||||
if (!mission) return;
|
||||
|
||||
m_Missions.erase(missionId);
|
||||
GameMessages::SendResetMissions(m_Parent, m_Parent->GetSystemAddress(), missionId);
|
||||
GameMessages::ResetMissions resetMissions;
|
||||
resetMissions.target = m_Parent->GetObjectID();
|
||||
resetMissions.missionID = missionId;
|
||||
resetMissions.SendToClient(m_Parent->GetSystemAddress());
|
||||
}
|
||||
|
||||
void PushMissions(const std::map<uint32_t, Mission*>& missions, AMFArrayValue& V, bool verbose) {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "CDMissionsTable.h"
|
||||
#include "CDMissionNPCComponentTable.h"
|
||||
#include "GameMessages.h"
|
||||
#include "MissionMessages.h"
|
||||
#include "Entity.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "Logger.h"
|
||||
@@ -54,6 +55,24 @@ MissionOfferComponent::MissionOfferComponent(Entity* parent, const int32_t compo
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
// "Why are we sending it twice, once to a non-player object?"
|
||||
// The first one (targeting the offerer) makes the client zoom into the object.
|
||||
// The second (targeting the player) actually makes the UI pop up so the mission can be offered.
|
||||
// Why is it like this? Because LU isn't just a clown, it's the entire circus.
|
||||
void OfferMissionToPlayer(const Entity& player, const int32_t missionID, const LWOOBJID offerer) {
|
||||
GameMessages::OfferMission offerMission;
|
||||
offerMission.missionID = missionID;
|
||||
offerMission.offerer = offerer;
|
||||
|
||||
offerMission.target = offerer;
|
||||
offerMission.SendToClient(player.GetSystemAddress());
|
||||
|
||||
offerMission.target = player.GetObjectID();
|
||||
offerMission.SendToClient(player.GetSystemAddress());
|
||||
}
|
||||
}
|
||||
|
||||
void MissionOfferComponent::OnUse(Entity* originator) {
|
||||
OfferMissions(originator);
|
||||
}
|
||||
@@ -95,7 +114,7 @@ void MissionOfferComponent::OfferMissions(Entity* entity, const uint32_t specifi
|
||||
|
||||
// We have the mission, if it is not complete, offer it
|
||||
if (mission->IsActive() || mission->IsReadyToComplete()) {
|
||||
GameMessages::SendOfferMission(entity->GetObjectID(), entity->GetSystemAddress(), missionId, m_Parent->GetObjectID());
|
||||
OfferMissionToPlayer(*entity, missionId, m_Parent->GetObjectID());
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -132,7 +151,7 @@ void MissionOfferComponent::OfferMissions(Entity* entity, const uint32_t specifi
|
||||
const auto& iter = std::find(randomMissionPool.begin(), randomMissionPool.end(), specifiedMissionId);
|
||||
|
||||
if (iter != randomMissionPool.end() && MissionPrerequisites::CanAccept(specifiedMissionId, missionComponent->GetMissions())) {
|
||||
GameMessages::SendOfferMission(entity->GetObjectID(), entity->GetSystemAddress(), specifiedMissionId, m_Parent->GetObjectID());
|
||||
OfferMissionToPlayer(*entity, specifiedMissionId, m_Parent->GetObjectID());
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -152,7 +171,7 @@ void MissionOfferComponent::OfferMissions(Entity* entity, const uint32_t specifi
|
||||
|
||||
if (mission == nullptr || mission->IsAchievement()) continue;
|
||||
|
||||
GameMessages::SendOfferMission(entity->GetObjectID(), entity->GetSystemAddress(), sample, m_Parent->GetObjectID());
|
||||
OfferMissionToPlayer(*entity, sample, m_Parent->GetObjectID());
|
||||
|
||||
canAcceptPool.clear();
|
||||
|
||||
@@ -169,9 +188,9 @@ void MissionOfferComponent::OfferMissions(Entity* entity, const uint32_t specifi
|
||||
|
||||
const auto selected = canAcceptPool[GeneralUtils::GenerateRandomNumber<int>(0, canAcceptPool.size() - 1)];
|
||||
|
||||
GameMessages::SendOfferMission(entity->GetObjectID(), entity->GetSystemAddress(), selected, m_Parent->GetObjectID());
|
||||
OfferMissionToPlayer(*entity, selected, m_Parent->GetObjectID());
|
||||
} else if (offeredMission.GetOffersMission()) {
|
||||
GameMessages::SendOfferMission(entity->GetObjectID(), entity->GetSystemAddress(), missionId, m_Parent->GetObjectID());
|
||||
OfferMissionToPlayer(*entity, missionId, m_Parent->GetObjectID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ set(DGAME_DGAMEMESSAGES_SOURCES
|
||||
"ActivityMessages.cpp"
|
||||
"GameMessageHandler.cpp"
|
||||
"GameMessages.cpp"
|
||||
"MissionMessages.cpp"
|
||||
"RacingMessages.cpp"
|
||||
"PropertyDataMessage.cpp"
|
||||
"PropertySelectQueryProperty.cpp")
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "EchoSyncSkill.h"
|
||||
#include "ActivityMessages.h"
|
||||
#include "RacingMessages.h"
|
||||
#include "MissionMessages.h"
|
||||
#include "eMissionTaskType.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "ServiceType.h"
|
||||
@@ -62,6 +63,13 @@ namespace {
|
||||
{ NOTIFY_SERVER_VEHICLE_REMOVE_PASSIVE_BOOST_ACTION, []() { return std::make_unique<VehicleNotifyServerRemovePassiveBoostAction>(); } },
|
||||
{ RACING_PLAYER_INFO_RESET_FINISHED, []() { return std::make_unique<RacingPlayerInfoResetFinished>(); } },
|
||||
{ VEHICLE_NOTIFY_HIT_IMAGINATION_SERVER, []() { return std::make_unique<VehicleNotifyHitImaginationServer>(); } },
|
||||
|
||||
// Missions, flags, collectibles
|
||||
{ RESPOND_TO_MISSION, []() { return std::make_unique<RespondToMission>(); } },
|
||||
{ MISSION_DIALOGUE_OK, []() { return std::make_unique<MissionDialogueOK>(); } },
|
||||
{ REQUEST_LINKED_MISSION, []() { return std::make_unique<RequestLinkedMission>(); } },
|
||||
{ SET_FLAG, []() { return std::make_unique<SetFlag>(); } },
|
||||
{ HAS_BEEN_COLLECTED, []() { return std::make_unique<HasBeenCollected>(); } },
|
||||
};
|
||||
};
|
||||
|
||||
@@ -137,21 +145,6 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream& inStream, const System
|
||||
GameMessages::HandleUnequipItem(inStream, entity);
|
||||
break;
|
||||
|
||||
case MessageType::Game::RESPOND_TO_MISSION: {
|
||||
GameMessages::HandleRespondToMission(inStream, entity);
|
||||
break;
|
||||
}
|
||||
|
||||
case MessageType::Game::SET_FLAG: {
|
||||
GameMessages::HandleSetFlag(inStream, entity);
|
||||
break;
|
||||
}
|
||||
|
||||
case MessageType::Game::HAS_BEEN_COLLECTED: {
|
||||
GameMessages::HandleHasBeenCollected(inStream, entity);
|
||||
break;
|
||||
}
|
||||
|
||||
// Currently not actually used for our implementation, however its used right now to get around invisible inventory items in the client.
|
||||
case MessageType::Game::SELECT_SKILL: {
|
||||
auto var = entity->GetVar<bool>(u"dlu_first_time_load");
|
||||
@@ -252,16 +245,6 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream& inStream, const System
|
||||
break;
|
||||
}
|
||||
|
||||
case MessageType::Game::REQUEST_LINKED_MISSION: {
|
||||
GameMessages::HandleRequestLinkedMission(inStream, entity);
|
||||
break;
|
||||
}
|
||||
|
||||
case MessageType::Game::MISSION_DIALOGUE_OK: {
|
||||
GameMessages::HandleMissionDialogOK(inStream, entity);
|
||||
break;
|
||||
}
|
||||
|
||||
case MessageType::Game::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 :)
|
||||
|
||||
@@ -351,19 +351,6 @@ void GameMessages::SendStartPathing(Entity* entity) {
|
||||
SEND_PACKET_BROADCAST;
|
||||
}
|
||||
|
||||
void GameMessages::SendResetMissions(Entity* entity, const SystemAddress& sysAddr, const int32_t missionid) {
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
bitStream.Write(MessageType::Game::RESET_MISSIONS);
|
||||
|
||||
bitStream.Write(missionid != -1);
|
||||
if (missionid != -1) bitStream.Write(missionid);
|
||||
|
||||
SEND_PACKET;
|
||||
}
|
||||
|
||||
void GameMessages::SendPlatformResync(Entity* entity, const SystemAddress& sysAddr, bool bStopAtDesiredWaypoint,
|
||||
int iIndex, int iDesiredWaypointIndex, int nextIndex,
|
||||
eMovementPlatformState movementState, bool special) {
|
||||
@@ -514,18 +501,6 @@ void GameMessages::SendAddItemToInventoryClientSync(Entity* entity, const System
|
||||
SEND_PACKET;
|
||||
}
|
||||
|
||||
void GameMessages::SendNotifyClientFlagChange(const LWOOBJID& objectID, uint32_t iFlagID, bool bFlag, const SystemAddress& sysAddr) {
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(objectID);
|
||||
bitStream.Write(MessageType::Game::NOTIFY_CLIENT_FLAG_CHANGE);
|
||||
bitStream.Write(bFlag);
|
||||
bitStream.Write(iFlagID);
|
||||
|
||||
SEND_PACKET;
|
||||
}
|
||||
|
||||
void GameMessages::SendChangeObjectWorldState(const LWOOBJID& objectID, eObjectWorldState state, const SystemAddress& sysAddr) {
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
@@ -538,67 +513,6 @@ void GameMessages::SendChangeObjectWorldState(const LWOOBJID& objectID, eObjectW
|
||||
SEND_PACKET;
|
||||
}
|
||||
|
||||
void GameMessages::SendOfferMission(const LWOOBJID& entity, const SystemAddress& sysAddr, int32_t missionID, const LWOOBJID& offererID) {
|
||||
//You might be wondering.
|
||||
//"Why are we sending it twice, once to a non-player object?
|
||||
//Well, the first one (sent to the offerer) makes the client zoom into the object.
|
||||
//The second, actually makes the UI pop up so you can be offered the mission.
|
||||
//Why is it like this? Because LU isn't just a clown, it's the entire circus.
|
||||
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(offererID);
|
||||
bitStream.Write(MessageType::Game::OFFER_MISSION);
|
||||
bitStream.Write(missionID);
|
||||
bitStream.Write(offererID);
|
||||
|
||||
SEND_PACKET;
|
||||
|
||||
{
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(entity);
|
||||
bitStream.Write(MessageType::Game::OFFER_MISSION);
|
||||
bitStream.Write(missionID);
|
||||
bitStream.Write(offererID);
|
||||
|
||||
SEND_PACKET;
|
||||
}
|
||||
}
|
||||
|
||||
void GameMessages::SendNotifyMission(Entity* entity, const SystemAddress& sysAddr, int missionID, int missionState, bool sendingRewards) {
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
bitStream.Write(MessageType::Game::NOTIFY_MISSION);
|
||||
bitStream.Write(missionID);
|
||||
bitStream.Write(missionState);
|
||||
bitStream.Write(sendingRewards);
|
||||
|
||||
SEND_PACKET;
|
||||
}
|
||||
|
||||
void GameMessages::SendNotifyMissionTask(Entity* entity, const SystemAddress& sysAddr, int missionID, int taskMask, std::vector<float> updates) {
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
bitStream.Write(MessageType::Game::NOTIFY_MISSION_TASK);
|
||||
|
||||
bitStream.Write(missionID);
|
||||
bitStream.Write(taskMask);
|
||||
bitStream.Write<unsigned char>(updates.size());
|
||||
|
||||
for (uint32_t i = 0; i < updates.size(); ++i) {
|
||||
bitStream.Write(updates[i]);
|
||||
}
|
||||
|
||||
SEND_PACKET;
|
||||
}
|
||||
|
||||
void GameMessages::SendModifyLEGOScore(Entity* entity, const SystemAddress& sysAddr, int64_t score, eLootSourceType sourceType) {
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
@@ -1460,19 +1374,6 @@ void GameMessages::SendRequestActivitySummaryLeaderboardData(const LWOOBJID& obj
|
||||
SEND_PACKET;
|
||||
}
|
||||
|
||||
void GameMessages::NotifyLevelRewards(LWOOBJID objectID, const SystemAddress& sysAddr, int level, bool sending_rewards) {
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(objectID);
|
||||
bitStream.Write(MessageType::Game::NOTIFY_LEVEL_REWARDS);
|
||||
|
||||
bitStream.Write(level);
|
||||
bitStream.Write(sending_rewards);
|
||||
|
||||
SEND_PACKET;
|
||||
}
|
||||
|
||||
void GameMessages::SendSetShootingGalleryParams(LWOOBJID objectId, const SystemAddress& sysAddr,
|
||||
float cameraFOV,
|
||||
float cooldown,
|
||||
@@ -4626,127 +4527,6 @@ void GameMessages::HandleModularBuildConvertModel(RakNet::BitStream& inStream, E
|
||||
item->SetCount(item->GetCount() - 1, false, false, true, eLootSourceType::QUICKBUILD);
|
||||
}
|
||||
|
||||
void GameMessages::HandleSetFlag(RakNet::BitStream& inStream, Entity* entity) {
|
||||
bool bFlag{};
|
||||
int32_t iFlagID{};
|
||||
|
||||
inStream.Read(bFlag);
|
||||
inStream.Read(iFlagID);
|
||||
|
||||
auto character = entity->GetCharacter();
|
||||
if (character) character->SetPlayerFlag(iFlagID, bFlag);
|
||||
|
||||
// This is always set the first time a player loads into a world from character select
|
||||
// and is used to know when to refresh the players inventory items so they show up.
|
||||
if (iFlagID == ePlayerFlag::IS_NEWS_SCREEN_VISIBLE && bFlag) {
|
||||
entity->SetVar<bool>(u"dlu_first_time_load", true);
|
||||
}
|
||||
}
|
||||
|
||||
void GameMessages::HandleRespondToMission(RakNet::BitStream& inStream, Entity* entity) {
|
||||
int missionID{};
|
||||
LWOOBJID playerID{};
|
||||
LWOOBJID receiverID{};
|
||||
bool isDefaultReward{};
|
||||
LOT reward = LOT_NULL;
|
||||
|
||||
inStream.Read(missionID);
|
||||
inStream.Read(playerID);
|
||||
inStream.Read(receiverID);
|
||||
inStream.Read(isDefaultReward);
|
||||
if (isDefaultReward) inStream.Read(reward);
|
||||
|
||||
MissionComponent* missionComponent = static_cast<MissionComponent*>(entity->GetComponent(eReplicaComponentType::MISSION));
|
||||
if (!missionComponent) {
|
||||
LOG("Unable to get mission component for entity %llu to handle RespondToMission", playerID);
|
||||
return;
|
||||
}
|
||||
|
||||
Mission* mission = missionComponent->GetMission(missionID);
|
||||
if (mission) {
|
||||
mission->SetReward(reward);
|
||||
} else {
|
||||
LOG("Unable to get mission %i for entity %llu to update reward in RespondToMission", missionID, playerID);
|
||||
}
|
||||
|
||||
Entity* offerer = Game::entityManager->GetEntity(receiverID);
|
||||
|
||||
if (offerer == nullptr) {
|
||||
LOG("Unable to get receiver entity %llu for RespondToMission", receiverID);
|
||||
return;
|
||||
}
|
||||
|
||||
offerer->GetScript()->OnRespondToMission(offerer, missionID, Game::entityManager->GetEntity(playerID), reward);
|
||||
}
|
||||
|
||||
void GameMessages::HandleMissionDialogOK(RakNet::BitStream& inStream, Entity* entity) {
|
||||
bool bIsComplete{};
|
||||
eMissionState iMissionState{};
|
||||
int missionID{};
|
||||
LWOOBJID responder{};
|
||||
Entity* player = nullptr;
|
||||
|
||||
inStream.Read(bIsComplete);
|
||||
inStream.Read(iMissionState);
|
||||
inStream.Read(missionID);
|
||||
inStream.Read(responder);
|
||||
player = Game::entityManager->GetEntity(responder);
|
||||
|
||||
if (entity) entity->GetScript()->OnMissionDialogueOK(entity, player, missionID, iMissionState);
|
||||
|
||||
// Get the player's mission component
|
||||
MissionComponent* missionComponent = static_cast<MissionComponent*>(player->GetComponent(eReplicaComponentType::MISSION));
|
||||
if (!missionComponent) {
|
||||
LOG("Unable to get mission component for entity %llu to handle MissionDialogueOK", player->GetObjectID());
|
||||
return;
|
||||
}
|
||||
|
||||
if (iMissionState == eMissionState::AVAILABLE || iMissionState == eMissionState::COMPLETE_AVAILABLE) {
|
||||
missionComponent->AcceptMission(missionID);
|
||||
} else if (iMissionState == eMissionState::READY_TO_COMPLETE || iMissionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
|
||||
missionComponent->CompleteMission(missionID);
|
||||
}
|
||||
|
||||
if (Game::config->GetValue("allow_players_to_skip_cinematics") != "1"
|
||||
|| !player->GetCharacter()
|
||||
|| !player->GetCharacter()->GetPlayerFlag(ePlayerFlag::DLU_SKIP_CINEMATICS)) return;
|
||||
player->AddCallbackTimer(0.5f, [player]() {
|
||||
if (!player) return;
|
||||
GameMessages::SendEndCinematic(player->GetObjectID(), u"", player->GetSystemAddress());
|
||||
});
|
||||
}
|
||||
|
||||
void GameMessages::HandleRequestLinkedMission(RakNet::BitStream& inStream, Entity* entity) {
|
||||
LWOOBJID playerId{};
|
||||
int missionId{};
|
||||
bool bMissionOffered{};
|
||||
|
||||
inStream.Read(playerId);
|
||||
inStream.Read(missionId);
|
||||
inStream.Read(bMissionOffered);
|
||||
|
||||
auto* player = Game::entityManager->GetEntity(playerId);
|
||||
|
||||
auto* missionOfferComponent = static_cast<MissionOfferComponent*>(entity->GetComponent(eReplicaComponentType::MISSION_OFFER));
|
||||
|
||||
if (missionOfferComponent != nullptr) {
|
||||
missionOfferComponent->OfferMissions(player, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void GameMessages::HandleHasBeenCollected(RakNet::BitStream& inStream, Entity* entity) {
|
||||
LWOOBJID playerID;
|
||||
inStream.Read(playerID);
|
||||
|
||||
Entity* player = Game::entityManager->GetEntity(playerID);
|
||||
if (!player || !entity || entity->GetCollectibleID() == 0) return;
|
||||
|
||||
MissionComponent* missionComponent = static_cast<MissionComponent*>(player->GetComponent(eReplicaComponentType::MISSION));
|
||||
if (missionComponent) {
|
||||
missionComponent->Progress(eMissionTaskType::COLLECTION, entity->GetLOT(), entity->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
void GameMessages::HandleNotifyServerLevelProcessingComplete(RakNet::BitStream& inStream, Entity* entity) {
|
||||
auto* levelComp = entity->GetComponent<LevelProgressionComponent>();
|
||||
if (!levelComp) return;
|
||||
|
||||
@@ -161,21 +161,14 @@ namespace GameMessages {
|
||||
int iIndex = 0, int iDesiredWaypointIndex = 1, int nextIndex = 1,
|
||||
eMovementPlatformState movementState = eMovementPlatformState::Moving, bool special = false);
|
||||
|
||||
void SendResetMissions(Entity* entity, const SystemAddress& sysAddr, const int32_t missionid = -1);
|
||||
void SendRestoreToPostLoadStats(Entity* entity, const SystemAddress& sysAddr);
|
||||
void SendServerDoneLoadingAllObjects(Entity* entity, const SystemAddress& sysAddr);
|
||||
void SendGMLevelBroadcast(const LWOOBJID& objectID, eGameMasterLevel level);
|
||||
void SendChatModeUpdate(const LWOOBJID& objectID, eGameMasterLevel level);
|
||||
|
||||
void SendAddItemToInventoryClientSync(Entity* entity, const SystemAddress& sysAddr, Item* item, const LWOOBJID& objectID, bool showFlyingLoot, int itemCount, LWOOBJID subKey = LWOOBJID_EMPTY, eLootSourceType lootSourceType = eLootSourceType::NONE);
|
||||
void SendNotifyClientFlagChange(const LWOOBJID& objectID, uint32_t iFlagID, bool bFlag, const SystemAddress& sysAddr);
|
||||
void SendChangeObjectWorldState(const LWOOBJID& objectID, eObjectWorldState 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<float> 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);
|
||||
void SendUIMessageServerToSingleClient(Entity* entity, const SystemAddress& sysAddr, const std::string& message, AMFBaseValue& args);
|
||||
|
||||
@@ -646,11 +639,6 @@ namespace GameMessages {
|
||||
void HandleQuickBuildCancel(RakNet::BitStream& inStream, Entity* entity);
|
||||
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 HandleNotifyServerLevelProcessingComplete(RakNet::BitStream& inStream, Entity* entity);
|
||||
void HandlePickupCurrency(RakNet::BitStream& inStream, Entity* entity);
|
||||
void HandleRequestDie(RakNet::BitStream& inStream, Entity* entity);
|
||||
|
||||
238
dGame/dGameMessages/MissionMessages.cpp
Normal file
238
dGame/dGameMessages/MissionMessages.cpp
Normal file
@@ -0,0 +1,238 @@
|
||||
#include "MissionMessages.h"
|
||||
|
||||
#include "BitStreamUtils.h"
|
||||
#include "Character.h"
|
||||
#include "CppScripts.h"
|
||||
#include "dConfig.h"
|
||||
#include "eMissionState.h"
|
||||
#include "eMissionTaskType.h"
|
||||
#include "ePlayerFlag.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "Entity.h"
|
||||
#include "EntityManager.h"
|
||||
#include "Game.h"
|
||||
#include "Logger.h"
|
||||
#include "Mission.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "MissionOfferComponent.h"
|
||||
|
||||
namespace GameMessages {
|
||||
void OfferMission::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write(missionID);
|
||||
bitStream.Write(offerer);
|
||||
}
|
||||
|
||||
bool OfferMission::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(bitStream.Read(missionID));
|
||||
VALIDATE_READ(bitStream.Read(offerer));
|
||||
return true;
|
||||
}
|
||||
|
||||
void RespondToMission::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write(missionID);
|
||||
bitStream.Write(playerID);
|
||||
bitStream.Write(receiver);
|
||||
BitStreamUtils::WriteOptional(bitStream, rewardItem, LOT_NULL);
|
||||
}
|
||||
|
||||
bool RespondToMission::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(bitStream.Read(missionID));
|
||||
VALIDATE_READ(bitStream.Read(playerID));
|
||||
VALIDATE_READ(bitStream.Read(receiver));
|
||||
VALIDATE_READ(BitStreamUtils::ReadOptional(bitStream, rewardItem, LOT_NULL));
|
||||
return true;
|
||||
}
|
||||
|
||||
void RespondToMission::Handle(Entity& entity, const SystemAddress& sysAddr) {
|
||||
const auto reward = rewardItem;
|
||||
MissionComponent* missionComponent = static_cast<MissionComponent*>(entity.GetComponent(eReplicaComponentType::MISSION));
|
||||
if (!missionComponent) {
|
||||
LOG("Unable to get mission component for entity %llu to handle RespondToMission", playerID);
|
||||
return;
|
||||
}
|
||||
|
||||
Mission* mission = missionComponent->GetMission(missionID);
|
||||
if (mission) {
|
||||
mission->SetReward(reward);
|
||||
} else {
|
||||
LOG("Unable to get mission %i for entity %llu to update reward in RespondToMission", missionID, playerID);
|
||||
}
|
||||
|
||||
Entity* offerer = Game::entityManager->GetEntity(receiver);
|
||||
|
||||
if (offerer == nullptr) {
|
||||
LOG("Unable to get receiver entity %llu for RespondToMission", receiver);
|
||||
return;
|
||||
}
|
||||
|
||||
offerer->GetScript()->OnRespondToMission(offerer, missionID, Game::entityManager->GetEntity(playerID), reward);
|
||||
}
|
||||
|
||||
void NotifyMission::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write(missionID);
|
||||
bitStream.Write(missionState);
|
||||
bitStream.Write(sendingRewards);
|
||||
}
|
||||
|
||||
bool NotifyMission::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(bitStream.Read(missionID));
|
||||
VALIDATE_READ(bitStream.Read(missionState));
|
||||
VALIDATE_READ(bitStream.Read(sendingRewards));
|
||||
return true;
|
||||
}
|
||||
|
||||
void NotifyMissionTask::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write(missionID);
|
||||
bitStream.Write(taskMask);
|
||||
bitStream.Write<uint8_t>(updates.size());
|
||||
for (const auto update : updates) bitStream.Write(update);
|
||||
}
|
||||
|
||||
bool NotifyMissionTask::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(bitStream.Read(missionID));
|
||||
VALIDATE_READ(bitStream.Read(taskMask));
|
||||
uint8_t count{};
|
||||
VALIDATE_READ(bitStream.Read(count));
|
||||
updates.resize(count);
|
||||
for (auto& update : updates) VALIDATE_READ(bitStream.Read(update));
|
||||
return true;
|
||||
}
|
||||
|
||||
void ResetMissions::Serialize(RakNet::BitStream& bitStream) const {
|
||||
BitStreamUtils::WriteOptional(bitStream, missionID, -1);
|
||||
}
|
||||
|
||||
bool ResetMissions::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(BitStreamUtils::ReadOptional(bitStream, missionID, -1));
|
||||
return true;
|
||||
}
|
||||
|
||||
void MissionDialogueOK::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write(bIsComplete);
|
||||
bitStream.Write(iMissionState);
|
||||
bitStream.Write(missionID);
|
||||
bitStream.Write(responder);
|
||||
}
|
||||
|
||||
bool MissionDialogueOK::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(bitStream.Read(bIsComplete));
|
||||
VALIDATE_READ(bitStream.Read(iMissionState));
|
||||
VALIDATE_READ(bitStream.Read(missionID));
|
||||
VALIDATE_READ(bitStream.Read(responder));
|
||||
return true;
|
||||
}
|
||||
|
||||
void MissionDialogueOK::Handle(Entity& entityRef, const SystemAddress& sysAddr) {
|
||||
Entity* entity = &entityRef;
|
||||
Entity* player = Game::entityManager->GetEntity(responder);
|
||||
|
||||
if (entity) entity->GetScript()->OnMissionDialogueOK(entity, player, missionID, iMissionState);
|
||||
|
||||
// Get the player's mission component
|
||||
MissionComponent* missionComponent = static_cast<MissionComponent*>(player->GetComponent(eReplicaComponentType::MISSION));
|
||||
if (!missionComponent) {
|
||||
LOG("Unable to get mission component for entity %llu to handle MissionDialogueOK", player->GetObjectID());
|
||||
return;
|
||||
}
|
||||
|
||||
if (iMissionState == eMissionState::AVAILABLE || iMissionState == eMissionState::COMPLETE_AVAILABLE) {
|
||||
missionComponent->AcceptMission(missionID);
|
||||
} else if (iMissionState == eMissionState::READY_TO_COMPLETE || iMissionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
|
||||
missionComponent->CompleteMission(missionID);
|
||||
}
|
||||
|
||||
if (Game::config->GetValue("allow_players_to_skip_cinematics") != "1"
|
||||
|| !player->GetCharacter()
|
||||
|| !player->GetCharacter()->GetPlayerFlag(ePlayerFlag::DLU_SKIP_CINEMATICS)) return;
|
||||
player->AddCallbackTimer(0.5f, [player]() {
|
||||
if (!player) return;
|
||||
GameMessages::SendEndCinematic(player->GetObjectID(), u"", player->GetSystemAddress());
|
||||
});
|
||||
}
|
||||
|
||||
void RequestLinkedMission::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write(playerID);
|
||||
bitStream.Write(missionID);
|
||||
bitStream.Write(bMissionOffered);
|
||||
}
|
||||
|
||||
bool RequestLinkedMission::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(bitStream.Read(playerID));
|
||||
VALIDATE_READ(bitStream.Read(missionID));
|
||||
VALIDATE_READ(bitStream.Read(bMissionOffered));
|
||||
return true;
|
||||
}
|
||||
|
||||
void RequestLinkedMission::Handle(Entity& entity, const SystemAddress& sysAddr) {
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
|
||||
auto* missionOfferComponent = static_cast<MissionOfferComponent*>(entity.GetComponent(eReplicaComponentType::MISSION_OFFER));
|
||||
|
||||
if (missionOfferComponent != nullptr) {
|
||||
missionOfferComponent->OfferMissions(player, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void SetFlag::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write(bFlag);
|
||||
bitStream.Write(iFlagID);
|
||||
}
|
||||
|
||||
bool SetFlag::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(bitStream.Read(bFlag));
|
||||
VALIDATE_READ(bitStream.Read(iFlagID));
|
||||
return true;
|
||||
}
|
||||
|
||||
void SetFlag::Handle(Entity& entity, const SystemAddress& sysAddr) {
|
||||
auto character = entity.GetCharacter();
|
||||
if (character) character->SetPlayerFlag(iFlagID, bFlag);
|
||||
|
||||
// This is always set the first time a player loads into a world from character select
|
||||
// and is used to know when to refresh the players inventory items so they show up.
|
||||
if (iFlagID == ePlayerFlag::IS_NEWS_SCREEN_VISIBLE && bFlag) {
|
||||
entity.SetVar<bool>(u"dlu_first_time_load", true);
|
||||
}
|
||||
}
|
||||
|
||||
void NotifyClientFlagChange::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write(bFlag);
|
||||
bitStream.Write(iFlagID);
|
||||
}
|
||||
|
||||
bool NotifyClientFlagChange::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(bitStream.Read(bFlag));
|
||||
VALIDATE_READ(bitStream.Read(iFlagID));
|
||||
return true;
|
||||
}
|
||||
|
||||
void HasBeenCollected::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write(playerID);
|
||||
}
|
||||
|
||||
bool HasBeenCollected::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(bitStream.Read(playerID));
|
||||
return true;
|
||||
}
|
||||
|
||||
void HasBeenCollected::Handle(Entity& entity, const SystemAddress& sysAddr) {
|
||||
Entity* player = Game::entityManager->GetEntity(playerID);
|
||||
if (!player || entity.GetCollectibleID() == 0) return;
|
||||
|
||||
MissionComponent* missionComponent = static_cast<MissionComponent*>(player->GetComponent(eReplicaComponentType::MISSION));
|
||||
if (missionComponent) {
|
||||
missionComponent->Progress(eMissionTaskType::COLLECTION, entity.GetLOT(), entity.GetObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
void NotifyLevelRewards::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write(level);
|
||||
bitStream.Write(sendingRewards);
|
||||
}
|
||||
|
||||
bool NotifyLevelRewards::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(bitStream.Read(level));
|
||||
VALIDATE_READ(bitStream.Read(sendingRewards));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
136
dGame/dGameMessages/MissionMessages.h
Normal file
136
dGame/dGameMessages/MissionMessages.h
Normal file
@@ -0,0 +1,136 @@
|
||||
#ifndef MISSIONMESSAGES_H
|
||||
#define MISSIONMESSAGES_H
|
||||
|
||||
#include "GameMessages.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
enum class eMissionState : int;
|
||||
|
||||
// Game messages for missions, player flags, collectibles and level rewards.
|
||||
// Field names follow the client (legouniverse.exe 1.10.64); fields are listed in wire order.
|
||||
// The server -> client messages here are sent with SendToClient: they were never broadcast.
|
||||
namespace GameMessages {
|
||||
// Server -> client. Sent twice by MissionOfferComponent: once targeting the offerer (zooms the camera to it)
|
||||
// and once targeting the player (opens the offer UI).
|
||||
struct OfferMission : public NetGameMsg {
|
||||
OfferMission() : NetGameMsg(MessageType::Game::OFFER_MISSION) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
|
||||
int32_t missionID{};
|
||||
LWOOBJID offerer{};
|
||||
};
|
||||
|
||||
// Client -> server.
|
||||
struct RespondToMission : public NetGameMsg {
|
||||
RespondToMission() : NetGameMsg(MessageType::Game::RESPOND_TO_MISSION) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
void Handle(Entity& entity, const SystemAddress& sysAddr) override;
|
||||
|
||||
int32_t missionID{};
|
||||
LWOOBJID playerID{};
|
||||
LWOOBJID receiver{};
|
||||
LOT rewardItem{ LOT_NULL }; // optional
|
||||
};
|
||||
|
||||
// Server -> client.
|
||||
struct NotifyMission : public NetGameMsg {
|
||||
NotifyMission() : NetGameMsg(MessageType::Game::NOTIFY_MISSION) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
|
||||
int32_t missionID{};
|
||||
int32_t missionState{};
|
||||
bool sendingRewards{};
|
||||
};
|
||||
|
||||
// Server -> client.
|
||||
struct NotifyMissionTask : public NetGameMsg {
|
||||
NotifyMissionTask() : NetGameMsg(MessageType::Game::NOTIFY_MISSION_TASK) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
|
||||
int32_t missionID{};
|
||||
int32_t taskMask{};
|
||||
std::vector<float> updates{}; // u8 count, then the floats
|
||||
};
|
||||
|
||||
// Server -> client.
|
||||
struct ResetMissions : public NetGameMsg {
|
||||
ResetMissions() : NetGameMsg(MessageType::Game::RESET_MISSIONS) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
|
||||
int32_t missionID{ -1 }; // optional
|
||||
};
|
||||
|
||||
// Client -> server.
|
||||
struct MissionDialogueOK : public NetGameMsg {
|
||||
MissionDialogueOK() : NetGameMsg(MessageType::Game::MISSION_DIALOGUE_OK) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
void Handle(Entity& entity, const SystemAddress& sysAddr) override;
|
||||
|
||||
bool bIsComplete{};
|
||||
eMissionState iMissionState{};
|
||||
int32_t missionID{};
|
||||
LWOOBJID responder{};
|
||||
};
|
||||
|
||||
// Client -> server.
|
||||
struct RequestLinkedMission : public NetGameMsg {
|
||||
RequestLinkedMission() : NetGameMsg(MessageType::Game::REQUEST_LINKED_MISSION) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
void Handle(Entity& entity, const SystemAddress& sysAddr) override;
|
||||
|
||||
LWOOBJID playerID{};
|
||||
int32_t missionID{};
|
||||
bool bMissionOffered{};
|
||||
};
|
||||
|
||||
// Client -> server.
|
||||
struct SetFlag : public NetGameMsg {
|
||||
SetFlag() : NetGameMsg(MessageType::Game::SET_FLAG) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
void Handle(Entity& entity, const SystemAddress& sysAddr) override;
|
||||
|
||||
bool bFlag{};
|
||||
int32_t iFlagID{};
|
||||
};
|
||||
|
||||
// Server -> client.
|
||||
struct NotifyClientFlagChange : public NetGameMsg {
|
||||
NotifyClientFlagChange() : NetGameMsg(MessageType::Game::NOTIFY_CLIENT_FLAG_CHANGE) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
|
||||
bool bFlag{};
|
||||
uint32_t iFlagID{};
|
||||
};
|
||||
|
||||
// Client -> server. Sent when the player collects a collectible.
|
||||
struct HasBeenCollected : public NetGameMsg {
|
||||
HasBeenCollected() : NetGameMsg(MessageType::Game::HAS_BEEN_COLLECTED) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
void Handle(Entity& entity, const SystemAddress& sysAddr) override;
|
||||
|
||||
LWOOBJID playerID{};
|
||||
};
|
||||
|
||||
// Server -> client.
|
||||
struct NotifyLevelRewards : public NetGameMsg {
|
||||
NotifyLevelRewards() : NetGameMsg(MessageType::Game::NOTIFY_LEVEL_REWARDS) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
|
||||
int32_t level{};
|
||||
bool sendingRewards{};
|
||||
};
|
||||
};
|
||||
|
||||
#endif // MISSIONMESSAGES_H
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "EntityManager.h"
|
||||
#include "Game.h"
|
||||
#include "GameMessages.h"
|
||||
#include "MissionMessages.h"
|
||||
#include "Mail.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "eRacingTaskParam.h"
|
||||
@@ -628,7 +629,12 @@ void Mission::SetMissionState(const eMissionState state, const bool sendingRewar
|
||||
auto* characterComponent = entity->GetComponent<CharacterComponent>();
|
||||
if (!characterComponent) return;
|
||||
|
||||
GameMessages::SendNotifyMission(entity, characterComponent->GetSystemAddress(), info.id, static_cast<int>(state), sendingRewards);
|
||||
GameMessages::NotifyMission notifyMission;
|
||||
notifyMission.target = entity->GetObjectID();
|
||||
notifyMission.missionID = info.id;
|
||||
notifyMission.missionState = static_cast<int32_t>(state);
|
||||
notifyMission.sendingRewards = sendingRewards;
|
||||
notifyMission.SendToClient(characterComponent->GetSystemAddress());
|
||||
}
|
||||
|
||||
void Mission::SetMissionTypeState(eMissionLockState state, const std::string& type, const std::string& subType) {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "EntityManager.h"
|
||||
#include "ScriptedActivityComponent.h"
|
||||
#include "GameMessages.h"
|
||||
#include "MissionMessages.h"
|
||||
#include "dZoneManager.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "MissionComponent.h"
|
||||
@@ -68,9 +69,12 @@ void MissionTask::SetProgress(const uint32_t value, const bool echo) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<float> updates;
|
||||
updates.push_back(static_cast<float>(progress));
|
||||
GameMessages::SendNotifyMissionTask(entity, entity->GetSystemAddress(), static_cast<int>(info->id), static_cast<int>(1 << (mask + 1)), updates);
|
||||
GameMessages::NotifyMissionTask notifyMissionTask;
|
||||
notifyMissionTask.target = entity->GetObjectID();
|
||||
notifyMissionTask.missionID = static_cast<int32_t>(info->id);
|
||||
notifyMissionTask.taskMask = static_cast<int32_t>(1 << (mask + 1));
|
||||
notifyMissionTask.updates.push_back(static_cast<float>(progress));
|
||||
notifyMissionTask.SendToClient(entity->GetSystemAddress());
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user