From e415d96a9ddf832ae396f242b350bd233658b03e Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Sat, 18 Jun 2022 00:03:27 -0700 Subject: [PATCH] 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. --- dGame/dComponents/InventoryComponent.cpp | 3 ++- dGame/dComponents/PetComponent.cpp | 3 +++ resources/worldconfig.ini | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dGame/dComponents/InventoryComponent.cpp b/dGame/dComponents/InventoryComponent.cpp index bc589e7b..b7eae8bf 100644 --- a/dGame/dComponents/InventoryComponent.cpp +++ b/dGame/dComponents/InventoryComponent.cpp @@ -24,6 +24,7 @@ #include "dZoneManager.h" #include "PropertyManagementComponent.h" #include "DestroyableComponent.h" +#include "dConfig.h" 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. auto destroyableComponent = m_Parent->GetComponent(); - 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); return; } diff --git a/dGame/dComponents/PetComponent.cpp b/dGame/dComponents/PetComponent.cpp index caefbf68..87f7278b 100644 --- a/dGame/dComponents/PetComponent.cpp +++ b/dGame/dComponents/PetComponent.cpp @@ -16,6 +16,7 @@ #include "../dWorldServer/ObjectIDManager.h" #include "Game.h" +#include "dConfig.h" #include "dChatFilter.h" #include "Database.h" @@ -985,6 +986,8 @@ void PetComponent::Activate(Item* item, bool registerPet) } void PetComponent::AddDrainImaginationTimer(Item* item) { + if (Game::config->GetValue("pets_imagination") == "0") return; + auto playerInventory = item->GetInventory(); if (!playerInventory) return; diff --git a/resources/worldconfig.ini b/resources/worldconfig.ini index b1fec1a6..bba17b38 100644 --- a/resources/worldconfig.ini +++ b/resources/worldconfig.ini @@ -57,3 +57,6 @@ check_fdb=0 # 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). 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