mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-05-30 21:51:33 +00:00
things switched, just gotta move the handle's
This commit is contained in:
parent
47015fda08
commit
5628664060
@ -1,36 +0,0 @@
|
|||||||
#ifndef __POSITIONUPDATE__H__
|
|
||||||
#define __POSITIONUPDATE__H__
|
|
||||||
|
|
||||||
#include "NiPoint3.h"
|
|
||||||
#include "NiQuaternion.h"
|
|
||||||
|
|
||||||
|
|
||||||
struct RemoteInputInfo {
|
|
||||||
bool operator==(const RemoteInputInfo& other) {
|
|
||||||
return m_RemoteInputX == other.m_RemoteInputX && m_RemoteInputY == other.m_RemoteInputY && m_IsPowersliding == other.m_IsPowersliding && m_IsModified == other.m_IsModified;
|
|
||||||
}
|
|
||||||
|
|
||||||
float m_RemoteInputX = 0;
|
|
||||||
float m_RemoteInputY = 0;
|
|
||||||
bool m_IsPowersliding = false;
|
|
||||||
bool m_IsModified = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct LocalSpaceInfo {
|
|
||||||
LWOOBJID objectId = LWOOBJID_EMPTY;
|
|
||||||
NiPoint3 position = NiPoint3Constant::ZERO;
|
|
||||||
NiPoint3 linearVelocity = NiPoint3Constant::ZERO;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PositionUpdate {
|
|
||||||
NiPoint3 position = NiPoint3Constant::ZERO;
|
|
||||||
NiQuaternion rotation = NiQuaternionConstant::IDENTITY;
|
|
||||||
bool onGround = false;
|
|
||||||
bool onRail = false;
|
|
||||||
NiPoint3 velocity = NiPoint3Constant::ZERO;
|
|
||||||
NiPoint3 angularVelocity = NiPoint3Constant::ZERO;
|
|
||||||
LocalSpaceInfo localSpaceInfo;
|
|
||||||
RemoteInputInfo remoteInputInfo;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //!__POSITIONUPDATE__H__
|
|
@ -23,9 +23,9 @@
|
|||||||
#include "eMissionTaskType.h"
|
#include "eMissionTaskType.h"
|
||||||
#include "eTriggerEventType.h"
|
#include "eTriggerEventType.h"
|
||||||
#include "eObjectBits.h"
|
#include "eObjectBits.h"
|
||||||
#include "PositionUpdate.h"
|
|
||||||
#include "MessageType/Chat.h"
|
#include "MessageType/Chat.h"
|
||||||
#include "PlayerManager.h"
|
#include "PlayerManager.h"
|
||||||
|
#include "WorldPackets.h"
|
||||||
|
|
||||||
//Component includes:
|
//Component includes:
|
||||||
#include "Component.h"
|
#include "Component.h"
|
||||||
@ -99,7 +99,7 @@
|
|||||||
|
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
|
|
||||||
Observable<Entity*, const PositionUpdate&> Entity::OnPlayerPositionUpdate;
|
Observable<Entity*, const WorldPackets::PositionUpdate&> Entity::OnPlayerPositionUpdate;
|
||||||
|
|
||||||
Entity::Entity(const LWOOBJID& objectID, EntityInfo info, User* parentUser, Entity* parentEntity) {
|
Entity::Entity(const LWOOBJID& objectID, EntityInfo info, User* parentUser, Entity* parentEntity) {
|
||||||
m_ObjectID = objectID;
|
m_ObjectID = objectID;
|
||||||
@ -2112,7 +2112,7 @@ uint8_t Entity::GetCollectibleID() const {
|
|||||||
return collectible ? collectible->GetCollectibleId() : 0;
|
return collectible ? collectible->GetCollectibleId() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::ProcessPositionUpdate(PositionUpdate& update) {
|
void Entity::ProcessPositionUpdate(WorldPackets::PositionUpdate& update) {
|
||||||
if (!IsPlayer()) return;
|
if (!IsPlayer()) return;
|
||||||
auto* controllablePhysicsComponent = GetComponent<ControllablePhysicsComponent>();
|
auto* controllablePhysicsComponent = GetComponent<ControllablePhysicsComponent>();
|
||||||
if (!controllablePhysicsComponent) return;
|
if (!controllablePhysicsComponent) return;
|
||||||
|
@ -20,6 +20,9 @@ namespace GameMessages {
|
|||||||
struct ChildLoaded;
|
struct ChildLoaded;
|
||||||
struct PlayerResurrectionFinished;
|
struct PlayerResurrectionFinished;
|
||||||
};
|
};
|
||||||
|
namespace WorldPackets {
|
||||||
|
struct PositionUpdate;
|
||||||
|
};
|
||||||
|
|
||||||
namespace MessageType {
|
namespace MessageType {
|
||||||
enum class Game : uint16_t;
|
enum class Game : uint16_t;
|
||||||
@ -316,7 +319,7 @@ public:
|
|||||||
|
|
||||||
Entity* GetScheduledKiller() { return m_ScheduleKiller; }
|
Entity* GetScheduledKiller() { return m_ScheduleKiller; }
|
||||||
|
|
||||||
void ProcessPositionUpdate(PositionUpdate& update);
|
void ProcessPositionUpdate(WorldPackets::PositionUpdate& update);
|
||||||
|
|
||||||
// Scale will only be communicated to the client when the construction packet is sent
|
// Scale will only be communicated to the client when the construction packet is sent
|
||||||
void SetScale(const float scale) { m_Scale = scale; };
|
void SetScale(const float scale) { m_Scale = scale; };
|
||||||
@ -328,7 +331,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief The observable for player entity position updates.
|
* @brief The observable for player entity position updates.
|
||||||
*/
|
*/
|
||||||
static Observable<Entity*, const PositionUpdate&> OnPlayerPositionUpdate;
|
static Observable<Entity*, const WorldPackets::PositionUpdate&> OnPlayerPositionUpdate;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
LWOOBJID m_ObjectID;
|
LWOOBJID m_ObjectID;
|
||||||
|
@ -34,7 +34,7 @@ void HavokVehiclePhysicsComponent::SetIsOnRail(bool val) {
|
|||||||
m_IsOnRail = val;
|
m_IsOnRail = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HavokVehiclePhysicsComponent::SetRemoteInputInfo(const RemoteInputInfo& remoteInputInfo) {
|
void HavokVehiclePhysicsComponent::SetRemoteInputInfo(const WorldPackets::PositionUpdate::RemoteInputInfo& remoteInputInfo) {
|
||||||
if (remoteInputInfo == m_RemoteInputInfo) return;
|
if (remoteInputInfo == m_RemoteInputInfo) return;
|
||||||
this->m_RemoteInputInfo = remoteInputInfo;
|
this->m_RemoteInputInfo = remoteInputInfo;
|
||||||
m_DirtyPosition = true;
|
m_DirtyPosition = true;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
#include "PhysicsComponent.h"
|
#include "PhysicsComponent.h"
|
||||||
#include "eReplicaComponentType.h"
|
#include "eReplicaComponentType.h"
|
||||||
#include "PositionUpdate.h"
|
#include "WorldPackets.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Physics component for vehicles.
|
* Physics component for vehicles.
|
||||||
@ -65,7 +65,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
const bool GetIsOnRail() const { return m_IsOnRail; }
|
const bool GetIsOnRail() const { return m_IsOnRail; }
|
||||||
|
|
||||||
void SetRemoteInputInfo(const RemoteInputInfo&);
|
void SetRemoteInputInfo(const WorldPackets::PositionUpdate::RemoteInputInfo& remoteInputInfo);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NiPoint3 m_Velocity;
|
NiPoint3 m_Velocity;
|
||||||
@ -76,5 +76,5 @@ private:
|
|||||||
|
|
||||||
float m_SoftUpdate = 0;
|
float m_SoftUpdate = 0;
|
||||||
uint32_t m_EndBehavior;
|
uint32_t m_EndBehavior;
|
||||||
RemoteInputInfo m_RemoteInputInfo;
|
WorldPackets::PositionUpdate::RemoteInputInfo m_RemoteInputInfo;
|
||||||
};
|
};
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include "ClientPackets.h"
|
#include "ClientPackets.h"
|
||||||
#include "dCommonVars.h"
|
#include "dCommonVars.h"
|
||||||
#include "PositionUpdate.h"
|
|
||||||
#include "LDFFormat.h"
|
#include "LDFFormat.h"
|
||||||
#include "ZCompression.h"
|
#include "ZCompression.h"
|
||||||
|
|
||||||
@ -139,111 +138,3 @@ namespace ClientPackets {
|
|||||||
bitStream.Write<uint8_t>(supportsObjects);
|
bitStream.Write<uint8_t>(supportsObjects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatMessage ClientPackets::HandleChatMessage(Packet* packet) {
|
|
||||||
CINSTREAM_SKIP_HEADER;
|
|
||||||
|
|
||||||
ChatMessage message;
|
|
||||||
uint32_t messageLength;
|
|
||||||
|
|
||||||
inStream.Read(message.chatChannel);
|
|
||||||
inStream.Read(message.unknown);
|
|
||||||
inStream.Read(messageLength);
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < (messageLength - 1); ++i) {
|
|
||||||
uint16_t character;
|
|
||||||
inStream.Read(character);
|
|
||||||
message.message.push_back(character);
|
|
||||||
}
|
|
||||||
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
PositionUpdate ClientPackets::HandleClientPositionUpdate(Packet* packet) {
|
|
||||||
PositionUpdate update;
|
|
||||||
CINSTREAM_SKIP_HEADER;
|
|
||||||
|
|
||||||
inStream.Read(update.position.x);
|
|
||||||
inStream.Read(update.position.y);
|
|
||||||
inStream.Read(update.position.z);
|
|
||||||
|
|
||||||
inStream.Read(update.rotation.x);
|
|
||||||
inStream.Read(update.rotation.y);
|
|
||||||
inStream.Read(update.rotation.z);
|
|
||||||
inStream.Read(update.rotation.w);
|
|
||||||
|
|
||||||
inStream.Read(update.onGround);
|
|
||||||
inStream.Read(update.onRail);
|
|
||||||
|
|
||||||
bool velocityFlag = false;
|
|
||||||
inStream.Read(velocityFlag);
|
|
||||||
if (velocityFlag) {
|
|
||||||
inStream.Read(update.velocity.x);
|
|
||||||
inStream.Read(update.velocity.y);
|
|
||||||
inStream.Read(update.velocity.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool angVelocityFlag = false;
|
|
||||||
inStream.Read(angVelocityFlag);
|
|
||||||
if (angVelocityFlag) {
|
|
||||||
inStream.Read(update.angularVelocity.x);
|
|
||||||
inStream.Read(update.angularVelocity.y);
|
|
||||||
inStream.Read(update.angularVelocity.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO figure out how to use these. Ignoring for now, but reading in if they exist.
|
|
||||||
bool hasLocalSpaceInfo{};
|
|
||||||
if (inStream.Read(hasLocalSpaceInfo) && hasLocalSpaceInfo) {
|
|
||||||
inStream.Read(update.localSpaceInfo.objectId);
|
|
||||||
inStream.Read(update.localSpaceInfo.position.x);
|
|
||||||
inStream.Read(update.localSpaceInfo.position.y);
|
|
||||||
inStream.Read(update.localSpaceInfo.position.z);
|
|
||||||
bool hasLinearVelocity = false;
|
|
||||||
if (inStream.Read(hasLinearVelocity) && hasLinearVelocity) {
|
|
||||||
inStream.Read(update.localSpaceInfo.linearVelocity.x);
|
|
||||||
inStream.Read(update.localSpaceInfo.linearVelocity.y);
|
|
||||||
inStream.Read(update.localSpaceInfo.linearVelocity.z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool hasRemoteInputInfo{};
|
|
||||||
if (inStream.Read(hasRemoteInputInfo) && hasRemoteInputInfo) {
|
|
||||||
inStream.Read(update.remoteInputInfo.m_RemoteInputX);
|
|
||||||
inStream.Read(update.remoteInputInfo.m_RemoteInputY);
|
|
||||||
inStream.Read(update.remoteInputInfo.m_IsPowersliding);
|
|
||||||
inStream.Read(update.remoteInputInfo.m_IsModified);
|
|
||||||
}
|
|
||||||
|
|
||||||
return update;
|
|
||||||
}
|
|
||||||
|
|
||||||
ChatModerationRequest ClientPackets::HandleChatModerationRequest(Packet* packet) {
|
|
||||||
CINSTREAM_SKIP_HEADER;
|
|
||||||
|
|
||||||
ChatModerationRequest request;
|
|
||||||
|
|
||||||
inStream.Read(request.chatLevel);
|
|
||||||
inStream.Read(request.requestID);
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < 42; ++i) {
|
|
||||||
uint16_t character;
|
|
||||||
inStream.Read(character);
|
|
||||||
request.receiver.push_back(static_cast<uint8_t>(character));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!request.receiver.empty()) {
|
|
||||||
if (std::string(request.receiver.c_str(), 4) == "[GM]") { // Shift the string forward if we are speaking to a GM as the client appends "[GM]" if they are
|
|
||||||
request.receiver = std::string(request.receiver.c_str() + 4, request.receiver.size() - 4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t messageLength;
|
|
||||||
inStream.Read(messageLength);
|
|
||||||
for (uint32_t i = 0; i < messageLength; ++i) {
|
|
||||||
uint16_t character;
|
|
||||||
inStream.Read(character);
|
|
||||||
request.message.push_back(static_cast<uint8_t>(character));
|
|
||||||
}
|
|
||||||
|
|
||||||
return request;
|
|
||||||
}
|
|
||||||
|
@ -17,30 +17,12 @@ class PositionUpdate;
|
|||||||
|
|
||||||
struct Packet;
|
struct Packet;
|
||||||
|
|
||||||
struct ChatMessage {
|
|
||||||
uint8_t chatChannel = 0;
|
|
||||||
uint16_t unknown = 0;
|
|
||||||
std::u16string message;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ChatModerationRequest {
|
|
||||||
uint8_t chatLevel = 0;
|
|
||||||
uint8_t requestID = 0;
|
|
||||||
std::string receiver;
|
|
||||||
std::string message;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class User;
|
class User;
|
||||||
struct SystemAddress;
|
struct SystemAddress;
|
||||||
enum class eCharacterCreationResponse : uint8_t;
|
enum class eCharacterCreationResponse : uint8_t;
|
||||||
enum class eRenameResponse : uint8_t;
|
enum class eRenameResponse : uint8_t;
|
||||||
|
|
||||||
namespace ClientPackets {
|
namespace ClientPackets {
|
||||||
ChatMessage HandleChatMessage(Packet* packet);
|
|
||||||
PositionUpdate HandleClientPositionUpdate(Packet* packet);
|
|
||||||
ChatModerationRequest HandleChatModerationRequest(Packet* packet);
|
|
||||||
|
|
||||||
struct LoadStaticZone : public LUBitStream {
|
struct LoadStaticZone : public LUBitStream {
|
||||||
LWOZONEID zoneID;
|
LWOZONEID zoneID;
|
||||||
uint32_t checksum = 0;
|
uint32_t checksum = 0;
|
||||||
|
@ -30,13 +30,123 @@ namespace WorldPackets {
|
|||||||
data.Insert("Description4", Game::config->GetValue("help_4_description"));
|
data.Insert("Description4", Game::config->GetValue("help_4_description"));
|
||||||
break;
|
break;
|
||||||
case eLanguageCodeID::PL_US:
|
case eLanguageCodeID::PL_US:
|
||||||
|
[[fallthrough]];
|
||||||
case eLanguageCodeID::DE_DE:
|
case eLanguageCodeID::DE_DE:
|
||||||
|
[[fallthrough]];
|
||||||
case eLanguageCodeID::EN_GB:
|
case eLanguageCodeID::EN_GB:
|
||||||
|
[[fallthrough]];
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
GameMessages::SendUIMessageServerToSingleClient(player, sysAddr, "UIHelpTop5", data);
|
GameMessages::SendUIMessageServerToSingleClient(player, sysAddr, "UIHelpTop5", data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GeneralChatMessage::Deserialize(RakNet::BitStream& bitStream) {
|
||||||
|
VALIDATE_READ(bitStream.Read(chatChannel));
|
||||||
|
VALIDATE_READ(bitStream.Read(unknown));
|
||||||
|
|
||||||
|
uint32_t messageLength;
|
||||||
|
VALIDATE_READ(bitStream.Read(messageLength));
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < (messageLength - 1); ++i) {
|
||||||
|
uint16_t character;
|
||||||
|
VALIDATE_READ(bitStream.Read(character));
|
||||||
|
message.push_back(character);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeneralChatMessage::Handle() {
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PositionUpdate::Deserialize(RakNet::BitStream& bitStream) {
|
||||||
|
VALIDATE_READ(bitStream.Read(position.x));
|
||||||
|
VALIDATE_READ(bitStream.Read(position.y));
|
||||||
|
VALIDATE_READ(bitStream.Read(position.z));
|
||||||
|
|
||||||
|
VALIDATE_READ(bitStream.Read(rotation.x));
|
||||||
|
VALIDATE_READ(bitStream.Read(rotation.y));
|
||||||
|
VALIDATE_READ(bitStream.Read(rotation.z));
|
||||||
|
VALIDATE_READ(bitStream.Read(rotation.w));
|
||||||
|
|
||||||
|
VALIDATE_READ(bitStream.Read(onGround));
|
||||||
|
VALIDATE_READ(bitStream.Read(onRail));
|
||||||
|
|
||||||
|
bool velocityFlag = false;
|
||||||
|
if (bitStream.Read(velocityFlag) && velocityFlag) {
|
||||||
|
VALIDATE_READ(bitStream.Read(velocity.x));
|
||||||
|
VALIDATE_READ(bitStream.Read(velocity.y));
|
||||||
|
VALIDATE_READ(bitStream.Read(velocity.z));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool angVelocityFlag = false;
|
||||||
|
if (bitStream.Read(angVelocityFlag) && angVelocityFlag) {
|
||||||
|
VALIDATE_READ(bitStream.Read(angularVelocity.x));
|
||||||
|
VALIDATE_READ(bitStream.Read(angularVelocity.y));
|
||||||
|
VALIDATE_READ(bitStream.Read(angularVelocity.z));
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO figure out how to use these. Ignoring for now, but reading in if they exist.
|
||||||
|
bool hasLocalSpaceInfo{};
|
||||||
|
VALIDATE_READ(bitStream.Read(hasLocalSpaceInfo));
|
||||||
|
if (hasLocalSpaceInfo) {
|
||||||
|
VALIDATE_READ(bitStream.Read(localSpaceInfo.objectId));
|
||||||
|
VALIDATE_READ(bitStream.Read(localSpaceInfo.position.x));
|
||||||
|
VALIDATE_READ(bitStream.Read(localSpaceInfo.position.y));
|
||||||
|
VALIDATE_READ(bitStream.Read(localSpaceInfo.position.z));
|
||||||
|
|
||||||
|
bool hasLinearVelocity = false;
|
||||||
|
if (bitStream.Read(hasLinearVelocity) && hasLinearVelocity) {
|
||||||
|
VALIDATE_READ(bitStream.Read(localSpaceInfo.linearVelocity.x));
|
||||||
|
VALIDATE_READ(bitStream.Read(localSpaceInfo.linearVelocity.y));
|
||||||
|
VALIDATE_READ(bitStream.Read(localSpaceInfo.linearVelocity.z));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool hasRemoteInputInfo{};
|
||||||
|
VALIDATE_READ(bitStream.Read(hasRemoteInputInfo));
|
||||||
|
if (hasRemoteInputInfo) {
|
||||||
|
VALIDATE_READ(bitStream.Read(remoteInputInfo.m_RemoteInputX));
|
||||||
|
VALIDATE_READ(bitStream.Read(remoteInputInfo.m_RemoteInputY));
|
||||||
|
VALIDATE_READ(bitStream.Read(remoteInputInfo.m_IsPowersliding));
|
||||||
|
VALIDATE_READ(bitStream.Read(remoteInputInfo.m_IsModified));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PositionUpdate::Handle() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool StringCheck::Deserialize(RakNet::BitStream& bitStream) {
|
||||||
|
VALIDATE_READ(bitStream.Read(chatLevel));
|
||||||
|
VALIDATE_READ(bitStream.Read(requestID));
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < 42; ++i) {
|
||||||
|
uint16_t character;
|
||||||
|
VALIDATE_READ(bitStream.Read(character));
|
||||||
|
receiver.push_back(static_cast<uint8_t>(character));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!receiver.empty()) {
|
||||||
|
if (std::string(receiver.c_str(), 4) == "[GM]") { // Shift the string forward if we are speaking to a GM as the client appends "[GM]" if they are
|
||||||
|
receiver = std::string(receiver.c_str() + 4, receiver.size() - 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t messageLength;
|
||||||
|
VALIDATE_READ(bitStream.Read(messageLength));
|
||||||
|
for (uint32_t i = 0; i < messageLength; ++i) {
|
||||||
|
uint16_t character;
|
||||||
|
VALIDATE_READ(bitStream.Read(character));
|
||||||
|
message.push_back(static_cast<uint8_t>(character));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void StringCheck::Handle() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,56 @@ namespace WorldPackets {
|
|||||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||||
void Handle() override;
|
void Handle() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct GeneralChatMessage : public LUBitStream {
|
||||||
|
uint8_t chatChannel = 0;
|
||||||
|
uint16_t unknown = 0;
|
||||||
|
std::u16string message;
|
||||||
|
|
||||||
|
GeneralChatMessage() : LUBitStream(eConnectionType::WORLD, MessageType::World::GENERAL_CHAT_MESSAGE) {};
|
||||||
|
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||||
|
void Handle() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct PositionUpdate : public LUBitStream {
|
||||||
|
NiPoint3 position = NiPoint3Constant::ZERO;
|
||||||
|
NiQuaternion rotation = NiQuaternionConstant::IDENTITY;
|
||||||
|
bool onGround = false;
|
||||||
|
bool onRail = false;
|
||||||
|
NiPoint3 velocity = NiPoint3Constant::ZERO;
|
||||||
|
NiPoint3 angularVelocity = NiPoint3Constant::ZERO;
|
||||||
|
struct LocalSpaceInfo {
|
||||||
|
LWOOBJID objectId = LWOOBJID_EMPTY;
|
||||||
|
NiPoint3 position = NiPoint3Constant::ZERO;
|
||||||
|
NiPoint3 linearVelocity = NiPoint3Constant::ZERO;
|
||||||
|
};
|
||||||
|
LocalSpaceInfo localSpaceInfo;
|
||||||
|
struct RemoteInputInfo {
|
||||||
|
bool operator==(const RemoteInputInfo& other) {
|
||||||
|
return m_RemoteInputX == other.m_RemoteInputX && m_RemoteInputY == other.m_RemoteInputY && m_IsPowersliding == other.m_IsPowersliding && m_IsModified == other.m_IsModified;
|
||||||
|
}
|
||||||
|
float m_RemoteInputX = 0;
|
||||||
|
float m_RemoteInputY = 0;
|
||||||
|
bool m_IsPowersliding = false;
|
||||||
|
bool m_IsModified = false;
|
||||||
|
};
|
||||||
|
RemoteInputInfo remoteInputInfo;
|
||||||
|
|
||||||
|
PositionUpdate() : LUBitStream(eConnectionType::WORLD, MessageType::World::POSITION_UPDATE) {};
|
||||||
|
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||||
|
void Handle() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct StringCheck : public LUBitStream {
|
||||||
|
uint8_t chatLevel = 0;
|
||||||
|
uint8_t requestID = 0;
|
||||||
|
std::string receiver;
|
||||||
|
std::string message;
|
||||||
|
|
||||||
|
StringCheck() : LUBitStream(eConnectionType::WORLD, MessageType::World::STRING_CHECK) {};
|
||||||
|
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||||
|
void Handle() override;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // WORLDPACKETS_H
|
#endif // WORLDPACKETS_H
|
||||||
|
@ -77,7 +77,6 @@
|
|||||||
#include "eGameMasterLevel.h"
|
#include "eGameMasterLevel.h"
|
||||||
#include "StringifiedEnum.h"
|
#include "StringifiedEnum.h"
|
||||||
#include "Server.h"
|
#include "Server.h"
|
||||||
#include "PositionUpdate.h"
|
|
||||||
#include "PlayerManager.h"
|
#include "PlayerManager.h"
|
||||||
#include "eLoginResponse.h"
|
#include "eLoginResponse.h"
|
||||||
#include "MissionComponent.h"
|
#include "MissionComponent.h"
|
||||||
@ -1223,8 +1222,8 @@ void HandlePacket(Packet* packet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case MessageType::World::POSITION_UPDATE: {
|
case MessageType::World::POSITION_UPDATE: {
|
||||||
auto positionUpdate = ClientPackets::HandleClientPositionUpdate(packet);
|
WorldPackets::PositionUpdate positionUpdate;
|
||||||
|
positionUpdate.Deserialize(inStream);
|
||||||
User* user = UserManager::Instance()->GetUser(packet->systemAddress);
|
User* user = UserManager::Instance()->GetUser(packet->systemAddress);
|
||||||
if (!user) {
|
if (!user) {
|
||||||
LOG("Unable to get user to parse position update");
|
LOG("Unable to get user to parse position update");
|
||||||
@ -1276,7 +1275,8 @@ void HandlePacket(Packet* packet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case MessageType::World::STRING_CHECK: {
|
case MessageType::World::STRING_CHECK: {
|
||||||
auto request = ClientPackets::HandleChatModerationRequest(packet);
|
WorldPackets::StringCheck request;
|
||||||
|
request.Deserialize(inStream);
|
||||||
|
|
||||||
// TODO: Find a good home for the logic in this case.
|
// TODO: Find a good home for the logic in this case.
|
||||||
User* user = UserManager::Instance()->GetUser(packet->systemAddress);
|
User* user = UserManager::Instance()->GetUser(packet->systemAddress);
|
||||||
@ -1354,7 +1354,8 @@ void HandlePacket(Packet* packet) {
|
|||||||
if (g_ChatDisabled) {
|
if (g_ChatDisabled) {
|
||||||
ChatPackets::SendMessageFail(packet->systemAddress);
|
ChatPackets::SendMessageFail(packet->systemAddress);
|
||||||
} else {
|
} else {
|
||||||
auto chatMessage = ClientPackets::HandleChatMessage(packet);
|
WorldPackets::GeneralChatMessage chatMessage;
|
||||||
|
chatMessage.Deserialize(inStream);
|
||||||
|
|
||||||
// TODO: Find a good home for the logic in this case.
|
// TODO: Find a good home for the logic in this case.
|
||||||
User* user = UserManager::Instance()->GetUser(packet->systemAddress);
|
User* user = UserManager::Instance()->GetUser(packet->systemAddress);
|
||||||
@ -1400,7 +1401,6 @@ void HandlePacket(Packet* packet) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
case MessageType::World::UI_HELP_TOP_5: {
|
case MessageType::World::UI_HELP_TOP_5: {
|
||||||
WorldPackets::UIHelpTop5 help;
|
WorldPackets::UIHelpTop5 help;
|
||||||
help.Deserialize(inStream);
|
help.Deserialize(inStream);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user