mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
Fixed pet emotes not playing
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
#include "ePetTamingNotifyType.h"
|
||||
#include "eUseItemResponse.h"
|
||||
#include "ePlayerFlag.h"
|
||||
#include "ePetStatus.h"
|
||||
|
||||
#include "Game.h"
|
||||
#include "dConfig.h"
|
||||
@@ -81,7 +80,7 @@ PetComponent::PetComponent(Entity* parent, uint32_t componentId): Component(pare
|
||||
m_Timer = 0;
|
||||
m_TimerAway = 0;
|
||||
m_DatabaseId = LWOOBJID_EMPTY;
|
||||
m_Status = ePetStatus::TAMEABLE; // Tameable
|
||||
m_Status = PetStatus::TAMEABLE; // Tameable
|
||||
m_Ability = PetAbilityType::Invalid;
|
||||
m_StartPosition = NiPoint3::ZERO;
|
||||
m_MovementAI = nullptr;
|
||||
@@ -382,7 +381,7 @@ void PetComponent::Update(float deltaTime) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_TresureTime > 0.0f) {
|
||||
if (m_TresureTime > 0.0f) { //TODO: Find better trigger
|
||||
InteractDig(deltaTime);
|
||||
return;
|
||||
}
|
||||
@@ -450,7 +449,7 @@ void PetComponent::Update(float deltaTime) {
|
||||
if (distance < 5 * 5) {
|
||||
m_Interaction = closestTresure->GetObjectID();
|
||||
|
||||
Command(NiPoint3::ZERO, LWOOBJID_EMPTY, 1, 202, true);
|
||||
Command(NiPoint3::ZERO, LWOOBJID_EMPTY, 1, PetEmote::Bounce , true); // Plays 'bounce' animation
|
||||
|
||||
SetIsReadyToDig(true);
|
||||
|
||||
@@ -478,20 +477,20 @@ void PetComponent::SetIsReadyToDig(bool isReady) {
|
||||
if (isReady) {
|
||||
LOG("Dig state reached!");
|
||||
//m_Interaction = closestTresure->GetObjectID();
|
||||
SetAbility(PetAbilityType::JumpOnObject);
|
||||
SetStatus(ePetStatus::IS_NOT_WAITING); // Treasure dig status
|
||||
//SetAbility(PetAbilityType::JumpOnObject);
|
||||
SetStatus(PetStatus::IS_NOT_WAITING); // Treasure dig status
|
||||
m_ReadyToDig = true;
|
||||
}
|
||||
else {
|
||||
LOG("Dig state ended!");
|
||||
//m_Interaction = LWOOBJID_EMPTY;
|
||||
SetAbility(PetAbilityType::Invalid);
|
||||
//SetAbility(PetAbilityType::Invalid);
|
||||
SetStatus(0); // TODO: Check status
|
||||
m_ReadyToDig = false;
|
||||
}
|
||||
}
|
||||
|
||||
void PetComponent::InteractDig(float deltaTime) { //Should I rename to InteractDig?
|
||||
void PetComponent::InteractDig(float deltaTime) {
|
||||
LOG("Pet digging!");
|
||||
|
||||
auto* tresure = Game::entityManager->GetEntity(m_Interaction);
|
||||
@@ -773,7 +772,7 @@ void PetComponent::ClientExitTamingMinigame(bool voluntaryExit) {
|
||||
|
||||
currentActivities.erase(m_Tamer);
|
||||
|
||||
SetStatus(ePetStatus::TAMEABLE);
|
||||
SetStatus(PetStatus::TAMEABLE);
|
||||
m_Tamer = LWOOBJID_EMPTY;
|
||||
m_Timer = 0;
|
||||
|
||||
@@ -824,7 +823,7 @@ void PetComponent::ClientFailTamingMinigame() {
|
||||
|
||||
currentActivities.erase(m_Tamer);
|
||||
|
||||
SetStatus(ePetStatus::TAMEABLE);
|
||||
SetStatus(PetStatus::TAMEABLE);
|
||||
m_Tamer = LWOOBJID_EMPTY;
|
||||
m_Timer = 0;
|
||||
|
||||
@@ -1024,10 +1023,7 @@ void PetComponent::Release() {
|
||||
|
||||
void PetComponent::Command(NiPoint3 position, LWOOBJID source, int32_t commandType, int32_t typeId, bool overrideObey) {
|
||||
auto* owner = GetOwner();
|
||||
|
||||
if (owner == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (!owner) return;
|
||||
|
||||
if (commandType == 1) {
|
||||
// Emotes
|
||||
@@ -1151,3 +1147,13 @@ void PetComponent::LoadPetNameFromModeration() {
|
||||
void PetComponent::SetPreconditions(std::string& preconditions) {
|
||||
m_Preconditions = new PreconditionExpression(preconditions);
|
||||
}
|
||||
|
||||
void PetComponent::StartInteractDig() {
|
||||
//m_InInteract = true;
|
||||
m_TresureTime = 2.0f; //TODO: Remove magic number
|
||||
Command(NiPoint3::ZERO, LWOOBJID_EMPTY, 1, PetEmote::DigTreasure , true);
|
||||
}
|
||||
|
||||
void PetComponent::EndInteractDig() {
|
||||
//m_InInteract = false;
|
||||
}
|
@@ -6,6 +6,24 @@
|
||||
#include "Preconditions.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
enum PetStatus : uint32_t {
|
||||
NONE,
|
||||
UNKNOWN1 = 0x1,
|
||||
UNKNOWN2 = 0x2,
|
||||
UNKNOWN3 = 0x4,
|
||||
UNKNOWN4 = 0x8,
|
||||
BEING_TAMED = 0x10,
|
||||
IS_NOT_WAITING = 0x20, // Right name? - used to be decimal 20
|
||||
PLAY_SPAWN_ANIM = 0x80,
|
||||
TAMEABLE = 0x4000000
|
||||
};
|
||||
|
||||
enum PetEmote : int32_t {
|
||||
ActivateSwitch = 201,
|
||||
DigTreasure,
|
||||
Bounce
|
||||
};
|
||||
|
||||
enum class PetAbilityType
|
||||
{
|
||||
Invalid,
|
||||
@@ -29,12 +47,6 @@ public:
|
||||
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
|
||||
void Update(float deltaTime) override;
|
||||
|
||||
/**
|
||||
* Handles the pet dig interaction
|
||||
* @param deltaTime time elapsed
|
||||
*/
|
||||
void InteractDig(float deltaTime);
|
||||
|
||||
/**
|
||||
* Handles an OnUse event from another entity, initializing the pet taming minigame if this pet is untamed.
|
||||
* @param originator the entity that triggered the event
|
||||
@@ -189,6 +201,22 @@ public:
|
||||
*/
|
||||
bool GetIsReadyToDig() { return m_ReadyToDig; };
|
||||
|
||||
/**
|
||||
* Start the dig interaction
|
||||
*/
|
||||
void StartInteractDig();
|
||||
|
||||
/**
|
||||
* Handles the pet dig interaction
|
||||
* @param deltaTime time elapsed
|
||||
*/
|
||||
void InteractDig(float deltaTime);
|
||||
|
||||
/**
|
||||
* End the dig interaction
|
||||
*/
|
||||
void EndInteractDig();
|
||||
|
||||
/**
|
||||
* Sets pet's treasure timer
|
||||
* @param digTime float representing the treasure dig time in seconds
|
||||
|
Reference in New Issue
Block a user