TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
AuctionHouseBotBuyer.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
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 #ifndef AUCTION_HOUSE_BOT_BUYER_H
19 #define AUCTION_HOUSE_BOT_BUYER_H
20 
21 #include "Define.h"
22 #include "AuctionHouseMgr.h"
23 #include "AuctionHouseBot.h"
24 
26 {
28 
30  time_t LastChecked;
31  time_t LastExist;
32 };
33 
35 {
37 
42  double TotalBuyPrice;
43  double TotalBidPrice;
44 };
45 
46 typedef std::map<uint32, BuyerItemInfo> BuyerItemInfoMap;
47 typedef std::map<uint32, BuyerAuctionEval> CheckEntryMap;
48 
50 {
52 
53  void Initialize(AuctionHouseType houseType)
54  {
55  _houseType = houseType;
56  }
57 
59 
63 
64 private:
66 };
67 
68 // This class handle all Buyer method
69 // (holder of AuctionBotConfig for each auction house type)
71 {
72 public:
74  ~AuctionBotBuyer();
75 
76  bool Initialize() override;
77  bool Update(AuctionHouseType houseType) override;
78 
79  void LoadConfig();
80  void BuyAndBidItems(BuyerConfiguration& config);
81 
82 private:
85 
86  void LoadBuyerValues(BuyerConfiguration& config);
87 
88  // ahInfo can be NULL
89  bool RollBuyChance(const BuyerItemInfo* ahInfo, const Item* item, const AuctionEntry* auction, uint32 bidPrice);
90  bool RollBidChance(const BuyerItemInfo* ahInfo, const Item* item, const AuctionEntry* auction, uint32 bidPrice);
91  void PlaceBidToEntry(AuctionEntry* auction, uint32 bidPrice);
92  void BuyEntry(AuctionEntry* auction, AuctionHouseObject* auctionHouse);
93  void PrepareListOfEntry(BuyerConfiguration& config);
94  uint32 GetItemInformation(BuyerConfiguration& config);
95  uint32 GetVendorPrice(uint32 quality);
96  uint32 GetChanceMultiplier(uint32 quality);
97 };
98 
99 #endif
uint32 _checkInterval
Definition: AuctionHouseBotBuyer.h:83
double TotalBidPrice
Definition: AuctionHouseBotBuyer.h:43
Definition: AuctionHouseBot.h:42
BuyerConfiguration()
Definition: AuctionHouseBotBuyer.h:51
AuctionHouseType
Definition: AuctionHouseBot.h:40
uint32 MinBuyPrice
Definition: AuctionHouseBotBuyer.h:40
time_t LastChecked
Definition: AuctionHouseBotBuyer.h:30
time_t LastExist
Definition: AuctionHouseBotBuyer.h:31
std::map< uint32, BuyerItemInfo > BuyerItemInfoMap
Definition: AuctionHouseBotBuyer.h:46
Definition: AuctionHouseMgr.h:67
#define false
Definition: CascPort.h:18
uint32 BuyItemCount
Definition: AuctionHouseBotBuyer.h:39
uint32 AuctionId
Definition: AuctionHouseBotBuyer.h:29
Definition: AuctionHouseBotBuyer.h:25
AuctionHouseType GetHouseType() const
Definition: AuctionHouseBotBuyer.h:58
BuyerItemInfoMap SameItemInfo
Definition: AuctionHouseBotBuyer.h:60
#define MAX_AUCTION_HOUSE_TYPE
Definition: AuctionHouseBot.h:47
Definition: AuctionHouseBotBuyer.h:70
AuctionHouseType _houseType
Definition: AuctionHouseBotBuyer.h:65
Definition: Item.h:259
uint32 MinBidPrice
Definition: AuctionHouseBotBuyer.h:41
virtual bool Update(AuctionHouseType houseType)=0
uint32_t uint32
Definition: Define.h:150
CheckEntryMap EligibleItems
Definition: AuctionHouseBotBuyer.h:61
virtual bool Initialize()=0
Definition: AuctionHouseBot.h:254
void Initialize(AuctionHouseType houseType)
Definition: AuctionHouseBotBuyer.h:53
uint32 BidItemCount
Definition: AuctionHouseBotBuyer.h:38
bool BuyerEnabled
Definition: AuctionHouseBotBuyer.h:62
#define TC_GAME_API
Definition: Define.h:134
BuyerAuctionEval()
Definition: AuctionHouseBotBuyer.h:27
BuyerItemInfo()
Definition: AuctionHouseBotBuyer.h:36
Definition: AuctionHouseMgr.h:100
Definition: AuctionHouseBotBuyer.h:49
std::map< uint32, BuyerAuctionEval > CheckEntryMap
Definition: AuctionHouseBotBuyer.h:47
Definition: AuctionHouseBotBuyer.h:34
double TotalBuyPrice
Definition: AuctionHouseBotBuyer.h:42