fix(Core/AuctionHouse): Implemented sorting. Based on @r00ty-tc work. (#9011)

Fixes #8728
This commit is contained in:
UltraNix
2021-11-16 17:32:12 +01:00
committed by GitHub
parent eed40ce78a
commit 3895487dc2
5 changed files with 401 additions and 129 deletions

View File

@@ -727,28 +727,40 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recvData)
uint8 getAll;
recvData >> getAll;
// this block looks like it uses some lame byte packing or similar...
uint8 unkCnt;
recvData >> unkCnt;
for (uint8 i = 0; i < unkCnt; i++)
// Read sort block
uint8 sortOrderCount;
recvData >> sortOrderCount;
AuctionSortOrderVector sortOrder;
for (uint8 i = 0; i < sortOrderCount; i++)
{
recvData.read_skip<uint8>();
recvData.read_skip<uint8>();
uint8 sortMode;
uint8 isDesc;
recvData >> sortMode;
recvData >> isDesc;
AuctionSortInfo sortInfo;
sortInfo.isDesc = (isDesc == 1);
sortInfo.sortOrder = static_cast<AuctionSortOrder>(sortMode);
sortOrder.push_back(std::move(sortInfo));
}
// remove fake death
if (_player->HasUnitState(UNIT_STATE_DIED))
{
_player->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
}
// pussywizard:
const uint32 delay = 2000;
const uint32 now = World::GetGameTimeMS();
uint32 diff = getMSTimeDiff(_lastAuctionListItemsMSTime, now);
if (diff > delay)
{
diff = delay;
}
_lastAuctionListItemsMSTime = now + delay - diff;
std::lock_guard<std::mutex> guard(AsyncAuctionListingMgr::GetTempLock());
AsyncAuctionListingMgr::GetTempList().push_back( AuctionListItemsDelayEvent(delay - diff, _player->GetGUID(), guid, searchedname, listfrom, levelmin, levelmax, usable, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, getAll) );
AsyncAuctionListingMgr::GetTempList().push_back(AuctionListItemsDelayEvent(delay - diff, _player->GetGUID(), guid, searchedname, listfrom, levelmin, levelmax, usable, auctionSlotID,
auctionMainCategory, auctionSubCategory, quality, getAll, sortOrder));
}
void WorldSession::HandleAuctionListPendingSales(WorldPacket& recvData)