diff --git a/conf/mod_ahbot.conf.dist b/conf/mod_ahbot.conf.dist index 293b0f0..b77d979 100644 --- a/conf/mod_ahbot.conf.dist +++ b/conf/mod_ahbot.conf.dist @@ -94,6 +94,11 @@ # 2 = shorts, auctions lasts within an hour # Default 1 # +# AuctionHouseBot.SellZeroPriceItems +# Sell items which does not have a price associated (depending also on UseBuyPriceForSeller) by +# proposing a price which depends on the item level and its rarity class. +# Default 0 (disabled) +# ############################################################################### AuctionHouseBot.DEBUG = 0 @@ -117,6 +122,7 @@ AuctionHouseBot.ConsiderOnlyBotAuctions = 0 AuctionHouseBot.DuplicatesCount = 0 AuctionHouseBot.DivisibleStacks = 0 AuctionHouseBot.ElapsingTimeClass = 1 +AuctionHouseBot.SellZeroPriceItems = 0 ############################################################################### # AUCTION HOUSE BOT FILTERS PART 1 diff --git a/src/AuctionHouseBot.cpp b/src/AuctionHouseBot.cpp index e74d674..d4b90a4 100644 --- a/src/AuctionHouseBot.cpp +++ b/src/AuctionHouseBot.cpp @@ -870,6 +870,29 @@ void AuctionHouseBot::Sell(Player* AHBplayer, AHBConfig* config) } } + // + // If the buyout price is still zero, determine a random one using the item level + // + + if (config->SellZeroPriceItems) + { + if (buyoutPrice == 0) + { + buyoutPrice = urand(prototype->ItemLevel, prototype->ItemLevel + 10) * 10; + + if (buyoutPrice <= 0) + { + if (config->DebugOutSeller) + { + LOG_ERROR("module", "AHBot [{}]: Could not determine a price for item {} of quality {} (min={}, max={})", _id, itemID, prototype->Quality, config->GetMinPrice(prototype->Quality), config->GetMaxPrice(prototype->Quality)); + } + + item->RemoveFromUpdateQueueOf(AHBplayer); + continue; + } + } + } + buyoutPrice = buyoutPrice * urand(config->GetMinPrice(prototype->Quality), config->GetMaxPrice(prototype->Quality)); buyoutPrice = buyoutPrice / 100; @@ -1450,5 +1473,5 @@ void AuctionHouseBot::Initialize(AHBConfig* allianceConfig, AHBConfig* hordeConf // Done // - LOG_INFO("module", "AHBot [{}]: initialization complete", uint32(_id)); + LOG_INFO("module", "AHBot [{}]: initialization complete\n", uint32(_id)); } diff --git a/src/AuctionHouseBotConfig.cpp b/src/AuctionHouseBotConfig.cpp index 0cb742a..806a4d6 100644 --- a/src/AuctionHouseBotConfig.cpp +++ b/src/AuctionHouseBotConfig.cpp @@ -203,6 +203,7 @@ AHBConfig::AHBConfig(uint32 ahid, AHBConfig* conf) BuyMethod = conf->BuyMethod; SellMethod = conf->SellMethod; ConsiderOnlyBotAuctions = conf->ConsiderOnlyBotAuctions; + SellZeroPriceItems = conf->SellZeroPriceItems; ItemsPerCycle = conf->ItemsPerCycle; Vendor_Items = conf->Vendor_Items; Loot_Items = conf->Loot_Items; @@ -510,6 +511,7 @@ void AHBConfig::Reset() SellMethod = false; SellAtMarketPrice = false; ConsiderOnlyBotAuctions = false; + SellZeroPriceItems = false; ItemsPerCycle = 200; Vendor_Items = false; @@ -2014,6 +2016,8 @@ uint64 AHBConfig::GetItemPrice(uint32 id) void AHBConfig::Initialize(std::set botsIds) { + LOG_INFO("module", "Initializing configuration for AH {}...", AHID); + InitializeFromFile(); InitializeFromSql(botsIds); InitializeBins(); @@ -2044,6 +2048,7 @@ void AHBConfig::InitializeFromFile() DivisibleStacks = sConfigMgr->GetOption ("AuctionHouseBot.DivisibleStacks" , false); ElapsingTimeClass = sConfigMgr->GetOption("AuctionHouseBot.DuplicatesCount" , 1); ConsiderOnlyBotAuctions = sConfigMgr->GetOption ("AuctionHouseBot.ConsiderOnlyBotAuctions", false); + SellZeroPriceItems = sConfigMgr->GetOption ("AuctionHouseBot.SellZeroPriceItems" , false); ItemsPerCycle = sConfigMgr->GetOption("AuctionHouseBot.ItemsPerCycle" , 200); // @@ -2590,31 +2595,34 @@ void AHBConfig::InitializeBins() } // - // Exclude items with no possible price + // Exclude items that does not have a price // - if (SellMethod) + if (!SellZeroPriceItems) { - if (itr->second.BuyPrice == 0) + if (SellMethod) { - continue; + if (itr->second.BuyPrice == 0) + { + continue; + } } - } - else - { - if (itr->second.SellPrice == 0) + else { - continue; + if (itr->second.SellPrice == 0) + { + continue; + } } - } - // - // Exclude items with no costs associated, in any case - // + // + // Exclude items with no costs associated, in any case + // - if ((itr->second.BuyPrice == 0) && (itr->second.SellPrice == 0)) - { - continue; + if ((itr->second.BuyPrice == 0) && (itr->second.SellPrice == 0)) + { + continue; + } } // @@ -3329,8 +3337,6 @@ void AHBConfig::InitializeBins() // Perform reporting and the last check: if no items are disabled or in the whitelist clear the bin making the selling useless // - LOG_INFO("module", "AHBot: Configuration for ah {}", AHID); - if (SellerWhiteList.size() == 0) { if (DisableItemStore.size() == 0) @@ -3357,27 +3363,32 @@ void AHBConfig::InitializeBins() return; } - LOG_INFO("module", "AHBot: {} disabled items", uint32(DisableItemStore.size())); + LOG_INFO("module", ">> Using all compatible items ({} disabled)", uint32(DisableItemStore.size())); } else { - LOG_INFO("module", "AHBot: Using a whitelist of {} items", uint32(SellerWhiteList.size())); - } - - LOG_INFO("module", "AHBot: loaded {} grey trade goods", uint32(GreyTradeGoodsBin.size())); - LOG_INFO("module", "AHBot: loaded {} white trade goods", uint32(WhiteTradeGoodsBin.size())); - LOG_INFO("module", "AHBot: loaded {} green trade goods", uint32(GreenTradeGoodsBin.size())); - LOG_INFO("module", "AHBot: loaded {} blue trade goods", uint32(BlueTradeGoodsBin.size())); - LOG_INFO("module", "AHBot: loaded {} purple trade goods", uint32(PurpleTradeGoodsBin.size())); - LOG_INFO("module", "AHBot: loaded {} orange trade goods", uint32(OrangeTradeGoodsBin.size())); - LOG_INFO("module", "AHBot: loaded {} yellow trade goods", uint32(YellowTradeGoodsBin.size())); - LOG_INFO("module", "AHBot: loaded {} grey items" , uint32(GreyItemsBin.size())); - LOG_INFO("module", "AHBot: loaded {} white items" , uint32(WhiteItemsBin.size())); - LOG_INFO("module", "AHBot: loaded {} green items" , uint32(GreenItemsBin.size())); - LOG_INFO("module", "AHBot: loaded {} blue items" , uint32(BlueItemsBin.size())); - LOG_INFO("module", "AHBot: loaded {} purple items" , uint32(PurpleItemsBin.size())); - LOG_INFO("module", "AHBot: loaded {} orange items" , uint32(OrangeItemsBin.size())); - LOG_INFO("module", "AHBot: loaded {} yellow items" , uint32(YellowItemsBin.size())); + LOG_INFO("module", ">> Using a whitelist of {} items", uint32(SellerWhiteList.size())); + } + + LOG_INFO("module", ">>\tgrey\twhite\tgreen\tblue\tpurple\torange\tyellow", uint32(GreyTradeGoodsBin.size())); + + LOG_INFO("module", ">>\t{}\t{}\t{}\t{}\t{}\t{}\t{}\ttrade goods", + uint32(GreyTradeGoodsBin.size()), + uint32(WhiteTradeGoodsBin.size()), + uint32(GreenTradeGoodsBin.size()), + uint32(BlueTradeGoodsBin.size()), + uint32(PurpleTradeGoodsBin.size()), + uint32(OrangeTradeGoodsBin.size()), + uint32(YellowTradeGoodsBin.size())); + + LOG_INFO("module", ">>\t{}\t{}\t{}\t{}\t{}\t{}\t{}\titems\n", + uint32(GreyItemsBin.size()), + uint32(WhiteItemsBin.size()), + uint32(GreenItemsBin.size()), + uint32(BlueItemsBin.size()), + uint32(PurpleItemsBin.size()), + uint32(OrangeItemsBin.size()), + uint32(YellowItemsBin.size())); } std::set AHBConfig::getCommaSeparatedIntegers(std::string text) diff --git a/src/AuctionHouseBotConfig.h b/src/AuctionHouseBotConfig.h index f649037..f79b7f3 100644 --- a/src/AuctionHouseBotConfig.h +++ b/src/AuctionHouseBotConfig.h @@ -183,6 +183,7 @@ class AHBConfig bool BuyMethod; bool SellMethod; bool SellAtMarketPrice; + bool SellZeroPriceItems; uint32 MarketResetThreshold; bool ConsiderOnlyBotAuctions; uint32 ItemsPerCycle; diff --git a/src/AuctionHouseBotWorldScript.cpp b/src/AuctionHouseBotWorldScript.cpp index 2a36e17..07394e6 100644 --- a/src/AuctionHouseBotWorldScript.cpp +++ b/src/AuctionHouseBotWorldScript.cpp @@ -124,8 +124,6 @@ void AHBot_WorldScript::OnBeforeConfigLoad(bool reload) void AHBot_WorldScript::OnStartup() { - LOG_INFO("server.loading", "Initialize AuctionHouseBot..."); - // // Initialize the configuration (done only once at startup) //