OregonCore  revision 3611e8a-git
Your Favourite TBC server
AuctionHouseHandler.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the OregonCore Project. See AUTHORS file for Copyright information
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #include "ObjectMgr.h"
19 #include "Player.h"
20 #include "World.h"
21 #include "WorldPacket.h"
22 #include "WorldSession.h"
23 
24 #include "AuctionHouseBot.h"
25 #include "AuctionHouseMgr.h"
26 #include "Log.h"
27 #include "Opcodes.h"
28 #include "UpdateMask.h"
29 #include "Util.h"
30 
31 // please DO NOT use iterator++, because it is slower than ++iterator!!!
32 // post-incrementation is always slower than pre-incrementation !
33 
34 // void called when player click on auctioneer npc
36 {
37  uint64 guid; // NPC guid
38  recv_data >> guid;
39 
41  if (!unit)
42  {
43  sLog.outDebug("WORLD: HandleAuctionHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
44  return;
45  }
46 
47  // remove fake death
48  if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
50 
51  SendAuctionHello(guid, unit);
52 }
53 
54 // this void causes that auction window is opened
56 {
58  if (!ahEntry)
59  return;
60 
62  data << uint64(guid);
63  data << uint32(ahEntry->houseId);
64  SendPacket(&data);
65 }
66 
67 // call this method when player bids, creates, or deletes auction
68 void WorldSession::SendAuctionCommandResult(uint32 auctionId, uint32 Action, uint32 ErrorCode, uint32 bidError)
69 {
71  data << uint32(auctionId);
72  data << uint32(Action);
73  data << uint32(ErrorCode);
74  if (!ErrorCode && Action)
75  data << uint32(bidError); // when bid, then send 0, once...
76  SendPacket(&data);
77 }
78 
79 // this function sends notification, if bidder is online
80 void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 item_template)
81 {
83  data << uint32(location);
84  data << uint32(auctionId);
85  data << uint64(bidder);
86  data << uint32(bidSum);
87  data << uint32(diff);
88  data << uint32(item_template);
89  data << uint32(0);
90  SendPacket(&data);
91 }
92 
93 // this void causes on client to display: "Your auction sold"
95 {
97  data << uint32(auction->Id);
98  data << uint32(auction->bid);
99  data << uint32(0); // unk
100  data << uint32(0); // unk
101  data << uint32(0); // unk
102  data << uint32(auction->item_template);
103  data << uint32(0); // unk
104  SendPacket(&data);
105 }
106 
107 // this function sends mail to old bidder
109 {
110  uint64 oldBidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
111  Player* oldBidder = sObjectMgr.GetPlayer(oldBidder_guid);
112 
113  uint32 oldBidder_accId = 0;
114  if (!oldBidder)
115  oldBidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(oldBidder_guid);
116 
117  // old bidder exist
118  if (oldBidder || oldBidder_accId)
119  {
120  std::ostringstream msgAuctionOutbiddedSubject;
121  msgAuctionOutbiddedSubject << auction->item_template << ":0:" << AUCTION_OUTBIDDED;
122 
123  if (oldBidder && !_player)
124  oldBidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, auctionbot.GetAHBplayerGUID(), newPrice, auction->GetAuctionOutBid(), auction->item_template);
125 
126  if (oldBidder && _player)
127  oldBidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, _player->GetGUID(), newPrice, auction->GetAuctionOutBid(), auction->item_template);
128 
129  MailDraft(msgAuctionOutbiddedSubject.str())
130  .AddMoney(auction->bid)
131  .SendMailTo(MailReceiver(oldBidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED);
132  }
133 }
134 
135 // this function sends mail, when auction is cancelled to old bidder
137 {
138  uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
139  Player* bidder = sObjectMgr.GetPlayer(bidder_guid);
140 
141  uint32 bidder_accId = 0;
142  if (!bidder)
143  bidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(bidder_guid);
144 
145  // bidder exist
146  if (bidder || bidder_accId)
147  {
148  std::ostringstream msgAuctionCancelledSubject;
149  msgAuctionCancelledSubject << auction->item_template << ":0:" << AUCTION_CANCELLED_TO_BIDDER;
150 
151  MailDraft(msgAuctionCancelledSubject.str())
152  .AddMoney(auction->bid)
153  .SendMailTo(MailReceiver(bidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED);
154  }
155 }
156 
157 // this void creates new auction and adds auction to some auctionhouse
159 {
160  uint64 auctioneer, item;
161  uint32 etime, bid, buyout;
162  recv_data >> auctioneer >> item;
163  recv_data >> bid >> buyout >> etime;
164  Player* pl = GetPlayer();
165 
166  if (!item || !bid || !etime)
167  return; // check for cheaters
168 
170  if (!pCreature)
171  {
172  sLog.outDebug("WORLD: HandleAuctionSellItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)));
173  return;
174  }
175 
176  AuctionHouseEntry const* auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(pCreature->getFaction());
177  if (!auctionHouseEntry)
178  {
179  sLog.outDebug("WORLD: HandleAuctionSellItem - Unit (GUID: %u) has wrong faction.", uint32(GUID_LOPART(auctioneer)));
180  return;
181  }
182 
183 
184  // client send time in minutes, convert to common used sec time
185  etime *= MINUTE;
186 
187  // client understand only 3 auction time
188  switch (etime)
189  {
190  case 1*MIN_AUCTION_TIME:
191  case 2*MIN_AUCTION_TIME:
192  case 4*MIN_AUCTION_TIME:
193  break;
194  default:
195  return;
196  }
197 
198  // remove fake death
199  if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
201 
202  Item* it = pl->GetItemByGuid(item);
203  //do not allow to sell already auctioned items
204  if (sAuctionMgr->GetAItem(GUID_LOPART(item)))
205  {
206  sLog.outError("AuctionError, player %s is sending item id: %u, but item is already in another auction", pl->GetName(), GUID_LOPART(item));
208  return;
209  }
210  // prevent sending bag with items (cheat: can be placed in bag after adding equiped empty bag to auction)
211  if (!it)
212  {
214  return;
215  }
216 
217  if (!it->CanBeTraded())
218  {
220  return;
221  }
222 
224  {
226  return;
227  }
228 
229  if (it->IsBag() && !((Bag*)it)->IsEmpty())
230  {
232  return;
233  }
234 
235  AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction());
236 
237  // we have to take deposit :
238  uint32 deposit = sAuctionMgr->GetAuctionDeposit(auctionHouseEntry, etime, it);
239  if (pl->GetMoney() < deposit)
240  {
242  return;
243  }
244 
245  if (GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE))
246  {
247  sLog.outCommand(GetAccountId(), "GM %s (Account: %u) create auction: %s (Entry: %u Count: %u)",
248  GetPlayerName(), GetAccountId(), it->GetProto()->Name1, it->GetEntry(), it->GetCount());
249  }
250 
251  pl->ModifyMoney(-int32(deposit));
252 
253  uint32 auction_time = uint32(etime * sWorld.getRate(RATE_AUCTION_TIME));
254 
255  AuctionEntry* AH = new AuctionEntry;
256  AH->Id = sObjectMgr.GenerateAuctionID();
258  AH->auctioneer = 23442;
259  else
260  AH->auctioneer = GUID_LOPART(auctioneer);
261  AH->item_guidlow = GUID_LOPART(item);
262  AH->item_template = it->GetEntry();
263  AH->owner = pl->GetGUIDLow();
264  AH->startbid = bid;
265  AH->bidder = 0;
266  AH->bid = 0;
267  AH->buyout = buyout;
268  AH->expire_time = time(NULL) + auction_time;
269  AH->deposit = deposit;
270  AH->auctionHouseEntry = auctionHouseEntry;
271 
272  sLog.outDetail("selling item %u to auctioneer %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", GUID_LOPART(item), AH->auctioneer, bid, buyout, auction_time, AH->GetHouseId());
273  sAuctionMgr->AddAItem(it);
274  auctionHouse->AddAuction(AH);
275 
276  pl->MoveItemFromInventory(it->GetBagSlot(), it->GetSlot(), true);
277 
279  it->DeleteFromInventoryDB();
280  it->SaveToDB(); // recursive and not have transaction guard into self, not in inventiory and can be save standalone
281  AH->SaveToDB();
284 
286 }
287 
288 // this function is called when client bids or buys out auction
290 {
291  uint64 auctioneer;
292  uint32 auctionId;
293  uint32 price;
294  recv_data >> auctioneer;
295  recv_data >> auctionId >> price;
296 
297  if (!auctionId || !price)
298  return; // check for cheaters
299 
301  if (!pCreature)
302  {
303  sLog.outDebug("WORLD: HandleAuctionPlaceBid - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)));
304  return;
305  }
306 
307  // remove fake death
308  if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
310 
311  AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction());
312 
313  AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
314  Player* pl = GetPlayer();
315 
316  if (!auction || auction->owner == pl->GetGUIDLow())
317  {
318  // you cannot bid your own auction:
320  return;
321  }
322 
323  // impossible have online own another character (use this for speedup check in case online owner)
324  Player* auction_owner = sObjectMgr.GetPlayer(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER));
325  if (!auction_owner && sObjectMgr.GetPlayerAccountIdByGUID(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)) == pl->GetSession()->GetAccountId())
326  {
327  // you cannot bid your another character auction:
329  return;
330  }
331 
332  // cheating
333  if (price <= auction->bid || price < auction->startbid)
334  return;
335 
336  // price too low for next bid if not buyout
337  if ((price < auction->buyout || auction->buyout == 0) &&
338  price < auction->bid + auction->GetAuctionOutBid())
339  {
340  // auction has already higher bid, client tests it!
341  return;
342  }
343 
344  if (price > pl->GetMoney())
345  {
346  // you don't have enought money!, client tests!
347  // SendAuctionCommandResult(auction->auctionId, AUCTION_PLACE_BID, ???);
348  return;
349  }
350 
351  if (price < auction->buyout || auction->buyout == 0)
352  {
353  if (auction->bidder > 0)
354  {
355  if (auction->bidder == pl->GetGUIDLow())
356  pl->ModifyMoney(-int32(price - auction->bid));
357  else
358  {
359  // mail to last bidder and return money
360  SendAuctionOutbiddedMail(auction, price);
361  pl->ModifyMoney(-int32(price));
362  }
363  }
364  else
365  pl->ModifyMoney(-int32(price));
366 
367  auction->bidder = pl->GetGUIDLow();
368  auction->bid = price;
369 
370  // after this update we should save player's money ...
372  CharacterDatabase.PExecute("UPDATE auctionhouse SET buyguid = '%u',lastbid = '%u' WHERE id = '%u'", auction->bidder, auction->bid, auction->Id);
373 
375  }
376  else
377  {
378  // buyout:
379  if (pl->GetGUIDLow() == auction->bidder)
380  pl->ModifyMoney(-int32(auction->buyout - auction->bid));
381  else
382  {
383  pl->ModifyMoney(-int32(auction->buyout));
384  if (auction->bidder) // buyout for bidded auction ..
385  SendAuctionOutbiddedMail(auction, auction->buyout);
386  }
387  auction->bidder = pl->GetGUIDLow();
388  auction->bid = auction->buyout;
389 
390  sAuctionMgr->SendAuctionSalePendingMail(auction);
391  sAuctionMgr->SendAuctionSuccessfulMail(auction);
392  sAuctionMgr->SendAuctionWonMail(auction);
393 
395 
397  auction->DeleteFromDB();
398  uint32 item_template = auction->item_template;
399  sAuctionMgr->RemoveAItem(auction->item_guidlow);
400  auctionHouse->RemoveAuction(auction, item_template);
401  }
404 }
405 
406 // this void is called when auction_owner cancels his auction
408 {
409  uint64 auctioneer;
410  uint32 auctionId;
411  recv_data >> auctioneer;
412  recv_data >> auctionId;
413  //sLog.outDebug("Cancel AUCTION AuctionID: %u", auctionId);
414 
416  if (!pCreature)
417  {
418  sLog.outDebug("WORLD: HandleAuctionRemoveItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)));
419  return;
420  }
421 
422  // remove fake death
423  if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
425 
426  AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction());
427 
428  AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
429  Player* pl = GetPlayer();
430 
431  if (auction && auction->owner == pl->GetGUIDLow())
432  {
433  Item* pItem = sAuctionMgr->GetAItem(auction->item_guidlow);
434  if (pItem)
435  {
436  if (auction->bidder > 0) // If we have a bidder, we have to send him the money he paid
437  {
438  uint32 auctionCut = auction->GetAuctionCut();
439  if (pl->GetMoney() < auctionCut) //player doesn't have enough money, maybe message needed
440  return;
441  //some auctionBidderNotification would be needed, but don't know that parts..
443  pl->ModifyMoney(-int32(auctionCut));
444  }
445  // Return the item by mail
446  std::ostringstream msgAuctionCanceledOwner;
447  msgAuctionCanceledOwner << auction->item_template << ":0:" << AUCTION_CANCELED;
448 
449  // item will deleted or added to received mail list
450  MailDraft(msgAuctionCanceledOwner.str())
451  .AddItem(pItem)
452  .SendMailTo(pl, auction, MAIL_CHECK_MASK_COPIED);
453  }
454  else
455  {
456  sLog.outError("Auction id: %u has invalid item (item guid : %u)!!!", auction->Id, auction->item_guidlow);
458  return;
459  }
460  }
461  else
462  {
464  // this code isn't possible ... maybe there should be assert
465  sLog.outError("CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is NULL", pl->GetGUIDLow(), auctionId);
466  return;
467  }
468 
469  // inform player, that auction is removed
471 
472  // Now remove the auction
475  auction->DeleteFromDB();
476  uint32 item_template = auction->item_template;
477  sAuctionMgr->RemoveAItem(auction->item_guidlow);
478  auctionHouse->RemoveAuction(auction, item_template);
480 }
481 
482 // called when player lists his bids
484 {
485  uint64 guid; //NPC guid
486  uint32 listfrom; //page of auctions
487  uint32 outbiddedCount; //count of outbidded auctions
488 
489  recv_data >> guid;
490  recv_data >> listfrom; // not used in fact (this list not have page control in client)
491  recv_data >> outbiddedCount;
492  if (recv_data.size() != (16 + outbiddedCount * 4))
493  {
494  sLog.outError("Client sent bad opcode!!! with count: %u and size : %lu (must be: %u)", outbiddedCount, (unsigned long)recv_data.size(), (16 + outbiddedCount * 4));
495  outbiddedCount = 0;
496  }
497 
499  if (!pCreature)
500  {
501  sLog.outDebug("WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
502  return;
503  }
504 
505  // remove fake death
506  if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
508 
509  AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction());
510 
511  WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, (4 + 4 + 4));
512  Player* pl = GetPlayer();
513  data << uint32(0); // add 0 as count
514  uint32 count = 0;
515  uint32 totalcount = 0;
516  while (outbiddedCount > 0) //add all data, which client requires
517  {
518  --outbiddedCount;
519  uint32 outbiddedAuctionId;
520  recv_data >> outbiddedAuctionId;
521  AuctionEntry* auction = auctionHouse->GetAuction(outbiddedAuctionId);
522  if (auction && auction->BuildAuctionInfo(data))
523  {
524  ++totalcount;
525  ++count;
526  }
527  }
528 
529  auctionHouse->BuildListBidderItems(data, pl, count, totalcount);
530  data.put<uint32>(0, count); // add count to placeholder
531  data << uint32(totalcount);
532  data << uint32(300); //unk 2.3.0
533  SendPacket(&data);
534 }
535 
536 // this void sends player info about his auctions
538 {
539  uint32 listfrom;
540  uint64 guid;
541 
542  recv_data >> guid;
543  recv_data >> listfrom; // not used in fact (this list not have page control in client)
544 
546  if (!pCreature)
547  {
548  sLog.outDebug("WORLD: HandleAuctionListOwnerItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
549  return;
550  }
551 
552  // remove fake death
553  if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
555 
556  AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction());
557 
558  WorldPacket data(SMSG_AUCTION_OWNER_LIST_RESULT, (4 + 4 + 4));
559  data << (uint32) 0; // amount place holder
560 
561  uint32 count = 0;
562  uint32 totalcount = 0;
563 
564  auctionHouse->BuildListOwnerItems(data, _player, count, totalcount);
565  data.put<uint32>(0, count);
566  data << uint32(totalcount);
567  data << uint32(0); // 2.3.0 delay for next list request?
568  SendPacket(&data);
569 }
570 
571 //this void is called when player clicks on search button
573 {
574  std::string searchedname;
575  uint8 levelmin, levelmax, usable;
576  uint32 listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality;
577  uint64 guid;
578 
579  recv_data >> guid;
580  recv_data >> listfrom; // start, used for page control listing by 50 elements
581  recv_data >> searchedname;
582 
583  recv_data >> levelmin >> levelmax;
584  recv_data >> auctionSlotID >> auctionMainCategory >> auctionSubCategory;
585  recv_data >> quality >> usable;
586 
587  recv_data.read_skip<uint8>(); // unk
588 
589  // this block looks like it uses some lame byte packing or similar...
590  uint8 unkCnt;
591  recv_data >> unkCnt;
592  for (uint8 i = 0; i < unkCnt; i++)
593  {
594  recv_data.read_skip<uint8>();
595  recv_data.read_skip<uint8>();
596  }
597 
599  if (!pCreature)
600  {
601  sLog.outDebug("WORLD: HandleAuctionListItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
602  return;
603  }
604 
605  // remove fake death
606  if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
608 
609  AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction());
610 
611  //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);
612 
613  WorldPacket data(SMSG_AUCTION_LIST_RESULT, (4 + 4 + 4));
614  uint32 count = 0;
615  uint32 totalcount = 0;
616  data << uint32(0);
617 
618  // converting string that we try to find to lower case
619  std::wstring wsearchedname;
620  if (!Utf8toWStr(searchedname, wsearchedname))
621  return;
622 
623  wstrToLower(wsearchedname);
624 
625  auctionHouse->BuildListAuctionItems(data, _player,
626  wsearchedname, listfrom, levelmin, levelmax, usable,
627  auctionSlotID, auctionMainCategory, auctionSubCategory, quality,
628  count, totalcount);
629 
630  data.put<uint32>(0, count);
631  data << uint32(totalcount);
632  data << uint32(300); // 2.3.0 delay for next list request?
633  SendPacket(&data);
634 }
635 
void AddAuction(AuctionEntry *ah)
uint32 GetCount() const
Definition: Item.h:251
ItemTemplate const * GetProto() const
Definition: Item.cpp:460
void MoveItemFromInventory(uint8 bag, uint8 slot, bool update)
Definition: Player.cpp:10687
const uint32 & GetUInt32Value(uint16 index) const
Definition: Object.h:228
void read_skip()
Definition: ByteBuffer.h:276
#define GUID_LOPART(x)
Definition: ObjectGuid.h:110
bool BuildAuctionInfo(WorldPacket &data) const
void BuildListAuctionItems(WorldPacket &data, Player *player, std::wstring const &searchedname, uint32 listfrom, uint32 levelmin, uint32 levelmax, uint32 usable, uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality, uint32 &count, uint32 &totalcount)
void BuildListOwnerItems(WorldPacket &data, Player *player, uint32 &count, uint32 &totalcount)
uint32 item_guidlow
bool BeginTransaction()
Definition: Database.cpp:533
uint32 getFaction() const
Definition: Unit.h:1111
#define auctionbot
void BuildListBidderItems(WorldPacket &data, Player *player, uint32 &count, uint32 &totalcount)
AuctionEntry * GetAuction(uint32 id) const
void HandleAuctionListItems(WorldPacket &recv_data)
virtual void SaveToDB()
Definition: Item.cpp:286
void RemoveSpellsCausingAura(AuraType auraType)
Definition: Unit.cpp:648
#define sLog
Log class singleton.
Definition: Log.h:187
void DeleteFromDB() const
ACE_INT32 int32
Definition: Define.h:67
uint32 GetAccountId() const
Definition: WorldSession.h:100
Player * GetPlayer() const
Definition: WorldSession.h:104
uint32 GetGUIDLow() const
Definition: Object.h:160
void HandleAuctionListBidderItems(WorldPacket &recv_data)
bool IsBag() const
Definition: Item.h:229
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:294
#define sObjectMgr
Definition: ObjectMgr.h:1285
void wstrToLower(std::wstring &str)
Definition: Util.h:314
void SendPacket(WorldPacket const *packet)
bool CommitTransaction()
Definition: Database.cpp:551
Definition: Common.h:179
void HandleAuctionListOwnerItems(WorldPacket &recv_data)
Definition: Bag.h:27
ACE_UINT8 uint8
Definition: Define.h:73
void HandleAuctionPlaceBid(WorldPacket &recv_data)
size_t size() const
Definition: ByteBuffer.h:336
void HandleAuctionRemoveItem(WorldPacket &recv_data)
void put(size_t pos, T value)
Definition: ByteBuffer.h:79
void HandleAuctionHelloOpcode(WorldPacket &recvPacket)
#define MAKE_NEW_GUID(l, e, h)
Definition: ObjectGuid.h:80
Definition: Item.h:196
void SendAuctionOwnerNotification(AuctionEntry *auction)
void SendMailTo(MailReceiver const &receiver, MailSender const &sender, MailCheckMask checked=MAIL_CHECK_MASK_NONE, uint32 deliver_delay=0)
Definition: Mail.cpp:978
bool PExecute(const char *format,...) ATTR_PRINTF(2
Definition: Database.cpp:441
char const * GetPlayerName() const
void HandleAuctionSellItem(WorldPacket &recv_data)
uint8 GetSlot() const
Definition: Item.h:266
uint32 GetAuctionCut() const
uint32 item_template
uint32 GetHouseId() const
const char * GetName() const
Definition: Object.h:692
ACE_UINT64 uint64
Definition: Define.h:70
Player * _player
Definition: WorldSession.h:729
void SendAuctionCommandResult(uint32 auctionId, uint32 Action, uint32 ErrorCode, uint32 bidError=0)
uint32 GetMoney()
Definition: Player.h:1524
#define sAuctionMgr
Creature * GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
Definition: Player.cpp:2191
void SaveInventoryAndGoldToDB()
Definition: Player.cpp:16417
bool RemoveAuction(AuctionEntry *auction, uint32 item_template)
bool CanBeTraded() const
Definition: Item.cpp:738
uint32 GetEntry() const
Definition: Object.h:186
WorldSession * GetSession() const
Definition: Player.h:1959
#define sWorld
Definition: World.h:860
DatabaseType CharacterDatabase
Accessor to the character database.
Definition: Main.cpp:54
void uint32 GetSecurity() const
Definition: WorldSession.h:96
void SendAuctionOutbiddedMail(AuctionEntry *auction, uint32 newPrice)
void ModifyMoney(int32 d)
Definition: Player.h:1528
ACE_UINT32 uint32
Definition: Define.h:71
void SendAuctionCancelledToBidderMail(AuctionEntry *auction)
uint8 GetBagSlot() const
Definition: Item.cpp:728
void DeleteFromInventoryDB()
Definition: Item.cpp:455
#define MIN_AUCTION_TIME
Definition: Player.h:922
uint32 GetAuctionOutBid() const
void SendAuctionHello(uint64 guid, Creature *unit)
void SendAuctionBidderNotification(uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 item_template)
Item * GetItemByGuid(uint64 guid) const
Definition: Player.cpp:8583
static AuctionHouseEntry const * GetAuctionHouseEntry(uint32 factionTemplateId)
const uint64 & GetGUID() const
Definition: Object.h:156