AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
AuctionListItemsDelayEvent Class Reference

#include "AsyncAuctionListing.h"

Public Member Functions

 AuctionListItemsDelayEvent (Milliseconds pickupTimer, ObjectGuid playerguid, ObjectGuid creatureguid, std::string searchedname, uint32 listfrom, uint8 levelmin, uint8 levelmax, uint8 usable, uint32 auctionSlotID, uint32 auctionMainCategory, uint32 auctionSubCategory, uint32 quality, uint8 getAll, AuctionSortOrderVector sortOrder)
 
bool Execute ()
 

Public Attributes

Milliseconds _pickupTimer
 
ObjectGuid _playerguid
 
ObjectGuid _creatureguid
 
std::string _searchedname
 
uint32 _listfrom
 
uint8 _levelmin
 
uint8 _levelmax
 
uint8 _usable
 
uint32 _auctionSlotID
 
uint32 _auctionMainCategory
 
uint32 _auctionSubCategory
 
uint32 _quality
 
uint8 _getAll
 
AuctionSortOrderVector _sortOrder
 

Detailed Description

Constructor & Destructor Documentation

◆ AuctionListItemsDelayEvent()

AuctionListItemsDelayEvent::AuctionListItemsDelayEvent ( Milliseconds  pickupTimer,
ObjectGuid  playerguid,
ObjectGuid  creatureguid,
std::string  searchedname,
uint32  listfrom,
uint8  levelmin,
uint8  levelmax,
uint8  usable,
uint32  auctionSlotID,
uint32  auctionMainCategory,
uint32  auctionSubCategory,
uint32  quality,
uint8  getAll,
AuctionSortOrderVector  sortOrder 
)
inline
43 :
44 _pickupTimer(pickupTimer), _playerguid(playerguid), _creatureguid(creatureguid), _searchedname(searchedname), _listfrom(listfrom), _levelmin(levelmin), _levelmax(levelmax),_usable(usable),
45 _auctionSlotID(auctionSlotID), _auctionMainCategory(auctionMainCategory), _auctionSubCategory(auctionSubCategory), _quality(quality), _getAll(getAll), _sortOrder(sortOrder) { }
uint32 _listfrom
Definition: AsyncAuctionListing.h:53
uint8 _usable
Definition: AsyncAuctionListing.h:56
uint8 _levelmax
Definition: AsyncAuctionListing.h:55
ObjectGuid _playerguid
Definition: AsyncAuctionListing.h:50
ObjectGuid _creatureguid
Definition: AsyncAuctionListing.h:51
std::string _searchedname
Definition: AsyncAuctionListing.h:52
uint32 _quality
Definition: AsyncAuctionListing.h:60
Milliseconds _pickupTimer
Definition: AsyncAuctionListing.h:49
uint32 _auctionSlotID
Definition: AsyncAuctionListing.h:57
uint8 _levelmin
Definition: AsyncAuctionListing.h:54
uint32 _auctionMainCategory
Definition: AsyncAuctionListing.h:58
AuctionSortOrderVector _sortOrder
Definition: AsyncAuctionListing.h:62
uint32 _auctionSubCategory
Definition: AsyncAuctionListing.h:59
uint8 _getAll
Definition: AsyncAuctionListing.h:61

Member Function Documentation

◆ Execute()

bool AuctionListItemsDelayEvent::Execute ( )
38{
40 if (!plr || !plr->IsInWorld() || plr->IsDuringRemoveFromWorld() || plr->IsBeingTeleported())
41 return true;
42
44 if (!creature)
45 return true;
46
47 AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->GetFaction());
48
49 WorldPacket data(SMSG_AUCTION_LIST_RESULT, (4 + 4 + 4) + 50 * ((16 + MAX_INSPECTED_ENCHANTMENT_SLOT * 3) * 4));
50 uint32 count = 0;
51 uint32 totalcount = 0;
52 data << (uint32) 0;
53
54 // converting string that we try to find to lower case
55 std::wstring wsearchedname;
56 if (!Utf8toWStr(_searchedname, wsearchedname))
57 return true;
58
59 wstrToLower(wsearchedname);
60
61 uint32 searchTimeout = sWorld->getIntConfig(CONFIG_AUCTION_HOUSE_SEARCH_TIMEOUT);
62 bool result = auctionHouse->BuildListAuctionItems(data, plr,
63 wsearchedname, _listfrom, _levelmin, _levelmax, _usable,
65 count, totalcount, _getAll, _sortOrder, Milliseconds(searchTimeout));
66
67 if (result)
68 {
69 data.put<uint32>(0, count);
70 data << (uint32) totalcount;
71 data << (uint32) 300; // clientside search cooldown [ms] (gray search button)
72 plr->GetSession()->SendPacket(&data);
73 }
74
75 return true;
76}
bool Utf8toWStr(char const *utf8str, std::size_t csize, wchar_t *wstr, std::size_t &wsize)
Definition: Util.cpp:281
void wstrToLower(std::wstring &str)
Definition: Util.cpp:382
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition: Duration.h:27
std::uint32_t uint32
Definition: Define.h:107
#define sAuctionMgr
Definition: AuctionHouseMgr.h:227
@ CONFIG_AUCTION_HOUSE_SEARCH_TIMEOUT
Definition: IWorld.h:424
@ UNIT_NPC_FLAG_AUCTIONEER
Definition: UnitDefines.h:315
@ MAX_INSPECTED_ENCHANTMENT_SLOT
Definition: Item.h:176
@ SMSG_AUCTION_LIST_RESULT
Definition: Opcodes.h:634
#define sWorld
Definition: World.h:444
Player * FindPlayer(ObjectGuid const guid)
Definition: ObjectAccessor.cpp:248
Definition: AuctionHouseMgr.h:130
bool BuildListAuctionItems(WorldPacket &data, Player *player, std::wstring const &searchedname, uint32 listfrom, uint8 levelmin, uint8 levelmax, uint8 usable, uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality, uint32 &count, uint32 &totalcount, uint8 getAll, AuctionSortOrderVector const &sortOrder, Milliseconds searchTimeout)
Definition: AuctionHouseMgr.cpp:733
Definition: Creature.h:46
bool IsInWorld() const
Definition: Object.h:104
Definition: Player.h:1064
WorldSession * GetSession() const
Definition: Player.h:1978
Creature * GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask)
Definition: Player.cpp:2075
bool IsBeingTeleported() const
Definition: Player.h:2070
uint32 GetFaction() const
Definition: Unit.h:755
bool IsDuringRemoveFromWorld() const
Definition: Unit.h:1712
Definition: WorldPacket.h:27
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition: WorldSession.cpp:214

References _auctionMainCategory, _auctionSlotID, _auctionSubCategory, _creatureguid, _getAll, _levelmax, _levelmin, _listfrom, _playerguid, _quality, _searchedname, _sortOrder, _usable, AuctionHouseObject::BuildListAuctionItems(), CONFIG_AUCTION_HOUSE_SEARCH_TIMEOUT, ObjectAccessor::FindPlayer(), Unit::GetFaction(), Player::GetNPCIfCanInteractWith(), Player::GetSession(), Player::IsBeingTeleported(), Unit::IsDuringRemoveFromWorld(), Object::IsInWorld(), MAX_INSPECTED_ENCHANTMENT_SLOT, ByteBuffer::put(), sAuctionMgr, WorldSession::SendPacket(), SMSG_AUCTION_LIST_RESULT, sWorld, UNIT_NPC_FLAG_AUCTIONEER, Utf8toWStr(), and wstrToLower().

Member Data Documentation

◆ _auctionMainCategory

uint32 AuctionListItemsDelayEvent::_auctionMainCategory

Referenced by Execute().

◆ _auctionSlotID

uint32 AuctionListItemsDelayEvent::_auctionSlotID

Referenced by Execute().

◆ _auctionSubCategory

uint32 AuctionListItemsDelayEvent::_auctionSubCategory

Referenced by Execute().

◆ _creatureguid

ObjectGuid AuctionListItemsDelayEvent::_creatureguid

Referenced by Execute().

◆ _getAll

uint8 AuctionListItemsDelayEvent::_getAll

Referenced by Execute().

◆ _levelmax

uint8 AuctionListItemsDelayEvent::_levelmax

Referenced by Execute().

◆ _levelmin

uint8 AuctionListItemsDelayEvent::_levelmin

Referenced by Execute().

◆ _listfrom

uint32 AuctionListItemsDelayEvent::_listfrom

Referenced by Execute().

◆ _pickupTimer

Milliseconds AuctionListItemsDelayEvent::_pickupTimer

◆ _playerguid

ObjectGuid AuctionListItemsDelayEvent::_playerguid

Referenced by Execute().

◆ _quality

uint32 AuctionListItemsDelayEvent::_quality

Referenced by Execute().

◆ _searchedname

std::string AuctionListItemsDelayEvent::_searchedname

Referenced by Execute().

◆ _sortOrder

AuctionSortOrderVector AuctionListItemsDelayEvent::_sortOrder

Referenced by Execute().

◆ _usable

uint8 AuctionListItemsDelayEvent::_usable

Referenced by Execute().