1 #ifndef AUCTION_HOUSE_BOT_H
2 #define AUCTION_HOUSE_BOT_H
5 #include "Config/ConfigEnv.h"
12 #define AHB_WHITE_TG 1
13 #define AHB_GREEN_TG 2
15 #define AHB_PURPLE_TG 4
20 #define AHB_PURPLE_I 9
21 #define AHBplayerAccount sConfig.GetIntDefault("AuctionHouseBot.Account", 0)
22 #define AHBplayerGUID sConfig.GetIntDefault("AuctionHouseBot.GUID", 0)
23 #define ItemsPerCycle sConfig.GetIntDefault("AuctionHouseBot.ItemsPerCycle", 200)
33 uint32 percentWhiteTradeGoods
;
34 uint32 percentGreenTradeGoods
;
35 uint32 percentBlueTradeGoods
;
36 uint32 percentPurpleTradeGoods
;
37 uint32 percentWhiteItems
;
38 uint32 percentGreenItems
;
39 uint32 percentBlueItems
;
40 uint32 percentPurpleItems
;
43 uint32 minBidPriceWhite
;
44 uint32 maxBidPriceWhite
;
48 uint32 minBidPriceGreen
;
49 uint32 maxBidPriceGreen
;
53 uint32 minBidPriceBlue
;
54 uint32 maxBidPriceBlue
;
56 uint32 minPricePurple
;
57 uint32 maxPricePurple
;
58 uint32 minBidPricePurple
;
59 uint32 maxBidPricePurple
;
60 uint32 maxStackPurple
;
62 uint32 buyerPriceGrey
;
63 uint32 buyerPriceWhite
;
64 uint32 buyerPriceGreen
;
65 uint32 buyerPriceBlue
;
66 uint32 buyerPricePurple
;
67 uint32 buyerBiddingInterval
;
68 uint32 buyerBidsPerInterval
;
79 AHBConfig(uint32 ahid
)
90 void SetMinItems(uint32 value
)
96 if ((minItems
== 0) && (maxItems
))
98 else if ((maxItems
) && (minItems
> maxItems
))
103 void SetMaxItems(uint32 value
)
112 void SetMinTime(uint32 value
)
120 else if ((maxTime
) && (minTime
> maxTime
))
125 void SetMaxTime(uint32 value
)
133 void SetPercentages(uint32 wtg
, uint32 gtg
, uint32 btg
, uint32 ptg
, uint32 wi
, uint32 gi
, uint32 bi
, uint32 pi
)
135 uint32 totalPercent
= wtg
+ gtg
+ btg
+ ptg
+ wi
+ gi
+ bi
+ pi
;
137 if (totalPercent
== 0)
141 else if (totalPercent
!= 100)
143 double scale
= (double) 100 / (double) totalPercent
;
145 wtg
= (uint32
) (scale
* (double) pi
);
146 gtg
= (uint32
) (scale
* (double) gtg
);
147 btg
= (uint32
) (scale
* (double) btg
);
148 ptg
= (uint32
) (scale
* (double) ptg
);
149 wi
= (uint32
) (scale
* (double) wi
);
150 gi
= (uint32
) (scale
* (double) gi
);
151 bi
= (uint32
) (scale
* (double) bi
);
152 pi
= 100 - wtg
- gtg
- btg
- ptg
- wi
- gi
- bi
;
155 percentWhiteTradeGoods
= wtg
;
156 percentGreenTradeGoods
= gtg
;
157 percentBlueTradeGoods
= btg
;
158 percentPurpleTradeGoods
= ptg
;
159 percentWhiteItems
= wi
;
160 percentGreenItems
= gi
;
161 percentBlueItems
= bi
;
162 percentPurpleItems
= pi
;
165 uint32
GetPercentages(uint32 color
)
173 return percentWhiteTradeGoods
;
176 return percentGreenTradeGoods
;
179 return percentBlueTradeGoods
;
182 return percentPurpleTradeGoods
;
188 return percentWhiteItems
;
191 return percentGreenItems
;
194 return percentBlueItems
;
197 return percentPurpleItems
;
204 void SetMinPrice(uint32 color
, uint32 value
)
211 minPriceWhite
= value
;
214 minPriceGreen
= value
;
217 minPriceBlue
= value
;
220 minPricePurple
= value
;
226 uint32
GetMinPrice(uint32 color
)
237 if (minPriceWhite
== 0)
239 else if (minPriceWhite
> maxPriceWhite
)
240 return maxPriceWhite
;
242 return minPriceWhite
;
247 if (minPriceGreen
== 0)
249 else if (minPriceGreen
> maxPriceGreen
)
250 return maxPriceGreen
;
252 return minPriceGreen
;
257 if (minPriceBlue
== 0)
259 else if (minPriceBlue
> maxPriceBlue
)
267 if (minPricePurple
== 0)
269 else if (minPricePurple
> maxPricePurple
)
270 return maxPricePurple
;
272 return minPricePurple
;
282 void SetMaxPrice(uint32 color
, uint32 value
)
289 maxPriceWhite
= value
;
292 maxPriceGreen
= value
;
295 maxPriceBlue
= value
;
298 maxPricePurple
= value
;
304 uint32
GetMaxPrice(uint32 color
)
315 if (maxPriceWhite
== 0)
318 return maxPriceWhite
;
323 if (maxPriceGreen
== 0)
326 return maxPriceGreen
;
331 if (maxPriceBlue
== 0)
339 if (maxPricePurple
== 0)
342 return maxPricePurple
;
352 void SetMinBidPrice(uint32 color
, uint32 value
)
359 minBidPriceWhite
= value
;
362 minBidPriceGreen
= value
;
365 minBidPriceBlue
= value
;
368 minBidPricePurple
= value
;
374 uint32
GetMinBidPrice(uint32 color
)
385 if (minBidPriceWhite
> 100)
388 return minBidPriceWhite
;
393 if (minBidPriceGreen
> 100)
396 return minBidPriceGreen
;
401 if (minBidPriceBlue
> 100)
404 return minBidPriceBlue
;
409 if (minBidPricePurple
> 100)
412 return minBidPricePurple
;
422 void SetMaxBidPrice(uint32 color
, uint32 value
)
429 maxBidPriceWhite
= value
;
432 maxBidPriceGreen
= value
;
435 maxBidPriceBlue
= value
;
438 maxBidPricePurple
= value
;
444 uint32
GetMaxBidPrice(uint32 color
)
455 if (maxBidPriceWhite
> 100)
458 return maxBidPriceWhite
;
463 if (maxBidPriceGreen
> 100)
466 return maxBidPriceGreen
;
471 if (maxBidPriceBlue
> 100)
474 return maxBidPriceBlue
;
479 if (maxBidPricePurple
> 100)
482 return maxBidPricePurple
;
492 void SetMaxStack(uint32 color
, uint32 value
)
499 maxStackWhite
= value
;
502 maxStackGreen
= value
;
505 maxStackBlue
= value
;
508 maxStackPurple
= value
;
514 uint32
GetMaxStack(uint32 color
)
525 return maxStackWhite
;
530 return maxStackGreen
;
540 return maxStackPurple
;
550 void SetBuyerPrice(uint32 color
, uint32 value
)
555 buyerPriceGrey
= value
;
558 buyerPriceWhite
= value
;
561 buyerPriceGreen
= value
;
564 buyerPriceBlue
= value
;
567 buyerPricePurple
= value
;
573 uint32
GetBuyerPrice(uint32 color
)
578 return buyerPriceGrey
;
581 return buyerPriceWhite
;
584 return buyerPriceGreen
;
587 return buyerPriceBlue
;
590 return buyerPricePurple
;
597 void SetBiddingInterval(uint32 value
)
599 buyerBiddingInterval
= value
;
601 uint32
GetBiddingInterval()
603 return buyerBiddingInterval
;
605 void CalculatePercents()
607 wtgp
= (uint32
) (((double)percentWhiteTradeGoods
/ 100.0) * maxItems
);
608 gtgp
= (uint32
) (((double)percentGreenTradeGoods
/ 100.0) * maxItems
);
609 btgp
= (uint32
) (((double)percentBlueTradeGoods
/ 100.0) * maxItems
);
610 ptgp
= (uint32
) (((double)percentPurpleTradeGoods
/ 100.0) * maxItems
);
611 wip
= (uint32
) (((double)percentWhiteItems
/ 100.0) * maxItems
);
612 gip
= (uint32
) (((double)percentGreenItems
/ 100.0) * maxItems
);
613 bip
= (uint32
) (((double)percentBlueItems
/ 100.0) * maxItems
);
614 pip
= (uint32
) (((double)percentPurpleItems
/ 100.0) * maxItems
);
615 uint32 total
= wtgp
+ gtgp
+ btgp
+ ptgp
+ wip
+ gip
+ bip
+ pip
;
616 if (total
!= maxItems
)
618 wtgp
= (uint32
) (maxItems
* (double) wtgp
);
619 gtgp
= (uint32
) (maxItems
* (double) gtgp
);
620 btgp
= (uint32
) (maxItems
* (double) btgp
);
621 ptgp
= (uint32
) (maxItems
* (double) ptgp
);
622 wip
= (uint32
) (maxItems
* (double) wip
);
623 gip
= (uint32
) (maxItems
* (double) gip
);
624 bip
= (uint32
) (maxItems
* (double) bip
);
625 pip
= (maxItems
- (wtgp
+ gtgp
+ btgp
+ ptgp
+ wip
+ gip
+ bip
));
626 total
= wtgp
+ gtgp
+ btgp
+ ptgp
+ wip
+ gip
+ bip
+ pip
;
628 //sLog.outString("%u %u %u %u %u %u %u %u", wtgp, gtgp, btgp, ptgp, wip, gip, bip, pip);
630 uint32
GetPercents(uint32 color
)
669 void SetBidsPerInterval(uint32 value
)
671 buyerBidsPerInterval
= value
;
673 uint32
GetBidsPerInterval()
675 return buyerBidsPerInterval
;
681 void AuctionHouseBot();
682 void AuctionHouseBotInit();
683 void AuctionHouseBotLoadValues(AHBConfig
*);
684 void AuctionHouseBotCommands(uint32
, uint32
, uint32
, char*);