mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-14 10:20:05 +00:00
Assign paths with matching taskIDs to escort tasks on task start
This commit is contained in:
parent
974b67d4b6
commit
a90ba9ea08
@ -3,6 +3,7 @@
|
|||||||
#include "PlayerManager.hpp"
|
#include "PlayerManager.hpp"
|
||||||
#include "Nanos.hpp"
|
#include "Nanos.hpp"
|
||||||
#include "Items.hpp"
|
#include "Items.hpp"
|
||||||
|
#include "Transport.hpp"
|
||||||
|
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
|
||||||
@ -358,15 +359,19 @@ static void taskStart(CNSocket* sock, CNPacketData* data) {
|
|||||||
response.iRemainTime = task["m_iSTGrantTimer"];
|
response.iRemainTime = task["m_iSTGrantTimer"];
|
||||||
sock->sendPacket((void*)&response, P_FE2CL_REP_PC_TASK_START_SUCC, sizeof(sP_FE2CL_REP_PC_TASK_START_SUCC));
|
sock->sendPacket((void*)&response, P_FE2CL_REP_PC_TASK_START_SUCC, sizeof(sP_FE2CL_REP_PC_TASK_START_SUCC));
|
||||||
|
|
||||||
// HACK: auto-succeed escort task
|
// if escort task, assign matching paths to all nearby NPCs
|
||||||
if (task["m_iHTaskType"] == 6) {
|
if (task["m_iHTaskType"] == 6) {
|
||||||
std::cout << "Skipping escort mission" << std::endl;
|
for(Chunk* chunk : plr->viewableChunks) // check all NPCs in view
|
||||||
INITSTRUCT(sP_FE2CL_REP_PC_TASK_END_SUCC, response);
|
for (EntityRef ref : chunk->entities) {
|
||||||
|
if (ref.type != EntityType::PLAYER) {
|
||||||
endTask(sock, missionData->iTaskNum);
|
BaseNPC* npc = (BaseNPC*)ref.getEntity();
|
||||||
response.iTaskNum = missionData->iTaskNum;
|
NPCPath* path = Transport::findApplicablePath(npc->appearanceData.iNPC_ID, npc->appearanceData.iNPCType, missionData->iTaskNum);
|
||||||
|
if (path != nullptr) {
|
||||||
sock->sendPacket((void*)&response, P_FE2CL_REP_PC_TASK_END_SUCC, sizeof(sP_FE2CL_REP_PC_TASK_END_SUCC));
|
Transport::constructPathNPC(npc->appearanceData.iNPC_ID, path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user