From f0202a2094de8b1f3cb6df1d18493b8d4a34fd7a Mon Sep 17 00:00:00 2001 From: NotAdam Date: Tue, 1 Jan 2019 23:37:32 +1100 Subject: [PATCH] fix structs, disable market cache gen --- src/common/Network/PacketDef/Ipcs.h | 2 +- .../Network/PacketDef/Zone/ServerZoneDef.h | 10 +-- src/world/Manager/MarketMgr.cpp | 86 ++++++++++--------- 3 files changed, 51 insertions(+), 47 deletions(-) diff --git a/src/common/Network/PacketDef/Ipcs.h b/src/common/Network/PacketDef/Ipcs.h index bdfc08fb..bca4b286 100644 --- a/src/common/Network/PacketDef/Ipcs.h +++ b/src/common/Network/PacketDef/Ipcs.h @@ -176,7 +176,7 @@ namespace Sapphire::Network::Packets DirectorVars = 0x01E1, // updated 4.4 - CFAvailableContents = 0x01FD, // updated 4.2 + CFAvailableContents = 0xF1FD, // updated 4.2 WeatherChange = 0x01FC, // updated 4.4 PlayerTitleList = 0x01FD, // updated 4.4 diff --git a/src/common/Network/PacketDef/Zone/ServerZoneDef.h b/src/common/Network/PacketDef/Zone/ServerZoneDef.h index 18618ab9..e1f3980e 100644 --- a/src/common/Network/PacketDef/Zone/ServerZoneDef.h +++ b/src/common/Network/PacketDef/Zone/ServerZoneDef.h @@ -1876,14 +1876,14 @@ struct FFXIVIpcMarketBoardItemListingHistory : struct MarketListing { uint32_t salePrice; - time_t purchaseTime; + uint32_t purchaseTime; uint32_t quantity; - uint16_t unknown1; - uint8_t unknown2; + uint8_t isHq; + uint8_t padding; + uint8_t onMannequin; - char sellerName[32]; + char buyerName[33]; - uint8_t unknown3; uint32_t itemCatalogId; } listing[20]; }; diff --git a/src/world/Manager/MarketMgr.cpp b/src/world/Manager/MarketMgr.cpp index e1a6d3bd..d18d28e1 100644 --- a/src/world/Manager/MarketMgr.cpp +++ b/src/world/Manager/MarketMgr.cpp @@ -22,38 +22,41 @@ Sapphire::World::Manager::MarketMgr::MarketMgr( Sapphire::FrameworkPtr pFw ) : bool Sapphire::World::Manager::MarketMgr::init() { - Logger::info( "MarketMgr: warming up marketable item cache..." ); - - // build item cache - auto exdData = framework()->get< Sapphire::Data::ExdDataGenerated >(); - auto idList = exdData->getItemIdList(); - - for( auto id : idList ) - { - auto item = exdData->get< Sapphire::Data::Item >( id ); - if( !item ) - continue; - - if( item->isUntradable ) - continue; - - MarketableItem cacheEntry {}; - cacheEntry.catalogId = id; - cacheEntry.itemSearchCategory = item->itemSearchCategory; - cacheEntry.maxEquipLevel = item->levelEquip; - cacheEntry.name = item->name; - cacheEntry.classJob = item->classJobUse; - cacheEntry.itemLevel = item->levelItem; - - m_marketItemCache.push_back( std::move( cacheEntry ) ); - } - - std::sort( m_marketItemCache.begin(), m_marketItemCache.end(), []( const MarketableItem& a, const MarketableItem& b ) - { - return a.itemLevel > b.itemLevel; - } ); - - Logger::info( "MarketMgr: Cached " + std::to_string( m_marketItemCache.size() ) + " marketable items" ); +// Logger::info( "MarketMgr: warming up marketable item cache..." ); +// +// // build item cache +// auto exdData = framework()->get< Sapphire::Data::ExdDataGenerated >(); +// auto idList = exdData->getItemIdList(); +// +// for( auto id : idList ) +// { +// if( id > 10000 ) +// break; +// +// auto item = exdData->get< Sapphire::Data::Item >( id ); +// if( !item ) +// continue; +// +// if( item->isUntradable ) +// continue; +// +// MarketableItem cacheEntry {}; +// cacheEntry.catalogId = id; +// cacheEntry.itemSearchCategory = item->itemSearchCategory; +// cacheEntry.maxEquipLevel = item->levelEquip; +// cacheEntry.name = item->name; +// cacheEntry.classJob = item->classJobUse; +// cacheEntry.itemLevel = item->levelItem; +// +// m_marketItemCache.push_back( std::move( cacheEntry ) ); +// } +// +// std::sort( m_marketItemCache.begin(), m_marketItemCache.end(), []( const MarketableItem& a, const MarketableItem& b ) +// { +// return a.itemLevel > b.itemLevel; +// } ); +// +// Logger::info( "MarketMgr: Cached " + std::to_string( m_marketItemCache.size() ) + " marketable items" ); return true; } @@ -72,20 +75,21 @@ void Sapphire::World::Manager::MarketMgr::requestItemListingInfo( Sapphire::Enti historyPkt->data().itemCatalogId = 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 ]; listing.itemCatalogId = catalogId; - listing.quantity = i; + listing.quantity = i + 1; 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 ); @@ -119,7 +123,7 @@ void Sapphire::World::Manager::MarketMgr::searchMarketboard( Entity::Player& pla data.itemCatalogId = item.catalogId; data.quantity = item.quantity; - data.demand = 69; + data.demand = 420; } 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::findItems( const std::string_view& searchStr, uint8_t itemSearchCat,