cleaned up file and added helper functions

This commit is contained in:
EmosewaMC
2022-03-28 19:58:50 -07:00
parent 17b0de8062
commit 965d4c7af0
2 changed files with 98 additions and 101 deletions

View File

@@ -1,17 +1,17 @@
#pragma once
#include <map>
#include "Component.h"
#include "Entity.h"
#include "EntityManager.h"
#include "GameMessages.h"
#include "Component.h"
#include <map>
/**
* Represents the launch pad that's used to select and browse properties
*/
class PropertyEntranceComponent : public Component
{
public:
class PropertyEntranceComponent : public Component {
public:
static const uint32_t ComponentType = COMPONENT_TYPE_PROPERTY_ENTRANCE;
explicit PropertyEntranceComponent(uint32_t componentID, Entity* parent);
@@ -24,11 +24,11 @@ public:
/**
* 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 clone ID of the property to visit
* @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);
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
@@ -44,17 +44,7 @@ public:
* @param filterText property names to search for
* @param sysAddr the address to send gamemessage responses to
*/
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);
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);
/**
* Returns the name of this property
@@ -68,8 +58,12 @@ public:
*/
[[nodiscard]] LWOMAPID GetMapID() const { return m_MapID; };
private:
PropertySelectQueryProperty SetPropertyValues(PropertySelectQueryProperty property, LWOCLONEID cloneId = LWOCLONEID_INVALID, std::string ownerName = "", std::string propertyName = "", std::string propertyDescription = "",
uint32_t reputation = 0, bool isBFF = false, bool isFriend = false, bool isModeratorApproved = false, bool isAlt = false, bool isOwned = false, uint32_t privacyOption = 0, uint32_t timeLastUpdated = 0, uint64_t performanceCost = 0);
std::string BuildQuery(Entity* entity, int32_t sortMethod);
private:
/**
* Cache of property information that was queried for property launched, indexed by property ID
*/
@@ -91,4 +85,6 @@ private:
SORT_TYPE_RECENT = 3,
SORT_TYPE_FEATURED = 5
};
const std::string baseQueryForProperties = "SELECT p.* FROM properties as p JOIN charinfo as ci ON ci.prop_clone_id = p.clone_id where p.zone_id = ? AND (p.description LIKE ? OR p.name LIKE ? OR ci.name LIKE ?) AND p.mod_approved >= ? AND p.privacy_option >= ? ";
};