mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-05-23 15:22:28 +00:00
PropertyVendorComponent pass
This commit is contained in:
parent
a37ec326b9
commit
c204ea4009
@ -10,34 +10,30 @@
|
|||||||
#include "PropertyManagementComponent.h"
|
#include "PropertyManagementComponent.h"
|
||||||
#include "UserManager.h"
|
#include "UserManager.h"
|
||||||
|
|
||||||
PropertyVendorComponent::PropertyVendorComponent(Entity* parent) : Component(parent) {
|
PropertyVendorComponent::PropertyVendorComponent(Entity* parent) : Component(parent) { }
|
||||||
}
|
|
||||||
|
|
||||||
void PropertyVendorComponent::OnUse(Entity* originator) {
|
void PropertyVendorComponent::OnUse(Entity* originator) {
|
||||||
if (PropertyManagementComponent::Instance() == nullptr) return;
|
if (!PropertyManagementComponent::Instance()) return;
|
||||||
|
|
||||||
OnQueryPropertyData(originator, originator->GetSystemAddress());
|
OnQueryPropertyData(originator, originator->GetSystemAddress());
|
||||||
|
|
||||||
if (PropertyManagementComponent::Instance()->GetOwnerId() == LWOOBJID_EMPTY) {
|
if (PropertyManagementComponent::Instance()->GetOwnerId() != LWOOBJID_EMPTY) return;
|
||||||
Game::logger->Log("PropertyVendorComponent", "Property vendor opening!");
|
Game::logger->Log("PropertyVendorComponent", "Property vendor opening!");
|
||||||
|
|
||||||
GameMessages::SendOpenPropertyVendor(m_ParentEntity->GetObjectID(), originator->GetSystemAddress());
|
GameMessages::SendOpenPropertyVendor(m_ParentEntity->GetObjectID(), originator->GetSystemAddress());
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertyVendorComponent::OnQueryPropertyData(Entity* originator, const SystemAddress& sysAddr) {
|
void PropertyVendorComponent::OnQueryPropertyData(Entity* originator, const SystemAddress& sysAddr) {
|
||||||
if (PropertyManagementComponent::Instance() == nullptr) return;
|
if (!PropertyManagementComponent::Instance()) return;
|
||||||
|
|
||||||
PropertyManagementComponent::Instance()->OnQueryPropertyData(originator, sysAddr, m_ParentEntity->GetObjectID());
|
PropertyManagementComponent::Instance()->OnQueryPropertyData(originator, sysAddr, m_ParentEntity->GetObjectID());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertyVendorComponent::OnBuyFromVendor(Entity* originator, const bool confirmed, const LOT lot, const uint32_t count) {
|
void PropertyVendorComponent::OnBuyFromVendor(Entity* originator, const bool confirmed, const LOT lot, const uint32_t count) {
|
||||||
if (PropertyManagementComponent::Instance() == nullptr) return;
|
if (!PropertyManagementComponent::Instance()) return;
|
||||||
|
|
||||||
if (PropertyManagementComponent::Instance()->Claim(originator->GetObjectID()) == false) {
|
if (!PropertyManagementComponent::Instance()->Claim(originator->GetObjectID())) {
|
||||||
Game::logger->Log("PropertyVendorComponent", "FAILED TO CLAIM PROPERTY. PLAYER ID IS %llu", originator->GetObjectID());
|
Game::logger->Log("PropertyVendorComponent", "Player %llu attempted to claim a property that did not belong to them.", originator->GetObjectID());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,6 +47,6 @@ void PropertyVendorComponent::OnBuyFromVendor(Entity* originator, const bool con
|
|||||||
|
|
||||||
PropertyManagementComponent::Instance()->OnQueryPropertyData(originator, originator->GetSystemAddress());
|
PropertyManagementComponent::Instance()->OnQueryPropertyData(originator, originator->GetSystemAddress());
|
||||||
|
|
||||||
Game::logger->Log("PropertyVendorComponent", "Fired event; (%d) (%i) (%i)", confirmed, lot, count);
|
Game::logger->Log("PropertyVendorComponent", "Fired event, (%d) (%i) (%i)", confirmed, lot, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
/**
|
/**
|
||||||
* The property guard that stands on a property before it's claimed, allows entities to attempt claiming this property.
|
* The property guard that stands on a property before it's claimed, allows entities to attempt claiming this property.
|
||||||
*/
|
*/
|
||||||
class PropertyVendorComponent : public Component
|
class PropertyVendorComponent final : public Component
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::PROPERTY_VENDOR;
|
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::PROPERTY_VENDOR;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user