Added silent unsummoning

- summonNano now supports an optional "silent" argument
- gumballs now last 10 minutes.
- fixed comments
This commit is contained in:
Jade 2020-11-29 18:06:11 +00:00 committed by Gent S
parent 5771cd014a
commit 58952be47e
3 changed files with 11 additions and 8 deletions

View File

@ -559,7 +559,7 @@ void MobManager::combatStep(Mob *mob, time_t currTime) {
int mobRange = (int)mob->data["m_iAtkRange"] + (int)mob->data["m_iRadius"]; int mobRange = (int)mob->data["m_iAtkRange"] + (int)mob->data["m_iRadius"];
if (currTime >= mob->nextAttack) { 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); useAbilities(mob, currTime);
if (mob->target == nullptr) if (mob->target == nullptr)
return; return;
@ -913,7 +913,7 @@ void MobManager::dealGooDamage(CNSocket *sock, int amount) {
if (plr->Nanos[plr->activeNano].iStamina <= 0) { if (plr->Nanos[plr->activeNano].iStamina <= 0) {
dmg->bNanoDeactive = 1; dmg->bNanoDeactive = 1;
plr->Nanos[plr->activeNano].iStamina = 0; 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; plr->Nanos[plr->activeNano].iStamina -= 1 + plr->nanoDrainRate / 5;
if (plr->Nanos[plr->activeNano].iStamina <= 0) if (plr->Nanos[plr->activeNano].iStamina <= 0)
NanoManager::summonNano(sock, -1); // unsummon nano NanoManager::summonNano(sock, -1, true); // unsummon nano silently
transmit = true; transmit = true;
} else if (plr->Nanos[plr->equippedNanos[i]].iStamina < 150) { // regain stamina } else if (plr->Nanos[plr->equippedNanos[i]].iStamina < 150) { // regain stamina
@ -1634,9 +1634,11 @@ void MobManager::dealCorruption(Mob *mob, std::vector<int> targetData, int skill
respdata[i].iHitFlag = 16; // lose respdata[i].iHitFlag = 16; // lose
respdata[i].iDamage = NanoManager::SkillTable[skillID].powerIntensity[0] * PC_MAXHEALTH((int)mob->data["m_iNpcLevel"]) / 1500; 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; 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].iNanoStamina = plr->Nanos[plr->activeNano].iStamina = 0;
} }
}
respdata[i].iHP = plr->HP-= respdata[i].iDamage; respdata[i].iHP = plr->HP-= respdata[i].iDamage;
respdata[i].iConditionBitFlag = plr->iConditionBitFlag; respdata[i].iConditionBitFlag = plr->iConditionBitFlag;

View File

@ -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)); 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); INITSTRUCT(sP_FE2CL_REP_NANO_ACTIVE_SUCC, resp);
resp.iActiveNanoSlotNum = slot; resp.iActiveNanoSlotNum = slot;
Player *plr = PlayerManager::getPlayer(sock); Player *plr = PlayerManager::getPlayer(sock);
@ -338,9 +338,10 @@ void NanoManager::summonNano(CNSocket *sock, int slot) {
} }
} }
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)); 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); INITSTRUCT(sP_FE2CL_NANO_ACTIVE, pkt1);
pkt1.iPC_ID = plr->iID; pkt1.iPC_ID = plr->iID;
pkt1.Nano = plr->Nanos[nanoID]; pkt1.Nano = plr->Nanos[nanoID];

View File

@ -62,7 +62,7 @@ namespace NanoManager {
// Helper methods // Helper methods
void addNano(CNSocket* sock, int16_t nanoID, int16_t slot, bool spendfm=false); 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 setNanoSkill(CNSocket* sock, sP_CL2FE_REQ_NANO_TUNE* skill);
void resetNanoSkill(CNSocket* sock, int16_t nanoID); void resetNanoSkill(CNSocket* sock, int16_t nanoID);
void nanoUnbuff(CNSocket* sock, std::vector<int> targetData, int32_t bitFlag, int16_t timeBuffID, int16_t amount, bool groupPower); void nanoUnbuff(CNSocket* sock, std::vector<int> targetData, int32_t bitFlag, int16_t timeBuffID, int16_t amount, bool groupPower);