mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 13:30:06 +00:00
A few cosmetic changes in Missions.cpp
* Removed a redundant failure case in endTask() * Fixed a misleading comment in startTask() * Removed a redundant level check in updateFusionMatter() * Cleared up misleading comment and code layout in taskEnd() * Removed unnecessary comment in mobKilled()
This commit is contained in:
parent
94af318139
commit
d3af99fcef
@ -232,11 +232,6 @@ static bool endTask(CNSocket *sock, int32_t taskNum, int choice=0) {
|
|||||||
if (!found)
|
if (!found)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (i == ACTIVE_MISSION_COUNT - 1 && plr->tasks[i] != 0) {
|
|
||||||
std::cout << "[WARN] Player completed non-active mission!?" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// mission rewards
|
// mission rewards
|
||||||
if (Rewards.find(taskNum) != Rewards.end()) {
|
if (Rewards.find(taskNum) != Rewards.end()) {
|
||||||
if (giveMissionReward(sock, taskNum, choice) == -1)
|
if (giveMissionReward(sock, taskNum, choice) == -1)
|
||||||
@ -303,7 +298,7 @@ bool Missions::startTask(Player* plr, int TaskID) {
|
|||||||
TaskData& task = *Missions::Tasks[TaskID];
|
TaskData& task = *Missions::Tasks[TaskID];
|
||||||
|
|
||||||
if (task["m_iCTRReqLvMin"] > plr->level) {
|
if (task["m_iCTRReqLvMin"] > plr->level) {
|
||||||
std::cout << "[WARN] Player tried to start a task below their level" << std::endl;
|
std::cout << "[WARN] Player tried to start a task above their level" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,11 +387,12 @@ static void taskStart(CNSocket* sock, CNPacketData* data) {
|
|||||||
static void taskEnd(CNSocket* sock, CNPacketData* data) {
|
static void taskEnd(CNSocket* sock, CNPacketData* data) {
|
||||||
sP_CL2FE_REQ_PC_TASK_END* missionData = (sP_CL2FE_REQ_PC_TASK_END*)data->buf;
|
sP_CL2FE_REQ_PC_TASK_END* missionData = (sP_CL2FE_REQ_PC_TASK_END*)data->buf;
|
||||||
|
|
||||||
// failed timed missions give an iNPC_ID of 0
|
|
||||||
if (missionData->iNPC_ID == 0) {
|
|
||||||
TaskData* task = Missions::Tasks[missionData->iTaskNum];
|
TaskData* task = Missions::Tasks[missionData->iTaskNum];
|
||||||
if (task->task["m_iSTGrantTimer"] > 0) { // its a timed mission
|
|
||||||
|
// handle timed mission failure
|
||||||
|
if (task->task["m_iSTGrantTimer"] > 0 && missionData->iNPC_ID == 0) {
|
||||||
Player* plr = PlayerManager::getPlayer(sock);
|
Player* plr = PlayerManager::getPlayer(sock);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enemy killing missions
|
* Enemy killing missions
|
||||||
* this is gross and should be cleaned up later
|
* this is gross and should be cleaned up later
|
||||||
@ -418,7 +414,6 @@ static void taskEnd(CNSocket* sock, CNPacketData* data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!mobsAreKilled) {
|
if (!mobsAreKilled) {
|
||||||
|
|
||||||
int failTaskID = task->task["m_iFOutgoingTask"];
|
int failTaskID = task->task["m_iFOutgoingTask"];
|
||||||
if (failTaskID != 0) {
|
if (failTaskID != 0) {
|
||||||
Missions::quitTask(sock, missionData->iTaskNum, false);
|
Missions::quitTask(sock, missionData->iTaskNum, false);
|
||||||
@ -430,7 +425,6 @@ static void taskEnd(CNSocket* sock, CNPacketData* data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
INITSTRUCT(sP_FE2CL_REP_PC_TASK_END_SUCC, response);
|
INITSTRUCT(sP_FE2CL_REP_PC_TASK_END_SUCC, response);
|
||||||
|
|
||||||
@ -555,9 +549,6 @@ void Missions::updateFusionMatter(CNSocket* sock, int fusion) {
|
|||||||
response.iTaskNum = AvatarGrowth[plr->level]["m_iNanoQuestTaskID"];
|
response.iTaskNum = AvatarGrowth[plr->level]["m_iNanoQuestTaskID"];
|
||||||
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));
|
||||||
#else
|
#else
|
||||||
if (plr->level >= 36)
|
|
||||||
return;
|
|
||||||
|
|
||||||
plr->fusionmatter -= (int)Missions::AvatarGrowth[plr->level]["m_iReqBlob_NanoCreate"];
|
plr->fusionmatter -= (int)Missions::AvatarGrowth[plr->level]["m_iReqBlob_NanoCreate"];
|
||||||
plr->level++;
|
plr->level++;
|
||||||
|
|
||||||
@ -604,7 +595,6 @@ void Missions::mobKilled(CNSocket *sock, int mobid, int rolledQItem) {
|
|||||||
if (task["m_iCSUItemNumNeeded"][j] != 0 && !isQuestItemFull(sock, task["m_iCSUItemID"][j], task["m_iCSUItemNumNeeded"][j]) ) {
|
if (task["m_iCSUItemNumNeeded"][j] != 0 && !isQuestItemFull(sock, task["m_iCSUItemID"][j], task["m_iCSUItemNumNeeded"][j]) ) {
|
||||||
bool drop = rolledQItem % 100 < task["m_iSTItemDropRate"][j];
|
bool drop = rolledQItem % 100 < task["m_iSTItemDropRate"][j];
|
||||||
if (drop) {
|
if (drop) {
|
||||||
// XXX: are CSUItemID and CSTItemID the same?
|
|
||||||
dropQuestItem(sock, plr->tasks[i], 1, task["m_iCSUItemID"][j], mobid);
|
dropQuestItem(sock, plr->tasks[i], 1, task["m_iCSUItemID"][j], mobid);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user