diff --git a/dCommon/dEnums/dCommonVars.h b/dCommon/dEnums/dCommonVars.h index a071dff3..b2688c96 100644 --- a/dCommon/dEnums/dCommonVars.h +++ b/dCommon/dEnums/dCommonVars.h @@ -59,6 +59,7 @@ const uint64_t LWOZONEID_INVALID = 0; //!< Invalid LWOZONEID const LOT LOT_ZONE_CONTROL = 2365; const LOT LOT_3D_AMBIENT_SOUND = 6368; const LOT LOT_MODEL_IN_WORLD = 14; +const LOT LOT_THINKING_CAP = 6086; const float PI = 3.14159f; diff --git a/dGame/dComponents/BuffComponent.cpp b/dGame/dComponents/BuffComponent.cpp index 3c80b990..b048fa61 100644 --- a/dGame/dComponents/BuffComponent.cpp +++ b/dGame/dComponents/BuffComponent.cpp @@ -125,10 +125,6 @@ void BuffComponent::RemoveBuff(int32_t id, bool fromUnEquip, bool removeImmunity RemoveBuffEffect(id); } -bool BuffComponent::HasBuff(int32_t id) { - return m_Buffs.find(id) != m_Buffs.end(); -} - void BuffComponent::ApplyBuffEffect(int32_t id) { const auto& parameters = GetBuffParameters(id); for (const auto& parameter : parameters) { diff --git a/dGame/dComponents/BuffComponent.h b/dGame/dComponents/BuffComponent.h index 0219e0ff..c3f9066b 100644 --- a/dGame/dComponents/BuffComponent.h +++ b/dGame/dComponents/BuffComponent.h @@ -88,7 +88,7 @@ public: * @param id the id of the buff to find * @return whether or not the entity has a buff with the specified id active */ - bool HasBuff(int32_t id); + bool HasBuff(int32_t id) { return m_Buffs.find(id) != m_Buffs.end(); }; /** * Applies the effects of the buffs on the entity, e.g.: changing armor, health, imag, etc. diff --git a/dGame/dComponents/BuildBorderComponent.cpp b/dGame/dComponents/BuildBorderComponent.cpp index 72dc0606..217d2b78 100644 --- a/dGame/dComponents/BuildBorderComponent.cpp +++ b/dGame/dComponents/BuildBorderComponent.cpp @@ -9,62 +9,40 @@ #include "Item.h" #include "PropertyManagementComponent.h" -BuildBorderComponent::BuildBorderComponent(Entity* parent) : Component(parent) { -} - -BuildBorderComponent::~BuildBorderComponent() { -} - void BuildBorderComponent::OnUse(Entity* originator) { - if (originator->GetCharacter()) { - const auto& entities = EntityManager::Instance()->GetEntitiesInGroup("PropertyPlaque"); + if (!originator->GetCharacter()) return; - auto buildArea = m_ParentEntity->GetObjectID(); + const auto& entities = EntityManager::Instance()->GetEntitiesInGroup("PropertyPlaque"); - if (!entities.empty()) { - buildArea = entities[0]->GetObjectID(); + auto buildArea = entities.empty() ? m_ParentEntity->GetObjectID() : entities.front()->GetObjectID(); - Game::logger->Log("BuildBorderComponent", "Using PropertyPlaque"); - } + auto* inventoryComponent = originator->GetComponent(); - auto* inventoryComponent = originator->GetComponent(); + if (!inventoryComponent) return; - if (inventoryComponent == nullptr) { - return; - } + auto* thinkingHat = inventoryComponent->FindItemByLot(LOT_THINKING_CAP); - auto* thinkingHat = inventoryComponent->FindItemByLot(6086); + if (!thinkingHat) return; - if (thinkingHat == nullptr) { - return; - } + Game::logger->Log("BuildBorderComponent", "Using BuildArea %llu for player %llu", buildArea, originator->GetObjectID()); - inventoryComponent->PushEquippedItems(); + inventoryComponent->PushEquippedItems(); - Game::logger->Log("BuildBorderComponent", "Starting with %llu", buildArea); - - if (PropertyManagementComponent::Instance() != nullptr) { - GameMessages::SendStartArrangingWithItem( - originator, - originator->GetSystemAddress(), - true, - buildArea, - originator->GetPosition(), - 0, - thinkingHat->GetId(), - thinkingHat->GetLot(), - 4, - 0, - -1, - NiPoint3::ZERO, - 0 - ); - } else { - GameMessages::SendStartArrangingWithItem(originator, originator->GetSystemAddress(), true, buildArea, originator->GetPosition()); - } - - auto* inv = m_ParentEntity->GetComponent(); - if (!inv) return; - inv->PushEquippedItems(); // technically this is supposed to happen automatically... but it doesnt? so just keep this here + if (PropertyManagementComponent::Instance()) { + GameMessages::SendStartArrangingWithItem( + originator, + originator->GetSystemAddress(), + true, + buildArea, + originator->GetPosition(), + 0, + thinkingHat->GetId(), + thinkingHat->GetLot(), + 4, + 0, + -1 + ); + } else { + GameMessages::SendStartArrangingWithItem(originator, originator->GetSystemAddress(), true, buildArea, originator->GetPosition()); } } diff --git a/dGame/dComponents/BuildBorderComponent.h b/dGame/dComponents/BuildBorderComponent.h index 985c0388..be2e4378 100644 --- a/dGame/dComponents/BuildBorderComponent.h +++ b/dGame/dComponents/BuildBorderComponent.h @@ -6,8 +6,6 @@ #ifndef BUILDBORDERCOMPONENT_H #define BUILDBORDERCOMPONENT_H -#include "BitStream.h" -#include "Entity.h" #include "Component.h" #include "eReplicaComponentType.h" @@ -18,15 +16,13 @@ class BuildBorderComponent : public Component { public: inline static const eReplicaComponentType ComponentType = eReplicaComponentType::BUILD_BORDER; - BuildBorderComponent(Entity* parent); - ~BuildBorderComponent() override; + BuildBorderComponent(Entity* parent) : Component(parent) { }; /** * Causes the originator to start build with this entity as a reference point * @param originator the entity (probably a player) that triggered the event */ void OnUse(Entity* originator) override; -private: }; #endif // BUILDBORDERCOMPONENT_H