mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 17:54:01 +00:00
format codebase
This commit is contained in:
@@ -20,596 +20,596 @@
|
||||
#include "Database.h"
|
||||
|
||||
Mission::Mission(MissionComponent* missionComponent, const uint32_t missionId) {
|
||||
m_MissionComponent = missionComponent;
|
||||
m_MissionComponent = missionComponent;
|
||||
|
||||
m_Completions = 0;
|
||||
m_Completions = 0;
|
||||
|
||||
m_Timestamp = 0;
|
||||
m_Timestamp = 0;
|
||||
|
||||
m_Reward = 0;
|
||||
m_Reward = 0;
|
||||
|
||||
m_State = MissionState::MISSION_STATE_UNKNOWN;
|
||||
m_State = MissionState::MISSION_STATE_UNKNOWN;
|
||||
|
||||
auto* missionsTable = CDClientManager::Instance()->GetTable<CDMissionsTable>("Missions");
|
||||
auto* missionsTable = CDClientManager::Instance()->GetTable<CDMissionsTable>("Missions");
|
||||
|
||||
info = missionsTable->GetPtrByMissionID(missionId);
|
||||
info = missionsTable->GetPtrByMissionID(missionId);
|
||||
|
||||
if (info == &CDMissionsTable::Default) {
|
||||
Game::logger->Log("Missions", "Failed to find mission (%i)!", missionId);
|
||||
if (info == &CDMissionsTable::Default) {
|
||||
Game::logger->Log("Missions", "Failed to find mission (%i)!", missionId);
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
auto* tasksTable = CDClientManager::Instance()->GetTable<CDMissionTasksTable>("MissionTasks");
|
||||
auto* tasksTable = CDClientManager::Instance()->GetTable<CDMissionTasksTable>("MissionTasks");
|
||||
|
||||
auto tasks = tasksTable->GetByMissionID(missionId);
|
||||
auto tasks = tasksTable->GetByMissionID(missionId);
|
||||
|
||||
for (auto i = 0U; i < tasks.size(); ++i) {
|
||||
auto* info = tasks[i];
|
||||
for (auto i = 0U; i < tasks.size(); ++i) {
|
||||
auto* info = tasks[i];
|
||||
|
||||
auto* task = new MissionTask(this, info, i);
|
||||
auto* task = new MissionTask(this, info, i);
|
||||
|
||||
m_Tasks.push_back(task);
|
||||
}
|
||||
m_Tasks.push_back(task);
|
||||
}
|
||||
}
|
||||
|
||||
void Mission::LoadFromXml(tinyxml2::XMLElement* element) {
|
||||
// Start custom XML
|
||||
if (element->Attribute("state") != nullptr) {
|
||||
m_State = static_cast<MissionState>(std::stoul(element->Attribute("state")));
|
||||
}
|
||||
// End custom XML
|
||||
// Start custom XML
|
||||
if (element->Attribute("state") != nullptr) {
|
||||
m_State = static_cast<MissionState>(std::stoul(element->Attribute("state")));
|
||||
}
|
||||
// End custom XML
|
||||
|
||||
if (element->Attribute("cct") != nullptr) {
|
||||
m_Completions = std::stoul(element->Attribute("cct"));
|
||||
if (element->Attribute("cct") != nullptr) {
|
||||
m_Completions = std::stoul(element->Attribute("cct"));
|
||||
|
||||
m_Timestamp = std::stoul(element->Attribute("cts"));
|
||||
m_Timestamp = std::stoul(element->Attribute("cts"));
|
||||
|
||||
if (IsComplete()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (IsComplete()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
auto* task = element->FirstChildElement();
|
||||
auto* task = element->FirstChildElement();
|
||||
|
||||
auto index = 0U;
|
||||
auto index = 0U;
|
||||
|
||||
while (task != nullptr) {
|
||||
if (index >= m_Tasks.size()) {
|
||||
break;
|
||||
}
|
||||
while (task != nullptr) {
|
||||
if (index >= m_Tasks.size()) {
|
||||
break;
|
||||
}
|
||||
|
||||
const auto type = m_Tasks[index]->GetType();
|
||||
const auto type = m_Tasks[index]->GetType();
|
||||
|
||||
if (type == MissionTaskType::MISSION_TASK_TYPE_ENVIRONMENT ||
|
||||
type == MissionTaskType::MISSION_TASK_TYPE_VISIT_PROPERTY) {
|
||||
std::vector<uint32_t> uniques;
|
||||
if (type == MissionTaskType::MISSION_TASK_TYPE_ENVIRONMENT ||
|
||||
type == MissionTaskType::MISSION_TASK_TYPE_VISIT_PROPERTY) {
|
||||
std::vector<uint32_t> uniques;
|
||||
|
||||
const auto value = std::stoul(task->Attribute("v"));
|
||||
const auto value = std::stoul(task->Attribute("v"));
|
||||
|
||||
m_Tasks[index]->SetProgress(value, false);
|
||||
m_Tasks[index]->SetProgress(value, false);
|
||||
|
||||
task = task->NextSiblingElement();
|
||||
task = task->NextSiblingElement();
|
||||
|
||||
while (task != nullptr) {
|
||||
const auto unique = std::stoul(task->Attribute("v"));
|
||||
while (task != nullptr) {
|
||||
const auto unique = std::stoul(task->Attribute("v"));
|
||||
|
||||
uniques.push_back(unique);
|
||||
uniques.push_back(unique);
|
||||
|
||||
if (m_MissionComponent != nullptr && type == MissionTaskType::MISSION_TASK_TYPE_ENVIRONMENT) {
|
||||
m_MissionComponent->AddCollectible(unique);
|
||||
}
|
||||
if (m_MissionComponent != nullptr && type == MissionTaskType::MISSION_TASK_TYPE_ENVIRONMENT) {
|
||||
m_MissionComponent->AddCollectible(unique);
|
||||
}
|
||||
|
||||
task = task->NextSiblingElement();
|
||||
}
|
||||
task = task->NextSiblingElement();
|
||||
}
|
||||
|
||||
m_Tasks[index]->SetUnique(uniques);
|
||||
m_Tasks[index]->SetUnique(uniques);
|
||||
|
||||
m_Tasks[index]->SetProgress(uniques.size(), false);
|
||||
m_Tasks[index]->SetProgress(uniques.size(), false);
|
||||
|
||||
break;
|
||||
} else {
|
||||
const auto value = std::stoul(task->Attribute("v"));
|
||||
break;
|
||||
} else {
|
||||
const auto value = std::stoul(task->Attribute("v"));
|
||||
|
||||
m_Tasks[index]->SetProgress(value, false);
|
||||
m_Tasks[index]->SetProgress(value, false);
|
||||
|
||||
task = task->NextSiblingElement();
|
||||
}
|
||||
task = task->NextSiblingElement();
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
void Mission::UpdateXml(tinyxml2::XMLElement* element) {
|
||||
// Start custom XML
|
||||
element->SetAttribute("state", static_cast<unsigned int>(m_State));
|
||||
// End custom XML
|
||||
// Start custom XML
|
||||
element->SetAttribute("state", static_cast<unsigned int>(m_State));
|
||||
// End custom XML
|
||||
|
||||
element->DeleteChildren();
|
||||
element->DeleteChildren();
|
||||
|
||||
element->SetAttribute("id", static_cast<unsigned int>(info->id));
|
||||
element->SetAttribute("id", static_cast<unsigned int>(info->id));
|
||||
|
||||
if (m_Completions > 0) {
|
||||
element->SetAttribute("cct", static_cast<unsigned int>(m_Completions));
|
||||
if (m_Completions > 0) {
|
||||
element->SetAttribute("cct", static_cast<unsigned int>(m_Completions));
|
||||
|
||||
element->SetAttribute("cts", static_cast<unsigned int>(m_Timestamp));
|
||||
element->SetAttribute("cts", static_cast<unsigned int>(m_Timestamp));
|
||||
|
||||
if (IsComplete()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (IsComplete()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto* task : m_Tasks) {
|
||||
if (task->GetType() == MissionTaskType::MISSION_TASK_TYPE_ENVIRONMENT ||
|
||||
task->GetType() == MissionTaskType::MISSION_TASK_TYPE_VISIT_PROPERTY) {
|
||||
for (auto* task : m_Tasks) {
|
||||
if (task->GetType() == MissionTaskType::MISSION_TASK_TYPE_ENVIRONMENT ||
|
||||
task->GetType() == MissionTaskType::MISSION_TASK_TYPE_VISIT_PROPERTY) {
|
||||
|
||||
auto* child = element->GetDocument()->NewElement("sv");
|
||||
auto* child = element->GetDocument()->NewElement("sv");
|
||||
|
||||
child->SetAttribute("v", static_cast<unsigned int>(task->GetProgress()));
|
||||
child->SetAttribute("v", static_cast<unsigned int>(task->GetProgress()));
|
||||
|
||||
element->LinkEndChild(child);
|
||||
element->LinkEndChild(child);
|
||||
|
||||
for (auto unique : task->GetUnique()) {
|
||||
auto* uniqueElement = element->GetDocument()->NewElement("sv");
|
||||
for (auto unique : task->GetUnique()) {
|
||||
auto* uniqueElement = element->GetDocument()->NewElement("sv");
|
||||
|
||||
uniqueElement->SetAttribute("v", static_cast<unsigned int>(unique));
|
||||
uniqueElement->SetAttribute("v", static_cast<unsigned int>(unique));
|
||||
|
||||
element->LinkEndChild(uniqueElement);
|
||||
}
|
||||
element->LinkEndChild(uniqueElement);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
auto* child = element->GetDocument()->NewElement("sv");
|
||||
break;
|
||||
}
|
||||
auto* child = element->GetDocument()->NewElement("sv");
|
||||
|
||||
child->SetAttribute("v", static_cast<unsigned int>(task->GetProgress()));
|
||||
child->SetAttribute("v", static_cast<unsigned int>(task->GetProgress()));
|
||||
|
||||
element->LinkEndChild(child);
|
||||
}
|
||||
element->LinkEndChild(child);
|
||||
}
|
||||
}
|
||||
|
||||
bool Mission::IsValidMission(const uint32_t missionId) {
|
||||
auto* table = CDClientManager::Instance()->GetTable<CDMissionsTable>("Missions");
|
||||
auto* table = CDClientManager::Instance()->GetTable<CDMissionsTable>("Missions");
|
||||
|
||||
const auto missions = table->Query([=](const CDMissions& entry) {
|
||||
return entry.id == static_cast<int>(missionId);
|
||||
});
|
||||
const auto missions = table->Query([=](const CDMissions& entry) {
|
||||
return entry.id == static_cast<int>(missionId);
|
||||
});
|
||||
|
||||
return !missions.empty();
|
||||
return !missions.empty();
|
||||
}
|
||||
|
||||
bool Mission::IsValidMission(const uint32_t missionId, CDMissions& info) {
|
||||
auto* table = CDClientManager::Instance()->GetTable<CDMissionsTable>("Missions");
|
||||
auto* table = CDClientManager::Instance()->GetTable<CDMissionsTable>("Missions");
|
||||
|
||||
const auto missions = table->Query([=](const CDMissions& entry) {
|
||||
return entry.id == static_cast<int>(missionId);
|
||||
});
|
||||
const auto missions = table->Query([=](const CDMissions& entry) {
|
||||
return entry.id == static_cast<int>(missionId);
|
||||
});
|
||||
|
||||
if (missions.empty()) {
|
||||
return false;
|
||||
}
|
||||
if (missions.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
info = missions[0];
|
||||
info = missions[0];
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
Entity* Mission::GetAssociate() const {
|
||||
return m_MissionComponent->GetParent();
|
||||
return m_MissionComponent->GetParent();
|
||||
}
|
||||
|
||||
User* Mission::GetUser() const {
|
||||
return GetAssociate()->GetParentUser();
|
||||
return GetAssociate()->GetParentUser();
|
||||
}
|
||||
|
||||
uint32_t Mission::GetMissionId() const {
|
||||
return info->id;
|
||||
return info->id;
|
||||
}
|
||||
|
||||
const CDMissions& Mission::GetClientInfo() const {
|
||||
return *info;
|
||||
return *info;
|
||||
}
|
||||
|
||||
uint32_t Mission::GetCompletions() const {
|
||||
return m_Completions;
|
||||
return m_Completions;
|
||||
}
|
||||
|
||||
uint32_t Mission::GetTimestamp() const {
|
||||
return m_Timestamp;
|
||||
return m_Timestamp;
|
||||
}
|
||||
|
||||
LOT Mission::GetReward() const {
|
||||
return m_Reward;
|
||||
return m_Reward;
|
||||
}
|
||||
|
||||
std::vector<MissionTask*> Mission::GetTasks() const {
|
||||
return m_Tasks;
|
||||
return m_Tasks;
|
||||
}
|
||||
|
||||
MissionState Mission::GetMissionState() const {
|
||||
return m_State;
|
||||
return m_State;
|
||||
}
|
||||
|
||||
bool Mission::IsAchievement() const {
|
||||
return !info->isMission;
|
||||
return !info->isMission;
|
||||
}
|
||||
|
||||
bool Mission::IsMission() const {
|
||||
return info->isMission;
|
||||
return info->isMission;
|
||||
}
|
||||
|
||||
bool Mission::IsRepeatable() const {
|
||||
return info->repeatable;
|
||||
return info->repeatable;
|
||||
}
|
||||
|
||||
bool Mission::IsComplete() const {
|
||||
return m_State == MissionState::MISSION_STATE_COMPLETE;
|
||||
return m_State == MissionState::MISSION_STATE_COMPLETE;
|
||||
}
|
||||
|
||||
bool Mission::IsActive() const {
|
||||
return m_State == MissionState::MISSION_STATE_ACTIVE || m_State == MissionState::MISSION_STATE_COMPLETE_AVAILABLE;
|
||||
return m_State == MissionState::MISSION_STATE_ACTIVE || m_State == MissionState::MISSION_STATE_COMPLETE_AVAILABLE;
|
||||
}
|
||||
|
||||
void Mission::MakeActive() {
|
||||
SetMissionState(m_Completions == 0 ? MissionState::MISSION_STATE_ACTIVE : MissionState::MISSION_STATE_COMPLETE_ACTIVE);
|
||||
SetMissionState(m_Completions == 0 ? MissionState::MISSION_STATE_ACTIVE : MissionState::MISSION_STATE_COMPLETE_ACTIVE);
|
||||
}
|
||||
|
||||
bool Mission::IsReadyToComplete() const {
|
||||
return m_State == MissionState::MISSION_STATE_READY_TO_COMPLETE || m_State == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE;
|
||||
return m_State == MissionState::MISSION_STATE_READY_TO_COMPLETE || m_State == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE;
|
||||
}
|
||||
|
||||
void Mission::MakeReadyToComplete() {
|
||||
SetMissionState(m_Completions == 0 ? MissionState::MISSION_STATE_READY_TO_COMPLETE : MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE);
|
||||
SetMissionState(m_Completions == 0 ? MissionState::MISSION_STATE_READY_TO_COMPLETE : MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE);
|
||||
}
|
||||
|
||||
bool Mission::IsAvalible() const {
|
||||
return m_State == MissionState::MISSION_STATE_AVAILABLE || m_State == MissionState::MISSION_STATE_COMPLETE_AVAILABLE;
|
||||
return m_State == MissionState::MISSION_STATE_AVAILABLE || m_State == MissionState::MISSION_STATE_COMPLETE_AVAILABLE;
|
||||
}
|
||||
|
||||
bool Mission::IsFetchMission() const {
|
||||
return m_Tasks.size() == 1 && m_Tasks[0]->GetType() == MissionTaskType::MISSION_TASK_TYPE_MISSION_INTERACTION;
|
||||
return m_Tasks.size() == 1 && m_Tasks[0]->GetType() == MissionTaskType::MISSION_TASK_TYPE_MISSION_INTERACTION;
|
||||
}
|
||||
|
||||
void Mission::MakeAvalible() {
|
||||
SetMissionState(m_Completions == 0 ? MissionState::MISSION_STATE_AVAILABLE : MissionState::MISSION_STATE_COMPLETE_AVAILABLE);
|
||||
SetMissionState(m_Completions == 0 ? MissionState::MISSION_STATE_AVAILABLE : MissionState::MISSION_STATE_COMPLETE_AVAILABLE);
|
||||
}
|
||||
|
||||
void Mission::Accept() {
|
||||
SetMissionTypeState(MissionLockState::MISSION_LOCK_NEW, info->defined_type, info->defined_subtype);
|
||||
SetMissionTypeState(MissionLockState::MISSION_LOCK_NEW, info->defined_type, info->defined_subtype);
|
||||
|
||||
SetMissionState(m_Completions > 0 ? MissionState::MISSION_STATE_COMPLETE_ACTIVE : MissionState::MISSION_STATE_ACTIVE);
|
||||
SetMissionState(m_Completions > 0 ? MissionState::MISSION_STATE_COMPLETE_ACTIVE : MissionState::MISSION_STATE_ACTIVE);
|
||||
|
||||
Catchup();
|
||||
Catchup();
|
||||
}
|
||||
|
||||
void Mission::Complete(const bool yieldRewards) {
|
||||
if (m_State != MissionState::MISSION_STATE_ACTIVE && m_State != MissionState::MISSION_STATE_COMPLETE_ACTIVE) {
|
||||
Accept();
|
||||
}
|
||||
if (m_State != MissionState::MISSION_STATE_ACTIVE && m_State != MissionState::MISSION_STATE_COMPLETE_ACTIVE) {
|
||||
Accept();
|
||||
}
|
||||
|
||||
for (auto* task : m_Tasks) {
|
||||
task->Complete();
|
||||
}
|
||||
for (auto* task : m_Tasks) {
|
||||
task->Complete();
|
||||
}
|
||||
|
||||
SetMissionState(MissionState::MISSION_STATE_REWARDING, true);
|
||||
SetMissionState(MissionState::MISSION_STATE_REWARDING, true);
|
||||
|
||||
if (yieldRewards) {
|
||||
YieldRewards();
|
||||
}
|
||||
if (yieldRewards) {
|
||||
YieldRewards();
|
||||
}
|
||||
|
||||
SetMissionState(MissionState::MISSION_STATE_COMPLETE);
|
||||
SetMissionState(MissionState::MISSION_STATE_COMPLETE);
|
||||
|
||||
m_Completions++;
|
||||
m_Completions++;
|
||||
|
||||
m_Timestamp = std::time(nullptr);
|
||||
m_Timestamp = std::time(nullptr);
|
||||
|
||||
auto* entity = GetAssociate();
|
||||
auto* entity = GetAssociate();
|
||||
|
||||
if (entity == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (entity == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* characterComponent = entity->GetComponent<CharacterComponent>();
|
||||
if (characterComponent != nullptr) {
|
||||
characterComponent->TrackMissionCompletion(!info->isMission);
|
||||
}
|
||||
auto* characterComponent = entity->GetComponent<CharacterComponent>();
|
||||
if (characterComponent != nullptr) {
|
||||
characterComponent->TrackMissionCompletion(!info->isMission);
|
||||
}
|
||||
|
||||
auto* missionComponent = entity->GetComponent<MissionComponent>();
|
||||
auto* missionComponent = entity->GetComponent<MissionComponent>();
|
||||
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MISSION_COMPLETE, info->id);
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MISSION_COMPLETE, info->id);
|
||||
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, info->id, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_COMPLETE_ANY_RACING_TASK);
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, info->id, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_COMPLETE_ANY_RACING_TASK);
|
||||
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, info->id, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_COMPLETE_TRACK_TASKS);
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, info->id, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_COMPLETE_TRACK_TASKS);
|
||||
|
||||
auto* missionEmailTable = CDClientManager::Instance()->GetTable<CDMissionEmailTable>("MissionEmail");
|
||||
auto* missionEmailTable = CDClientManager::Instance()->GetTable<CDMissionEmailTable>("MissionEmail");
|
||||
|
||||
const auto missionId = GetMissionId();
|
||||
const auto missionId = GetMissionId();
|
||||
|
||||
const auto missionEmails = missionEmailTable->Query([missionId](const CDMissionEmail& entry) {
|
||||
return entry.missionID == missionId;
|
||||
});
|
||||
const auto missionEmails = missionEmailTable->Query([missionId](const CDMissionEmail& entry) {
|
||||
return entry.missionID == missionId;
|
||||
});
|
||||
|
||||
for (const auto& email : missionEmails) {
|
||||
const auto missionEmailBase = "MissionEmail_" + std::to_string(email.ID) + "_";
|
||||
for (const auto& email : missionEmails) {
|
||||
const auto missionEmailBase = "MissionEmail_" + std::to_string(email.ID) + "_";
|
||||
|
||||
const auto senderLocale = missionEmailBase + "senderName";
|
||||
const auto announceLocale = missionEmailBase + "announceText";
|
||||
const auto senderLocale = missionEmailBase + "senderName";
|
||||
const auto announceLocale = missionEmailBase + "announceText";
|
||||
|
||||
if (email.messageType == 1 && Game::locale->HasPhrase(senderLocale)) {
|
||||
const auto subject = dLocale::GetTemplate(missionEmailBase + "subjectText");
|
||||
const auto body = dLocale::GetTemplate(missionEmailBase + "bodyText");
|
||||
const auto sender = dLocale::GetTemplate(senderLocale);
|
||||
if (email.messageType == 1 && Game::locale->HasPhrase(senderLocale)) {
|
||||
const auto subject = dLocale::GetTemplate(missionEmailBase + "subjectText");
|
||||
const auto body = dLocale::GetTemplate(missionEmailBase + "bodyText");
|
||||
const auto sender = dLocale::GetTemplate(senderLocale);
|
||||
|
||||
Mail::SendMail(LWOOBJID_EMPTY, sender, GetAssociate(), subject, body, email.attachmentLOT, 1);
|
||||
}
|
||||
}
|
||||
Mail::SendMail(LWOOBJID_EMPTY, sender, GetAssociate(), subject, body, email.attachmentLOT, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Mission::CheckCompletion() {
|
||||
for (auto* task : m_Tasks) {
|
||||
if (!task->IsComplete()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (auto* task : m_Tasks) {
|
||||
if (!task->IsComplete()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsAchievement()) {
|
||||
Complete();
|
||||
if (IsAchievement()) {
|
||||
Complete();
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
MakeReadyToComplete();
|
||||
MakeReadyToComplete();
|
||||
}
|
||||
|
||||
void Mission::Catchup() {
|
||||
auto* entity = GetAssociate();
|
||||
auto* entity = GetAssociate();
|
||||
|
||||
auto* inventory = static_cast<InventoryComponent*>(entity->GetComponent(COMPONENT_TYPE_INVENTORY));
|
||||
auto* inventory = static_cast<InventoryComponent*>(entity->GetComponent(COMPONENT_TYPE_INVENTORY));
|
||||
|
||||
for (auto* task : m_Tasks) {
|
||||
const auto type = task->GetType();
|
||||
for (auto* task : m_Tasks) {
|
||||
const auto type = task->GetType();
|
||||
|
||||
if (type == MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION) {
|
||||
for (auto target : task->GetAllTargets()) {
|
||||
const auto count = inventory->GetLotCountNonTransfer(target);
|
||||
if (type == MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION) {
|
||||
for (auto target : task->GetAllTargets()) {
|
||||
const auto count = inventory->GetLotCountNonTransfer(target);
|
||||
|
||||
for (auto i = 0U; i < count; ++i) {
|
||||
task->Progress(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (auto i = 0U; i < count; ++i) {
|
||||
task->Progress(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (type == MissionTaskType::MISSION_TASK_TYPE_PLAYER_FLAG) {
|
||||
for (auto target : task->GetAllTargets()) {
|
||||
const auto flag = GetUser()->GetLastUsedChar()->GetPlayerFlag(target);
|
||||
if (type == MissionTaskType::MISSION_TASK_TYPE_PLAYER_FLAG) {
|
||||
for (auto target : task->GetAllTargets()) {
|
||||
const auto flag = GetUser()->GetLastUsedChar()->GetPlayerFlag(target);
|
||||
|
||||
if (!flag) {
|
||||
continue;
|
||||
}
|
||||
if (!flag) {
|
||||
continue;
|
||||
}
|
||||
|
||||
task->Progress(target);
|
||||
task->Progress(target);
|
||||
|
||||
if (task->IsComplete()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (task->IsComplete()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Mission::YieldRewards() {
|
||||
auto* entity = GetAssociate();
|
||||
auto* entity = GetAssociate();
|
||||
|
||||
if (entity == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (entity == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* character = GetUser()->GetLastUsedChar();
|
||||
auto* character = GetUser()->GetLastUsedChar();
|
||||
|
||||
auto* inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
auto* levelComponent = entity->GetComponent<LevelProgressionComponent>();
|
||||
auto* characterComponent = entity->GetComponent<CharacterComponent>();
|
||||
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||
auto* missionComponent = entity->GetComponent<MissionComponent>();
|
||||
auto* inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
auto* levelComponent = entity->GetComponent<LevelProgressionComponent>();
|
||||
auto* characterComponent = entity->GetComponent<CharacterComponent>();
|
||||
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||
auto* missionComponent = entity->GetComponent<MissionComponent>();
|
||||
|
||||
// Remove mission items
|
||||
for (auto* task : m_Tasks) {
|
||||
if (task->GetType() != MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION) {
|
||||
continue;
|
||||
}
|
||||
// Remove mission items
|
||||
for (auto* task : m_Tasks) {
|
||||
if (task->GetType() != MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto& param = task->GetParameters();
|
||||
const auto& param = task->GetParameters();
|
||||
|
||||
if (param.empty() || (param[0] & 1) == 0) // Should items be removed?
|
||||
{
|
||||
for (const auto target : task->GetAllTargets()) {
|
||||
// This is how live did it. ONLY remove item collection items from the items and hidden inventories and none of the others.
|
||||
inventoryComponent->RemoveItem(target, task->GetClientInfo().targetValue, eInventoryType::ITEMS);
|
||||
inventoryComponent->RemoveItem(target, task->GetClientInfo().targetValue, eInventoryType::HIDDEN);
|
||||
if (param.empty() || (param[0] & 1) == 0) // Should items be removed?
|
||||
{
|
||||
for (const auto target : task->GetAllTargets()) {
|
||||
// This is how live did it. ONLY remove item collection items from the items and hidden inventories and none of the others.
|
||||
inventoryComponent->RemoveItem(target, task->GetClientInfo().targetValue, eInventoryType::ITEMS);
|
||||
inventoryComponent->RemoveItem(target, task->GetClientInfo().targetValue, eInventoryType::HIDDEN);
|
||||
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION, target, LWOOBJID_EMPTY, "", -task->GetClientInfo().targetValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION, target, LWOOBJID_EMPTY, "", -task->GetClientInfo().targetValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int32_t coinsToSend = 0;
|
||||
if (info->LegoScore > 0) {
|
||||
eLootSourceType lootSource = info->isMission ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT;
|
||||
if(levelComponent->GetLevel() >= dZoneManager::Instance()->GetMaxLevel()) {
|
||||
// Since the character is at the level cap we reward them with coins instead of UScore.
|
||||
coinsToSend += info->LegoScore * dZoneManager::Instance()->GetLevelCapCurrencyConversion();
|
||||
} else {
|
||||
characterComponent->SetUScore(characterComponent->GetUScore() + info->LegoScore);
|
||||
GameMessages::SendModifyLEGOScore(entity, entity->GetSystemAddress(), info->LegoScore, lootSource);
|
||||
}
|
||||
}
|
||||
int32_t coinsToSend = 0;
|
||||
if (info->LegoScore > 0) {
|
||||
eLootSourceType lootSource = info->isMission ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT;
|
||||
if (levelComponent->GetLevel() >= dZoneManager::Instance()->GetMaxLevel()) {
|
||||
// Since the character is at the level cap we reward them with coins instead of UScore.
|
||||
coinsToSend += info->LegoScore * dZoneManager::Instance()->GetLevelCapCurrencyConversion();
|
||||
} else {
|
||||
characterComponent->SetUScore(characterComponent->GetUScore() + info->LegoScore);
|
||||
GameMessages::SendModifyLEGOScore(entity, entity->GetSystemAddress(), info->LegoScore, lootSource);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_Completions > 0) {
|
||||
std::vector<std::pair<LOT, uint32_t>> items;
|
||||
if (m_Completions > 0) {
|
||||
std::vector<std::pair<LOT, uint32_t>> items;
|
||||
|
||||
items.emplace_back(info->reward_item1_repeatable, info->reward_item1_repeat_count);
|
||||
items.emplace_back(info->reward_item2_repeatable, info->reward_item2_repeat_count);
|
||||
items.emplace_back(info->reward_item3_repeatable, info->reward_item3_repeat_count);
|
||||
items.emplace_back(info->reward_item4_repeatable, info->reward_item4_repeat_count);
|
||||
items.emplace_back(info->reward_item1_repeatable, info->reward_item1_repeat_count);
|
||||
items.emplace_back(info->reward_item2_repeatable, info->reward_item2_repeat_count);
|
||||
items.emplace_back(info->reward_item3_repeatable, info->reward_item3_repeat_count);
|
||||
items.emplace_back(info->reward_item4_repeatable, info->reward_item4_repeat_count);
|
||||
|
||||
for (const auto& pair : items) {
|
||||
// Some missions reward zero of an item and so they must be allowed through this clause,
|
||||
// hence pair.second < 0 instead of pair.second <= 0.
|
||||
if (pair.second < 0 || (m_Reward > 0 && pair.first != m_Reward)) {
|
||||
continue;
|
||||
}
|
||||
for (const auto& pair : items) {
|
||||
// Some missions reward zero of an item and so they must be allowed through this clause,
|
||||
// hence pair.second < 0 instead of pair.second <= 0.
|
||||
if (pair.second < 0 || (m_Reward > 0 && pair.first != m_Reward)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// If a mission rewards zero of an item, make it reward 1.
|
||||
auto count = pair.second > 0 ? pair.second : 1;
|
||||
// If a mission rewards zero of an item, make it reward 1.
|
||||
auto count = pair.second > 0 ? pair.second : 1;
|
||||
|
||||
// Sanity check, 6 is the max any mission yields
|
||||
if (count > 6) {
|
||||
count = 0;
|
||||
}
|
||||
// Sanity check, 6 is the max any mission yields
|
||||
if (count > 6) {
|
||||
count = 0;
|
||||
}
|
||||
|
||||
inventoryComponent->AddItem(pair.first, count, IsMission() ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT);
|
||||
}
|
||||
inventoryComponent->AddItem(pair.first, count, IsMission() ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT);
|
||||
}
|
||||
|
||||
if (info->reward_currency_repeatable > 0 || coinsToSend > 0) {
|
||||
eLootSourceType lootSource = info->isMission ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT;
|
||||
character->SetCoins(character->GetCoins() + info->reward_currency_repeatable + coinsToSend, lootSource);
|
||||
}
|
||||
if (info->reward_currency_repeatable > 0 || coinsToSend > 0) {
|
||||
eLootSourceType lootSource = info->isMission ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT;
|
||||
character->SetCoins(character->GetCoins() + info->reward_currency_repeatable + coinsToSend, lootSource);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<std::pair<LOT, int32_t>> items;
|
||||
std::vector<std::pair<LOT, int32_t>> items;
|
||||
|
||||
items.emplace_back(info->reward_item1, info->reward_item1_count);
|
||||
items.emplace_back(info->reward_item2, info->reward_item2_count);
|
||||
items.emplace_back(info->reward_item3, info->reward_item3_count);
|
||||
items.emplace_back(info->reward_item4, info->reward_item4_count);
|
||||
items.emplace_back(info->reward_item1, info->reward_item1_count);
|
||||
items.emplace_back(info->reward_item2, info->reward_item2_count);
|
||||
items.emplace_back(info->reward_item3, info->reward_item3_count);
|
||||
items.emplace_back(info->reward_item4, info->reward_item4_count);
|
||||
|
||||
for (const auto& pair : items) {
|
||||
// Some missions reward zero of an item and so they must be allowed through this clause,
|
||||
// hence pair.second < 0 instead of pair.second <= 0.
|
||||
if (pair.second < 0 || (m_Reward > 0 && pair.first != m_Reward)) {
|
||||
continue;
|
||||
}
|
||||
for (const auto& pair : items) {
|
||||
// Some missions reward zero of an item and so they must be allowed through this clause,
|
||||
// hence pair.second < 0 instead of pair.second <= 0.
|
||||
if (pair.second < 0 || (m_Reward > 0 && pair.first != m_Reward)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// If a mission rewards zero of an item, make it reward 1.
|
||||
auto count = pair.second > 0 ? pair.second : 1;
|
||||
// If a mission rewards zero of an item, make it reward 1.
|
||||
auto count = pair.second > 0 ? pair.second : 1;
|
||||
|
||||
// Sanity check, 6 is the max any mission yields
|
||||
if (count > 6) {
|
||||
count = 0;
|
||||
}
|
||||
// Sanity check, 6 is the max any mission yields
|
||||
if (count > 6) {
|
||||
count = 0;
|
||||
}
|
||||
|
||||
inventoryComponent->AddItem(pair.first, count, IsMission() ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT);
|
||||
}
|
||||
inventoryComponent->AddItem(pair.first, count, IsMission() ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT);
|
||||
}
|
||||
|
||||
if (info->reward_currency > 0 || coinsToSend > 0) {
|
||||
eLootSourceType lootSource = info->isMission ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT;
|
||||
character->SetCoins(character->GetCoins() + info->reward_currency + coinsToSend, lootSource);
|
||||
}
|
||||
if (info->reward_currency > 0 || coinsToSend > 0) {
|
||||
eLootSourceType lootSource = info->isMission ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT;
|
||||
character->SetCoins(character->GetCoins() + info->reward_currency + coinsToSend, lootSource);
|
||||
}
|
||||
|
||||
if (info->reward_maxinventory > 0) {
|
||||
auto* inventory = inventoryComponent->GetInventory(ITEMS);
|
||||
if (info->reward_maxinventory > 0) {
|
||||
auto* inventory = inventoryComponent->GetInventory(ITEMS);
|
||||
|
||||
inventory->SetSize(inventory->GetSize() + info->reward_maxinventory);
|
||||
}
|
||||
inventory->SetSize(inventory->GetSize() + info->reward_maxinventory);
|
||||
}
|
||||
|
||||
if (info->reward_bankinventory > 0) {
|
||||
auto* inventory = inventoryComponent->GetInventory(eInventoryType::VAULT_ITEMS);
|
||||
auto modelInventory = inventoryComponent->GetInventory(eInventoryType::VAULT_MODELS);
|
||||
if (info->reward_bankinventory > 0) {
|
||||
auto* inventory = inventoryComponent->GetInventory(eInventoryType::VAULT_ITEMS);
|
||||
auto modelInventory = inventoryComponent->GetInventory(eInventoryType::VAULT_MODELS);
|
||||
|
||||
inventory->SetSize(inventory->GetSize() + info->reward_bankinventory);
|
||||
modelInventory->SetSize(modelInventory->GetSize() + info->reward_bankinventory);
|
||||
}
|
||||
inventory->SetSize(inventory->GetSize() + info->reward_bankinventory);
|
||||
modelInventory->SetSize(modelInventory->GetSize() + info->reward_bankinventory);
|
||||
}
|
||||
|
||||
if (info->reward_reputation > 0) {
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_EARN_REPUTATION, 0, 0L, "", info->reward_reputation);
|
||||
auto character = entity->GetComponent<CharacterComponent>();
|
||||
if (character) {
|
||||
character->SetReputation(character->GetReputation() + info->reward_reputation);
|
||||
GameMessages::SendUpdateReputation(entity->GetObjectID(), character->GetReputation(), entity->GetSystemAddress());
|
||||
}
|
||||
}
|
||||
if (info->reward_reputation > 0) {
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_EARN_REPUTATION, 0, 0L, "", info->reward_reputation);
|
||||
auto character = entity->GetComponent<CharacterComponent>();
|
||||
if (character) {
|
||||
character->SetReputation(character->GetReputation() + info->reward_reputation);
|
||||
GameMessages::SendUpdateReputation(entity->GetObjectID(), character->GetReputation(), entity->GetSystemAddress());
|
||||
}
|
||||
}
|
||||
|
||||
if (info->reward_maxhealth > 0) {
|
||||
destroyableComponent->SetMaxHealth(destroyableComponent->GetMaxHealth() + static_cast<float>(info->reward_maxhealth), true);
|
||||
}
|
||||
if (info->reward_maxhealth > 0) {
|
||||
destroyableComponent->SetMaxHealth(destroyableComponent->GetMaxHealth() + static_cast<float>(info->reward_maxhealth), true);
|
||||
}
|
||||
|
||||
if (info->reward_maximagination > 0) {
|
||||
destroyableComponent->SetMaxImagination(destroyableComponent->GetMaxImagination() + static_cast<float>(info->reward_maximagination), true);
|
||||
}
|
||||
if (info->reward_maximagination > 0) {
|
||||
destroyableComponent->SetMaxImagination(destroyableComponent->GetMaxImagination() + static_cast<float>(info->reward_maximagination), true);
|
||||
}
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(entity);
|
||||
EntityManager::Instance()->SerializeEntity(entity);
|
||||
|
||||
if (info->reward_emote > 0) {
|
||||
character->UnlockEmote(info->reward_emote);
|
||||
}
|
||||
if (info->reward_emote > 0) {
|
||||
character->UnlockEmote(info->reward_emote);
|
||||
}
|
||||
|
||||
if (info->reward_emote2 > 0) {
|
||||
character->UnlockEmote(info->reward_emote2);
|
||||
}
|
||||
if (info->reward_emote2 > 0) {
|
||||
character->UnlockEmote(info->reward_emote2);
|
||||
}
|
||||
|
||||
if (info->reward_emote3 > 0) {
|
||||
character->UnlockEmote(info->reward_emote3);
|
||||
}
|
||||
if (info->reward_emote3 > 0) {
|
||||
character->UnlockEmote(info->reward_emote3);
|
||||
}
|
||||
|
||||
if (info->reward_emote4 > 0) {
|
||||
character->UnlockEmote(info->reward_emote4);
|
||||
}
|
||||
if (info->reward_emote4 > 0) {
|
||||
character->UnlockEmote(info->reward_emote4);
|
||||
}
|
||||
}
|
||||
|
||||
void Mission::Progress(MissionTaskType type, int32_t value, LWOOBJID associate, const std::string& targets, int32_t count) {
|
||||
const auto isRemoval = count < 0;
|
||||
const auto isRemoval = count < 0;
|
||||
|
||||
if (isRemoval && (IsComplete() || IsAchievement())) {
|
||||
return;
|
||||
}
|
||||
if (isRemoval && (IsComplete() || IsAchievement())) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto* task : m_Tasks) {
|
||||
if (task->IsComplete() && !isRemoval) {
|
||||
continue;
|
||||
}
|
||||
for (auto* task : m_Tasks) {
|
||||
if (task->IsComplete() && !isRemoval) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (task->GetType() != type) {
|
||||
continue;
|
||||
}
|
||||
if (task->GetType() != type) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isRemoval && !task->InAllTargets(value)) {
|
||||
continue;
|
||||
}
|
||||
if (isRemoval && !task->InAllTargets(value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
task->Progress(value, associate, targets, count);
|
||||
}
|
||||
task->Progress(value, associate, targets, count);
|
||||
}
|
||||
}
|
||||
|
||||
void Mission::SetMissionState(const MissionState state, const bool sendingRewards) {
|
||||
this->m_State = state;
|
||||
this->m_State = state;
|
||||
|
||||
auto* entity = GetAssociate();
|
||||
auto* entity = GetAssociate();
|
||||
|
||||
if (entity == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (entity == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
GameMessages::SendNotifyMission(entity, entity->GetParentUser()->GetSystemAddress(), info->id, static_cast<int>(state), sendingRewards);
|
||||
GameMessages::SendNotifyMission(entity, entity->GetParentUser()->GetSystemAddress(), info->id, static_cast<int>(state), sendingRewards);
|
||||
}
|
||||
|
||||
void Mission::SetMissionTypeState(MissionLockState state, const std::string& type, const std::string& subType) {
|
||||
// TODO
|
||||
// TODO
|
||||
}
|
||||
|
||||
void Mission::SetCompletions(const uint32_t value) {
|
||||
m_Completions = value;
|
||||
m_Completions = value;
|
||||
}
|
||||
|
||||
void Mission::SetReward(const LOT lot) {
|
||||
m_Reward = lot;
|
||||
m_Reward = lot;
|
||||
}
|
||||
|
||||
Mission::~Mission() {
|
||||
for (auto* task : m_Tasks) {
|
||||
delete task;
|
||||
}
|
||||
for (auto* task : m_Tasks) {
|
||||
delete task;
|
||||
}
|
||||
|
||||
m_Tasks.clear();
|
||||
}
|
||||
m_Tasks.clear();
|
||||
}
|
||||
|
@@ -22,244 +22,244 @@ class Mission final
|
||||
{
|
||||
public:
|
||||
Mission(MissionComponent* missionComponent, uint32_t missionId);
|
||||
~Mission();
|
||||
~Mission();
|
||||
|
||||
void LoadFromXml(tinyxml2::XMLElement* element);
|
||||
void UpdateXml(tinyxml2::XMLElement* element);
|
||||
void LoadFromXml(tinyxml2::XMLElement* element);
|
||||
void UpdateXml(tinyxml2::XMLElement* element);
|
||||
|
||||
/**
|
||||
* Returns the ID of this mission
|
||||
* @return the ID of this mission
|
||||
*/
|
||||
/**
|
||||
* Returns the ID of this mission
|
||||
* @return the ID of this mission
|
||||
*/
|
||||
uint32_t GetMissionId() const;
|
||||
|
||||
/**
|
||||
* Returns the entity that is currently progressing this mission
|
||||
* @return the entity that is currently progressing this mission
|
||||
*/
|
||||
/**
|
||||
* Returns the entity that is currently progressing this mission
|
||||
* @return the entity that is currently progressing this mission
|
||||
*/
|
||||
Entity* GetAssociate() const;
|
||||
|
||||
/**
|
||||
* Returns the account owns the entity that is currently progressing this mission
|
||||
* @return the account owns the entity that is currently progressing this mission
|
||||
*/
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Returns the current state of this mission
|
||||
* @return the current state of this mission
|
||||
*/
|
||||
/**
|
||||
* Returns the current state of this mission
|
||||
* @return the current state of this mission
|
||||
*/
|
||||
MissionState GetMissionState() const;
|
||||
|
||||
/**
|
||||
* Returns the database information that represents to this mission.
|
||||
* @return the database information that represents to this mission.
|
||||
*/
|
||||
/**
|
||||
* Returns the database information that represents to this mission.
|
||||
* @return the database information that represents to this mission.
|
||||
*/
|
||||
const CDMissions& GetClientInfo() const;
|
||||
|
||||
/**
|
||||
* Returns the number of times the entity has completed this mission, can only be > 0 for dailies.
|
||||
* @return the number of thimes the entity has completed this mission
|
||||
*/
|
||||
/**
|
||||
* Returns the number of times the entity has completed this mission, can only be > 0 for dailies.
|
||||
* @return the number of thimes the entity has completed this mission
|
||||
*/
|
||||
uint32_t GetCompletions() const;
|
||||
|
||||
/**
|
||||
* Sets the number of times this mission has been completed
|
||||
* @param value the number of times this mission should be completed
|
||||
*/
|
||||
void SetCompletions(uint32_t value);
|
||||
/**
|
||||
* Sets the number of times this mission has been completed
|
||||
* @param value the number of times this mission should be completed
|
||||
*/
|
||||
void SetCompletions(uint32_t value);
|
||||
|
||||
/**
|
||||
* Returns the last timestamp at which the entity completed this mission
|
||||
* @return the last timestamp at which the entity completed this mission
|
||||
*/
|
||||
/**
|
||||
* Returns the last timestamp at which the entity completed this mission
|
||||
* @return the last timestamp at which the entity completed this mission
|
||||
*/
|
||||
uint32_t GetTimestamp() const;
|
||||
|
||||
/**
|
||||
* Returns some specific reward that should be returned from the possible rewards indicated by the client
|
||||
* @return some specific reward that should be returned from the possible rewards indicated by the client
|
||||
*/
|
||||
/**
|
||||
* Returns some specific reward that should be returned from the possible rewards indicated by the client
|
||||
* @return some specific reward that should be returned from the possible rewards indicated by the client
|
||||
*/
|
||||
LOT GetReward() const;
|
||||
|
||||
/**
|
||||
* Sets an some specific reward that should be returned from the possible rewards indicated by the client
|
||||
* @param lot the reward to set
|
||||
*/
|
||||
void SetReward(LOT lot);
|
||||
/**
|
||||
* Sets an some specific reward that should be returned from the possible rewards indicated by the client
|
||||
* @param lot the reward to set
|
||||
*/
|
||||
void SetReward(LOT lot);
|
||||
|
||||
/**
|
||||
* Returns all the tasks that must be completed to mark this mission as complete
|
||||
* @return all the tasks that must be completed to mark this mission as complete
|
||||
*/
|
||||
/**
|
||||
* Returns all the tasks that must be completed to mark this mission as complete
|
||||
* @return all the tasks that must be completed to mark this mission as complete
|
||||
*/
|
||||
std::vector<MissionTask*> GetTasks() const;
|
||||
|
||||
/**
|
||||
* Updates the mission state to the one provided
|
||||
* @param state the mission state to set
|
||||
* @param sendingRewards a flag indicating to the client that rewards wil lfollow
|
||||
*/
|
||||
/**
|
||||
* Updates the mission state to the one provided
|
||||
* @param state the mission state to set
|
||||
* @param sendingRewards a flag indicating to the client that rewards wil lfollow
|
||||
*/
|
||||
void SetMissionState(MissionState state, bool sendingRewards = false);
|
||||
|
||||
/**
|
||||
* Currently unimplemented
|
||||
*/
|
||||
/**
|
||||
* Currently unimplemented
|
||||
*/
|
||||
void SetMissionTypeState(MissionLockState state, const std::string& type, const std::string& subType);
|
||||
|
||||
/**
|
||||
* Returns whether this mission is an achievement
|
||||
* @return true if this mission is an achievement, false otherwise
|
||||
*/
|
||||
/**
|
||||
* Returns whether this mission is an achievement
|
||||
* @return true if this mission is an achievement, false otherwise
|
||||
*/
|
||||
bool IsAchievement() const;
|
||||
|
||||
/**
|
||||
* Returns whether this mission is a mission (e.g.: not an achievement)
|
||||
* @return true if this mission is not an achievement, false otherwise
|
||||
*/
|
||||
/**
|
||||
* Returns whether this mission is a mission (e.g.: not an achievement)
|
||||
* @return true if this mission is not an achievement, false otherwise
|
||||
*/
|
||||
bool IsMission() const;
|
||||
|
||||
/**
|
||||
* Returns whether this mission can be repeated (mostly used for dailies)
|
||||
* @return true if this mission can be repeated, false otherwise
|
||||
*/
|
||||
/**
|
||||
* Returns whether this mission can be repeated (mostly used for dailies)
|
||||
* @return true if this mission can be repeated, false otherwise
|
||||
*/
|
||||
bool IsRepeatable() const;
|
||||
|
||||
/**
|
||||
* Returns whether the entity has completed this mission before
|
||||
* @return true if the mission has been completed before, false otherwise
|
||||
*/
|
||||
/**
|
||||
* Returns whether the entity has completed this mission before
|
||||
* @return true if the mission has been completed before, false otherwise
|
||||
*/
|
||||
bool IsComplete() const;
|
||||
|
||||
/**
|
||||
* Returns whether the mission is currently active
|
||||
* @return true if the mission is currently active, false otherwise
|
||||
*/
|
||||
/**
|
||||
* Returns whether the mission is currently active
|
||||
* @return true if the mission is currently active, false otherwise
|
||||
*/
|
||||
bool IsActive() const;
|
||||
|
||||
/**
|
||||
* Sets the mission state to active, takes into account if this is a repeatable mission.
|
||||
*/
|
||||
/**
|
||||
* Sets the mission state to active, takes into account if this is a repeatable mission.
|
||||
*/
|
||||
void MakeActive();
|
||||
|
||||
/**
|
||||
* Returns whether the entity has completed all tasks and can hand the mission in for rewards.
|
||||
* @return true if the entity can hand the mission in, false otherwise
|
||||
*/
|
||||
/**
|
||||
* Returns whether the entity has completed all tasks and can hand the mission in for rewards.
|
||||
* @return true if the entity can hand the mission in, false otherwise
|
||||
*/
|
||||
bool IsReadyToComplete() const;
|
||||
|
||||
/**
|
||||
* Sets the mission state to ready to complete, takes into account if this is a repeatable mission
|
||||
*/
|
||||
/**
|
||||
* Sets the mission state to ready to complete, takes into account if this is a repeatable mission
|
||||
*/
|
||||
void MakeReadyToComplete();
|
||||
|
||||
/**
|
||||
* Returns whether this mission can be accepted by the entity
|
||||
* @return true if the mission can be accepted by the entity, false otherwise
|
||||
*/
|
||||
/**
|
||||
* Returns whether this mission can be accepted by the entity
|
||||
* @return true if the mission can be accepted by the entity, false otherwise
|
||||
*/
|
||||
bool IsAvalible() const;
|
||||
|
||||
/**
|
||||
* Sets the mission state to available, takes into account if this mission is repeatable
|
||||
*/
|
||||
void MakeAvalible();
|
||||
/**
|
||||
* Sets the mission state to available, takes into account if this mission is repeatable
|
||||
*/
|
||||
void MakeAvalible();
|
||||
|
||||
/**
|
||||
* Returns whether this mission is one where an entity simply has to go somewhere, but doesn't have to turn in the
|
||||
* mission tasks at the original mission giver (called a fetch mission).
|
||||
* @return true if this is a fetch mission, false otherwise
|
||||
*/
|
||||
/**
|
||||
* Returns whether this mission is one where an entity simply has to go somewhere, but doesn't have to turn in the
|
||||
* mission tasks at the original mission giver (called a fetch mission).
|
||||
* @return true if this is a fetch mission, false otherwise
|
||||
*/
|
||||
bool IsFetchMission() const;
|
||||
|
||||
/**
|
||||
* Accepts this mission, setting it to available. Also progresses any of the tasks if the entity has already
|
||||
* progressed for them (for example "collect X bricks", will fast track for the amount of bricks the entity
|
||||
* already has).
|
||||
*/
|
||||
/**
|
||||
* Accepts this mission, setting it to available. Also progresses any of the tasks if the entity has already
|
||||
* progressed for them (for example "collect X bricks", will fast track for the amount of bricks the entity
|
||||
* already has).
|
||||
*/
|
||||
void Accept();
|
||||
|
||||
/**
|
||||
* Completes the mission and handles all logistics regarding that: checking all tasks, handing out rewards,
|
||||
* emailing them if the inventory is full, etc. If the mission tasks have not all been completed this is a no-op.
|
||||
* @param yieldRewards if true, rewards will be given to the entity
|
||||
*/
|
||||
/**
|
||||
* Completes the mission and handles all logistics regarding that: checking all tasks, handing out rewards,
|
||||
* emailing them if the inventory is full, etc. If the mission tasks have not all been completed this is a no-op.
|
||||
* @param yieldRewards if true, rewards will be given to the entity
|
||||
*/
|
||||
void Complete(bool yieldRewards = true);
|
||||
|
||||
/**
|
||||
* Checks if this mission is ready to be completed and updates the state if so. If this is an achievement, the
|
||||
* state will automatically be updated to completed as there's nobody to hand achievements in to.
|
||||
*/
|
||||
/**
|
||||
* Checks if this mission is ready to be completed and updates the state if so. If this is an achievement, the
|
||||
* state will automatically be updated to completed as there's nobody to hand achievements in to.
|
||||
*/
|
||||
void CheckCompletion();
|
||||
|
||||
/**
|
||||
* Gives all the rewards (items, score, stats, etc.) to the entity. Takes into account if the entity has completed
|
||||
* the mission before.
|
||||
*/
|
||||
/**
|
||||
* Gives all the rewards (items, score, stats, etc.) to the entity. Takes into account if the entity has completed
|
||||
* the mission before.
|
||||
*/
|
||||
void YieldRewards();
|
||||
|
||||
/**
|
||||
* Attempts to progress tasks of a certain type for this mission. Note that the interpretation of any of these
|
||||
* arguments is up to the mission task at hand.
|
||||
* @param type the mission task type to progress
|
||||
* @param value the value to progress the mission task with
|
||||
* @param associate optional object ID that was related to the progression
|
||||
* @param targets optional multiple targets that need to be met for progression
|
||||
* @param count optional count to progress with
|
||||
*/
|
||||
/**
|
||||
* Attempts to progress tasks of a certain type for this mission. Note that the interpretation of any of these
|
||||
* arguments is up to the mission task at hand.
|
||||
* @param type the mission task type to progress
|
||||
* @param value the value to progress the mission task with
|
||||
* @param associate optional object ID that was related to the progression
|
||||
* @param targets optional multiple targets that need to be met for progression
|
||||
* @param count optional count to progress with
|
||||
*/
|
||||
void Progress(MissionTaskType type, int32_t value, LWOOBJID associate = 0, const std::string& targets = "", int32_t count = 1);
|
||||
|
||||
/**
|
||||
* Returns if the mission ID that's given belongs to an existing mission
|
||||
* @param missionId the mission ID to check for
|
||||
* @return true if the mission exists, false otherwise
|
||||
*/
|
||||
/**
|
||||
* Returns if the mission ID that's given belongs to an existing mission
|
||||
* @param missionId the mission ID to check for
|
||||
* @return true if the mission exists, false otherwise
|
||||
*/
|
||||
static bool IsValidMission(uint32_t missionId);
|
||||
|
||||
/**
|
||||
* Returns if the mission ID that's given belongs to an existing mission
|
||||
* @param missionId the mission ID to check for
|
||||
* @param info variable to store the queried mission information in
|
||||
* @return true if the mission exists, false otherwise
|
||||
*/
|
||||
/**
|
||||
* Returns if the mission ID that's given belongs to an existing mission
|
||||
* @param missionId the mission ID to check for
|
||||
* @param info variable to store the queried mission information in
|
||||
* @return true if the mission exists, false otherwise
|
||||
*/
|
||||
static bool IsValidMission(uint32_t missionId, CDMissions& info);
|
||||
private:
|
||||
/**
|
||||
* Progresses all the newly accepted tasks for this mission after it has been accepted to reflect the state of the
|
||||
* inventory of the entity.
|
||||
*/
|
||||
/**
|
||||
* Progresses all the newly accepted tasks for this mission after it has been accepted to reflect the state of the
|
||||
* inventory of the entity.
|
||||
*/
|
||||
void Catchup();
|
||||
|
||||
/**
|
||||
* The database information that corresponds to this mission
|
||||
*/
|
||||
/**
|
||||
* The database information that corresponds to this mission
|
||||
*/
|
||||
const CDMissions* info;
|
||||
|
||||
/**
|
||||
* The current state this mission is in
|
||||
*/
|
||||
/**
|
||||
* The current state this mission is in
|
||||
*/
|
||||
MissionState m_State;
|
||||
|
||||
/**
|
||||
* The number of times the entity has completed this mission
|
||||
*/
|
||||
/**
|
||||
* The number of times the entity has completed this mission
|
||||
*/
|
||||
uint32_t m_Completions;
|
||||
|
||||
/**
|
||||
* The last time the entity completed this mission
|
||||
*/
|
||||
/**
|
||||
* The last time the entity completed this mission
|
||||
*/
|
||||
uint32_t m_Timestamp;
|
||||
|
||||
/**
|
||||
* The mission component of the entity that owns this mission
|
||||
*/
|
||||
/**
|
||||
* The mission component of the entity that owns this mission
|
||||
*/
|
||||
MissionComponent* m_MissionComponent;
|
||||
|
||||
/**
|
||||
* Optionally specific reward that should be returned from the possible rewards indicated by the client
|
||||
*/
|
||||
/**
|
||||
* Optionally specific reward that should be returned from the possible rewards indicated by the client
|
||||
*/
|
||||
LOT m_Reward;
|
||||
|
||||
/**
|
||||
* All the tasks that can be progressed for this mission
|
||||
*/
|
||||
/**
|
||||
* All the tasks that can be progressed for this mission
|
||||
*/
|
||||
std::vector<MissionTask*> m_Tasks;
|
||||
};
|
||||
|
||||
|
@@ -52,8 +52,7 @@ PrerequisiteExpression::PrerequisiteExpression(const std::string& str) {
|
||||
case '9':
|
||||
if (sub) {
|
||||
s << character;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
a << character;
|
||||
}
|
||||
break;
|
||||
@@ -71,8 +70,7 @@ PrerequisiteExpression::PrerequisiteExpression(const std::string& str) {
|
||||
|
||||
if (!aString.empty()) {
|
||||
this->a = std::stoul(a.str());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this->a = 0;
|
||||
}
|
||||
|
||||
@@ -80,8 +78,7 @@ PrerequisiteExpression::PrerequisiteExpression(const std::string& str) {
|
||||
|
||||
if (!subString.empty()) {
|
||||
this->sub = std::stoul(s.str());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this->sub = 0;
|
||||
}
|
||||
|
||||
@@ -89,8 +86,7 @@ PrerequisiteExpression::PrerequisiteExpression(const std::string& str) {
|
||||
|
||||
if (!bString.empty()) {
|
||||
this->b = new PrerequisiteExpression(bString);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this->b = nullptr;
|
||||
}
|
||||
}
|
||||
@@ -109,11 +105,10 @@ bool PrerequisiteExpression::Execute(const std::unordered_map<uint32_t, Mission*
|
||||
|
||||
if (this->sub != 0) {
|
||||
// Special case for one Wisp Lee repeatable mission.
|
||||
a = mission->GetClientInfo().id == 1883 ?
|
||||
mission->GetMissionState() == static_cast<MissionState>(this->sub) :
|
||||
a = mission->GetClientInfo().id == 1883 ?
|
||||
mission->GetMissionState() == static_cast<MissionState>(this->sub) :
|
||||
mission->GetMissionState() >= static_cast<MissionState>(this->sub);
|
||||
}
|
||||
else if (mission->IsComplete()) {
|
||||
} else if (mission->IsComplete()) {
|
||||
a = true;
|
||||
}
|
||||
}
|
||||
@@ -144,42 +139,42 @@ bool MissionPrerequisites::CanAccept(const uint32_t missionId, const std::unorde
|
||||
const auto& info = mission->GetClientInfo();
|
||||
|
||||
if (info.repeatable) {
|
||||
const auto prerequisitesMet = CheckPrerequisites(missionId, missions);
|
||||
const auto prerequisitesMet = CheckPrerequisites(missionId, missions);
|
||||
|
||||
// Checked by client
|
||||
// Checked by client
|
||||
const time_t time = std::time(nullptr);
|
||||
const time_t lock = mission->GetTimestamp() + info.cooldownTime * 60;
|
||||
|
||||
// If there's no time limit, just check the prerequisites, otherwise make sure both conditions are met
|
||||
// If there's no time limit, just check the prerequisites, otherwise make sure both conditions are met
|
||||
return (info.cooldownTime == -1 ? prerequisitesMet : (lock - time < 0)) && prerequisitesMet;
|
||||
}
|
||||
|
||||
// Mission is already accepted and cannot be repeatedly accepted
|
||||
// Mission is already accepted and cannot be repeatedly accepted
|
||||
return false;
|
||||
}
|
||||
|
||||
// Mission is not yet accepted, check the prerequisites
|
||||
// Mission is not yet accepted, check the prerequisites
|
||||
return CheckPrerequisites(missionId, missions);
|
||||
}
|
||||
|
||||
bool MissionPrerequisites::CheckPrerequisites(uint32_t missionId, const std::unordered_map<uint32_t, Mission*>& missions) {
|
||||
const auto& index = expressions.find(missionId);
|
||||
if (index != expressions.end()) {
|
||||
return index->second->Execute(missions);
|
||||
}
|
||||
const auto& index = expressions.find(missionId);
|
||||
if (index != expressions.end()) {
|
||||
return index->second->Execute(missions);
|
||||
}
|
||||
|
||||
auto* missionsTable = CDClientManager::Instance()->GetTable<CDMissionsTable>("Missions");
|
||||
const auto missionEntries = missionsTable->Query([=](const CDMissions& entry) {
|
||||
return entry.id == static_cast<int>(missionId);
|
||||
});
|
||||
auto* missionsTable = CDClientManager::Instance()->GetTable<CDMissionsTable>("Missions");
|
||||
const auto missionEntries = missionsTable->Query([=](const CDMissions& entry) {
|
||||
return entry.id == static_cast<int>(missionId);
|
||||
});
|
||||
|
||||
if (missionEntries.empty())
|
||||
return false;
|
||||
if (missionEntries.empty())
|
||||
return false;
|
||||
|
||||
auto* expression = new PrerequisiteExpression(missionEntries[0].prereqMissionID);
|
||||
expressions.insert_or_assign(missionId, expression);
|
||||
auto* expression = new PrerequisiteExpression(missionEntries[0].prereqMissionID);
|
||||
expressions.insert_or_assign(missionId, expression);
|
||||
|
||||
return expression->Execute(missions);
|
||||
return expression->Execute(missions);
|
||||
}
|
||||
|
||||
std::unordered_map<uint32_t, PrerequisiteExpression*> MissionPrerequisites::expressions = {};
|
||||
|
@@ -16,11 +16,11 @@ class PrerequisiteExpression final
|
||||
PrerequisiteExpression* b;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Executes the prerequisite, checking its contents and returning whether or not the mission may be accepted
|
||||
* @param missions the list of missions to check the prerequisites against (f.e. whether they're completed)
|
||||
* @return whether or not all the prerequisites are met
|
||||
*/
|
||||
/**
|
||||
* Executes the prerequisite, checking its contents and returning whether or not the mission may be accepted
|
||||
* @param missions the list of missions to check the prerequisites against (f.e. whether they're completed)
|
||||
* @return whether or not all the prerequisites are met
|
||||
*/
|
||||
bool Execute(const std::unordered_map<uint32_t, Mission*>& missions) const;
|
||||
|
||||
explicit PrerequisiteExpression(const std::string& str);
|
||||
@@ -33,26 +33,26 @@ public:
|
||||
class MissionPrerequisites final
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Checks whether or not the mission identified by the specified ID can be accepted based on the mission inventory passed.
|
||||
* Also performs checks for daily missions (e.g. if the time out is valid).
|
||||
* @param missionId the mission ID to check prerequisites for
|
||||
* @param missions the mission inventory to check the prerequisites against
|
||||
* @return whether or not the mission identified by the specified ID can be accepted
|
||||
*/
|
||||
/**
|
||||
* Checks whether or not the mission identified by the specified ID can be accepted based on the mission inventory passed.
|
||||
* Also performs checks for daily missions (e.g. if the time out is valid).
|
||||
* @param missionId the mission ID to check prerequisites for
|
||||
* @param missions the mission inventory to check the prerequisites against
|
||||
* @return whether or not the mission identified by the specified ID can be accepted
|
||||
*/
|
||||
static bool CanAccept(uint32_t missionId, const std::unordered_map<uint32_t, Mission*>& missions);
|
||||
private:
|
||||
|
||||
/**
|
||||
* Cache of all the executed prerequisites
|
||||
*/
|
||||
/**
|
||||
* Cache of all the executed prerequisites
|
||||
*/
|
||||
static std::unordered_map<uint32_t, PrerequisiteExpression*> expressions;
|
||||
|
||||
/**
|
||||
* Checks the prerequisites for a mission
|
||||
* @param missionId the mission ID to check prerequisites for
|
||||
* @param missions the mission inventory to check the prerequisites against
|
||||
* @return whether or not the mission identified by the specified ID can be accepted
|
||||
*/
|
||||
static bool CheckPrerequisites(uint32_t missionId, const std::unordered_map<uint32_t, Mission*>& missions);
|
||||
/**
|
||||
* Checks the prerequisites for a mission
|
||||
* @param missionId the mission ID to check prerequisites for
|
||||
* @param missions the mission inventory to check the prerequisites against
|
||||
* @return whether or not the mission identified by the specified ID can be accepted
|
||||
*/
|
||||
static bool CheckPrerequisites(uint32_t missionId, const std::unordered_map<uint32_t, Mission*>& missions);
|
||||
};
|
||||
|
@@ -7,50 +7,50 @@
|
||||
* Represents the possible states a mission can be in
|
||||
*/
|
||||
enum class MissionState : int {
|
||||
/**
|
||||
* The mission state is unknown
|
||||
*/
|
||||
MISSION_STATE_UNKNOWN = -1,
|
||||
/**
|
||||
* The mission state is unknown
|
||||
*/
|
||||
MISSION_STATE_UNKNOWN = -1,
|
||||
|
||||
/**
|
||||
* The mission is yielding rewards
|
||||
*/
|
||||
MISSION_STATE_REWARDING = 0,
|
||||
/**
|
||||
* The mission is yielding rewards
|
||||
*/
|
||||
MISSION_STATE_REWARDING = 0,
|
||||
|
||||
/**
|
||||
* The mission can be accepted
|
||||
*/
|
||||
MISSION_STATE_AVAILABLE = 1,
|
||||
/**
|
||||
* The mission can be accepted
|
||||
*/
|
||||
MISSION_STATE_AVAILABLE = 1,
|
||||
|
||||
/**
|
||||
* The mission has been accepted but not yet completed
|
||||
*/
|
||||
MISSION_STATE_ACTIVE = 2,
|
||||
/**
|
||||
* The mission has been accepted but not yet completed
|
||||
*/
|
||||
MISSION_STATE_ACTIVE = 2,
|
||||
|
||||
/**
|
||||
* All the tasks for the mission have been completed and the entity can turn the mission in to complete it
|
||||
*/
|
||||
MISSION_STATE_READY_TO_COMPLETE = 4, //!< The mission is ready to complete
|
||||
/**
|
||||
* All the tasks for the mission have been completed and the entity can turn the mission in to complete it
|
||||
*/
|
||||
MISSION_STATE_READY_TO_COMPLETE = 4, //!< The mission is ready to complete
|
||||
|
||||
/**
|
||||
* The mission has been completed
|
||||
*/
|
||||
MISSION_STATE_COMPLETE = 8,
|
||||
/**
|
||||
* The mission has been completed
|
||||
*/
|
||||
MISSION_STATE_COMPLETE = 8,
|
||||
|
||||
/**
|
||||
* The mission is available again and has been completed before. Used for daily missions.
|
||||
*/
|
||||
MISSION_STATE_COMPLETE_AVAILABLE = 9,
|
||||
/**
|
||||
* The mission is available again and has been completed before. Used for daily missions.
|
||||
*/
|
||||
MISSION_STATE_COMPLETE_AVAILABLE = 9,
|
||||
|
||||
/**
|
||||
* The mission is active and has been completed before. Used for daily missions.
|
||||
*/
|
||||
MISSION_STATE_COMPLETE_ACTIVE = 10,
|
||||
/**
|
||||
* The mission is active and has been completed before. Used for daily missions.
|
||||
*/
|
||||
MISSION_STATE_COMPLETE_ACTIVE = 10,
|
||||
|
||||
/**
|
||||
* The mission has been completed before and has now been completed again. Used for daily missions.
|
||||
*/
|
||||
MISSION_STATE_COMPLETE_READY_TO_COMPLETE = 12
|
||||
/**
|
||||
* The mission has been completed before and has now been completed again. Used for daily missions.
|
||||
*/
|
||||
MISSION_STATE_COMPLETE_READY_TO_COMPLETE = 12
|
||||
};
|
||||
|
||||
#endif //!__MISSIONSTATE__H__
|
||||
|
@@ -14,8 +14,7 @@
|
||||
#include "MissionComponent.h"
|
||||
|
||||
|
||||
MissionTask::MissionTask(Mission* mission, CDMissionTasks* info, uint32_t mask)
|
||||
{
|
||||
MissionTask::MissionTask(Mission* mission, CDMissionTasks* info, uint32_t mask) {
|
||||
this->info = info;
|
||||
this->mission = mission;
|
||||
this->mask = mask;
|
||||
@@ -43,36 +42,30 @@ MissionTask::MissionTask(Mission* mission, CDMissionTasks* info, uint32_t mask)
|
||||
}
|
||||
|
||||
|
||||
MissionTaskType MissionTask::GetType() const
|
||||
{
|
||||
MissionTaskType MissionTask::GetType() const {
|
||||
return static_cast<MissionTaskType>(info->taskType);
|
||||
}
|
||||
|
||||
|
||||
uint32_t MissionTask::GetProgress() const
|
||||
{
|
||||
uint32_t MissionTask::GetProgress() const {
|
||||
return progress;
|
||||
}
|
||||
|
||||
|
||||
void MissionTask::SetProgress(const uint32_t value, const bool echo)
|
||||
{
|
||||
if (progress == value)
|
||||
{
|
||||
void MissionTask::SetProgress(const uint32_t value, const bool echo) {
|
||||
if (progress == value) {
|
||||
return;
|
||||
}
|
||||
|
||||
progress = value;
|
||||
|
||||
if (!echo)
|
||||
{
|
||||
if (!echo) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* entity = mission->GetAssociate();
|
||||
|
||||
if (entity == nullptr)
|
||||
{
|
||||
if (entity == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -82,23 +75,19 @@ void MissionTask::SetProgress(const uint32_t value, const bool echo)
|
||||
}
|
||||
|
||||
|
||||
void MissionTask::SetUnique(const std::vector<uint32_t>& value)
|
||||
{
|
||||
void MissionTask::SetUnique(const std::vector<uint32_t>& value) {
|
||||
unique = value;
|
||||
}
|
||||
|
||||
|
||||
void MissionTask::AddProgress(int32_t value)
|
||||
{
|
||||
void MissionTask::AddProgress(int32_t value) {
|
||||
value += progress;
|
||||
|
||||
if (value > info->targetValue)
|
||||
{
|
||||
if (value > info->targetValue) {
|
||||
value = info->targetValue;
|
||||
}
|
||||
|
||||
if (value < 0)
|
||||
{
|
||||
if (value < 0) {
|
||||
value = 0;
|
||||
}
|
||||
|
||||
@@ -106,50 +95,42 @@ void MissionTask::AddProgress(int32_t value)
|
||||
}
|
||||
|
||||
|
||||
Mission* MissionTask::GetMission() const
|
||||
{
|
||||
Mission* MissionTask::GetMission() const {
|
||||
return mission;
|
||||
}
|
||||
|
||||
|
||||
uint32_t MissionTask::GetTarget() const
|
||||
{
|
||||
uint32_t MissionTask::GetTarget() const {
|
||||
return info->target;
|
||||
}
|
||||
|
||||
|
||||
const CDMissionTasks& MissionTask::GetClientInfo() const
|
||||
{
|
||||
const CDMissionTasks& MissionTask::GetClientInfo() const {
|
||||
return *info;
|
||||
}
|
||||
|
||||
|
||||
uint32_t MissionTask::GetMask() const
|
||||
{
|
||||
uint32_t MissionTask::GetMask() const {
|
||||
return mask;
|
||||
}
|
||||
|
||||
|
||||
const std::vector<uint32_t>& MissionTask::GetUnique() const
|
||||
{
|
||||
const std::vector<uint32_t>& MissionTask::GetUnique() const {
|
||||
return unique;
|
||||
}
|
||||
|
||||
|
||||
const std::vector<uint32_t>& MissionTask::GetTargets() const
|
||||
{
|
||||
const std::vector<uint32_t>& MissionTask::GetTargets() const {
|
||||
return targets;
|
||||
}
|
||||
|
||||
|
||||
const std::vector<uint32_t>& MissionTask::GetParameters() const
|
||||
{
|
||||
const std::vector<uint32_t>& MissionTask::GetParameters() const {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
|
||||
std::vector<uint32_t> MissionTask::GetAllTargets() const
|
||||
{
|
||||
std::vector<uint32_t> MissionTask::GetAllTargets() const {
|
||||
auto targets = GetTargets();
|
||||
|
||||
targets.push_back(GetTarget());
|
||||
@@ -158,83 +139,68 @@ std::vector<uint32_t> MissionTask::GetAllTargets() const
|
||||
}
|
||||
|
||||
|
||||
bool MissionTask::InTargets(const uint32_t value) const
|
||||
{
|
||||
bool MissionTask::InTargets(const uint32_t value) const {
|
||||
auto targets = GetTargets();
|
||||
|
||||
return std::find(targets.begin(), targets.end(), value) != targets.end();
|
||||
}
|
||||
|
||||
|
||||
bool MissionTask::InAllTargets(const uint32_t value) const
|
||||
{
|
||||
bool MissionTask::InAllTargets(const uint32_t value) const {
|
||||
auto targets = GetAllTargets();
|
||||
|
||||
return std::find(targets.begin(), targets.end(), value) != targets.end();
|
||||
}
|
||||
|
||||
bool MissionTask::InParameters(const uint32_t value) const
|
||||
{
|
||||
bool MissionTask::InParameters(const uint32_t value) const {
|
||||
auto parameters = GetParameters();
|
||||
|
||||
return std::find(parameters.begin(), parameters.end(), value) != parameters.end();
|
||||
}
|
||||
|
||||
|
||||
bool MissionTask::IsComplete() const
|
||||
{
|
||||
bool MissionTask::IsComplete() const {
|
||||
// Mission 668 has task uid 984 which is a bit mask. Its completion value is 3.
|
||||
if (info->uid == 984) {
|
||||
return progress >= 3;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return progress >= info->targetValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MissionTask::Complete()
|
||||
{
|
||||
void MissionTask::Complete() {
|
||||
SetProgress(info->targetValue);
|
||||
}
|
||||
|
||||
|
||||
void MissionTask::CheckCompletion() const
|
||||
{
|
||||
if (IsComplete())
|
||||
{
|
||||
void MissionTask::CheckCompletion() const {
|
||||
if (IsComplete()) {
|
||||
mission->CheckCompletion();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& targets, int32_t count)
|
||||
{
|
||||
void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& targets, int32_t count) {
|
||||
if (IsComplete() && count > 0) return;
|
||||
|
||||
const auto type = GetType();
|
||||
|
||||
if (count < 0)
|
||||
{
|
||||
if (mission->IsMission() && type == MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION && InAllTargets(value))
|
||||
{
|
||||
if (parameters.size() > 0 && (parameters[0] & 1) != 0)
|
||||
{
|
||||
if (count < 0) {
|
||||
if (mission->IsMission() && type == MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION && InAllTargets(value)) {
|
||||
if (parameters.size() > 0 && (parameters[0] & 1) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* inventoryComponent = mission->GetAssociate()->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inventoryComponent != nullptr)
|
||||
{
|
||||
if (inventoryComponent != nullptr) {
|
||||
int32_t itemCount = inventoryComponent->GetLotCountNonTransfer(value);
|
||||
|
||||
if (itemCount < info->targetValue)
|
||||
{
|
||||
if (itemCount < info->targetValue) {
|
||||
SetProgress(itemCount);
|
||||
|
||||
if (mission->IsReadyToComplete())
|
||||
{
|
||||
if (mission->IsReadyToComplete()) {
|
||||
mission->MakeActive();
|
||||
}
|
||||
}
|
||||
@@ -271,8 +237,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
|
||||
}
|
||||
|
||||
activity = static_cast<ScriptedActivityComponent*>(entity->GetComponent(COMPONENT_TYPE_REBUILD));
|
||||
if (activity == nullptr)
|
||||
{
|
||||
if (activity == nullptr) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -280,8 +245,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
|
||||
|
||||
const auto activityIdOverride = entity->GetVar<int32_t>(u"activityID");
|
||||
|
||||
if (activityIdOverride != 0)
|
||||
{
|
||||
if (activityIdOverride != 0) {
|
||||
activityId = activityIdOverride;
|
||||
}
|
||||
|
||||
@@ -308,8 +272,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
|
||||
|
||||
entity = EntityManager::Instance()->GetEntity(associate);
|
||||
|
||||
if (entity == nullptr)
|
||||
{
|
||||
if (entity == nullptr) {
|
||||
Game::logger->Log("MissionTask", "Failed to find associated entity (%llu)!", associate);
|
||||
|
||||
break;
|
||||
@@ -335,11 +298,11 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
|
||||
break;
|
||||
}
|
||||
|
||||
case MissionTaskType::MISSION_TASK_TYPE_MINIGAME:
|
||||
case MissionTaskType::MISSION_TASK_TYPE_MINIGAME:
|
||||
{
|
||||
auto* minigameManager = EntityManager::Instance()->GetEntity(associate);
|
||||
if (minigameManager == nullptr)
|
||||
break;
|
||||
break;
|
||||
|
||||
int32_t gameID = minigameManager->GetLOT();
|
||||
|
||||
@@ -353,11 +316,11 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
|
||||
}
|
||||
// This special case is for shooting gallery missions that want their
|
||||
// progress value set to 1 instead of being set to the target value.
|
||||
if(info->targetGroup == targets && value >= info->targetValue && GetMission()->IsMission() && info->target == 1864 && info->targetGroup == "performact_score") {
|
||||
if (info->targetGroup == targets && value >= info->targetValue && GetMission()->IsMission() && info->target == 1864 && info->targetGroup == "performact_score") {
|
||||
SetProgress(1);
|
||||
break;
|
||||
}
|
||||
if(info->targetGroup == targets && value >= info->targetValue) {
|
||||
if (info->targetGroup == targets && value >= info->targetValue) {
|
||||
SetProgress(info->targetValue);
|
||||
break;
|
||||
}
|
||||
@@ -383,8 +346,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
|
||||
|
||||
entity = EntityManager::Instance()->GetEntity(associate);
|
||||
|
||||
if (entity == nullptr)
|
||||
{
|
||||
if (entity == nullptr) {
|
||||
Game::logger->Log("MissionTask", "Failed to find associated entity (%llu)!", associate);
|
||||
|
||||
break;
|
||||
@@ -431,8 +393,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
|
||||
|
||||
if (parameters[0] != associate) break;
|
||||
|
||||
if (associate == 1 || associate == 2 || associate == 3)
|
||||
{
|
||||
if (associate == 1 || associate == 2 || associate == 3) {
|
||||
if (value > info->targetValue) break;
|
||||
|
||||
AddProgress(info->targetValue);
|
||||
@@ -447,26 +408,18 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
|
||||
// If we won at Gnarled Forest, set bit 1
|
||||
else if (value == 1303) SetProgress(tempProgress |= 1 << 1);
|
||||
// If both bits are set, then the client sees the mission as complete.
|
||||
}
|
||||
else if (associate == 10)
|
||||
{
|
||||
} else if (associate == 10) {
|
||||
// If the player did not crash during the race, progress this task by count.
|
||||
if (value != 0) break;
|
||||
|
||||
AddProgress(count);
|
||||
}
|
||||
else if (associate == 4 || associate == 5 || associate == 14)
|
||||
{
|
||||
} else if (associate == 4 || associate == 5 || associate == 14) {
|
||||
if (!InAllTargets(value)) break;
|
||||
AddProgress(count);
|
||||
}
|
||||
else if (associate == 17)
|
||||
{
|
||||
} else if (associate == 17) {
|
||||
if (!InAllTargets(value)) break;
|
||||
AddProgress(count);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
AddProgress(count);
|
||||
}
|
||||
|
||||
@@ -503,8 +456,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
|
||||
}
|
||||
|
||||
|
||||
MissionTask::~MissionTask()
|
||||
{
|
||||
MissionTask::~MissionTask() {
|
||||
targets.clear();
|
||||
|
||||
parameters.clear();
|
||||
|
@@ -16,172 +16,172 @@ class MissionTask final
|
||||
{
|
||||
public:
|
||||
MissionTask(Mission* mission, CDMissionTasks* info, uint32_t mask);
|
||||
~MissionTask();
|
||||
~MissionTask();
|
||||
|
||||
/**
|
||||
* Attempts to progress this task using the provided parameters. Note that the behavior of this method is different
|
||||
* for each mission task type.
|
||||
* @param value the value to progress by
|
||||
* @param associate optional object ID of an entity that was related to the progression
|
||||
* @param targets optional multiple targets that need to be met to progress
|
||||
* @param count a number that indicates the times to progress
|
||||
*/
|
||||
/**
|
||||
* Attempts to progress this task using the provided parameters. Note that the behavior of this method is different
|
||||
* for each mission task type.
|
||||
* @param value the value to progress by
|
||||
* @param associate optional object ID of an entity that was related to the progression
|
||||
* @param targets optional multiple targets that need to be met to progress
|
||||
* @param count a number that indicates the times to progress
|
||||
*/
|
||||
void Progress(int32_t value, LWOOBJID associate = 0, const std::string& targets = "", int32_t count = 1);
|
||||
|
||||
/**
|
||||
* Returns the current progression of this task
|
||||
* @return the current progression of this task
|
||||
*/
|
||||
/**
|
||||
* Returns the current progression of this task
|
||||
* @return the current progression of this task
|
||||
*/
|
||||
uint32_t GetProgress() const;
|
||||
|
||||
/**
|
||||
* Progresses the progress of this task by the provided value. Does not exceed the target progress.
|
||||
* @param value the value to progress by
|
||||
*/
|
||||
void AddProgress(int32_t value);
|
||||
/**
|
||||
* Progresses the progress of this task by the provided value. Does not exceed the target progress.
|
||||
* @param value the value to progress by
|
||||
*/
|
||||
void AddProgress(int32_t value);
|
||||
|
||||
/**
|
||||
* Sets the progress of the task and optionally notifies the client
|
||||
* @param value the value to set for the progress
|
||||
* @param echo if true, this will notify the client of the change
|
||||
*/
|
||||
void SetProgress(uint32_t value, bool echo = true);
|
||||
/**
|
||||
* Sets the progress of the task and optionally notifies the client
|
||||
* @param value the value to set for the progress
|
||||
* @param echo if true, this will notify the client of the change
|
||||
*/
|
||||
void SetProgress(uint32_t value, bool echo = true);
|
||||
|
||||
/**
|
||||
* Returns the mission this task belongs to
|
||||
* @return the mission this task belongs to
|
||||
*/
|
||||
/**
|
||||
* Returns the mission this task belongs to
|
||||
* @return the mission this task belongs to
|
||||
*/
|
||||
Mission* GetMission() const;
|
||||
|
||||
/**
|
||||
* Returns the type of this task
|
||||
* @return the type of this task
|
||||
*/
|
||||
/**
|
||||
* Returns the type of this task
|
||||
* @return the type of this task
|
||||
*/
|
||||
MissionTaskType GetType() const;
|
||||
|
||||
/**
|
||||
* Returns the value that should be progressed to, to complete the mission (the target value)
|
||||
* @return the target value
|
||||
*/
|
||||
/**
|
||||
* Returns the value that should be progressed to, to complete the mission (the target value)
|
||||
* @return the target value
|
||||
*/
|
||||
uint32_t GetTarget() const;
|
||||
|
||||
/**
|
||||
* Returns the database information for this mission
|
||||
* @return the database information for this mission
|
||||
*/
|
||||
/**
|
||||
* Returns the database information for this mission
|
||||
* @return the database information for this mission
|
||||
*/
|
||||
const CDMissionTasks& GetClientInfo() const;
|
||||
|
||||
/**
|
||||
* Returns the mask for this mission, used for communicating updates
|
||||
* @return the mask for this mission, used for communicating updates
|
||||
*/
|
||||
/**
|
||||
* Returns the mask for this mission, used for communicating updates
|
||||
* @return the mask for this mission, used for communicating updates
|
||||
*/
|
||||
uint32_t GetMask() const;
|
||||
|
||||
/**
|
||||
* Returns the currently visited list of unique locations (only used for visiting mission types)
|
||||
* @return the currently visited list of unique locations
|
||||
*/
|
||||
/**
|
||||
* Returns the currently visited list of unique locations (only used for visiting mission types)
|
||||
* @return the currently visited list of unique locations
|
||||
*/
|
||||
const std::vector<uint32_t>& GetUnique() const;
|
||||
|
||||
/**
|
||||
* Sets the uniquely visited list of locations
|
||||
* @param value the uniquely visited list of locations
|
||||
*/
|
||||
void SetUnique(const std::vector<uint32_t>& value);
|
||||
/**
|
||||
* Sets the uniquely visited list of locations
|
||||
* @param value the uniquely visited list of locations
|
||||
*/
|
||||
void SetUnique(const std::vector<uint32_t>& value);
|
||||
|
||||
/**
|
||||
* Returns the possibly target values for this mission task for progression
|
||||
* @return the possibly target values for this mission task for progression
|
||||
*/
|
||||
/**
|
||||
* Returns the possibly target values for this mission task for progression
|
||||
* @return the possibly target values for this mission task for progression
|
||||
*/
|
||||
const std::vector<uint32_t>& GetTargets() const;
|
||||
|
||||
/**
|
||||
* Returns the parameters for this task: meta information that determines if the task can be progressed. Note:
|
||||
* not used by all task types.
|
||||
* @return the parameters for this task
|
||||
*/
|
||||
/**
|
||||
* Returns the parameters for this task: meta information that determines if the task can be progressed. Note:
|
||||
* not used by all task types.
|
||||
* @return the parameters for this task
|
||||
*/
|
||||
const std::vector<uint32_t>& GetParameters() const;
|
||||
|
||||
/**
|
||||
* Returns all the target values for this mission, including the target value concatenated by the optional list of
|
||||
* targets parsed as ints.
|
||||
* @return all the targets for this task
|
||||
*/
|
||||
/**
|
||||
* Returns all the target values for this mission, including the target value concatenated by the optional list of
|
||||
* targets parsed as ints.
|
||||
* @return all the targets for this task
|
||||
*/
|
||||
std::vector<uint32_t> GetAllTargets() const;
|
||||
|
||||
/**
|
||||
* Returns whether the value is in the list of target values of this task
|
||||
* @param value the value to check for
|
||||
* @return true if the value is in the target list, false otherwise
|
||||
*/
|
||||
/**
|
||||
* Returns whether the value is in the list of target values of this task
|
||||
* @param value the value to check for
|
||||
* @return true if the value is in the target list, false otherwise
|
||||
*/
|
||||
bool InTargets(uint32_t value) const;
|
||||
|
||||
/**
|
||||
* Returns whether the value is in one of the target values or equals the individual target value of this task
|
||||
* @param value the value to check for
|
||||
* @return true if the value is one of the targets, false otherwise
|
||||
*/
|
||||
/**
|
||||
* Returns whether the value is in one of the target values or equals the individual target value of this task
|
||||
* @param value the value to check for
|
||||
* @return true if the value is one of the targets, false otherwise
|
||||
*/
|
||||
bool InAllTargets(uint32_t value) const;
|
||||
|
||||
/**
|
||||
* Checks if the provided is one of the parameters for this task
|
||||
* @param value the value to check for
|
||||
* @return true if the value is one of the parameters, false otherwise
|
||||
*/
|
||||
/**
|
||||
* Checks if the provided is one of the parameters for this task
|
||||
* @param value the value to check for
|
||||
* @return true if the value is one of the parameters, false otherwise
|
||||
*/
|
||||
bool InParameters(uint32_t value) const;
|
||||
|
||||
/**
|
||||
* Checks if this task has been completed by comparing its progress against the target value
|
||||
* @return true if the task has been completed, false otherwise
|
||||
*/
|
||||
/**
|
||||
* Checks if this task has been completed by comparing its progress against the target value
|
||||
* @return true if the task has been completed, false otherwise
|
||||
*/
|
||||
bool IsComplete() const;
|
||||
|
||||
/**
|
||||
* Completes the mission by setting the progress to the required value
|
||||
*/
|
||||
/**
|
||||
* Completes the mission by setting the progress to the required value
|
||||
*/
|
||||
void Complete();
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Datbase information about this task
|
||||
*/
|
||||
/**
|
||||
* Datbase information about this task
|
||||
*/
|
||||
CDMissionTasks* info;
|
||||
|
||||
/**
|
||||
* The mission this task belongs to
|
||||
*/
|
||||
/**
|
||||
* The mission this task belongs to
|
||||
*/
|
||||
Mission* mission;
|
||||
|
||||
/**
|
||||
* Mask used for communicating mission updates
|
||||
*/
|
||||
/**
|
||||
* Mask used for communicating mission updates
|
||||
*/
|
||||
uint32_t mask;
|
||||
|
||||
/**
|
||||
* The current progression towards the target
|
||||
*/
|
||||
/**
|
||||
* The current progression towards the target
|
||||
*/
|
||||
uint32_t progress;
|
||||
|
||||
/**
|
||||
* The list of target values for progressing this task
|
||||
*/
|
||||
/**
|
||||
* The list of target values for progressing this task
|
||||
*/
|
||||
std::vector<uint32_t> targets;
|
||||
|
||||
/**
|
||||
* The list of parameters for progressing this task (not used by all task types)
|
||||
*/
|
||||
/**
|
||||
* The list of parameters for progressing this task (not used by all task types)
|
||||
*/
|
||||
std::vector<uint32_t> parameters;
|
||||
|
||||
/**
|
||||
* The unique places visited for progression (not used by all task types)
|
||||
*/
|
||||
/**
|
||||
* The unique places visited for progression (not used by all task types)
|
||||
*/
|
||||
std::vector<uint32_t> unique;
|
||||
|
||||
/**
|
||||
* Checks if the task is complete, and if so checks if the parent mission is complete
|
||||
*/
|
||||
/**
|
||||
* Checks if the task is complete, and if so checks if the parent mission is complete
|
||||
*/
|
||||
void CheckCompletion() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -5,27 +5,27 @@
|
||||
|
||||
//! An enum for mission task types
|
||||
enum class MissionTaskType : int {
|
||||
MISSION_TASK_TYPE_UNKNOWN = -1, //!< The task type is unknown
|
||||
MISSION_TASK_TYPE_SMASH = 0, //!< A task for smashing something
|
||||
MISSION_TASK_TYPE_SCRIPT = 1, //!< A task handled by a server LUA script
|
||||
MISSION_TASK_TYPE_ACTIVITY = 2, //!< A task for completing a quickbuild
|
||||
MISSION_TASK_TYPE_ENVIRONMENT = 3, //!< A task for something in the environment
|
||||
MISSION_TASK_TYPE_MISSION_INTERACTION = 4, //!< A task for interacting with a mission
|
||||
MISSION_TASK_TYPE_EMOTE = 5, //!< A task for playing an emote
|
||||
MISSION_TASK_TYPE_FOOD = 9, //!< A task for eating food
|
||||
MISSION_TASK_TYPE_SKILL = 10, //!< A task for performing a skill
|
||||
MISSION_TASK_TYPE_ITEM_COLLECTION = 11, //!< A task for collecting an item
|
||||
MISSION_TASK_TYPE_LOCATION = 12, //!< A task for finding a location
|
||||
MISSION_TASK_TYPE_MINIGAME = 14, //!< A task for doing something in a minigame
|
||||
MISSION_TASK_TYPE_NON_MISSION_INTERACTION = 15, //!< A task for interacting with a non-mission
|
||||
MISSION_TASK_TYPE_MISSION_COMPLETE = 16, //!< A task for completing a mission
|
||||
MISSION_TASK_TYPE_EARN_REPUTATION = 17, //!< A task for earning reputation
|
||||
MISSION_TASK_TYPE_POWERUP = 21, //!< A task for collecting a powerup
|
||||
MISSION_TASK_TYPE_PET_TAMING = 22, //!< A task for taming a pet
|
||||
MISSION_TASK_TYPE_RACING = 23, //!< A task for racing
|
||||
MISSION_TASK_TYPE_PLAYER_FLAG = 24, //!< A task for setting a player flag
|
||||
MISSION_TASK_TYPE_PLACE_MODEL = 25, //!< A task for picking up a model
|
||||
MISSION_TASK_TYPE_VISIT_PROPERTY = 30 //!< A task for visiting a property
|
||||
MISSION_TASK_TYPE_UNKNOWN = -1, //!< The task type is unknown
|
||||
MISSION_TASK_TYPE_SMASH = 0, //!< A task for smashing something
|
||||
MISSION_TASK_TYPE_SCRIPT = 1, //!< A task handled by a server LUA script
|
||||
MISSION_TASK_TYPE_ACTIVITY = 2, //!< A task for completing a quickbuild
|
||||
MISSION_TASK_TYPE_ENVIRONMENT = 3, //!< A task for something in the environment
|
||||
MISSION_TASK_TYPE_MISSION_INTERACTION = 4, //!< A task for interacting with a mission
|
||||
MISSION_TASK_TYPE_EMOTE = 5, //!< A task for playing an emote
|
||||
MISSION_TASK_TYPE_FOOD = 9, //!< A task for eating food
|
||||
MISSION_TASK_TYPE_SKILL = 10, //!< A task for performing a skill
|
||||
MISSION_TASK_TYPE_ITEM_COLLECTION = 11, //!< A task for collecting an item
|
||||
MISSION_TASK_TYPE_LOCATION = 12, //!< A task for finding a location
|
||||
MISSION_TASK_TYPE_MINIGAME = 14, //!< A task for doing something in a minigame
|
||||
MISSION_TASK_TYPE_NON_MISSION_INTERACTION = 15, //!< A task for interacting with a non-mission
|
||||
MISSION_TASK_TYPE_MISSION_COMPLETE = 16, //!< A task for completing a mission
|
||||
MISSION_TASK_TYPE_EARN_REPUTATION = 17, //!< A task for earning reputation
|
||||
MISSION_TASK_TYPE_POWERUP = 21, //!< A task for collecting a powerup
|
||||
MISSION_TASK_TYPE_PET_TAMING = 22, //!< A task for taming a pet
|
||||
MISSION_TASK_TYPE_RACING = 23, //!< A task for racing
|
||||
MISSION_TASK_TYPE_PLAYER_FLAG = 24, //!< A task for setting a player flag
|
||||
MISSION_TASK_TYPE_PLACE_MODEL = 25, //!< A task for picking up a model
|
||||
MISSION_TASK_TYPE_VISIT_PROPERTY = 30 //!< A task for visiting a property
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -3,18 +3,18 @@
|
||||
#include <cstdint>
|
||||
|
||||
enum class RacingTaskParam : int32_t {
|
||||
RACING_TASK_PARAM_FINISH_WITH_PLACEMENT = 1, //<! A task param for finishing with a specific placement.
|
||||
RACING_TASK_PARAM_LAP_TIME = 2, //<! A task param for finishing with a specific lap time.
|
||||
RACING_TASK_PARAM_TOTAL_TRACK_TIME = 3, //<! A task param for finishing with a specific track time.
|
||||
RACING_TASK_PARAM_COMPLETE_ANY_RACING_TASK = 4, //<! A task param for completing a racing task.
|
||||
RACING_TASK_PARAM_COMPLETE_TRACK_TASKS = 5, //<! A task param for completing a task for a specific track.
|
||||
RACING_TASK_PARAM_MODULAR_BUILDING = 6, //<! A task param for modular building with racing builds.
|
||||
RACING_TASK_PARAM_SAFE_DRIVER = 10, //<! A task param for completing a race without smashing.
|
||||
RACING_TASK_PARAM_SMASHABLES = 11, //<! A task param for smashing entities during a race.
|
||||
RACING_TASK_PARAM_COLLECT_IMAGINATION = 12, //<! A task param for collecting imagination during a race.
|
||||
RACING_TASK_PARAM_COMPETED_IN_RACE = 13, //<! A task param for competing in a race.
|
||||
RACING_TASK_PARAM_WIN_RACE_IN_WORLD = 14, //<! A task param for winning a race in a specific world.
|
||||
RACING_TASK_PARAM_FIRST_PLACE_MULTIPLE_TRACKS = 15, //<! A task param for finishing in first place on multiple tracks.
|
||||
RACING_TASK_PARAM_LAST_PLACE_FINISH = 16, //<! A task param for finishing in last place.
|
||||
RACING_TASK_PARAM_SMASH_SPECIFIC_SMASHABLE = 17 //<! A task param for smashing dragon eggs during a race.
|
||||
};
|
||||
RACING_TASK_PARAM_FINISH_WITH_PLACEMENT = 1, //<! A task param for finishing with a specific placement.
|
||||
RACING_TASK_PARAM_LAP_TIME = 2, //<! A task param for finishing with a specific lap time.
|
||||
RACING_TASK_PARAM_TOTAL_TRACK_TIME = 3, //<! A task param for finishing with a specific track time.
|
||||
RACING_TASK_PARAM_COMPLETE_ANY_RACING_TASK = 4, //<! A task param for completing a racing task.
|
||||
RACING_TASK_PARAM_COMPLETE_TRACK_TASKS = 5, //<! A task param for completing a task for a specific track.
|
||||
RACING_TASK_PARAM_MODULAR_BUILDING = 6, //<! A task param for modular building with racing builds.
|
||||
RACING_TASK_PARAM_SAFE_DRIVER = 10, //<! A task param for completing a race without smashing.
|
||||
RACING_TASK_PARAM_SMASHABLES = 11, //<! A task param for smashing entities during a race.
|
||||
RACING_TASK_PARAM_COLLECT_IMAGINATION = 12, //<! A task param for collecting imagination during a race.
|
||||
RACING_TASK_PARAM_COMPETED_IN_RACE = 13, //<! A task param for competing in a race.
|
||||
RACING_TASK_PARAM_WIN_RACE_IN_WORLD = 14, //<! A task param for winning a race in a specific world.
|
||||
RACING_TASK_PARAM_FIRST_PLACE_MULTIPLE_TRACKS = 15, //<! A task param for finishing in first place on multiple tracks.
|
||||
RACING_TASK_PARAM_LAST_PLACE_FINISH = 16, //<! A task param for finishing in last place.
|
||||
RACING_TASK_PARAM_SMASH_SPECIFIC_SMASHABLE = 17 //<! A task param for smashing dragon eggs during a race.
|
||||
};
|
||||
|
Reference in New Issue
Block a user