Merge commit 'b69fd4ac682347b8b735ac7116ada25d79698933' into 4.3.4

Conflicts:
	README.md
	sql/updates/world/2015_02_06_13_world_335.sql
	src/server/game/Globals/ObjectMgr.cpp
	src/server/game/Spells/SpellMgr.cpp
This commit is contained in:
Carbenium committed 2015-07-21 21:45:04 +02:00
commit 7d5d040948
25 files changed
+467 -391

No files matched your search

+2
View File
@@ -2,6 +2,8 @@
[![Issue Stats](http://www.issuestats.com/github/TrinityCore/TrinityCore/badge/issue)](http://www.issuestats.com/github/TrinityCore/TrinityCore) [![Issue Stats](http://www.issuestats.com/github/TrinityCore/TrinityCore/badge/pr)](http://www.issuestats.com/github/TrinityCore/TrinityCore) [![Bountysource](https://www.bountysource.com/badge/tracker?tracker_id=1310)](https://www.bountysource.com/trackers/1310-trinity-core?utm_source=1310&utm_medium=shield&utm_campaign=TRACKER_BADGE)
[![Issue Stats](http://www.issuestats.com/github/TrinityCore/TrinityCore/badge/pr)](http://www.issuestats.com/github/TrinityCore/TrinityCore)
[![Issue Stats](http://www.issuestats.com/github/TrinityCore/TrinityCore/badge/issue)](http://www.issuestats.com/github/TrinityCore/TrinityCore)
`6.x`: [![6.x Build Status](https://travis-ci.org/TrinityCore/TrinityCore.svg?branch=6.x)](https://travis-ci.org/TrinityCore/TrinityCore)
`4.3.4`: [![4.3.4 Build Status](https://travis-ci.org/TrinityCore/TrinityCore.svg?branch=4.3.4)](https://travis-ci.org/TrinityCore/TrinityCore)
`3.3.5`: [![3.3.5 Build Status](https://travis-ci.org/TrinityCore/TrinityCore.svg?branch=3.3.5)](https://travis-ci.org/TrinityCore/TrinityCore)
@@ -394,6 +394,18 @@ namespace VMAP
}
}
if (bounds.isEmpty())
{
std::cout << "\nModel " << std::string(buff, name_length) << " has empty bounding box" << std::endl;
continue;
}
if (!bounds.isFinite())
{
std::cout << "\nModel " << std::string(buff, name_length) << " has invalid bounding box" << std::endl;
continue;
}
fwrite(&displayId, sizeof(uint32), 1, model_list_copy);
fwrite(&name_length, sizeof(uint32), 1, model_list_copy);
fwrite(&buff, sizeof(char), name_length, model_list_copy);
@@ -78,6 +78,12 @@ void LoadGameObjectModelList()
break;
}
if (v1.isNaN() || v2.isNaN())
{
VMAP_ERROR_LOG("misc", "File '%s' Model '%s' has invalid v1%s v2%s values!", VMAP::GAMEOBJECT_MODELS, std::string(buff, name_length).c_str(), v1.toString().c_str(), v2.toString().c_str());
continue;
}
model_list.insert
(
ModelList::value_type( displayId, GameobjectModelData(std::string(buff, name_length), AABox(v1, v2)) )
@@ -204,14 +204,24 @@ void AuctionBotConfig::GetConfigFromFile()
SetConfig(CONFIG_AHBOT_MINTIME, "AuctionHouseBot.MinTime", 1);
SetConfig(CONFIG_AHBOT_MAXTIME, "AuctionHouseBot.MaxTime", 72);
SetConfigMinMax(CONFIG_AHBOT_BUYER_CHANCE_RATIO_ALLIANCE, "AuctionHouseBot.Buyer.Alliance.Chance.Ratio", 3, 1, 100);
SetConfigMinMax(CONFIG_AHBOT_BUYER_CHANCE_RATIO_HORDE, "AuctionHouseBot.Buyer.Horde.Chance.Ratio", 3, 1, 100);
SetConfigMinMax(CONFIG_AHBOT_BUYER_CHANCE_RATIO_NEUTRAL, "AuctionHouseBot.Buyer.Neutral.Chance.Ratio", 3, 1, 100);
SetConfigMinMax(CONFIG_AHBOT_BUYER_RECHECK_INTERVAL, "AuctionHouseBot.Buyer.Recheck.Interval", 20, 1, DAY / MINUTE);
SetConfig(CONFIG_AHBOT_BUYER_BASEPRICE_GRAY, "AuctionHouseBot.Buyer.Baseprice.Gray", 3504);
SetConfig(CONFIG_AHBOT_BUYER_BASEPRICE_WHITE, "AuctionHouseBot.Buyer.Baseprice.White", 5429);
SetConfig(CONFIG_AHBOT_BUYER_BASEPRICE_GREEN, "AuctionHouseBot.Buyer.Baseprice.Green", 21752);
SetConfig(CONFIG_AHBOT_BUYER_BASEPRICE_BLUE, "AuctionHouseBot.Buyer.Baseprice.Blue", 36463);
SetConfig(CONFIG_AHBOT_BUYER_BASEPRICE_PURPLE, "AuctionHouseBot.Buyer.Baseprice.Purple", 87124);
SetConfig(CONFIG_AHBOT_BUYER_BASEPRICE_ORANGE, "AuctionHouseBot.Buyer.Baseprice.Orange", 214347);
SetConfig(CONFIG_AHBOT_BUYER_BASEPRICE_YELLOW, "AuctionHouseBot.Buyer.Baseprice.Yellow", 407406);
SetConfig(CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_GRAY, "AuctionHouseBot.Buyer.ChanceMultiplier.Gray", 100);
SetConfig(CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_WHITE, "AuctionHouseBot.Buyer.ChanceMultiplier.White", 100);
SetConfig(CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_GREEN, "AuctionHouseBot.Buyer.ChanceMultiplier.Green", 100);
SetConfig(CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_BLUE, "AuctionHouseBot.Buyer.ChanceMultiplier.Blue", 100);
SetConfig(CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_PURPLE, "AuctionHouseBot.Buyer.ChanceMultiplier.Purple", 100);
SetConfig(CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_ORANGE, "AuctionHouseBot.Buyer.ChanceMultiplier.Orange", 100);
SetConfig(CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_YELLOW, "AuctionHouseBot.Buyer.ChanceMultiplier.Yellow", 100);
SetConfig(CONFIG_AHBOT_SELLER_ENABLED, "AuctionHouseBot.Seller.Enabled", false);
SetConfig(CONFIG_AHBOT_BUYER_ENABLED, "AuctionHouseBot.Buyer.Enabled", false);
SetConfig(CONFIG_AHBOT_BUYPRICE_BUYER, "AuctionHouseBot.Buyer.Buyprice", true);
SetConfig(CONFIG_AHBOT_CLASS_MISC_MOUNT_MIN_REQ_LEVEL, "AuctionHouseBot.Class.Misc.Mount.ReqLevel.Min", 0);
SetConfig(CONFIG_AHBOT_CLASS_MISC_MOUNT_MAX_REQ_LEVEL, "AuctionHouseBot.Class.Misc.Mount.ReqLevel.Max", 0);
@@ -110,10 +110,21 @@ enum AuctionBotConfigUInt32Values
CONFIG_AHBOT_CLASS_PERMANENT_PRICE_RATIO,
CONFIG_AHBOT_CLASS_MISC_PRICE_RATIO,
CONFIG_AHBOT_CLASS_GLYPH_PRICE_RATIO,
CONFIG_AHBOT_BUYER_CHANCE_RATIO_ALLIANCE,
CONFIG_AHBOT_BUYER_CHANCE_RATIO_HORDE,
CONFIG_AHBOT_BUYER_CHANCE_RATIO_NEUTRAL,
CONFIG_AHBOT_BUYER_RECHECK_INTERVAL,
CONFIG_AHBOT_BUYER_BASEPRICE_GRAY,
CONFIG_AHBOT_BUYER_BASEPRICE_WHITE,
CONFIG_AHBOT_BUYER_BASEPRICE_GREEN,
CONFIG_AHBOT_BUYER_BASEPRICE_BLUE,
CONFIG_AHBOT_BUYER_BASEPRICE_PURPLE,
CONFIG_AHBOT_BUYER_BASEPRICE_ORANGE,
CONFIG_AHBOT_BUYER_BASEPRICE_YELLOW,
CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_GRAY,
CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_WHITE,
CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_GREEN,
CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_BLUE,
CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_PURPLE,
CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_ORANGE,
CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_YELLOW,
CONFIG_AHBOT_CLASS_MISC_MOUNT_MIN_REQ_LEVEL,
CONFIG_AHBOT_CLASS_MISC_MOUNT_MAX_REQ_LEVEL,
CONFIG_AHBOT_CLASS_MISC_MOUNT_MIN_SKILL_RANK,
@@ -143,7 +154,6 @@ enum AuctionBotConfigBoolValues
CONFIG_AHBOT_BIND_USE,
CONFIG_AHBOT_BIND_QUEST,
CONFIG_AHBOT_BUYPRICE_SELLER,
CONFIG_AHBOT_BUYPRICE_BUYER,
CONFIG_AHBOT_SELLER_ENABLED,
CONFIG_AHBOT_BUYER_ENABLED,
CONFIG_AHBOT_LOCKBOX_ENABLED,
@@ -20,7 +20,7 @@
#include "ItemPrototype.h"
#include "AuctionHouseBotBuyer.h"
AuctionBotBuyer::AuctionBotBuyer(): _checkInterval(20)
AuctionBotBuyer::AuctionBotBuyer() : _checkInterval(20 * MINUTE)
{
// Define faction for our main data class.
for (int i = 0; i < MAX_AUCTION_HOUSE_TYPE; ++i)
@@ -48,35 +48,12 @@ bool AuctionBotBuyer::Initialize()
if (!activeHouse)
return false;
//load Check interval
// load Check interval
_checkInterval = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYER_RECHECK_INTERVAL) * MINUTE;
TC_LOG_DEBUG("ahbot", "AHBot buyer interval between 2 check = %u", _checkInterval);
TC_LOG_DEBUG("ahbot", "AHBot buyer interval is %u minutes", _checkInterval / MINUTE);
return true;
}
void AuctionBotBuyer::LoadBuyerValues(BuyerConfiguration& config)
{
uint32 factionChance;
switch (config.GetHouseType())
{
case AUCTION_HOUSE_ALLIANCE:
config.BuyerPriceRatio = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_ALLIANCE_PRICE_RATIO) + 50;
factionChance = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYER_CHANCE_RATIO_ALLIANCE);
break;
case AUCTION_HOUSE_HORDE:
config.BuyerPriceRatio = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_HORDE_PRICE_RATIO) + 50;
factionChance = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYER_CHANCE_RATIO_HORDE);
break;
default:
config.BuyerPriceRatio = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_NEUTRAL_PRICE_RATIO) + 50;
factionChance = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYER_CHANCE_RATIO_NEUTRAL);
break;
}
config.FactionChance = 5000 * factionChance;
}
void AuctionBotBuyer::LoadConfig()
{
for (int i = 0; i < MAX_AUCTION_HOUSE_TYPE; ++i)
@@ -87,352 +64,378 @@ void AuctionBotBuyer::LoadConfig()
}
}
uint32 AuctionBotBuyer::GetBuyableEntry(BuyerConfiguration& config)
void AuctionBotBuyer::LoadBuyerValues(BuyerConfiguration& config)
{
}
// Makes an AHbot buyer cycle for AH type if necessary
bool AuctionBotBuyer::Update(AuctionHouseType houseType)
{
if (!sAuctionBotConfig->GetConfigBuyerEnabled(houseType))
return false;
TC_LOG_DEBUG("ahbot", "AHBot: %s buying ...", AuctionBotConfig::GetHouseTypeName(houseType));
BuyerConfiguration& config = _houseConfig[houseType];
uint32 eligibleItems = GetItemInformation(config);
if (eligibleItems)
{
// Prepare list of items to bid or buy - remove old items
PrepareListOfEntry(config);
// Process buying and bidding items
BuyAndBidItems(config);
}
return true;
}
// Collects information about item counts and minimum prices to SameItemInfo and updates EligibleItems - a list with new items eligible for bot to buy and bid
// Returns count of items in AH that were eligible for being bought or bidded on by ahbot buyer (EligibleItems size)
uint32 AuctionBotBuyer::GetItemInformation(BuyerConfiguration& config)
{
config.SameItemInfo.clear();
uint32 count = 0;
time_t now = time(nullptr);
uint32 count = 0;
AuctionHouseObject* house = sAuctionMgr->GetAuctionsMap(config.GetHouseType());
for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = house->GetAuctionsBegin(); itr != house->GetAuctionsEnd(); ++itr)
{
AuctionEntry* entry = itr->second;
Item* item = sAuctionMgr->GetAItem(entry->itemGUIDLow);
if (item)
if (!item)
continue;
BuyerItemInfo& itemInfo = config.SameItemInfo[item->GetEntry()];
// Update item entry's count and total bid prices
// This can be used later to determine the prices and chances to bid
uint32 itemBidPrice = entry->startbid / item->GetCount();
itemInfo.TotalBidPrice = itemInfo.TotalBidPrice + itemBidPrice;
itemInfo.BidItemCount++;
// Set minimum bid price
if (!itemInfo.MinBidPrice)
itemInfo.MinBidPrice = itemBidPrice;
else
itemBidPrice = std::min(itemInfo.MinBidPrice, itemBidPrice);
// Set minimum buyout price if item has buyout
if (entry->buyout)
{
ItemTemplate const * prototype = item->GetTemplate();
if (prototype)
{
++config.SameItemInfo[item->GetEntry()].ItemCount; // Structure constructor will make sure Element are correctly initialized 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());
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();
else if (config.SameItemInfo[item->GetEntry()].MinBuyPrice == 0)
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();
else if (config.SameItemInfo[item->GetEntry()].MinBidPrice == 0)
config.SameItemInfo[item->GetEntry()].MinBidPrice = itr->second->startbid / item->GetCount();
// Update item entry's count and total buyout prices
// This can be used later to determine the prices and chances to buyout
uint32 itemBuyPrice = entry->buyout / item->GetCount();
itemInfo.TotalBuyPrice = itemInfo.TotalBuyPrice + itemBuyPrice;
itemInfo.BuyItemCount++;
if (!entry->owner)
{
if (!itemInfo.MinBuyPrice)
itemInfo.MinBuyPrice = itemBuyPrice;
else
itemInfo.MinBuyPrice = std::min(itemInfo.MinBuyPrice, itemBuyPrice);
}
if (entry->bid != 0 && entry->bidder) // Add bid by player
{
config.CheckedEntry[entry->Id].LastExist = now;
config.CheckedEntry[entry->Id].AuctionId = entry->Id;
++count;
}
}
else
{
if (entry->bid != 0)
{
if (entry->bidder)
{
config.CheckedEntry[entry->Id].LastExist = now;
config.CheckedEntry[entry->Id].AuctionId = entry->Id;
++count;
}
}
else
{
config.CheckedEntry[entry->Id].LastExist = now;
config.CheckedEntry[entry->Id].AuctionId = entry->Id;
++count;
}
}
}
// Add/update to EligibleItems if:
// has a bid by player or
// has no bids and not owned by bot
if ((entry->bid && entry->bidder) || (entry->owner && !entry->bid))
{
config.EligibleItems[entry->Id].LastExist = now;
config.EligibleItems[entry->Id].AuctionId = entry->Id;
++count;
}
}
TC_LOG_DEBUG("ahbot", "AHBot: %u items added to buyable vector for ah type: %u", count, config.GetHouseType());
TC_LOG_DEBUG("ahbot", "AHBot: %u items added to buyable/biddable vector for ah type: %u", count, config.GetHouseType());
TC_LOG_DEBUG("ahbot", "AHBot: SameItemInfo size = %u", (uint32)config.SameItemInfo.size());
return count;
}
// ahInfo can be NULL
bool AuctionBotBuyer::RollBuyChance(const BuyerItemInfo* ahInfo, const Item* item, const AuctionEntry* auction, uint32 /*bidPrice*/)
{
if (!auction->buyout)
return false;
uint32 itemBuyPrice = auction->buyout / item->GetCount();
uint32 itemPrice = item->GetTemplate()->SellPrice ? item->GetTemplate()->SellPrice : GetVendorPrice(item->GetTemplate()->Quality);
// The AH cut needs to be added to the price, but we dont want a 100% chance to buy if the price is exactly AH default
itemPrice *= 1.4f;
// This value is between 0 and 100 and is used directly as the chance to buy or bid
// Value equal or above 100 means 100% chance and value below 0 means 0% chance
float chance = 100 / sqrt(itemBuyPrice / float(itemPrice));
// If a player has bidded on item, have fifth of normal chance
if (auction->bidder)
chance = chance / 5;
if (ahInfo)
{
float avgBuyPrice = ahInfo->TotalBuyPrice / float(ahInfo->BuyItemCount);
TC_LOG_DEBUG("ahbot", "AHBot: buyout average: %.1f items with buyout: %u", avgBuyPrice, ahInfo->BuyItemCount);
// If there are more than 5 items on AH of this entry, try weigh in the average buyout price
if (ahInfo->BuyItemCount > 5)
{
chance *= 1 / sqrt(itemBuyPrice / avgBuyPrice);
}
}
// Add config weigh in for quality
chance *= GetChanceMultiplier(item->GetTemplate()->Quality) / 100.0f;
float rand = frand(0, 100);
bool win = rand <= chance;
TC_LOG_DEBUG("ahbot", "AHBot: %s BUY! chance = %.2f, price = %u, buyprice = %u.", win ? "WIN" : "LOSE", chance, itemPrice, itemBuyPrice);
return win;
}
// ahInfo can be NULL
bool AuctionBotBuyer::RollBidChance(const BuyerItemInfo* ahInfo, const Item* item, const AuctionEntry* auction, uint32 bidPrice)
{
uint32 itemBidPrice = bidPrice / item->GetCount();
uint32 itemPrice = item->GetTemplate()->SellPrice ? item->GetTemplate()->SellPrice : GetVendorPrice(item->GetTemplate()->Quality);
// The AH cut needs to be added to the price, but we dont want a 100% chance to buy if the price is exactly AH default
itemPrice *= 1.4f;
// This value is between 0 and 100 and is used directly as the chance to buy or bid
// Value equal or above 100 means 100% chance and value below 0 means 0% chance
float chance = 100 / sqrt(itemBidPrice / float(itemPrice));
if (ahInfo)
{
float avgBidPrice = ahInfo->TotalBidPrice / float(ahInfo->BidItemCount);
TC_LOG_DEBUG("ahbot", "AHBot: Bid average: %.1f biddable item count: %u", avgBidPrice, ahInfo->BidItemCount);
// If there are more than 5 items on AH of this entry, try weigh in the average bid price
if (ahInfo->BidItemCount >= 5)
{
chance *= 1 / sqrt(itemBidPrice / avgBidPrice);
}
}
// If a player has bidded on item, have fifth of normal chance
if (auction->bidder)
chance = chance / 5;
// Add config weigh in for quality
chance *= GetChanceMultiplier(item->GetTemplate()->Quality) / 100.0f;
float rand = frand(0, 100);
bool win = rand <= chance;
TC_LOG_DEBUG("ahbot", "AHBot: %s BID! chance = %.2f, price = %u, bidprice = %u.", win ? "WIN" : "LOSE", chance, itemPrice, itemBidPrice);
return win;
}
// Removes items from EligibleItems that we shouldnt buy or bid on
// The last existed time on them should be older than now
void AuctionBotBuyer::PrepareListOfEntry(BuyerConfiguration& config)
{
// now - 5 seconds to leave out all old entries but keep the ones just updated a moment ago
time_t now = time(nullptr) - 5;
for (CheckEntryMap::iterator itr = config.CheckedEntry.begin(); itr != config.CheckedEntry.end();)
for (CheckEntryMap::iterator itr = config.EligibleItems.begin(); itr != config.EligibleItems.end();)
{
if (itr->second.LastExist < (now - 5))
config.CheckedEntry.erase(itr++);
if (itr->second.LastExist < now)
config.EligibleItems.erase(itr++);
else
++itr;
}
TC_LOG_DEBUG("ahbot", "AHBot: CheckedEntry size = %u", (uint32)config.CheckedEntry.size());
TC_LOG_DEBUG("ahbot", "AHBot: EligibleItems size = %u", (uint32)config.EligibleItems.size());
}
bool AuctionBotBuyer::IsBuyableEntry(uint32 buyoutPrice, double inGameBuyPrice, uint32 maxBuyablePrice, uint32 minBuyPrice, uint32 maxChance, uint32 chanceRatio)
// Tries to bid and buy items based on their prices and chances set in configs
void AuctionBotBuyer::BuyAndBidItems(BuyerConfiguration& config)
{
double ratio = 0;
uint32 chance = 0;
if (buyoutPrice <= minBuyPrice)
{
if (buyoutPrice <= maxBuyablePrice)
chance = maxChance;
else
{
if (buyoutPrice > 0 && maxBuyablePrice > 0)
{
ratio = double(buyoutPrice) / double(maxBuyablePrice);
if (ratio < 10)
chance = maxChance - (ratio * maxChance / 10);
else
chance = 1;
}
}
}
else if (buyoutPrice <= inGameBuyPrice)
{
if (buyoutPrice <= maxBuyablePrice)
chance = maxChance / 5;
else
{
if (buyoutPrice > 0 && maxBuyablePrice > 0)
{
ratio = double(buyoutPrice) / double(maxBuyablePrice);
if (ratio < 10)
chance = (maxChance / 5) - (ratio * maxChance / 50);
else
chance = 1;
}
}
}
else if (buyoutPrice <= maxBuyablePrice)
chance = maxChance / 10;
else
{
if (buyoutPrice > 0 && maxBuyablePrice > 0)
{
ratio = double(buyoutPrice) / double(maxBuyablePrice);
if (ratio < 10)
chance = (maxChance / 5) - (ratio* maxChance / 50);
else
chance = 0;
}
else
chance = 0;
}
if (urand(1, chanceRatio) <= chance)
{
TC_LOG_DEBUG("ahbot", "AHBot: WIN BUY! Chance = %u, num = %u.", chance, chanceRatio);
return true;
}
else
{
TC_LOG_DEBUG("ahbot", "AHBot: LOOSE BUY! Chance = %u, num = %u.", chance, chanceRatio);
return false;
}
}
bool AuctionBotBuyer::IsBidableEntry(uint32 bidPrice, double inGameBuyPrice, double maxBidablePrice, uint32 minBidPrice, uint32 maxChance, uint32 chanceRatio)
{
double ratio = 0;
uint32 chance = 0;
if (bidPrice <= minBidPrice)
{
if (inGameBuyPrice != 0 && bidPrice < inGameBuyPrice - (inGameBuyPrice / 30))
chance = maxChance;
else
{
if (bidPrice < maxBidablePrice)
{
ratio = maxBidablePrice / bidPrice;
if (ratio < 3)
chance = maxChance / 500 * ratio;
else
chance = maxChance / 500;
}
}
}
else if (bidPrice < (inGameBuyPrice - (inGameBuyPrice / 30)))
chance = (maxChance / 10);
else
{
if (bidPrice < maxBidablePrice)
{
ratio = maxBidablePrice / bidPrice;
if (ratio < 4)
chance = maxChance / 1000 * ratio;
else
chance = maxChance / 1000;
}
}
if (urand(1, chanceRatio) <= chance)
{
TC_LOG_DEBUG("ahbot", "AHBot: WIN BID! Chance = %u, num = %u.", chance, chanceRatio);
return true;
}
else
{
TC_LOG_DEBUG("ahbot", "AHBot: LOOSE BID! Chance = %u, num = %u.", chance, chanceRatio);
return false;
}
}
void AuctionBotBuyer::PlaceBidToEntry(AuctionEntry* auction, uint32 bidPrice)
{
TC_LOG_DEBUG("ahbot", "AHBot: Bid placed to entry %u, %.2fg", auction->Id, float(bidPrice) / 10000.0f);
auction->bid = bidPrice;
}
void AuctionBotBuyer::BuyEntry(AuctionEntry* auction)
{
TC_LOG_DEBUG("ahbot", "AHBot: Entry %u bought at %.2fg", auction->Id, float(auction->buyout) / 10000.0f);
auction->bid = auction->buyout;
}
void AuctionBotBuyer::AddNewAuctionBuyerBotBid(BuyerConfiguration& config)
{
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(config.GetHouseType());
PrepareListOfEntry(config);
time_t now = time(nullptr);
uint32 buyCycles;
if (config.CheckedEntry.size() > sAuctionBotConfig->GetItemPerCycleBoost())
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(config.GetHouseType());
CheckEntryMap& items = config.EligibleItems;
// Max amount of items to buy or bid
uint32 cycles = sAuctionBotConfig->GetItemPerCycleNormal();
if (items.size() > sAuctionBotConfig->GetItemPerCycleBoost())
{
buyCycles = sAuctionBotConfig->GetItemPerCycleBoost();
// set more cycles if there is a huge influx of items
cycles = sAuctionBotConfig->GetItemPerCycleBoost();
TC_LOG_DEBUG("ahbot", "AHBot: Boost value used for Buyer! (if this happens often adjust both ItemsPerCycle in worldserver.conf)");
}
else
buyCycles = sAuctionBotConfig->GetItemPerCycleNormal();
for (CheckEntryMap::iterator itr = config.CheckedEntry.begin(); itr != config.CheckedEntry.end();)
// Process items eligible to be bidded or bought
CheckEntryMap::iterator itr = items.begin();
while (cycles && itr != items.end())
{
AuctionEntry* auction = auctionHouse->GetAuction(itr->second.AuctionId);
if (!auction) // is auction not active now
if (!auction)
{
TC_LOG_DEBUG("ahbot", "AHBot: Entry %u doesn't exists, perhaps bought already?",
itr->second.AuctionId);
config.CheckedEntry.erase(itr++);
TC_LOG_DEBUG("ahbot", "AHBot: Entry %u doesn't exists, perhaps bought already?", itr->second.AuctionId);
items.erase(itr++);
continue;
}
if (itr->second.LastChecked != 0 && (now - itr->second.LastChecked) <= _checkInterval)
// Check if the item has been checked once before
// If it has been checked and it was recently, skip it
if (itr->second.LastChecked && (now - itr->second.LastChecked) <= _checkInterval)
{
TC_LOG_DEBUG("ahbot", "AHBot: In time interval wait for entry %u!", auction->Id);
++itr;
continue;
}
if (buyCycles == 0)
break;
uint32 maxChance = 5000;
Item* item = sAuctionMgr->GetAItem(auction->itemGUIDLow);
if (!item) // auction item not accessible, possible auction in payment pending mode
if (!item)
{
config.CheckedEntry.erase(itr++);
// auction item not accessible, possible auction in payment pending mode
items.erase(itr++);
continue;
}
ItemTemplate const* prototype = item->GetTemplate();
uint32 basePrice = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYPRICE_BUYER) ? prototype->BuyPrice : prototype->SellPrice;
basePrice *= item->GetCount();
uint32 maxBuyablePrice = (basePrice * config.BuyerPriceRatio) / 100;
BuyerItemInfoMap::iterator sameItemItr = config.SameItemInfo.find(item->GetEntry());
uint32 buyoutPrice = auction->buyout / item->GetCount();
// price to bid if bidding
uint32 bidPrice;
uint32 bidPriceByItem;
uint32 minBidPrice;
uint32 minBuyPrice;
if (auction->bid >= auction->startbid)
{
bidPrice = auction->GetAuctionOutBid();
bidPriceByItem = auction->bid / item->GetCount();
// get bid price to outbid previous bidder
bidPrice = auction->bid + auction->GetAuctionOutBid();
}
else
{
// no previous bidders - use starting bid
bidPrice = auction->startbid;
bidPriceByItem = auction->startbid / item->GetCount();
}
double inGameBuyPrice;
double inGameBidPrice;
if (sameItemItr == config.SameItemInfo.end())
{
inGameBuyPrice = 0;
inGameBidPrice = 0;
minBidPrice = 0;
minBuyPrice = 0;
}
else
{
if (sameItemItr->second.ItemCount == 1)
maxBuyablePrice = maxBuyablePrice * 5; // if only one item exist can be bought if the price is high too.
inGameBuyPrice = sameItemItr->second.BuyPrice / sameItemItr->second.ItemCount;
inGameBidPrice = sameItemItr->second.BidPrice / sameItemItr->second.ItemCount;
minBidPrice = sameItemItr->second.MinBidPrice;
minBuyPrice = sameItemItr->second.MinBuyPrice;
}
const BuyerItemInfo* ahInfo = nullptr;
BuyerItemInfoMap::const_iterator sameItemItr = config.SameItemInfo.find(item->GetEntry());
if (sameItemItr != config.SameItemInfo.end())
ahInfo = &sameItemItr->second;
uint32 maxBidablePrice = maxBuyablePrice - (maxBuyablePrice / 30); // Max Bidable price defined to 70% of max buyable price
TC_LOG_DEBUG("ahbot", "AHBot: Rolling for AHentry %u:", auction->Id);
TC_LOG_DEBUG("ahbot", "AHBot: Auction added with data:");
TC_LOG_DEBUG("ahbot", "AHBot: MaxPrice of Entry %u is %.1fg.", itr->second.AuctionId, double(maxBuyablePrice) / 10000.0);
TC_LOG_DEBUG("ahbot", "AHBot: GamePrice buy=%.1fg, bid=%.1fg.", inGameBuyPrice / 10000, inGameBidPrice / 10000);
TC_LOG_DEBUG("ahbot", "AHBot: Minimal price see in AH Buy=%ug, Bid=%ug.",
minBuyPrice / 10000, minBidPrice / 10000);
TC_LOG_DEBUG("ahbot", "AHBot: Actual Entry price, Buy=%ug, Bid=%ug.", buyoutPrice / 10000, bidPrice / 10000);
// Roll buy and bid chances
bool successBuy = RollBuyChance(ahInfo, item, auction, bidPrice);
bool successBid = RollBidChance(ahInfo, item, auction, bidPrice);
if (!auction->owner) // Original auction owner
maxChance = maxChance / 5; // if Owner is AHBot this mean player placed bid on this auction. We divide by 5 chance for AhBuyer to place bid on it. (This make more challenge than ignore entry)
if (auction->buyout != 0) // Is the item directly buyable?
{
if (IsBuyableEntry(buyoutPrice, inGameBuyPrice, maxBuyablePrice, minBuyPrice, maxChance, config.FactionChance))
{
if (IsBidableEntry(bidPriceByItem, inGameBuyPrice, maxBidablePrice, minBidPrice, maxChance / 2, config.FactionChance))
{
if (urand(0, 5) == 0)
PlaceBidToEntry(auction, bidPrice);
else
BuyEntry(auction);
}
else
BuyEntry(auction);
}
else if (IsBidableEntry(bidPriceByItem, inGameBuyPrice, maxBidablePrice, minBidPrice, maxChance / 2, config.FactionChance))
PlaceBidToEntry(auction, bidPrice);
}
else if (IsBidableEntry(bidPriceByItem, inGameBuyPrice, maxBidablePrice, minBidPrice, maxChance, config.FactionChance))
PlaceBidToEntry(auction, bidPrice);
// If roll bidding succesfully and bid price is above buyout -> buyout
// If roll for buying was successful but not for bid, buyout directly
// If roll bidding was also successful, buy the entry with 20% chance
// - Better bid than buy since the item is bought by bot if no player bids after
// Otherwise bid if roll for bid was successful
if ((auction->buyout && successBid && bidPrice >= auction->buyout) ||
(successBuy && (!successBid || urand(1, 5) == 1)))
BuyEntry(auction, auctionHouse); // buyout
else if (successBid)
PlaceBidToEntry(auction, bidPrice); // bid
itr->second.LastChecked = now;
--buyCycles;
--cycles;
++itr;
}
// Clear not needed entries
config.SameItemInfo.clear();
}
bool AuctionBotBuyer::Update(AuctionHouseType houseType)
uint32 AuctionBotBuyer::GetVendorPrice(uint32 quality)
{
if (sAuctionBotConfig->GetConfigBuyerEnabled(houseType))
switch (quality)
{
TC_LOG_DEBUG("ahbot", "AHBot: %s buying ...", AuctionBotConfig::GetHouseTypeName(houseType));
if (GetBuyableEntry(_houseConfig[houseType]) > 0)
AddNewAuctionBuyerBotBid(_houseConfig[houseType]);
return true;
case ITEM_QUALITY_POOR:
return sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYER_BASEPRICE_GRAY);
case ITEM_QUALITY_NORMAL:
return sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYER_BASEPRICE_WHITE);
case ITEM_QUALITY_UNCOMMON:
return sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYER_BASEPRICE_GREEN);
case ITEM_QUALITY_RARE:
return sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYER_BASEPRICE_BLUE);
case ITEM_QUALITY_EPIC:
return sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYER_BASEPRICE_PURPLE);
case ITEM_QUALITY_LEGENDARY:
return sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYER_BASEPRICE_ORANGE);
case ITEM_QUALITY_ARTIFACT:
return sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYER_BASEPRICE_YELLOW);
default:
return 1 * SILVER;
}
return false;
}
uint32 AuctionBotBuyer::GetChanceMultiplier(uint32 quality)
{
switch (quality)
{
case ITEM_QUALITY_POOR:
return sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_GRAY);
case ITEM_QUALITY_NORMAL:
return sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_WHITE);
case ITEM_QUALITY_UNCOMMON:
return sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_GREEN);
case ITEM_QUALITY_RARE:
return sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_BLUE);
case ITEM_QUALITY_EPIC:
return sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_PURPLE);
case ITEM_QUALITY_LEGENDARY:
return sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_ORANGE);
case ITEM_QUALITY_ARTIFACT:
return sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_YELLOW);
default:
return 100;
}
}
// Buys the auction and does necessary actions to complete the buyout
void AuctionBotBuyer::BuyEntry(AuctionEntry* auction, AuctionHouseObject* auctionHouse)
{
TC_LOG_DEBUG("ahbot", "AHBot: Entry %u bought at %.2fg", auction->Id, float(auction->buyout) / GOLD);
SQLTransaction trans = CharacterDatabase.BeginTransaction();
// Send mail to previous bidder if any
if (auction->bidder)
sAuctionMgr->SendAuctionOutbiddedMail(auction, auction->buyout, NULL, trans);
// Set bot as bidder and set new bid amount
auction->bidder = 0;
auction->bid = auction->buyout;
// Mails must be under transaction control too to prevent data loss
sAuctionMgr->SendAuctionSalePendingMail(auction, trans);
sAuctionMgr->SendAuctionSuccessfulMail(auction, trans);
sAuctionMgr->SendAuctionWonMail(auction, trans);
// Delete auction from DB
auction->DeleteFromDB(trans);
// Remove auction item and auction from memory
sAuctionMgr->RemoveAItem(auction->itemGUIDLow);
auctionHouse->RemoveAuction(auction);
// Run SQLs
CharacterDatabase.CommitTransaction(trans);
}
// Bids on the auction and does the necessary actions for bidding
void AuctionBotBuyer::PlaceBidToEntry(AuctionEntry* auction, uint32 bidPrice)
{
TC_LOG_DEBUG("ahbot", "AHBot: Bid placed to entry %u, %.2fg", auction->Id, float(bidPrice) / GOLD);
SQLTransaction trans = CharacterDatabase.BeginTransaction();
// Send mail to previous bidder if any
if (auction->bidder)
sAuctionMgr->SendAuctionOutbiddedMail(auction, bidPrice, NULL, trans);
// Set bot as bidder and set new bid amount
auction->bidder = 0;
auction->bid = bidPrice;
// Update auction to DB
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_AUCTION_BID);
stmt->setUInt32(0, auction->bidder);
stmt->setUInt32(1, auction->bid);
stmt->setUInt32(2, auction->Id);
trans->Append(stmt);
// Run SQLs
CharacterDatabase.CommitTransaction(trans);
}
@@ -24,7 +24,7 @@
struct BuyerAuctionEval
{
BuyerAuctionEval(): AuctionId(0), LastChecked(0), LastExist(0) {}
BuyerAuctionEval() : AuctionId(0), LastChecked(0), LastExist(0) { }
uint32 AuctionId;
time_t LastChecked;
@@ -33,13 +33,14 @@ struct BuyerAuctionEval
struct BuyerItemInfo
{
BuyerItemInfo(): ItemCount(0), BuyPrice(0), BidPrice(0), MinBuyPrice(0), MinBidPrice(0) {}
BuyerItemInfo() : BidItemCount(0), BuyItemCount(0), MinBuyPrice(0), MinBidPrice(0), TotalBuyPrice(0), TotalBidPrice(0) { }
uint32 ItemCount;
double BuyPrice;
double BidPrice;
uint32 BidItemCount;
uint32 BuyItemCount;
uint32 MinBuyPrice;
uint32 MinBidPrice;
double TotalBuyPrice;
double TotalBidPrice;
};
typedef std::map<uint32, BuyerItemInfo> BuyerItemInfoMap;
@@ -47,7 +48,7 @@ typedef std::map<uint32, BuyerAuctionEval> CheckEntryMap;
struct BuyerConfiguration
{
BuyerConfiguration(): FactionChance(3), BuyerEnabled(false), BuyerPriceRatio(100), _houseType(AUCTION_HOUSE_NEUTRAL) {}
BuyerConfiguration() : BuyerEnabled(false), _houseType(AUCTION_HOUSE_NEUTRAL) { }
void Initialize(AuctionHouseType houseType)
{
@@ -57,10 +58,8 @@ struct BuyerConfiguration
AuctionHouseType GetHouseType() const { return _houseType; }
BuyerItemInfoMap SameItemInfo;
CheckEntryMap CheckedEntry;
uint32 FactionChance;
CheckEntryMap EligibleItems;
bool BuyerEnabled;
uint32 BuyerPriceRatio;
private:
AuctionHouseType _houseType;
@@ -78,19 +77,23 @@ public:
bool Update(AuctionHouseType houseType) override;
void LoadConfig();
void AddNewAuctionBuyerBotBid(BuyerConfiguration& config);
void BuyAndBidItems(BuyerConfiguration& config);
private:
uint32 _checkInterval;
BuyerConfiguration _houseConfig[MAX_AUCTION_HOUSE_TYPE];
void LoadBuyerValues(BuyerConfiguration& config);
bool IsBuyableEntry(uint32 buyoutPrice, double inGameBuyPrice, uint32 maxBuyablePrice, uint32 minBuyPrice, uint32 maxChance, uint32 chanceRatio);
bool IsBidableEntry(uint32 bidPrice, double inGameBuyPrice, double maxBidablePrice, uint32 minBidPrice, uint32 maxChance, uint32 chanceRatio);
// ahInfo can be NULL
bool RollBuyChance(const BuyerItemInfo* ahInfo, const Item* item, const AuctionEntry* auction, uint32 bidPrice);
bool RollBidChance(const BuyerItemInfo* ahInfo, const Item* item, const AuctionEntry* auction, uint32 bidPrice);
void PlaceBidToEntry(AuctionEntry* auction, uint32 bidPrice);
void BuyEntry(AuctionEntry* auction);
void BuyEntry(AuctionEntry* auction, AuctionHouseObject* auctionHouse);
void PrepareListOfEntry(BuyerConfiguration& config);
uint32 GetBuyableEntry(BuyerConfiguration& config);
uint32 GetItemInformation(BuyerConfiguration& config);
uint32 GetVendorPrice(uint32 quality);
uint32 GetChanceMultiplier(uint32 quality);
};
#endif
@@ -44,14 +44,14 @@ bool AuctionBotSeller::Initialize()
{
std::stringstream includeStream(sAuctionBotConfig->GetAHBotIncludes());
std::string temp;
while (getline(includeStream, temp, ','))
while (std::getline(includeStream, temp, ','))
includeItems.push_back(atoi(temp.c_str()));
}
{
std::stringstream excludeStream(sAuctionBotConfig->GetAHBotExcludes());
std::string temp;
while (getline(excludeStream, temp, ','))
while (std::getline(excludeStream, temp, ','))
excludeItems.push_back(atoi(temp.c_str()));
}
+1 -1
View File
@@ -19291,7 +19291,7 @@ bool Player::Satisfy(AccessRequirement const* ar, uint32 target_map, bool report
else if (mapDiff->hasErrorMessage) // if (missingAchievement) covered by this case
SendTransferAborted(target_map, TRANSFER_ABORT_DIFFICULTY, target_difficulty);
else if (missingItem)
GetSession()->SendAreaTriggerMessage(GetSession()->GetTrinityString(LANG_LEVEL_MINREQUIRED_AND_ITEM), LevelMin, sObjectMgr->GetItemTemplate(missingItem)->Name1.c_str());
GetSession()->SendAreaTriggerMessage(GetSession()->GetTrinityString(LANG_LEVEL_MINREQUIRED_AND_ITEM), LevelMin, ASSERT_NOTNULL(sObjectMgr->GetItemTemplate(missingItem))->Name1.c_str());
else if (LevelMin)
GetSession()->SendAreaTriggerMessage(GetSession()->GetTrinityString(LANG_LEVEL_MINREQUIRED), LevelMin);
}
+8 -26
View File
@@ -7203,6 +7203,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
continue;
}
bool invalidSpilloverFaction = false;
for (uint32 i = 0; i < MAX_SPILLOVER_FACTIONS; ++i)
{
if (repTemplate.faction[i])
@@ -7212,47 +7213,28 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
if (!factionSpillover)
{
TC_LOG_ERROR("sql.sql", "Spillover faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template` for faction %u, skipping", repTemplate.faction[i], factionId);
continue;
invalidSpilloverFaction = true;
break;
}
if (factionSpillover->reputationListID < 0)
{
TC_LOG_ERROR("sql.sql", "Spillover faction (faction.dbc) %u for faction %u in `reputation_spillover_template` can not be listed for client, and then useless, skipping", repTemplate.faction[i], factionId);
continue;
invalidSpilloverFaction = true;
break;
}
if (repTemplate.faction_rank[i] >= MAX_REPUTATION_RANK)
{
TC_LOG_ERROR("sql.sql", "Rank %u used in `reputation_spillover_template` for spillover faction %u is not valid, skipping", repTemplate.faction_rank[i], repTemplate.faction[i]);
continue;
invalidSpilloverFaction = true;
break;
}
}
}
FactionEntry const* factionEntry0 = sFactionStore.LookupEntry(repTemplate.faction[0]);
if (repTemplate.faction[0] && !factionEntry0)
{
TC_LOG_ERROR("sql.sql", "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[0]);
if (invalidSpilloverFaction)
continue;
}
FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(repTemplate.faction[1]);
if (repTemplate.faction[1] && !factionEntry1)
{
TC_LOG_ERROR("sql.sql", "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[1]);
continue;
}
FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(repTemplate.faction[2]);
if (repTemplate.faction[2] && !factionEntry2)
{
TC_LOG_ERROR("sql.sql", "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[2]);
continue;
}
FactionEntry const* factionEntry3 = sFactionStore.LookupEntry(repTemplate.faction[3]);
if (repTemplate.faction[3] && !factionEntry3)
{
TC_LOG_ERROR("sql.sql", "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[3]);
continue;
}
FactionEntry const* factionEntry4 = sFactionStore.LookupEntry(repTemplate.faction[4]);
if (repTemplate.faction[4] && !factionEntry4)
{
+1 -1
View File
@@ -1856,7 +1856,7 @@ GroupJoinBattlegroundResult Group::CanJoinBattlegroundQueue(Battleground const*
return ERR_BATTLEGROUND_NONE; // ERR_GROUP_JOIN_BATTLEGROUND_TOO_MANY handled on client side
// get a player as reference, to compare other players' stats to (arena team id, queue id based on level, etc.)
Player* reference = GetFirstMember()->GetSource();
Player* reference = ASSERT_NOTNULL(GetFirstMember())->GetSource();
// no reference found, can't join this way
if (!reference)
return ERR_BATTLEGROUND_JOIN_FAILED;
@@ -436,7 +436,7 @@ enum SpellAttr4
SPELL_ATTR4_UNK4 = 0x00000010, // 4 This will no longer cause guards to attack on use??
SPELL_ATTR4_UNK5 = 0x00000020, // 5
SPELL_ATTR4_NOT_STEALABLE = 0x00000040, // 6 although such auras might be dispellable, they cannot be stolen
SPELL_ATTR4_TRIGGERED = 0x00000080, // 7 spells forced to be triggered
SPELL_ATTR4_CAN_CAST_WHILE_CASTING = 0x00000080, // 7 Can be cast while another cast is in progress - see CanCastWhileCasting(SpellRec const*,CGUnit_C *,int &)
SPELL_ATTR4_FIXED_DAMAGE = 0x00000100, // 8 Ignores resilience and any (except mechanic related) damage or % damage taken auras on target.
SPELL_ATTR4_TRIGGER_ACTIVATE = 0x00000200, // 9 initially disabled / trigger activate from event (Execute, Riposte, Deep Freeze end other)
SPELL_ATTR4_SPELL_VS_EXTEND_COST = 0x00000400, // 10 Rogue Shiv have this flag
+1 -1
View File
@@ -298,7 +298,7 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
{
// bonuses are already given, so just modify standing by rate
int32 spilloverRep = int32(standing * repTemplate->faction_rate[i]);
SetOneFactionReputation(sFactionStore.LookupEntry(repTemplate->faction[i]), spilloverRep, incremental);
SetOneFactionReputation(sFactionStore.AssertEntry(repTemplate->faction[i]), spilloverRep, incremental);
}
}
}
+2 -2
View File
@@ -576,8 +576,8 @@ m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharme
m_spellState = SPELL_STATE_NULL;
_triggeredCastFlags = triggerFlags;
if (info->AttributesEx4 & SPELL_ATTR4_TRIGGERED)
_triggeredCastFlags = TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_EQUIPPED_ITEM_REQUIREMENT);
if (info->AttributesEx4 & SPELL_ATTR4_CAN_CAST_WHILE_CASTING)
_triggeredCastFlags = TriggerCastFlags(uint32(_triggeredCastFlags) | TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_CAST_DIRECTLY);
m_CastItem = NULL;
m_castItemGUID.Clear();
+3 -1
View File
@@ -3037,6 +3037,8 @@ void SpellMgr::LoadSpellInfoCorrections()
switch (spellInfo->Id)
{
case 70743: // AoD Special
case 70614: // AoD Special - Vegard
case 42436: // Drink! (Brewfest)
spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_TARGET_ANY);
break;
@@ -3739,7 +3741,7 @@ void SpellMgr::LoadSpellInfoCorrections()
case 45440: // Steam Tonk Controller
case 60256: // Collect Sample
// Crashes client on pressing ESC
spellInfo->AttributesEx4 &= ~SPELL_ATTR4_TRIGGERED;
spellInfo->AttributesEx4 &= ~SPELL_ATTR4_CAN_CAST_WHILE_CASTING;
break;
case 96942: // Gaze of Occu'thar
case 101009: // Gaze of Occu'thar
+1 -1
View File
@@ -300,7 +300,7 @@ public:
else if (commentToken[1] == '/')
{
std::string str;
getline(ifs, str);
std::getline(ifs, str);
continue;
}
// regular data
@@ -29,6 +29,7 @@ EndContentData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "PassiveAI.h"
#include "Player.h"
/*######
@@ -48,14 +49,18 @@ class npc_webbed_creature : public CreatureScript
public:
npc_webbed_creature() : CreatureScript("npc_webbed_creature") { }
struct npc_webbed_creatureAI : public ScriptedAI
struct npc_webbed_creatureAI : public NullCreatureAI
{
npc_webbed_creatureAI(Creature* creature) : ScriptedAI(creature) { }
npc_webbed_creatureAI(Creature* creature) : NullCreatureAI(creature) { }
void Reset() override { }
void EnterCombat(Unit* /*who*/) override { }
void AttackStart(Unit* /*who*/) override { }
void MoveInLineOfSight(Unit* /*who*/) override { }
void JustDied(Unit* killer) override
{
uint32 spawnCreatureID = 0;
@@ -1259,7 +1259,7 @@ class spell_putricide_mutated_plague : public SpellScriptLoader
return;
uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
SpellInfo const* spell = sSpellMgr->GetSpellInfo(triggerSpell);
SpellInfo const* spell = sSpellMgr->EnsureSpellInfo(triggerSpell);
spell = sSpellMgr->GetSpellForDifficultyFromSpell(spell, caster);
int32 damage = spell->Effects[EFFECT_0].CalcValue(caster);
+7
View File
@@ -87,6 +87,13 @@ class DBCStorage
return (id >= nCount) ? NULL : indexTable.asT[id];
}
T const* AssertEntry(uint32 id) const
{
T const* entry = LookupEntry(id);
ASSERT(entry);
return entry;
}
uint32 GetNumRows() const { return nCount; }
char const* GetFormat() const { return fmt; }
uint32 GetFieldCount() const { return fieldCount; }
@@ -29,6 +29,8 @@
#include "QueryHolder.h"
#include "AdhocStatement.h"
#include <mysqld_error.h>
#define MIN_MYSQL_SERVER_VERSION 50100u
#define MIN_MYSQL_CLIENT_VERSION 50100u
@@ -368,7 +370,8 @@ class DatabaseWorkerPool
void DirectCommitTransaction(SQLTransaction& transaction)
{
T* con = GetFreeConnection();
if (con->ExecuteTransaction(transaction))
int errorCode = con->ExecuteTransaction(transaction);
if (!errorCode)
{
con->Unlock(); // OK, operation succesful
return;
@@ -376,12 +379,12 @@ class DatabaseWorkerPool
//! Handle MySQL Errno 1213 without extending deadlock to the core itself
/// @todo More elegant way
if (con->GetLastError() == 1213)
if (errorCode == ER_LOCK_DEADLOCK)
{
uint8 loopBreaker = 5;
for (uint8 i = 0; i < loopBreaker; ++i)
{
if (con->ExecuteTransaction(transaction))
if (!con->ExecuteTransaction(transaction))
break;
}
}
@@ -359,11 +359,11 @@ void MySQLConnection::CommitTransaction()
Execute("COMMIT");
}
bool MySQLConnection::ExecuteTransaction(SQLTransaction& transaction)
int MySQLConnection::ExecuteTransaction(SQLTransaction& transaction)
{
std::list<SQLElementData> const& queries = transaction->m_queries;
if (queries.empty())
return false;
return -1;
BeginTransaction();
@@ -380,8 +380,9 @@ bool MySQLConnection::ExecuteTransaction(SQLTransaction& transaction)
if (!Execute(stmt))
{
TC_LOG_WARN("sql.sql", "Transaction aborted. %u queries not executed.", (uint32)queries.size());
int errorCode = GetLastError();
RollbackTransaction();
return false;
return errorCode;
}
}
break;
@@ -392,8 +393,9 @@ bool MySQLConnection::ExecuteTransaction(SQLTransaction& transaction)
if (!Execute(sql))
{
TC_LOG_WARN("sql.sql", "Transaction aborted. %u queries not executed.", (uint32)queries.size());
int errorCode = GetLastError();
RollbackTransaction();
return false;
return errorCode;
}
}
break;
@@ -406,7 +408,7 @@ bool MySQLConnection::ExecuteTransaction(SQLTransaction& transaction)
// and not while iterating over every element.
CommitTransaction();
return true;
return 0;
}
MySQLPreparedStatement* MySQLConnection::GetPreparedStatement(uint32 index)
+1 -1
View File
@@ -86,7 +86,7 @@ class MySQLConnection
void BeginTransaction();
void RollbackTransaction();
void CommitTransaction();
bool ExecuteTransaction(SQLTransaction& transaction);
int ExecuteTransaction(SQLTransaction& transaction);
operator bool () const { return m_Mysql != NULL; }
void Ping() { mysql_ping(m_Mysql); }
+5 -3
View File
@@ -17,6 +17,7 @@
#include "DatabaseEnv.h"
#include "Transaction.h"
#include <mysqld_error.h>
//- Append a raw ad-hoc query to the transaction
void Transaction::Append(const char* sql)
@@ -74,14 +75,15 @@ void Transaction::Cleanup()
bool TransactionTask::Execute()
{
if (m_conn->ExecuteTransaction(m_trans))
int errorCode = m_conn->ExecuteTransaction(m_trans);
if (!errorCode)
return true;
if (m_conn->GetLastError() == 1213)
if (errorCode == ER_LOCK_DEADLOCK)
{
uint8 loopBreaker = 5; // Handle MySQL Errno 1213 without extending deadlock to the core itself
for (uint8 i = 0; i < loopBreaker; ++i)
if (m_conn->ExecuteTransaction(m_trans))
if (!m_conn->ExecuteTransaction(m_trans))
return true;
}
+6
View File
@@ -49,4 +49,10 @@ namespace Trinity
#define ASSERT WPAssert
template <typename T> inline T* ASSERT_NOTNULL(T* pointer)
{
ASSERT(pointer);
return pointer;
}
#endif
+39 -18
View File
@@ -2999,32 +2999,53 @@ AuctionHouseBot.Buyer.Horde.Enabled = 0
AuctionHouseBot.Buyer.Neutral.Enabled = 0
#
# AuctionHouseBot.BuyPrice.Buyer
# Description: Should the Buyer use BuyPrice or SellPrice to determine Bid Prices
# Default: 1 - (use BuyPrice)
# 0 - (use SellPrice)
# AuctionHouseBot.Buyer.Baseprice.QUALITY
# Description: Base sellprices in copper for non priced items for each quality.
# The default values are based on average item prices of each quality.
# Defaults: Gray 3504
# White 5429
# Green 21752
# Blue 36463
# Purple 87124
# Orange 214347
# Yellow 407406
AuctionHouseBot.Buyer.Buyprice = 1
AuctionHouseBot.Buyer.Baseprice.Gray = 3504
AuctionHouseBot.Buyer.Baseprice.White = 5429
AuctionHouseBot.Buyer.Baseprice.Green = 21752
AuctionHouseBot.Buyer.Baseprice.Blue = 36463
AuctionHouseBot.Buyer.Baseprice.Purple = 87124
AuctionHouseBot.Buyer.Baseprice.Orange = 214347
AuctionHouseBot.Buyer.Baseprice.Yellow = 407406
#
# AuctionHouseBot.Buyer.ChanceMultiplier.QUALITY
# Description: Multipliers for the buy/bid chances for each quality. 100 means the chance is 100% of the original,
# 1 would mean 1 % of the original and 200 would mean 200% of the original chance.
# Defaults: Gray 100
# White 100
# Green 100
# Blue 100
# Purple 100
# Orange 100
# Yellow 100
AuctionHouseBot.Buyer.ChanceMultiplier.Gray = 100
AuctionHouseBot.Buyer.ChanceMultiplier.White = 100
AuctionHouseBot.Buyer.ChanceMultiplier.Green = 100
AuctionHouseBot.Buyer.ChanceMultiplier.Blue = 100
AuctionHouseBot.Buyer.ChanceMultiplier.Purple = 100
AuctionHouseBot.Buyer.ChanceMultiplier.Orange = 100
AuctionHouseBot.Buyer.ChanceMultiplier.Yellow = 100
#
# AuctionHouseBot.Buyer.Recheck.Interval
# Description: This specifies the time interval (in minutes) between two evaluations of the same selled item.
# The lesser this value is, the more chances you give for item to be bought by ahbot.
# Description: This specifies the time interval (in minutes) between two evaluations of the same sold item.
# The smaller this value is, the more chances you give for an item to be bought by ahbot.
# Default: 20 (20min.)
AuctionHouseBot.Buyer.Recheck.Interval = 20
#
# AuctionHouseBot.Buyer.Alliance.Chance.Ratio
# Description: Chance ratio for the buyer to buy an item. Higher the value, lesser the probability
# Example: 3 (1 out of 3 change, that is, 33%).
# Default: 3
#
AuctionHouseBot.Buyer.Alliance.Chance.Ratio = 3
AuctionHouseBot.Buyer.Horde.Chance.Ratio = 3
AuctionHouseBot.Buyer.Neutral.Chance.Ratio = 3
#
###################################################################################################