mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-15 20:08:14 +00:00
Merge branch 'main' into fix/cmake-libs-2
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "eMissionTaskType.h"
|
||||
#include "eMissionLockState.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "Character.h"
|
||||
|
||||
#include "CDMissionEmailTable.h"
|
||||
|
||||
@@ -40,7 +41,7 @@ Mission::Mission(MissionComponent* missionComponent, const uint32_t missionId) {
|
||||
|
||||
m_State = eMissionState::UNKNOWN;
|
||||
|
||||
auto* missionsTable = CDClientManager::Instance().GetTable<CDMissionsTable>();
|
||||
auto* missionsTable = CDClientManager::GetTable<CDMissionsTable>();
|
||||
|
||||
auto* mis = missionsTable->GetPtrByMissionID(missionId);
|
||||
info = *mis;
|
||||
@@ -51,7 +52,7 @@ Mission::Mission(MissionComponent* missionComponent, const uint32_t missionId) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* tasksTable = CDClientManager::Instance().GetTable<CDMissionTasksTable>();
|
||||
auto* tasksTable = CDClientManager::GetTable<CDMissionTasksTable>();
|
||||
|
||||
auto tasks = tasksTable->GetByMissionID(missionId);
|
||||
|
||||
@@ -179,7 +180,7 @@ void Mission::UpdateXml(tinyxml2::XMLElement* element) {
|
||||
}
|
||||
|
||||
bool Mission::IsValidMission(const uint32_t missionId) {
|
||||
auto* table = CDClientManager::Instance().GetTable<CDMissionsTable>();
|
||||
auto* table = CDClientManager::GetTable<CDMissionsTable>();
|
||||
|
||||
const auto missions = table->Query([=](const CDMissions& entry) {
|
||||
return entry.id == static_cast<int>(missionId);
|
||||
@@ -189,7 +190,7 @@ bool Mission::IsValidMission(const uint32_t missionId) {
|
||||
}
|
||||
|
||||
bool Mission::IsValidMission(const uint32_t missionId, CDMissions& info) {
|
||||
auto* table = CDClientManager::Instance().GetTable<CDMissionsTable>();
|
||||
auto* table = CDClientManager::GetTable<CDMissionsTable>();
|
||||
|
||||
const auto missions = table->Query([=](const CDMissions& entry) {
|
||||
return entry.id == static_cast<int>(missionId);
|
||||
@@ -208,8 +209,8 @@ Entity* Mission::GetAssociate() const {
|
||||
return m_MissionComponent->GetParent();
|
||||
}
|
||||
|
||||
User* Mission::GetUser() const {
|
||||
return GetAssociate()->GetParentUser();
|
||||
Character* Mission::GetCharacter() const {
|
||||
return GetAssociate()->GetCharacter();
|
||||
}
|
||||
|
||||
uint32_t Mission::GetMissionId() const {
|
||||
@@ -333,7 +334,7 @@ void Mission::Complete(const bool yieldRewards) {
|
||||
|
||||
missionComponent->Progress(eMissionTaskType::RACING, info.id, static_cast<LWOOBJID>(eRacingTaskParam::COMPLETE_TRACK_TASKS));
|
||||
|
||||
auto* missionEmailTable = CDClientManager::Instance().GetTable<CDMissionEmailTable>();
|
||||
auto* missionEmailTable = CDClientManager::GetTable<CDMissionEmailTable>();
|
||||
|
||||
const auto missionId = GetMissionId();
|
||||
|
||||
@@ -390,7 +391,7 @@ void Mission::Catchup() {
|
||||
|
||||
if (type == eMissionTaskType::PLAYER_FLAG) {
|
||||
for (int32_t target : task->GetAllTargets()) {
|
||||
const auto flag = GetUser()->GetLastUsedChar()->GetPlayerFlag(target);
|
||||
const auto flag = GetCharacter()->GetPlayerFlag(target);
|
||||
|
||||
if (!flag) {
|
||||
continue;
|
||||
@@ -413,7 +414,7 @@ void Mission::YieldRewards() {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* character = GetUser()->GetLastUsedChar();
|
||||
auto* character = GetCharacter();
|
||||
|
||||
auto* inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
auto* levelComponent = entity->GetComponent<LevelProgressionComponent>();
|
||||
@@ -599,8 +600,10 @@ void Mission::SetMissionState(const eMissionState state, const bool sendingRewar
|
||||
if (entity == nullptr) {
|
||||
return;
|
||||
}
|
||||
auto* characterComponent = entity->GetComponent<CharacterComponent>();
|
||||
if (!characterComponent) return;
|
||||
|
||||
GameMessages::SendNotifyMission(entity, entity->GetParentUser()->GetSystemAddress(), info.id, static_cast<int>(state), sendingRewards);
|
||||
GameMessages::SendNotifyMission(entity, characterComponent->GetSystemAddress(), info.id, static_cast<int>(state), sendingRewards);
|
||||
}
|
||||
|
||||
void Mission::SetMissionTypeState(eMissionLockState state, const std::string& type, const std::string& subType) {
|
||||
|
@@ -17,6 +17,7 @@ namespace tinyxml2 {
|
||||
enum class eMissionState : int;
|
||||
enum class eMissionLockState : int;
|
||||
class MissionComponent;
|
||||
class Character;
|
||||
|
||||
/**
|
||||
* A mission (or achievement) that a player may unlock, progress and complete.
|
||||
@@ -46,7 +47,7 @@ public:
|
||||
* Returns the account owns the entity that is currently progressing this mission
|
||||
* @return the account owns the entity that is currently progressing this mission
|
||||
*/
|
||||
User* GetUser() const;
|
||||
Character* GetCharacter() const;
|
||||
|
||||
/**
|
||||
* Returns the current state of this mission
|
||||
|
@@ -161,7 +161,7 @@ bool MissionPrerequisites::CheckPrerequisites(uint32_t missionId, const std::uno
|
||||
return index->second->Execute(missions);
|
||||
}
|
||||
|
||||
auto* missionsTable = CDClientManager::Instance().GetTable<CDMissionsTable>();
|
||||
auto* missionsTable = CDClientManager::GetTable<CDMissionsTable>();
|
||||
const auto missionEntries = missionsTable->Query([=](const CDMissions& entry) {
|
||||
return entry.id == static_cast<int>(missionId);
|
||||
});
|
||||
|
@@ -27,19 +27,15 @@ MissionTask::MissionTask(Mission* mission, CDMissionTasks* info, uint32_t mask)
|
||||
std::string token;
|
||||
|
||||
while (std::getline(stream, token, ',')) {
|
||||
uint32_t parameter;
|
||||
if (GeneralUtils::TryParse(token, parameter)) {
|
||||
parameters.push_back(parameter);
|
||||
}
|
||||
const auto parameter = GeneralUtils::TryParse<uint32_t>(token);
|
||||
if (parameter) parameters.push_back(parameter.value());
|
||||
}
|
||||
|
||||
stream = std::istringstream(info->targetGroup);
|
||||
|
||||
while (std::getline(stream, token, ',')) {
|
||||
uint32_t parameter;
|
||||
if (GeneralUtils::TryParse(token, parameter)) {
|
||||
targets.push_back(parameter);
|
||||
}
|
||||
const auto parameter = GeneralUtils::TryParse<uint32_t>(token);
|
||||
if (parameter) targets.push_back(parameter.value());
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user