merged master

This commit is contained in:
CPunch 2020-08-20 10:43:37 -05:00
parent 42597c2a7a
commit d6e1f57c23
8 changed files with 3283 additions and 2 deletions

View File

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

View File

@ -18,7 +18,13 @@ int U8toU16(std::string src, char16_t* des) {
}
uint64_t getTime() {
#ifndef _MSC_VER
struct timeval tp;
gettimeofday(&tp, NULL);
return tp.tv_sec * 1000 + tp.tv_usec / 1000;
#else
time_t t;
time(&t);
return (uint64_t)t;
#endif
}

View File

@ -10,7 +10,12 @@
#include <iostream>
#include <stdio.h>
#include <stdint.h>
// Can't use this in MSVC.
#ifndef _MSC_VER
#include <sys/time.h>
#else
#include <time.h>
#endif
#include <cstring>
#include <string>
#include <locale>

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

View File

@ -15,7 +15,7 @@ int settings::SPAWN_X = 179213;
int settings::SPAWN_Y = 268451;
int settings::SPAWN_Z = -4210;
std::string settings::MOTDSTRING;
std::string settings::MOTDSTRING = "Welcome to OpenFusion!";
void settings::init() {
INIReader reader("config.ini");

File diff suppressed because it is too large Load Diff