Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Misspelling for Treasure in PetComponent files #1617

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions dGame/dComponents/PetComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ PetComponent::PetComponent(Entity* parentEntity, uint32_t componentId) : Compone
m_Ability = ePetAbilityType::Invalid;
m_StartPosition = NiPoint3Constant::ZERO;
m_MovementAI = nullptr;
m_TresureTime = 0;
m_TreasureTime = 0;

std::string checkPreconditions = GeneralUtils::UTF16ToWTF8(parentEntity->GetVar<std::u16string>(u"CheckPrecondition"));

Expand Down Expand Up @@ -319,27 +319,27 @@ void PetComponent::Update(float deltaTime) {
return;
}

if (m_TresureTime > 0) {
auto* tresure = Game::entityManager->GetEntity(m_Interaction);
if (m_TreasureTime > 0) {
auto* treasure = Game::entityManager->GetEntity(m_Interaction);

if (tresure == nullptr) {
m_TresureTime = 0;
if (treasure == nullptr) {
m_TreasureTime = 0;

return;
}

m_TresureTime -= deltaTime;
m_TreasureTime -= deltaTime;

m_MovementAI->Stop();

if (m_TresureTime <= 0) {
if (m_TreasureTime <= 0) {
m_Parent->SetOwnerOverride(m_Owner);

tresure->Smash(m_Parent->GetObjectID());
treasure->Smash(m_Parent->GetObjectID());

m_Interaction = LWOOBJID_EMPTY;

m_TresureTime = 0;
m_TreasureTime = 0;
}

return;
Expand Down Expand Up @@ -396,30 +396,30 @@ void PetComponent::Update(float deltaTime) {
// Determine if the "Lost Tags" mission has been completed and digging has been unlocked
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
if (closestTresure->GetLOT() == 12192 && m_Parent->GetLOT() != 13067) {
goto skipTresure;
if (closestTreasure->GetLOT() == 12192 && m_Parent->GetLOT() != 13067) {
goto skipTreasure;
}

NiPoint3 tresurePosition = closestTresure->GetPosition();
float distance = Vector3::DistanceSquared(position, tresurePosition);
NiPoint3 treasurePosition = closestTreasure->GetPosition();
float distance = Vector3::DistanceSquared(position, treasurePosition);
if (distance < 5 * 5) {
m_Interaction = closestTresure->GetObjectID();
m_Interaction = closestTreasure->GetObjectID();

Command(NiPoint3Constant::ZERO, LWOOBJID_EMPTY, 1, 202, true);

m_TresureTime = 2;
m_TreasureTime = 2;
} else if (distance < 10 * 10) {
haltDistance = 1;

destination = tresurePosition;
destination = treasurePosition;
}
}

skipTresure:
skipTreasure:

m_MovementAI->SetHaltDistance(haltDistance);

Expand Down
2 changes: 1 addition & 1 deletion dGame/dComponents/PetComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ class PetComponent final : public Component
* Timer that tracks how long a pet has been digging up some treasure, required to spawn the treasure contents
* on time
*/
float m_TresureTime;
float m_TreasureTime;

/**
* The position that this pet was spawned at
Expand Down
12 changes: 6 additions & 6 deletions dScripts/02_server/Map/General/PetDigServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,20 +215,20 @@ void PetDigServer::SpawnPet(Entity* self, const Entity* owner, const DigInfo dig
Game::entityManager->ConstructEntity(spawnedPet);
}

Entity* PetDigServer::GetClosestTresure(NiPoint3 position) {
Entity* PetDigServer::GetClosestTreasure(NiPoint3 position) {
float closestDistance = 0;
Entity* closest = nullptr;

for (const auto tresureId : treasures) {
auto* tresure = Game::entityManager->GetEntity(tresureId);
for (const auto treasureId : treasures) {
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) {
closestDistance = distance;
closest = tresure;
closest = treasure;
}
}

Expand Down
2 changes: 1 addition & 1 deletion dScripts/02_server/Map/General/PetDigServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class PetDigServer : public CppScripts::Script
void OnStartup(Entity* self) override;
void OnDie(Entity* self, Entity* killer) override;

static Entity* GetClosestTresure(NiPoint3 position);
static Entity* GetClosestTreasure(NiPoint3 position);

private:
static void ProgressPetDigMissions(const Entity* owner, const Entity* chest);
Expand Down