OregonCore  revision fb2a440-git
Your Favourite TBC server
AuctionEntry Struct Reference

#include <AuctionHouseMgr.h>

Public Member Functions

uint32 GetHouseId () const
 
uint32 GetHouseFaction () const
 
uint32 GetAuctionCut () const
 
uint32 GetAuctionOutBid () const
 
bool BuildAuctionInfo (WorldPacket &data) const
 
void DeleteFromDB () const
 
void SaveToDB () const
 

Public Attributes

uint32 Id
 
uint32 auctioneer
 
uint32 item_guidlow
 
uint32 item_template
 
uint32 owner
 
uint32 startbid
 
uint32 bid
 
uint32 buyout
 
time_t expire_time
 
uint32 bidder
 
uint32 deposit
 
AuctionHouseEntry const * auctionHouseEntry
 

Detailed Description

Definition at line 47 of file AuctionHouseMgr.h.

Member Function Documentation

bool AuctionEntry::BuildAuctionInfo ( WorldPacket data) const

Definition at line 676 of file AuctionHouseMgr.cpp.

References Item::GetCount(), Item::GetEnchantmentCharges(), Item::GetEnchantmentDuration(), Item::GetEnchantmentId(), Object::GetEntry(), Item::GetItemRandomPropertyId(), Item::GetItemSuffixFactor(), Item::GetSpellCharges(), IN_MILLISECONDS, MAX_INSPECTED_ENCHANTMENT_SLOT, sAuctionMgr, and sLog.

Referenced by AuctionHouseObject::BuildListAuctionItems(), AuctionHouseObject::BuildListOwnerItems(), GetHouseFaction(), and WorldSession::HandleAuctionListBidderItems().

677 {
678  Item* pItem = sAuctionMgr->GetAItem(item_guidlow);
679  if (!pItem)
680  {
681  sLog.outError("auction to item, that doesn't exist !!!!");
682  return false;
683  }
684  data << uint32(Id);
685  data << uint32(pItem->GetEntry());
686 
687  for (uint8 i = 0; i < MAX_INSPECTED_ENCHANTMENT_SLOT; ++i)
688  {
689  data << uint32(pItem->GetEnchantmentId(EnchantmentSlot(i)));
690  data << uint32(pItem->GetEnchantmentDuration(EnchantmentSlot(i)));
691  data << uint32(pItem->GetEnchantmentCharges(EnchantmentSlot(i)));
692  }
693 
694  data << uint32(pItem->GetItemRandomPropertyId()); // random item property id
695  data << uint32(pItem->GetItemSuffixFactor()); // SuffixFactor
696  data << uint32(pItem->GetCount()); // item->count
697  data << uint32(pItem->GetSpellCharges()); // item->charge FFFFFFF
698  data << uint32(0); // Unknown
699  data << uint64(owner); // Auction->owner
700  data << uint32(startbid); // Auction->startbid (not sure if useful)
701  data << uint32(bid ? GetAuctionOutBid() : 0);
702  // minimal outbid
703  data << uint32(buyout); // auction->buyout
704  data << uint32((expire_time - time(NULL))*IN_MILLISECONDS); // time left
705  data << uint64(bidder) ; // auction->bidder current
706  data << uint32(bid); // current bid
707  return true;
708 }
uint32 GetCount() const
Definition: Item.h:251
int32 GetSpellCharges(uint8 index=0) const
Definition: Item.h:330
uint32 item_guidlow
uint32 GetItemSuffixFactor() const
Definition: Item.h:302
#define sLog
Log class singleton.
Definition: Log.h:187
int32 GetItemRandomPropertyId() const
Definition: Item.h:298
uint32 GetEnchantmentDuration(EnchantmentSlot slot) const
Definition: Item.h:317
ACE_UINT8 uint8
Definition: Define.h:73
Definition: Item.h:196
time_t expire_time
ACE_UINT64 uint64
Definition: Define.h:70
uint32 GetEnchantmentCharges(EnchantmentSlot slot) const
Definition: Item.h:321
EnchantmentSlot
Definition: Item.h:147
#define sAuctionMgr
uint32 GetEntry() const
Definition: Object.h:192
ACE_UINT32 uint32
Definition: Define.h:71
uint32 GetAuctionOutBid() const
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:313
void AuctionEntry::DeleteFromDB ( ) const

Definition at line 722 of file AuctionHouseMgr.cpp.

References CharacterDatabase, and Database::PExecute().

Referenced by AuctionHouseBot::addNewAuctionBuyerBotBid(), GetHouseFaction(), WorldSession::HandleAuctionPlaceBid(), WorldSession::HandleAuctionRemoveItem(), AuctionHouseMgr::LoadAuctions(), and AuctionHouseObject::Update().

723 {
724  // No SQL injection (Id is integer)
725  CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE id = '%u'", Id);
726 }
bool PExecute(const char *format,...) ATTR_PRINTF(2
Definition: Database.cpp:441
DatabaseType CharacterDatabase
Accessor to the character database.
Definition: Main.cpp:54
uint32 AuctionEntry::GetAuctionCut ( ) const

Definition at line 710 of file AuctionHouseMgr.cpp.

References CalculatePct(), RATE_AUCTION_CUT, and sWorld.

Referenced by GetHouseFaction(), WorldSession::HandleAuctionRemoveItem(), AuctionHouseMgr::SendAuctionSalePendingMail(), and AuctionHouseMgr::SendAuctionSuccessfulMail().

711 {
713 }
AuctionHouseEntry const * auctionHouseEntry
T CalculatePct(T base, U pct)
Definition: Util.h:97
#define sWorld
Definition: World.h:860
ACE_UINT32 uint32
Definition: Define.h:71
uint32 AuctionEntry::GetAuctionOutBid ( ) const

Definition at line 716 of file AuctionHouseMgr.cpp.

References CalculatePct().

Referenced by AuctionHouseBot::addNewAuctionBuyerBotBid(), GetHouseFaction(), WorldSession::HandleAuctionPlaceBid(), and WorldSession::SendAuctionOutbiddedMail().

717 {
718  uint32 outbid = CalculatePct(bid, 5);
719  return outbid ? outbid : 1;
720 }
T CalculatePct(T base, U pct)
Definition: Util.h:97
ACE_UINT32 uint32
Definition: Define.h:71
uint32 AuctionEntry::GetHouseFaction ( ) const
inline
uint32 AuctionEntry::GetHouseId ( ) const
inline
void AuctionEntry::SaveToDB ( ) const

Definition at line 728 of file AuctionHouseMgr.cpp.

References CharacterDatabase, Database::PExecute(), and UI64FMTD.

Referenced by AuctionHouseBot::addNewAuctions(), and GetHouseFaction().

729 {
730  // No SQL injection (no strings)
731  CharacterDatabase.PExecute("INSERT INTO auctionhouse (id,auctioneerguid,itemguid,item_template,itemowner,buyoutprice,time,buyguid,lastbid,startbid,deposit) "
732  "VALUES ('%u', '%u', '%u', '%u', '%u', '%u', '" UI64FMTD "', '%u', '%u', '%u', '%u')",
734 }
uint32 item_guidlow
#define UI64FMTD
Definition: Common.h:149
time_t expire_time
bool PExecute(const char *format,...) ATTR_PRINTF(2
Definition: Database.cpp:441
uint32 item_template
ACE_UINT64 uint64
Definition: Define.h:70
DatabaseType CharacterDatabase
Accessor to the character database.
Definition: Main.cpp:54

Member Data Documentation

AuctionHouseEntry const* AuctionEntry::auctionHouseEntry

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