1 #ifndef AUCTION_HOUSE_BOT_H
2 #define AUCTION_HOUSE_BOT_H
5 #include "Config/ConfigEnv.h"
14 #define AHB_WHITE_TG 1
15 #define AHB_GREEN_TG 2
17 #define AHB_PURPLE_TG 4
18 #define AHB_ORANGE_TG 5
19 #define AHB_YELLOW_TG 6
24 #define AHB_PURPLE_I 11
25 #define AHB_ORANGE_I 12
26 #define AHB_YELLOW_I 13
27 #define AHBplayerAccount sConfig.GetIntDefault("AuctionHouseBot.Account", 0)
28 #define AHBplayerGUID sConfig.GetIntDefault("AuctionHouseBot.GUID", 0)
29 #define ItemsPerCycle sConfig.GetIntDefault("AuctionHouseBot.ItemsPerCycle", 200)
30 #define SellMethod sConfig.GetIntDefault("AuctionHouseBot.UseBuyPriceForSeller", 1)
31 #define BuyMethod sConfig.GetIntDefault("AuctionHouseBot.UseBuyPriceForBuyer", 0)
42 uint32 percentGreyTradeGoods
;
43 uint32 percentWhiteTradeGoods
;
44 uint32 percentGreenTradeGoods
;
45 uint32 percentBlueTradeGoods
;
46 uint32 percentPurpleTradeGoods
;
47 uint32 percentOrangeTradeGoods
;
48 uint32 percentYellowTradeGoods
;
49 uint32 percentGreyItems
;
50 uint32 percentWhiteItems
;
51 uint32 percentGreenItems
;
52 uint32 percentBlueItems
;
53 uint32 percentPurpleItems
;
54 uint32 percentOrangeItems
;
55 uint32 percentYellowItems
;
58 uint32 minBidPriceGrey
;
59 uint32 maxBidPriceGrey
;
63 uint32 minBidPriceWhite
;
64 uint32 maxBidPriceWhite
;
68 uint32 minBidPriceGreen
;
69 uint32 maxBidPriceGreen
;
73 uint32 minBidPriceBlue
;
74 uint32 maxBidPriceBlue
;
76 uint32 minPricePurple
;
77 uint32 maxPricePurple
;
78 uint32 minBidPricePurple
;
79 uint32 maxBidPricePurple
;
80 uint32 maxStackPurple
;
81 uint32 minPriceOrange
;
82 uint32 maxPriceOrange
;
83 uint32 minBidPriceOrange
;
84 uint32 maxBidPriceOrange
;
85 uint32 maxStackOrange
;
86 uint32 minPriceYellow
;
87 uint32 maxPriceYellow
;
88 uint32 minBidPriceYellow
;
89 uint32 maxBidPriceYellow
;
90 uint32 maxStackYellow
;
92 uint32 buyerPriceGrey
;
93 uint32 buyerPriceWhite
;
94 uint32 buyerPriceGreen
;
95 uint32 buyerPriceBlue
;
96 uint32 buyerPricePurple
;
97 uint32 buyerPriceOrange
;
98 uint32 buyerPriceYellow
;
99 uint32 buyerBiddingInterval
;
100 uint32 buyerBidsPerInterval
;
117 AHBConfig(uint32 ahid
)
147 void SetMinItems(uint32 value
)
153 if ((minItems
== 0) && (maxItems
))
155 else if ((maxItems
) && (minItems
> maxItems
))
160 void SetMaxItems(uint32 value
)
169 void SetMinTime(uint32 value
)
177 else if ((maxTime
) && (minTime
> maxTime
))
182 void SetMaxTime(uint32 value
)
190 void SetPercentages(uint32 greytg
, uint32 whitetg
, uint32 greentg
, uint32 bluetg
, uint32 purpletg
, uint32 orangetg
, uint32 yellowtg
, uint32 greyi
, uint32 whitei
, uint32 greeni
, uint32 bluei
, uint32 purplei
, uint32 orangei
, uint32 yellowi
)
192 uint32 totalPercent
= greytg
+ whitetg
+ greentg
+ bluetg
+ purpletg
+ orangetg
+ yellowtg
+ greyi
+ whitei
+ greeni
+ bluei
+ purplei
+ orangei
+ yellowi
;
194 if (totalPercent
== 0)
198 else if (totalPercent
!= 100)
215 percentGreyTradeGoods
= greytg
;
216 percentWhiteTradeGoods
= whitetg
;
217 percentGreenTradeGoods
= greentg
;
218 percentBlueTradeGoods
= bluetg
;
219 percentPurpleTradeGoods
= purpletg
;
220 percentOrangeTradeGoods
= orangetg
;
221 percentYellowTradeGoods
= yellowtg
;
222 percentGreyItems
= greyi
;
223 percentWhiteItems
= whitei
;
224 percentGreenItems
= greeni
;
225 percentBlueItems
= bluei
;
226 percentPurpleItems
= purplei
;
227 percentOrangeItems
= orangei
;
228 percentYellowItems
= yellowi
;
231 uint32
GetPercentages(uint32 color
)
236 return percentGreyTradeGoods
;
239 return percentWhiteTradeGoods
;
242 return percentGreenTradeGoods
;
245 return percentBlueTradeGoods
;
248 return percentPurpleTradeGoods
;
251 return percentOrangeTradeGoods
;
254 return percentYellowTradeGoods
;
257 return percentGreyItems
;
260 return percentWhiteItems
;
263 return percentGreenItems
;
266 return percentBlueItems
;
269 return percentPurpleItems
;
272 return percentOrangeItems
;
275 return percentYellowItems
;
282 void SetMinPrice(uint32 color
, uint32 value
)
287 minPriceGrey
= value
;
290 minPriceWhite
= value
;
293 minPriceGreen
= value
;
296 minPriceBlue
= value
;
299 minPricePurple
= value
;
302 minPriceOrange
= value
;
305 minPriceYellow
= value
;
311 uint32
GetMinPrice(uint32 color
)
317 if (minPriceGrey
== 0)
319 else if (minPriceGrey
> maxPriceGrey
)
327 if (minPriceWhite
== 0)
329 else if (minPriceWhite
> maxPriceWhite
)
330 return maxPriceWhite
;
332 return minPriceWhite
;
337 if (minPriceGreen
== 0)
339 else if (minPriceGreen
> maxPriceGreen
)
340 return maxPriceGreen
;
342 return minPriceGreen
;
347 if (minPriceBlue
== 0)
349 else if (minPriceBlue
> maxPriceBlue
)
357 if (minPricePurple
== 0)
359 else if (minPricePurple
> maxPricePurple
)
360 return maxPricePurple
;
362 return minPricePurple
;
367 if (minPriceOrange
== 0)
369 else if (minPriceOrange
> maxPriceOrange
)
370 return maxPriceOrange
;
372 return minPriceOrange
;
377 if (minPriceYellow
== 0)
379 else if (minPriceYellow
> maxPriceYellow
)
380 return maxPriceYellow
;
382 return minPriceYellow
;
392 void SetMaxPrice(uint32 color
, uint32 value
)
397 maxPriceGrey
= value
;
400 maxPriceWhite
= value
;
403 maxPriceGreen
= value
;
406 maxPriceBlue
= value
;
409 maxPricePurple
= value
;
412 maxPriceOrange
= value
;
415 maxPriceYellow
= value
;
421 uint32
GetMaxPrice(uint32 color
)
427 if (maxPriceGrey
== 0)
435 if (maxPriceWhite
== 0)
438 return maxPriceWhite
;
443 if (maxPriceGreen
== 0)
446 return maxPriceGreen
;
451 if (maxPriceBlue
== 0)
459 if (maxPricePurple
== 0)
462 return maxPricePurple
;
467 if (maxPriceOrange
== 0)
470 return maxPriceOrange
;
475 if (maxPriceYellow
== 0)
478 return maxPriceYellow
;
488 void SetMinBidPrice(uint32 color
, uint32 value
)
493 minBidPriceGrey
= value
;
496 minBidPriceWhite
= value
;
499 minBidPriceGreen
= value
;
502 minBidPriceBlue
= value
;
505 minBidPricePurple
= value
;
508 minBidPriceOrange
= value
;
511 minBidPriceYellow
= value
;
517 uint32
GetMinBidPrice(uint32 color
)
523 if (minBidPriceGrey
> 100)
526 return minBidPriceGrey
;
531 if (minBidPriceWhite
> 100)
534 return minBidPriceWhite
;
539 if (minBidPriceGreen
> 100)
542 return minBidPriceGreen
;
547 if (minBidPriceBlue
> 100)
550 return minBidPriceBlue
;
555 if (minBidPricePurple
> 100)
558 return minBidPricePurple
;
563 if (minBidPriceOrange
> 100)
566 return minBidPriceOrange
;
571 if (minBidPriceYellow
> 100)
574 return minBidPriceYellow
;
584 void SetMaxBidPrice(uint32 color
, uint32 value
)
589 maxBidPriceGrey
= value
;
592 maxBidPriceWhite
= value
;
595 maxBidPriceGreen
= value
;
598 maxBidPriceBlue
= value
;
601 maxBidPricePurple
= value
;
604 maxBidPriceOrange
= value
;
607 maxBidPriceYellow
= value
;
613 uint32
GetMaxBidPrice(uint32 color
)
619 if (maxBidPriceGrey
> 100)
622 return maxBidPriceGrey
;
627 if (maxBidPriceWhite
> 100)
630 return maxBidPriceWhite
;
635 if (maxBidPriceGreen
> 100)
638 return maxBidPriceGreen
;
643 if (maxBidPriceBlue
> 100)
646 return maxBidPriceBlue
;
651 if (maxBidPricePurple
> 100)
654 return maxBidPricePurple
;
659 if (maxBidPriceOrange
> 100)
662 return maxBidPriceOrange
;
667 if (maxBidPriceYellow
> 100)
670 return maxBidPriceYellow
;
680 void SetMaxStack(uint32 color
, uint32 value
)
685 maxStackGrey
= value
;
688 maxStackWhite
= value
;
691 maxStackGreen
= value
;
694 maxStackBlue
= value
;
697 maxStackPurple
= value
;
700 maxStackOrange
= value
;
703 maxStackYellow
= value
;
709 uint32
GetMaxStack(uint32 color
)
720 return maxStackWhite
;
725 return maxStackGreen
;
735 return maxStackPurple
;
740 return maxStackOrange
;
745 return maxStackYellow
;
755 void SetBuyerPrice(uint32 color
, uint32 value
)
760 buyerPriceGrey
= value
;
763 buyerPriceWhite
= value
;
766 buyerPriceGreen
= value
;
769 buyerPriceBlue
= value
;
772 buyerPricePurple
= value
;
775 buyerPriceOrange
= value
;
778 buyerPriceYellow
= value
;
784 uint32
GetBuyerPrice(uint32 color
)
789 return buyerPriceGrey
;
792 return buyerPriceWhite
;
795 return buyerPriceGreen
;
798 return buyerPriceBlue
;
801 return buyerPricePurple
;
804 return buyerPriceOrange
;
807 return buyerPriceYellow
;
814 void SetBiddingInterval(uint32 value
)
816 buyerBiddingInterval
= value
;
818 uint32
GetBiddingInterval()
820 return buyerBiddingInterval
;
822 void CalculatePercents()
824 greytgp
= (uint32
) (((double)percentGreyTradeGoods
/ 100.0) * maxItems
);
825 whitetgp
= (uint32
) (((double)percentWhiteTradeGoods
/ 100.0) * maxItems
);
826 greentgp
= (uint32
) (((double)percentGreenTradeGoods
/ 100.0) * maxItems
);
827 bluetgp
= (uint32
) (((double)percentBlueTradeGoods
/ 100.0) * maxItems
);
828 purpletgp
= (uint32
) (((double)percentPurpleTradeGoods
/ 100.0) * maxItems
);
829 orangetgp
= (uint32
) (((double)percentOrangeTradeGoods
/ 100.0) * maxItems
);
830 yellowtgp
= (uint32
) (((double)percentYellowTradeGoods
/ 100.0) * maxItems
);
831 greyip
= (uint32
) (((double)percentGreyItems
/ 100.0) * maxItems
);
832 whiteip
= (uint32
) (((double)percentWhiteItems
/ 100.0) * maxItems
);
833 greenip
= (uint32
) (((double)percentGreenItems
/ 100.0) * maxItems
);
834 blueip
= (uint32
) (((double)percentBlueItems
/ 100.0) * maxItems
);
835 purpleip
= (uint32
) (((double)percentPurpleItems
/ 100.0) * maxItems
);
836 orangeip
= (uint32
) (((double)percentOrangeItems
/ 100.0) * maxItems
);
837 yellowip
= (uint32
) (((double)percentYellowItems
/ 100.0) * maxItems
);
838 uint32 total
= greytgp
+ whitetgp
+ greentgp
+ bluetgp
+ purpletgp
+ orangetgp
+ yellowtgp
+ greyip
+ whiteip
+ greenip
+ blueip
+ purpleip
+ orangeip
+ yellowip
;
839 int32 diff
= (maxItems
- total
);
842 if ((whiteip
- diff
) > 0)
844 else if ((greenip
- diff
) > 0)
852 uint32
GetPercents(uint32 color
)
903 void SetBidsPerInterval(uint32 value
)
905 buyerBidsPerInterval
= value
;
907 uint32
GetBidsPerInterval()
909 return buyerBidsPerInterval
;
915 void AuctionHouseBot();
916 void AuctionHouseBotInit();
917 void AuctionHouseBotLoadValues(AHBConfig
*);
918 void AuctionHouseBotCommands(uint32
, uint32
, uint32
, char*);