Finished these server tweaks

This commit is contained in:
Kayne Ruse
2015-02-13 23:34:34 +11:00
parent 9710acad6f
commit e71d0b3a09
11 changed files with 103 additions and 21 deletions
+2
View File
@@ -107,6 +107,8 @@ private:
//chat
void hTextBroadcast(TextPacket* const);
void hTextSpeech(TextPacket* const);
void hTextWhisper(TextPacket* const);
//utility methods
void PumpPacket(SerialPacket* const);
+10 -6
View File
@@ -28,7 +28,7 @@
//Character Management
//-------------------------
void ServerApplication::HandleCharacterCreate(CharacterPacket* const argPacket) {
void ServerApplication::hCharacterCreate(CharacterPacket* const argPacket) {
int characterIndex = characterMgr.Create(argPacket->accountIndex, argPacket->handle, argPacket->avatar);
if (characterIndex < 0) {
@@ -55,7 +55,7 @@ void ServerApplication::HandleCharacterCreate(CharacterPacket* const argPacket)
PumpPacket(&newPacket);
}
void ServerApplication::HandleCharacterDelete(CharacterPacket* const argPacket) {
void ServerApplication::hCharacterDelete(CharacterPacket* const argPacket) {
//get the user's data
AccountData* accountData = accountMgr.Get(argPacket->accountIndex);
if (!accountData) {
@@ -102,7 +102,7 @@ void ServerApplication::HandleCharacterDelete(CharacterPacket* const argPacket)
PumpPacket(static_cast<SerialPacket*>(&newPacket));
}
void ServerApplication::HandleCharacterLoad(CharacterPacket* const argPacket) {
void ServerApplication::hCharacterLoad(CharacterPacket* const argPacket) {
int characterIndex = characterMgr.Load(argPacket->accountIndex, argPacket->handle, argPacket->avatar);
if (characterIndex < 0) {
@@ -135,7 +135,7 @@ void ServerApplication::HandleCharacterLoad(CharacterPacket* const argPacket) {
PumpPacket(&newPacket);
}
void ServerApplication::HandleCharacterUnload(CharacterPacket* const argPacket) {
void ServerApplication::hCharacterUnload(CharacterPacket* const argPacket) {
//get the entries
CharacterData* characterData = characterMgr.Get(argPacket->characterIndex);
if (!characterData) {
@@ -177,7 +177,7 @@ void ServerApplication::HandleCharacterUnload(CharacterPacket* const argPacket)
//TODO: (9) Could replace this verbosity with a "verify" method, taking a client, account and character ptr as arguments
void ServerApplication::HandleCharacterMovement(CharacterPacket* const argPacket) {
void ServerApplication::hCharacterMovement(CharacterPacket* const argPacket) {
//get the specified objects
AccountData* accountData = accountMgr.Get(argPacket->accountIndex);
CharacterData* characterData = characterMgr.Get(argPacket->characterIndex);
@@ -234,6 +234,10 @@ void ServerApplication::HandleCharacterMovement(CharacterPacket* const argPacket
}
}
void ServerApplication::HandleCharacterAttack(CharacterPacket* const) {
void ServerApplication::hCharacterAttack(CharacterPacket* const argPacket) {
//TODO: (9) bounce graphical attack data
}
void ServerApplication::hCharacterDamage(CharacterPacket* const argPacket) {
//TODO: (9) empty
}
+34
View File
@@ -0,0 +1,34 @@
/* Copyright: (c) Kayne Ruse 2013-2015
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
#include "server_application.hpp"
void ServerApplication::hTextBroadcast(TextPacket* const argPacket) {
//TODO: (9) empty
}
void ServerApplication::hTextSpeech(TextPacket* const argPacket) {
//TODO: (9) empty
}
void ServerApplication::hTextWhisper(TextPacket* const argPacket) {
//TODO: (9) empty
}
@@ -25,20 +25,10 @@
#include <sstream>
//-------------------------
//General data management
//Queries
//-------------------------
//NOTE: Queries go here
void ServerApplication::SaveServerState() {
//SaveServerState
}
//-------------------------
//Map management
//-------------------------
void ServerApplication::HandleRegionRequest(RegionPacket* const argPacket) {
void ServerApplication::hRegionRequest(RegionPacket* const argPacket) {
//get the region object, send a rejection on error
RoomData* room = roomMgr.Get(argPacket->roomIndex);
if (!room) {
@@ -71,7 +61,7 @@ void ServerApplication::HandleRegionRequest(RegionPacket* const argPacket) {
network.SendTo(argPacket->srcAddress, static_cast<SerialPacket*>(&newPacket));
}
void ServerApplication::HandleCharacterExists(CharacterPacket* const argPacket) {
void ServerApplication::hQueryCharacterExists(CharacterPacket* const argPacket) {
//respond with all character data
CharacterPacket newPacket;
@@ -84,3 +74,23 @@ void ServerApplication::HandleCharacterExists(CharacterPacket* const argPacket)
network.SendTo(argPacket->srcAddress, static_cast<SerialPacket*>(&newPacket));
}
}
void ServerApplication::hQueryCharacterStats(CharacterPacket* const argPacket) {
//TODO: (9) empty
}
void ServerApplication::hQueryCharacterLocation(CharacterPacket* const argPacket) {
//TODO: (9) empty
}
void ServerApplication::hQueryMonsterExists(MonsterPacket* const argPacket) {
//TODO: (9) empty
}
void ServerApplication::hQueryMonsterStats(MonsterPacket* const argPacket) {
//TODO: (9) empty
}
void ServerApplication::hQueryMonsterLocation(MonsterPacket* const argPacket) {
//TODO: (9) empty
}
+6
View File
@@ -311,6 +311,12 @@ void ServerApplication::HandlePacket(SerialPacket* const argPacket) {
case SerialPacketType::TEXT_BROADCAST:
hTextBroadcast(static_cast<TextPacket*>(argPacket));
break;
case SerialPacketType::TEXT_SPEECH:
hTextSpeech(static_cast<TextPacket*>(argPacket));
break;
case SerialPacketType::TEXT_WHISPER:
hTextWhisper(static_cast<TextPacket*>(argPacket));
break;
//handle errors
default: {
+2 -2
View File
@@ -33,7 +33,7 @@ void ServerApplication::hAdminDisconnectForced(ClientPacket* const argPacket) {
//TODO: (9) boot players
}
void ServerApplication::HandleShutdownRequest(ClientPacket* const argPacket) {
void ServerApplication::hAdminShutdownRequest(ClientPacket* const argPacket) {
//get the account and client data
AccountData* accountData = accountMgr.Get(argPacket->accountIndex);
if (!accountData) {
@@ -76,7 +76,7 @@ void ServerApplication::HandleShutdownRequest(ClientPacket* const argPacket) {
//disconnect all clients
TextPacket newPacket;
newPacket.type = SerialPacketType::DISCONNECT_FORCED;
newPacket.type = SerialPacketType::ADMIN_DISCONNECT_FORCED;
strncpy(newPacket.text, "Server shutdown", PACKET_STRING_SIZE);
PumpPacket(&newPacket);
+3
View File
@@ -21,3 +21,6 @@
*/
#include "server_application.hpp"
void ServerApplication::hMonsterDamage(MonsterPacket* const argPacket) {
//TODO: (9) empty
}