updateFusionMatter now sets fusion matter

This commit is contained in:
CPunch 2020-09-23 16:04:58 -05:00
parent 4caca07856
commit c33f218e56
3 changed files with 7 additions and 7 deletions

View File

@ -302,7 +302,7 @@ int MissionManager::giveMissionReward(CNSocket *sock, int task) {
// update player // update player
plr->money += reward->money; plr->money += reward->money;
plr->fusionmatter += reward->fusionmatter; MissionManager::updateFusionMatter(sock, reward->fusionmatter);
// simple rewards // simple rewards
resp->m_iCandy = plr->money; resp->m_iCandy = plr->money;
@ -323,15 +323,15 @@ int MissionManager::giveMissionReward(CNSocket *sock, int task) {
sock->sendPacket((void*)respbuf, P_FE2CL_REP_REWARD_ITEM, resplen); sock->sendPacket((void*)respbuf, P_FE2CL_REP_REWARD_ITEM, resplen);
MissionManager::updateFusionMatter(sock);
return 0; return 0;
} }
void MissionManager::updateFusionMatter(CNSocket* sock) { void MissionManager::updateFusionMatter(CNSocket* sock, int fusion) {
Player *plr = PlayerManager::getPlayer(sock); Player *plr = PlayerManager::getPlayer(sock);
plr->fusionmatter += fusion;
// check if it is over the limit // check if it is over the limit
std::cout << plr->fusionmatter << " > " << AvatarGrowth[plr->level]["m_iReqBlob_NanoCreate"] << std::endl;
if (plr->fusionmatter > AvatarGrowth[plr->level]["m_iReqBlob_NanoCreate"]) { if (plr->fusionmatter > AvatarGrowth[plr->level]["m_iReqBlob_NanoCreate"]) {
// check if the nano task is already started // check if the nano task is already started
@ -347,6 +347,7 @@ void MissionManager::updateFusionMatter(CNSocket* sock) {
INITSTRUCT(sP_FE2CL_REP_PC_TASK_START_SUCC, response); INITSTRUCT(sP_FE2CL_REP_PC_TASK_START_SUCC, response);
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));
return;
} }
} }

View File

@ -51,7 +51,7 @@ namespace MissionManager {
//checks if player doesn't have n/n quest items //checks if player doesn't have n/n quest items
bool isQuestItemFull(CNSocket* sock, int itemId, int itemCount); bool isQuestItemFull(CNSocket* sock, int itemId, int itemCount);
int giveMissionReward(CNSocket *sock, int task); int giveMissionReward(CNSocket *sock, int task);
void updateFusionMatter(CNSocket* sock); void updateFusionMatter(CNSocket* sock, int fusion);
void mobKilled(CNSocket *sock, int mobid); void mobKilled(CNSocket *sock, int mobid);

View File

@ -105,7 +105,7 @@ void MobManager::giveReward(CNSocket *sock) {
// update player // update player
plr->money += 50; plr->money += 50;
plr->fusionmatter += 70; MissionManager::updateFusionMatter(sock, 70);
// simple rewards // simple rewards
reward->m_iCandy = plr->money; reward->m_iCandy = plr->money;
@ -132,7 +132,6 @@ void MobManager::giveReward(CNSocket *sock) {
sock->sendPacket((void*)respbuf, P_FE2CL_REP_REWARD_ITEM, resplen); sock->sendPacket((void*)respbuf, P_FE2CL_REP_REWARD_ITEM, resplen);
} }
MissionManager::updateFusionMatter(sock);
} }
void MobManager::killMob(CNSocket *sock, Mob *mob) { void MobManager::killMob(CNSocket *sock, Mob *mob) {