-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[11723] Auction House Bot (AHBot) patch applied
Thanks to Chris K, cyberium, Dolomit6, grether, Kerbe, Naicisum, Paradox, Xeross and other contributers for creating, long time improvments and patch up-to-date state support. AHBot disabled by default. For enable it you need have ahbot.conf in same dir where mangosd.conf placed and enable options: AuctionHouseBot.Seller.Enabled and/or AuctionHouseBot.Buyer.Enabled Original version ahbot.conf can be found by path: src/game/AuctionHouseBot/ahbot.conf.dist.in Note: chat commands from patch not included in commits and will added later after additional work. Signed-off-by: VladimirMangos <[email protected]>
- Loading branch information
antiroot
authored and
VladimirMangos
committed
Jul 8, 2011
1 parent
7fc59ff
commit 96e8b33
Showing
16 changed files
with
2,287 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Auction Houses Bot populates the auction houses with items. | ||
It makes the game feel a bit more active in auction usage part | ||
specially for low-populated servers. Items and prices are chosen | ||
randomly based on the parameters you define. If an auction expires, auctions | ||
are deleted quietly. AHBot will not buy it's own items, and will not receive | ||
mail from the AH or get returned mail. | ||
|
||
=============================================================================== | ||
~~HOW TO CONFIGURE~~ | ||
=============================================================================== | ||
|
||
You must copy config file template as ahbot.conf from src/game/AuctionHouseBot/ahbot.conf.dist.in | ||
to directory wher use store mangosd.conf file, and modify values to appropriate for you state. | ||
Read ahbot.conf option descriptions for details. | ||
|
||
Note: But default AHBot disabled by provided config options values |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
#ifndef AUCTION_HOUSE_BOT_H | ||
#define AUCTION_HOUSE_BOT_H | ||
|
||
#include "../World.h" | ||
#include "Config/Config.h" | ||
#include "../AuctionHouseMgr.h" | ||
#include "../SharedDefines.h" | ||
#include "../Item.h" | ||
|
||
// shadow of ItemQualities with skipped ITEM_QUALITY_HEIRLOOM, anything after ITEM_QUALITY_ARTIFACT(6) in fact | ||
enum AuctionQuality | ||
{ | ||
AUCTION_QUALITY_GREY = ITEM_QUALITY_POOR, | ||
AUCTION_QUALITY_WHITE = ITEM_QUALITY_NORMAL, | ||
AUCTION_QUALITY_GREEN = ITEM_QUALITY_UNCOMMON, | ||
AUCTION_QUALITY_BLUE = ITEM_QUALITY_RARE, | ||
AUCTION_QUALITY_PURPLE = ITEM_QUALITY_EPIC, | ||
AUCTION_QUALITY_ORANGE = ITEM_QUALITY_LEGENDARY, | ||
AUCTION_QUALITY_YELLOW = ITEM_QUALITY_ARTIFACT, | ||
}; | ||
|
||
#define MAX_AUCTION_QUALITY 7 | ||
|
||
enum AuctionBotConfigUInt32Values | ||
{ | ||
CONFIG_UINT32_AHBOT_MAXTIME, | ||
CONFIG_UINT32_AHBOT_MINTIME, | ||
CONFIG_UINT32_AHBOT_ITEMS_PER_CYCLE_BOOST, | ||
CONFIG_UINT32_AHBOT_ITEMS_PER_CYCLE_NORMAL, | ||
CONFIG_UINT32_AHBOT_ALLIANCE_ITEM_AMOUNT_RATIO, | ||
CONFIG_UINT32_AHBOT_HORDE_ITEM_AMOUNT_RATIO, | ||
CONFIG_UINT32_AHBOT_NEUTRAL_ITEM_AMOUNT_RATIO, | ||
CONFIG_UINT32_AHBOT_ITEM_MIN_ITEM_LEVEL, | ||
CONFIG_UINT32_AHBOT_ITEM_MAX_ITEM_LEVEL, | ||
CONFIG_UINT32_AHBOT_ITEM_MIN_REQ_LEVEL, | ||
CONFIG_UINT32_AHBOT_ITEM_MAX_REQ_LEVEL, | ||
CONFIG_UINT32_AHBOT_ITEM_MIN_SKILL_RANK, | ||
CONFIG_UINT32_AHBOT_ITEM_MAX_SKILL_RANK, | ||
CONFIG_UINT32_AHBOT_ITEM_GREY_AMOUNT, | ||
CONFIG_UINT32_AHBOT_ITEM_WHITE_AMOUNT, | ||
CONFIG_UINT32_AHBOT_ITEM_GREEN_AMOUNT, | ||
CONFIG_UINT32_AHBOT_ITEM_BLUE_AMOUNT, | ||
CONFIG_UINT32_AHBOT_ITEM_PURPLE_AMOUNT, | ||
CONFIG_UINT32_AHBOT_ITEM_ORANGE_AMOUNT, | ||
CONFIG_UINT32_AHBOT_ITEM_YELLOW_AMOUNT, | ||
CONFIG_UINT32_AHBOT_CLASS_CONSUMABLE_AMOUNT, | ||
CONFIG_UINT32_AHBOT_CLASS_CONTAINER_AMOUNT, | ||
CONFIG_UINT32_AHBOT_CLASS_WEAPON_AMOUNT, | ||
CONFIG_UINT32_AHBOT_CLASS_GEM_AMOUNT, | ||
CONFIG_UINT32_AHBOT_CLASS_ARMOR_AMOUNT, | ||
CONFIG_UINT32_AHBOT_CLASS_REAGENT_AMOUNT, | ||
CONFIG_UINT32_AHBOT_CLASS_PROJECTILE_AMOUNT, | ||
CONFIG_UINT32_AHBOT_CLASS_TRADEGOOD_AMOUNT, | ||
CONFIG_UINT32_AHBOT_CLASS_GENERIC_AMOUNT, | ||
CONFIG_UINT32_AHBOT_CLASS_RECIPE_AMOUNT, | ||
CONFIG_UINT32_AHBOT_CLASS_QUIVER_AMOUNT, | ||
CONFIG_UINT32_AHBOT_CLASS_QUEST_AMOUNT, | ||
CONFIG_UINT32_AHBOT_CLASS_KEY_AMOUNT, | ||
CONFIG_UINT32_AHBOT_CLASS_MISC_AMOUNT, | ||
CONFIG_UINT32_AHBOT_CLASS_GLYPH_AMOUNT, | ||
CONFIG_UINT32_AHBOT_ALLIANCE_PRICE_RATIO, | ||
CONFIG_UINT32_AHBOT_HORDE_PRICE_RATIO, | ||
CONFIG_UINT32_AHBOT_NEUTRAL_PRICE_RATIO, | ||
CONFIG_UINT32_AHBOT_BUYER_CHANCE_RATIO_ALLIANCE, | ||
CONFIG_UINT32_AHBOT_BUYER_CHANCE_RATIO_HORDE, | ||
CONFIG_UINT32_AHBOT_BUYER_CHANCE_RATIO_NEUTRAL, | ||
CONFIG_UINT32_AHBOT_BUYER_RECHECK_INTERVAL, | ||
CONFIG_UINT32_AHBOT_CLASS_MISC_MOUNT_MIN_REQ_LEVEL, | ||
CONFIG_UINT32_AHBOT_CLASS_MISC_MOUNT_MAX_REQ_LEVEL, | ||
CONFIG_UINT32_AHBOT_CLASS_MISC_MOUNT_MIN_SKILL_RANK, | ||
CONFIG_UINT32_AHBOT_CLASS_MISC_MOUNT_MAX_SKILL_RANK, | ||
CONFIG_UINT32_AHBOT_CLASS_GLYPH_MIN_REQ_LEVEL, | ||
CONFIG_UINT32_AHBOT_CLASS_GLYPH_MAX_REQ_LEVEL, | ||
CONFIG_UINT32_AHBOT_CLASS_GLYPH_MIN_ITEM_LEVEL, | ||
CONFIG_UINT32_AHBOT_CLASS_GLYPH_MAX_ITEM_LEVEL, | ||
CONFIG_UINT32_AHBOT_CLASS_TRADEGOOD_MIN_ITEM_LEVEL, | ||
CONFIG_UINT32_AHBOT_CLASS_TRADEGOOD_MAX_ITEM_LEVEL, | ||
CONFIG_UINT32_AHBOT_CLASS_CONTAINER_MIN_ITEM_LEVEL, | ||
CONFIG_UINT32_AHBOT_CLASS_CONTAINER_MAX_ITEM_LEVEL, | ||
CONFIG_UINT32_AHBOT_UINT32_COUNT | ||
}; | ||
|
||
enum AuctionBotConfigBoolValues | ||
{ | ||
CONFIG_BOOL_AHBOT_BUYER_ALLIANCE_ENABLED, | ||
CONFIG_BOOL_AHBOT_BUYER_HORDE_ENABLED, | ||
CONFIG_BOOL_AHBOT_BUYER_NEUTRAL_ENABLED, | ||
CONFIG_BOOL_AHBOT_ITEMS_VENDOR, | ||
CONFIG_BOOL_AHBOT_ITEMS_LOOT, | ||
CONFIG_BOOL_AHBOT_ITEMS_MISC, | ||
CONFIG_BOOL_AHBOT_BIND_NO, | ||
CONFIG_BOOL_AHBOT_BIND_PICKUP, | ||
CONFIG_BOOL_AHBOT_BIND_EQUIP, | ||
CONFIG_BOOL_AHBOT_BIND_USE, | ||
CONFIG_BOOL_AHBOT_BIND_QUEST, | ||
CONFIG_BOOL_AHBOT_BUYPRICE_SELLER, | ||
CONFIG_BOOL_AHBOT_BUYPRICE_BUYER, | ||
CONFIG_BOOL_AHBOT_DEBUG_SELLER, | ||
CONFIG_BOOL_AHBOT_DEBUG_BUYER, | ||
CONFIG_BOOL_AHBOT_SELLER_ENABLED, | ||
CONFIG_BOOL_AHBOT_BUYER_ENABLED, | ||
CONFIG_BOOL_AHBOT_LOCKBOX_ENABLED, | ||
CONFIG_UINT32_AHBOT_BOOL_COUNT | ||
}; | ||
|
||
// All basic config data used by other AHBot classes for self-configure. | ||
class AuctionBotConfig | ||
{ | ||
public: | ||
AuctionBotConfig() {} | ||
|
||
bool Initialize(); | ||
const char* GetAHBotIncludes() const { return m_AHBotIncludes.c_str(); } | ||
const char* GetAHBotExcludes() const { return m_AHBotExcludes.c_str(); } | ||
|
||
uint32 getConfig(AuctionBotConfigUInt32Values index) const { return m_configUint32Values[index]; } | ||
bool getConfig(AuctionBotConfigBoolValues index) const { return m_configBoolValues[index]; } | ||
void setConfig(AuctionBotConfigBoolValues index, bool value) { m_configBoolValues[index]=value; } | ||
void setConfig(AuctionBotConfigUInt32Values index, uint32 value) { m_configUint32Values[index]=value; } | ||
|
||
uint32 getConfigItemAmountRatio(AuctionHouseType houseType) const; | ||
bool getConfigBuyerEnabled(AuctionHouseType houseType) const; | ||
|
||
|
||
uint32 GetItemPerCycleBoost() const { return m_ItemsPerCycleBoost; } | ||
uint32 GetItemPerCycleNormal() const { return m_ItemsPerCycleNormal; } | ||
bool Reload(); | ||
|
||
static char const* GetItemClassName(ItemClass itemclass); | ||
static char const* GetHouseTypeName(AuctionHouseType houseType); | ||
|
||
private: | ||
std::string m_AHBotIncludes; | ||
std::string m_AHBotExcludes; | ||
Config m_AhBotCfg; | ||
uint32 m_ItemsPerCycleBoost; | ||
uint32 m_ItemsPerCycleNormal; | ||
|
||
uint32 m_configUint32Values[CONFIG_UINT32_AHBOT_UINT32_COUNT]; | ||
bool m_configBoolValues[CONFIG_UINT32_AHBOT_BOOL_COUNT]; | ||
|
||
void SetAHBotIncludes(const std::string& AHBotIncludes) { m_AHBotIncludes = AHBotIncludes; } | ||
void SetAHBotExcludes(const std::string& AHBotExcludes) { m_AHBotExcludes = AHBotExcludes; } | ||
|
||
void setConfig(AuctionBotConfigUInt32Values index, char const* fieldname, uint32 defvalue); | ||
void setConfigMax(AuctionBotConfigUInt32Values index, char const* fieldname, uint32 defvalue, uint32 maxvalue); | ||
void setConfigMinMax(AuctionBotConfigUInt32Values index, char const* fieldname, uint32 defvalue, uint32 minvalue, uint32 maxvalue); | ||
void setConfig(AuctionBotConfigBoolValues index, char const* fieldname, bool defvalue); | ||
void GetConfigFromFile(); | ||
}; | ||
|
||
#define sAuctionBotConfig MaNGOS::Singleton<AuctionBotConfig>::Instance() | ||
|
||
class AuctionBotAgent | ||
{ | ||
public: | ||
AuctionBotAgent() {} | ||
virtual ~AuctionBotAgent() {} | ||
public: | ||
virtual bool Initialize() =0; | ||
virtual bool Update(AuctionHouseType houseType) =0; | ||
}; | ||
|
||
struct AuctionHouseBotStatusInfoPerType | ||
{ | ||
uint32 ItemsCount; | ||
uint32 QualityInfo[MAX_AUCTION_QUALITY]; | ||
}; | ||
|
||
typedef AuctionHouseBotStatusInfoPerType AuctionHouseBotStatusInfo[MAX_AUCTION_HOUSE_TYPE]; | ||
|
||
// This class handle both Selling and Buying method | ||
// (holder of AuctionBotBuyer and AuctionBotSeller objects) | ||
class AuctionHouseBot | ||
{ | ||
public: | ||
AuctionHouseBot(); | ||
~AuctionHouseBot(); | ||
|
||
void Update(); | ||
void Initialize(); | ||
|
||
// Followed method is mainly used by level3.cpp for ingame/console command | ||
void SetItemsRatio(uint32* al, uint32* ho, uint32* ne); | ||
void SetItemsAmount(uint32* grey_i, uint32* white_i, uint32* green_i, uint32* blue_i, uint32* purple_i, uint32* orange_i, uint32* yellow_i); | ||
bool ReloadAllConfig(); | ||
void Rebuild(bool all); | ||
|
||
void PrepareStatusInfos(AuctionHouseBotStatusInfo& statusInfo); | ||
private: | ||
void InitilizeAgents(); | ||
|
||
AuctionBotAgent* m_Buyer; | ||
AuctionBotAgent* m_Seller; | ||
|
||
uint32 m_OperationSelector; // 0..2*MAX_AUCTION_HOUSE_TYPE-1 | ||
}; | ||
|
||
#define sAuctionBot MaNGOS::Singleton<AuctionHouseBot>::Instance() | ||
|
||
#endif |
Oops, something went wrong.