Cleanup Operator padding

This commit is contained in:
Schmoozerd 2012-07-20 17:38:23 +02:00
parent 9141299127
commit e32b9953a1
264 changed files with 6715 additions and 6715 deletions

View file

@ -122,23 +122,23 @@ class AHB_Seller_Config
void SetMaxTime(uint32 value) { m_maxTime = value; }
uint32 GetMaxTime() const { return m_maxTime; }
// Data access classified by item class and item quality //
void SetItemsAmountPerClass(AuctionQuality quality, ItemClass itemclass, uint32 amount) { m_ItemInfo[quality].ItemClassInfos[itemclass].AmountOfItems=amount * m_ItemInfo[quality].ItemClassInfos[itemclass].Quantity; }
void SetItemsAmountPerClass(AuctionQuality quality, ItemClass itemclass, uint32 amount) { m_ItemInfo[quality].ItemClassInfos[itemclass].AmountOfItems = amount * m_ItemInfo[quality].ItemClassInfos[itemclass].Quantity; }
uint32 GetItemsAmountPerClass(AuctionQuality quality, ItemClass itemclass) const { return m_ItemInfo[quality].ItemClassInfos[itemclass].AmountOfItems; }
void SetItemsQuantityPerClass(AuctionQuality quality, ItemClass itemclass, uint32 qty) { m_ItemInfo[quality].ItemClassInfos[itemclass].Quantity=qty; }
void SetItemsQuantityPerClass(AuctionQuality quality, ItemClass itemclass, uint32 qty) { m_ItemInfo[quality].ItemClassInfos[itemclass].Quantity = qty; }
uint32 GetItemsQuantityPerClass(AuctionQuality quality, ItemClass itemclass) const { return m_ItemInfo[quality].ItemClassInfos[itemclass].Quantity; }
void SetMissedItemsPerClass(AuctionQuality quality, ItemClass itemclass, uint32 found)
{
if (m_ItemInfo[quality].ItemClassInfos[itemclass].AmountOfItems > found)
m_ItemInfo[quality].ItemClassInfos[itemclass].MissItems=m_ItemInfo[quality].ItemClassInfos[itemclass].AmountOfItems - found;
m_ItemInfo[quality].ItemClassInfos[itemclass].MissItems = m_ItemInfo[quality].ItemClassInfos[itemclass].AmountOfItems - found;
else
m_ItemInfo[quality].ItemClassInfos[itemclass].MissItems = 0;
}
uint32 GetMissedItemsPerClass(AuctionQuality quality, ItemClass itemclass) const { return m_ItemInfo[quality].ItemClassInfos[itemclass].MissItems; }
// Data for every quality of item //
void SetItemsAmountPerQuality(AuctionQuality quality, uint32 cnt) { m_ItemInfo[quality].AmountOfItems=cnt; }
void SetItemsAmountPerQuality(AuctionQuality quality, uint32 cnt) { m_ItemInfo[quality].AmountOfItems = cnt; }
uint32 GetItemsAmountPerQuality(AuctionQuality quality) const { return m_ItemInfo[quality].AmountOfItems; }
void SetPriceRatioPerQuality(AuctionQuality quality, uint32 value) { m_ItemInfo[quality].PriceRatio=value; }
void SetPriceRatioPerQuality(AuctionQuality quality, uint32 value) { m_ItemInfo[quality].PriceRatio = value; }
uint32 GetPriceRatioPerQuality(AuctionQuality quality) const { return m_ItemInfo[quality].PriceRatio; }
private:
@ -237,13 +237,13 @@ bool AuctionBotConfig::Initialize()
return false;
}
if ((getConfig(CONFIG_UINT32_AHBOT_ALLIANCE_ITEM_AMOUNT_RATIO)==0) && (getConfig(CONFIG_UINT32_AHBOT_HORDE_ITEM_AMOUNT_RATIO)==0) && (getConfig(CONFIG_UINT32_AHBOT_NEUTRAL_ITEM_AMOUNT_RATIO)==0) &&
if ((getConfig(CONFIG_UINT32_AHBOT_ALLIANCE_ITEM_AMOUNT_RATIO) == 0) && (getConfig(CONFIG_UINT32_AHBOT_HORDE_ITEM_AMOUNT_RATIO) == 0) && (getConfig(CONFIG_UINT32_AHBOT_NEUTRAL_ITEM_AMOUNT_RATIO) == 0) &&
!getConfig(CONFIG_BOOL_AHBOT_BUYER_ALLIANCE_ENABLED) && !getConfig(CONFIG_BOOL_AHBOT_BUYER_HORDE_ENABLED) && !getConfig(CONFIG_BOOL_AHBOT_BUYER_NEUTRAL_ENABLED))
{
sLog.outString("All feature of AuctionHouseBot are disabled! (If you want to use it please set config in 'ahbot.conf')");
return false;
}
if ((getConfig(CONFIG_UINT32_AHBOT_ALLIANCE_ITEM_AMOUNT_RATIO)==0) && (getConfig(CONFIG_UINT32_AHBOT_HORDE_ITEM_AMOUNT_RATIO)==0) && (getConfig(CONFIG_UINT32_AHBOT_NEUTRAL_ITEM_AMOUNT_RATIO)==0))
if ((getConfig(CONFIG_UINT32_AHBOT_ALLIANCE_ITEM_AMOUNT_RATIO) == 0) && (getConfig(CONFIG_UINT32_AHBOT_HORDE_ITEM_AMOUNT_RATIO) == 0) && (getConfig(CONFIG_UINT32_AHBOT_NEUTRAL_ITEM_AMOUNT_RATIO) == 0))
sLog.outString("AuctionHouseBot SELLER is disabled! (If you want to use it please set config in 'ahbot.conf')");
if (!getConfig(CONFIG_BOOL_AHBOT_BUYER_ALLIANCE_ENABLED) && !getConfig(CONFIG_BOOL_AHBOT_BUYER_HORDE_ENABLED) && !getConfig(CONFIG_BOOL_AHBOT_BUYER_NEUTRAL_ENABLED))
@ -256,7 +256,7 @@ bool AuctionBotConfig::Initialize()
void AuctionBotConfig::setConfig(AuctionBotConfigUInt32Values index, char const* fieldname, uint32 defvalue)
{
setConfig(index, m_AhBotCfg.GetIntDefault(fieldname,defvalue));
setConfig(index, m_AhBotCfg.GetIntDefault(fieldname, defvalue));
if (int32(getConfig(index)) < 0)
{
sLog.outError("AHBot: %s (%i) can't be negative. Using %u instead.", fieldname, int32(getConfig(index)), defvalue);
@ -266,7 +266,7 @@ void AuctionBotConfig::setConfig(AuctionBotConfigUInt32Values index, char const*
void AuctionBotConfig::setConfigMax(AuctionBotConfigUInt32Values index, char const* fieldname, uint32 defvalue, uint32 maxvalue)
{
setConfig(index, m_AhBotCfg.GetIntDefault(fieldname,defvalue));
setConfig(index, m_AhBotCfg.GetIntDefault(fieldname, defvalue));
if (getConfig(index) > maxvalue)
{
sLog.outError("AHBot: %s (%u) must be in range 0...%u. Using %u instead.", fieldname, getConfig(index), maxvalue, maxvalue);
@ -276,7 +276,7 @@ void AuctionBotConfig::setConfigMax(AuctionBotConfigUInt32Values index, char con
void AuctionBotConfig::setConfigMinMax(AuctionBotConfigUInt32Values index, char const* fieldname, uint32 defvalue, uint32 minvalue, uint32 maxvalue)
{
setConfig(index, m_AhBotCfg.GetIntDefault(fieldname,defvalue));
setConfig(index, m_AhBotCfg.GetIntDefault(fieldname, defvalue));
if (getConfig(index) > maxvalue)
{
sLog.outError("AHBot: %s (%u) must be in range %u...%u. Using %u instead.", fieldname, getConfig(index), minvalue, maxvalue, maxvalue);
@ -291,7 +291,7 @@ void AuctionBotConfig::setConfigMinMax(AuctionBotConfigUInt32Values index, char
void AuctionBotConfig::setConfig(AuctionBotConfigBoolValues index, char const* fieldname, bool defvalue)
{
setConfig(index, m_AhBotCfg.GetBoolDefault(fieldname,defvalue));
setConfig(index, m_AhBotCfg.GetBoolDefault(fieldname, defvalue));
}
//Get AuctionHousebot configuration file
@ -369,7 +369,7 @@ void AuctionBotConfig::GetConfigFromFile()
setConfigMinMax(CONFIG_UINT32_AHBOT_BUYER_CHANCE_RATIO_ALLIANCE, "AuctionHouseBot.Buyer.Alliance.Chance.Ratio", 3, 1, 100);
setConfigMinMax(CONFIG_UINT32_AHBOT_BUYER_CHANCE_RATIO_HORDE , "AuctionHouseBot.Buyer.Horde.Chance.Ratio" , 3, 1, 100);
setConfigMinMax(CONFIG_UINT32_AHBOT_BUYER_CHANCE_RATIO_NEUTRAL , "AuctionHouseBot.Buyer.Neutral.Chance.Ratio" , 3, 1, 100);
setConfigMinMax(CONFIG_UINT32_AHBOT_BUYER_RECHECK_INTERVAL , "AuctionHouseBot.Buyer.Recheck.Interval" , 20,1, DAY/MINUTE);
setConfigMinMax(CONFIG_UINT32_AHBOT_BUYER_RECHECK_INTERVAL , "AuctionHouseBot.Buyer.Recheck.Interval" , 20, 1, DAY / MINUTE);
setConfig(CONFIG_BOOL_AHBOT_DEBUG_SELLER , "AuctionHouseBot.DEBUG.Seller" , false);
setConfig(CONFIG_BOOL_AHBOT_DEBUG_BUYER , "AuctionHouseBot.DEBUG.Buyer" , false);
@ -441,8 +441,8 @@ uint32 AuctionBotConfig::getConfigItemQualityAmount(AuctionQuality quality) cons
case AUCTION_QUALITY_WHITE: return getConfig(CONFIG_UINT32_AHBOT_ITEM_WHITE_AMOUNT);
case AUCTION_QUALITY_GREEN: return getConfig(CONFIG_UINT32_AHBOT_ITEM_GREEN_AMOUNT);
case AUCTION_QUALITY_BLUE: return getConfig(CONFIG_UINT32_AHBOT_ITEM_BLUE_AMOUNT);
case AUCTION_QUALITY_PURPLE:return getConfig(CONFIG_UINT32_AHBOT_ITEM_PURPLE_AMOUNT);
case AUCTION_QUALITY_ORANGE:return getConfig(CONFIG_UINT32_AHBOT_ITEM_ORANGE_AMOUNT);
case AUCTION_QUALITY_PURPLE: return getConfig(CONFIG_UINT32_AHBOT_ITEM_PURPLE_AMOUNT);
case AUCTION_QUALITY_ORANGE: return getConfig(CONFIG_UINT32_AHBOT_ITEM_ORANGE_AMOUNT);
default: return getConfig(CONFIG_UINT32_AHBOT_ITEM_YELLOW_AMOUNT);
}
}
@ -489,19 +489,19 @@ void AuctionBotBuyer::LoadBuyerValues(AHB_Buyer_Config& config)
switch (config.GetHouseType())
{
case AUCTION_HOUSE_ALLIANCE:
config.BuyerPriceRatio = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_ALLIANCE_PRICE_RATIO)+50;
config.BuyerPriceRatio = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_ALLIANCE_PRICE_RATIO) + 50;
FactionChance = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_BUYER_CHANCE_RATIO_ALLIANCE);
break;
case AUCTION_HOUSE_HORDE:
config.BuyerPriceRatio = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_HORDE_PRICE_RATIO)+50;
config.BuyerPriceRatio = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_HORDE_PRICE_RATIO) + 50;
FactionChance = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_BUYER_CHANCE_RATIO_HORDE);
break;
default:
config.BuyerPriceRatio = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_NEUTRAL_PRICE_RATIO)+50;
config.BuyerPriceRatio = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_NEUTRAL_PRICE_RATIO) + 50;
FactionChance = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_BUYER_CHANCE_RATIO_NEUTRAL);
break;
}
config.FactionChance=5000*FactionChance;
config.FactionChance = 5000 * FactionChance;
}
void AuctionBotBuyer::LoadConfig()
@ -517,8 +517,8 @@ void AuctionBotBuyer::LoadConfig()
uint32 AuctionBotBuyer::GetBuyableEntry(AHB_Buyer_Config& config)
{
config.SameItemInfo.clear();
uint32 count=0;
time_t Now=time(NULL);
uint32 count = 0;
time_t Now = time(NULL);
AuctionHouseObject::AuctionEntryMapBounds bounds = sAuctionMgr.GetAuctionsMap(config.GetHouseType())->GetAuctionsBounds();
for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
@ -531,45 +531,45 @@ uint32 AuctionBotBuyer::GetBuyableEntry(AHB_Buyer_Config& config)
if (prototype)
{
++config.SameItemInfo[item->GetEntry()].ItemCount; // Structure constructor will make sure Element are correctly initialised if entry is created here.
config.SameItemInfo[item->GetEntry()].BuyPrice =config.SameItemInfo[item->GetEntry()].BuyPrice + (itr->second->buyout/item->GetCount());
config.SameItemInfo[item->GetEntry()].BidPrice =config.SameItemInfo[item->GetEntry()].BidPrice + (itr->second->startbid/item->GetCount());
config.SameItemInfo[item->GetEntry()].BuyPrice = config.SameItemInfo[item->GetEntry()].BuyPrice + (itr->second->buyout / item->GetCount());
config.SameItemInfo[item->GetEntry()].BidPrice = config.SameItemInfo[item->GetEntry()].BidPrice + (itr->second->startbid / item->GetCount());
if (itr->second->buyout != 0)
{
if (itr->second->buyout/item->GetCount() < config.SameItemInfo[item->GetEntry()].MinBuyPrice)
config.SameItemInfo[item->GetEntry()].MinBuyPrice = itr->second->buyout/item->GetCount();
if (itr->second->buyout / item->GetCount() < config.SameItemInfo[item->GetEntry()].MinBuyPrice)
config.SameItemInfo[item->GetEntry()].MinBuyPrice = itr->second->buyout / item->GetCount();
else if (config.SameItemInfo[item->GetEntry()].MinBuyPrice == 0)
config.SameItemInfo[item->GetEntry()].MinBuyPrice = itr->second->buyout/item->GetCount();
config.SameItemInfo[item->GetEntry()].MinBuyPrice = itr->second->buyout / item->GetCount();
}
if (itr->second->startbid/item->GetCount() < config.SameItemInfo[item->GetEntry()].MinBidPrice)
config.SameItemInfo[item->GetEntry()].MinBidPrice = itr->second->startbid/item->GetCount();
if (itr->second->startbid / item->GetCount() < config.SameItemInfo[item->GetEntry()].MinBidPrice)
config.SameItemInfo[item->GetEntry()].MinBidPrice = itr->second->startbid / item->GetCount();
else if (config.SameItemInfo[item->GetEntry()].MinBidPrice == 0)
config.SameItemInfo[item->GetEntry()].MinBidPrice = itr->second->startbid/item->GetCount();
config.SameItemInfo[item->GetEntry()].MinBidPrice = itr->second->startbid / item->GetCount();
if (!Aentry->owner)
{
if ((Aentry->bid!=0) && Aentry->bidder) // Add bided by player
if ((Aentry->bid != 0) && Aentry->bidder) // Add bided by player
{
config.CheckedEntry[Aentry->Id].LastExist=Now;
config.CheckedEntry[Aentry->Id].AuctionId=Aentry->Id;
config.CheckedEntry[Aentry->Id].LastExist = Now;
config.CheckedEntry[Aentry->Id].AuctionId = Aentry->Id;
++count;
}
}
else
{
if (Aentry->bid!=0)
if (Aentry->bid != 0)
{
if (Aentry->bidder)
{
config.CheckedEntry[Aentry->Id].LastExist=Now;
config.CheckedEntry[Aentry->Id].AuctionId=Aentry->Id;
config.CheckedEntry[Aentry->Id].LastExist = Now;
config.CheckedEntry[Aentry->Id].AuctionId = Aentry->Id;
++count;
}
}
else
{
config.CheckedEntry[Aentry->Id].LastExist=Now;
config.CheckedEntry[Aentry->Id].AuctionId=Aentry->Id;
config.CheckedEntry[Aentry->Id].LastExist = Now;
config.CheckedEntry[Aentry->Id].AuctionId = Aentry->Id;
++count;
}
}
@ -577,18 +577,18 @@ uint32 AuctionBotBuyer::GetBuyableEntry(AHB_Buyer_Config& config)
}
}
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: %u items added to buyable vector for ah type: %u",count, config.GetHouseType());
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: %u items added to buyable vector for ah type: %u", count, config.GetHouseType());
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: SameItemInfo size = " SIZEFMTD, config.SameItemInfo.size());
return count;
}
void AuctionBotBuyer::PrepareListOfEntry(AHB_Buyer_Config& config)
{
time_t Now=time(NULL)-5;
time_t Now = time(NULL) - 5;
for (CheckEntryMap::iterator itr=config.CheckedEntry.begin(); itr != config.CheckedEntry.end();)
for (CheckEntryMap::iterator itr = config.CheckedEntry.begin(); itr != config.CheckedEntry.end();)
{
if (itr->second.LastExist < (Now-5))
if (itr->second.LastExist < (Now - 5))
config.CheckedEntry.erase(itr++);
else
++itr;
@ -599,13 +599,13 @@ void AuctionBotBuyer::PrepareListOfEntry(AHB_Buyer_Config& config)
bool AuctionBotBuyer::IsBuyableEntry(uint32 buyoutPrice, double InGame_BuyPrice, double MaxBuyablePrice, uint32 MinBuyPrice, uint32 MaxChance, uint32 ChanceRatio)
{
double ratio=0;
uint32 Chance=0;
double ratio = 0;
uint32 Chance = 0;
if (buyoutPrice <= MinBuyPrice)
{
if (buyoutPrice <= MaxBuyablePrice)
Chance=MaxChance;
Chance = MaxChance;
else
{
@ -613,15 +613,15 @@ bool AuctionBotBuyer::IsBuyableEntry(uint32 buyoutPrice, double InGame_BuyPrice,
{
ratio = buyoutPrice / MaxBuyablePrice;
if (ratio < 10)
Chance=MaxChance - (ratio*(MaxChance/10));
else Chance=1;
Chance = MaxChance - (ratio * (MaxChance / 10));
else Chance = 1;
}
}
}
else if (buyoutPrice <= InGame_BuyPrice)
{
if (buyoutPrice <= MaxBuyablePrice)
Chance=MaxChance/5;
Chance = MaxChance / 5;
else
{
@ -629,80 +629,80 @@ bool AuctionBotBuyer::IsBuyableEntry(uint32 buyoutPrice, double InGame_BuyPrice,
{
ratio = buyoutPrice / MaxBuyablePrice;
if (ratio < 10)
Chance=(MaxChance/5) - (ratio*(MaxChance/50));
else Chance=1;
Chance = (MaxChance / 5) - (ratio * (MaxChance / 50));
else Chance = 1;
}
}
}
else if (buyoutPrice <= MaxBuyablePrice)
Chance = MaxChance/10;
Chance = MaxChance / 10;
else
{
if ((buyoutPrice > 0) && (MaxBuyablePrice > 0))
{
ratio = buyoutPrice / MaxBuyablePrice;
if (ratio < 10)
Chance=(MaxChance/5) - (ratio*(MaxChance/50));
else Chance=0;
Chance = (MaxChance / 5) - (ratio * (MaxChance / 50));
else Chance = 0;
}
else Chance = 0;
}
uint32 RandNum = urand(1,ChanceRatio);
if (RandNum<=Chance)
uint32 RandNum = urand(1, ChanceRatio);
if (RandNum <= Chance)
{
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: WIN BUY! Chance = %u, num = %u.",Chance, RandNum);
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: WIN BUY! Chance = %u, num = %u.", Chance, RandNum);
return true;
}
else
{
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot:LOOSE BUY! Chance = %u, num = %u.",Chance, RandNum);
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot:LOOSE BUY! Chance = %u, num = %u.", Chance, RandNum);
return false;
}
}
bool AuctionBotBuyer::IsBidableEntry(uint32 bidPrice, double InGame_BuyPrice, double MaxBidablePrice, uint32 MinBidPrice, uint32 MaxChance, uint32 ChanceRatio)
{
double ratio=0;
uint32 Chance=0;
double ratio = 0;
uint32 Chance = 0;
if (bidPrice <= MinBidPrice)
{
if ((InGame_BuyPrice != 0) && (bidPrice < (InGame_BuyPrice - (InGame_BuyPrice / 30))))
Chance=MaxChance;
Chance = MaxChance;
else
{
if (bidPrice < MaxBidablePrice)
{
ratio = MaxBidablePrice / bidPrice;
if (ratio < 3)
Chance = ((MaxChance/500)*ratio);
Chance = ((MaxChance / 500) * ratio);
else
Chance = (MaxChance/500);
Chance = (MaxChance / 500);
}
}
}
else if (bidPrice < (InGame_BuyPrice - (InGame_BuyPrice / 30)))
Chance=(MaxChance/10);
Chance = (MaxChance / 10);
else
{
if (bidPrice < MaxBidablePrice)
{
ratio = MaxBidablePrice / bidPrice;
if (ratio < 4)
Chance = ((MaxChance/1000)*ratio);
Chance = ((MaxChance / 1000) * ratio);
else
Chance = (MaxChance/1000);
Chance = (MaxChance / 1000);
}
}
uint32 RandNum = urand(1,ChanceRatio);
if (RandNum<=Chance)
uint32 RandNum = urand(1, ChanceRatio);
if (RandNum <= Chance)
{
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: WIN BID! Chance = %u, num = %u.",Chance, RandNum);
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: WIN BID! Chance = %u, num = %u.", Chance, RandNum);
return true;
}
else
{
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: LOOSE BID! Chance = %u, num = %u.",Chance, RandNum);
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: LOOSE BID! Chance = %u, num = %u.", Chance, RandNum);
return false;
}
}
@ -729,13 +729,13 @@ void AuctionBotBuyer::addNewAuctionBuyerBotBid(AHB_Buyer_Config& config)
uint32 BuyCycles;
if (config.CheckedEntry.size() > sAuctionBotConfig.GetItemPerCycleBoost())
{
BuyCycles=sAuctionBotConfig.GetItemPerCycleBoost();
BuyCycles = sAuctionBotConfig.GetItemPerCycleBoost();
BASIC_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Boost value used for Buyer! (if this happens often adjust both ItemsPerCycle in ahbot.conf)");
}
else
BuyCycles=sAuctionBotConfig.GetItemPerCycleNormal();
BuyCycles = sAuctionBotConfig.GetItemPerCycleNormal();
for (CheckEntryMap::iterator itr =config.CheckedEntry.begin(); itr != config.CheckedEntry.end();)
for (CheckEntryMap::iterator itr = config.CheckedEntry.begin(); itr != config.CheckedEntry.end();)
{
AuctionEntry* auction = auctionHouse->GetAuction(itr->second.AuctionId);
if (!auction || auction->moneyDeliveryTime) // is auction not active now
@ -757,7 +757,7 @@ void AuctionBotBuyer::addNewAuctionBuyerBotBid(AHB_Buyer_Config& config)
if (BuyCycles == 0)
break;
uint32 MaxChance=5000;
uint32 MaxChance = 5000;
Item* item = sAuctionMgr.GetAItem(auction->itemGuidLow);
if (!item) // auction item not accessible, possible auction in payment pending mode
@ -771,45 +771,45 @@ void AuctionBotBuyer::addNewAuctionBuyerBotBid(AHB_Buyer_Config& config)
uint32 BasePrice = sAuctionBotConfig.getConfig(CONFIG_BOOL_AHBOT_BUYPRICE_BUYER) ? prototype->BuyPrice : prototype->SellPrice;
BasePrice *= item->GetCount();
double MaxBuyablePrice = (BasePrice * config.BuyerPriceRatio)/100;
double MaxBuyablePrice = (BasePrice * config.BuyerPriceRatio) / 100;
BuyerItemInfoMap::iterator sameitem_itr = config.SameItemInfo.find(item->GetEntry());
uint32 buyoutPrice = auction->buyout/item->GetCount();
uint32 buyoutPrice = auction->buyout / item->GetCount();
uint32 bidPrice;
uint32 bidPriceByItem;
if (auction->bid >= auction->startbid)
{
bidPrice = auction->GetAuctionOutBid();
bidPriceByItem = auction->bid/item->GetCount();
bidPriceByItem = auction->bid / item->GetCount();
}
else
{
bidPrice = auction->startbid;
bidPriceByItem = auction->startbid/item->GetCount();
bidPriceByItem = auction->startbid / item->GetCount();
}
double InGame_BuyPrice;
double InGame_BidPrice;
if (sameitem_itr==config.SameItemInfo.end())
if (sameitem_itr == config.SameItemInfo.end())
{
InGame_BuyPrice=0;
InGame_BidPrice=0;
InGame_BuyPrice = 0;
InGame_BidPrice = 0;
}
else
{
if (sameitem_itr->second.ItemCount == 1) MaxBuyablePrice = MaxBuyablePrice * 5; // if only one item exist can be buyed if the price is high too.
InGame_BuyPrice=sameitem_itr->second.BuyPrice/sameitem_itr->second.ItemCount;
InGame_BidPrice=sameitem_itr->second.BidPrice/sameitem_itr->second.ItemCount;
InGame_BuyPrice = sameitem_itr->second.BuyPrice / sameitem_itr->second.ItemCount;
InGame_BidPrice = sameitem_itr->second.BidPrice / sameitem_itr->second.ItemCount;
}
double MaxBidablePrice = MaxBuyablePrice - (MaxBuyablePrice / 30); // Max Bidable price defined to 70% of max buyable price
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Auction added with data:");
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: MaxPrice of Entry %u is %.1fg.", itr->second.AuctionId, MaxBuyablePrice / 10000);
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: GamePrice buy=%.1fg, bid=%.1fg.",InGame_BuyPrice/10000, InGame_BidPrice / 10000);
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: GamePrice buy=%.1fg, bid=%.1fg.", InGame_BuyPrice / 10000, InGame_BidPrice / 10000);
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Minimal price see in AH Buy=%ug, Bid=%ug.",
sameitem_itr->second.MinBuyPrice / 10000,sameitem_itr->second.MinBidPrice / 10000);
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Actual Entry price, Buy=%ug, Bid=%ug.", buyoutPrice / 10000, bidPrice/ 10000);
sameitem_itr->second.MinBuyPrice / 10000, sameitem_itr->second.MinBidPrice / 10000);
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Actual Entry price, Buy=%ug, Bid=%ug.", buyoutPrice / 10000, bidPrice / 10000);
if (!auction->owner) // Original auction owner
{
@ -819,19 +819,19 @@ void AuctionBotBuyer::addNewAuctionBuyerBotBid(AHB_Buyer_Config& config)
{
if (IsBuyableEntry(buyoutPrice, InGame_BuyPrice, MaxBuyablePrice, sameitem_itr->second.MinBuyPrice, MaxChance, config.FactionChance))
{
if (IsBidableEntry(bidPriceByItem, InGame_BuyPrice, MaxBidablePrice, sameitem_itr->second.MinBidPrice, MaxChance/2, config.FactionChance))
if (urand(0,5)==0) PlaceBidToEntry(auction, bidPrice); else BuyEntry(auction);
if (IsBidableEntry(bidPriceByItem, InGame_BuyPrice, MaxBidablePrice, sameitem_itr->second.MinBidPrice, MaxChance / 2, config.FactionChance))
if (urand(0, 5) == 0) PlaceBidToEntry(auction, bidPrice); else BuyEntry(auction);
else
BuyEntry(auction);
}
else
{
if (IsBidableEntry(bidPriceByItem, InGame_BuyPrice, MaxBidablePrice, sameitem_itr->second.MinBidPrice, MaxChance/2, config.FactionChance))
if (IsBidableEntry(bidPriceByItem, InGame_BuyPrice, MaxBidablePrice, sameitem_itr->second.MinBidPrice, MaxChance / 2, config.FactionChance))
PlaceBidToEntry(auction, bidPrice);
}
}
else // buyout = 0 mean only bid are possible
if (IsBidableEntry(bidPriceByItem, InGame_BuyPrice, MaxBidablePrice, sameitem_itr->second.MinBidPrice,MaxChance, config.FactionChance))
if (IsBidableEntry(bidPriceByItem, InGame_BuyPrice, MaxBidablePrice, sameitem_itr->second.MinBidPrice, MaxChance, config.FactionChance))
PlaceBidToEntry(auction, bidPrice);
itr->second.LastChecked = Now;
@ -879,14 +879,14 @@ bool AuctionBotSeller::Initialize()
{
std::stringstream includeStream(sAuctionBotConfig.GetAHBotIncludes());
std::string temp;
while (getline(includeStream,temp, ','))
while (getline(includeStream, temp, ','))
includeItems.push_back(atoi(temp.c_str()));
}
{
std::stringstream excludeStream(sAuctionBotConfig.GetAHBotExcludes());
std::string temp;
while (getline(excludeStream,temp, ','))
while (getline(excludeStream, temp, ','))
excludeItems.push_back(atoi(temp.c_str()));
}
@ -973,7 +973,7 @@ bool AuctionBotSeller::Initialize()
// forced exclude filter
bool isExcludeItem = false;
for (size_t i = 0; (i < excludeItems.size() && (!isExcludeItem)); ++i)
if (itemID ==excludeItems[i])
if (itemID == excludeItems[i])
isExcludeItem = true;
if (isExcludeItem)
continue;
@ -1116,7 +1116,7 @@ bool AuctionBotSeller::Initialize()
break;
}
case ITEM_CLASS_MISC:
if (prototype->SubClass==ITEM_SUBCLASS_JUNK_MOUNT)
if (prototype->SubClass == ITEM_SUBCLASS_JUNK_MOUNT)
{
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_MISC_MOUNT_MIN_REQ_LEVEL))
if (prototype->RequiredLevel < value)
@ -1379,13 +1379,13 @@ void AuctionBotSeller::LoadSellerValues(AHB_Seller_Config& config)
PriceRatio = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_NEUTRAL_PRICE_RATIO);
break;
}
config.SetPriceRatioPerQuality(AUCTION_QUALITY_GREY,PriceRatio);
config.SetPriceRatioPerQuality(AUCTION_QUALITY_WHITE,PriceRatio);
config.SetPriceRatioPerQuality(AUCTION_QUALITY_GREEN,PriceRatio);
config.SetPriceRatioPerQuality(AUCTION_QUALITY_BLUE,PriceRatio);
config.SetPriceRatioPerQuality(AUCTION_QUALITY_PURPLE,PriceRatio);
config.SetPriceRatioPerQuality(AUCTION_QUALITY_ORANGE,PriceRatio);
config.SetPriceRatioPerQuality(AUCTION_QUALITY_YELLOW,PriceRatio);
config.SetPriceRatioPerQuality(AUCTION_QUALITY_GREY, PriceRatio);
config.SetPriceRatioPerQuality(AUCTION_QUALITY_WHITE, PriceRatio);
config.SetPriceRatioPerQuality(AUCTION_QUALITY_GREEN, PriceRatio);
config.SetPriceRatioPerQuality(AUCTION_QUALITY_BLUE, PriceRatio);
config.SetPriceRatioPerQuality(AUCTION_QUALITY_PURPLE, PriceRatio);
config.SetPriceRatioPerQuality(AUCTION_QUALITY_ORANGE, PriceRatio);
config.SetPriceRatioPerQuality(AUCTION_QUALITY_YELLOW, PriceRatio);
//load min and max auction times
config.SetMinTime(sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_MINTIME));
@ -1394,7 +1394,7 @@ void AuctionBotSeller::LoadSellerValues(AHB_Seller_Config& config)
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_SELLER, "AHBot: minTime = %u", config.GetMinTime());
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_SELLER, "AHBot: maxTime = %u", config.GetMaxTime());
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_SELLER, "AHBot: For AH type %u",config.GetHouseType());
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_SELLER, "AHBot: For AH type %u", config.GetHouseType());
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_SELLER, "AHBot: GreyItems = %u", config.GetItemsAmountPerQuality(AUCTION_QUALITY_GREY));
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_SELLER, "AHBot: WhiteItems = %u", config.GetItemsAmountPerQuality(AUCTION_QUALITY_WHITE));
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_SELLER, "AHBot: GreenItems = %u", config.GetItemsAmountPerQuality(AUCTION_QUALITY_GREEN));
@ -1428,18 +1428,18 @@ uint32 AuctionBotSeller::SetStat(AHB_Seller_Config& config)
}
}
}
uint32 count=0;
for (uint32 j=0; j<MAX_AUCTION_QUALITY; ++j)
uint32 count = 0;
for (uint32 j = 0; j < MAX_AUCTION_QUALITY; ++j)
{
for (uint32 i=0; i<MAX_ITEM_CLASS; ++i)
for (uint32 i = 0; i < MAX_ITEM_CLASS; ++i)
{
config.SetMissedItemsPerClass((AuctionQuality) j, (ItemClass) i, ItemsInAH[j][i]);
count+=config.GetMissedItemsPerClass((AuctionQuality) j, (ItemClass) i);
count += config.GetMissedItemsPerClass((AuctionQuality) j, (ItemClass) i);
}
}
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_SELLER, "AHBot: Missed Item \tGrey\tWhite\tGreen\tBlue\tPurple\tOrange\tYellow");
for (uint32 i=0; i<MAX_ITEM_CLASS; ++i)
for (uint32 i = 0; i < MAX_ITEM_CLASS; ++i)
{
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_SELLER, "AHBot: %-18s\t%u\t%u\t%u\t%u\t%u\t%u\t%u",
sAuctionBotConfig.GetItemClassName(ItemClass(i)),
@ -1459,7 +1459,7 @@ uint32 AuctionBotSeller::SetStat(AHB_Seller_Config& config)
bool AuctionBotSeller::getRandomArray(AHB_Seller_Config& config, RandomArray& ra, const std::vector<std::vector<uint32> >& addedItem)
{
ra.clear();
bool Ok=false;
bool Ok = false;
for (uint32 j = 0; j < MAX_AUCTION_QUALITY; ++j)
{
@ -1471,7 +1471,7 @@ bool AuctionBotSeller::getRandomArray(AHB_Seller_Config& config, RandomArray& ra
miss_item.color = j;
miss_item.itemclass = i;
ra.push_back(miss_item);
Ok=true;
Ok = true;
}
}
}
@ -1485,10 +1485,10 @@ void AuctionBotSeller::SetPricesOfItem(ItemPrototype const* itemProto, AHB_Selle
(itemQuality < MAX_AUCTION_QUALITY ? config.GetPriceRatioPerQuality(AuctionQuality(itemQuality)) : 1) ;
double randrange = temp_buyp * 0.4;
buyp = (urand(temp_buyp-randrange, temp_buyp+randrange)/100)+1;
double urandrange=buyp*40;
double temp_bidp = buyp*50;
bidp = (urand(temp_bidp-urandrange, temp_bidp+urandrange)/100)+1;
buyp = (urand(temp_buyp - randrange, temp_buyp + randrange) / 100) + 1;
double urandrange = buyp * 40;
double temp_bidp = buyp * 50;
bidp = (urand(temp_bidp - urandrange, temp_bidp + urandrange) / 100) + 1;
}
void AuctionBotSeller::SetItemsRatio(uint32 al, uint32 ho, uint32 ne)
@ -1538,8 +1538,8 @@ void AuctionBotSeller::SetItemsAmountForQuality(AuctionQuality quality, uint32 v
case AUCTION_QUALITY_WHITE: sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_WHITE_AMOUNT, val); break;
case AUCTION_QUALITY_GREEN: sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_GREEN_AMOUNT, val); break;
case AUCTION_QUALITY_BLUE: sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_BLUE_AMOUNT, val); break;
case AUCTION_QUALITY_PURPLE:sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_PURPLE_AMOUNT, val); break;
case AUCTION_QUALITY_ORANGE:sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_ORANGE_AMOUNT, val); break;
case AUCTION_QUALITY_PURPLE: sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_PURPLE_AMOUNT, val); break;
case AUCTION_QUALITY_ORANGE: sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_ORANGE_AMOUNT, val); break;
default: sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_YELLOW_AMOUNT, val); break;
}
@ -1556,10 +1556,10 @@ void AuctionBotSeller::addNewAuctions(AHB_Seller_Config& config)
// If there is large amount of items missed we can use boost value to get fast filled AH
if (config.LastMissedItem > sAuctionBotConfig.GetItemPerCycleBoost())
{
items=sAuctionBotConfig.GetItemPerCycleBoost();
items = sAuctionBotConfig.GetItemPerCycleBoost();
BASIC_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Boost value used to fill AH! (if this happens often adjust both ItemsPerCycle in ahbot.conf)");
}
else items=sAuctionBotConfig.GetItemPerCycleNormal();
else items = sAuctionBotConfig.GetItemPerCycleNormal();
uint32 houseid;
switch (config.GetHouseType())
@ -1574,18 +1574,18 @@ void AuctionBotSeller::addNewAuctions(AHB_Seller_Config& config)
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(config.GetHouseType());
RandomArray randArray;
std::vector<std::vector<uint32> > ItemsAdded(MAX_AUCTION_QUALITY,std::vector<uint32> (MAX_ITEM_CLASS));
std::vector<std::vector<uint32> > ItemsAdded(MAX_AUCTION_QUALITY, std::vector<uint32> (MAX_ITEM_CLASS));
// Main loop
// getRandomArray will give what categories of items should be added (return true if there is at least 1 items missed)
while (getRandomArray(config,randArray, ItemsAdded) && (items>0))
while (getRandomArray(config, randArray, ItemsAdded) && (items > 0))
{
--items;
// Select random position from missed items table
uint32 pos = (urand(0,randArray.size()-1));
uint32 pos = (urand(0, randArray.size() - 1));
// Set itemID with random item ID for selected categories and color, from m_ItemPool table
uint32 itemID = m_ItemPool[randArray[pos].color][randArray[pos].itemclass][urand(0,m_ItemPool[randArray[pos].color][randArray[pos].itemclass].size()-1)];
uint32 itemID = m_ItemPool[randArray[pos].color][randArray[pos].itemclass][urand(0, m_ItemPool[randArray[pos].color][randArray[pos].itemclass].size() - 1)];
++ ItemsAdded[randArray[pos].color][randArray[pos].itemclass]; // Helper table to avoid rescan from DB in this loop. (has we add item in random orders)
if (!itemID)
@ -1763,7 +1763,7 @@ void AuctionHouseBot::Update()
return;
// scan all possible update cases until first success
for (uint32 count = 0; count < 2*MAX_AUCTION_HOUSE_TYPE; ++count)
for (uint32 count = 0; count < 2 * MAX_AUCTION_HOUSE_TYPE; ++count)
{
bool successStep = false;
@ -1779,7 +1779,7 @@ void AuctionHouseBot::Update()
}
++m_OperationSelector;
if (m_OperationSelector >= 2*MAX_AUCTION_HOUSE_TYPE)
if (m_OperationSelector >= 2 * MAX_AUCTION_HOUSE_TYPE)
m_OperationSelector = 0;
// one success update per call