Added config setting

Added a config setting to allow players to disable pets consuming imagination.  This value defaults to zero as a feature of DLU.
This commit is contained in:
EmosewaMC 2022-06-18 00:03:27 -07:00
parent 35ea3d35ae
commit e415d96a9d
3 changed files with 8 additions and 1 deletions

View File

@ -24,6 +24,7 @@
#include "dZoneManager.h" #include "dZoneManager.h"
#include "PropertyManagementComponent.h" #include "PropertyManagementComponent.h"
#include "DestroyableComponent.h" #include "DestroyableComponent.h"
#include "dConfig.h"
InventoryComponent::InventoryComponent(Entity* parent, tinyxml2::XMLDocument* document) : Component(parent) InventoryComponent::InventoryComponent(Entity* parent, tinyxml2::XMLDocument* document) : Component(parent)
{ {
@ -1354,7 +1355,7 @@ void InventoryComponent::SpawnPet(Item* item)
// First check if we can summon the pet. You need 1 imagination to do so. // First check if we can summon the pet. You need 1 imagination to do so.
auto destroyableComponent = m_Parent->GetComponent<DestroyableComponent>(); auto destroyableComponent = m_Parent->GetComponent<DestroyableComponent>();
if (destroyableComponent && destroyableComponent->GetImagination() <= 0) { if (Game::config->GetValue("pets_imagination") == "1" && destroyableComponent && destroyableComponent->GetImagination() <= 0) {
GameMessages::SendUseItemRequirementsResponse(m_Parent->GetObjectID(), m_Parent->GetSystemAddress(), UseItemResponse::NoImaginationForPet); GameMessages::SendUseItemRequirementsResponse(m_Parent->GetObjectID(), m_Parent->GetSystemAddress(), UseItemResponse::NoImaginationForPet);
return; return;
} }

View File

@ -16,6 +16,7 @@
#include "../dWorldServer/ObjectIDManager.h" #include "../dWorldServer/ObjectIDManager.h"
#include "Game.h" #include "Game.h"
#include "dConfig.h"
#include "dChatFilter.h" #include "dChatFilter.h"
#include "Database.h" #include "Database.h"
@ -985,6 +986,8 @@ void PetComponent::Activate(Item* item, bool registerPet)
} }
void PetComponent::AddDrainImaginationTimer(Item* item) { void PetComponent::AddDrainImaginationTimer(Item* item) {
if (Game::config->GetValue("pets_imagination") == "0") return;
auto playerInventory = item->GetInventory(); auto playerInventory = item->GetInventory();
if (!playerInventory) return; if (!playerInventory) return;

View File

@ -57,3 +57,6 @@ check_fdb=0
# 0 or 1, DLU leaderboards will rate Avant Gardens Survival based on score by default. # 0 or 1, DLU leaderboards will rate Avant Gardens Survival based on score by default.
# This option should be set to 1 if you would like it to reflect the game when it was live (scoring based on time). # This option should be set to 1 if you would like it to reflect the game when it was live (scoring based on time).
classic_survival_scoring=0 classic_survival_scoring=0
# If this value is 1, pets will consume imagination as they did in live. if 0 they will not consume imagination at all.
pets_imagination=0