mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-11-03 14:11:56 +00:00
Added fallback to default values if CDClient data cannot be loaded
This commit is contained in:
@@ -73,6 +73,38 @@ std::map<LOT, int32_t> PetComponent::petFlags = {
|
||||
{ 13067, 838 }, // Skeleton dragon
|
||||
};
|
||||
|
||||
PetComponent::PetComponent(Entity* parentEntity, uint32_t componentId) : Component{ parentEntity },
|
||||
m_PetInfo{ CDClientManager::Instance().GetTable<CDPetComponentTable>()->GetByID(componentId) } {
|
||||
m_ComponentId = componentId;
|
||||
m_Interaction = LWOOBJID_EMPTY;
|
||||
m_InteractType = PetInteractType::none;
|
||||
m_Owner = LWOOBJID_EMPTY;
|
||||
m_ModerationStatus = 0;
|
||||
m_Tamer = LWOOBJID_EMPTY;
|
||||
m_ModelId = LWOOBJID_EMPTY;
|
||||
m_Timer = 0;
|
||||
m_TimerAway = 0;
|
||||
m_TimerBounce = 0;
|
||||
m_DatabaseId = LWOOBJID_EMPTY;
|
||||
m_Flags = PetFlag::SPAWNING; // Tameable
|
||||
m_Ability = ePetAbilityType::Invalid;
|
||||
m_StartPosition = m_Parent->GetPosition();
|
||||
m_MovementAI = nullptr;
|
||||
m_Preconditions = nullptr;
|
||||
|
||||
m_ReadyToInteract = false;
|
||||
SetPetAiState(PetAiState::spawn);
|
||||
SetIsHandlingInteraction(false);
|
||||
|
||||
std::string checkPreconditions = GeneralUtils::UTF16ToWTF8(parentEntity->GetVar<std::u16string>(u"CheckPrecondition"));
|
||||
|
||||
if (!checkPreconditions.empty()) {
|
||||
SetPreconditions(checkPreconditions);
|
||||
}
|
||||
|
||||
m_FollowRadius = 8.0f; //Game::zoneManager->GetPetFollowRadius(); // TODO: FIX THIS TO LOAD DYNAMICALLY
|
||||
}
|
||||
|
||||
void PetComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
|
||||
const bool tamed = m_Owner != LWOOBJID_EMPTY;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user