diff --git a/conf/mod_ahbot.conf.dist b/conf/mod_ahbot.conf.dist index 26d8fdf..701a890 100644 --- a/conf/mod_ahbot.conf.dist +++ b/conf/mod_ahbot.conf.dist @@ -50,217 +50,3 @@ AuctionHouseBot.UseBuyPriceForBuyer = 0 AuctionHouseBot.Account = 0 AuctionHouseBot.GUID = 0 AuctionHouseBot.ItemsPerCycle = 200 - -############################################################################### -# AUCTION HOUSE BOT FILTERS PART 1 -# -# AuctionHouseBot.VendorItems -# Include items that can be bought from vendors. -# Default 0 (False) -# -# AuctionHouseBot.VendorTradeGoods -# Include Trade Goods that can be bought from vendors. -# Default 0 (False) -# -# AuctionHouseBot.LootItems -# Include items that can be looted or fished for. -# Default 1 (True) -# -# AuctionHouseBot.LootTradeGoods -# Include Trade Goods that can be looted or fished for. -# Default 1 (True) -# -# AuctionHouseBot.OtherItems -# Include misc. items. -# Default 0 (False) -# -# AuctionHouseBot.OtherTradeGoods -# Include misc. Trade Goods. -# Default 0 (False) -# -# AuctionHouseBot.Bonding_types -# Indicates which bonding types to allow seller to put up for auction -# No_Bind -# Default 1 (True) -# Bind_When_Picked_Up -# Default 0 (False) -# Bind_When_Equipped -# Default 1 (True) -# Bind_When_Use -# Default 1 (True) -# Bind_Quest_Item -# Default 0 (False) -# -# AuctionHouseBot.DisablePermEnchant -# Disable Items with a Permanent Enchantment -# Default 0 (False) -# -# AuctionHouseBot.DisableConjured -# Disable Conjured Items -# Default 0 (False) -# -# AuctionHouseBot.DisableGems -# Disable Gems -# Default 0 (False) -# -# AuctionHouseBot.DisableMoney -# Disable Items that are used as money -# Default 0 (False) -# -# AuctionHouseBot.DisableMoneyLoot -# Disable Items that have Money as a loot -# Default 0 (False) -# -# AuctionHouseBot.DisableLootable -# Disable Items that have other items as loot -# Default 0 (False) -# -# AuctionHouseBot.DisableKeys -# Disable Items that are keys -# Default 0 (False) -# -# AuctionHouseBot.DisableDuration -# Disable Items with a duration -# Default 0 (False) -# -# AuctionHouseBot.DisableBOP_Or_Quest_NoReqLevel -# Disable items that are BOP or Quest Item -# with a Required level that is less than the Item Level -# (This prevents a level 10 with a level 60 weapon or armor) -# (May need further refinement) -# Default 0 (False) -# -############################################################################### - -AuctionHouseBot.VendorItems = 0 -AuctionHouseBot.VendorTradeGoods = 0 -AuctionHouseBot.LootItems = 1 -AuctionHouseBot.LootTradeGoods = 1 -AuctionHouseBot.OtherItems = 0 -AuctionHouseBot.OtherTradeGoods = 0 -AuctionHouseBot.No_Bind = 1 -AuctionHouseBot.Bind_When_Picked_Up = 0 -AuctionHouseBot.Bind_When_Equipped = 1 -AuctionHouseBot.Bind_When_Use = 1 -AuctionHouseBot.Bind_Quest_Item = 0 -AuctionHouseBot.DisablePermEnchant = 0 -AuctionHouseBot.DisableConjured = 0 -AuctionHouseBot.DisableGems = 0 -AuctionHouseBot.DisableMoney = 0 -AuctionHouseBot.DisableMoneyLoot = 0 -AuctionHouseBot.DisableLootable = 0 -AuctionHouseBot.DisableKeys = 0 -AuctionHouseBot.DisableDuration = 0 -AuctionHouseBot.DisableBOP_Or_Quest_NoReqLevel = 0 - -############################################################################### -# AUCTION HOUSE BOT FILTERS PART 2 -# -# These Filters are boolean (0 or 1) and will disable items that are -# specifically meant for the Class named. -# (UnusedClass is Class 10, which was skipped for some reason) -# Default 0 (allowed) -# -############################################################################### - -AuctionHouseBot.DisableWarriorItems = 0 -AuctionHouseBot.DisablePaladinItems = 0 -AuctionHouseBot.DisableHunterItems = 0 -AuctionHouseBot.DisableRogueItems = 0 -AuctionHouseBot.DisablePriestItems = 0 -AuctionHouseBot.DisableDKItems = 0 -AuctionHouseBot.DisableShamanItems = 0 -AuctionHouseBot.DisableMageItems = 0 -AuctionHouseBot.DisableWarlockItems = 0 -AuctionHouseBot.DisableUnusedClassItems = 0 -AuctionHouseBot.DisableDruidItems = 0 - -############################################################################### -# AUCTION HOUSE BOT FILTERS PART 3 -# -# AuctionHouseBot.DisabledItems -# Prevent Seller from listing specific item(s) -# (not used anymore, see table "mod_auctionhousebot_disabled_items") -# -# AuctionHouseBot.DisableItemsBelowLevel -# Prevent Seller from listing Items below this Level -# Default 0 (Off) -# -# AuctionHouseBot.DisableItemsAboveLevel -# Prevent Seller from listing Items above this Level -# Default 0 (Off) -# -# AuctionHouseBot.DisableTGsBelowLevel -# Prevent Seller from listing Trade Goods below this Level -# Default 0 (Off) -# -# AuctionHouseBot.DisableTGsAboveLevel -# Prevent Seller from listing Trade Goods above this Level -# Default 0 (Off) -# -# AuctionHouseBot.DisableItemsBelowGUID -# Prevent Seller from listing Items below this GUID -# Default 0 (Off) -# -# AuctionHouseBot.DisableItemsAboveGUID -# Prevent Seller from listing Items above this GUID -# Default 0 (Off) -# -# AuctionHouseBot.DisableTGsBelowGUID -# Prevent Seller from listing Trade Goods below this GUID -# Default 0 (Off) -# -# AuctionHouseBot.DisableTGsAboveGUID -# Prevent Seller from listing Trade Goods above this GUID -# Default 0 (Off) -# -# AuctionHouseBot.DisableItemsBelowReqLevel -# Prevent Seller from listing Items below this Required Level -# Default 0 (Off) -# -# AuctionHouseBot.DisableItemsAboveReqLevel -# Prevent Seller from listing Items above this Required Level -# Default 0 (Off) -# -# AuctionHouseBot.DisableTGsBelowReqLevel -# Prevent Seller from listing Trade Goods below this Required Level -# Default 0 (Off) -# -# AuctionHouseBot.DisableTGsAboveReqLevel -# Prevent Seller from listing Trade Goods above this Required Level -# Default 0 (Off) -# -# AuctionHouseBot.DisableItemsBelowReqSkillRank -# Prevent Seller from listing Items below this Required Skill Rank -# Default 0 (Off) -# -# AuctionHouseBot.DisableItemsAboveReqSkillRank -# Prevent Seller from listing Items above this Required Skill Rank -# Default 0 (Off) -# -# AuctionHouseBot.DisableTGsBelowReqSkillRank -# Prevent Seller from listing Trade Goods below this Required Skill Rank -# Default 0 (Off) -# -# AuctionHouseBot.DisableTGsAboveReqSkillRank -# Prevent Seller from listing Trade Goods above this Required Skill Rank -# Default 0 (Off) -# -############################################################################### - -AuctionHouseBot.DisableItemsBelowLevel = 0 -AuctionHouseBot.DisableItemsAboveLevel = 0 -AuctionHouseBot.DisableTGsBelowLevel = 0 -AuctionHouseBot.DisableTGsAboveLevel = 0 -AuctionHouseBot.DisableItemsBelowGUID = 0 -AuctionHouseBot.DisableItemsAboveGUID = 0 -AuctionHouseBot.DisableTGsBelowGUID = 0 -AuctionHouseBot.DisableTGsAboveGUID = 0 -AuctionHouseBot.DisableItemsBelowReqLevel = 0 -AuctionHouseBot.DisableItemsAboveReqLevel = 0 -AuctionHouseBot.DisableTGsBelowReqLevel = 0 -AuctionHouseBot.DisableTGsAboveReqLevel = 0 -AuctionHouseBot.DisableItemsBelowReqSkillRank = 0 -AuctionHouseBot.DisableItemsAboveReqSkillRank = 0 -AuctionHouseBot.DisableTGsBelowReqSkillRank = 0 -AuctionHouseBot.DisableTGsAboveReqSkillRank = 0 diff --git a/data/sql/db-world/base/mod_auctionhousebot.sql b/data/sql/db-world/base/mod_auctionhousebot.sql index 12aaa00..c01efaf 100644 --- a/data/sql/db-world/base/mod_auctionhousebot.sql +++ b/data/sql/db-world/base/mod_auctionhousebot.sql @@ -4,20 +4,6 @@ CREATE TABLE `mod_auctionhousebot` ( `name` char(25) DEFAULT NULL COMMENT 'Text name of the auctionhouse.', `minitems` int(11) DEFAULT '0' COMMENT 'This is the minimum number of items you want to keep in the auction house. a 0 here will make it the same as the maximum.', `maxitems` int(11) DEFAULT '0' COMMENT 'This is the number of items you want to keep in the auction house.', - `percentgreytradegoods` int(11) DEFAULT '0' COMMENT 'Sets the percentage of the Grey Trade Goods auction items', - `percentwhitetradegoods` int(11) DEFAULT '27' COMMENT 'Sets the percentage of the White Trade Goods auction items', - `percentgreentradegoods` int(11) DEFAULT '12' COMMENT 'Sets the percentage of the Green Trade Goods auction items', - `percentbluetradegoods` int(11) DEFAULT '10' COMMENT 'Sets the percentage of the Blue Trade Goods auction items', - `percentpurpletradegoods` int(11) DEFAULT '1' COMMENT 'Sets the percentage of the Purple Trade Goods auction items', - `percentorangetradegoods` int(11) DEFAULT '0' COMMENT 'Sets the percentage of the Orange Trade Goods auction items', - `percentyellowtradegoods` int(11) DEFAULT '0' COMMENT 'Sets the percentage of the Yellow Trade Goods auction items', - `percentgreyitems` int(11) DEFAULT '0' COMMENT 'Sets the percentage of the non trade Grey auction items', - `percentwhiteitems` int(11) DEFAULT '10' COMMENT 'Sets the percentage of the non trade White auction items', - `percentgreenitems` int(11) DEFAULT '30' COMMENT 'Sets the percentage of the non trade Green auction items', - `percentblueitems` int(11) DEFAULT '8' COMMENT 'Sets the percentage of the non trade Blue auction items', - `percentpurpleitems` int(11) DEFAULT '2' COMMENT 'Sets the percentage of the non trade Purple auction items', - `percentorangeitems` int(11) DEFAULT '0' COMMENT 'Sets the percentage of the non trade Orange auction items', - `percentyellowitems` int(11) DEFAULT '0' COMMENT 'Sets the percentage of the non trade Yellow auction items', `minpricegrey` int(11) DEFAULT '100' COMMENT 'Minimum price of Grey items (percentage).', `maxpricegrey` int(11) DEFAULT '150' COMMENT 'Maximum price of Grey items (percentage).', `minpricewhite` int(11) DEFAULT '150' COMMENT 'Minimum price of White items (percentage).', @@ -72,11 +58,11 @@ CREATE TABLE `mod_auctionhousebot_disabled_items` ( ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- AHBot auctionhouse configuration -INSERT INTO `mod_auctionhousebot` (`auctionhouse`, `name`, `minitems`, `maxitems`, `percentgreytradegoods`, `percentwhitetradegoods`, `percentgreentradegoods`, `percentbluetradegoods`, `percentpurpletradegoods`, `percentorangetradegoods`, `percentyellowtradegoods`, `percentgreyitems`, `percentwhiteitems`, `percentgreenitems`, `percentblueitems`, `percentpurpleitems`, `percentorangeitems`, `percentyellowitems`, `minpricegrey`, `maxpricegrey`, `minpricewhite`, `maxpricewhite`, `minpricegreen`, `maxpricegreen`, `minpriceblue`, `maxpriceblue`, `minpricepurple`, `maxpricepurple`, `minpriceorange`, `maxpriceorange`, `minpriceyellow`, `maxpriceyellow`, `minbidpricegrey`, `maxbidpricegrey`, `minbidpricewhite`, `maxbidpricewhite`, `minbidpricegreen`, `maxbidpricegreen`, `minbidpriceblue`, `maxbidpriceblue`, `minbidpricepurple`, `maxbidpricepurple`, `minbidpriceorange`, `maxbidpriceorange`, `minbidpriceyellow`, `maxbidpriceyellow`, `maxstackgrey`, `maxstackwhite`, `maxstackgreen`, `maxstackblue`, `maxstackpurple`, `maxstackorange`, `maxstackyellow`, `buyerpricegrey`, `buyerpricewhite`, `buyerpricegreen`, `buyerpriceblue`, `buyerpricepurple`, `buyerpriceorange`, `buyerpriceyellow`, `buyerbiddinginterval`, `buyerbidsperinterval`) +INSERT INTO `mod_auctionhousebot` (`auctionhouse`, `name`, `minitems`, `maxitems`, `minpricegrey`, `maxpricegrey`, `minpricewhite`, `maxpricewhite`, `minpricegreen`, `maxpricegreen`, `minpriceblue`, `maxpriceblue`, `minpricepurple`, `maxpricepurple`, `minpriceorange`, `maxpriceorange`, `minpriceyellow`, `maxpriceyellow`, `minbidpricegrey`, `maxbidpricegrey`, `minbidpricewhite`, `maxbidpricewhite`, `minbidpricegreen`, `maxbidpricegreen`, `minbidpriceblue`, `maxbidpriceblue`, `minbidpricepurple`, `maxbidpricepurple`, `minbidpriceorange`, `maxbidpriceorange`, `minbidpriceyellow`, `maxbidpriceyellow`, `maxstackgrey`, `maxstackwhite`, `maxstackgreen`, `maxstackblue`, `maxstackpurple`, `maxstackorange`, `maxstackyellow`, `buyerpricegrey`, `buyerpricewhite`, `buyerpricegreen`, `buyerpriceblue`, `buyerpricepurple`, `buyerpriceorange`, `buyerpriceyellow`, `buyerbiddinginterval`, `buyerbidsperinterval`) VALUES -(2,'Alliance',250,250,0,27,12,10,1,0,0,0,10,30,8,2,0,0,100,150,150,250,800,1400,1250,1750,2250,4550,3250,5550,5250,6550,70,100,70,100,80,100,75,100,80,100,80,100,80,100,0,0,3,2,1,1,1,1,3,5,12,15,20,22,1,1), -(6,'Horde',250,250,0,27,12,10,1,0,0,0,10,30,8,2,0,0,100,150,150,250,800,1400,1250,1750,2250,4550,3250,5550,5250,6550,70,100,70,100,80,100,75,100,80,100,80,100,80,100,0,0,3,2,1,1,1,1,3,5,12,15,20,22,1,1), -(7,'Neutral',250,250,0,27,12,10,1,0,0,0,10,30,8,2,0,0,100,150,150,250,800,1400,1250,1750,2250,4550,3250,5550,5250,6550,70,100,70,100,80,100,75,100,80,100,80,100,80,100,0,0,3,2,1,1,1,1,3,5,12,15,20,22,1,1); +(2,'Alliance',10000,10000,100,150,150,250,800,1400,1250,1750,2250,4550,3250,5550,5250,6550,70,100,70,100,80,100,75,100,80,100,80,100,80,100,0,0,3,2,1,1,1,1,3,5,12,15,20,22,1,1), +(6,'Horde',10000,10000,100,150,150,250,800,1400,1250,1750,2250,4550,3250,5550,5250,6550,70,100,70,100,80,100,75,100,80,100,80,100,80,100,0,0,3,2,1,1,1,1,3,5,12,15,20,22,1,1), +(7,'Neutral',10000,10000,100,150,150,250,800,1400,1250,1750,2250,4550,3250,5550,5250,6550,70,100,70,100,80,100,75,100,80,100,80,100,80,100,0,0,3,2,1,1,1,1,3,5,12,15,20,22,1,1); -- Items unavailable to players INSERT INTO `mod_auctionhousebot_disabled_items` diff --git a/data/sql/db-world/updates/mod_auctionhousebot_20231113_01.sql b/data/sql/db-world/updates/mod_auctionhousebot_20231113_01.sql new file mode 100644 index 0000000..0506c7a --- /dev/null +++ b/data/sql/db-world/updates/mod_auctionhousebot_20231113_01.sql @@ -0,0 +1 @@ +UPDATE mod_auctionhousebot SET minitems = 20000, maxitems = 20000 WHERE auctionhouse < 10; \ No newline at end of file diff --git a/src/AuctionHouseBot.cpp b/src/AuctionHouseBot.cpp index 8ce56cb..b50f396 100644 --- a/src/AuctionHouseBot.cpp +++ b/src/AuctionHouseBot.cpp @@ -28,22 +28,7 @@ #include using namespace std; -vector npcItems; -vector lootItems; -vector greyTradeGoodsBin; -vector whiteTradeGoodsBin; -vector greenTradeGoodsBin; -vector blueTradeGoodsBin; -vector purpleTradeGoodsBin; -vector orangeTradeGoodsBin; -vector yellowTradeGoodsBin; -vector greyItemsBin; -vector whiteItemsBin; -vector greenItemsBin; -vector blueItemsBin; -vector purpleItemsBin; -vector orangeItemsBin; -vector yellowItemsBin; +vector itemCandidates; AuctionHouseBot::AuctionHouseBot() { @@ -52,62 +37,6 @@ AuctionHouseBot::AuctionHouseBot() AHBSeller = false; AHBBuyer = false; - //Begin Filters - - Vendor_Items = false; - Loot_Items = false; - Other_Items = false; - Vendor_TGs = false; - Loot_TGs = false; - Other_TGs = false; - - No_Bind = false; - Bind_When_Picked_Up = false; - Bind_When_Equipped = false; - Bind_When_Use = false; - Bind_Quest_Item = false; - - DisablePermEnchant = false; - DisableConjured = false; - DisableGems = false; - DisableMoney = false; - DisableMoneyLoot = false; - DisableLootable = false; - DisableKeys = false; - DisableDuration = false; - DisableBOP_Or_Quest_NoReqLevel = false; - - DisableWarriorItems = false; - DisablePaladinItems = false; - DisableHunterItems = false; - DisableRogueItems = false; - DisablePriestItems = false; - DisableDKItems = false; - DisableShamanItems = false; - DisableMageItems = false; - DisableWarlockItems = false; - DisableUnusedClassItems = false; - DisableDruidItems = false; - - DisableItemsBelowLevel = 0; - DisableItemsAboveLevel = 0; - DisableTGsBelowLevel = 0; - DisableTGsAboveLevel = 0; - DisableItemsBelowGUID = 0; - DisableItemsAboveGUID = 0; - DisableTGsBelowGUID = 0; - DisableTGsAboveGUID = 0; - DisableItemsBelowReqLevel = 0; - DisableItemsAboveReqLevel = 0; - DisableTGsBelowReqLevel = 0; - DisableTGsAboveReqLevel = 0; - DisableItemsBelowReqSkillRank = 0; - DisableItemsAboveReqSkillRank = 0; - DisableTGsBelowReqSkillRank = 0; - DisableTGsAboveReqSkillRank = 0; - - //End Filters - _lastrun_a = time(NULL); _lastrun_h = time(NULL); _lastrun_n = time(NULL); @@ -121,6 +50,40 @@ AuctionHouseBot::~AuctionHouseBot() { } +uint32 AuctionHouseBot::GetStackSizeForItem(ItemTemplate const* itemProto) const +{ + // Determine the stack ratio based on class type + if (itemProto == NULL) + return 1; + + // TODO: Move this to a config + uint32 stackRatio = 0; + switch (itemProto->Class) + { + case ITEM_CLASS_CONSUMABLE: stackRatio = 5; break; + case ITEM_CLASS_CONTAINER: stackRatio = 0; break; + case ITEM_CLASS_WEAPON: stackRatio = 0; break; + case ITEM_CLASS_GEM: stackRatio = 5; break; + case ITEM_CLASS_REAGENT: stackRatio = 50; break; + case ITEM_CLASS_ARMOR: stackRatio = 0; break; + case ITEM_CLASS_PROJECTILE: stackRatio = 100; break; + case ITEM_CLASS_TRADE_GOODS: stackRatio = 25; break; + case ITEM_CLASS_GENERIC: stackRatio = 100; break; + case ITEM_CLASS_RECIPE: stackRatio = 0; break; + case ITEM_CLASS_QUIVER: stackRatio = 0; break; + case ITEM_CLASS_QUEST: stackRatio = 10; break; + case ITEM_CLASS_KEY: stackRatio = 10; break; + case ITEM_CLASS_MISC: stackRatio = 100; break; + case ITEM_CLASS_GLYPH: stackRatio = 0; break; + default: stackRatio = 0; break; + } + + if (stackRatio > urand(0, 99)) + return urand(1, itemProto->GetMaxStackSize()); + else + return 1; +} + void AuctionHouseBot::addNewAuctions(Player *AHBplayer, AHBConfig *config) { if (!AHBSeller) @@ -179,41 +142,6 @@ void AuctionHouseBot::addNewAuctions(Player *AHBplayer, AHBConfig *config) if (debug_Out) LOG_ERROR("module", "AHSeller: Current house id is {}", config->GetAHID()); - uint32 greyTGcount = config->GetPercents(AHB_GREY_TG); - uint32 whiteTGcount = config->GetPercents(AHB_WHITE_TG); - uint32 greenTGcount = config->GetPercents(AHB_GREEN_TG); - uint32 blueTGcount = config->GetPercents(AHB_BLUE_TG); - uint32 purpleTGcount = config->GetPercents(AHB_PURPLE_TG); - uint32 orangeTGcount = config->GetPercents(AHB_ORANGE_TG); - uint32 yellowTGcount = config->GetPercents(AHB_YELLOW_TG); - uint32 greyIcount = config->GetPercents(AHB_GREY_I); - uint32 whiteIcount = config->GetPercents(AHB_WHITE_I); - uint32 greenIcount = config->GetPercents(AHB_GREEN_I); - uint32 blueIcount = config->GetPercents(AHB_BLUE_I); - uint32 purpleIcount = config->GetPercents(AHB_PURPLE_I); - uint32 orangeIcount = config->GetPercents(AHB_ORANGE_I); - uint32 yellowIcount = config->GetPercents(AHB_YELLOW_I); -/* uint32 total = greyTGcount + whiteTGcount + greenTGcount + blueTGcount - + purpleTGcount + orangeTGcount + yellowTGcount - + whiteIcount + greenIcount + blueIcount + purpleIcount - + orangeIcount + yellowIcount; -*/ - uint32 greyTGoods = config->GetItemCounts(AHB_GREY_TG); - uint32 whiteTGoods = config->GetItemCounts(AHB_WHITE_TG); - uint32 greenTGoods = config->GetItemCounts(AHB_GREEN_TG); - uint32 blueTGoods = config->GetItemCounts(AHB_BLUE_TG); - uint32 purpleTGoods = config->GetItemCounts(AHB_PURPLE_TG); - uint32 orangeTGoods = config->GetItemCounts(AHB_ORANGE_TG); - uint32 yellowTGoods = config->GetItemCounts(AHB_YELLOW_TG); - - uint32 greyItems = config->GetItemCounts(AHB_GREY_I); - uint32 whiteItems = config->GetItemCounts(AHB_WHITE_I); - uint32 greenItems = config->GetItemCounts(AHB_GREEN_I); - uint32 blueItems = config->GetItemCounts(AHB_BLUE_I); - uint32 purpleItems = config->GetItemCounts(AHB_PURPLE_I); - uint32 orangeItems = config->GetItemCounts(AHB_ORANGE_I); - uint32 yellowItems = config->GetItemCounts(AHB_YELLOW_I); - if (debug_Out) LOG_ERROR("module", "AHSeller: {} items", items); @@ -223,270 +151,116 @@ void AuctionHouseBot::addNewAuctions(Player *AHBplayer, AHBConfig *config) if (debug_Out) LOG_ERROR("module", "AHSeller: {} count", cnt); - uint32 itemID = 0; - uint32 itemColor = 99; - uint32 loopbreaker = 0; - while (itemID == 0 && loopbreaker <= 50) + // Pull a random item out of the candidate list + uint32 itemID = itemCandidates[urand(0, itemCandidates.size() - 1)]; + + // Prevent invalid IDs + if (itemID == 0) { - ++loopbreaker; - uint32 choice = urand(0, 13); - itemColor = choice; - switch (choice) - { - case 0: - { - if ((greyItemsBin.size() > 0) && (greyItems < greyIcount)) - itemID = greyItemsBin[urand(0, greyItemsBin.size() - 1)]; - else continue; - break; - } - case 1: - { - if ((whiteItemsBin.size() > 0) && (whiteItems < whiteIcount)) - itemID = whiteItemsBin[urand(0, whiteItemsBin.size() - 1)]; - else continue; - break; - } - case 2: - { - if ((greenItemsBin.size() > 0) && (greenItems < greenIcount)) - itemID = greenItemsBin[urand(0, greenItemsBin.size() - 1)]; - else continue; - break; - } - case 3: - { - if ((blueItemsBin.size() > 0) && (blueItems < blueIcount)) - itemID = blueItemsBin[urand(0, blueItemsBin.size() - 1)]; - else continue; - break; - } - case 4: - { - if ((purpleItemsBin.size() > 0) && (purpleItems < purpleIcount)) - itemID = purpleItemsBin[urand(0, purpleItemsBin.size() - 1)]; - else continue; - break; - } - case 5: - { - if ((orangeItemsBin.size() > 0) && (orangeItems < orangeIcount)) - itemID = orangeItemsBin[urand(0, orangeItemsBin.size() - 1)]; - else continue; - break; - } - case 6: - { - if ((yellowItemsBin.size() > 0) && (yellowItems < yellowIcount)) - itemID = yellowItemsBin[urand(0, yellowItemsBin.size() - 1)]; - else continue; - break; - } - case 7: - { - if ((greyTradeGoodsBin.size() > 0) && (greyTGoods < greyTGcount)) - itemID = greyTradeGoodsBin[urand(0, greyTradeGoodsBin.size() - 1)]; - else continue; - break; - } - case 8: - { - if ((whiteTradeGoodsBin.size() > 0) && (whiteTGoods < whiteTGcount)) - itemID = whiteTradeGoodsBin[urand(0, whiteTradeGoodsBin.size() - 1)]; - else continue; - break; - } - case 9: - { - if ((greenTradeGoodsBin.size() > 0) && (greenTGoods < greenTGcount)) - itemID = greenTradeGoodsBin[urand(0, greenTradeGoodsBin.size() - 1)]; - else continue; - break; - } - case 10: - { - if ((blueTradeGoodsBin.size() > 0) && (blueTGoods < blueTGcount)) - itemID = blueTradeGoodsBin[urand(0, blueTradeGoodsBin.size() - 1)]; - else continue; - break; - } - case 11: - { - if ((purpleTradeGoodsBin.size() > 0) && (purpleTGoods < purpleTGcount)) - itemID = purpleTradeGoodsBin[urand(0, purpleTradeGoodsBin.size() - 1)]; - else continue; - break; - } - case 12: - { - if ((orangeTradeGoodsBin.size() > 0) && (orangeTGoods < orangeTGcount)) - itemID = orangeTradeGoodsBin[urand(0, orangeTradeGoodsBin.size() - 1)]; - else continue; - break; - } - case 13: - { - if ((yellowTradeGoodsBin.size() > 0) && (yellowTGoods < yellowTGcount)) - itemID = yellowTradeGoodsBin[urand(0, yellowTradeGoodsBin.size() - 1)]; - else continue; - break; - } - default: - { - if (debug_Out) - LOG_ERROR("module", "AHSeller: itemID Switch - Default Reached"); - break; - } - } - - if (itemID == 0) - { - if (debug_Out) - LOG_ERROR("module", "AHSeller: Item::CreateItem() - ItemID is 0"); - continue; - } - - ItemTemplate const* prototype = sObjectMgr->GetItemTemplate(itemID); - if (prototype == NULL) - { - if (debug_Out) - LOG_ERROR("module", "AHSeller: Huh?!?! prototype == NULL"); - continue; - } - - Item* item = Item::CreateItem(itemID, 1, AHBplayer); - if (item == NULL) - { - if (debug_Out) - LOG_ERROR("module", "AHSeller: Item::CreateItem() returned NULL"); - break; - } - item->AddToUpdateQueueOf(AHBplayer); - - uint32 randomPropertyId = Item::GenerateItemRandomPropertyId(itemID); - if (randomPropertyId != 0) - item->SetItemRandomProperties(randomPropertyId); - - uint64 buyoutPrice = 0; - uint64 bidPrice = 0; - uint32 stackCount = 1; - - if (SellMethod) - buyoutPrice = prototype->BuyPrice; - else - buyoutPrice = prototype->SellPrice; - - if (prototype->Quality <= AHB_MAX_QUALITY) - { - if (config->GetMaxStack(prototype->Quality) > 1 && item->GetMaxStackCount() > 1) - stackCount = urand(1, minValue(item->GetMaxStackCount(), config->GetMaxStack(prototype->Quality))); - else if (config->GetMaxStack(prototype->Quality) == 0 && item->GetMaxStackCount() > 1) - stackCount = urand(1, item->GetMaxStackCount()); - else - stackCount = 1; - buyoutPrice *= urand(config->GetMinPrice(prototype->Quality), config->GetMaxPrice(prototype->Quality)); - buyoutPrice /= 100; - bidPrice = buyoutPrice * urand(config->GetMinBidPrice(prototype->Quality), config->GetMaxBidPrice(prototype->Quality)); - bidPrice /= 100; - } - else - { - // quality is something it shouldn't be, let's get out of here - if (debug_Out) - LOG_ERROR("module", "AHBuyer: Quality {} not Supported", prototype->Quality); - item->RemoveFromUpdateQueueOf(AHBplayer); - continue; - } - - uint32 etime = urand(1,3); - switch(etime) - { - case 1: - etime = 43200; - break; - case 2: - etime = 86400; - break; - case 3: - etime = 172800; - break; - default: - etime = 86400; - break; - } - item->SetCount(stackCount); - - uint32 dep = sAuctionMgr->GetAuctionDeposit(ahEntry, etime, item, stackCount); - - auto trans = CharacterDatabase.BeginTransaction(); - AuctionEntry* auctionEntry = new AuctionEntry(); - auctionEntry->Id = sObjectMgr->GenerateAuctionID(); - auctionEntry->houseId = config->GetAHID(); - auctionEntry->item_guid = item->GetGUID(); - auctionEntry->item_template = item->GetEntry(); - auctionEntry->itemCount = item->GetCount(); - auctionEntry->owner = AHBplayer->GetGUID(); - auctionEntry->startbid = bidPrice * stackCount; - auctionEntry->buyout = buyoutPrice * stackCount; - auctionEntry->bid = 0; - auctionEntry->deposit = dep; - auctionEntry->expire_time = (time_t) etime + time(NULL); - auctionEntry->auctionHouseEntry = ahEntry; - item->SaveToDB(trans); - item->RemoveFromUpdateQueueOf(AHBplayer); - sAuctionMgr->AddAItem(item); - auctionHouse->AddAuction(auctionEntry); - auctionEntry->SaveToDB(trans); - CharacterDatabase.CommitTransaction(trans); - - switch(itemColor) - { - case 0: - ++greyItems; - break; - case 1: - ++whiteItems; - break; - case 2: - ++greenItems; - break; - case 3: - ++blueItems; - break; - case 4: - ++purpleItems; - break; - case 5: - ++orangeItems; - break; - case 6: - ++yellowItems; - break; - case 7: - ++greyTGoods; - break; - case 8: - ++whiteTGoods; - break; - case 9: - ++greenTGoods; - break; - case 10: - ++blueTGoods; - break; - case 11: - ++purpleTGoods; - break; - case 12: - ++orangeTGoods; - break; - case 13: - ++yellowTGoods; - break; - default: - break; - } + if (debug_Out) + LOG_ERROR("module", "AHSeller: Item::CreateItem() - ItemID is 0"); + continue; } + + ItemTemplate const* prototype = sObjectMgr->GetItemTemplate(itemID); + if (prototype == NULL) + { + if (debug_Out) + LOG_ERROR("module", "AHSeller: prototype == NULL"); + continue; + } + + Item* item = Item::CreateItem(itemID, 1, AHBplayer); + if (item == NULL) + { + if (debug_Out) + LOG_ERROR("module", "AHSeller: Item::CreateItem() returned NULL"); + break; + } + item->AddToUpdateQueueOf(AHBplayer); + + uint32 randomPropertyId = Item::GenerateItemRandomPropertyId(itemID); + if (randomPropertyId != 0) + item->SetItemRandomProperties(randomPropertyId); + + uint64 buyoutPrice = 0; + uint64 bidPrice = 0; + + if (SellMethod) + buyoutPrice = prototype->BuyPrice; + else + buyoutPrice = prototype->SellPrice; + + // Set a minimum buyoutPrice to 1 silver + if (buyoutPrice < 100) + { + // TODO: Move this to a config value + buyoutPrice = 100; + } + + // Set the price + if (prototype->Quality <= AHB_MAX_QUALITY) + { + buyoutPrice *= urand(config->GetMinPrice(prototype->Quality), config->GetMaxPrice(prototype->Quality)); + buyoutPrice /= 100; + bidPrice = buyoutPrice * urand(config->GetMinBidPrice(prototype->Quality), config->GetMaxBidPrice(prototype->Quality)); + bidPrice /= 100; + } + else + { + // quality is something it shouldn't be, let's get out of here + if (debug_Out) + LOG_ERROR("module", "AHBuyer: Quality {} not Supported", prototype->Quality); + item->RemoveFromUpdateQueueOf(AHBplayer); + continue; + } + + // Define a duration + uint32 etime = urand(1,3); + switch(etime) + { + case 1: + etime = 43200; + break; + case 2: + etime = 86400; + break; + case 3: + etime = 172800; + break; + default: + etime = 86400; + break; + } + + // Set stack size + uint32 stackCount = GetStackSizeForItem(prototype); + item->SetCount(stackCount); + + uint32 dep = sAuctionMgr->GetAuctionDeposit(ahEntry, etime, item, stackCount); + + auto trans = CharacterDatabase.BeginTransaction(); + AuctionEntry* auctionEntry = new AuctionEntry(); + auctionEntry->Id = sObjectMgr->GenerateAuctionID(); + auctionEntry->houseId = config->GetAHID(); + auctionEntry->item_guid = item->GetGUID(); + auctionEntry->item_template = item->GetEntry(); + auctionEntry->itemCount = item->GetCount(); + auctionEntry->owner = AHBplayer->GetGUID(); + auctionEntry->startbid = bidPrice * stackCount; + auctionEntry->buyout = buyoutPrice * stackCount; + auctionEntry->bid = 0; + auctionEntry->deposit = dep; + auctionEntry->expire_time = (time_t) etime + time(NULL); + auctionEntry->auctionHouseEntry = ahEntry; + item->SaveToDB(trans); + item->RemoveFromUpdateQueueOf(AHBplayer); + sAuctionMgr->AddAItem(item); + auctionHouse->AddAuction(auctionEntry); + auctionEntry->SaveToDB(trans); + CharacterDatabase.CommitTransaction(trans); + + } } void AuctionHouseBot::addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, WorldSession *session) @@ -784,190 +558,19 @@ void AuctionHouseBot::Initialize() if (AHBSeller) { - QueryResult results = QueryResult(NULL); - char npcQuery[] = "SELECT distinct item FROM npc_vendor"; - results = WorldDatabase.Query(npcQuery); - if (results) - { - do - { - Field* fields = results->Fetch(); - npcItems.push_back(fields[0].Get()); - - } while (results->NextRow()); - } - else - { - if (debug_Out) - LOG_ERROR("module", "AuctionHouseBot: \"{}\" failed", npcQuery); - } - - char lootQuery[] = "SELECT item FROM creature_loot_template UNION " - "SELECT item FROM reference_loot_template UNION " - "SELECT item FROM disenchant_loot_template UNION " - "SELECT item FROM fishing_loot_template UNION " - "SELECT item FROM gameobject_loot_template UNION " - "SELECT item FROM item_loot_template UNION " - "SELECT item FROM milling_loot_template UNION " - "SELECT item FROM pickpocketing_loot_template UNION " - "SELECT item FROM prospecting_loot_template UNION " - "SELECT item FROM skinning_loot_template"; - - results = WorldDatabase.Query(lootQuery); - if (results) - { - do - { - Field* fields = results->Fetch(); - lootItems.push_back(fields[0].Get()); - - } while (results->NextRow()); - } - else - { - if (debug_Out) - LOG_ERROR("module", "AuctionHouseBot: \"{}\" failed", lootQuery); - } - + // Build a list of items that can be pulled from for auction ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore(); for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr) { - switch (itr->second.Bonding) - { - case NO_BIND: - if (!No_Bind) - continue; - break; - case BIND_WHEN_PICKED_UP: - if (!Bind_When_Picked_Up) - continue; - break; - case BIND_WHEN_EQUIPED: - if (!Bind_When_Equipped) - continue; - break; - case BIND_WHEN_USE: - if (!Bind_When_Use) - continue; - break; - case BIND_QUEST_ITEM: - if (!Bind_Quest_Item) - continue; - break; - default: - continue; - break; - } - - if (SellMethod) - { - if (itr->second.BuyPrice == 0) - continue; - } - else - { - if (itr->second.SellPrice == 0) - continue; - } - - if (itr->second.Quality > 6) + // Skip any BOP items + if (itr->second.Bonding == BIND_WHEN_PICKED_UP) continue; - if ((Vendor_Items == 0) && !(itr->second.Class == ITEM_CLASS_TRADE_GOODS)) - { - bool isVendorItem = false; + // Restrict quality to anything under 7 (artifact and below) or are 0 (poor) + if (itr->second.Quality == 0 || itr->second.Quality > 6) + continue; - for (unsigned int i = 0; (i < npcItems.size()) && (!isVendorItem); i++) - { - if (itr->second.ItemId == npcItems[i]) - isVendorItem = true; - } - - if (isVendorItem) - continue; - } - - if ((Vendor_TGs == 0) && (itr->second.Class == ITEM_CLASS_TRADE_GOODS)) - { - bool isVendorTG = false; - - for (unsigned int i = 0; (i < npcItems.size()) && (!isVendorTG); i++) - { - if (itr->second.ItemId == npcItems[i]) - isVendorTG = true; - } - - if (isVendorTG) - continue; - } - - if ((Loot_Items == 0) && !(itr->second.Class == ITEM_CLASS_TRADE_GOODS)) - { - bool isLootItem = false; - - for (unsigned int i = 0; (i < lootItems.size()) && (!isLootItem); i++) - { - if (itr->second.ItemId == lootItems[i]) - isLootItem = true; - } - - if (isLootItem) - continue; - } - - if ((Loot_TGs == 0) && (itr->second.Class == ITEM_CLASS_TRADE_GOODS)) - { - bool isLootTG = false; - - for (unsigned int i = 0; (i < lootItems.size()) && (!isLootTG); i++) - { - if (itr->second.ItemId == lootItems[i]) - isLootTG = true; - } - - if (isLootTG) - continue; - } - - if ((Other_Items == 0) && !(itr->second.Class == ITEM_CLASS_TRADE_GOODS)) - { - bool isVendorItem = false; - bool isLootItem = false; - - for (unsigned int i = 0; (i < npcItems.size()) && (!isVendorItem); i++) - { - if (itr->second.ItemId == npcItems[i]) - isVendorItem = true; - } - for (unsigned int i = 0; (i < lootItems.size()) && (!isLootItem); i++) - { - if (itr->second.ItemId == lootItems[i]) - isLootItem = true; - } - if ((!isLootItem) && (!isVendorItem)) - continue; - } - - if ((Other_TGs == 0) && (itr->second.Class == ITEM_CLASS_TRADE_GOODS)) - { - bool isVendorTG = false; - bool isLootTG = false; - - for (unsigned int i = 0; (i < npcItems.size()) && (!isVendorTG); i++) - { - if (itr->second.ItemId == npcItems[i]) - isVendorTG = true; - } - for (unsigned int i = 0; (i < lootItems.size()) && (!isLootTG); i++) - { - if (itr->second.ItemId == lootItems[i]) - isLootTG = true; - } - if ((!isLootTG) && (!isVendorTG)) - continue; - } - - // Disable items by Id + // Disabled items by Id if (DisableItemStore.find(itr->second.ItemId) != DisableItemStore.end()) { if (debug_Out_Filters) @@ -975,382 +578,90 @@ void AuctionHouseBot::Initialize() continue; } - // Disable permanent enchants items - if ((DisablePermEnchant) && (itr->second.Class == ITEM_CLASS_PERMANENT)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Permanent Enchant Item)", itr->second.ItemId); - continue; - } - // Disable conjured items - if ((DisableConjured) && (itr->second.IsConjuredConsumable())) + if (itr->second.IsConjuredConsumable()) { if (debug_Out_Filters) LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Conjured Consumable)", itr->second.ItemId); continue; } - // Disable gems - if ((DisableGems) && (itr->second.Class == ITEM_CLASS_GEM)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Gem)", itr->second.ItemId); - continue; - } + // Disable money + if (itr->second.Class == ITEM_CLASS_MONEY) + { + if (debug_Out_Filters) + LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Money)", itr->second.ItemId); + continue; + } - // Disable money - if ((DisableMoney) && (itr->second.Class == ITEM_CLASS_MONEY)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Money)", itr->second.ItemId); - continue; - } + // Disable moneyloot + if (itr->second.MinMoneyLoot > 0) + { + if (debug_Out_Filters) + LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (MoneyLoot)", itr->second.ItemId); + continue; + } - // Disable moneyloot - if ((DisableMoneyLoot) && (itr->second.MinMoneyLoot > 0)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (MoneyLoot)", itr->second.ItemId); - continue; - } + // Disable items with duration + if (itr->second.Duration > 0) + { + if (debug_Out_Filters) + LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Has a Duration)", itr->second.ItemId); + continue; + } - // Disable lootable items - if ((DisableLootable) && (itr->second.Flags & 4)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Lootable Item)", itr->second.ItemId); - continue; - } + // Disable items which are bind quest Items + if (itr->second.Bonding == BIND_QUEST_ITEM) + { + if (debug_Out_Filters) + LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (BOP or BQI and Required Level is less than Item Level)", itr->second.ItemId); + continue; + } - // Disable Keys - if ((DisableKeys) && (itr->second.Class == ITEM_CLASS_KEY)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Quest Item)", itr->second.ItemId); - continue; - } + // Disable "other" consumables + if (itr->second.Class == ITEM_CLASS_CONSUMABLE && itr->second.SubClass == ITEM_SUBCLASS_CONSUMABLE_OTHER) + { + if (debug_Out_Filters) + LOG_ERROR("module", "AuctionHouseBot: Item {} disabled consumber 'other' item", itr->second.ItemId); + continue; + } - // Disable items with duration - if ((DisableDuration) && (itr->second.Duration > 0)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Has a Duration)", itr->second.ItemId); - continue; - } + // Disable Junk items + if (itr->second.SubClass == ITEM_SUBCLASS_JUNK) + { + if (debug_Out_Filters) + LOG_ERROR("module", "AuctionHouseBot: Item {} disabled 'junk' item", itr->second.ItemId); + continue; + } - // Disable items which are BOP or Quest Items and have a required level lower than the item level - if ((DisableBOP_Or_Quest_NoReqLevel) && ((itr->second.Bonding == BIND_WHEN_PICKED_UP || itr->second.Bonding == BIND_QUEST_ITEM) && (itr->second.RequiredLevel < itr->second.ItemLevel))) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (BOP or BQI and Required Level is less than Item Level)", itr->second.ItemId); - continue; - } + // Disable All Misc (Pets, Mounts, etc) + if (itr->second.Class == ITEM_CLASS_MISC) + { + if (debug_Out_Filters) + LOG_ERROR("module", "AuctionHouseBot: Item {} disabled misc item", itr->second.ItemId); + continue; + } - // Disable items specifically for Warrior - if ((DisableWarriorItems) && (itr->second.AllowableClass == 1)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Warrior Item)", itr->second.ItemId); - continue; - } + // Disable anything with the string literal of a testing or depricated item + if (itr->second.Name1.find("Test ") != std::string::npos || + itr->second.Name1.find("Unused") != std::string::npos || + itr->second.Name1.find("Deprecated") != std::string::npos || + itr->second.Name1.find(" Epic ") != std::string::npos || + itr->second.Name1.find("[PH]") != std::string::npos || + itr->second.Name1.find("[DEP]") != std::string::npos || + itr->second.Name1.find("TEST") != std::string::npos) + { + if (debug_Out_Filters) + LOG_ERROR("module", "AuctionHouseBot: Item {} disabled item with a temp or unused item name", itr->second.ItemId); + continue; + } - // Disable items specifically for Paladin - if ((DisablePaladinItems) && (itr->second.AllowableClass == 2)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Paladin Item)", itr->second.ItemId); - continue; - } - - // Disable items specifically for Hunter - if ((DisableHunterItems) && (itr->second.AllowableClass == 4)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Hunter Item)", itr->second.ItemId); - continue; - } - - // Disable items specifically for Rogue - if ((DisableRogueItems) && (itr->second.AllowableClass == 8)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Rogue Item)", itr->second.ItemId); - continue; - } - - // Disable items specifically for Priest - if ((DisablePriestItems) && (itr->second.AllowableClass == 16)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Priest Item)", itr->second.ItemId); - continue; - } - - // Disable items specifically for DK - if ((DisableDKItems) && (itr->second.AllowableClass == 32)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (DK Item)", itr->second.ItemId); - continue; - } - - // Disable items specifically for Shaman - if ((DisableShamanItems) && (itr->second.AllowableClass == 64)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Shaman Item)", itr->second.ItemId); - continue; - } - - // Disable items specifically for Mage - if ((DisableMageItems) && (itr->second.AllowableClass == 128)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Mage Item)", itr->second.ItemId); - continue; - } - - // Disable items specifically for Warlock - if ((DisableWarlockItems) && (itr->second.AllowableClass == 256)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Warlock Item)", itr->second.ItemId); - continue; - } - - // Disable items specifically for Unused Class - if ((DisableUnusedClassItems) && (itr->second.AllowableClass == 512)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Unused Item)", itr->second.ItemId); - continue; - } - - // Disable items specifically for Druid - if ((DisableDruidItems) && (itr->second.AllowableClass == 1024)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Druid Item)", itr->second.ItemId); - continue; - } - - // Disable Items below level X - if ((DisableItemsBelowLevel) && (itr->second.Class != ITEM_CLASS_TRADE_GOODS) && (itr->second.ItemLevel < DisableItemsBelowLevel)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Item Level = {})", itr->second.ItemId, itr->second.ItemLevel); - continue; - } - - // Disable Items above level X - if ((DisableItemsAboveLevel) && (itr->second.Class != ITEM_CLASS_TRADE_GOODS) && (itr->second.ItemLevel > DisableItemsAboveLevel)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Item Level = {})", itr->second.ItemId, itr->second.ItemLevel); - continue; - } - - // Disable Trade Goods below level X - if ((DisableTGsBelowLevel) && (itr->second.Class == ITEM_CLASS_TRADE_GOODS) && (itr->second.ItemLevel < DisableTGsBelowLevel)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Trade Good {} disabled (Trade Good Level = {})", itr->second.ItemId, itr->second.ItemLevel); - continue; - } - - // Disable Trade Goods above level X - if ((DisableTGsAboveLevel) && (itr->second.Class == ITEM_CLASS_TRADE_GOODS) && (itr->second.ItemLevel > DisableTGsAboveLevel)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Trade Good {} disabled (Trade Good Level = {})", itr->second.ItemId, itr->second.ItemLevel); - continue; - } - - // Disable Items below GUID X - if ((DisableItemsBelowGUID) && (itr->second.Class != ITEM_CLASS_TRADE_GOODS) && (itr->second.ItemId < DisableItemsBelowGUID)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Item Level = {})", itr->second.ItemId, itr->second.ItemLevel); - continue; - } - - // Disable Items above GUID X - if ((DisableItemsAboveGUID) && (itr->second.Class != ITEM_CLASS_TRADE_GOODS) && (itr->second.ItemId > DisableItemsAboveGUID)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Item Level = {})", itr->second.ItemId, itr->second.ItemLevel); - continue; - } - - // Disable Trade Goods below GUID X - if ((DisableTGsBelowGUID) && (itr->second.Class == ITEM_CLASS_TRADE_GOODS) && (itr->second.ItemId < DisableTGsBelowGUID)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Trade Good Level = {})", itr->second.ItemId, itr->second.ItemLevel); - continue; - } - - // Disable Trade Goods above GUID X - if ((DisableTGsAboveGUID) && (itr->second.Class == ITEM_CLASS_TRADE_GOODS) && (itr->second.ItemId > DisableTGsAboveGUID)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Trade Good Level = {})", itr->second.ItemId, itr->second.ItemLevel); - continue; - } - - // Disable Items for level lower than X - if ((DisableItemsBelowReqLevel) && (itr->second.RequiredLevel < DisableItemsBelowReqLevel)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (RequiredLevel = {})", itr->second.ItemId, itr->second.RequiredLevel); - continue; - } - - // Disable Items for level higher than X - if ((DisableItemsAboveReqLevel) && (itr->second.RequiredLevel > DisableItemsAboveReqLevel)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (RequiredLevel = {})", itr->second.ItemId, itr->second.RequiredLevel); - continue; - } - - // Disable Trade Goods for level lower than X - if ((DisableTGsBelowReqLevel) && (itr->second.RequiredLevel < DisableTGsBelowReqLevel)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Trade Good {} disabled (RequiredLevel = {})", itr->second.ItemId, itr->second.RequiredLevel); - continue; - } - - // Disable Trade Goods for level higher than X - if ((DisableTGsAboveReqLevel) && (itr->second.RequiredLevel > DisableTGsAboveReqLevel)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Trade Good {} disabled (RequiredLevel = {})", itr->second.ItemId, itr->second.RequiredLevel); - continue; - } - - // Disable Items that require skill lower than X - if ((DisableItemsBelowReqSkillRank) && (itr->second.RequiredSkillRank < DisableItemsBelowReqSkillRank)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (RequiredSkillRank = {})", itr->second.ItemId, itr->second.RequiredSkillRank); - continue; - } - - // Disable Items that require skill higher than X - if ((DisableItemsAboveReqSkillRank) && (itr->second.RequiredSkillRank > DisableItemsAboveReqSkillRank)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (RequiredSkillRank = {})", itr->second.ItemId, itr->second.RequiredSkillRank); - continue; - } - - // Disable Trade Goods that require skill lower than X - if ((DisableTGsBelowReqSkillRank) && (itr->second.RequiredSkillRank < DisableTGsBelowReqSkillRank)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (RequiredSkillRank = {})", itr->second.ItemId, itr->second.RequiredSkillRank); - continue; - } - - // Disable Trade Goods that require skill higher than X - if ((DisableTGsAboveReqSkillRank) && (itr->second.RequiredSkillRank > DisableTGsAboveReqSkillRank)) - { - if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (RequiredSkillRank = {})", itr->second.ItemId, itr->second.RequiredSkillRank); - continue; - } - - switch (itr->second.Quality) - { - case AHB_GREY: - if (itr->second.Class == ITEM_CLASS_TRADE_GOODS) - greyTradeGoodsBin.push_back(itr->second.ItemId); - else - greyItemsBin.push_back(itr->second.ItemId); - break; - - case AHB_WHITE: - if (itr->second.Class == ITEM_CLASS_TRADE_GOODS) - whiteTradeGoodsBin.push_back(itr->second.ItemId); - else - whiteItemsBin.push_back(itr->second.ItemId); - break; - - case AHB_GREEN: - if (itr->second.Class == ITEM_CLASS_TRADE_GOODS) - greenTradeGoodsBin.push_back(itr->second.ItemId); - else - greenItemsBin.push_back(itr->second.ItemId); - break; - - case AHB_BLUE: - if (itr->second.Class == ITEM_CLASS_TRADE_GOODS) - blueTradeGoodsBin.push_back(itr->second.ItemId); - else - blueItemsBin.push_back(itr->second.ItemId); - break; - - case AHB_PURPLE: - if (itr->second.Class == ITEM_CLASS_TRADE_GOODS) - purpleTradeGoodsBin.push_back(itr->second.ItemId); - else - purpleItemsBin.push_back(itr->second.ItemId); - break; - - case AHB_ORANGE: - if (itr->second.Class == ITEM_CLASS_TRADE_GOODS) - orangeTradeGoodsBin.push_back(itr->second.ItemId); - else - orangeItemsBin.push_back(itr->second.ItemId); - break; - - case AHB_YELLOW: - if (itr->second.Class == ITEM_CLASS_TRADE_GOODS) - yellowTradeGoodsBin.push_back(itr->second.ItemId); - else - yellowItemsBin.push_back(itr->second.ItemId); - break; - } - } - - if ((greyTradeGoodsBin.size() == 0) && - (whiteTradeGoodsBin.size() == 0) && - (greenTradeGoodsBin.size() == 0) && - (blueTradeGoodsBin.size() == 0) && - (purpleTradeGoodsBin.size() == 0) && - (orangeTradeGoodsBin.size() == 0) && - (yellowTradeGoodsBin.size() == 0) && - (greyItemsBin.size() == 0) && - (whiteItemsBin.size() == 0) && - (greenItemsBin.size() == 0) && - (blueItemsBin.size() == 0) && - (purpleItemsBin.size() == 0) && - (orangeItemsBin.size() == 0) && - (yellowItemsBin.size() == 0)) - { - LOG_ERROR("module", "AuctionHouseBot: No items"); - AHBSeller = 0; + // Store the item ID + itemCandidates.push_back(itr->second.ItemId); } LOG_INFO("module", "AuctionHouseBot:"); LOG_INFO("module", "{} disabled items", uint32(DisableItemStore.size())); - LOG_INFO("module", "loaded {} grey trade goods", uint32(greyTradeGoodsBin.size())); - LOG_INFO("module", "loaded {} white trade goods", uint32(whiteTradeGoodsBin.size())); - LOG_INFO("module", "loaded {} green trade goods", uint32(greenTradeGoodsBin.size())); - LOG_INFO("module", "loaded {} blue trade goods", uint32(blueTradeGoodsBin.size())); - LOG_INFO("module", "loaded {} purple trade goods", uint32(purpleTradeGoodsBin.size())); - LOG_INFO("module", "loaded {} orange trade goods", uint32(orangeTradeGoodsBin.size())); - LOG_INFO("module", "loaded {} yellow trade goods", uint32(yellowTradeGoodsBin.size())); - LOG_INFO("module", "loaded {} grey items", uint32(greyItemsBin.size())); - LOG_INFO("module", "loaded {} white items", uint32(whiteItemsBin.size())); - LOG_INFO("module", "loaded {} green items", uint32(greenItemsBin.size())); - LOG_INFO("module", "loaded {} blue items", uint32(blueItemsBin.size())); - LOG_INFO("module", "loaded {} purple items", uint32(purpleItemsBin.size())); - LOG_INFO("module", "loaded {} orange items", uint32(orangeItemsBin.size())); - LOG_INFO("module", "loaded {} yellow items", uint32(yellowItemsBin.size())); } LOG_INFO("module", "AuctionHouseBot and AuctionHouseBuyer have been loaded."); @@ -1369,60 +680,6 @@ void AuctionHouseBot::InitializeConfiguration() AHBplayerAccount = sConfigMgr->GetOption("AuctionHouseBot.Account", 0); AHBplayerGUID = sConfigMgr->GetOption("AuctionHouseBot.GUID", 0); ItemsPerCycle = sConfigMgr->GetOption("AuctionHouseBot.ItemsPerCycle", 200); - - //Begin Filters - - Vendor_Items = sConfigMgr->GetOption("AuctionHouseBot.VendorItems", false); - Loot_Items = sConfigMgr->GetOption("AuctionHouseBot.LootItems", true); - Other_Items = sConfigMgr->GetOption("AuctionHouseBot.OtherItems", false); - Vendor_TGs = sConfigMgr->GetOption("AuctionHouseBot.VendorTradeGoods", false); - Loot_TGs = sConfigMgr->GetOption("AuctionHouseBot.LootTradeGoods", true); - Other_TGs = sConfigMgr->GetOption("AuctionHouseBot.OtherTradeGoods", false); - - No_Bind = sConfigMgr->GetOption("AuctionHouseBot.No_Bind", true); - Bind_When_Picked_Up = sConfigMgr->GetOption("AuctionHouseBot.Bind_When_Picked_Up", false); - Bind_When_Equipped = sConfigMgr->GetOption("AuctionHouseBot.Bind_When_Equipped", true); - Bind_When_Use = sConfigMgr->GetOption("AuctionHouseBot.Bind_When_Use", true); - Bind_Quest_Item = sConfigMgr->GetOption("AuctionHouseBot.Bind_Quest_Item", false); - - DisablePermEnchant = sConfigMgr->GetOption("AuctionHouseBot.DisablePermEnchant", false); - DisableConjured = sConfigMgr->GetOption("AuctionHouseBot.DisableConjured", false); - DisableGems = sConfigMgr->GetOption("AuctionHouseBot.DisableGems", false); - DisableMoney = sConfigMgr->GetOption("AuctionHouseBot.DisableMoney", false); - DisableMoneyLoot = sConfigMgr->GetOption("AuctionHouseBot.DisableMoneyLoot", false); - DisableLootable = sConfigMgr->GetOption("AuctionHouseBot.DisableLootable", false); - DisableKeys = sConfigMgr->GetOption("AuctionHouseBot.DisableKeys", false); - DisableDuration = sConfigMgr->GetOption("AuctionHouseBot.DisableDuration", false); - DisableBOP_Or_Quest_NoReqLevel = sConfigMgr->GetOption("AuctionHouseBot.DisableBOP_Or_Quest_NoReqLevel", false); - - DisableWarriorItems = sConfigMgr->GetOption("AuctionHouseBot.DisableWarriorItems", false); - DisablePaladinItems = sConfigMgr->GetOption("AuctionHouseBot.DisablePaladinItems", false); - DisableHunterItems = sConfigMgr->GetOption("AuctionHouseBot.DisableHunterItems", false); - DisableRogueItems = sConfigMgr->GetOption("AuctionHouseBot.DisableRogueItems", false); - DisablePriestItems = sConfigMgr->GetOption("AuctionHouseBot.DisablePriestItems", false); - DisableDKItems = sConfigMgr->GetOption("AuctionHouseBot.DisableDKItems", false); - DisableShamanItems = sConfigMgr->GetOption("AuctionHouseBot.DisableShamanItems", false); - DisableMageItems = sConfigMgr->GetOption("AuctionHouseBot.DisableMageItems", false); - DisableWarlockItems = sConfigMgr->GetOption("AuctionHouseBot.DisableWarlockItems", false); - DisableUnusedClassItems = sConfigMgr->GetOption("AuctionHouseBot.DisableUnusedClassItems", false); - DisableDruidItems = sConfigMgr->GetOption("AuctionHouseBot.DisableDruidItems", false); - - DisableItemsBelowLevel = sConfigMgr->GetOption("AuctionHouseBot.DisableItemsBelowLevel", 0); - DisableItemsAboveLevel = sConfigMgr->GetOption("AuctionHouseBot.DisableItemsAboveLevel", 0); - DisableTGsBelowLevel = sConfigMgr->GetOption("AuctionHouseBot.DisableTGsBelowLevel", 0); - DisableTGsAboveLevel = sConfigMgr->GetOption("AuctionHouseBot.DisableTGsAboveLevel", 0); - DisableItemsBelowGUID = sConfigMgr->GetOption("AuctionHouseBot.DisableItemsBelowGUID", 0); - DisableItemsAboveGUID = sConfigMgr->GetOption("AuctionHouseBot.DisableItemsAboveGUID", 0); - DisableTGsBelowGUID = sConfigMgr->GetOption("AuctionHouseBot.DisableTGsBelowGUID", 0); - DisableTGsAboveGUID = sConfigMgr->GetOption("AuctionHouseBot.DisableTGsAboveGUID", 0); - DisableItemsBelowReqLevel = sConfigMgr->GetOption("AuctionHouseBot.DisableItemsBelowReqLevel", 0); - DisableItemsAboveReqLevel = sConfigMgr->GetOption("AuctionHouseBot.DisableItemsAboveReqLevel", 0); - DisableTGsBelowReqLevel = sConfigMgr->GetOption("AuctionHouseBot.DisableTGsBelowReqLevel", 0); - DisableTGsAboveReqLevel = sConfigMgr->GetOption("AuctionHouseBot.DisableTGsAboveReqLevel", 0); - DisableItemsBelowReqSkillRank = sConfigMgr->GetOption("AuctionHouseBot.DisableItemsBelowReqSkillRank", 0); - DisableItemsAboveReqSkillRank = sConfigMgr->GetOption("AuctionHouseBot.DisableItemsAboveReqSkillRank", 0); - DisableTGsBelowReqSkillRank = sConfigMgr->GetOption("AuctionHouseBot.DisableTGsBelowReqSkillRank", 0); - DisableTGsAboveReqSkillRank = sConfigMgr->GetOption("AuctionHouseBot.DisableTGsAboveReqSkillRank", 0); } void AuctionHouseBot::IncrementItemCounts(AuctionEntry* ah) @@ -1468,8 +725,6 @@ void AuctionHouseBot::IncrementItemCounts(AuctionEntry* ah) LOG_ERROR("module", "AHBot: {} returned as House Faction. Neutral", ah->GetHouseId()); config = &NeutralConfig; } - - config->IncItemCounts(prototype->Class, prototype->Quality); } void AuctionHouseBot::DecrementItemCounts(AuctionEntry* ah, uint32 itemEntry) @@ -1504,8 +759,6 @@ void AuctionHouseBot::DecrementItemCounts(AuctionEntry* ah, uint32 itemEntry) LOG_ERROR("module", "AHBot: {} returned as House Faction. Neutral", ah->GetHouseId()); config = &NeutralConfig; } - - config->DecItemCounts(prototype->Class, prototype->Quality); } void AuctionHouseBot::Commands(uint32 command, uint32 ahMapID, uint32 col, char* args) @@ -1586,7 +839,6 @@ void AuctionHouseBot::Commands(uint32 command, uint32 ahMapID, uint32 col, char* uint32 maxItems = (uint32) strtoul(param1, NULL, 0); WorldDatabase.Execute("UPDATE mod_auctionhousebot SET maxitems = '{}' WHERE auctionhouse = '{}'", maxItems, ahMapID); config->SetMaxItems(maxItems); - config->CalculatePercents(); } break; case 3: //min time Deprecated (Place holder for future commands) @@ -1640,7 +892,6 @@ void AuctionHouseBot::Commands(uint32 command, uint32 ahMapID, uint32 col, char* trans->Append("UPDATE mod_auctionhousebot SET percentorangeitems = '{}' WHERE auctionhouse = '{}'", orangei, ahMapID); trans->Append("UPDATE mod_auctionhousebot SET percentyellowitems = '{}' WHERE auctionhouse = '{}'", yellowi, ahMapID); WorldDatabase.CommitTransaction(trans); - config->SetPercentages(greytg, whitetg, greentg, bluetg, purpletg, orangetg, yellowtg, greyi, whitei, greeni, bluei, purplei, orangei, yellowi); } break; case 6: //min prices @@ -1722,22 +973,6 @@ void AuctionHouseBot::LoadValues(AHBConfig *config) //load min and max items config->SetMinItems(WorldDatabase.Query("SELECT minitems FROM mod_auctionhousebot WHERE auctionhouse = {}", config->GetAHID())->Fetch()->Get()); config->SetMaxItems(WorldDatabase.Query("SELECT maxitems FROM mod_auctionhousebot WHERE auctionhouse = {}", config->GetAHID())->Fetch()->Get()); - //load percentages - uint32 greytg = WorldDatabase.Query("SELECT percentgreytradegoods FROM mod_auctionhousebot WHERE auctionhouse = {}", config->GetAHID())->Fetch()->Get(); - uint32 whitetg = WorldDatabase.Query("SELECT percentwhitetradegoods FROM mod_auctionhousebot WHERE auctionhouse = {}", config->GetAHID())->Fetch()->Get(); - uint32 greentg = WorldDatabase.Query("SELECT percentgreentradegoods FROM mod_auctionhousebot WHERE auctionhouse = {}", config->GetAHID())->Fetch()->Get(); - uint32 bluetg = WorldDatabase.Query("SELECT percentbluetradegoods FROM mod_auctionhousebot WHERE auctionhouse = {}", config->GetAHID())->Fetch()->Get(); - uint32 purpletg = WorldDatabase.Query("SELECT percentpurpletradegoods FROM mod_auctionhousebot WHERE auctionhouse = {}", config->GetAHID())->Fetch()->Get(); - uint32 orangetg = WorldDatabase.Query("SELECT percentorangetradegoods FROM mod_auctionhousebot WHERE auctionhouse = {}", config->GetAHID())->Fetch()->Get(); - uint32 yellowtg = WorldDatabase.Query("SELECT percentyellowtradegoods FROM mod_auctionhousebot WHERE auctionhouse = {}", config->GetAHID())->Fetch()->Get(); - uint32 greyi = WorldDatabase.Query("SELECT percentgreyitems FROM mod_auctionhousebot WHERE auctionhouse = {}", config->GetAHID())->Fetch()->Get(); - uint32 whitei = WorldDatabase.Query("SELECT percentwhiteitems FROM mod_auctionhousebot WHERE auctionhouse = {}", config->GetAHID())->Fetch()->Get(); - uint32 greeni = WorldDatabase.Query("SELECT percentgreenitems FROM mod_auctionhousebot WHERE auctionhouse = {}", config->GetAHID())->Fetch()->Get(); - uint32 bluei = WorldDatabase.Query("SELECT percentblueitems FROM mod_auctionhousebot WHERE auctionhouse = {}", config->GetAHID())->Fetch()->Get(); - uint32 purplei = WorldDatabase.Query("SELECT percentpurpleitems FROM mod_auctionhousebot WHERE auctionhouse = {}", config->GetAHID())->Fetch()->Get(); - uint32 orangei = WorldDatabase.Query("SELECT percentorangeitems FROM mod_auctionhousebot WHERE auctionhouse = {}", config->GetAHID())->Fetch()->Get(); - uint32 yellowi = WorldDatabase.Query("SELECT percentyellowitems FROM mod_auctionhousebot WHERE auctionhouse = {}", config->GetAHID())->Fetch()->Get(); - config->SetPercentages(greytg, whitetg, greentg, bluetg, purpletg, orangetg, yellowtg, greyi, whitei, greeni, bluei, purplei, orangei, yellowi); //load min and max prices config->SetMinPrice(AHB_GREY, WorldDatabase.Query("SELECT minpricegrey FROM mod_auctionhousebot WHERE auctionhouse = {}", config->GetAHID())->Fetch()->Get()); config->SetMaxPrice(AHB_GREY, WorldDatabase.Query("SELECT maxpricegrey FROM mod_auctionhousebot WHERE auctionhouse = {}", config->GetAHID())->Fetch()->Get()); @@ -1780,20 +1015,6 @@ void AuctionHouseBot::LoadValues(AHBConfig *config) { LOG_ERROR("module", "minItems = {}", config->GetMinItems()); LOG_ERROR("module", "maxItems = {}", config->GetMaxItems()); - LOG_ERROR("module", "percentGreyTradeGoods = {}", config->GetPercentages(AHB_GREY_TG)); - LOG_ERROR("module", "percentWhiteTradeGoods = {}", config->GetPercentages(AHB_WHITE_TG)); - LOG_ERROR("module", "percentGreenTradeGoods = {}", config->GetPercentages(AHB_GREEN_TG)); - LOG_ERROR("module", "percentBlueTradeGoods = {}", config->GetPercentages(AHB_BLUE_TG)); - LOG_ERROR("module", "percentPurpleTradeGoods = {}", config->GetPercentages(AHB_PURPLE_TG)); - LOG_ERROR("module", "percentOrangeTradeGoods = {}", config->GetPercentages(AHB_ORANGE_TG)); - LOG_ERROR("module", "percentYellowTradeGoods = {}", config->GetPercentages(AHB_YELLOW_TG)); - LOG_ERROR("module", "percentGreyItems = {}", config->GetPercentages(AHB_GREY_I)); - LOG_ERROR("module", "percentWhiteItems = {}", config->GetPercentages(AHB_WHITE_I)); - LOG_ERROR("module", "percentGreenItems = {}", config->GetPercentages(AHB_GREEN_I)); - LOG_ERROR("module", "percentBlueItems = {}", config->GetPercentages(AHB_BLUE_I)); - LOG_ERROR("module", "percentPurpleItems = {}", config->GetPercentages(AHB_PURPLE_I)); - LOG_ERROR("module", "percentOrangeItems = {}", config->GetPercentages(AHB_ORANGE_I)); - LOG_ERROR("module", "percentYellowItems = {}", config->GetPercentages(AHB_YELLOW_I)); LOG_ERROR("module", "minPriceGrey = {}", config->GetMinPrice(AHB_GREY)); LOG_ERROR("module", "maxPriceGrey = {}", config->GetMaxPrice(AHB_GREY)); LOG_ERROR("module", "minPriceWhite = {}", config->GetMinPrice(AHB_WHITE)); @@ -1833,83 +1054,8 @@ void AuctionHouseBot::LoadValues(AHBConfig *config) //AuctionHouseEntry const* ahEntry = sAuctionMgr->GetAuctionHouseEntry(config->GetAHFID()); AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(config->GetAHFID()); - - config->ResetItemCounts(); - uint32 auctions = auctionHouse->Getcount(); - - if (auctions) - { - for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = auctionHouse->GetAuctionsBegin(); itr != auctionHouse->GetAuctionsEnd(); ++itr) - { - AuctionEntry *Aentry = itr->second; - Item *item = sAuctionMgr->GetAItem(Aentry->item_guid); - if (item) - { - ItemTemplate const *prototype = item->GetTemplate(); - if (prototype) - { - switch (prototype->Quality) - { - case 0: - if (prototype->Class == ITEM_CLASS_TRADE_GOODS) - config->IncItemCounts(AHB_GREY_TG); - else - config->IncItemCounts(AHB_GREY_I); - break; - case 1: - if (prototype->Class == ITEM_CLASS_TRADE_GOODS) - config->IncItemCounts(AHB_WHITE_TG); - else - config->IncItemCounts(AHB_WHITE_I); - break; - case 2: - if (prototype->Class == ITEM_CLASS_TRADE_GOODS) - config->IncItemCounts(AHB_GREEN_TG); - else - config->IncItemCounts(AHB_GREEN_I); - break; - case 3: - if (prototype->Class == ITEM_CLASS_TRADE_GOODS) - config->IncItemCounts(AHB_BLUE_TG); - else - config->IncItemCounts(AHB_BLUE_I); - break; - case 4: - if (prototype->Class == ITEM_CLASS_TRADE_GOODS) - config->IncItemCounts(AHB_PURPLE_TG); - else - config->IncItemCounts(AHB_PURPLE_I); - break; - case 5: - if (prototype->Class == ITEM_CLASS_TRADE_GOODS) - config->IncItemCounts(AHB_ORANGE_TG); - else - config->IncItemCounts(AHB_ORANGE_I); - break; - case 6: - if (prototype->Class == ITEM_CLASS_TRADE_GOODS) - config->IncItemCounts(AHB_YELLOW_TG); - else - config->IncItemCounts(AHB_YELLOW_I); - break; - } - } - } - } - } - - if (debug_Out) - { - LOG_ERROR("module", "Current Settings for {} Auctionhouses:", WorldDatabase.Query("SELECT name FROM mod_auctionhousebot WHERE auctionhouse = {}", config->GetAHID())->Fetch()->Get()); - LOG_ERROR("module", "Grey Trade Goods\t{}\tGrey Items\t{}", config->GetItemCounts(AHB_GREY_TG), config->GetItemCounts(AHB_GREY_I)); - LOG_ERROR("module", "White Trade Goods\t{}\tWhite Items\t{}", config->GetItemCounts(AHB_WHITE_TG), config->GetItemCounts(AHB_WHITE_I)); - LOG_ERROR("module", "Green Trade Goods\t{}\tGreen Items\t{}", config->GetItemCounts(AHB_GREEN_TG), config->GetItemCounts(AHB_GREEN_I)); - LOG_ERROR("module", "Blue Trade Goods\t{}\tBlue Items\t{}", config->GetItemCounts(AHB_BLUE_TG), config->GetItemCounts(AHB_BLUE_I)); - LOG_ERROR("module", "Purple Trade Goods\t{}\tPurple Items\t{}", config->GetItemCounts(AHB_PURPLE_TG), config->GetItemCounts(AHB_PURPLE_I)); - LOG_ERROR("module", "Orange Trade Goods\t{}\tOrange Items\t{}", config->GetItemCounts(AHB_ORANGE_TG), config->GetItemCounts(AHB_ORANGE_I)); - LOG_ERROR("module", "Yellow Trade Goods\t{}\tYellow Items\t{}", config->GetItemCounts(AHB_YELLOW_TG), config->GetItemCounts(AHB_YELLOW_I)); - } } + if (AHBBuyer) { //load buyer bid prices diff --git a/src/AuctionHouseBot.h b/src/AuctionHouseBot.h index a091f7d..193ade7 100644 --- a/src/AuctionHouseBot.h +++ b/src/AuctionHouseBot.h @@ -59,20 +59,6 @@ private: uint32 AHFID; uint32 minItems; uint32 maxItems; - uint32 percentGreyTradeGoods; - uint32 percentWhiteTradeGoods; - uint32 percentGreenTradeGoods; - uint32 percentBlueTradeGoods; - uint32 percentPurpleTradeGoods; - uint32 percentOrangeTradeGoods; - uint32 percentYellowTradeGoods; - uint32 percentGreyItems; - uint32 percentWhiteItems; - uint32 percentGreenItems; - uint32 percentBlueItems; - uint32 percentPurpleItems; - uint32 percentOrangeItems; - uint32 percentYellowItems; uint32 minPriceGrey; uint32 maxPriceGrey; uint32 minBidPriceGrey; @@ -119,37 +105,6 @@ private: uint32 buyerBiddingInterval; uint32 buyerBidsPerInterval; - uint32 greytgp; - uint32 whitetgp; - uint32 greentgp; - uint32 bluetgp; - uint32 purpletgp; - uint32 orangetgp; - uint32 yellowtgp; - uint32 greyip; - uint32 whiteip; - uint32 greenip; - uint32 blueip; - uint32 purpleip; - uint32 orangeip; - uint32 yellowip; - - uint32 greyTGoods; - uint32 whiteTGoods; - uint32 greenTGoods; - uint32 blueTGoods; - uint32 purpleTGoods; - uint32 orangeTGoods; - uint32 yellowTGoods; - - uint32 greyItems; - uint32 whiteItems; - uint32 greenItems; - uint32 blueItems; - uint32 purpleItems; - uint32 orangeItems; - uint32 yellowItems; - public: AHBConfig(uint32 ahid) { @@ -204,98 +159,7 @@ public: { return maxItems; } - void SetPercentages(uint32 greytg, uint32 whitetg, uint32 greentg, uint32 bluetg, uint32 purpletg, uint32 orangetg, uint32 yellowtg, uint32 greyi, uint32 whitei, uint32 greeni, uint32 bluei, uint32 purplei, uint32 orangei, uint32 yellowi) - { - uint32 totalPercent = greytg + whitetg + greentg + bluetg + purpletg + orangetg + yellowtg + greyi + whitei + greeni + bluei + purplei + orangei + yellowi; - if (totalPercent == 0) - { - maxItems = 0; - } - else if (totalPercent != 100) - { - greytg = 0; - whitetg = 27; - greentg = 12; - bluetg = 10; - purpletg = 1; - orangetg = 0; - yellowtg = 0; - greyi = 0; - whitei = 10; - greeni = 30; - bluei = 8; - purplei = 2; - orangei = 0; - yellowi = 0; - } - percentGreyTradeGoods = greytg; - percentWhiteTradeGoods = whitetg; - percentGreenTradeGoods = greentg; - percentBlueTradeGoods = bluetg; - percentPurpleTradeGoods = purpletg; - percentOrangeTradeGoods = orangetg; - percentYellowTradeGoods = yellowtg; - percentGreyItems = greyi; - percentWhiteItems = whitei; - percentGreenItems = greeni; - percentBlueItems = bluei; - percentPurpleItems = purplei; - percentOrangeItems = orangei; - percentYellowItems = yellowi; - CalculatePercents(); - } - uint32 GetPercentages(uint32 color) - { - switch(color) - { - case AHB_GREY_TG: - return percentGreyTradeGoods; - break; - case AHB_WHITE_TG: - return percentWhiteTradeGoods; - break; - case AHB_GREEN_TG: - return percentGreenTradeGoods; - break; - case AHB_BLUE_TG: - return percentBlueTradeGoods; - break; - case AHB_PURPLE_TG: - return percentPurpleTradeGoods; - break; - case AHB_ORANGE_TG: - return percentOrangeTradeGoods; - break; - case AHB_YELLOW_TG: - return percentYellowTradeGoods; - break; - case AHB_GREY_I: - return percentGreyItems; - break; - case AHB_WHITE_I: - return percentWhiteItems; - break; - case AHB_GREEN_I: - return percentGreenItems; - break; - case AHB_BLUE_I: - return percentBlueItems; - break; - case AHB_PURPLE_I: - return percentPurpleItems; - break; - case AHB_ORANGE_I: - return percentOrangeItems; - break; - case AHB_YELLOW_I: - return percentYellowItems; - break; - default: - return 0; - break; - } - } void SetMinPrice(uint32 color, uint32 value) { switch(color) @@ -325,6 +189,7 @@ public: break; } } + uint32 GetMinPrice(uint32 color) { switch(color) @@ -836,306 +701,7 @@ public: { return buyerBiddingInterval; } - void CalculatePercents() - { - greytgp = (uint32) (((double)percentGreyTradeGoods / 100.0) * maxItems); - whitetgp = (uint32) (((double)percentWhiteTradeGoods / 100.0) * maxItems); - greentgp = (uint32) (((double)percentGreenTradeGoods / 100.0) * maxItems); - bluetgp = (uint32) (((double)percentBlueTradeGoods / 100.0) * maxItems); - purpletgp = (uint32) (((double)percentPurpleTradeGoods / 100.0) * maxItems); - orangetgp = (uint32) (((double)percentOrangeTradeGoods / 100.0) * maxItems); - yellowtgp = (uint32) (((double)percentYellowTradeGoods / 100.0) * maxItems); - greyip = (uint32) (((double)percentGreyItems / 100.0) * maxItems); - whiteip = (uint32) (((double)percentWhiteItems / 100.0) * maxItems); - greenip = (uint32) (((double)percentGreenItems / 100.0) * maxItems); - blueip = (uint32) (((double)percentBlueItems / 100.0) * maxItems); - purpleip = (uint32) (((double)percentPurpleItems / 100.0) * maxItems); - orangeip = (uint32) (((double)percentOrangeItems / 100.0) * maxItems); - yellowip = (uint32) (((double)percentYellowItems / 100.0) * maxItems); - uint32 total = greytgp + whitetgp + greentgp + bluetgp + purpletgp + orangetgp + yellowtgp + greyip + whiteip + greenip + blueip + purpleip + orangeip + yellowip; - int32 diff = (maxItems - total); - if (diff < 0) - { - if ((whiteip - diff) > 0) - whiteip -= diff; - else if ((greenip - diff) > 0) - greenip -= diff; - } - else if (diff < 0) - { - whiteip += diff; - } - } - uint32 GetPercents(uint32 color) - { - switch(color) - { - case AHB_GREY_TG: - return greytgp; - break; - case AHB_WHITE_TG: - return whitetgp; - break; - case AHB_GREEN_TG: - return greentgp; - break; - case AHB_BLUE_TG: - return bluetgp; - break; - case AHB_PURPLE_TG: - return purpletgp; - break; - case AHB_ORANGE_TG: - return orangetgp; - break; - case AHB_YELLOW_TG: - return yellowtgp; - break; - case AHB_GREY_I: - return greyip; - break; - case AHB_WHITE_I: - return whiteip; - break; - case AHB_GREEN_I: - return greenip; - break; - case AHB_BLUE_I: - return blueip; - break; - case AHB_PURPLE_I: - return purpleip; - break; - case AHB_ORANGE_I: - return orangeip; - break; - case AHB_YELLOW_I: - return yellowip; - break; - default: - return 0; - break; - } - } - void DecItemCounts(uint32 Class, uint32 Quality) - { - switch(Class) - { - case ITEM_CLASS_TRADE_GOODS: - DecItemCounts(Quality); - break; - default: - DecItemCounts(Quality + 7); - break; - } - } - - void DecItemCounts(uint32 color) - { - switch(color) - { - case AHB_GREY_TG: - --greyTGoods; - break; - case AHB_WHITE_TG: - --whiteTGoods; - break; - case AHB_GREEN_TG: - --greenTGoods; - break; - case AHB_BLUE_TG: - --blueTGoods; - break; - case AHB_PURPLE_TG: - --purpleTGoods; - break; - case AHB_ORANGE_TG: - --orangeTGoods; - break; - case AHB_YELLOW_TG: - --yellowTGoods; - break; - case AHB_GREY_I: - --greyItems; - break; - case AHB_WHITE_I: - --whiteItems; - break; - case AHB_GREEN_I: - --greenItems; - break; - case AHB_BLUE_I: - --blueItems; - break; - case AHB_PURPLE_I: - --purpleItems; - break; - case AHB_ORANGE_I: - --orangeItems; - break; - case AHB_YELLOW_I: - --yellowItems; - break; - default: - break; - } - } - - void IncItemCounts(uint32 Class, uint32 Quality) - { - switch(Class) - { - case ITEM_CLASS_TRADE_GOODS: - IncItemCounts(Quality); - break; - default: - IncItemCounts(Quality + 7); - break; - } - } - - void IncItemCounts(uint32 color) - { - switch(color) - { - case AHB_GREY_TG: - ++greyTGoods; - break; - case AHB_WHITE_TG: - ++whiteTGoods; - break; - case AHB_GREEN_TG: - ++greenTGoods; - break; - case AHB_BLUE_TG: - ++blueTGoods; - break; - case AHB_PURPLE_TG: - ++purpleTGoods; - break; - case AHB_ORANGE_TG: - ++orangeTGoods; - break; - case AHB_YELLOW_TG: - ++yellowTGoods; - break; - case AHB_GREY_I: - ++greyItems; - break; - case AHB_WHITE_I: - ++whiteItems; - break; - case AHB_GREEN_I: - ++greenItems; - break; - case AHB_BLUE_I: - ++blueItems; - break; - case AHB_PURPLE_I: - ++purpleItems; - break; - case AHB_ORANGE_I: - ++orangeItems; - break; - case AHB_YELLOW_I: - ++yellowItems; - break; - default: - break; - } - } - - void ResetItemCounts() - { - greyTGoods = 0; - whiteTGoods = 0; - greenTGoods = 0; - blueTGoods = 0; - purpleTGoods = 0; - orangeTGoods = 0; - yellowTGoods = 0; - - greyItems = 0; - whiteItems = 0; - greenItems = 0; - blueItems = 0; - purpleItems = 0; - orangeItems = 0; - yellowItems = 0; - } - - uint32 TotalItemCounts() - { - return( - greyTGoods + - whiteTGoods + - greenTGoods + - blueTGoods + - purpleTGoods + - orangeTGoods + - yellowTGoods + - - greyItems + - whiteItems + - greenItems + - blueItems + - purpleItems + - orangeItems + - yellowItems); - } - - uint32 GetItemCounts(uint32 color) - { - switch(color) - { - case AHB_GREY_TG: - return greyTGoods; - break; - case AHB_WHITE_TG: - return whiteTGoods; - break; - case AHB_GREEN_TG: - return greenTGoods; - break; - case AHB_BLUE_TG: - return blueTGoods; - break; - case AHB_PURPLE_TG: - return purpleTGoods; - break; - case AHB_ORANGE_TG: - return orangeTGoods; - break; - case AHB_YELLOW_TG: - return yellowTGoods; - break; - case AHB_GREY_I: - return greyItems; - break; - case AHB_WHITE_I: - return whiteItems; - break; - case AHB_GREEN_I: - return greenItems; - break; - case AHB_BLUE_I: - return blueItems; - break; - case AHB_PURPLE_I: - return purpleItems; - break; - case AHB_ORANGE_I: - return orangeItems; - break; - case AHB_YELLOW_I: - return yellowItems; - break; - default: - return 0; - break; - } - } void SetBidsPerInterval(uint32 value) { buyerBidsPerInterval = value; @@ -1164,60 +730,6 @@ private: ObjectGuid::LowType AHBplayerGUID; uint32 ItemsPerCycle; - //Begin Filters - - bool Vendor_Items; - bool Loot_Items; - bool Other_Items; - bool Vendor_TGs; - bool Loot_TGs; - bool Other_TGs; - - bool No_Bind; - bool Bind_When_Picked_Up; - bool Bind_When_Equipped; - bool Bind_When_Use; - bool Bind_Quest_Item; - - bool DisablePermEnchant; - bool DisableConjured; - bool DisableGems; - bool DisableMoney; - bool DisableMoneyLoot; - bool DisableLootable; - bool DisableKeys; - bool DisableDuration; - bool DisableBOP_Or_Quest_NoReqLevel; - - bool DisableWarriorItems; - bool DisablePaladinItems; - bool DisableHunterItems; - bool DisableRogueItems; - bool DisablePriestItems; - bool DisableDKItems; - bool DisableShamanItems; - bool DisableMageItems; - bool DisableWarlockItems; - bool DisableUnusedClassItems; - bool DisableDruidItems; - - uint32 DisableItemsBelowLevel; - uint32 DisableItemsAboveLevel; - uint32 DisableTGsBelowLevel; - uint32 DisableTGsAboveLevel; - uint32 DisableItemsBelowGUID; - uint32 DisableItemsAboveGUID; - uint32 DisableTGsBelowGUID; - uint32 DisableTGsAboveGUID; - uint32 DisableItemsBelowReqLevel; - uint32 DisableItemsAboveReqLevel; - uint32 DisableTGsBelowReqLevel; - uint32 DisableTGsAboveReqLevel; - uint32 DisableItemsBelowReqSkillRank; - uint32 DisableItemsAboveReqSkillRank; - uint32 DisableTGsBelowReqSkillRank; - uint32 DisableTGsAboveReqSkillRank; - std::set DisableItemStore; //End Filters @@ -1231,6 +743,7 @@ private: time_t _lastrun_n; inline uint32 minValue(uint32 a, uint32 b) { return a <= b ? a : b; }; + uint32 GetStackSizeForItem(ItemTemplate const* itemProto) const; void addNewAuctions(Player *AHBplayer, AHBConfig *config); void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, WorldSession *session);