Dont take imagination on initial tame

This commit is contained in:
EmosewaMC 2022-06-18 00:14:24 -07:00
parent 0774ab930d
commit 2a0616d0e9
2 changed files with 9 additions and 9 deletions

View File

@ -651,7 +651,7 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position)
inventoryComponent->SetDatabasePet(petSubKey, databasePet);
Activate(item, false);
Activate(item, false, true);
m_Timer = 0;
@ -912,9 +912,9 @@ void PetComponent::Wander()
m_Timer += (m_MovementAI->GetCurrentPosition().x - destination.x) / info.wanderSpeed;
}
void PetComponent::Activate(Item* item, bool registerPet)
void PetComponent::Activate(Item* item, bool registerPet, bool fromTaming)
{
AddDrainImaginationTimer(item);
AddDrainImaginationTimer(item, fromTaming);
m_ItemId = item->GetId();
m_DatabaseId = item->GetSubKey();
@ -985,9 +985,9 @@ void PetComponent::Activate(Item* item, bool registerPet)
GameMessages::SendShowPetActionButton(m_Owner, 3, true, owner->GetSystemAddress());
}
void PetComponent::AddDrainImaginationTimer(Item* item) {
void PetComponent::AddDrainImaginationTimer(Item* item, bool fromTaming) {
if (Game::config->GetValue("pets_imagination") != "1") return;
auto playerInventory = item->GetInventory();
if (!playerInventory) return;
@ -1000,8 +1000,8 @@ void PetComponent::AddDrainImaginationTimer(Item* item) {
auto playerDestroyableComponent = playerEntity->GetComponent<DestroyableComponent>();
if (!playerDestroyableComponent) return;
// Drain by 1 when you summon pet or when this method is called
playerDestroyableComponent->Imagine(-1);
// Drain by 1 when you summon pet or when this method is called, but not when we have just tamed this pet.
if (!fromTaming) playerDestroyableComponent->Imagine(-1);
// Set this to a variable so when this is called back from the player the timer doesn't fire off.
m_Parent->AddCallbackTimer(imaginationDrainRate, [playerDestroyableComponent, this, item](){

View File

@ -82,7 +82,7 @@ public:
* @param item the item to create the pet from
* @param registerPet notifies the client that the pet was spawned, not necessary if this pet is being tamed
*/
void Activate(Item* item, bool registerPet = true);
void Activate(Item* item, bool registerPet = true, bool fromTaming = false);
/**
* Despawns the pet
@ -209,7 +209,7 @@ public:
*
* @param item The item that represents this pet in the inventory.
*/
void AddDrainImaginationTimer(Item* item);
void AddDrainImaginationTimer(Item* item, bool fromTaming = false);
private: