// this void is called when player clicks on search button void WorldSession::HandleAuctionListItems( WorldPacket & recv_data ) { DEBUG_LOG("WORLD: HandleAuctionListItems"); ObjectGuid auctioneerGuid; std::string searchedname; uint8 levelmin, levelmax, usable, isFull, sortCount; uint32 listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality; recv_data >> auctioneerGuid; recv_data >> listfrom; // start, used for page control listing by 50 elements recv_data >> searchedname; recv_data >> levelmin >> levelmax; recv_data >> auctionSlotID >> auctionMainCategory >> auctionSubCategory >> quality; recv_data >> usable >> isFull >> sortCount; // auction columns sorting for(uint32 i = 0; i < sortCount; ++i) { recv_data.read_skip<uint8>(); // column? recv_data.read_skip<uint8>(); // direction? } AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid); if (!auctionHouseEntry) return; // always return pointer AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry); // remove fake death if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); //DEBUG_LOG("Auctionhouse search %s list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", // auctioneerGuid.GetString().c_str(), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable); WorldPacket data( SMSG_AUCTION_LIST_RESULT, (4+4+4) ); uint32 count = 0; uint32 totalcount = 0; data << uint32(0); // converting string that we try to find to lower case std::wstring wsearchedname; if(!Utf8toWStr(searchedname,wsearchedname)) return; wstrToLower(wsearchedname); auctionHouse->BuildListAuctionItems(data, _player, wsearchedname, listfrom, levelmin, levelmax, usable, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, count, totalcount); data.put<uint32>(0, count); data << uint32(totalcount); data << uint32(300); // 2.3.0 delay for next list request? SendPacket(&data); }
//this void is called when player clicks on search button void WorldSession::HandleAuctionListItems(WorldPackets::AuctionHouse::AuctionListItems& packet) { Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(packet.Auctioneer, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { TC_LOG_DEBUG("network", "WORLD: HandleAuctionListItems - %s not found or you can't interact with him.", packet.Auctioneer.ToString().c_str()); return; } // remove fake death if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction()); TC_LOG_DEBUG("auctionHouse", "Auctionhouse search (%s), searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", packet.Auctioneer.ToString().c_str(), packet.Name.c_str(), packet.MinLevel, packet.MaxLevel , packet.InvType, packet.ItemClass, packet.ItemSubclass, packet.Quality, packet.OnlyUsable); WorldPackets::AuctionHouse::AuctionListItemsResult result; // converting string that we try to find to lower case std::wstring wsearchedname; if (!Utf8toWStr(packet.Name, wsearchedname)) return; wstrToLower(wsearchedname); auctionHouse->BuildListAuctionItems(result, _player, wsearchedname, packet.Offset, packet.MinLevel, packet.MaxLevel, packet.OnlyUsable, packet.InvType, packet.ItemClass, packet.ItemSubclass, packet.Quality, result.TotalCount); result.DesiredDelay = 300; result.OnlyUsable = packet.OnlyUsable; SendPacket(result.Write()); }
//this void is called when player clicks on search button void WorldSession::HandleAuctionListItems( WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data,8+4+1+1+1+4+4+4+4+1); std::string searchedname; uint8 levelmin, levelmax, usable; uint32 listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality; uint64 guid; recv_data >> guid; recv_data >> listfrom; // start, used for page control listing by 50 elements recv_data >> searchedname; // recheck with known string size CHECK_PACKET_SIZE(recv_data,8+4+(searchedname.size()+1)+1+1+4+4+4+4+1); recv_data >> levelmin >> levelmax; recv_data >> auctionSlotID >> auctionMainCategory >> auctionSubCategory; recv_data >> quality >> usable; Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_AUCTIONEER); if (!pCreature) { sLog.outDebug( "WORLD: HandleAuctionListItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) ); return; } // remove fake death if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap( pCreature->getFaction() ); //sLog.outDebug("Auctionhouse search (GUID: %u TypeId: %u)", , list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", // GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid)), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable); WorldPacket data( SMSG_AUCTION_LIST_RESULT, (4+4+4) ); uint32 count = 0; uint32 totalcount = 0; data << (uint32) 0; // converting string that we try to find to lower case std::wstring wsearchedname; if(!Utf8toWStr(searchedname,wsearchedname)) return; wstrToLower(wsearchedname); auctionHouse->BuildListAuctionItems(data,_player, wsearchedname, listfrom, levelmin, levelmax, usable, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, count,totalcount); data.put<uint32>(0, count); data << (uint32) totalcount; data << (uint32) 300; // unk 2.3.0 const? SendPacket(&data); }
// this void is called when player clicks on search button void WorldSession::HandleAuctionListItems(WorldPacket& recv_data) { DEBUG_LOG("WORLD: HandleAuctionListItems"); ObjectGuid auctioneerGuid; std::string searchedname; uint8 levelmin, levelmax, usable; uint32 listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality; recv_data >> auctioneerGuid; recv_data >> listfrom; // start, used for page control listing by 50 elements recv_data >> searchedname; recv_data >> levelmin >> levelmax; recv_data >> auctionSlotID >> auctionMainCategory >> auctionSubCategory >> quality; recv_data >> usable; AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid); if (!auctionHouseEntry) return; // always return pointer AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry); // DEBUG_LOG("Auctionhouse search %s list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", // auctioneerGuid.GetString().c_str(), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable); WorldPacket data(SMSG_AUCTION_LIST_RESULT, (4 + 4)); uint32 count = 0; uint32 totalcount = 0; data << uint32(0); // converting string that we try to find to lower case std::wstring wsearchedname; if (!Utf8toWStr(searchedname, wsearchedname)) return; wstrToLower(wsearchedname); auctionHouse->BuildListAuctionItems(data, _player, wsearchedname, listfrom, levelmin, levelmax, usable, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, count, totalcount); data.put<uint32>(0, count); data << uint32(totalcount); SendPacket(data); }
bool AuctionListItemsDelayEvent::Execute() { Player* plr = ObjectAccessor::FindPlayer(_playerguid); if (!plr || !plr->IsInWorld() || plr->IsDuringRemoveFromWorld() || plr->IsBeingTeleported()) return true; Creature* creature = plr->GetNPCIfCanInteractWith(_creatureguid, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) return true; AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction()); //sLog->outDebug("Auctionhouse search (GUID: %u TypeId: %u)",, list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", // GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid)), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable); WorldPacket data(SMSG_AUCTION_LIST_RESULT, (4+4+4)+50*((16+MAX_INSPECTED_ENCHANTMENT_SLOT*3)*4)); uint32 count = 0; uint32 totalcount = 0; data << (uint32) 0; // converting string that we try to find to lower case std::wstring wsearchedname; if (!Utf8toWStr(_searchedname, wsearchedname)) return true; wstrToLower(wsearchedname); bool result = auctionHouse->BuildListAuctionItems(data, plr, wsearchedname, _listfrom, _levelmin, _levelmax, _usable, _auctionSlotID, _auctionMainCategory, _auctionSubCategory, _quality, count, totalcount, _getAll); if (!result) return false; data.put<uint32>(0, count); data << (uint32) totalcount; data << (uint32) 300; // clientside search cooldown [ms] (gray search button) plr->GetSession()->SendPacket(&data); return true; }
//this void is called when player clicks on search button void WorldSession::HandleAuctionListItems(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_ITEMS"); std::string searchedname; uint8 levelmin, levelmax, usable; uint32 listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality; ObjectGuid guid; recvData >> guid; recvData >> listfrom; // start, used for page control listing by 50 elements recvData >> searchedname; recvData >> levelmin >> levelmax; recvData >> auctionSlotID >> auctionMainCategory >> auctionSubCategory; recvData >> quality >> usable; recvData.read_skip<uint8>(); // unk // this block looks like it uses some lame byte packing or similar... uint8 unkCnt; recvData >> unkCnt; for (uint8 i = 0; i < unkCnt; i++) { recvData.read_skip<uint8>(); recvData.read_skip<uint8>(); } Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { TC_LOG_DEBUG("network", "WORLD: HandleAuctionListItems - %s not found or you can't interact with him.", guid.ToString().c_str()); return; } // remove fake death if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction()); TC_LOG_DEBUG("auctionHouse", "Auctionhouse search (%s) list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", guid.ToString().c_str(), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable); WorldPacket data(SMSG_AUCTION_LIST_RESULT, (4+4+4)); uint32 count = 0; uint32 totalcount = 0; data << (uint32) 0; // converting string that we try to find to lower case std::wstring wsearchedname; if (!Utf8toWStr(searchedname, wsearchedname)) return; wstrToLower(wsearchedname); auctionHouse->BuildListAuctionItems(data, _player, wsearchedname, listfrom, levelmin, levelmax, usable, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, count, totalcount); data.put<uint32>(0, count); data << (uint32) totalcount; data << (uint32) 300; // unk 2.3.0 const? SendPacket(&data); }
//this void is called when player clicks on search button void WorldSession::HandleAuctionListItems(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_ITEMS"); uint8 levelmin, levelmax, unkbyte; uint32 listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, dword148; ObjectGuid guid; recvData >> auctionSubCategory; recvData >> levelmin; recvData >> quality; recvData >> listfrom; recvData >> unkbyte; recvData >> auctionMainCategory; recvData >> auctionSlotID; recvData >> levelmax; recvData >> dword148; // this block looks like it uses some lame byte packing or similar... for (uint32 i = 0; i < dword148; i++) recvData.read_skip<uint8>(); auto searchedname_len = recvData.ReadBits(8); bool test1 = recvData.ReadBit(); guid[4] = recvData.ReadBit(); guid[0] = recvData.ReadBit(); guid[6] = recvData.ReadBit(); guid[2] = recvData.ReadBit(); bool usable = recvData.ReadBit(); guid[5] = recvData.ReadBit(); guid[7] = recvData.ReadBit(); guid[1] = recvData.ReadBit(); guid[3] = recvData.ReadBit(); recvData.FlushBits(); std::string searchedname = recvData.ReadString(searchedname_len); recvData.ReadByteSeq(guid[4]); recvData.ReadByteSeq(guid[6]); recvData.ReadByteSeq(guid[2]); recvData.ReadByteSeq(guid[0]); recvData.ReadByteSeq(guid[7]); recvData.ReadByteSeq(guid[1]); recvData.ReadByteSeq(guid[5]); recvData.ReadByteSeq(guid[3]); Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionListItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } // remove fake death if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction()); //sLog->outDebug(LOG_FILTER_GENERAL, "Auctionhouse search (GUID: %u TypeId: %u)",, list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", // GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid)), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable); WorldPacket data(SMSG_AUCTION_LIST_RESULT, (4 + 4 + 4)); uint32 count = 0; uint32 totalcount = 0; data << uint32(0); // converting string that we try to find to lower case std::wstring wsearchedname; if (!Utf8toWStr(searchedname, wsearchedname)) return; wstrToLower(wsearchedname); auctionHouse->BuildListAuctionItems(data, _player, wsearchedname, listfrom, levelmin, levelmax, usable, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, count, totalcount); data.put<uint32>(0, count); data << uint32(totalcount); data << uint32(300); //unk 2.3.0 SendPacket(&data); }
//this void is called when player clicks on search button void WorldSession::HandleAuctionListItems(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_ITEMS"); ObjectGuid auctioneer; std::string searchString; uint8 levelMin, levelMax, searchStringLen, Unk; uint32 listFrom, auctionSlotId, auctionMainCategory, auctionSubCategory, quality, sortCount; bool usableItems, exactMatch; recvData >> listFrom; // start, used for page control listing by 50 elements recvData >> auctioneer; recvData >> levelMin; recvData >> levelMax; recvData >> auctionSlotId; recvData >> auctionMainCategory; recvData >> auctionSubCategory; recvData >> quality; recvData >> Unk; searchStringLen = recvData.ReadBits(8); recvData.FlushBits(); searchString = recvData.ReadString(searchStringLen); usableItems = recvData.ReadBit(); exactMatch = recvData.ReadBit(); recvData.FlushBits(); recvData >> sortCount; for (uint8 i = 0; i < sortCount; i++) recvData.read_skip<uint8>(); // sorts currently unhandle Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { TC_LOG_DEBUG("network", "WORLD: HandleAuctionListItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); return; } // remove fake death if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction()); //TC_LOG_DEBUG("misc", "Auctionhouse search (GUID: %u TypeId: %u)",, list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", // GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid)), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable); uint32 count = 0; uint32 totalcount = 0; WorldPacket data(SMSG_AUCTION_LIST_RESULT, 500); // guess size data << uint32(0); // amount place holder data << uint32(AUCTION_SEARCH_DELAY); data << uint32(totalcount); // converting string that we try to find to lower case std::wstring wsearchedname; if (!Utf8toWStr(searchString, wsearchedname)) return; wstrToLower(wsearchedname); auctionHouse->BuildListAuctionItems(data, _player, wsearchedname, listFrom, levelMin, levelMax, usableItems, auctionSlotId, auctionMainCategory, auctionSubCategory, quality, count, totalcount); data.WriteBit(usableItems); data.put<uint32>(0, count); SendPacket(&data); }
//this void is called when player clicks on search button void WorldSession::HandleAuctionListItems(WorldPacket& recv_data) { std::string searchedname; uint8 levelmin, levelmax, usable; uint32 listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality; uint64 guid; recv_data >> guid; recv_data >> listfrom; // start, used for page control listing by 50 elements recv_data >> searchedname; recv_data >> levelmin >> levelmax; recv_data >> auctionSlotID >> auctionMainCategory >> auctionSubCategory; recv_data >> quality >> usable; recv_data.read_skip<uint8>(); // unk // this block looks like it uses some lame byte packing or similar... uint8 unkCnt; recv_data >> unkCnt; for (uint8 i = 0; i < unkCnt; i++) { recv_data.read_skip<uint8>(); recv_data.read_skip<uint8>(); } Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER); if (!pCreature) { sLog.outDebug("WORLD: HandleAuctionListItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } // remove fake death if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction()); //sLog.outDebug("Auctionhouse search (GUID: %u TypeId: %u)", , list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid)), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable); WorldPacket data(SMSG_AUCTION_LIST_RESULT, (4+4+4)); uint32 count = 0; uint32 totalcount = 0; data << uint32(0); // converting string that we try to find to lower case std::wstring wsearchedname; if (!Utf8toWStr(searchedname,wsearchedname)) return; wstrToLower(wsearchedname); auctionHouse->BuildListAuctionItems(data, _player, wsearchedname, listfrom, levelmin, levelmax, usable, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, count, totalcount); data.put<uint32>(0, count); data << uint32(totalcount); data << uint32(300); // 2.3.0 delay for next list request? SendPacket(&data); }