mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-26 07:27:18 +00:00
BuildBorderCleanup
This commit is contained in:
parent
d29287f9d9
commit
fdcfbdee85
@ -59,6 +59,7 @@ const uint64_t LWOZONEID_INVALID = 0; //!< Invalid LWOZONEID
|
|||||||
const LOT LOT_ZONE_CONTROL = 2365;
|
const LOT LOT_ZONE_CONTROL = 2365;
|
||||||
const LOT LOT_3D_AMBIENT_SOUND = 6368;
|
const LOT LOT_3D_AMBIENT_SOUND = 6368;
|
||||||
const LOT LOT_MODEL_IN_WORLD = 14;
|
const LOT LOT_MODEL_IN_WORLD = 14;
|
||||||
|
const LOT LOT_THINKING_CAP = 6086;
|
||||||
|
|
||||||
|
|
||||||
const float PI = 3.14159f;
|
const float PI = 3.14159f;
|
||||||
|
@ -125,10 +125,6 @@ void BuffComponent::RemoveBuff(int32_t id, bool fromUnEquip, bool removeImmunity
|
|||||||
RemoveBuffEffect(id);
|
RemoveBuffEffect(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BuffComponent::HasBuff(int32_t id) {
|
|
||||||
return m_Buffs.find(id) != m_Buffs.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BuffComponent::ApplyBuffEffect(int32_t id) {
|
void BuffComponent::ApplyBuffEffect(int32_t id) {
|
||||||
const auto& parameters = GetBuffParameters(id);
|
const auto& parameters = GetBuffParameters(id);
|
||||||
for (const auto& parameter : parameters) {
|
for (const auto& parameter : parameters) {
|
||||||
|
@ -88,7 +88,7 @@ public:
|
|||||||
* @param id the id of the buff to find
|
* @param id the id of the buff to find
|
||||||
* @return whether or not the entity has a buff with the specified id active
|
* @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.
|
* Applies the effects of the buffs on the entity, e.g.: changing armor, health, imag, etc.
|
||||||
|
@ -9,62 +9,40 @@
|
|||||||
#include "Item.h"
|
#include "Item.h"
|
||||||
#include "PropertyManagementComponent.h"
|
#include "PropertyManagementComponent.h"
|
||||||
|
|
||||||
BuildBorderComponent::BuildBorderComponent(Entity* parent) : Component(parent) {
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildBorderComponent::~BuildBorderComponent() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void BuildBorderComponent::OnUse(Entity* originator) {
|
void BuildBorderComponent::OnUse(Entity* originator) {
|
||||||
if (originator->GetCharacter()) {
|
if (!originator->GetCharacter()) return;
|
||||||
const auto& entities = EntityManager::Instance()->GetEntitiesInGroup("PropertyPlaque");
|
|
||||||
|
|
||||||
auto buildArea = m_ParentEntity->GetObjectID();
|
const auto& entities = EntityManager::Instance()->GetEntitiesInGroup("PropertyPlaque");
|
||||||
|
|
||||||
if (!entities.empty()) {
|
auto buildArea = entities.empty() ? m_ParentEntity->GetObjectID() : entities.front()->GetObjectID();
|
||||||
buildArea = entities[0]->GetObjectID();
|
|
||||||
|
|
||||||
Game::logger->Log("BuildBorderComponent", "Using PropertyPlaque");
|
auto* inventoryComponent = originator->GetComponent<InventoryComponent>();
|
||||||
}
|
|
||||||
|
|
||||||
auto* inventoryComponent = originator->GetComponent<InventoryComponent>();
|
if (!inventoryComponent) return;
|
||||||
|
|
||||||
if (inventoryComponent == nullptr) {
|
auto* thinkingHat = inventoryComponent->FindItemByLot(LOT_THINKING_CAP);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto* thinkingHat = inventoryComponent->FindItemByLot(6086);
|
if (!thinkingHat) return;
|
||||||
|
|
||||||
if (thinkingHat == nullptr) {
|
Game::logger->Log("BuildBorderComponent", "Using BuildArea %llu for player %llu", buildArea, originator->GetObjectID());
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
inventoryComponent->PushEquippedItems();
|
inventoryComponent->PushEquippedItems();
|
||||||
|
|
||||||
Game::logger->Log("BuildBorderComponent", "Starting with %llu", buildArea);
|
if (PropertyManagementComponent::Instance()) {
|
||||||
|
GameMessages::SendStartArrangingWithItem(
|
||||||
if (PropertyManagementComponent::Instance() != nullptr) {
|
originator,
|
||||||
GameMessages::SendStartArrangingWithItem(
|
originator->GetSystemAddress(),
|
||||||
originator,
|
true,
|
||||||
originator->GetSystemAddress(),
|
buildArea,
|
||||||
true,
|
originator->GetPosition(),
|
||||||
buildArea,
|
0,
|
||||||
originator->GetPosition(),
|
thinkingHat->GetId(),
|
||||||
0,
|
thinkingHat->GetLot(),
|
||||||
thinkingHat->GetId(),
|
4,
|
||||||
thinkingHat->GetLot(),
|
0,
|
||||||
4,
|
-1
|
||||||
0,
|
);
|
||||||
-1,
|
} else {
|
||||||
NiPoint3::ZERO,
|
GameMessages::SendStartArrangingWithItem(originator, originator->GetSystemAddress(), true, buildArea, originator->GetPosition());
|
||||||
0
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
GameMessages::SendStartArrangingWithItem(originator, originator->GetSystemAddress(), true, buildArea, originator->GetPosition());
|
|
||||||
}
|
|
||||||
|
|
||||||
auto* inv = m_ParentEntity->GetComponent<InventoryComponent>();
|
|
||||||
if (!inv) return;
|
|
||||||
inv->PushEquippedItems(); // technically this is supposed to happen automatically... but it doesnt? so just keep this here
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
#ifndef BUILDBORDERCOMPONENT_H
|
#ifndef BUILDBORDERCOMPONENT_H
|
||||||
#define BUILDBORDERCOMPONENT_H
|
#define BUILDBORDERCOMPONENT_H
|
||||||
|
|
||||||
#include "BitStream.h"
|
|
||||||
#include "Entity.h"
|
|
||||||
#include "Component.h"
|
#include "Component.h"
|
||||||
#include "eReplicaComponentType.h"
|
#include "eReplicaComponentType.h"
|
||||||
|
|
||||||
@ -18,15 +16,13 @@ class BuildBorderComponent : public Component {
|
|||||||
public:
|
public:
|
||||||
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::BUILD_BORDER;
|
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::BUILD_BORDER;
|
||||||
|
|
||||||
BuildBorderComponent(Entity* parent);
|
BuildBorderComponent(Entity* parent) : Component(parent) { };
|
||||||
~BuildBorderComponent() override;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Causes the originator to start build with this entity as a reference point
|
* Causes the originator to start build with this entity as a reference point
|
||||||
* @param originator the entity (probably a player) that triggered the event
|
* @param originator the entity (probably a player) that triggered the event
|
||||||
*/
|
*/
|
||||||
void OnUse(Entity* originator) override;
|
void OnUse(Entity* originator) override;
|
||||||
private:
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BUILDBORDERCOMPONENT_H
|
#endif // BUILDBORDERCOMPONENT_H
|
||||||
|
Loading…
Reference in New Issue
Block a user