mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-04 17:57:47 +00:00
fix structs, disable market cache gen
This commit is contained in:
parent
4fcfc6ecf1
commit
f0202a2094
3 changed files with 51 additions and 47 deletions
|
@ -176,7 +176,7 @@ namespace Sapphire::Network::Packets
|
||||||
|
|
||||||
DirectorVars = 0x01E1, // updated 4.4
|
DirectorVars = 0x01E1, // updated 4.4
|
||||||
|
|
||||||
CFAvailableContents = 0x01FD, // updated 4.2
|
CFAvailableContents = 0xF1FD, // updated 4.2
|
||||||
|
|
||||||
WeatherChange = 0x01FC, // updated 4.4
|
WeatherChange = 0x01FC, // updated 4.4
|
||||||
PlayerTitleList = 0x01FD, // updated 4.4
|
PlayerTitleList = 0x01FD, // updated 4.4
|
||||||
|
|
|
@ -1876,14 +1876,14 @@ struct FFXIVIpcMarketBoardItemListingHistory :
|
||||||
struct MarketListing
|
struct MarketListing
|
||||||
{
|
{
|
||||||
uint32_t salePrice;
|
uint32_t salePrice;
|
||||||
time_t purchaseTime;
|
uint32_t purchaseTime;
|
||||||
uint32_t quantity;
|
uint32_t quantity;
|
||||||
uint16_t unknown1;
|
uint8_t isHq;
|
||||||
uint8_t unknown2;
|
uint8_t padding;
|
||||||
|
uint8_t onMannequin;
|
||||||
|
|
||||||
char sellerName[32];
|
char buyerName[33];
|
||||||
|
|
||||||
uint8_t unknown3;
|
|
||||||
uint32_t itemCatalogId;
|
uint32_t itemCatalogId;
|
||||||
} listing[20];
|
} listing[20];
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,38 +22,41 @@ Sapphire::World::Manager::MarketMgr::MarketMgr( Sapphire::FrameworkPtr pFw ) :
|
||||||
|
|
||||||
bool Sapphire::World::Manager::MarketMgr::init()
|
bool Sapphire::World::Manager::MarketMgr::init()
|
||||||
{
|
{
|
||||||
Logger::info( "MarketMgr: warming up marketable item cache..." );
|
// Logger::info( "MarketMgr: warming up marketable item cache..." );
|
||||||
|
//
|
||||||
// build item cache
|
// // build item cache
|
||||||
auto exdData = framework()->get< Sapphire::Data::ExdDataGenerated >();
|
// auto exdData = framework()->get< Sapphire::Data::ExdDataGenerated >();
|
||||||
auto idList = exdData->getItemIdList();
|
// auto idList = exdData->getItemIdList();
|
||||||
|
//
|
||||||
for( auto id : idList )
|
// for( auto id : idList )
|
||||||
{
|
// {
|
||||||
auto item = exdData->get< Sapphire::Data::Item >( id );
|
// if( id > 10000 )
|
||||||
if( !item )
|
// break;
|
||||||
continue;
|
//
|
||||||
|
// auto item = exdData->get< Sapphire::Data::Item >( id );
|
||||||
if( item->isUntradable )
|
// if( !item )
|
||||||
continue;
|
// continue;
|
||||||
|
//
|
||||||
MarketableItem cacheEntry {};
|
// if( item->isUntradable )
|
||||||
cacheEntry.catalogId = id;
|
// continue;
|
||||||
cacheEntry.itemSearchCategory = item->itemSearchCategory;
|
//
|
||||||
cacheEntry.maxEquipLevel = item->levelEquip;
|
// MarketableItem cacheEntry {};
|
||||||
cacheEntry.name = item->name;
|
// cacheEntry.catalogId = id;
|
||||||
cacheEntry.classJob = item->classJobUse;
|
// cacheEntry.itemSearchCategory = item->itemSearchCategory;
|
||||||
cacheEntry.itemLevel = item->levelItem;
|
// cacheEntry.maxEquipLevel = item->levelEquip;
|
||||||
|
// cacheEntry.name = item->name;
|
||||||
m_marketItemCache.push_back( std::move( cacheEntry ) );
|
// cacheEntry.classJob = item->classJobUse;
|
||||||
}
|
// cacheEntry.itemLevel = item->levelItem;
|
||||||
|
//
|
||||||
std::sort( m_marketItemCache.begin(), m_marketItemCache.end(), []( const MarketableItem& a, const MarketableItem& b )
|
// m_marketItemCache.push_back( std::move( cacheEntry ) );
|
||||||
{
|
// }
|
||||||
return a.itemLevel > b.itemLevel;
|
//
|
||||||
} );
|
// std::sort( m_marketItemCache.begin(), m_marketItemCache.end(), []( const MarketableItem& a, const MarketableItem& b )
|
||||||
|
// {
|
||||||
Logger::info( "MarketMgr: Cached " + std::to_string( m_marketItemCache.size() ) + " marketable items" );
|
// return a.itemLevel > b.itemLevel;
|
||||||
|
// } );
|
||||||
|
//
|
||||||
|
// Logger::info( "MarketMgr: Cached " + std::to_string( m_marketItemCache.size() ) + " marketable items" );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -72,20 +75,21 @@ void Sapphire::World::Manager::MarketMgr::requestItemListingInfo( Sapphire::Enti
|
||||||
historyPkt->data().itemCatalogId = catalogId;
|
historyPkt->data().itemCatalogId = catalogId;
|
||||||
historyPkt->data().itemCatalogId2 = catalogId;
|
historyPkt->data().itemCatalogId2 = catalogId;
|
||||||
|
|
||||||
memset( &historyPkt->data().listing, 0x0, sizeof( Server::FFXIVIpcMarketBoardItemListingHistory::MarketListing ) * 20 );
|
std::string name = "fix game pls se :(((";
|
||||||
|
|
||||||
std::string name = "fix game";
|
for( int i = 0; i < 10; i++ )
|
||||||
|
|
||||||
for( int i = 0; i < 10; ++i )
|
|
||||||
{
|
{
|
||||||
auto& listing = historyPkt->data().listing[ i ];
|
auto& listing = historyPkt->data().listing[ i ];
|
||||||
|
|
||||||
listing.itemCatalogId = catalogId;
|
listing.itemCatalogId = catalogId;
|
||||||
listing.quantity = i;
|
listing.quantity = i + 1;
|
||||||
listing.purchaseTime = time( nullptr );
|
listing.purchaseTime = time( nullptr );
|
||||||
listing.salePrice = 500;
|
listing.salePrice = 69420420;
|
||||||
|
listing.isHq = 1;
|
||||||
|
listing.onMannequin = 1;
|
||||||
|
|
||||||
strcpy( listing.sellerName, name.c_str() );
|
|
||||||
|
strcpy( listing.buyerName, name.c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
player.queuePacket( historyPkt );
|
player.queuePacket( historyPkt );
|
||||||
|
@ -119,7 +123,7 @@ void Sapphire::World::Manager::MarketMgr::searchMarketboard( Entity::Player& pla
|
||||||
|
|
||||||
data.itemCatalogId = item.catalogId;
|
data.itemCatalogId = item.catalogId;
|
||||||
data.quantity = item.quantity;
|
data.quantity = item.quantity;
|
||||||
data.demand = 69;
|
data.demand = 420;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( size < 20 )
|
if( size < 20 )
|
||||||
|
@ -132,7 +136,7 @@ void Sapphire::World::Manager::MarketMgr::searchMarketboard( Entity::Player& pla
|
||||||
|
|
||||||
void Sapphire::World::Manager::MarketMgr::requestItemListings( Sapphire::Entity::Player& player, uint16_t catalogId )
|
void Sapphire::World::Manager::MarketMgr::requestItemListings( Sapphire::Entity::Player& player, uint16_t catalogId )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::World::Manager::MarketMgr::findItems( const std::string_view& searchStr, uint8_t itemSearchCat,
|
void Sapphire::World::Manager::MarketMgr::findItems( const std::string_view& searchStr, uint8_t itemSearchCat,
|
||||||
|
|
Loading…
Add table
Reference in a new issue