TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
AuctionHouseBot Class Reference

#include <AuctionHouseBot.h>

Public Member Functions

void Update ()
 
void Initialize ()
 
void SetItemsRatio (uint32 al, uint32 ho, uint32 ne)
 
void SetItemsRatioForHouse (AuctionHouseType house, uint32 val)
 
void SetItemsAmount (uint32(&vals)[MAX_AUCTION_QUALITY])
 
void SetItemsAmountForQuality (AuctionQuality quality, uint32 val)
 
void ReloadAllConfig ()
 
void Rebuild (bool all)
 
void PrepareStatusInfos (AuctionHouseBotStatusInfo &statusInfo)
 

Static Public Member Functions

static AuctionHouseBotinstance ()
 

Private Member Functions

 AuctionHouseBot ()
 
 ~AuctionHouseBot ()
 
 AuctionHouseBot (const AuctionHouseBot &)
 
AuctionHouseBotoperator= (const AuctionHouseBot &)
 
void InitializeAgents ()
 

Private Attributes

AuctionBotBuyer_buyer
 
AuctionBotSeller_seller
 
uint32 _operationSelector
 

Constructor & Destructor Documentation

AuctionHouseBot::AuctionHouseBot ( )
private
322  : _buyer(nullptr), _seller(nullptr), _operationSelector(0)
323 {
324 }
AuctionBotSeller * _seller
Definition: AuctionHouseBot.h:300
AuctionBotBuyer * _buyer
Definition: AuctionHouseBot.h:299
uint32 _operationSelector
Definition: AuctionHouseBot.h:302
AuctionHouseBot::~AuctionHouseBot ( )
private
327 {
328  delete _buyer;
329  delete _seller;
330 }
AuctionBotSeller * _seller
Definition: AuctionHouseBot.h:300
AuctionBotBuyer * _buyer
Definition: AuctionHouseBot.h:299
AuctionHouseBot::AuctionHouseBot ( const AuctionHouseBot )
private

Member Function Documentation

void AuctionHouseBot::Initialize ( )
360 {
361  if (sAuctionBotConfig->Initialize())
363 }
#define sAuctionBotConfig
Definition: AuctionHouseBot.h:252
void InitializeAgents()
Definition: AuctionHouseBot.cpp:332

+ Here is the call graph for this function:

void AuctionHouseBot::InitializeAgents ( )
private
333 {
335  {
336  delete _seller;
337 
338  _seller = new AuctionBotSeller();
339  if (!_seller->Initialize())
340  {
341  delete _seller;
342  _seller = nullptr;
343  }
344  }
345 
347  {
348  delete _buyer;
349 
350  _buyer = new AuctionBotBuyer();
351  if (!_buyer->Initialize())
352  {
353  delete _buyer;
354  _buyer = nullptr;
355  }
356  }
357 }
#define sAuctionBotConfig
Definition: AuctionHouseBot.h:252
AuctionBotSeller * _seller
Definition: AuctionHouseBot.h:300
Definition: AuctionHouseBot.h:172
AuctionBotBuyer * _buyer
Definition: AuctionHouseBot.h:299
Definition: AuctionHouseBotSeller.h:118
Definition: AuctionHouseBotBuyer.h:70
bool Initialize() override
Definition: AuctionHouseBotBuyer.cpp:34
Definition: AuctionHouseBot.h:173
bool Initialize() override
Definition: AuctionHouseBotSeller.cpp:35

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

AuctionHouseBot * AuctionHouseBot::instance ( )
static
436 {
437  static AuctionHouseBot instance;
438  return &instance;
439 }
static AuctionHouseBot * instance()
Definition: AuctionHouseBot.cpp:435
Definition: AuctionHouseBot.h:273
AuctionHouseBot& AuctionHouseBot::operator= ( const AuctionHouseBot )
private
void AuctionHouseBot::PrepareStatusInfos ( AuctionHouseBotStatusInfo statusInfo)
396 {
397  for (uint32 i = 0; i < MAX_AUCTION_HOUSE_TYPE; ++i)
398  {
399  statusInfo[i].ItemsCount = 0;
400 
401  for (int j = 0; j < MAX_AUCTION_QUALITY; ++j)
402  statusInfo[i].QualityInfo[j] = 0;
403 
404  AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(AuctionHouseType(i));
405  for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = auctionHouse->GetAuctionsBegin(); itr != auctionHouse->GetAuctionsEnd(); ++itr)
406  {
407  AuctionEntry* auctionEntry = itr->second;
408  if (Item* item = sAuctionMgr->GetAItem(auctionEntry->itemGUIDLow))
409  {
410  ItemTemplate const* prototype = item->GetTemplate();
411  if (!auctionEntry->owner) // Add only ahbot items
412  {
413  if (prototype->GetQuality() < MAX_AUCTION_QUALITY)
414  ++statusInfo[i].QualityInfo[prototype->GetQuality()];
415 
416  ++statusInfo[i].ItemsCount;
417  }
418  }
419  }
420  }
421 }
AuctionEntryMap::iterator GetAuctionsEnd()
Definition: AuctionHouseMgr.h:114
AuctionHouseType
Definition: AuctionHouseBot.h:40
ObjectGuid::LowType itemGUIDLow
Definition: AuctionHouseMgr.h:71
#define MAX_AUCTION_QUALITY
Definition: AuctionHouseBot.h:38
Definition: AuctionHouseMgr.h:67
AuctionEntryMap::iterator GetAuctionsBegin()
Definition: AuctionHouseMgr.h:113
#define MAX_AUCTION_HOUSE_TYPE
Definition: AuctionHouseBot.h:47
ObjectGuid::LowType owner
Definition: AuctionHouseMgr.h:74
Definition: Item.h:259
uint32_t uint32
Definition: Define.h:150
Definition: ItemTemplate.h:647
#define sAuctionMgr
Definition: AuctionHouseMgr.h:199
Definition: AuctionHouseMgr.h:100
uint32 GetQuality() const
Definition: ItemTemplate.h:655

+ Here is the call graph for this function:

void AuctionHouseBot::Rebuild ( bool  all)
424 {
425  for (uint32 i = 0; i < MAX_AUCTION_HOUSE_TYPE; ++i)
426  {
427  AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(AuctionHouseType(i));
428  for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = auctionHouse->GetAuctionsBegin(); itr != auctionHouse->GetAuctionsEnd(); ++itr)
429  if (!itr->second->owner) // ahbot auction
430  if (all || itr->second->bid == 0) // expire now auction if no bid or forced
431  itr->second->expire_time = sWorld->GetGameTime();
432  }
433 }
AuctionEntryMap::iterator GetAuctionsEnd()
Definition: AuctionHouseMgr.h:114
AuctionHouseType
Definition: AuctionHouseBot.h:40
AuctionEntryMap::iterator GetAuctionsBegin()
Definition: AuctionHouseMgr.h:113
#define sWorld
Definition: World.h:887
bool all(float x)
Definition: g3dmath.h:431
#define MAX_AUCTION_HOUSE_TYPE
Definition: AuctionHouseBot.h:47
uint32_t uint32
Definition: Define.h:150
#define sAuctionMgr
Definition: AuctionHouseMgr.h:199
Definition: AuctionHouseMgr.h:100

+ Here is the call graph for this function:

void AuctionHouseBot::ReloadAllConfig ( )
390 {
391  sAuctionBotConfig->Reload();
393 }
#define sAuctionBotConfig
Definition: AuctionHouseBot.h:252
void InitializeAgents()
Definition: AuctionHouseBot.cpp:332

+ Here is the call graph for this function:

void AuctionHouseBot::SetItemsAmount ( uint32(&)  vals[MAX_AUCTION_QUALITY])
378 {
379  if (_seller)
380  _seller->SetItemsAmount(vals);
381 }
AuctionBotSeller * _seller
Definition: AuctionHouseBot.h:300
void SetItemsAmount(uint32(&vals)[MAX_AUCTION_QUALITY])
Definition: AuctionHouseBotSeller.cpp:880

+ Here is the call graph for this function:

void AuctionHouseBot::SetItemsAmountForQuality ( AuctionQuality  quality,
uint32  val 
)
384 {
385  if (_seller)
386  _seller->SetItemsAmountForQuality(quality, val);
387 }
void SetItemsAmountForQuality(AuctionQuality quality, uint32 val)
Definition: AuctionHouseBotSeller.cpp:894
AuctionBotSeller * _seller
Definition: AuctionHouseBot.h:300

+ Here is the call graph for this function:

void AuctionHouseBot::SetItemsRatio ( uint32  al,
uint32  ho,
uint32  ne 
)
366 {
367  if (_seller)
368  _seller->SetItemsRatio(al, ho, ne);
369 }
AuctionBotSeller * _seller
Definition: AuctionHouseBot.h:300
void SetItemsRatio(uint32 al, uint32 ho, uint32 ne)
Definition: AuctionHouseBotSeller.cpp:856

+ Here is the call graph for this function:

void AuctionHouseBot::SetItemsRatioForHouse ( AuctionHouseType  house,
uint32  val 
)
372 {
373  if (_seller)
374  _seller->SetItemsRatioForHouse(house, val);
375 }
AuctionBotSeller * _seller
Definition: AuctionHouseBot.h:300
void SetItemsRatioForHouse(AuctionHouseType house, uint32 val)
Definition: AuctionHouseBotSeller.cpp:866

+ Here is the call graph for this function:

void AuctionHouseBot::Update ( )
442 {
443  // nothing do...
444  if (!_buyer && !_seller)
445  return;
446 
447  // scan all possible update cases until first success
448  for (uint32 count = 0; count < 2 * MAX_AUCTION_HOUSE_TYPE; ++count)
449  {
450  bool successStep = false;
451 
452  if (_operationSelector < MAX_AUCTION_HOUSE_TYPE)
453  {
454  if (_seller)
456  }
457  else
458  {
459  if (_buyer)
460  successStep = _buyer->Update(AuctionHouseType(_operationSelector - MAX_AUCTION_HOUSE_TYPE));
461  }
462 
464  if (_operationSelector >= 2 * MAX_AUCTION_HOUSE_TYPE)
465  _operationSelector = 0;
466 
467  // one success update per call
468  if (successStep)
469  break;
470  }
471 }
bool Update(AuctionHouseType houseType) override
Definition: AuctionHouseBotSeller.cpp:1045
AuctionBotSeller * _seller
Definition: AuctionHouseBot.h:300
AuctionHouseType
Definition: AuctionHouseBot.h:40
AuctionBotBuyer * _buyer
Definition: AuctionHouseBot.h:299
bool Update(AuctionHouseType houseType) override
Definition: AuctionHouseBotBuyer.cpp:73
#define MAX_AUCTION_HOUSE_TYPE
Definition: AuctionHouseBot.h:47
uint32_t uint32
Definition: Define.h:150
uint32 _operationSelector
Definition: AuctionHouseBot.h:302

+ Here is the call graph for this function:

Member Data Documentation

AuctionBotBuyer* AuctionHouseBot::_buyer
private
uint32 AuctionHouseBot::_operationSelector
private
AuctionBotSeller* AuctionHouseBot::_seller
private

The documentation for this class was generated from the following files: