warping to the past now sets PayZoneFlag and removes all active missions

This commit is contained in:
kamilprzyb 2020-09-24 22:32:09 +02:00
parent df936e8c9c
commit 1874f1081b
3 changed files with 20 additions and 5 deletions

View File

@ -157,13 +157,17 @@ void MissionManager::quitMission(CNSocket* sock, CNPacketData* data) {
return; // malformed packet
sP_CL2FE_REQ_PC_TASK_STOP* missionData = (sP_CL2FE_REQ_PC_TASK_STOP*)data->buf;
quitTask(sock, missionData->iTaskNum);
}
void MissionManager::quitTask(CNSocket* sock, int32_t TaskNum) {
INITSTRUCT(sP_FE2CL_REP_PC_TASK_STOP_SUCC, response);
Player* plr = PlayerManager::getPlayer(sock);
// update player
int i;
for (i = 0; i < ACTIVE_MISSION_COUNT; i++) {
if (plr->tasks[i] == missionData->iTaskNum)
if (plr->tasks[i] == TaskNum)
{
plr->tasks[i] = 0;
for (int j = 0; j < 3; j++) {
@ -177,7 +181,7 @@ void MissionManager::quitMission(CNSocket* sock, CNPacketData* data) {
// remove current mission
plr->CurrentMissionID = 0;
TaskData& task = *Tasks[missionData->iTaskNum];
TaskData& task = *Tasks[TaskNum];
// clean up quest items
for (i = 0; i < 3; i++) {
@ -193,7 +197,7 @@ void MissionManager::quitMission(CNSocket* sock, CNPacketData* data) {
memset(&plr->QInven[j], 0, sizeof(sItemBase));
}
response.iTaskNum = missionData->iTaskNum;
response.iTaskNum = TaskNum;
sock->sendPacket((void*)&response, P_FE2CL_REP_PC_TASK_STOP_SUCC, sizeof(sP_FE2CL_REP_PC_TASK_STOP_SUCC));
}

View File

@ -56,4 +56,5 @@ namespace MissionManager {
void mobKilled(CNSocket *sock, int mobid);
void saveMission(Player* player, int missionId);
void quitTask(CNSocket* sock, int32_t TaskNum);
}

View File

@ -815,6 +815,16 @@ void PlayerManager::changePlayerGuide(CNSocket *sock, CNPacketData *data) {
resp.iFusionMatter = plr->fusionmatter; // no cost
sock->sendPacket((void*)&resp, P_FE2CL_REP_PC_CHANGE_MENTOR_SUCC, sizeof(sP_FE2CL_REP_PC_CHANGE_MENTOR_SUCC));
// if it's changed from computress
if (plr->mentor == 5) {
// we're warping to the past
plr->PCStyle2.iPayzoneFlag = 1;
// remove all active missions
for (int i = 0; i < ACTIVE_MISSION_COUNT; i++) {
if (plr->tasks[i] != 0)
MissionManager::quitTask(sock, plr->tasks[i]);
}
}
// save it on player
plr->mentor = pkt->iMentor;
}