DarkflameServer/dScripts/ai/NS/NsGetFactionMissionServer.cpp
Aaron Kimbrell 6aa90ad5b2
Breakout rest of the enums from dCommonVars and clean it up (#1061)
* Breakout rest of the enums from dcommonvars
so we don't have to deal with merge conflicts
ePlayerFlags is not a scoped enum, yet, due to it's complexity

* address feedback

* make player flag types consistent

* fix typo
2023-05-02 17:39:21 -05:00

57 lines
1.4 KiB
C++

#include "NsGetFactionMissionServer.h"
#include "GameMessages.h"
#include "MissionComponent.h"
#include "Character.h"
#include "eReplicaComponentType.h"
#include "ePlayerFlag.h"
void NsGetFactionMissionServer::OnRespondToMission(Entity* self, int missionID, Entity* player, int reward) {
if (missionID != 474) return;
if (reward != LOT_NULL) {
std::vector<int> factionMissions;
int celebrationID = -1;
int32_t flagID = -1;
if (reward == 6980) {
// Venture League
factionMissions = { 555, 556 };
celebrationID = 14;
flagID = 46;
} else if (reward == 6979) {
// Assembly
factionMissions = { 544, 545 };
celebrationID = 15;
flagID = 47;
} else if (reward == 6981) {
// Paradox
factionMissions = { 577, 578 };
celebrationID = 16;
flagID = 48;
} else if (reward == 6978) {
// Sentinel
factionMissions = { 566, 567 };
celebrationID = 17;
flagID = 49;
}
factionMissions.push_back(778);
if (celebrationID != -1) {
GameMessages::SendStartCelebrationEffect(player, player->GetSystemAddress(), celebrationID);
}
if (flagID != -1) {
player->GetCharacter()->SetPlayerFlag(ePlayerFlag::JOINED_A_FACTION, true);
player->GetCharacter()->SetPlayerFlag(flagID, true);
}
MissionComponent* mis = static_cast<MissionComponent*>(player->GetComponent(eReplicaComponentType::MISSION));
for (int mission : factionMissions) {
mis->AcceptMission(mission);
mis->CompleteMission(mission);
}
}
}