2018-12-31 23:20:36 +11:00
|
|
|
#ifndef SAPPHIRE_MARKETMGR_H
|
|
|
|
#define SAPPHIRE_MARKETMGR_H
|
|
|
|
|
|
|
|
#include "ForwardsZone.h"
|
|
|
|
#include "BaseManager.h"
|
|
|
|
|
2019-01-01 11:51:48 +11:00
|
|
|
#include <vector>
|
|
|
|
|
2018-12-31 23:20:36 +11:00
|
|
|
namespace Sapphire::World::Manager
|
|
|
|
{
|
|
|
|
class MarketMgr : public Manager::BaseManager
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit MarketMgr( FrameworkPtr pFw );
|
|
|
|
|
|
|
|
bool init();
|
|
|
|
|
2019-01-01 11:51:48 +11:00
|
|
|
void searchMarketboard( Entity::Player& player, uint8_t itemSearchCategory,
|
|
|
|
uint8_t maxEquipLevel, uint8_t classJob,
|
|
|
|
const std::string_view& searchStr, uint32_t requestId,
|
|
|
|
uint32_t startIdx );
|
|
|
|
|
2019-01-01 17:29:06 +11:00
|
|
|
void requestItemListingInfo( Entity::Player& player, uint32_t catalogId, uint32_t requestId );
|
|
|
|
|
|
|
|
void requestItemListings( Entity::Player& player, uint16_t catalogId );
|
2019-01-01 11:51:48 +11:00
|
|
|
|
|
|
|
private:
|
|
|
|
struct ItemSearchResult
|
|
|
|
{
|
|
|
|
uint32_t catalogId;
|
|
|
|
uint16_t quantity;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct MarketableItem
|
|
|
|
{
|
|
|
|
uint32_t catalogId;
|
|
|
|
uint8_t itemSearchCategory;
|
|
|
|
uint8_t maxEquipLevel;
|
2019-01-01 14:19:44 +11:00
|
|
|
uint16_t itemLevel;
|
2019-01-01 11:51:48 +11:00
|
|
|
uint8_t classJob;
|
|
|
|
std::string name;
|
|
|
|
};
|
|
|
|
|
|
|
|
using ItemSearchResultList = std::vector< ItemSearchResult >;
|
|
|
|
using MarketableItemCacheList = std::vector< MarketableItem >;
|
|
|
|
|
|
|
|
MarketableItemCacheList m_marketItemCache;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void findItems( const std::string_view& searchStr, uint8_t itemSearchCat, uint8_t maxEquipLevel, uint8_t classJob,
|
|
|
|
ItemSearchResultList& resultList );
|
2018-12-31 23:20:36 +11:00
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif //SAPPHIRE_MARKETMGR_H
|