Added nano summon feature

This commit is contained in:
Onii-chan 2020-08-20 11:51:02 +02:00
parent bb1ce5c28d
commit 795107a274
4 changed files with 35 additions and 0 deletions

View File

@ -10,6 +10,7 @@ enum SHARDPACKETID {
P_CL2FE_REQ_PC_ENTER = 318767105, P_CL2FE_REQ_PC_ENTER = 318767105,
P_CL2FE_REQ_PC_LOADING_COMPLETE = 318767245, P_CL2FE_REQ_PC_LOADING_COMPLETE = 318767245,
P_CL2FE_REP_LIVE_CHECK = 318767221, P_CL2FE_REP_LIVE_CHECK = 318767221,
P_CL2FE_REQ_NANO_ACTIVE = 318767119,
P_CL2FE_REQ_PC_MOVE = 318767107, P_CL2FE_REQ_PC_MOVE = 318767107,
P_CL2FE_REQ_PC_STOP = 318767108, P_CL2FE_REQ_PC_STOP = 318767108,
P_CL2FE_REQ_PC_JUMP = 318767109, P_CL2FE_REQ_PC_JUMP = 318767109,
@ -21,6 +22,7 @@ enum SHARDPACKETID {
P_CL2FE_REQ_PC_EXIT = 318767106, P_CL2FE_REQ_PC_EXIT = 318767106,
// shard 2 client // shard 2 client
P_FE2CL_REP_NANO_ACTIVE_SUCC = 822083624,
P_FE2CL_REP_PC_ENTER_SUCC = 822083586, P_FE2CL_REP_PC_ENTER_SUCC = 822083586,
P_FE2CL_REP_PC_LOADING_COMPLETE_SUCC = 822083833, P_FE2CL_REP_PC_LOADING_COMPLETE_SUCC = 822083833,
P_FE2CL_REQ_LIVE_CHECK = 822083792, P_FE2CL_REQ_LIVE_CHECK = 822083792,

20
src/NanoManager.cpp Normal file
View File

@ -0,0 +1,20 @@
#include "CNShardServer.hpp"
#include "CNStructs.hpp"
#include "NanoManager.hpp"
#include "PlayerManager.hpp"
void NanoManager::init() {
REGISTER_SHARD_PACKET(P_CL2FE_REQ_NANO_ACTIVE, nanoSummonHandler);
}
void NanoManager::nanoSummonHandler(CNSocket* sock, CNPacketData* data) {
sP_CL2FE_REQ_NANO_ACTIVE* nano = (sP_CL2FE_REQ_NANO_ACTIVE*)data->buf;
PlayerView plr = PlayerManager::players[sock];
// Send to client
sP_FE2CL_REP_NANO_ACTIVE_SUCC* resp = (sP_FE2CL_REP_NANO_ACTIVE_SUCC*)xmalloc(sizeof(sP_FE2CL_REP_NANO_ACTIVE_SUCC));
resp->iActiveNanoSlotNum = nano->iNanoSlotNum;
sock->sendPacket(new CNPacketData((void*)resp, P_FE2CL_REP_NANO_ACTIVE_SUCC, sizeof(sP_FE2CL_REP_NANO_ACTIVE_SUCC), sock->getFEKey()));
std::cout << U16toU8(plr.plr.PCStyle.szFirstName) << U16toU8(plr.plr.PCStyle.szLastName) << " requested to summon nano slot: " << nano->iNanoSlotNum << std::endl;
}

11
src/NanoManager.hpp Normal file
View File

@ -0,0 +1,11 @@
#ifndef _NM_HPP
#define _NM_HPP
#include "CNShardServer.hpp"
namespace NanoManager {
void init();
void nanoSummonHandler(CNSocket* sock, CNPacketData* data);
}
#endif

View File

@ -2,6 +2,7 @@
#include "CNShardServer.hpp" #include "CNShardServer.hpp"
#include "PlayerManager.hpp" #include "PlayerManager.hpp"
#include "ChatManager.hpp" #include "ChatManager.hpp"
#include "NanoManager.hpp"
#include "settings.hpp" #include "settings.hpp"
@ -28,6 +29,7 @@ int main() {
std::cout << "[INFO] Intializing Packet Managers..." << std::endl; std::cout << "[INFO] Intializing Packet Managers..." << std::endl;
PlayerManager::init(); PlayerManager::init();
ChatManager::init(); ChatManager::init();
NanoManager::init();
std::cout << "[INFO] Starting Server Threads..." << std::endl; std::cout << "[INFO] Starting Server Threads..." << std::endl;
CNLoginServer loginServer(settings::LOGINPORT); CNLoginServer loginServer(settings::LOGINPORT);