mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 06:27:45 +00:00
somewhat working marketboard implementation
This commit is contained in:
parent
717acba9cb
commit
cd19435876
6 changed files with 58 additions and 9 deletions
|
@ -1860,11 +1860,11 @@ struct FFXIVIpcMarketBoardSearchResult :
|
||||||
struct FFFXIVIpcMarketBoardItemListingCount :
|
struct FFFXIVIpcMarketBoardItemListingCount :
|
||||||
FFXIVIpcBasePacket< MarketBoardItemListingCount >
|
FFXIVIpcBasePacket< MarketBoardItemListingCount >
|
||||||
{
|
{
|
||||||
uint32_t itemCatalogId;
|
uint32_t itemCatalogId;
|
||||||
uint32_t unknown1; // does some shit if nonzero
|
uint32_t unknown1; // does some shit if nonzero
|
||||||
uint16_t unknown2;
|
uint16_t requestId;
|
||||||
uint16_t quantity; // high/low u8s read separately?
|
uint16_t quantity; // high/low u8s read separately?
|
||||||
uint32_t padding3;
|
uint32_t unknown3;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FFXIVIpcMarketBoardItemListingHistory :
|
struct FFXIVIpcMarketBoardItemListingHistory :
|
||||||
|
|
|
@ -58,12 +58,37 @@ bool Sapphire::World::Manager::MarketMgr::init()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::World::Manager::MarketMgr::requestItemListings( Sapphire::Entity::Player& player, uint32_t catalogId,
|
void Sapphire::World::Manager::MarketMgr::requestItemListingInfo( Sapphire::Entity::Player& player, uint32_t catalogId,
|
||||||
uint32_t requestId )
|
uint32_t requestId )
|
||||||
{
|
{
|
||||||
auto countPkt = makeZonePacket< Server::FFFXIVIpcMarketBoardItemListingCount >( player.getId() );
|
auto countPkt = makeZonePacket< Server::FFFXIVIpcMarketBoardItemListingCount >( player.getId() );
|
||||||
countPkt->data().quantity = 1;
|
countPkt->data().quantity = 1 << 8;
|
||||||
countPkt->data().itemCatalogId = catalogId;
|
countPkt->data().itemCatalogId = catalogId;
|
||||||
|
countPkt->data().requestId = requestId;
|
||||||
|
|
||||||
|
player.queuePacket( countPkt );
|
||||||
|
|
||||||
|
auto historyPkt = makeZonePacket< Server::FFXIVIpcMarketBoardItemListingHistory >( player.getId() );
|
||||||
|
historyPkt->data().itemCatalogId = catalogId;
|
||||||
|
historyPkt->data().itemCatalogId2 = catalogId;
|
||||||
|
|
||||||
|
memset( &historyPkt->data().listing, 0x0, sizeof( Server::FFXIVIpcMarketBoardItemListingHistory::MarketListing ) * 20 );
|
||||||
|
|
||||||
|
std::string name = "fix game";
|
||||||
|
|
||||||
|
for( int i = 0; i < 10; ++i )
|
||||||
|
{
|
||||||
|
auto& listing = historyPkt->data().listing[ i ];
|
||||||
|
|
||||||
|
listing.itemCatalogId = catalogId;
|
||||||
|
listing.quantity = i;
|
||||||
|
listing.purchaseTime = time( nullptr );
|
||||||
|
listing.salePrice = 500;
|
||||||
|
|
||||||
|
strcpy( listing.sellerName, name.c_str() );
|
||||||
|
}
|
||||||
|
|
||||||
|
player.queuePacket( historyPkt );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -105,6 +130,11 @@ void Sapphire::World::Manager::MarketMgr::searchMarketboard( Entity::Player& pla
|
||||||
player.queuePacket( resultPkt );
|
player.queuePacket( resultPkt );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
uint8_t maxEquipLevel, uint8_t classJob,
|
uint8_t maxEquipLevel, uint8_t classJob,
|
||||||
Sapphire::World::Manager::MarketMgr::ItemSearchResultList& resultList )
|
Sapphire::World::Manager::MarketMgr::ItemSearchResultList& resultList )
|
||||||
|
|
|
@ -20,7 +20,9 @@ namespace Sapphire::World::Manager
|
||||||
const std::string_view& searchStr, uint32_t requestId,
|
const std::string_view& searchStr, uint32_t requestId,
|
||||||
uint32_t startIdx );
|
uint32_t startIdx );
|
||||||
|
|
||||||
void requestItemListings( Entity::Player& player, uint32_t catalogId, uint32_t requestId );
|
void requestItemListingInfo( Entity::Player& player, uint32_t catalogId, uint32_t requestId );
|
||||||
|
|
||||||
|
void requestItemListings( Entity::Player& player, uint16_t catalogId );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct ItemSearchResult
|
struct ItemSearchResult
|
||||||
|
|
|
@ -126,6 +126,8 @@ Sapphire::Network::GameConnection::GameConnection( Sapphire::Network::HivePtr pH
|
||||||
setZoneHandler( ClientZoneIpcType::MarketBoardSearch, "MarketBoardSearch", &GameConnection::marketBoardSearch );
|
setZoneHandler( ClientZoneIpcType::MarketBoardSearch, "MarketBoardSearch", &GameConnection::marketBoardSearch );
|
||||||
setZoneHandler( ClientZoneIpcType::MarketBoardRequestItemListingInfo, "MarketBoardRequestItemListingInfo",
|
setZoneHandler( ClientZoneIpcType::MarketBoardRequestItemListingInfo, "MarketBoardRequestItemListingInfo",
|
||||||
&GameConnection::marketBoardRequestItemInfo );
|
&GameConnection::marketBoardRequestItemInfo );
|
||||||
|
setZoneHandler( ClientZoneIpcType::MarketBoardRequestItemListings, "MarketBoardRequestItemListings",
|
||||||
|
&GameConnection::marketBoardRequestItemListings );
|
||||||
|
|
||||||
setChatHandler( ClientChatIpcType::TellReq, "TellReq", &GameConnection::tellHandler );
|
setChatHandler( ClientChatIpcType::TellReq, "TellReq", &GameConnection::tellHandler );
|
||||||
|
|
||||||
|
|
|
@ -180,6 +180,8 @@ namespace Sapphire::Network
|
||||||
|
|
||||||
DECLARE_HANDLER( marketBoardRequestItemInfo );
|
DECLARE_HANDLER( marketBoardRequestItemInfo );
|
||||||
|
|
||||||
|
DECLARE_HANDLER( marketBoardRequestItemListings );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -777,4 +777,17 @@ void Sapphire::Network::GameConnection::marketBoardRequestItemInfo( FrameworkPtr
|
||||||
const auto packet = ZoneChannelPacket< Client::FFXIVIpcMarketBoardRequestItemListingInfo >( inPacket );
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcMarketBoardRequestItemListingInfo >( inPacket );
|
||||||
|
|
||||||
auto marketMgr = pFw->get< MarketMgr >();
|
auto marketMgr = pFw->get< MarketMgr >();
|
||||||
|
|
||||||
|
marketMgr->requestItemListingInfo( player, packet.data().catalogId, packet.data().requestId );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sapphire::Network::GameConnection::marketBoardRequestItemListings( FrameworkPtr pFw,
|
||||||
|
const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||||
|
Entity::Player& player )
|
||||||
|
{
|
||||||
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcMarketBoardRequestItemListings >( inPacket );
|
||||||
|
|
||||||
|
auto marketMgr = pFw->get< MarketMgr >();
|
||||||
|
|
||||||
|
marketMgr->requestItemListings( player, packet.data().itemCatalogId );
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue