mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-23 06:23:08 +00:00
refactor(component): the pet loads its row and preconditions in the client's phases
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -54,8 +54,6 @@ std::unordered_map<LWOOBJID, LWOOBJID> PetComponent::activePets{};
|
|||||||
|
|
||||||
PetComponent::PetComponent(Entity* parentEntity, const int32_t componentID) : Component{ parentEntity, componentID } {
|
PetComponent::PetComponent(Entity* parentEntity, const int32_t componentID) : Component{ parentEntity, componentID } {
|
||||||
RegisterMsg(&PetComponent::OnRequestUse);
|
RegisterMsg(&PetComponent::OnRequestUse);
|
||||||
m_PetInfo = CDClientManager::GetTable<CDPetComponentTable>()->GetByID(componentID); // TODO: Make reference when safe
|
|
||||||
|
|
||||||
m_Interaction = LWOOBJID_EMPTY;
|
m_Interaction = LWOOBJID_EMPTY;
|
||||||
m_Owner = LWOOBJID_EMPTY;
|
m_Owner = LWOOBJID_EMPTY;
|
||||||
m_ModerationStatus = 0;
|
m_ModerationStatus = 0;
|
||||||
@@ -69,8 +67,16 @@ PetComponent::PetComponent(Entity* parentEntity, const int32_t componentID) : Co
|
|||||||
m_StartPosition = NiPoint3Constant::ZERO;
|
m_StartPosition = NiPoint3Constant::ZERO;
|
||||||
m_MovementAI = nullptr;
|
m_MovementAI = nullptr;
|
||||||
m_TreasureTime = 0;
|
m_TreasureTime = 0;
|
||||||
|
}
|
||||||
|
|
||||||
std::string checkPreconditions = GeneralUtils::UTF16ToWTF8(parentEntity->GetVar<std::u16string>(u"CheckPrecondition"));
|
// The PetComponent row
|
||||||
|
void PetComponent::LoadDataFromTemplate() {
|
||||||
|
m_PetInfo = CDClientManager::GetTable<CDPetComponentTable>()->GetByID(m_ComponentID); // TODO: Make reference when safe
|
||||||
|
}
|
||||||
|
|
||||||
|
// The level config: the taming preconditions
|
||||||
|
void PetComponent::LoadConfigData() {
|
||||||
|
std::string checkPreconditions = GeneralUtils::UTF16ToWTF8(m_Parent->GetVar<std::u16string>(u"CheckPrecondition"));
|
||||||
|
|
||||||
if (!checkPreconditions.empty()) {
|
if (!checkPreconditions.empty()) {
|
||||||
SetPreconditions(checkPreconditions);
|
SetPreconditions(checkPreconditions);
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ public:
|
|||||||
static constexpr uint32_t PET_STATE_GOING_TO_ABILITY_OBJECT = 1 << 10;
|
static constexpr uint32_t PET_STATE_GOING_TO_ABILITY_OBJECT = 1 << 10;
|
||||||
|
|
||||||
explicit PetComponent(Entity* parentEntity, const int32_t componentID);
|
explicit PetComponent(Entity* parentEntity, const int32_t componentID);
|
||||||
|
|
||||||
|
void LoadDataFromTemplate() override;
|
||||||
|
void LoadConfigData() override;
|
||||||
~PetComponent() override;
|
~PetComponent() override;
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user