From f584dd140bd666b460999bc2e359e508585450eb Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Thu, 23 Oct 2014 23:50:49 +1100 Subject: [PATCH] Began work on expanding the network protocols --- .../network/packet_types/character_packet.hpp | 1 + common/network/serial_packet.hpp | 2 +- common/network/serial_packet_type.hpp | 39 ++++++++++++------- rsc/scripts/setup_server.sql | 2 + server/accounts/account_data.hpp | 1 + 5 files changed, 30 insertions(+), 15 deletions(-) diff --git a/common/network/packet_types/character_packet.hpp b/common/network/packet_types/character_packet.hpp index 5d94c16..e743589 100644 --- a/common/network/packet_types/character_packet.hpp +++ b/common/network/packet_types/character_packet.hpp @@ -35,6 +35,7 @@ struct CharacterPacket : SerialPacketBase { //the owner int accountIndex; + //TODO: Authentication token? //location int roomIndex; diff --git a/common/network/serial_packet.hpp b/common/network/serial_packet.hpp index 7dd6c81..5d9d008 100644 --- a/common/network/serial_packet.hpp +++ b/common/network/serial_packet.hpp @@ -33,7 +33,7 @@ typedef SerialPacketBase SerialPacket; //DOCS: NETWORK_VERSION is used to discern compatible servers and clients -constexpr int NETWORK_VERSION = 20140909; +constexpr int NETWORK_VERSION = -1; union MaxPacket { CharacterPacket a; diff --git a/common/network/serial_packet_type.hpp b/common/network/serial_packet_type.hpp index 1c517a8..b93b51f 100644 --- a/common/network/serial_packet_type.hpp +++ b/common/network/serial_packet_type.hpp @@ -46,21 +46,19 @@ enum class SerialPacketType { //------------------------- //ClientPacket - // client index, account index, character index + // client index, account index, username //------------------------- //Connecting to a server as a client JOIN_REQUEST, JOIN_RESPONSE, - //client requests all information from the server - SYNCHRONIZE, - //disconnect from the server - DISCONNECT, + DISCONNECT_REQUEST, + DISCONNECT_FORCED, //shut down the server - SHUTDOWN, + SHUTDOWN_REQUEST, //------------------------- //RegionPacket @@ -73,20 +71,33 @@ enum class SerialPacketType { //------------------------- //CharacterPacket - // handle, avatar, character index, account index, - // room index, origin, motion + // character index, + // handle, avatar, + // account index (owner), + // room index, origin, motion, // statistics //------------------------- - //controlling characters - CHARACTER_NEW, - CHARACTER_DELETE, - CHARACTER_UPDATE, - - //authentication, character index => character stats + //all stats CHARACTER_STATS_REQUEST, CHARACTER_STATS_RESPONSE, + //character management + //NOTE: The server sends create & delete messages to the clients, but the clients... don't? + CHARACTER_CREATE + CHARACTER_DELETE + CHARACTER_LOAD + CHARACTER_UNLOAD + + //find out info from the server + CHARACTER_QUERY_EXISTS + CHARACTER_QUERY_LOCATION + + //set the info in the server + CHARACTER_SET_ROOM + CHARACTER_SET_ORIGIN + CHARACTER_SET_MOTION + //------------------------- //TextPacket // name, text diff --git a/rsc/scripts/setup_server.sql b/rsc/scripts/setup_server.sql index 80da6fe..e7e9c63 100644 --- a/rsc/scripts/setup_server.sql +++ b/rsc/scripts/setup_server.sql @@ -1,3 +1,5 @@ +--TODO: An archive table of all dead characters + CREATE TABLE IF NOT EXISTS Accounts ( uid INTEGER PRIMARY KEY AUTOINCREMENT, username varchar(100) UNIQUE, diff --git a/server/accounts/account_data.hpp b/server/accounts/account_data.hpp index d7fb022..6242add 100644 --- a/server/accounts/account_data.hpp +++ b/server/accounts/account_data.hpp @@ -49,6 +49,7 @@ private: std::string username; //TODO: password + //bit fields? bool blackListed = false; bool whiteListed = true; bool mod = false;