Merge pull request #192 from advocaite/karrz-ahbot-quality-mix
AH bot: list the full mix of qualities (greens, blues, epics) like the WoW Forever repack
This commit is contained in:
+6
-1
@@ -8,7 +8,12 @@ Seller.cpp has a 3-line hook. Everything stays off unless `AuctionHouseBot.Selle
|
||||
Filter (`AuctionHouseBot.Vanilla.Only = 1`): no gems/glyphs, no later-expansion items, quality up to epic,
|
||||
required level <= `Vanilla.MaxReqLevel` (60), item level <= `Vanilla.MaxItemLevel` (100). Force-include list
|
||||
(`AuctionHouseBot.forceIncludeItems`) bypasses it. Prices come from vendor buy/sell price x the
|
||||
`AuctionHouseBot.*.Price.Ratio` keys. Per-bot posting/buying lives separately in
|
||||
`AuctionHouseBot.*.Price.Ratio` keys. `AuctionHouseBot.Items.Crafted = 1` (presets) also lists items a profession recipe makes, which are in no loot or vendor
|
||||
list and so were dropped by `Items.Misc = 0`. `AuctionHouseBot.Class.WeightByPoolSize = 1` (presets) shares each quality's amount by class priority times
|
||||
the number of different items in that class, so greens and blues are mostly gear instead of the same few bags, arrows and trade goods.
|
||||
`AuctionHouseBot.Vanilla.ValueCurve = 1` (presets) prices by item level squared x quality (1/2/15/50/150 copper for gray to epic)
|
||||
x class (gear, bags, trade goods 100%, recipes and misc 50%, consumables 25%, ammo and reagents vendor price only), never below
|
||||
vendor price; the buyer's fair price uses the same value. The 70532 data gives loot-only goods such as essences a 1 copper vendor price. Per-bot posting/buying lives separately in
|
||||
`Bot/States/Rules/AuctionRules.cpp`.
|
||||
|
||||
Not built or run in the cloud (no full toolchain): first test is on the PC. Check the startup log for
|
||||
|
||||
@@ -170,6 +170,7 @@ void AuctionBotConfig::GetConfigFromFile()
|
||||
SetConfig(CONFIG_AHBOT_ITEMS_VENDOR, "AuctionHouseBot.Items.Vendor", false);
|
||||
SetConfig(CONFIG_AHBOT_ITEMS_LOOT, "AuctionHouseBot.Items.Loot", true);
|
||||
SetConfig(CONFIG_AHBOT_ITEMS_MISC, "AuctionHouseBot.Items.Misc", false);
|
||||
SetConfig(CONFIG_AHBOT_ITEMS_CRAFTED, "AuctionHouseBot.Items.Crafted", false);
|
||||
|
||||
SetConfig(CONFIG_AHBOT_BIND_NO, "AuctionHouseBot.Bind.No", true);
|
||||
SetConfig(CONFIG_AHBOT_BIND_PICKUP, "AuctionHouseBot.Bind.Pickup", false);
|
||||
@@ -177,6 +178,7 @@ void AuctionBotConfig::GetConfigFromFile()
|
||||
SetConfig(CONFIG_AHBOT_BIND_USE, "AuctionHouseBot.Bind.Use", true);
|
||||
SetConfig(CONFIG_AHBOT_BIND_QUEST, "AuctionHouseBot.Bind.Quest", false);
|
||||
SetConfig(CONFIG_AHBOT_LOCKBOX_ENABLED, "AuctionHouseBot.LockBox.Enabled", false);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_WEIGHT_BY_POOL, "AuctionHouseBot.Class.WeightByPoolSize", false);
|
||||
|
||||
SetConfig(CONFIG_AHBOT_BUYPRICE_SELLER, "AuctionHouseBot.BuyPrice.Seller", false);
|
||||
|
||||
|
||||
@@ -171,6 +171,7 @@ enum AuctionBotConfigBoolValues
|
||||
CONFIG_AHBOT_ITEMS_VENDOR,
|
||||
CONFIG_AHBOT_ITEMS_LOOT,
|
||||
CONFIG_AHBOT_ITEMS_MISC,
|
||||
CONFIG_AHBOT_ITEMS_CRAFTED,
|
||||
CONFIG_AHBOT_BIND_NO,
|
||||
CONFIG_AHBOT_BIND_PICKUP,
|
||||
CONFIG_AHBOT_BIND_EQUIP,
|
||||
@@ -180,6 +181,7 @@ enum AuctionBotConfigBoolValues
|
||||
CONFIG_AHBOT_SELLER_ENABLED,
|
||||
CONFIG_AHBOT_BUYER_ENABLED,
|
||||
CONFIG_AHBOT_LOCKBOX_ENABLED,
|
||||
CONFIG_AHBOT_CLASS_WEIGHT_BY_POOL,
|
||||
CONFIG_AHBOT_CLASS_CONSUMABLE_ALLOW_ZERO,
|
||||
CONFIG_AHBOT_CLASS_CONTAINER_ALLOW_ZERO,
|
||||
CONFIG_AHBOT_CLASS_WEAPON_ALLOW_ZERO,
|
||||
|
||||
@@ -85,6 +85,8 @@ bool AuctionBotBuyer::Update(AuctionHouseType houseType)
|
||||
|
||||
BuyerConfiguration& config = _houseConfig[houseType];
|
||||
uint32 eligibleItems = GetItemInformation(config);
|
||||
AuctionBotBuyerPolicy::NoteCycle(eligibleItems);
|
||||
AuctionBotBuyerPolicy::LogCounters();
|
||||
if (eligibleItems)
|
||||
{
|
||||
// Prepare list of items to bid or buy - remove old items
|
||||
@@ -351,12 +353,19 @@ void AuctionBotBuyer::BuyAndBidItems(BuyerConfiguration& config)
|
||||
}
|
||||
|
||||
// never pay above the price cap (AuctionHouseBot.Buyer.MaxPriceMultiplier)
|
||||
bool capped = false;
|
||||
if (uint64 cap = AuctionBotBuyerPolicy::MaxUnitPrice(auction))
|
||||
{
|
||||
if (AuctionBotBuyerPolicy::PerItemPrice(auction, auction->BuyoutOrUnitPrice) > cap)
|
||||
{
|
||||
capped = capped || successBuy;
|
||||
successBuy = false;
|
||||
}
|
||||
if (AuctionBotBuyerPolicy::PerItemPrice(auction, bidPrice) > cap)
|
||||
{
|
||||
capped = capped || successBid;
|
||||
successBid = false;
|
||||
}
|
||||
}
|
||||
|
||||
// If roll bidding succesfully and bid price is above buyout -> buyout
|
||||
@@ -370,9 +379,15 @@ void AuctionBotBuyer::BuyAndBidItems(BuyerConfiguration& config)
|
||||
AuctionBotBuyerPolicy::RecordBuy(auction, AuctionBotBuyerPolicy::TotalPrice(auction, auction->BuyoutOrUnitPrice),
|
||||
AuctionBotConfig::GetHouseTypeName(config.GetHouseType()));
|
||||
BuyEntry(auction, auctionHouse); // buyout
|
||||
AuctionBotBuyerPolicy::Note(AuctionBotBuyerPolicy::Outcome::Bought);
|
||||
}
|
||||
else if (successBid)
|
||||
{
|
||||
PlaceBidToEntry(auction, auctionHouse, bidPrice); // bid
|
||||
AuctionBotBuyerPolicy::Note(AuctionBotBuyerPolicy::Outcome::Bid);
|
||||
}
|
||||
else
|
||||
AuctionBotBuyerPolicy::Note(capped ? AuctionBotBuyerPolicy::Outcome::OverCap : AuctionBotBuyerPolicy::Outcome::LostRoll);
|
||||
|
||||
itr->second.LastChecked = now;
|
||||
--cycles;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "AuctionHouseBotBuyerPolicy.h"
|
||||
#include "AuctionHouseBotVanilla.h"
|
||||
#include "AuctionHouseMgr.h"
|
||||
#include "Common.h"
|
||||
#include "Config.h"
|
||||
@@ -48,6 +49,13 @@ namespace
|
||||
time_t _hourStart = 0;
|
||||
uint32 _boughtThisHour = 0;
|
||||
|
||||
struct Counters
|
||||
{
|
||||
uint32 fresh = 0, hourLimit = 0, dayLimit = 0, bought = 0, bid = 0, lostRoll = 0, overCap = 0;
|
||||
uint32 cycles = 0, emptyCycles = 0;
|
||||
} _counters;
|
||||
time_t _countersLogged = 0;
|
||||
|
||||
void RollWindows(time_t now)
|
||||
{
|
||||
if (!_dayStart || now - _dayStart >= DAY)
|
||||
@@ -69,7 +77,8 @@ namespace
|
||||
{
|
||||
uint64 buy = proto->GetBuyPrice() / std::max<uint32>(1, proto->GetBuyCount());
|
||||
uint64 sell = uint64(proto->GetSellPrice()) * 4;
|
||||
return std::max<uint64>({ buy, sell, SILVER });
|
||||
// the seller's market value when AuctionHouseBot.Vanilla.ValueCurve is on, so the buyer pays what the bot asks
|
||||
return std::max<uint64>({ buy, sell, AuctionBotVanilla::UnitValue(proto), SILVER });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,14 +105,60 @@ bool Eligible(AuctionPosting const* auction)
|
||||
RollWindows(now);
|
||||
|
||||
if (_maxBuysPerHour && _boughtThisHour >= _maxBuysPerHour)
|
||||
{
|
||||
Note(Outcome::SkippedHourLimit);
|
||||
return false;
|
||||
}
|
||||
if (_dailyBudget && _spentToday >= _dailyBudget)
|
||||
{
|
||||
Note(Outcome::SkippedDayLimit);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Leave new listings alone for a while; the delay differs per listing but never changes for one.
|
||||
uint32 const span = _maxDelay - _minDelay;
|
||||
uint32 const delay = _minDelay + (span ? (auction->Id * 2654435761u) % (span + 1) : 0);
|
||||
return now - time_t(std::chrono::duration_cast<Seconds>(auction->StartTime.time_since_epoch()).count()) >= time_t(delay);
|
||||
if (now - time_t(std::chrono::duration_cast<Seconds>(auction->StartTime.time_since_epoch()).count()) >= time_t(delay))
|
||||
return true;
|
||||
Note(Outcome::SkippedFresh);
|
||||
return false;
|
||||
}
|
||||
|
||||
void Note(Outcome outcome)
|
||||
{
|
||||
switch (outcome)
|
||||
{
|
||||
case Outcome::SkippedFresh: ++_counters.fresh; break;
|
||||
case Outcome::SkippedHourLimit: ++_counters.hourLimit; break;
|
||||
case Outcome::SkippedDayLimit: ++_counters.dayLimit; break;
|
||||
case Outcome::Bought: ++_counters.bought; break;
|
||||
case Outcome::Bid: ++_counters.bid; break;
|
||||
case Outcome::LostRoll: ++_counters.lostRoll; break;
|
||||
case Outcome::OverCap: ++_counters.overCap; break;
|
||||
}
|
||||
}
|
||||
|
||||
void NoteCycle(uint32 eligible)
|
||||
{
|
||||
++_counters.cycles;
|
||||
if (!eligible)
|
||||
++_counters.emptyCycles;
|
||||
}
|
||||
|
||||
void LogCounters()
|
||||
{
|
||||
time_t const now = GameTime::GetGameTime();
|
||||
if (!_countersLogged)
|
||||
_countersLogged = now;
|
||||
if (now - _countersLogged < 10 * MINUTE)
|
||||
return;
|
||||
_countersLogged = now;
|
||||
|
||||
Counters const c = _counters;
|
||||
_counters = Counters();
|
||||
uint32 const fail = c.lostRoll + c.overCap;
|
||||
TC_LOG_INFO("ahbot", "[ahbot] buyouts attempts={} ok={} fail={} (lost_roll={} over_cap={}) bids={} skipped(fresh={} hour_limit={} day_limit={}) cycles={} empty_cycles={}",
|
||||
c.bought + c.bid + fail, c.bought, fail, c.lostRoll, c.overCap, c.bid, c.fresh, c.hourLimit, c.dayLimit, c.cycles, c.emptyCycles);
|
||||
}
|
||||
|
||||
bool FairPricingEnabled()
|
||||
@@ -161,7 +216,7 @@ void RecordBuy(AuctionPosting const* auction, uint64 totalPrice, char const* hou
|
||||
++_boughtToday;
|
||||
++_boughtThisHour;
|
||||
|
||||
TC_LOG_DEBUG("ahbot", "AHBot: buy {} x{} for {:.2f}g in {} (today: {} buys, {:.2f}g)",
|
||||
TC_LOG_INFO("ahbot", "AHBot: buy {} x{} for {:.2f}g in {} (today: {} buys, {:.2f}g)",
|
||||
auction->Items[0]->GetTemplate()->GetName(sWorld->GetDefaultDbcLocale()), auction->GetTotalItemCount(),
|
||||
float(totalPrice) / float(GOLD), house, _boughtToday, float(_spentToday) / float(GOLD));
|
||||
}
|
||||
|
||||
@@ -55,6 +55,25 @@ namespace AuctionBotBuyerPolicy
|
||||
// Updates the hourly/daily counters after a buyout.
|
||||
TC_GAME_API void RecordBuy(AuctionPosting const* auction, uint64 totalPrice, char const* house);
|
||||
|
||||
// What became of one auction the buyer looked at, for the periodic counter line.
|
||||
enum class Outcome : uint8
|
||||
{
|
||||
SkippedFresh, // the listing is too new (Buyer.MinDelay / MaxDelay)
|
||||
SkippedHourLimit, // Buyer.MaxBuysPerHour is spent
|
||||
SkippedDayLimit, // Buyer.DailyBudgetGold is spent
|
||||
Bought, // buyout done
|
||||
Bid, // a bid was placed instead
|
||||
LostRoll, // rolled for a buyout and a bid, neither came up
|
||||
OverCap // a roll came up but the price is above Buyer.MaxPriceMultiplier
|
||||
};
|
||||
TC_GAME_API void Note(Outcome outcome);
|
||||
|
||||
// One buyer cycle ran for a house, with `eligible` listings the buyer may buy or bid on (0 = nothing to look at).
|
||||
TC_GAME_API void NoteCycle(uint32 eligible);
|
||||
|
||||
// Every ten minutes: one info line with the counters since the last one, then they start again.
|
||||
TC_GAME_API void LogCounters();
|
||||
|
||||
// Buyer spend today and limits, for .ahbot stats
|
||||
TC_GAME_API std::string Describe();
|
||||
}
|
||||
|
||||
@@ -26,7 +26,10 @@
|
||||
#include "Containers.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Random.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "SpellMgr.h"
|
||||
#include <limits>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
|
||||
AuctionBotSeller::AuctionBotSeller()
|
||||
@@ -44,6 +47,7 @@ bool AuctionBotSeller::Initialize()
|
||||
{
|
||||
std::unordered_set<uint32> npcItems;
|
||||
std::unordered_set<uint32> lootItems;
|
||||
std::unordered_set<uint32> craftedItems;
|
||||
std::unordered_set<uint32> includeItems;
|
||||
std::unordered_set<uint32> excludeItems;
|
||||
|
||||
@@ -107,6 +111,28 @@ bool AuctionBotSeller::Initialize()
|
||||
}
|
||||
|
||||
TC_LOG_DEBUG("ahbot", "Loot filter has {} items", lootItems.size());
|
||||
|
||||
// AuctionHouseBot.Items.Crafted: items a profession recipe makes (Lesser Magic Wand, crafted gear) are in no loot or
|
||||
// vendor table, so Items.Misc = 0 dropped every one of them
|
||||
if (sAuctionBotConfig->GetConfig(CONFIG_AHBOT_ITEMS_CRAFTED))
|
||||
{
|
||||
for (SkillLineAbilityEntry const* ability : sSkillLineAbilityStore)
|
||||
{
|
||||
SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(ability->SkillLine);
|
||||
if (!skillLine || (skillLine->CategoryID != SKILL_CATEGORY_PROFESSION && skillLine->CategoryID != SKILL_CATEGORY_SECONDARY))
|
||||
continue;
|
||||
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(ability->Spell, DIFFICULTY_NONE);
|
||||
if (!spellInfo)
|
||||
continue;
|
||||
|
||||
for (SpellEffectInfo const& effect : spellInfo->GetEffects())
|
||||
if (effect.IsEffect(SPELL_EFFECT_CREATE_ITEM) && effect.ItemType)
|
||||
craftedItems.insert(effect.ItemType);
|
||||
}
|
||||
}
|
||||
|
||||
TC_LOG_DEBUG("ahbot", "Crafted filter has {} items", craftedItems.size());
|
||||
TC_LOG_DEBUG("ahbot", "Sorting and cleaning items for AHBot seller...");
|
||||
|
||||
uint32 itemsAdded = 0;
|
||||
@@ -229,8 +255,9 @@ bool AuctionBotSeller::Initialize()
|
||||
{
|
||||
bool const isVendorItem = npcItems.count(itemId) > 0;
|
||||
bool const isLootItem = lootItems.count(itemId) > 0;
|
||||
bool const isCraftedItem = craftedItems.count(itemId) > 0;
|
||||
|
||||
if (!isLootItem && !isVendorItem)
|
||||
if (!isLootItem && !isVendorItem && !isCraftedItem)
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -453,6 +480,15 @@ void AuctionBotSeller::LoadItemsQuantity(SellerConfiguration& config)
|
||||
return sAuctionBotConfig->GetConfig(index);
|
||||
};
|
||||
|
||||
// AuctionHouseBot.Class.WeightByPoolSize: a class's share also grows with its number of different items,
|
||||
// so a few green bags or arrows are not listed dozens of times each while green gear gets few slots
|
||||
bool const weightByPool = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_WEIGHT_BY_POOL);
|
||||
auto getWeight = [&](uint32 quality, uint32 itemClass) -> uint32
|
||||
{
|
||||
uint32 prio = getPriorityForClass(itemClass);
|
||||
return weightByPool ? prio * uint32(_itemPool[quality][itemClass].size()) : prio;
|
||||
};
|
||||
|
||||
std::vector<uint32> totalPrioPerQuality(MAX_AUCTION_QUALITY);
|
||||
for (uint32 j = 0; j < MAX_AUCTION_QUALITY; ++j)
|
||||
{
|
||||
@@ -462,7 +498,7 @@ void AuctionBotSeller::LoadItemsQuantity(SellerConfiguration& config)
|
||||
if (_itemPool[j][i].empty())
|
||||
continue;
|
||||
|
||||
totalPrioPerQuality[j] += getPriorityForClass(i);
|
||||
totalPrioPerQuality[j] += getWeight(j, i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,7 +510,7 @@ void AuctionBotSeller::LoadItemsQuantity(SellerConfiguration& config)
|
||||
|
||||
for (uint32 i = 0; i < MAX_ITEM_CLASS; ++i)
|
||||
{
|
||||
uint32 classPrio = getPriorityForClass(i);
|
||||
uint32 classPrio = getWeight(j, i);
|
||||
if (_itemPool[j][i].empty())
|
||||
classPrio = 0;
|
||||
|
||||
@@ -532,14 +568,32 @@ void AuctionBotSeller::LoadSellerValues(SellerConfiguration& config)
|
||||
// Fill ItemInfos object with real content of AH.
|
||||
uint32 AuctionBotSeller::SetStat(SellerConfiguration& config)
|
||||
{
|
||||
AllItemsArray itemsSaved;
|
||||
AllItemsArray itemsSaved = {};
|
||||
|
||||
std::map<std::pair<uint32, uint32>, uint32> bonusQualityDiffers; // (item quality, bonus quality) -> listings
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsById(sAuctionBotConfig->GetAuctionHouseId(config.GetHouseType()));
|
||||
for (auto itr = auctionHouse->GetAuctionsBegin(); itr != auctionHouse->GetAuctionsEnd(); ++itr)
|
||||
{
|
||||
AuctionPosting const* auctionEntry = &itr->second;
|
||||
if (auctionEntry->Owner.IsEmpty() || sAuctionBotConfig->IsBotChar(auctionEntry->Owner)) // Add only ahbot items
|
||||
++itemsSaved[auctionEntry->Items[0]->GetQuality()][auctionEntry->Bucket->ItemClass];
|
||||
{
|
||||
// count by the template, the same key _itemPool and the listing were chosen by: a bonus list
|
||||
// can change the item's quality, and such a listing was then never counted in its own slot
|
||||
ItemTemplate const* proto = auctionEntry->Items[0]->GetTemplate();
|
||||
if (proto->GetQuality() >= MAX_AUCTION_QUALITY || proto->GetClass() >= MAX_ITEM_CLASS)
|
||||
continue;
|
||||
if (auctionEntry->Items[0]->GetQuality() != proto->GetQuality())
|
||||
++bonusQualityDiffers[{ proto->GetQuality(), auctionEntry->Items[0]->GetQuality() }];
|
||||
++itemsSaved[proto->GetQuality()][proto->GetClass()];
|
||||
}
|
||||
}
|
||||
|
||||
if (!bonusQualityDiffers.empty() && !_bonusQualityReported)
|
||||
{
|
||||
for (auto const& [qualities, listings] : bonusQualityDiffers)
|
||||
TC_LOG_INFO("ahbot", "AHBot: {} listings in the {} house: item quality {}, bonus list quality {}",
|
||||
listings, AuctionBotConfig::GetHouseTypeName(config.GetHouseType()), qualities.first, qualities.second);
|
||||
_bonusQualityReported = true;
|
||||
}
|
||||
|
||||
uint32 count = 0;
|
||||
@@ -625,6 +679,8 @@ void AuctionBotSeller::SetPricesOfItem(ItemTemplate const* itemProto, SellerConf
|
||||
buyPrice = sellPrice;
|
||||
|
||||
float basePriceFloat = buyPrice * stackCount / (itemProto->GetClass() == 6 ? 200.0f : static_cast<float>(itemProto->GetBuyCount()));
|
||||
if (uint64 unitValue = AuctionBotVanilla::UnitValue(itemProto))
|
||||
basePriceFloat = float(unitValue) * stackCount;
|
||||
basePriceFloat *= priceRatio;
|
||||
|
||||
float range = basePriceFloat * 0.04f;
|
||||
@@ -837,7 +893,7 @@ void AuctionBotSeller::AddNewAuctions(SellerConfiguration& config)
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsById(sAuctionBotConfig->GetAuctionHouseId(config.GetHouseType()));
|
||||
|
||||
ItemsToSellArray itemsToSell;
|
||||
AllItemsArray allItems;
|
||||
AllItemsArray allItems = {};
|
||||
// Main loop
|
||||
// getRandomArray will give what categories of items should be added (return true if there is at least 1 items missed)
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
@@ -871,7 +927,7 @@ void AuctionBotSeller::AddNewAuctions(SellerConfiguration& config)
|
||||
if (!item)
|
||||
{
|
||||
TC_LOG_ERROR("ahbot", "AHBot: Item::CreateItem() returned NULL for item {} (stack: {})", itemId, stackCount);
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Update the just created item so that if it needs random properties it has them.
|
||||
@@ -912,13 +968,16 @@ void AuctionBotSeller::AddNewAuctions(SellerConfiguration& config)
|
||||
auction.StartTime = GameTime::GetSystemTime();
|
||||
auction.EndTime = auction.StartTime + Hours(urand(config.GetMinTime(), config.GetMaxTime()));
|
||||
|
||||
// save the item like a player listing does, otherwise the next start finds no item and deletes the auction
|
||||
item->SaveToDB(trans);
|
||||
auctionHouse->AddAuction(trans, std::move(auction));
|
||||
|
||||
++count;
|
||||
}
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
TC_LOG_DEBUG("ahbot", "AHBot: Added {} items to auction", count);
|
||||
if (count)
|
||||
TC_LOG_INFO("ahbot", "AHBot: sold {} items into the {} house", count, AuctionBotConfig::GetHouseTypeName(config.GetHouseType()));
|
||||
}
|
||||
|
||||
bool AuctionBotSeller::Update(AuctionHouseType houseType)
|
||||
|
||||
@@ -138,6 +138,7 @@ private:
|
||||
SellerConfiguration _houseConfig[MAX_AUCTION_HOUSE_TYPE];
|
||||
|
||||
ItemPool _itemPool[MAX_AUCTION_QUALITY][MAX_ITEM_CLASS];
|
||||
bool _bonusQualityReported = false;
|
||||
|
||||
void LoadSellerValues(SellerConfiguration& config);
|
||||
uint32 SetStat(SellerConfiguration& config);
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#include "Config.h"
|
||||
#include "ItemTemplate.h"
|
||||
#include "SharedDefines.h"
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
|
||||
namespace AuctionBotVanilla
|
||||
{
|
||||
@@ -27,6 +29,10 @@ namespace
|
||||
bool _enabled = false;
|
||||
int32 _maxReqLevel = 60;
|
||||
uint32 _maxItemLevel = 100; // Naxxramas epics top out around 92
|
||||
bool _valueCurve = false;
|
||||
|
||||
// copper per item level squared, by quality (gray .. epic)
|
||||
constexpr std::array<uint32, 5> QualityFactor = { 1, 2, 15, 50, 150 };
|
||||
}
|
||||
|
||||
void LoadConfig()
|
||||
@@ -34,6 +40,7 @@ void LoadConfig()
|
||||
_enabled = sConfigMgr->GetBoolDefault("AuctionHouseBot.Vanilla.Only", false);
|
||||
_maxReqLevel = sConfigMgr->GetIntDefault("AuctionHouseBot.Vanilla.MaxReqLevel", 60);
|
||||
_maxItemLevel = sConfigMgr->GetIntDefault("AuctionHouseBot.Vanilla.MaxItemLevel", 100);
|
||||
_valueCurve = sConfigMgr->GetBoolDefault("AuctionHouseBot.Vanilla.ValueCurve", false);
|
||||
}
|
||||
|
||||
bool Enabled()
|
||||
@@ -72,4 +79,41 @@ bool IsAllowed(ItemTemplate const* proto)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
uint64 UnitValue(ItemTemplate const* proto)
|
||||
{
|
||||
if (!_valueCurve)
|
||||
return 0;
|
||||
|
||||
// the 70532 data gives most loot-only goods a token vendor price (enchanting essences and shards: 1 copper),
|
||||
// so the vendor price alone lists them for a few copper
|
||||
uint64 vendor = std::max<uint64>(proto->GetBuyPrice() / std::max<uint32>(1, proto->GetBuyCount()), uint64(proto->GetSellPrice()) * 4);
|
||||
if (proto->GetClass() == ITEM_CLASS_PROJECTILE)
|
||||
vendor = proto->GetBuyPrice() / 200; // ammo is bought in stacks of 200
|
||||
|
||||
uint32 classPct = 0;
|
||||
switch (proto->GetClass())
|
||||
{
|
||||
case ITEM_CLASS_WEAPON:
|
||||
case ITEM_CLASS_ARMOR:
|
||||
case ITEM_CLASS_CONTAINER:
|
||||
case ITEM_CLASS_TRADE_GOODS:
|
||||
classPct = 100;
|
||||
break;
|
||||
case ITEM_CLASS_RECIPE:
|
||||
case ITEM_CLASS_MISCELLANEOUS:
|
||||
classPct = 50;
|
||||
break;
|
||||
case ITEM_CLASS_CONSUMABLE:
|
||||
classPct = 25;
|
||||
break;
|
||||
default: // ammo, reagents, quivers: vendor goods, vendor price
|
||||
break;
|
||||
}
|
||||
|
||||
uint32 quality = std::min<uint32>(proto->GetQuality(), QualityFactor.size() - 1);
|
||||
uint64 itemLevel = proto->GetBaseItemLevel();
|
||||
uint64 curve = itemLevel * itemLevel * QualityFactor[quality] * classPct / 100;
|
||||
return std::max<uint64>(vendor, curve);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#ifndef AUCTION_HOUSE_BOT_VANILLA_H
|
||||
#define AUCTION_HOUSE_BOT_VANILLA_H
|
||||
|
||||
#include "Define.h"
|
||||
|
||||
struct ItemTemplate;
|
||||
|
||||
// Optional vanilla-era item filter for the AuctionHouseBot seller (AuctionHouseBot.Vanilla.*).
|
||||
@@ -31,6 +33,10 @@ namespace AuctionBotVanilla
|
||||
|
||||
// False for anything that is not level-60 vanilla content; always true while the filter is off.
|
||||
bool IsAllowed(ItemTemplate const* proto);
|
||||
|
||||
// AuctionHouseBot.Vanilla.ValueCurve = 1: per-unit market value in copper from item level, quality and class,
|
||||
// never below the vendor price. 0 while the curve is off (callers keep the vendor price).
|
||||
uint64 UnitValue(ItemTemplate const* proto);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3821,6 +3821,14 @@ AuctionHouseBot.Vanilla.Only = 0
|
||||
AuctionHouseBot.Vanilla.MaxReqLevel = 60
|
||||
AuctionHouseBot.Vanilla.MaxItemLevel = 100
|
||||
|
||||
# AuctionHouseBot.Vanilla.ValueCurve
|
||||
# Description: Price bot listings (and the buyer's fair price) by item level squared x quality x class,
|
||||
# never below the vendor price. For client data whose loot-only goods carry a token vendor price.
|
||||
# Default: 0 - (Disabled, vendor price)
|
||||
# 1 - (Enabled)
|
||||
|
||||
AuctionHouseBot.Vanilla.ValueCurve = 0
|
||||
|
||||
#
|
||||
# AuctionHouseBot.Alliance.Items.Amount.Ratio
|
||||
# Description: Enable/Disable (disabled if 0) the part of AHBot that puts items up for auction on Alliance AH
|
||||
@@ -3901,6 +3909,14 @@ AuctionHouseBot.Items.Loot = 1
|
||||
|
||||
AuctionHouseBot.Items.Misc = 0
|
||||
|
||||
# AuctionHouseBot.Items.Crafted
|
||||
# Description: Include items made by a profession recipe even when no loot or vendor list has them
|
||||
# (only matters with AuctionHouseBot.Items.Misc = 0)
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
AuctionHouseBot.Items.Crafted = 0
|
||||
|
||||
#
|
||||
# AuctionHouseBot.Bind.*
|
||||
# Description: Indicates which bonding types to allow the bot to put up for auction
|
||||
@@ -4090,6 +4106,14 @@ AuctionHouseBot.Class.Key = 1
|
||||
AuctionHouseBot.Class.Misc = 5
|
||||
AuctionHouseBot.Class.Glyph = 3
|
||||
|
||||
# AuctionHouseBot.Class.WeightByPoolSize
|
||||
# Description: Also weight each class's share of a quality by how many different items it has, so a
|
||||
# class with a handful of items (green bags, arrows) is not listed dozens of times each.
|
||||
# Default: 0 - (Disabled, share by AuctionHouseBot.Class.* only)
|
||||
# 1 - (Enabled)
|
||||
|
||||
AuctionHouseBot.Class.WeightByPoolSize = 0
|
||||
|
||||
#
|
||||
###################################################################################################
|
||||
|
||||
|
||||
Reference in New Issue
Block a user