From 29cde56fb16b30cf85bebffa862aca4a2580c754 Mon Sep 17 00:00:00 2001 From: JadeShrineMaiden Date: Thu, 10 Sep 2020 17:51:52 +0100 Subject: [PATCH] Levelling up added to /nano - Using /nano levels up Player, a player cannot level down. --- src/NanoManager.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/NanoManager.cpp b/src/NanoManager.cpp index 8d2cdfa..cd7b5a6 100644 --- a/src/NanoManager.cpp +++ b/src/NanoManager.cpp @@ -141,6 +141,21 @@ void NanoManager::addNano(CNSocket* sock, int16_t nanoId, int16_t slot) { // Update player plr->Nanos[nanoId] = resp.Nano; + + // After a nano gets added, setting the level seems to be important so we are doing that + if (nanoId < plr->level) + nanoId = plr->level; + // Even if player level is unchanged, this packet still needs to be sent as using /nano always sets the player to 0 + INITSTRUCT(sP_FE2CL_REP_PC_CHANGE_LEVEL, resp2); + + resp2.iPC_ID = plr->iID; + resp2.iPC_Level = nanoId; + + sock->sendPacket((void*)&resp2, P_FE2CL_REP_PC_CHANGE_LEVEL, sizeof(sP_FE2CL_REP_PC_CHANGE_LEVEL)); + for (CNSocket* s : PlayerManager::players[sock].viewable) + s->sendPacket((void*)&resp2, P_FE2CL_REP_PC_CHANGE_LEVEL, sizeof(sP_FE2CL_REP_PC_CHANGE_LEVEL)); + + plr->level = nanoId; } void NanoManager::summonNano(CNSocket *sock, int slot) {