From 58952be47e92a9c832987f187b3e4d62d6c1e3c5 Mon Sep 17 00:00:00 2001 From: Jade Date: Sun, 29 Nov 2020 18:06:11 +0000 Subject: [PATCH] Added silent unsummoning - summonNano now supports an optional "silent" argument - gumballs now last 10 minutes. - fixed comments --- src/MobManager.cpp | 10 ++++++---- src/NanoManager.cpp | 7 ++++--- src/NanoManager.hpp | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/MobManager.cpp b/src/MobManager.cpp index 626f9fe..40dd7d6 100644 --- a/src/MobManager.cpp +++ b/src/MobManager.cpp @@ -559,7 +559,7 @@ void MobManager::combatStep(Mob *mob, time_t currTime) { int mobRange = (int)mob->data["m_iAtkRange"] + (int)mob->data["m_iRadius"]; if (currTime >= mob->nextAttack) { - if (mob->skillStyle != -1 || distance <= mobRange || rand() % 20 == 0) // while not in attack range, 1 / 10 chance. + if (mob->skillStyle != -1 || distance <= mobRange || rand() % 20 == 0) // while not in attack range, 1 / 20 chance. useAbilities(mob, currTime); if (mob->target == nullptr) return; @@ -913,7 +913,7 @@ void MobManager::dealGooDamage(CNSocket *sock, int amount) { if (plr->Nanos[plr->activeNano].iStamina <= 0) { dmg->bNanoDeactive = 1; plr->Nanos[plr->activeNano].iStamina = 0; - NanoManager::summonNano(PlayerManager::getSockFromID(plr->iID), -1); + NanoManager::summonNano(PlayerManager::getSockFromID(plr->iID), -1, true); } } @@ -967,7 +967,7 @@ void MobManager::playerTick(CNServer *serv, time_t currTime) { plr->Nanos[plr->activeNano].iStamina -= 1 + plr->nanoDrainRate / 5; if (plr->Nanos[plr->activeNano].iStamina <= 0) - NanoManager::summonNano(sock, -1); // unsummon nano + NanoManager::summonNano(sock, -1, true); // unsummon nano silently transmit = true; } else if (plr->Nanos[plr->equippedNanos[i]].iStamina < 150) { // regain stamina @@ -1634,8 +1634,10 @@ void MobManager::dealCorruption(Mob *mob, std::vector targetData, int skill respdata[i].iHitFlag = 16; // lose respdata[i].iDamage = NanoManager::SkillTable[skillID].powerIntensity[0] * PC_MAXHEALTH((int)mob->data["m_iNpcLevel"]) / 1500; respdata[i].iNanoStamina = plr->Nanos[plr->activeNano].iStamina -= 90; - if (plr->Nanos[plr->activeNano].iStamina < 0) + if (plr->Nanos[plr->activeNano].iStamina < 0) { + respdata[i].bNanoDeactive = 1; respdata[i].iNanoStamina = plr->Nanos[plr->activeNano].iStamina = 0; + } } respdata[i].iHP = plr->HP-= respdata[i].iDamage; diff --git a/src/NanoManager.cpp b/src/NanoManager.cpp index 84a06bf..7a4d221 100644 --- a/src/NanoManager.cpp +++ b/src/NanoManager.cpp @@ -291,7 +291,7 @@ void NanoManager::addNano(CNSocket* sock, int16_t nanoID, int16_t slot, bool spe PlayerManager::sendToViewable(sock, (void*)&resp2, P_FE2CL_REP_PC_CHANGE_LEVEL, sizeof(sP_FE2CL_REP_PC_CHANGE_LEVEL)); } -void NanoManager::summonNano(CNSocket *sock, int slot) { +void NanoManager::summonNano(CNSocket *sock, int slot, bool silent) { INITSTRUCT(sP_FE2CL_REP_NANO_ACTIVE_SUCC, resp); resp.iActiveNanoSlotNum = slot; Player *plr = PlayerManager::getPlayer(sock); @@ -338,9 +338,10 @@ void NanoManager::summonNano(CNSocket *sock, int slot) { } } - sock->sendPacket((void*)&resp, P_FE2CL_REP_NANO_ACTIVE_SUCC, sizeof(sP_FE2CL_REP_NANO_ACTIVE_SUCC)); + if (!silent) // silent nano death but only for the summoning player + sock->sendPacket((void*)&resp, P_FE2CL_REP_NANO_ACTIVE_SUCC, sizeof(sP_FE2CL_REP_NANO_ACTIVE_SUCC)); - // Send to other players + // Send to other players, these players can't handle silent nano deaths so this packet needs to be sent. INITSTRUCT(sP_FE2CL_NANO_ACTIVE, pkt1); pkt1.iPC_ID = plr->iID; pkt1.Nano = plr->Nanos[nanoID]; diff --git a/src/NanoManager.hpp b/src/NanoManager.hpp index 4623513..1e1f6e4 100644 --- a/src/NanoManager.hpp +++ b/src/NanoManager.hpp @@ -62,7 +62,7 @@ namespace NanoManager { // Helper methods void addNano(CNSocket* sock, int16_t nanoID, int16_t slot, bool spendfm=false); - void summonNano(CNSocket* sock, int slot); + void summonNano(CNSocket* sock, int slot, bool silent = false); void setNanoSkill(CNSocket* sock, sP_CL2FE_REQ_NANO_TUNE* skill); void resetNanoSkill(CNSocket* sock, int16_t nanoID); void nanoUnbuff(CNSocket* sock, std::vector targetData, int32_t bitFlag, int16_t timeBuffID, int16_t amount, bool groupPower);