2021-12-05 17:54:36 +00:00
|
|
|
#pragma once
|
|
|
|
|
2022-03-29 02:58:50 +00:00
|
|
|
#include <map>
|
|
|
|
|
|
|
|
#include "Component.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
#include "Entity.h"
|
|
|
|
#include "EntityManager.h"
|
|
|
|
#include "GameMessages.h"
|
2023-03-04 07:16:37 +00:00
|
|
|
#include "eReplicaComponentType.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2023-10-27 01:17:10 +00:00
|
|
|
#include "PropertyData.h"
|
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
/**
|
|
|
|
* Represents the launch pad that's used to select and browse properties
|
|
|
|
*/
|
2022-03-29 02:58:50 +00:00
|
|
|
class PropertyEntranceComponent : public Component {
|
|
|
|
public:
|
2023-03-04 07:16:37 +00:00
|
|
|
static const eReplicaComponentType ComponentType = eReplicaComponentType::PROPERTY_ENTRANCE;
|
2021-12-05 17:54:36 +00:00
|
|
|
explicit PropertyEntranceComponent(uint32_t componentID, Entity* parent);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
2022-03-29 02:58:50 +00:00
|
|
|
* @param index the index of the property property
|
2021-12-05 17:54:36 +00:00
|
|
|
* @param returnToZone whether or not the entity wishes to go back to the launch zone
|
|
|
|
* @param sysAddr the address to send gamemessage responses to
|
|
|
|
*/
|
2022-03-29 02:58:50 +00:00
|
|
|
void OnEnterProperty(Entity* entity, uint32_t index, bool returnToZone, const SystemAddress& sysAddr);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
2021-12-05 17:54:36 +00:00
|
|
|
* @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
|
|
|
|
*/
|
2022-03-29 02:58:50 +00:00
|
|
|
void OnPropertyEntranceSync(Entity* entity, bool includeNullAddress, bool includeNullDescription, bool playerOwn, bool updateUi, int32_t numResults, int32_t lReputationTime, int32_t sortMethod, int32_t startIndex, std::string filterText, const SystemAddress& sysAddr);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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-10-27 01:17:10 +00:00
|
|
|
void PopulateUserFriendMap(uint32_t user);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2023-10-27 01:17:10 +00:00
|
|
|
std::vector<uint32_t> GetPropertyIDsBasedOnParams(const std::string& searchText, uint32_t sortMethod);
|
|
|
|
|
|
|
|
PropertyData GetPropertyData(uint32_t propertyID);
|
|
|
|
PropertyPersonalData GetPropertyPersonalData(PropertyData& propertyData, Entity* queryingUser, bool updatePropertyDataStructure = false);
|
2022-03-29 02:58:50 +00:00
|
|
|
private:
|
2023-10-27 01:17:10 +00:00
|
|
|
std::unordered_map<LWOOBJID, std::vector<uint32_t>> m_UserRequestedCloneMap;
|
|
|
|
std::unordered_map<uint32_t, PropertyData> m_PropertyDataCache;
|
|
|
|
|
|
|
|
std::unordered_map<LWOOBJID, std::unordered_map<LWOOBJID, bool>> m_UserFriendMap;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
|
|
|
enum ePropertySortType : int32_t {
|
|
|
|
SORT_TYPE_FRIENDS = 0,
|
|
|
|
SORT_TYPE_REPUTATION = 1,
|
|
|
|
SORT_TYPE_RECENT = 3,
|
|
|
|
SORT_TYPE_FEATURED = 5
|
|
|
|
};
|
2021-12-05 17:54:36 +00:00
|
|
|
};
|