mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 14:57:44 +00:00
fix oob error on market board result lists and correctly sort the items
This commit is contained in:
parent
0aa1fab9a4
commit
a37525d002
6 changed files with 15 additions and 6 deletions
|
@ -264,7 +264,7 @@ namespace Sapphire::Network::Packets
|
||||||
|
|
||||||
LinkshellListHandler = 0x00F4, // updated 4.3
|
LinkshellListHandler = 0x00F4, // updated 4.3
|
||||||
|
|
||||||
MarketBoardRequestItemInformation = 0x00FE, // updated 4.4
|
MarketBoardRequestItemListingInfo = 0x00FE, // updated 4.4
|
||||||
MarketBoardRequestItemListings = 0x00FF, // updated 4.4
|
MarketBoardRequestItemListings = 0x00FF, // updated 4.4
|
||||||
MarketBoardSearch = 0x0103, // updated 4.4
|
MarketBoardSearch = 0x0103, // updated 4.4
|
||||||
|
|
||||||
|
|
|
@ -284,8 +284,8 @@ struct FFXIVIpcMarketBoardSearch :
|
||||||
/* 0032 */ uint16_t unk4[43];
|
/* 0032 */ uint16_t unk4[43];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FFXIVIpcMarketBoardRequestItemInformation :
|
struct FFXIVIpcMarketBoardRequestItemListingInfo :
|
||||||
FFXIVIpcBasePacket< MarketBoardRequestItemInformation >
|
FFXIVIpcBasePacket< MarketBoardRequestItemListingInfo >
|
||||||
{
|
{
|
||||||
/* 0000 */ uint32_t catalogId;
|
/* 0000 */ uint32_t catalogId;
|
||||||
/* 0000 */ uint32_t requestId;
|
/* 0000 */ uint32_t requestId;
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
#include "Actor/Player.h"
|
#include "Actor/Player.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
|
|
||||||
Sapphire::World::Manager::MarketMgr::MarketMgr( Sapphire::FrameworkPtr pFw ) :
|
Sapphire::World::Manager::MarketMgr::MarketMgr( Sapphire::FrameworkPtr pFw ) :
|
||||||
|
@ -41,10 +43,16 @@ bool Sapphire::World::Manager::MarketMgr::init()
|
||||||
cacheEntry.maxEquipLevel = item->levelEquip;
|
cacheEntry.maxEquipLevel = item->levelEquip;
|
||||||
cacheEntry.name = item->name;
|
cacheEntry.name = item->name;
|
||||||
cacheEntry.classJob = item->classJobUse;
|
cacheEntry.classJob = item->classJobUse;
|
||||||
|
cacheEntry.itemLevel = item->levelItem;
|
||||||
|
|
||||||
m_marketItemCache.push_back( std::move( cacheEntry ) );
|
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: Cached " + std::to_string( m_marketItemCache.size() ) + " marketable items" );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -79,7 +87,7 @@ void Sapphire::World::Manager::MarketMgr::searchMarketboard( Entity::Player& pla
|
||||||
resultPkt->data().itemIndexStart = startIdx;
|
resultPkt->data().itemIndexStart = startIdx;
|
||||||
resultPkt->data().requestId = requestId;
|
resultPkt->data().requestId = requestId;
|
||||||
|
|
||||||
for( auto i = 0; i < resultList.size(); i++ )
|
for( auto i = 0; i < size; i++ )
|
||||||
{
|
{
|
||||||
auto& item = resultList.at( startIdx + i );
|
auto& item = resultList.at( startIdx + i );
|
||||||
auto& data = resultPkt->data().items[ i ];
|
auto& data = resultPkt->data().items[ i ];
|
||||||
|
|
|
@ -34,6 +34,7 @@ namespace Sapphire::World::Manager
|
||||||
uint32_t catalogId;
|
uint32_t catalogId;
|
||||||
uint8_t itemSearchCategory;
|
uint8_t itemSearchCategory;
|
||||||
uint8_t maxEquipLevel;
|
uint8_t maxEquipLevel;
|
||||||
|
uint16_t itemLevel;
|
||||||
uint8_t classJob;
|
uint8_t classJob;
|
||||||
std::string name;
|
std::string name;
|
||||||
};
|
};
|
||||||
|
|
|
@ -124,7 +124,7 @@ Sapphire::Network::GameConnection::GameConnection( Sapphire::Network::HivePtr pH
|
||||||
setZoneHandler( ClientZoneIpcType::PerformNoteHandler, "PerformNoteHandler", &GameConnection::performNoteHandler );
|
setZoneHandler( ClientZoneIpcType::PerformNoteHandler, "PerformNoteHandler", &GameConnection::performNoteHandler );
|
||||||
|
|
||||||
setZoneHandler( ClientZoneIpcType::MarketBoardSearch, "MarketBoardSearch", &GameConnection::marketBoardSearch );
|
setZoneHandler( ClientZoneIpcType::MarketBoardSearch, "MarketBoardSearch", &GameConnection::marketBoardSearch );
|
||||||
setZoneHandler( ClientZoneIpcType::MarketBoardRequestItemInformation, "MarketBoardRequestItemInformation",
|
setZoneHandler( ClientZoneIpcType::MarketBoardRequestItemListingInfo, "MarketBoardRequestItemListingInfo",
|
||||||
&GameConnection::marketBoardRequestItemInfo );
|
&GameConnection::marketBoardRequestItemInfo );
|
||||||
|
|
||||||
setChatHandler( ClientChatIpcType::TellReq, "TellReq", &GameConnection::tellHandler );
|
setChatHandler( ClientChatIpcType::TellReq, "TellReq", &GameConnection::tellHandler );
|
||||||
|
|
|
@ -774,7 +774,7 @@ void Sapphire::Network::GameConnection::marketBoardRequestItemInfo( FrameworkPtr
|
||||||
const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||||
Entity::Player& player )
|
Entity::Player& player )
|
||||||
{
|
{
|
||||||
const auto packet = ZoneChannelPacket< Client::FFXIVIpcMarketBoardRequestItemInformation >( inPacket );
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcMarketBoardRequestItemListingInfo >( inPacket );
|
||||||
|
|
||||||
auto marketMgr = pFw->get< MarketMgr >();
|
auto marketMgr = pFw->get< MarketMgr >();
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue