mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-26 23:47:21 +00:00
Fixed Misspelling of Tresure variable for petcomponent (#1617)
This commit is contained in:
parent
112c2367cc
commit
d8b86072d4
@ -88,7 +88,7 @@ PetComponent::PetComponent(Entity* parentEntity, uint32_t componentId) : Compone
|
|||||||
m_Ability = ePetAbilityType::Invalid;
|
m_Ability = ePetAbilityType::Invalid;
|
||||||
m_StartPosition = NiPoint3Constant::ZERO;
|
m_StartPosition = NiPoint3Constant::ZERO;
|
||||||
m_MovementAI = nullptr;
|
m_MovementAI = nullptr;
|
||||||
m_TresureTime = 0;
|
m_TreasureTime = 0;
|
||||||
|
|
||||||
std::string checkPreconditions = GeneralUtils::UTF16ToWTF8(parentEntity->GetVar<std::u16string>(u"CheckPrecondition"));
|
std::string checkPreconditions = GeneralUtils::UTF16ToWTF8(parentEntity->GetVar<std::u16string>(u"CheckPrecondition"));
|
||||||
|
|
||||||
@ -319,27 +319,27 @@ void PetComponent::Update(float deltaTime) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_TresureTime > 0) {
|
if (m_TreasureTime > 0) {
|
||||||
auto* tresure = Game::entityManager->GetEntity(m_Interaction);
|
auto* treasure = Game::entityManager->GetEntity(m_Interaction);
|
||||||
|
|
||||||
if (tresure == nullptr) {
|
if (treasure == nullptr) {
|
||||||
m_TresureTime = 0;
|
m_TreasureTime = 0;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_TresureTime -= deltaTime;
|
m_TreasureTime -= deltaTime;
|
||||||
|
|
||||||
m_MovementAI->Stop();
|
m_MovementAI->Stop();
|
||||||
|
|
||||||
if (m_TresureTime <= 0) {
|
if (m_TreasureTime <= 0) {
|
||||||
m_Parent->SetOwnerOverride(m_Owner);
|
m_Parent->SetOwnerOverride(m_Owner);
|
||||||
|
|
||||||
tresure->Smash(m_Parent->GetObjectID());
|
treasure->Smash(m_Parent->GetObjectID());
|
||||||
|
|
||||||
m_Interaction = LWOOBJID_EMPTY;
|
m_Interaction = LWOOBJID_EMPTY;
|
||||||
|
|
||||||
m_TresureTime = 0;
|
m_TreasureTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -396,30 +396,30 @@ void PetComponent::Update(float deltaTime) {
|
|||||||
// Determine if the "Lost Tags" mission has been completed and digging has been unlocked
|
// Determine if the "Lost Tags" mission has been completed and digging has been unlocked
|
||||||
const bool digUnlocked = missionComponent->GetMissionState(842) == eMissionState::COMPLETE;
|
const bool digUnlocked = missionComponent->GetMissionState(842) == eMissionState::COMPLETE;
|
||||||
|
|
||||||
Entity* closestTresure = PetDigServer::GetClosestTresure(position);
|
Entity* closestTreasure = PetDigServer::GetClosestTreasure(position);
|
||||||
|
|
||||||
if (closestTresure != nullptr && digUnlocked) {
|
if (closestTreasure != nullptr && digUnlocked) {
|
||||||
// Skeleton Dragon Pat special case for bone digging
|
// Skeleton Dragon Pat special case for bone digging
|
||||||
if (closestTresure->GetLOT() == 12192 && m_Parent->GetLOT() != 13067) {
|
if (closestTreasure->GetLOT() == 12192 && m_Parent->GetLOT() != 13067) {
|
||||||
goto skipTresure;
|
goto skipTreasure;
|
||||||
}
|
}
|
||||||
|
|
||||||
NiPoint3 tresurePosition = closestTresure->GetPosition();
|
NiPoint3 treasurePosition = closestTreasure->GetPosition();
|
||||||
float distance = Vector3::DistanceSquared(position, tresurePosition);
|
float distance = Vector3::DistanceSquared(position, treasurePosition);
|
||||||
if (distance < 5 * 5) {
|
if (distance < 5 * 5) {
|
||||||
m_Interaction = closestTresure->GetObjectID();
|
m_Interaction = closestTreasure->GetObjectID();
|
||||||
|
|
||||||
Command(NiPoint3Constant::ZERO, LWOOBJID_EMPTY, 1, 202, true);
|
Command(NiPoint3Constant::ZERO, LWOOBJID_EMPTY, 1, 202, true);
|
||||||
|
|
||||||
m_TresureTime = 2;
|
m_TreasureTime = 2;
|
||||||
} else if (distance < 10 * 10) {
|
} else if (distance < 10 * 10) {
|
||||||
haltDistance = 1;
|
haltDistance = 1;
|
||||||
|
|
||||||
destination = tresurePosition;
|
destination = treasurePosition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
skipTresure:
|
skipTreasure:
|
||||||
|
|
||||||
m_MovementAI->SetHaltDistance(haltDistance);
|
m_MovementAI->SetHaltDistance(haltDistance);
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ private:
|
|||||||
* Timer that tracks how long a pet has been digging up some treasure, required to spawn the treasure contents
|
* Timer that tracks how long a pet has been digging up some treasure, required to spawn the treasure contents
|
||||||
* on time
|
* on time
|
||||||
*/
|
*/
|
||||||
float m_TresureTime;
|
float m_TreasureTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The position that this pet was spawned at
|
* The position that this pet was spawned at
|
||||||
|
@ -215,20 +215,20 @@ void PetDigServer::SpawnPet(Entity* self, const Entity* owner, const DigInfo dig
|
|||||||
Game::entityManager->ConstructEntity(spawnedPet);
|
Game::entityManager->ConstructEntity(spawnedPet);
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity* PetDigServer::GetClosestTresure(NiPoint3 position) {
|
Entity* PetDigServer::GetClosestTreasure(NiPoint3 position) {
|
||||||
float closestDistance = 0;
|
float closestDistance = 0;
|
||||||
Entity* closest = nullptr;
|
Entity* closest = nullptr;
|
||||||
|
|
||||||
for (const auto tresureId : treasures) {
|
for (const auto treasureId : treasures) {
|
||||||
auto* tresure = Game::entityManager->GetEntity(tresureId);
|
auto* treasure = Game::entityManager->GetEntity(treasureId);
|
||||||
|
|
||||||
if (tresure == nullptr) continue;
|
if (treasure == nullptr) continue;
|
||||||
|
|
||||||
float distance = Vector3::DistanceSquared(tresure->GetPosition(), position);
|
float distance = Vector3::DistanceSquared(treasure->GetPosition(), position);
|
||||||
|
|
||||||
if (closest == nullptr || distance < closestDistance) {
|
if (closest == nullptr || distance < closestDistance) {
|
||||||
closestDistance = distance;
|
closestDistance = distance;
|
||||||
closest = tresure;
|
closest = treasure;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ public:
|
|||||||
void OnStartup(Entity* self) override;
|
void OnStartup(Entity* self) override;
|
||||||
void OnDie(Entity* self, Entity* killer) override;
|
void OnDie(Entity* self, Entity* killer) override;
|
||||||
|
|
||||||
static Entity* GetClosestTresure(NiPoint3 position);
|
static Entity* GetClosestTreasure(NiPoint3 position);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void ProgressPetDigMissions(const Entity* owner, const Entity* chest);
|
static void ProgressPetDigMissions(const Entity* owner, const Entity* chest);
|
||||||
|
Loading…
Reference in New Issue
Block a user