mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-10 17:38:08 +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:
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user