mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-25 15:07:28 +00:00
Dont take imagination on initial tame
This commit is contained in:
parent
0774ab930d
commit
2a0616d0e9
@ -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,7 +985,7 @@ 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();
|
||||
@ -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](){
|
||||
|
@ -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:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user