DarkflameServer/dGame/dComponents/PropertyEntranceComponent.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

89 lines
3.0 KiB
C
Raw Normal View History

#pragma once
#include <map>
#include "Component.h"
#include "eReplicaComponentType.h"
#include "PropertySelectQueryProperty.h"
2023-07-11 07:02:59 +00:00
enum class ePropertySortType : int32_t {
SORT_TYPE_FRIENDS = 0,
SORT_TYPE_REPUTATION = 1,
SORT_TYPE_RECENT = 3,
SORT_TYPE_FEATURED = 5
};
/**
* Represents the launch pad that's used to select and browse properties
*/
2023-07-11 07:02:59 +00:00
class PropertyEntranceComponent final : public Component {
public:
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::PROPERTY_ENTRANCE;
2023-07-11 07:02:59 +00:00
explicit PropertyEntranceComponent(Entity* parent, int32_t componentID);
2023-07-11 05:18:42 +00:00
void LoadTemplateData() override;
/**
* Handles an OnUse request for some other entity, rendering the property browse menu
* @param entity the entity that triggered the event
*/
void OnUse(Entity* entity) override;
/**
* Handles the event triggered when the entity selects a property to visit and makes the entity to there
* @param entity the entity that triggered the event
* @param index the index of the property property
* @param returnToZone whether or not the entity wishes to go back to the launch zone
* @param sysAddr the address to send gamemessage responses to
*/
void OnEnterProperty(Entity* entity, uint32_t index, bool returnToZone, const SystemAddress& sysAddr);
/**
* Handles a request for information on available properties when an entity lands on the property
* @param entity the entity that triggered the event
* @param includeNullAddress unused
* @param includeNullDescription unused
* @param playerOwn only query properties owned by the entity
* @param updateUi unused
* @param numResults unused
2022-03-28 10:24:49 +00:00
* @param lReputationTime unused
* @param sortMethod unused
* @param startIndex the minimum index to start the query off
* @param filterText property names to search for
* @param sysAddr the address to send gamemessage responses to
*/
2023-07-11 07:02:59 +00:00
void OnPropertyEntranceSync(Entity* entity, bool includeNullAddress, bool includeNullDescription, bool playerOwn, bool updateUi, int32_t numResults, int32_t lReputationTime, ePropertySortType sortMethod, int32_t startIndex, std::string filterText, const SystemAddress& sysAddr);
/**
* Returns the name of this property
* @return the name of this property
*/
[[nodiscard]] std::string GetPropertyName() const { return m_PropertyName; };
/**
* Returns the map ID for this property
* @return the map ID for this property
*/
[[nodiscard]] LWOMAPID GetMapID() const { return m_MapID; };
2023-07-11 07:02:59 +00:00
[[nodiscard]] static std::string BuildQuery(const ePropertySortType sortMethod, Character* character, const std::string& customQuery = "", const bool wantLimits = true);
private:
/**
* Cache of property information that was queried for property launched, indexed by property ID
*/
std::map<LWOOBJID, std::vector<PropertySelectQueryProperty>> propertyQueries;
/**
* The custom name for this property
*/
std::string m_PropertyName;
/**
* The base map ID for this property (Avant Grove, etc).
*/
LWOMAPID m_MapID;
2022-03-28 03:04:45 +00:00
2023-07-11 05:18:42 +00:00
int32_t m_ComponentId = -1;
};