mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-05 18:24:12 +00:00
chore: continue work on removing raw packet reading (#1404)
* chore: continue work on removing raw packet reading tested that logging in, deleted a char, renaming a char, and transfeering to a zone all work still * Address Feedback
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
#include "CDClientManager.h"
|
||||
#include "Game.h"
|
||||
#include "Logger.h"
|
||||
#include "PacketUtils.h"
|
||||
#include <functional>
|
||||
#include "CDDestructibleComponentTable.h"
|
||||
#include "CDClientDatabase.h"
|
||||
|
@@ -11,7 +11,6 @@
|
||||
#include "SkillComponent.h"
|
||||
#include "SwitchComponent.h"
|
||||
#include "UserManager.h"
|
||||
#include "PacketUtils.h"
|
||||
#include "Metrics.hpp"
|
||||
#include "dZoneManager.h"
|
||||
#include "MissionComponent.h"
|
||||
@@ -389,8 +388,6 @@ void EntityManager::ConstructEntity(Entity* entity, const SystemAddress& sysAddr
|
||||
Game::server->Send(&stream, sysAddr, false);
|
||||
}
|
||||
|
||||
// PacketUtils::SavePacket("[24]_"+std::to_string(entity->GetObjectID()) + "_" + std::to_string(m_SerializationCounter) + ".bin", (char*)stream.GetData(), stream.GetNumberOfBytesUsed());
|
||||
|
||||
if (entity->IsPlayer()) {
|
||||
if (entity->GetGMLevel() > eGameMasterLevel::CIVILIAN) {
|
||||
GameMessages::SendToggleGMInvis(entity->GetObjectID(), true, sysAddr);
|
||||
@@ -434,8 +431,6 @@ void EntityManager::SerializeEntity(Entity* entity) {
|
||||
if (std::find(m_EntitiesToSerialize.begin(), m_EntitiesToSerialize.end(), entity->GetObjectID()) == m_EntitiesToSerialize.end()) {
|
||||
m_EntitiesToSerialize.push_back(entity->GetObjectID());
|
||||
}
|
||||
|
||||
//PacketUtils::SavePacket(std::to_string(m_SerializationCounter) + "_[27]_"+std::to_string(entity->GetObjectID()) + ".bin", (char*)stream.GetData(), stream.GetNumberOfBytesUsed());
|
||||
}
|
||||
|
||||
void EntityManager::DestructAllEntities(const SystemAddress& sysAddr) {
|
||||
|
@@ -11,7 +11,6 @@
|
||||
#include "WorldPackets.h"
|
||||
#include "Character.h"
|
||||
#include "BitStream.h"
|
||||
#include "PacketUtils.h"
|
||||
#include "ObjectIDManager.h"
|
||||
#include "Logger.h"
|
||||
#include "GeneralUtils.h"
|
||||
@@ -267,25 +266,41 @@ void UserManager::RequestCharacterList(const SystemAddress& sysAddr) {
|
||||
void UserManager::CreateCharacter(const SystemAddress& sysAddr, Packet* packet) {
|
||||
User* u = GetUser(sysAddr);
|
||||
if (!u) return;
|
||||
|
||||
LUWString LUWStringName(33);
|
||||
uint32_t firstNameIndex;
|
||||
uint32_t middleNameIndex;
|
||||
uint32_t lastNameIndex;
|
||||
uint32_t shirtColor;
|
||||
uint32_t shirtStyle;
|
||||
uint32_t pantsColor;
|
||||
uint32_t hairStyle;
|
||||
uint32_t hairColor;
|
||||
uint32_t lh;
|
||||
uint32_t rh;
|
||||
uint32_t eyebrows;
|
||||
uint32_t eyes;
|
||||
uint32_t mouth;
|
||||
|
||||
std::string name = PacketUtils::ReadString(8, packet, true);
|
||||
CINSTREAM_SKIP_HEADER;
|
||||
inStream.Read(LUWStringName);
|
||||
inStream.Read(firstNameIndex);
|
||||
inStream.Read(middleNameIndex);
|
||||
inStream.Read(lastNameIndex);
|
||||
inStream.IgnoreBytes(9);
|
||||
inStream.Read(shirtColor);
|
||||
inStream.Read(shirtStyle);
|
||||
inStream.Read(pantsColor);
|
||||
inStream.Read(hairStyle);
|
||||
inStream.Read(hairColor);
|
||||
inStream.Read(lh);
|
||||
inStream.Read(rh);
|
||||
inStream.Read(eyebrows);
|
||||
inStream.Read(eyes);
|
||||
inStream.Read(mouth);
|
||||
|
||||
uint32_t firstNameIndex = PacketUtils::ReadU32(74, packet);
|
||||
uint32_t middleNameIndex = PacketUtils::ReadU32(78, packet);
|
||||
uint32_t lastNameIndex = PacketUtils::ReadU32(82, packet);
|
||||
const auto name = LUWStringName.GetAsString();
|
||||
std::string predefinedName = GetPredefinedName(firstNameIndex, middleNameIndex, lastNameIndex);
|
||||
|
||||
uint32_t shirtColor = PacketUtils::ReadU32(95, packet);
|
||||
uint32_t shirtStyle = PacketUtils::ReadU32(99, packet);
|
||||
uint32_t pantsColor = PacketUtils::ReadU32(103, packet);
|
||||
uint32_t hairStyle = PacketUtils::ReadU32(107, packet);
|
||||
uint32_t hairColor = PacketUtils::ReadU32(111, packet);
|
||||
uint32_t lh = PacketUtils::ReadU32(115, packet);
|
||||
uint32_t rh = PacketUtils::ReadU32(119, packet);
|
||||
uint32_t eyebrows = PacketUtils::ReadU32(123, packet);
|
||||
uint32_t eyes = PacketUtils::ReadU32(127, packet);
|
||||
uint32_t mouth = PacketUtils::ReadU32(131, packet);
|
||||
|
||||
LOT shirtLOT = FindCharShirtID(shirtColor, shirtStyle);
|
||||
LOT pantsLOT = FindCharPantsID(pantsColor);
|
||||
|
||||
@@ -377,7 +392,9 @@ void UserManager::DeleteCharacter(const SystemAddress& sysAddr, Packet* packet)
|
||||
return;
|
||||
}
|
||||
|
||||
LWOOBJID objectID = PacketUtils::ReadS64(8, packet);
|
||||
CINSTREAM_SKIP_HEADER;
|
||||
LWOOBJID objectID;
|
||||
inStream.Read(objectID);
|
||||
uint32_t charID = static_cast<uint32_t>(objectID);
|
||||
|
||||
LOG("Received char delete req for ID: %llu (%u)", objectID, charID);
|
||||
@@ -411,14 +428,18 @@ void UserManager::RenameCharacter(const SystemAddress& sysAddr, Packet* packet)
|
||||
return;
|
||||
}
|
||||
|
||||
LWOOBJID objectID = PacketUtils::ReadS64(8, packet);
|
||||
CINSTREAM_SKIP_HEADER;
|
||||
LWOOBJID objectID;
|
||||
inStream.Read(objectID);
|
||||
GeneralUtils::ClearBit(objectID, eObjectBits::CHARACTER);
|
||||
GeneralUtils::ClearBit(objectID, eObjectBits::PERSISTENT);
|
||||
|
||||
uint32_t charID = static_cast<uint32_t>(objectID);
|
||||
LOG("Received char rename request for ID: %llu (%u)", objectID, charID);
|
||||
|
||||
std::string newName = PacketUtils::ReadString(16, packet, true);
|
||||
LUWString LUWStringName(33);
|
||||
inStream.Read(LUWStringName);
|
||||
const auto newName = LUWStringName.GetAsString();
|
||||
|
||||
Character* character = nullptr;
|
||||
|
||||
|
@@ -14,7 +14,6 @@
|
||||
#include "eGameActivity.h"
|
||||
|
||||
#include "dServer.h"
|
||||
#include "PacketUtils.h"
|
||||
#include "Spawner.h"
|
||||
#include "MovingPlatformComponent.h"
|
||||
#include "Preconditions.h"
|
||||
|
@@ -5,7 +5,6 @@
|
||||
#include <iomanip>
|
||||
|
||||
#include "Entity.h"
|
||||
#include "PacketUtils.h"
|
||||
|
||||
#include "CDClientManager.h"
|
||||
#include "GameMessages.h"
|
||||
|
@@ -1,7 +1,6 @@
|
||||
#include "GameMessages.h"
|
||||
#include "User.h"
|
||||
#include "Entity.h"
|
||||
#include "PacketUtils.h"
|
||||
#include "BitStreamUtils.h"
|
||||
#include "BitStream.h"
|
||||
#include "Game.h"
|
||||
@@ -1726,8 +1725,6 @@ void GameMessages::SendStartCelebrationEffect(Entity* entity, const SystemAddres
|
||||
bitStream.Write<uint32_t>(0); //subtext
|
||||
|
||||
SEND_PACKET;
|
||||
|
||||
//PacketUtils::SavePacket("StartCelebrationEffect.bin", (char*)bitStream.GetData(), bitStream.GetNumberOfBytesUsed());
|
||||
}
|
||||
|
||||
|
||||
@@ -1950,7 +1947,6 @@ void GameMessages::SendBBBSaveResponse(const LWOOBJID& objectId, const LWOOBJID&
|
||||
bitStream.Write(buffer[i]);
|
||||
|
||||
SEND_PACKET;
|
||||
//PacketUtils::SavePacket("eGameMessageType::BBB_SAVE_RESPONSE.bin", reinterpret_cast<char*>(bitStream.GetData()), bitStream.GetNumberOfBytesUsed());
|
||||
}
|
||||
|
||||
// Property
|
||||
|
@@ -12,7 +12,6 @@
|
||||
#include "dServer.h"
|
||||
#include "Entity.h"
|
||||
#include "Character.h"
|
||||
#include "PacketUtils.h"
|
||||
#include "BitStreamUtils.h"
|
||||
#include "Logger.h"
|
||||
#include "EntityManager.h"
|
||||
@@ -305,7 +304,6 @@ void Mail::HandleDataRequest(RakNet::BitStream* packet, const SystemAddress& sys
|
||||
}
|
||||
|
||||
Game::server->Send(&bitStream, sysAddr, false);
|
||||
// PacketUtils::SavePacket("Max_Mail_Data.bin", (const char*)bitStream.GetData(), bitStream.GetNumberOfBytesUsed());
|
||||
}
|
||||
|
||||
void Mail::HandleAttachmentCollect(RakNet::BitStream* packet, const SystemAddress& sysAddr, Entity* player) {
|
||||
|
Reference in New Issue
Block a user