mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-14 15:57:13 +00:00
The three components were made from the registry and wrote nothing, so the client read the next component's bits as theirs. - LWOChestComponent::Deserialize (0x00c22010), construction only: the player (u64) and the loot offer count (u32). - LWOChoiceBuildComponent::Deserialize (0x00bf26d0): a flag, then the state (u32, 0 waiting, 1 building), the built object and the user (u64 each). Always in a construction. - LWORollerComponent::Deserialize (0x00c15920), construction: the level's activity_camera_pos and activity_camera_lookat_pos (3 floats each) and the projectile skill (u32, the client starts at 1348); then the flag of the block about its user, which is never set. LWOGameObject::Deserialize (0x00f99690) reads the components in the order of the object's component list, which ObjectLoader2::DoObjectComponentLoad (0x0105ebb0) fills in the order of FillComponentOrder (0x0101f8e0): the roller after the shooting gallery and before the moving platform, the choice build after the moving platform and before the LUP exhibit and the model, the chest after the zone control and before render. They are placed against the components their objects have. The gate rush control (103) is left out: its two registry entries have no object, and there is no component for it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
62 lines
2.0 KiB
C++
62 lines
2.0 KiB
C++
#ifndef CHOICEBUILDCOMPONENT_H
|
|
#define CHOICEBUILDCOMPONENT_H
|
|
|
|
#include "BitStream.h"
|
|
#include "Component.h"
|
|
#include "dCommonVars.h"
|
|
#include "eReplicaComponentType.h"
|
|
|
|
/**
|
|
* Choice build, as the client's LWOChoiceBuildComponent makes it from the registry (LOTs 5668, 6414, 6462, 7002, 16205).
|
|
* Its state, the object built and the player using it are sent; nothing else of it is done on the server yet.
|
|
*/
|
|
class ChoiceBuildComponent final : public Component {
|
|
public:
|
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::CHOICE_BUILD;
|
|
|
|
// The client's states (its constructor starts at Waiting)
|
|
enum class eState : uint32_t {
|
|
Waiting = 0,
|
|
Building = 1,
|
|
};
|
|
|
|
ChoiceBuildComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {}
|
|
|
|
// LWOChoiceBuildComponent::Deserialize (0x00bf26d0) reads, in constructions and updates alike: a flag, then the
|
|
// state (u32), the built object (u64) and the user (u64). A construction always carries them.
|
|
void Serialize(RakNet::BitStream& outBitStream, const bool isConstruction) override {
|
|
outBitStream.Write(isConstruction || m_Dirty);
|
|
if (isConstruction || m_Dirty) {
|
|
outBitStream.Write(m_State);
|
|
outBitStream.Write(m_ChildObject);
|
|
outBitStream.Write(m_UserID);
|
|
}
|
|
if (!isConstruction) m_Dirty = false;
|
|
}
|
|
|
|
eState GetState() const { return m_State; }
|
|
LWOOBJID GetChildObject() const { return m_ChildObject; }
|
|
LWOOBJID GetUserID() const { return m_UserID; }
|
|
|
|
// Changes what the clients are told with the next update (the caller serializes the object)
|
|
void SetState(const eState state, const LWOOBJID childObject, const LWOOBJID userID) {
|
|
m_State = state;
|
|
m_ChildObject = childObject;
|
|
m_UserID = userID;
|
|
m_Dirty = true;
|
|
}
|
|
|
|
private:
|
|
eState m_State = eState::Waiting;
|
|
|
|
// The object the choice build made, none while waiting
|
|
LWOOBJID m_ChildObject = LWOOBJID_EMPTY;
|
|
|
|
// The player using the choice build, none while waiting
|
|
LWOOBJID m_UserID = LWOOBJID_EMPTY;
|
|
|
|
bool m_Dirty = false;
|
|
};
|
|
|
|
#endif // CHOICEBUILDCOMPONENT_H
|