mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
This commit is contained in:
40
sql/updates/auth/2014_08_28_00_auth_rbac_ahbot.sql
Normal file
40
sql/updates/auth/2014_08_28_00_auth_rbac_ahbot.sql
Normal file
@@ -0,0 +1,40 @@
|
||||
SET @id = 778;
|
||||
|
||||
-- Add new permissions
|
||||
DELETE FROM `rbac_permissions` WHERE `id` BETWEEN @id AND @id+15;
|
||||
INSERT INTO `rbac_permissions` (`id`, `name`) VALUES
|
||||
(@id, 'Command: ahbot'),
|
||||
(@id+1, 'Command: ahbot items'),
|
||||
(@id+2, 'Command: ahbot items gray'),
|
||||
(@id+3, 'Command: ahbot items white'),
|
||||
(@id+4, 'Command: ahbot items green'),
|
||||
(@id+5, 'Command: ahbot items blue'),
|
||||
(@id+6, 'Command: ahbot items purple'),
|
||||
(@id+7, 'Command: ahbot items orange'),
|
||||
(@id+8, 'Command: ahbot items yellow'),
|
||||
(@id+9, 'Command: ahbot ratio'),
|
||||
(@id+10, 'Command: ahbot ratio alliance'),
|
||||
(@id+11, 'Command: ahbot ratio horde'),
|
||||
(@id+12, 'Command: ahbot ratio neutral'),
|
||||
(@id+13, 'Command: ahbot rebuild'),
|
||||
(@id+14, 'Command: ahbot reload'),
|
||||
(@id+15, 'Command: ahbot status');
|
||||
|
||||
DELETE FROM `rbac_linked_permissions` WHERE `linkedId` BETWEEN @id AND @id+15;
|
||||
INSERT INTO `rbac_linked_permissions` (`id`, `linkedId`) VALUES
|
||||
(192, @id),
|
||||
(192, @id+1),
|
||||
(192, @id+2),
|
||||
(192, @id+3),
|
||||
(192, @id+4),
|
||||
(192, @id+5),
|
||||
(192, @id+6),
|
||||
(192, @id+7),
|
||||
(192, @id+8),
|
||||
(192, @id+9),
|
||||
(192, @id+10),
|
||||
(192, @id+11),
|
||||
(192, @id+12),
|
||||
(192, @id+13),
|
||||
(192, @id+14),
|
||||
(192, @id+15);
|
||||
42
sql/updates/world/2014_08_28_01_world_ahbot.sql
Normal file
42
sql/updates/world/2014_08_28_01_world_ahbot.sql
Normal file
@@ -0,0 +1,42 @@
|
||||
SET @id = 778;
|
||||
|
||||
DELETE FROM `command` WHERE `name` LIKE 'ahbot%';
|
||||
INSERT INTO `command` (`name`, `permission`, `help`) VALUES
|
||||
('ahbot items', @id+1, 'Syntax: .ahbot items $GrayItems $WhiteItems $GreenItems $BlueItems $PurpleItems $OrangeItems $YellowItems\r\n\r\nSet amount of each items color be selled on auction.'),
|
||||
('ahbot items gray', @id+2, 'Syntax: .ahbot items gray $GrayItems\r\n\r\nSet amount of Gray color items be selled on auction.'),
|
||||
('ahbot items white', @id+3, 'Syntax: .ahbot items white $WhiteItems\r\n\r\nSet amount of White color items be selled on auction.'),
|
||||
('ahbot items green', @id+4, 'Syntax: .ahbot items green $GreenItems\r\n\r\nSet amount of Green color items be selled on auction.'),
|
||||
('ahbot items blue', @id+5, 'Syntax: .ahbot items blue $BlueItems\r\n\r\nSet amount of Blue color items be selled on auction.'),
|
||||
('ahbot items purple', @id+6, 'Syntax: .ahbot items purple $PurpleItems\r\n\r\nSet amount of Purple color items be selled on auction.'),
|
||||
('ahbot items orange', @id+7, 'Syntax: .ahbot items orange $OrangeItems\r\n\r\nSet amount of Orange color items be selled on auction.'),
|
||||
('ahbot items yellow', @id+8, 'Syntax: .ahbot items yellow $YellowItems\r\n\r\nSet amount of Yellow color items be selled on auction.'),
|
||||
('ahbot ratio', @id+9, 'Syntax: .ahbot ratio $allianceratio $horderatio $neutralratio\r\n\r\nSet ratio of items in 3 auctions house.'),
|
||||
('ahbot ratio alliance', @id+10, 'Syntax: .ahbot ratio alliance $allianceratio\r\n\r\nSet ratio of items in alliance auction house.'),
|
||||
('ahbot ratio horde', @id+11, 'Syntax: .ahbot ratio horde $horderatio\r\n\r\nSet ratio of items in horde auction house.'),
|
||||
('ahbot ratio neutral', @id+12, 'Syntax: .ahbot ratio neutral $neutralratio\r\n\r\nSet ratio of items in $neutral auction house.'),
|
||||
('ahbot rebuild', @id+13, 'Syntax: .ahbot rebuild [all]\r\n\r\nExpire all actual auction of ahbot except bided by player. Binded auctions included to expire if "all" option used. Ahbot re-fill auctions base at current settings then.'),
|
||||
('ahbot reload', @id+14, 'Syntax: .ahbot reload\r\n\r\nReload AHBot settings from configuration file.'),
|
||||
('ahbot status', @id+15, 'Syntax: .ahbot status [all]\r\n\r\nShow current ahbot state data in short form, and with "all" with details.');
|
||||
|
||||
DELETE FROM `trinity_string` WHERE `entry` BETWEEN 1157 AND 1176;
|
||||
INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES
|
||||
(1157, 'All config are reloaded from configuration file.'),
|
||||
(1158, '=========================================================='),
|
||||
(1159, '|--------------------------------------------------------|'),
|
||||
(1160, '| | Alliance | Horde | Neutral | Total |'),
|
||||
(1161, ' Alliance/Horde/Neutral/Total'),
|
||||
(1162, '| %-10s | %8u | %8u | %8u | %8u |'),
|
||||
(1163, '%-10s = %6u / %6u / %6u / %6u'),
|
||||
(1164, 'Count'),
|
||||
(1165, 'Item Ratio'),
|
||||
(1166, '| | Alliance | Horde | Neutral | Amount |'),
|
||||
(1167, ' Alliance/Horde/Neutral/Amount'),
|
||||
(1168, 'Gray'),
|
||||
(1169, 'White'),
|
||||
(1170, 'Green'),
|
||||
(1171, 'Blue'),
|
||||
(1172, 'Purple'),
|
||||
(1173, 'Orange'),
|
||||
(1174, 'Yellow'),
|
||||
(1175, 'Amount of %s items is set to %u.'),
|
||||
(1176, 'Items ratio for %s is set to %u.');
|
||||
@@ -681,6 +681,22 @@ enum RBACPermissions
|
||||
RBAC_PERM_COMMAND_MODIFY_CURRENCY = 775, // only 4.3.4
|
||||
RBAC_PERM_COMMAND_DEBUG_PHASE = 776, // only 4.3.4
|
||||
RBAC_PERM_COMMAND_MAILBOX = 777,
|
||||
RBAC_PERM_COMMAND_AHBOT = 778,
|
||||
RBAC_PERM_COMMAND_AHBOT_ITEMS = 779,
|
||||
RBAC_PERM_COMMAND_AHBOT_ITEMS_GRAY = 780,
|
||||
RBAC_PERM_COMMAND_AHBOT_ITEMS_WHITE = 781,
|
||||
RBAC_PERM_COMMAND_AHBOT_ITEMS_GREEN = 782,
|
||||
RBAC_PERM_COMMAND_AHBOT_ITEMS_BLUE = 783,
|
||||
RBAC_PERM_COMMAND_AHBOT_ITEMS_PURPLE = 784,
|
||||
RBAC_PERM_COMMAND_AHBOT_ITEMS_ORANGE = 785,
|
||||
RBAC_PERM_COMMAND_AHBOT_ITEMS_YELLOW = 786,
|
||||
RBAC_PERM_COMMAND_AHBOT_RATIO = 787,
|
||||
RBAC_PERM_COMMAND_AHBOT_RATIO_ALLIANCE = 788,
|
||||
RBAC_PERM_COMMAND_AHBOT_RATIO_HORDE = 789,
|
||||
RBAC_PERM_COMMAND_AHBOT_RATIO_NEUTRAL = 790,
|
||||
RBAC_PERM_COMMAND_AHBOT_REBUILD = 791,
|
||||
RBAC_PERM_COMMAND_AHBOT_RELOAD = 792,
|
||||
RBAC_PERM_COMMAND_AHBOT_STATUS = 793,
|
||||
|
||||
// custom permissions 1000+
|
||||
RBAC_PERM_MAX
|
||||
|
||||
428
src/server/game/AuctionHouseBot/AuctionHouseBot.cpp
Normal file
428
src/server/game/AuctionHouseBot/AuctionHouseBot.cpp
Normal file
@@ -0,0 +1,428 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Log.h"
|
||||
#include "Item.h"
|
||||
#include "World.h"
|
||||
#include "Config.h"
|
||||
#include "AuctionHouseMgr.h"
|
||||
#include "AuctionHouseBot.h"
|
||||
#include "AuctionHouseBotBuyer.h"
|
||||
#include "AuctionHouseBotSeller.h"
|
||||
|
||||
bool AuctionBotConfig::Initialize()
|
||||
{
|
||||
GetConfigFromFile();
|
||||
|
||||
if (!GetConfig(CONFIG_AHBOT_BUYER_ENABLED) && !GetConfig(CONFIG_AHBOT_SELLER_ENABLED))
|
||||
{
|
||||
TC_LOG_INFO("ahbot", "AHBOT is Disabled.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GetConfig(CONFIG_AHBOT_ALLIANCE_ITEM_AMOUNT_RATIO) == 0 && GetConfig(CONFIG_AHBOT_HORDE_ITEM_AMOUNT_RATIO) == 0 && GetConfig(CONFIG_AHBOT_NEUTRAL_ITEM_AMOUNT_RATIO) == 0 &&
|
||||
!GetConfig(CONFIG_AHBOT_BUYER_ALLIANCE_ENABLED) && !GetConfig(CONFIG_AHBOT_BUYER_HORDE_ENABLED) && !GetConfig(CONFIG_AHBOT_BUYER_NEUTRAL_ENABLED))
|
||||
{
|
||||
TC_LOG_INFO("ahbot", "All feature of AuctionHouseBot are disabled!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GetConfig(CONFIG_AHBOT_ALLIANCE_ITEM_AMOUNT_RATIO) == 0 && GetConfig(CONFIG_AHBOT_HORDE_ITEM_AMOUNT_RATIO) == 0 && GetConfig(CONFIG_AHBOT_NEUTRAL_ITEM_AMOUNT_RATIO) == 0)
|
||||
TC_LOG_INFO("ahbot", "AuctionHouseBot SELLER is disabled!");
|
||||
|
||||
if (!GetConfig(CONFIG_AHBOT_BUYER_ALLIANCE_ENABLED) && !GetConfig(CONFIG_AHBOT_BUYER_HORDE_ENABLED) && !GetConfig(CONFIG_AHBOT_BUYER_NEUTRAL_ENABLED))
|
||||
TC_LOG_INFO("ahbot", "AuctionHouseBot BUYER is disabled!");
|
||||
|
||||
_itemsPerCycleBoost = GetConfig(CONFIG_AHBOT_ITEMS_PER_CYCLE_BOOST);
|
||||
_itemsPerCycleNormal = GetConfig(CONFIG_AHBOT_ITEMS_PER_CYCLE_NORMAL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void AuctionBotConfig::SetConfig(AuctionBotConfigUInt32Values index, char const* fieldname, uint32 defvalue)
|
||||
{
|
||||
SetConfig(index, sConfigMgr->GetIntDefault(fieldname, defvalue));
|
||||
|
||||
if (int32(GetConfig(index)) < 0)
|
||||
{
|
||||
TC_LOG_ERROR("ahbot", "AHBot: %s (%i) can't be negative. Using %u instead.", fieldname, int32(GetConfig(index)), defvalue);
|
||||
SetConfig(index, defvalue);
|
||||
}
|
||||
}
|
||||
|
||||
void AuctionBotConfig::SetConfigMax(AuctionBotConfigUInt32Values index, char const* fieldname, uint32 defvalue, uint32 maxvalue)
|
||||
{
|
||||
SetConfig(index, sConfigMgr->GetIntDefault(fieldname, defvalue));
|
||||
|
||||
if (GetConfig(index) > maxvalue)
|
||||
{
|
||||
TC_LOG_ERROR("ahbot", "AHBot: %s (%u) must be in range 0...%u. Using %u instead.", fieldname, GetConfig(index), maxvalue, maxvalue);
|
||||
SetConfig(index, maxvalue);
|
||||
}
|
||||
}
|
||||
|
||||
void AuctionBotConfig::SetConfigMinMax(AuctionBotConfigUInt32Values index, char const* fieldname, uint32 defvalue, uint32 minvalue, uint32 maxvalue)
|
||||
{
|
||||
SetConfig(index, sConfigMgr->GetIntDefault(fieldname, defvalue));
|
||||
|
||||
if (GetConfig(index) > maxvalue)
|
||||
{
|
||||
TC_LOG_ERROR("ahbot", "AHBot: %s (%u) must be in range %u...%u. Using %u instead.", fieldname, GetConfig(index), minvalue, maxvalue, maxvalue);
|
||||
SetConfig(index, maxvalue);
|
||||
}
|
||||
|
||||
if (GetConfig(index) < minvalue)
|
||||
{
|
||||
TC_LOG_ERROR("ahbot", "AHBot: %s (%u) must be in range %u...%u. Using %u instead.", fieldname, GetConfig(index), minvalue, maxvalue, minvalue);
|
||||
SetConfig(index, minvalue);
|
||||
}
|
||||
}
|
||||
|
||||
void AuctionBotConfig::SetConfig(AuctionBotConfigBoolValues index, char const* fieldname, bool defvalue)
|
||||
{
|
||||
SetConfig(index, sConfigMgr->GetBoolDefault(fieldname, defvalue));
|
||||
}
|
||||
|
||||
//Get AuctionHousebot configuration file
|
||||
void AuctionBotConfig::GetConfigFromFile()
|
||||
{
|
||||
SetConfigMax(CONFIG_AHBOT_ALLIANCE_ITEM_AMOUNT_RATIO, "AuctionHouseBot.Alliance.Items.Amount.Ratio", 100, 10000);
|
||||
SetConfigMax(CONFIG_AHBOT_HORDE_ITEM_AMOUNT_RATIO, "AuctionHouseBot.Horde.Items.Amount.Ratio", 100, 10000);
|
||||
SetConfigMax(CONFIG_AHBOT_NEUTRAL_ITEM_AMOUNT_RATIO, "AuctionHouseBot.Neutral.Items.Amount.Ratio", 100, 10000);
|
||||
|
||||
SetAHBotIncludes(sConfigMgr->GetStringDefault("AuctionHouseBot.forceIncludeItems", ""));
|
||||
SetAHBotExcludes(sConfigMgr->GetStringDefault("AuctionHouseBot.forceExcludeItems", ""));
|
||||
|
||||
SetConfig(CONFIG_AHBOT_BUYER_ALLIANCE_ENABLED, "AuctionHouseBot.Buyer.Alliance.Enabled", false);
|
||||
SetConfig(CONFIG_AHBOT_BUYER_HORDE_ENABLED, "AuctionHouseBot.Buyer.Horde.Enabled", false);
|
||||
SetConfig(CONFIG_AHBOT_BUYER_NEUTRAL_ENABLED, "AuctionHouseBot.Buyer.Neutral.Enabled", false);
|
||||
|
||||
SetConfig(CONFIG_AHBOT_ITEMS_VENDOR, "AuctionHouseBot.Items.Vendor", false);
|
||||
SetConfig(CONFIG_AHBOT_ITEMS_LOOT, "AuctionHouseBot.Items.Loot", true);
|
||||
SetConfig(CONFIG_AHBOT_ITEMS_MISC, "AuctionHouseBot.Items.Misc", false);
|
||||
|
||||
SetConfig(CONFIG_AHBOT_BIND_NO, "AuctionHouseBot.Bind.No", true);
|
||||
SetConfig(CONFIG_AHBOT_BIND_PICKUP, "AuctionHouseBot.Bind.Pickup", false);
|
||||
SetConfig(CONFIG_AHBOT_BIND_EQUIP, "AuctionHouseBot.Bind.Equip", true);
|
||||
SetConfig(CONFIG_AHBOT_BIND_USE, "AuctionHouseBot.Bind.Use", true);
|
||||
SetConfig(CONFIG_AHBOT_BIND_QUEST, "AuctionHouseBot.Bind.Quest", false);
|
||||
SetConfig(CONFIG_AHBOT_LOCKBOX_ENABLED, "AuctionHouseBot.LockBox.Enabled", false);
|
||||
|
||||
SetConfig(CONFIG_AHBOT_BUYPRICE_SELLER, "AuctionHouseBot.BuyPrice.Seller", true);
|
||||
|
||||
SetConfig(CONFIG_AHBOT_ITEMS_PER_CYCLE_BOOST, "AuctionHouseBot.ItemsPerCycle.Boost", 1000);
|
||||
SetConfig(CONFIG_AHBOT_ITEMS_PER_CYCLE_NORMAL, "AuctionHouseBot.ItemsPerCycle.Normal", 20);
|
||||
|
||||
SetConfig(CONFIG_AHBOT_ITEM_MIN_ITEM_LEVEL, "AuctionHouseBot.Items.ItemLevel.Min", 0);
|
||||
SetConfig(CONFIG_AHBOT_ITEM_MAX_ITEM_LEVEL, "AuctionHouseBot.Items.ItemLevel.Max", 0);
|
||||
SetConfig(CONFIG_AHBOT_ITEM_MIN_REQ_LEVEL, "AuctionHouseBot.Items.ReqLevel.Min", 0);
|
||||
SetConfig(CONFIG_AHBOT_ITEM_MAX_REQ_LEVEL, "AuctionHouseBot.Items.ReqLevel.Max", 0);
|
||||
SetConfig(CONFIG_AHBOT_ITEM_MIN_SKILL_RANK, "AuctionHouseBot.Items.ReqSkill.Min", 0);
|
||||
SetConfig(CONFIG_AHBOT_ITEM_MAX_SKILL_RANK, "AuctionHouseBot.Items.ReqSkill.Max", 0);
|
||||
|
||||
SetConfig(CONFIG_AHBOT_ITEM_GRAY_AMOUNT, "AuctionHouseBot.Items.Amount.Gray", 0);
|
||||
SetConfig(CONFIG_AHBOT_ITEM_WHITE_AMOUNT, "AuctionHouseBot.Items.Amount.White", 2000);
|
||||
SetConfig(CONFIG_AHBOT_ITEM_GREEN_AMOUNT, "AuctionHouseBot.Items.Amount.Green", 2500);
|
||||
SetConfig(CONFIG_AHBOT_ITEM_BLUE_AMOUNT, "AuctionHouseBot.Items.Amount.Blue", 1500);
|
||||
SetConfig(CONFIG_AHBOT_ITEM_PURPLE_AMOUNT, "AuctionHouseBot.Items.Amount.Purple", 500);
|
||||
SetConfig(CONFIG_AHBOT_ITEM_ORANGE_AMOUNT, "AuctionHouseBot.Items.Amount.Orange", 0);
|
||||
SetConfig(CONFIG_AHBOT_ITEM_YELLOW_AMOUNT, "AuctionHouseBot.Items.Amount.Yellow", 0);
|
||||
|
||||
SetConfigMax(CONFIG_AHBOT_CLASS_CONSUMABLE_AMOUNT, "AuctionHouseBot.Class.Consumable", 6, 10);
|
||||
SetConfigMax(CONFIG_AHBOT_CLASS_CONTAINER_AMOUNT, "AuctionHouseBot.Class.Container", 4, 10);
|
||||
SetConfigMax(CONFIG_AHBOT_CLASS_WEAPON_AMOUNT, "AuctionHouseBot.Class.Weapon", 8, 10);
|
||||
SetConfigMax(CONFIG_AHBOT_CLASS_GEM_AMOUNT, "AuctionHouseBot.Class.Gem", 3, 10);
|
||||
SetConfigMax(CONFIG_AHBOT_CLASS_ARMOR_AMOUNT, "AuctionHouseBot.Class.Armor", 8, 10);
|
||||
SetConfigMax(CONFIG_AHBOT_CLASS_REAGENT_AMOUNT, "AuctionHouseBot.Class.Reagent", 1, 10);
|
||||
SetConfigMax(CONFIG_AHBOT_CLASS_PROJECTILE_AMOUNT, "AuctionHouseBot.Class.Projectile", 2, 10);
|
||||
SetConfigMax(CONFIG_AHBOT_CLASS_TRADEGOOD_AMOUNT, "AuctionHouseBot.Class.TradeGood", 10, 10);
|
||||
SetConfigMax(CONFIG_AHBOT_CLASS_GENERIC_AMOUNT, "AuctionHouseBot.Class.Generic", 1, 10);
|
||||
SetConfigMax(CONFIG_AHBOT_CLASS_RECIPE_AMOUNT, "AuctionHouseBot.Class.Recipe", 6, 10);
|
||||
SetConfigMax(CONFIG_AHBOT_CLASS_QUIVER_AMOUNT, "AuctionHouseBot.Class.Quiver", 1, 10);
|
||||
SetConfigMax(CONFIG_AHBOT_CLASS_QUEST_AMOUNT, "AuctionHouseBot.Class.Quest", 1, 10);
|
||||
SetConfigMax(CONFIG_AHBOT_CLASS_KEY_AMOUNT, "AuctionHouseBot.Class.Key", 1, 10);
|
||||
SetConfigMax(CONFIG_AHBOT_CLASS_MISC_AMOUNT, "AuctionHouseBot.Class.Misc", 5, 10);
|
||||
SetConfigMax(CONFIG_AHBOT_CLASS_GLYPH_AMOUNT, "AuctionHouseBot.Class.Glyph", 3, 10);
|
||||
|
||||
SetConfig(CONFIG_AHBOT_ALLIANCE_PRICE_RATIO, "AuctionHouseBot.Alliance.Price.Ratio", 100);
|
||||
SetConfig(CONFIG_AHBOT_HORDE_PRICE_RATIO, "AuctionHouseBot.Horde.Price.Ratio", 100);
|
||||
SetConfig(CONFIG_AHBOT_NEUTRAL_PRICE_RATIO, "AuctionHouseBot.Neutral.Price.Ratio", 100);
|
||||
|
||||
SetConfig(CONFIG_AHBOT_ITEM_GRAY_PRICE_RATIO, "AuctionHouseBot.Items.Gray.Price.Ratio", 100);
|
||||
SetConfig(CONFIG_AHBOT_ITEM_WHITE_PRICE_RATIO, "AuctionHouseBot.Items.White.Price.Ratio", 100);
|
||||
SetConfig(CONFIG_AHBOT_ITEM_GREEN_PRICE_RATIO, "AuctionHouseBot.Items.Green.Price.Ratio", 100);
|
||||
SetConfig(CONFIG_AHBOT_ITEM_BLUE_PRICE_RATIO, "AuctionHouseBot.Items.Blue.Price.Ratio", 100);
|
||||
SetConfig(CONFIG_AHBOT_ITEM_PURPLE_PRICE_RATIO, "AuctionHouseBot.Items.Purple.Price.Ratio", 100);
|
||||
SetConfig(CONFIG_AHBOT_ITEM_ORANGE_PRICE_RATIO, "AuctionHouseBot.Items.Orange.Price.Ratio", 100);
|
||||
SetConfig(CONFIG_AHBOT_ITEM_YELLOW_PRICE_RATIO, "AuctionHouseBot.Items.Yellow.Price.Ratio", 100);
|
||||
|
||||
SetConfig(CONFIG_AHBOT_CLASS_CONSUMABLE_PRICE_RATIO, "AuctionHouseBot.Class.Consumable.Price.Ratio", 100);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_CONTAINER_PRICE_RATIO, "AuctionHouseBot.Class.Container.Price.Ratio", 100);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_WEAPON_PRICE_RATIO, "AuctionHouseBot.Class.Weapon.Price.Ratio", 100);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_GEM_PRICE_RATIO, "AuctionHouseBot.Class.Gem.Price.Ratio", 100);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_ARMOR_PRICE_RATIO, "AuctionHouseBot.Class.Armor.Price.Ratio", 100);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_REAGENT_PRICE_RATIO, "AuctionHouseBot.Class.Reagent.Price.Ratio", 100);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_PROJECTILE_PRICE_RATIO, "AuctionHouseBot.Class.Projectile.Price.Ratio", 100);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_TRADEGOOD_PRICE_RATIO, "AuctionHouseBot.Class.TradeGood.Price.Ratio", 100);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_GENERIC_PRICE_RATIO, "AuctionHouseBot.Class.Generic.Price.Ratio", 100);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_RECIPE_PRICE_RATIO, "AuctionHouseBot.Class.Recipe.Price.Ratio", 100);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_QUIVER_PRICE_RATIO, "AuctionHouseBot.Class.Quiver.Price.Ratio", 100);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_QUEST_PRICE_RATIO, "AuctionHouseBot.Class.Quest.Price.Ratio", 100);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_KEY_PRICE_RATIO, "AuctionHouseBot.Class.Key.Price.Ratio", 100);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_MISC_PRICE_RATIO, "AuctionHouseBot.Class.Misc.Price.Ratio", 100);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_GLYPH_PRICE_RATIO, "AuctionHouseBot.Class.Glyph.Price.Ratio", 100);
|
||||
|
||||
SetConfig(CONFIG_AHBOT_CLASS_CONSUMABLE_ALLOW_ZERO, "AuctionHouseBot.Class.Consumable.Allow.Zero", false);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_CONTAINER_ALLOW_ZERO, "AuctionHouseBot.Class.Container.Allow.Zero", false);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_WEAPON_ALLOW_ZERO, "AuctionHouseBot.Class.Weapon.Allow.Zero", false);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_GEM_ALLOW_ZERO, "AuctionHouseBot.Class.Gem.Allow.Zero", false);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_ARMOR_ALLOW_ZERO, "AuctionHouseBot.Class.Armor.Allow.Zero", false);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_REAGENT_ALLOW_ZERO, "AuctionHouseBot.Class.Reagent.Allow.Zero", false);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_PROJECTILE_ALLOW_ZERO, "AuctionHouseBot.Class.Projectile.Allow.Zero", false);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_TRADEGOOD_ALLOW_ZERO, "AuctionHouseBot.Class.TradeGood.Allow.Zero", false);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_RECIPE_ALLOW_ZERO, "AuctionHouseBot.Class.Recipe.Allow.Zero", false);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_QUIVER_ALLOW_ZERO, "AuctionHouseBot.Class.Quiver.Allow.Zero", false);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_QUEST_ALLOW_ZERO, "AuctionHouseBot.Class.Quest.Allow.Zero", false);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_KEY_ALLOW_ZERO, "AuctionHouseBot.Class.Key.Allow.Zero", false);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_MISC_ALLOW_ZERO, "AuctionHouseBot.Class.Misc.Allow.Zero", false);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_GLYPH_ALLOW_ZERO, "AuctionHouseBot.Class.Glyph.Allow.Zero", false);
|
||||
|
||||
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_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);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_MISC_MOUNT_MIN_SKILL_RANK, "AuctionHouseBot.Class.Misc.Mount.ReqSkill.Min", 0);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_MISC_MOUNT_MAX_SKILL_RANK, "AuctionHouseBot.Class.Misc.Mount.ReqSkill.Max", 0);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_GLYPH_MIN_REQ_LEVEL, "AuctionHouseBot.Class.Glyph.ReqLevel.Min", 0);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_GLYPH_MAX_REQ_LEVEL, "AuctionHouseBot.Class.Glyph.ReqLevel.Max", 0);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_GLYPH_MIN_ITEM_LEVEL, "AuctionHouseBot.Class.Glyph.ItemLevel.Min", 0);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_GLYPH_MAX_ITEM_LEVEL, "AuctionHouseBot.Class.Glyph.ItemLevel.Max", 0);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_TRADEGOOD_MIN_ITEM_LEVEL, "AuctionHouseBot.Class.TradeGood.ItemLevel.Min", 0);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_TRADEGOOD_MAX_ITEM_LEVEL, "AuctionHouseBot.Class.TradeGood.ItemLevel.Max", 0);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_CONTAINER_MIN_ITEM_LEVEL, "AuctionHouseBot.Class.Container.ItemLevel.Min", 0);
|
||||
SetConfig(CONFIG_AHBOT_CLASS_CONTAINER_MAX_ITEM_LEVEL, "AuctionHouseBot.Class.Container.ItemLevel.Max", 0);
|
||||
}
|
||||
|
||||
char const* AuctionBotConfig::GetHouseTypeName(AuctionHouseType houseType)
|
||||
{
|
||||
static char const* names[MAX_AUCTION_HOUSE_TYPE] = { "Alliance", "Horde", "Neutral" };
|
||||
return names[houseType];
|
||||
}
|
||||
|
||||
uint32 AuctionBotConfig::GetConfigItemAmountRatio(AuctionHouseType houseType) const
|
||||
{
|
||||
switch (houseType)
|
||||
{
|
||||
case AUCTION_HOUSE_ALLIANCE:
|
||||
return GetConfig(CONFIG_AHBOT_ALLIANCE_ITEM_AMOUNT_RATIO);
|
||||
case AUCTION_HOUSE_HORDE:
|
||||
return GetConfig(CONFIG_AHBOT_HORDE_ITEM_AMOUNT_RATIO);
|
||||
default:
|
||||
return GetConfig(CONFIG_AHBOT_NEUTRAL_ITEM_AMOUNT_RATIO);
|
||||
}
|
||||
}
|
||||
|
||||
bool AuctionBotConfig::GetConfigBuyerEnabled(AuctionHouseType houseType) const
|
||||
{
|
||||
switch (houseType)
|
||||
{
|
||||
case AUCTION_HOUSE_ALLIANCE:
|
||||
return GetConfig(CONFIG_AHBOT_BUYER_ALLIANCE_ENABLED);
|
||||
case AUCTION_HOUSE_HORDE:
|
||||
return GetConfig(CONFIG_AHBOT_BUYER_HORDE_ENABLED);
|
||||
default:
|
||||
return GetConfig(CONFIG_AHBOT_BUYER_NEUTRAL_ENABLED);
|
||||
}
|
||||
}
|
||||
|
||||
uint32 AuctionBotConfig::GetConfigItemQualityAmount(AuctionQuality quality) const
|
||||
{
|
||||
switch (quality)
|
||||
{
|
||||
case AUCTION_QUALITY_GRAY:
|
||||
return GetConfig(CONFIG_AHBOT_ITEM_GRAY_AMOUNT);
|
||||
case AUCTION_QUALITY_WHITE:
|
||||
return GetConfig(CONFIG_AHBOT_ITEM_WHITE_AMOUNT);
|
||||
case AUCTION_QUALITY_GREEN:
|
||||
return GetConfig(CONFIG_AHBOT_ITEM_GREEN_AMOUNT);
|
||||
case AUCTION_QUALITY_BLUE:
|
||||
return GetConfig(CONFIG_AHBOT_ITEM_BLUE_AMOUNT);
|
||||
case AUCTION_QUALITY_PURPLE:
|
||||
return GetConfig(CONFIG_AHBOT_ITEM_PURPLE_AMOUNT);
|
||||
case AUCTION_QUALITY_ORANGE:
|
||||
return GetConfig(CONFIG_AHBOT_ITEM_ORANGE_AMOUNT);
|
||||
default:
|
||||
return GetConfig(CONFIG_AHBOT_ITEM_YELLOW_AMOUNT);
|
||||
}
|
||||
}
|
||||
|
||||
AuctionHouseBot::AuctionHouseBot(): _buyer(nullptr), _seller(nullptr), _operationSelector(0)
|
||||
{
|
||||
}
|
||||
|
||||
AuctionHouseBot::~AuctionHouseBot()
|
||||
{
|
||||
delete _buyer;
|
||||
delete _seller;
|
||||
}
|
||||
|
||||
void AuctionHouseBot::InitializeAgents()
|
||||
{
|
||||
if (sAuctionBotConfig->GetConfig(CONFIG_AHBOT_SELLER_ENABLED))
|
||||
{
|
||||
if (_seller)
|
||||
delete _seller;
|
||||
|
||||
_seller = new AuctionBotSeller();
|
||||
if (!_seller->Initialize())
|
||||
{
|
||||
delete _seller;
|
||||
_seller = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYER_ENABLED))
|
||||
{
|
||||
if (_buyer)
|
||||
delete _buyer;
|
||||
|
||||
_buyer = new AuctionBotBuyer();
|
||||
if (!_buyer->Initialize())
|
||||
{
|
||||
delete _buyer;
|
||||
_buyer = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AuctionHouseBot::Initialize()
|
||||
{
|
||||
if (sAuctionBotConfig->Initialize())
|
||||
InitializeAgents();
|
||||
}
|
||||
|
||||
void AuctionHouseBot::SetItemsRatio(uint32 al, uint32 ho, uint32 ne)
|
||||
{
|
||||
if (_seller)
|
||||
_seller->SetItemsRatio(al, ho, ne);
|
||||
}
|
||||
|
||||
void AuctionHouseBot::SetItemsRatioForHouse(AuctionHouseType house, uint32 val)
|
||||
{
|
||||
if (_seller)
|
||||
_seller->SetItemsRatioForHouse(house, val);
|
||||
}
|
||||
|
||||
void AuctionHouseBot::SetItemsAmount(uint32(&vals)[MAX_AUCTION_QUALITY])
|
||||
{
|
||||
if (_seller)
|
||||
_seller->SetItemsAmount(vals);
|
||||
}
|
||||
|
||||
void AuctionHouseBot::SetItemsAmountForQuality(AuctionQuality quality, uint32 val)
|
||||
{
|
||||
if (_seller)
|
||||
_seller->SetItemsAmountForQuality(quality, val);
|
||||
}
|
||||
|
||||
void AuctionHouseBot::ReloadAllConfig()
|
||||
{
|
||||
sAuctionBotConfig->Reload();
|
||||
InitializeAgents();
|
||||
}
|
||||
|
||||
void AuctionHouseBot::PrepareStatusInfos(AuctionHouseBotStatusInfo& statusInfo)
|
||||
{
|
||||
for (uint32 i = 0; i < MAX_AUCTION_HOUSE_TYPE; ++i)
|
||||
{
|
||||
statusInfo[i].ItemsCount = 0;
|
||||
|
||||
for (int j = 0; j < MAX_AUCTION_QUALITY; ++j)
|
||||
statusInfo[i].QualityInfo[j] = 0;
|
||||
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(AuctionHouseType(i));
|
||||
for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = auctionHouse->GetAuctionsBegin(); itr != auctionHouse->GetAuctionsEnd(); ++itr)
|
||||
{
|
||||
AuctionEntry* auctionEntry = itr->second;
|
||||
if (Item* item = sAuctionMgr->GetAItem(auctionEntry->itemGUIDLow))
|
||||
{
|
||||
ItemTemplate const* prototype = item->GetTemplate();
|
||||
if (!auctionEntry->owner) // Add only ahbot items
|
||||
{
|
||||
if (prototype->Quality < MAX_AUCTION_QUALITY)
|
||||
++statusInfo[i].QualityInfo[prototype->Quality];
|
||||
|
||||
++statusInfo[i].ItemsCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AuctionHouseBot::Rebuild(bool all)
|
||||
{
|
||||
for (uint32 i = 0; i < MAX_AUCTION_HOUSE_TYPE; ++i)
|
||||
{
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(AuctionHouseType(i));
|
||||
for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = auctionHouse->GetAuctionsBegin(); itr != auctionHouse->GetAuctionsEnd(); ++itr)
|
||||
if (!itr->second->owner) // ahbot auction
|
||||
if (all || itr->second->bid == 0) // expire now auction if no bid or forced
|
||||
itr->second->expire_time = sWorld->GetGameTime();
|
||||
}
|
||||
}
|
||||
|
||||
void AuctionHouseBot::Update()
|
||||
{
|
||||
// nothing do...
|
||||
if (!_buyer && !_seller)
|
||||
return;
|
||||
|
||||
// scan all possible update cases until first success
|
||||
for (uint32 count = 0; count < 2 * MAX_AUCTION_HOUSE_TYPE; ++count)
|
||||
{
|
||||
bool successStep = false;
|
||||
|
||||
if (_operationSelector < MAX_AUCTION_HOUSE_TYPE)
|
||||
{
|
||||
if (_seller)
|
||||
successStep = _seller->Update(AuctionHouseType(_operationSelector));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_buyer)
|
||||
successStep = _buyer->Update(AuctionHouseType(_operationSelector - MAX_AUCTION_HOUSE_TYPE));
|
||||
}
|
||||
|
||||
++_operationSelector;
|
||||
if (_operationSelector >= 2 * MAX_AUCTION_HOUSE_TYPE)
|
||||
_operationSelector = 0;
|
||||
|
||||
// one success update per call
|
||||
if (successStep)
|
||||
break;
|
||||
}
|
||||
}
|
||||
280
src/server/game/AuctionHouseBot/AuctionHouseBot.h
Normal file
280
src/server/game/AuctionHouseBot/AuctionHouseBot.h
Normal file
@@ -0,0 +1,280 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef AUCTION_HOUSE_BOT_H
|
||||
#define AUCTION_HOUSE_BOT_H
|
||||
|
||||
#include "Define.h"
|
||||
|
||||
class AuctionBotSeller;
|
||||
class AuctionBotBuyer;
|
||||
|
||||
// shadow of ItemQualities with skipped ITEM_QUALITY_HEIRLOOM, anything after ITEM_QUALITY_ARTIFACT(6) in fact
|
||||
enum AuctionQuality
|
||||
{
|
||||
AUCTION_QUALITY_GRAY = ITEM_QUALITY_POOR,
|
||||
AUCTION_QUALITY_WHITE = ITEM_QUALITY_NORMAL,
|
||||
AUCTION_QUALITY_GREEN = ITEM_QUALITY_UNCOMMON,
|
||||
AUCTION_QUALITY_BLUE = ITEM_QUALITY_RARE,
|
||||
AUCTION_QUALITY_PURPLE = ITEM_QUALITY_EPIC,
|
||||
AUCTION_QUALITY_ORANGE = ITEM_QUALITY_LEGENDARY,
|
||||
AUCTION_QUALITY_YELLOW = ITEM_QUALITY_ARTIFACT,
|
||||
};
|
||||
|
||||
#define MAX_AUCTION_QUALITY 7
|
||||
|
||||
enum AuctionHouseType
|
||||
{
|
||||
AUCTION_HOUSE_ALLIANCE = 0,
|
||||
AUCTION_HOUSE_HORDE = 1,
|
||||
AUCTION_HOUSE_NEUTRAL = 2
|
||||
};
|
||||
|
||||
#define MAX_AUCTION_HOUSE_TYPE 3
|
||||
|
||||
enum AuctionBotConfigUInt32Values
|
||||
{
|
||||
CONFIG_AHBOT_MAXTIME,
|
||||
CONFIG_AHBOT_MINTIME,
|
||||
CONFIG_AHBOT_ITEMS_PER_CYCLE_BOOST,
|
||||
CONFIG_AHBOT_ITEMS_PER_CYCLE_NORMAL,
|
||||
CONFIG_AHBOT_ALLIANCE_ITEM_AMOUNT_RATIO,
|
||||
CONFIG_AHBOT_HORDE_ITEM_AMOUNT_RATIO,
|
||||
CONFIG_AHBOT_NEUTRAL_ITEM_AMOUNT_RATIO,
|
||||
CONFIG_AHBOT_ITEM_MIN_ITEM_LEVEL,
|
||||
CONFIG_AHBOT_ITEM_MAX_ITEM_LEVEL,
|
||||
CONFIG_AHBOT_ITEM_MIN_REQ_LEVEL,
|
||||
CONFIG_AHBOT_ITEM_MAX_REQ_LEVEL,
|
||||
CONFIG_AHBOT_ITEM_MIN_SKILL_RANK,
|
||||
CONFIG_AHBOT_ITEM_MAX_SKILL_RANK,
|
||||
CONFIG_AHBOT_ITEM_GRAY_AMOUNT,
|
||||
CONFIG_AHBOT_ITEM_WHITE_AMOUNT,
|
||||
CONFIG_AHBOT_ITEM_GREEN_AMOUNT,
|
||||
CONFIG_AHBOT_ITEM_BLUE_AMOUNT,
|
||||
CONFIG_AHBOT_ITEM_PURPLE_AMOUNT,
|
||||
CONFIG_AHBOT_ITEM_ORANGE_AMOUNT,
|
||||
CONFIG_AHBOT_ITEM_YELLOW_AMOUNT,
|
||||
CONFIG_AHBOT_CLASS_CONSUMABLE_AMOUNT,
|
||||
CONFIG_AHBOT_CLASS_CONTAINER_AMOUNT,
|
||||
CONFIG_AHBOT_CLASS_WEAPON_AMOUNT,
|
||||
CONFIG_AHBOT_CLASS_GEM_AMOUNT,
|
||||
CONFIG_AHBOT_CLASS_ARMOR_AMOUNT,
|
||||
CONFIG_AHBOT_CLASS_REAGENT_AMOUNT,
|
||||
CONFIG_AHBOT_CLASS_PROJECTILE_AMOUNT,
|
||||
CONFIG_AHBOT_CLASS_TRADEGOOD_AMOUNT,
|
||||
CONFIG_AHBOT_CLASS_GENERIC_AMOUNT,
|
||||
CONFIG_AHBOT_CLASS_RECIPE_AMOUNT,
|
||||
CONFIG_AHBOT_CLASS_QUIVER_AMOUNT,
|
||||
CONFIG_AHBOT_CLASS_QUEST_AMOUNT,
|
||||
CONFIG_AHBOT_CLASS_KEY_AMOUNT,
|
||||
CONFIG_AHBOT_CLASS_MISC_AMOUNT,
|
||||
CONFIG_AHBOT_CLASS_GLYPH_AMOUNT,
|
||||
CONFIG_AHBOT_ALLIANCE_PRICE_RATIO,
|
||||
CONFIG_AHBOT_HORDE_PRICE_RATIO,
|
||||
CONFIG_AHBOT_NEUTRAL_PRICE_RATIO,
|
||||
CONFIG_AHBOT_ITEM_GRAY_PRICE_RATIO,
|
||||
CONFIG_AHBOT_ITEM_WHITE_PRICE_RATIO,
|
||||
CONFIG_AHBOT_ITEM_GREEN_PRICE_RATIO,
|
||||
CONFIG_AHBOT_ITEM_BLUE_PRICE_RATIO,
|
||||
CONFIG_AHBOT_ITEM_PURPLE_PRICE_RATIO,
|
||||
CONFIG_AHBOT_ITEM_ORANGE_PRICE_RATIO,
|
||||
CONFIG_AHBOT_ITEM_YELLOW_PRICE_RATIO,
|
||||
CONFIG_AHBOT_CLASS_CONSUMABLE_PRICE_RATIO,
|
||||
CONFIG_AHBOT_CLASS_CONTAINER_PRICE_RATIO,
|
||||
CONFIG_AHBOT_CLASS_WEAPON_PRICE_RATIO,
|
||||
CONFIG_AHBOT_CLASS_GEM_PRICE_RATIO,
|
||||
CONFIG_AHBOT_CLASS_ARMOR_PRICE_RATIO,
|
||||
CONFIG_AHBOT_CLASS_REAGENT_PRICE_RATIO,
|
||||
CONFIG_AHBOT_CLASS_PROJECTILE_PRICE_RATIO,
|
||||
CONFIG_AHBOT_CLASS_TRADEGOOD_PRICE_RATIO,
|
||||
CONFIG_AHBOT_CLASS_GENERIC_PRICE_RATIO,
|
||||
CONFIG_AHBOT_CLASS_RECIPE_PRICE_RATIO,
|
||||
CONFIG_AHBOT_CLASS_MONEY_PRICE_RATIO,
|
||||
CONFIG_AHBOT_CLASS_QUIVER_PRICE_RATIO,
|
||||
CONFIG_AHBOT_CLASS_QUEST_PRICE_RATIO,
|
||||
CONFIG_AHBOT_CLASS_KEY_PRICE_RATIO,
|
||||
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_CLASS_MISC_MOUNT_MIN_REQ_LEVEL,
|
||||
CONFIG_AHBOT_CLASS_MISC_MOUNT_MAX_REQ_LEVEL,
|
||||
CONFIG_AHBOT_CLASS_MISC_MOUNT_MIN_SKILL_RANK,
|
||||
CONFIG_AHBOT_CLASS_MISC_MOUNT_MAX_SKILL_RANK,
|
||||
CONFIG_AHBOT_CLASS_GLYPH_MIN_REQ_LEVEL,
|
||||
CONFIG_AHBOT_CLASS_GLYPH_MAX_REQ_LEVEL,
|
||||
CONFIG_AHBOT_CLASS_GLYPH_MIN_ITEM_LEVEL,
|
||||
CONFIG_AHBOT_CLASS_GLYPH_MAX_ITEM_LEVEL,
|
||||
CONFIG_AHBOT_CLASS_TRADEGOOD_MIN_ITEM_LEVEL,
|
||||
CONFIG_AHBOT_CLASS_TRADEGOOD_MAX_ITEM_LEVEL,
|
||||
CONFIG_AHBOT_CLASS_CONTAINER_MIN_ITEM_LEVEL,
|
||||
CONFIG_AHBOT_CLASS_CONTAINER_MAX_ITEM_LEVEL,
|
||||
CONFIG_UINT32_AHBOT_UINT32_COUNT
|
||||
};
|
||||
|
||||
enum AuctionBotConfigBoolValues
|
||||
{
|
||||
CONFIG_AHBOT_BUYER_ALLIANCE_ENABLED,
|
||||
CONFIG_AHBOT_BUYER_HORDE_ENABLED,
|
||||
CONFIG_AHBOT_BUYER_NEUTRAL_ENABLED,
|
||||
CONFIG_AHBOT_ITEMS_VENDOR,
|
||||
CONFIG_AHBOT_ITEMS_LOOT,
|
||||
CONFIG_AHBOT_ITEMS_MISC,
|
||||
CONFIG_AHBOT_BIND_NO,
|
||||
CONFIG_AHBOT_BIND_PICKUP,
|
||||
CONFIG_AHBOT_BIND_EQUIP,
|
||||
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,
|
||||
CONFIG_AHBOT_CLASS_CONSUMABLE_ALLOW_ZERO,
|
||||
CONFIG_AHBOT_CLASS_CONTAINER_ALLOW_ZERO,
|
||||
CONFIG_AHBOT_CLASS_WEAPON_ALLOW_ZERO,
|
||||
CONFIG_AHBOT_CLASS_GEM_ALLOW_ZERO,
|
||||
CONFIG_AHBOT_CLASS_ARMOR_ALLOW_ZERO,
|
||||
CONFIG_AHBOT_CLASS_REAGENT_ALLOW_ZERO,
|
||||
CONFIG_AHBOT_CLASS_PROJECTILE_ALLOW_ZERO,
|
||||
CONFIG_AHBOT_CLASS_TRADEGOOD_ALLOW_ZERO,
|
||||
CONFIG_AHBOT_CLASS_RECIPE_ALLOW_ZERO,
|
||||
CONFIG_AHBOT_CLASS_QUIVER_ALLOW_ZERO,
|
||||
CONFIG_AHBOT_CLASS_QUEST_ALLOW_ZERO,
|
||||
CONFIG_AHBOT_CLASS_KEY_ALLOW_ZERO,
|
||||
CONFIG_AHBOT_CLASS_MISC_ALLOW_ZERO,
|
||||
CONFIG_AHBOT_CLASS_GLYPH_ALLOW_ZERO,
|
||||
CONFIG_UINT32_AHBOT_BOOL_COUNT
|
||||
};
|
||||
|
||||
// All basic config data used by other AHBot classes for self-configure.
|
||||
class AuctionBotConfig
|
||||
{
|
||||
private:
|
||||
AuctionBotConfig() {}
|
||||
~AuctionBotConfig() {}
|
||||
AuctionBotConfig(const AuctionBotConfig&);
|
||||
AuctionBotConfig& operator=(const AuctionBotConfig&);
|
||||
|
||||
public:
|
||||
static AuctionBotConfig* instance()
|
||||
{
|
||||
static AuctionBotConfig instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
bool Initialize();
|
||||
const std::string& GetAHBotIncludes() const { return _AHBotIncludes; }
|
||||
const std::string& GetAHBotExcludes() const { return _AHBotExcludes; }
|
||||
|
||||
uint32 GetConfig(AuctionBotConfigUInt32Values index) const { return _configUint32Values[index]; }
|
||||
bool GetConfig(AuctionBotConfigBoolValues index) const { return _configBoolValues[index]; }
|
||||
void SetConfig(AuctionBotConfigBoolValues index, bool value) { _configBoolValues[index] = value; }
|
||||
void SetConfig(AuctionBotConfigUInt32Values index, uint32 value) { _configUint32Values[index] = value; }
|
||||
|
||||
uint32 GetConfigItemAmountRatio(AuctionHouseType houseType) const;
|
||||
bool GetConfigBuyerEnabled(AuctionHouseType houseType) const;
|
||||
uint32 GetConfigItemQualityAmount(AuctionQuality quality) const;
|
||||
|
||||
uint32 GetItemPerCycleBoost() const { return _itemsPerCycleBoost; }
|
||||
uint32 GetItemPerCycleNormal() const { return _itemsPerCycleNormal; }
|
||||
void Reload() { GetConfigFromFile(); }
|
||||
|
||||
static char const* GetHouseTypeName(AuctionHouseType houseType);
|
||||
|
||||
private:
|
||||
std::string _AHBotIncludes;
|
||||
std::string _AHBotExcludes;
|
||||
uint32 _itemsPerCycleBoost;
|
||||
uint32 _itemsPerCycleNormal;
|
||||
|
||||
uint32 _configUint32Values[CONFIG_UINT32_AHBOT_UINT32_COUNT];
|
||||
bool _configBoolValues[CONFIG_UINT32_AHBOT_BOOL_COUNT];
|
||||
|
||||
void SetAHBotIncludes(const std::string& AHBotIncludes) { _AHBotIncludes = AHBotIncludes; }
|
||||
void SetAHBotExcludes(const std::string& AHBotExcludes) { _AHBotExcludes = AHBotExcludes; }
|
||||
|
||||
void SetConfig(AuctionBotConfigUInt32Values index, char const* fieldname, uint32 defvalue);
|
||||
void SetConfigMax(AuctionBotConfigUInt32Values index, char const* fieldname, uint32 defvalue, uint32 maxvalue);
|
||||
void SetConfigMinMax(AuctionBotConfigUInt32Values index, char const* fieldname, uint32 defvalue, uint32 minvalue, uint32 maxvalue);
|
||||
void SetConfig(AuctionBotConfigBoolValues index, char const* fieldname, bool defvalue);
|
||||
void GetConfigFromFile();
|
||||
};
|
||||
|
||||
#define sAuctionBotConfig AuctionBotConfig::instance()
|
||||
|
||||
class AuctionBotAgent
|
||||
{
|
||||
public:
|
||||
AuctionBotAgent() {}
|
||||
virtual ~AuctionBotAgent() {}
|
||||
virtual bool Initialize() = 0;
|
||||
virtual bool Update(AuctionHouseType houseType) = 0;
|
||||
};
|
||||
|
||||
struct AuctionHouseBotStatusInfoPerType
|
||||
{
|
||||
uint32 ItemsCount;
|
||||
uint32 QualityInfo[MAX_AUCTION_QUALITY];
|
||||
};
|
||||
|
||||
typedef AuctionHouseBotStatusInfoPerType AuctionHouseBotStatusInfo[MAX_AUCTION_HOUSE_TYPE];
|
||||
|
||||
// This class handle both Selling and Buying method
|
||||
// (holder of AuctionBotBuyer and AuctionBotSeller objects)
|
||||
class AuctionHouseBot
|
||||
{
|
||||
private:
|
||||
AuctionHouseBot();
|
||||
~AuctionHouseBot();
|
||||
AuctionHouseBot(const AuctionHouseBot&);
|
||||
AuctionHouseBot& operator=(const AuctionHouseBot&);
|
||||
|
||||
public:
|
||||
static AuctionHouseBot* instance()
|
||||
{
|
||||
static AuctionHouseBot instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void Update();
|
||||
void Initialize();
|
||||
|
||||
// Followed method is mainly used by cs_ahbot.cpp for in-game/console command
|
||||
void SetItemsRatio(uint32 al, uint32 ho, uint32 ne);
|
||||
void SetItemsRatioForHouse(AuctionHouseType house, uint32 val);
|
||||
void SetItemsAmount(uint32(&vals)[MAX_AUCTION_QUALITY]);
|
||||
void SetItemsAmountForQuality(AuctionQuality quality, uint32 val);
|
||||
void ReloadAllConfig();
|
||||
void Rebuild(bool all);
|
||||
|
||||
void PrepareStatusInfos(AuctionHouseBotStatusInfo& statusInfo);
|
||||
private:
|
||||
void InitializeAgents();
|
||||
|
||||
AuctionBotBuyer* _buyer;
|
||||
AuctionBotSeller* _seller;
|
||||
|
||||
uint32 _operationSelector; // 0..2*MAX_AUCTION_HOUSE_TYPE-1
|
||||
};
|
||||
|
||||
#define sAuctionBot AuctionHouseBot::instance()
|
||||
|
||||
#endif
|
||||
432
src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp
Normal file
432
src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp
Normal file
@@ -0,0 +1,432 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Log.h"
|
||||
#include "Item.h"
|
||||
#include "ItemPrototype.h"
|
||||
#include "AuctionHouseBotBuyer.h"
|
||||
|
||||
AuctionBotBuyer::AuctionBotBuyer()
|
||||
{
|
||||
// Define faction for our main data class.
|
||||
for (int i = 0; i < MAX_AUCTION_HOUSE_TYPE; ++i)
|
||||
_houseConfig[i].Initialize(AuctionHouseType(i));
|
||||
}
|
||||
|
||||
AuctionBotBuyer::~AuctionBotBuyer()
|
||||
{
|
||||
}
|
||||
|
||||
bool AuctionBotBuyer::Initialize()
|
||||
{
|
||||
LoadConfig();
|
||||
|
||||
bool activeHouse = false;
|
||||
for (int i = 0; i < MAX_AUCTION_HOUSE_TYPE; ++i)
|
||||
{
|
||||
if (_houseConfig[i].BuyerEnabled)
|
||||
{
|
||||
activeHouse = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!activeHouse)
|
||||
return false;
|
||||
|
||||
//load Check interval
|
||||
_checkInterval = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYER_RECHECK_INTERVAL) * MINUTE;
|
||||
TC_LOG_INFO("ahbot", "AHBot buyer interval between 2 check = %u", _checkInterval);
|
||||
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)
|
||||
{
|
||||
_houseConfig[i].BuyerEnabled = sAuctionBotConfig->GetConfigBuyerEnabled(AuctionHouseType(i));
|
||||
if (_houseConfig[i].BuyerEnabled)
|
||||
LoadBuyerValues(_houseConfig[i]);
|
||||
}
|
||||
}
|
||||
|
||||
uint32 AuctionBotBuyer::GetBuyableEntry(BuyerConfiguration& config)
|
||||
{
|
||||
config.SameItemInfo.clear();
|
||||
uint32 count = 0;
|
||||
time_t now = time(nullptr);
|
||||
|
||||
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)
|
||||
{
|
||||
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();
|
||||
|
||||
if (!entry->owner)
|
||||
{
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TC_LOG_INFO("ahbot", "AHBot: %u items added to buyable vector for ah type: %u", count, config.GetHouseType());
|
||||
TC_LOG_INFO("ahbot", "AHBot: SameItemInfo size = %u", (uint32)config.SameItemInfo.size());
|
||||
return count;
|
||||
}
|
||||
|
||||
void AuctionBotBuyer::PrepareListOfEntry(BuyerConfiguration& config)
|
||||
{
|
||||
time_t now = time(nullptr) - 5;
|
||||
|
||||
for (CheckEntryMap::iterator itr = config.CheckedEntry.begin(); itr != config.CheckedEntry.end();)
|
||||
{
|
||||
if (itr->second.LastExist < (now - 5))
|
||||
config.CheckedEntry.erase(itr++);
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
|
||||
TC_LOG_INFO("ahbot", "AHBot: CheckedEntry size = %u", (uint32)config.CheckedEntry.size());
|
||||
}
|
||||
|
||||
bool AuctionBotBuyer::IsBuyableEntry(uint32 buyoutPrice, double inGameBuyPrice, double maxBuyablePrice, uint32 minBuyPrice, uint32 maxChance, uint32 chanceRatio)
|
||||
{
|
||||
double ratio = 0;
|
||||
uint32 chance = 0;
|
||||
|
||||
if (buyoutPrice <= minBuyPrice)
|
||||
{
|
||||
if (buyoutPrice <= maxBuyablePrice)
|
||||
chance = maxChance;
|
||||
else
|
||||
{
|
||||
|
||||
if (buyoutPrice > 0 && maxBuyablePrice > 0)
|
||||
{
|
||||
ratio = buyoutPrice / 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 = buyoutPrice / 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 = buyoutPrice / maxBuyablePrice;
|
||||
if (ratio < 10)
|
||||
chance = (maxChance / 5) - (ratio* maxChance / 50);
|
||||
else
|
||||
chance = 0;
|
||||
}
|
||||
else
|
||||
chance = 0;
|
||||
}
|
||||
|
||||
if (urand(1, chanceRatio) <= chance)
|
||||
{
|
||||
TC_LOG_INFO("ahbot", "AHBot: WIN BUY! Chance = %u, num = %u.", chance, chanceRatio);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TC_LOG_INFO("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_INFO("ahbot", "AHBot: WIN BID! Chance = %u, num = %u.", chance, chanceRatio);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TC_LOG_INFO("ahbot", "AHBot: LOOSE BID! Chance = %u, num = %u.", chance, chanceRatio);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void AuctionBotBuyer::PlaceBidToEntry(AuctionEntry* auction, uint32 bidPrice)
|
||||
{
|
||||
TC_LOG_INFO("ahbot", "AHBot: Bid placed to entry %u, %.2fg", auction->Id, float(bidPrice) / 10000.0f);
|
||||
auction->bid = bidPrice;
|
||||
}
|
||||
|
||||
void AuctionBotBuyer::BuyEntry(AuctionEntry* auction)
|
||||
{
|
||||
TC_LOG_INFO("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())
|
||||
{
|
||||
buyCycles = sAuctionBotConfig->GetItemPerCycleBoost();
|
||||
TC_LOG_INFO("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();)
|
||||
{
|
||||
AuctionEntry* auction = auctionHouse->GetAuction(itr->second.AuctionId);
|
||||
if (!auction) // is auction not active now
|
||||
{
|
||||
TC_LOG_INFO("ahbot", "AHBot: Entry %u on ah %u doesn't exists, perhaps bought already?",
|
||||
itr->second.AuctionId, auction->GetHouseId());
|
||||
|
||||
config.CheckedEntry.erase(itr++);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (itr->second.LastChecked != 0 && (now - itr->second.LastChecked) <= _checkInterval)
|
||||
{
|
||||
TC_LOG_INFO("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
|
||||
{
|
||||
config.CheckedEntry.erase(itr++);
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemTemplate const* prototype = item->GetTemplate();
|
||||
|
||||
uint32 basePrice = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYPRICE_BUYER) ? prototype->BuyPrice : prototype->SellPrice;
|
||||
basePrice *= item->GetCount();
|
||||
|
||||
double maxBuyablePrice = (basePrice * config.BuyerPriceRatio) / 100;
|
||||
BuyerItemInfoMap::iterator sameItemItr = config.SameItemInfo.find(item->GetEntry());
|
||||
uint32 buyoutPrice = auction->buyout / item->GetCount();
|
||||
|
||||
uint32 bidPrice;
|
||||
uint32 bidPriceByItem;
|
||||
if (auction->bid >= auction->startbid)
|
||||
{
|
||||
bidPrice = auction->GetAuctionOutBid();
|
||||
bidPriceByItem = auction->bid / item->GetCount();
|
||||
}
|
||||
else
|
||||
{
|
||||
bidPrice = auction->startbid;
|
||||
bidPriceByItem = auction->startbid / item->GetCount();
|
||||
}
|
||||
|
||||
double inGameBuyPrice;
|
||||
double inGameBidPrice;
|
||||
if (sameItemItr == config.SameItemInfo.end())
|
||||
{
|
||||
inGameBuyPrice = 0;
|
||||
inGameBidPrice = 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;
|
||||
}
|
||||
|
||||
double maxBidablePrice = maxBuyablePrice - (maxBuyablePrice / 30); // Max Bidable price defined to 70% of max buyable price
|
||||
|
||||
TC_LOG_INFO("ahbot", "AHBot: Auction added with data:");
|
||||
TC_LOG_INFO("ahbot", "AHBot: MaxPrice of Entry %u is %.1fg.", itr->second.AuctionId, maxBuyablePrice / 10000);
|
||||
TC_LOG_INFO("ahbot", "AHBot: GamePrice buy=%.1fg, bid=%.1fg.", inGameBuyPrice / 10000, inGameBidPrice / 10000);
|
||||
TC_LOG_INFO("ahbot", "AHBot: Minimal price see in AH Buy=%ug, Bid=%ug.",
|
||||
sameItemItr->second.MinBuyPrice / 10000, sameItemItr->second.MinBidPrice / 10000);
|
||||
TC_LOG_INFO("ahbot", "AHBot: Actual Entry price, Buy=%ug, Bid=%ug.", buyoutPrice / 10000, bidPrice / 10000);
|
||||
|
||||
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, sameItemItr->second.MinBuyPrice, maxChance, config.FactionChance))
|
||||
{
|
||||
if (IsBidableEntry(bidPriceByItem, inGameBuyPrice, maxBidablePrice, sameItemItr->second.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, sameItemItr->second.MinBidPrice, maxChance / 2, config.FactionChance))
|
||||
PlaceBidToEntry(auction, bidPrice);
|
||||
}
|
||||
else if (IsBidableEntry(bidPriceByItem, inGameBuyPrice, maxBidablePrice, sameItemItr->second.MinBidPrice, maxChance, config.FactionChance))
|
||||
PlaceBidToEntry(auction, bidPrice);
|
||||
|
||||
itr->second.LastChecked = now;
|
||||
--buyCycles;
|
||||
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
|
||||
bool AuctionBotBuyer::Update(AuctionHouseType houseType)
|
||||
{
|
||||
if (sAuctionBotConfig->GetConfigBuyerEnabled(houseType))
|
||||
{
|
||||
TC_LOG_INFO("ahbot", "AHBot: %s buying ...", AuctionBotConfig::GetHouseTypeName(houseType));
|
||||
if (GetBuyableEntry(_houseConfig[houseType]) > 0)
|
||||
AddNewAuctionBuyerBotBid(_houseConfig[houseType]);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
96
src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.h
Normal file
96
src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.h
Normal file
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef AUCTION_HOUSE_BOT_BUYER_H
|
||||
#define AUCTION_HOUSE_BOT_BUYER_H
|
||||
|
||||
#include "Define.h"
|
||||
#include "AuctionHouseMgr.h"
|
||||
#include "AuctionHouseBot.h"
|
||||
|
||||
struct BuyerAuctionEval
|
||||
{
|
||||
BuyerAuctionEval(): AuctionId(0), LastChecked(0), LastExist(0) {}
|
||||
|
||||
uint32 AuctionId;
|
||||
time_t LastChecked;
|
||||
time_t LastExist;
|
||||
};
|
||||
|
||||
struct BuyerItemInfo
|
||||
{
|
||||
BuyerItemInfo(): ItemCount(0), BuyPrice(0), BidPrice(0), MinBuyPrice(0), MinBidPrice(0) {}
|
||||
|
||||
uint32 ItemCount;
|
||||
double BuyPrice;
|
||||
double BidPrice;
|
||||
uint32 MinBuyPrice;
|
||||
uint32 MinBidPrice;
|
||||
};
|
||||
|
||||
typedef std::map<uint32, BuyerItemInfo> BuyerItemInfoMap;
|
||||
typedef std::map<uint32, BuyerAuctionEval> CheckEntryMap;
|
||||
|
||||
struct BuyerConfiguration
|
||||
{
|
||||
BuyerConfiguration(): _houseType(AUCTION_HOUSE_NEUTRAL) {}
|
||||
|
||||
void Initialize(AuctionHouseType houseType)
|
||||
{
|
||||
_houseType = houseType;
|
||||
}
|
||||
|
||||
AuctionHouseType GetHouseType() const { return _houseType; }
|
||||
|
||||
BuyerItemInfoMap SameItemInfo;
|
||||
CheckEntryMap CheckedEntry;
|
||||
uint32 FactionChance;
|
||||
bool BuyerEnabled;
|
||||
uint32 BuyerPriceRatio;
|
||||
|
||||
private:
|
||||
AuctionHouseType _houseType;
|
||||
};
|
||||
|
||||
// This class handle all Buyer method
|
||||
// (holder of AuctionBotConfig for each auction house type)
|
||||
class AuctionBotBuyer : public AuctionBotAgent
|
||||
{
|
||||
public:
|
||||
AuctionBotBuyer();
|
||||
~AuctionBotBuyer() override;
|
||||
|
||||
bool Initialize() override;
|
||||
bool Update(AuctionHouseType houseType) override;
|
||||
|
||||
void LoadConfig();
|
||||
void AddNewAuctionBuyerBotBid(BuyerConfiguration& config);
|
||||
|
||||
private:
|
||||
uint32 _checkInterval;
|
||||
BuyerConfiguration _houseConfig[MAX_AUCTION_HOUSE_TYPE];
|
||||
|
||||
void LoadBuyerValues(BuyerConfiguration& config);
|
||||
bool IsBuyableEntry(uint32 buyoutPrice, double inGameBuyPrice, double maxBuyablePrice, uint32 minBuyPrice, uint32 maxChance, uint32 chanceRatio);
|
||||
bool IsBidableEntry(uint32 bidPrice, double inGameBuyPrice, double maxBidablePrice, uint32 minBidPrice, uint32 maxChance, uint32 chanceRatio);
|
||||
void PlaceBidToEntry(AuctionEntry* auction, uint32 bidPrice);
|
||||
void BuyEntry(AuctionEntry* auction);
|
||||
void PrepareListOfEntry(BuyerConfiguration& config);
|
||||
uint32 GetBuyableEntry(BuyerConfiguration& config);
|
||||
};
|
||||
|
||||
#endif
|
||||
1029
src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp
Normal file
1029
src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp
Normal file
File diff suppressed because it is too large
Load Diff
147
src/server/game/AuctionHouseBot/AuctionHouseBotSeller.h
Normal file
147
src/server/game/AuctionHouseBot/AuctionHouseBotSeller.h
Normal file
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef AUCTION_HOUSE_BOT_SELLER_H
|
||||
#define AUCTION_HOUSE_BOT_SELLER_H
|
||||
|
||||
#include "Define.h"
|
||||
#include "ItemPrototype.h"
|
||||
#include "AuctionHouseBot.h"
|
||||
|
||||
struct ItemToSell
|
||||
{
|
||||
uint32 Color;
|
||||
uint32 Itemclass;
|
||||
};
|
||||
|
||||
typedef std::vector<ItemToSell> ItemsToSellArray;
|
||||
typedef std::vector<std::vector<uint32>> AllItemsArray;
|
||||
|
||||
struct SellerItemClassInfo
|
||||
{
|
||||
SellerItemClassInfo(): AmountOfItems(0), MissItems(0), Quantity(0), PriceRatio(0) {}
|
||||
|
||||
uint32 AmountOfItems;
|
||||
uint32 MissItems;
|
||||
uint32 Quantity;
|
||||
uint32 PriceRatio;
|
||||
};
|
||||
|
||||
struct SellerItemInfo
|
||||
{
|
||||
SellerItemInfo(): AmountOfItems(0), MissItems(0), PriceRatio(0) {}
|
||||
|
||||
uint32 AmountOfItems;
|
||||
uint32 MissItems;
|
||||
uint32 PriceRatio;
|
||||
|
||||
SellerItemClassInfo ItemClassInfos[MAX_ITEM_CLASS];
|
||||
};
|
||||
|
||||
class SellerConfiguration
|
||||
{
|
||||
public:
|
||||
SellerConfiguration(): _houseType(AUCTION_HOUSE_NEUTRAL)
|
||||
{
|
||||
}
|
||||
|
||||
~SellerConfiguration() {}
|
||||
|
||||
void Initialize(AuctionHouseType houseType)
|
||||
{
|
||||
_houseType = houseType;
|
||||
}
|
||||
|
||||
AuctionHouseType GetHouseType() const { return _houseType; }
|
||||
|
||||
uint32 LastMissedItem;
|
||||
|
||||
void SetMinTime(uint32 value)
|
||||
{
|
||||
_minTime = value;
|
||||
}
|
||||
uint32 GetMinTime() const
|
||||
{
|
||||
return std::min(1u, std::min(_minTime, _maxTime));
|
||||
}
|
||||
|
||||
void SetMaxTime(uint32 value) { _maxTime = value; }
|
||||
uint32 GetMaxTime() const { return _maxTime; }
|
||||
// Data access classified by item class and item quality
|
||||
void SetItemsAmountPerClass(AuctionQuality quality, ItemClass itemclass, uint32 amount) { _ItemInfo[quality].ItemClassInfos[itemclass].AmountOfItems = amount * _ItemInfo[quality].ItemClassInfos[itemclass].Quantity; }
|
||||
uint32 GetItemsAmountPerClass(AuctionQuality quality, ItemClass itemclass) const { return _ItemInfo[quality].ItemClassInfos[itemclass].AmountOfItems; }
|
||||
void SetItemsQuantityPerClass(AuctionQuality quality, ItemClass itemclass, uint32 qty) { _ItemInfo[quality].ItemClassInfos[itemclass].Quantity = qty; }
|
||||
uint32 GetItemsQuantityPerClass(AuctionQuality quality, ItemClass itemclass) const { return _ItemInfo[quality].ItemClassInfos[itemclass].Quantity; }
|
||||
void SetMissedItemsPerClass(AuctionQuality quality, ItemClass itemclass, uint32 found)
|
||||
{
|
||||
if (_ItemInfo[quality].ItemClassInfos[itemclass].AmountOfItems > found)
|
||||
_ItemInfo[quality].ItemClassInfos[itemclass].MissItems = _ItemInfo[quality].ItemClassInfos[itemclass].AmountOfItems - found;
|
||||
else
|
||||
_ItemInfo[quality].ItemClassInfos[itemclass].MissItems = 0;
|
||||
}
|
||||
uint32 GetMissedItemsPerClass(AuctionQuality quality, ItemClass itemclass) const { return _ItemInfo[quality].ItemClassInfos[itemclass].MissItems; }
|
||||
|
||||
// Data for every quality of item
|
||||
void SetItemsAmountPerQuality(AuctionQuality quality, uint32 cnt) { _ItemInfo[quality].AmountOfItems = cnt; }
|
||||
uint32 GetItemsAmountPerQuality(AuctionQuality quality) const { return _ItemInfo[quality].AmountOfItems; }
|
||||
void SetPriceRatioPerQuality(AuctionQuality quality, uint32 value) { _ItemInfo[quality].PriceRatio = value; }
|
||||
uint32 GetPriceRatioPerQuality(AuctionQuality quality) const { return _ItemInfo[quality].PriceRatio; }
|
||||
void SetPriceRatioPerClass(ItemClass item, uint32 value) { _ItemInfo[0].ItemClassInfos[item].PriceRatio = value; }
|
||||
uint32 GetPriceRatioPerClass(ItemClass item) const { return _ItemInfo[0].ItemClassInfos[item].PriceRatio; }
|
||||
|
||||
private:
|
||||
AuctionHouseType _houseType;
|
||||
uint32 _minTime;
|
||||
uint32 _maxTime;
|
||||
SellerItemInfo _ItemInfo[MAX_AUCTION_QUALITY];
|
||||
};
|
||||
|
||||
// This class handle all Selling method
|
||||
// (holder of AHB_Seller_Config data for each auction house type)
|
||||
class AuctionBotSeller : public AuctionBotAgent
|
||||
{
|
||||
public:
|
||||
typedef std::vector<uint32> ItemPool;
|
||||
|
||||
AuctionBotSeller();
|
||||
~AuctionBotSeller() override;
|
||||
|
||||
bool Initialize() override;
|
||||
bool Update(AuctionHouseType houseType) override;
|
||||
|
||||
void AddNewAuctions(SellerConfiguration& config);
|
||||
void SetItemsRatio(uint32 al, uint32 ho, uint32 ne);
|
||||
void SetItemsRatioForHouse(AuctionHouseType house, uint32 val);
|
||||
void SetItemsAmount(uint32(&vals)[MAX_AUCTION_QUALITY]);
|
||||
void SetItemsAmountForQuality(AuctionQuality quality, uint32 val);
|
||||
void LoadConfig();
|
||||
|
||||
private:
|
||||
SellerConfiguration _houseConfig[MAX_AUCTION_HOUSE_TYPE];
|
||||
|
||||
ItemPool _itemPool[MAX_AUCTION_QUALITY][MAX_ITEM_CLASS];
|
||||
|
||||
void LoadSellerValues(SellerConfiguration& config);
|
||||
uint32 SetStat(SellerConfiguration& config);
|
||||
bool GetItemsToSell(SellerConfiguration& config, ItemsToSellArray& itemsToSellArray, AllItemsArray const& addedItem);
|
||||
void SetPricesOfItem(ItemTemplate const* itemProto, SellerConfiguration& config, uint32& buyp, uint32& bidp, uint32 stackcnt);
|
||||
void LoadItemsQuantity(SellerConfiguration& config);
|
||||
static uint32 GetBuyModifier(ItemTemplate const* prototype);
|
||||
static uint32 GetSellModifier(ItemTemplate const* itemProto);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -13,6 +13,7 @@ file(GLOB_RECURSE sources_Achievements Achievements/*.cpp Achievements/*.h)
|
||||
file(GLOB_RECURSE sources_Addons Addons/*.cpp Addons/*.h)
|
||||
file(GLOB_RECURSE sources_AI AI/*.cpp AI/*.h)
|
||||
file(GLOB_RECURSE sources_AuctionHouse AuctionHouse/*.cpp AuctionHouse/*.h)
|
||||
file(GLOB_RECURSE sources_AuctionHouseBot AuctionHouseBot/*.cpp AuctionHouseBot/*.h)
|
||||
file(GLOB_RECURSE sources_Battlefield Battlefield/*.cpp Battlefield/*.h)
|
||||
file(GLOB_RECURSE sources_Battlegrounds Battlegrounds/*.cpp Battlegrounds/*.h)
|
||||
file(GLOB_RECURSE sources_Calendar Calendar/*.cpp Calendar/*.h)
|
||||
@@ -63,6 +64,7 @@ set(game_STAT_SRCS
|
||||
${sources_Addons}
|
||||
${sources_AI}
|
||||
${sources_AuctionHouse}
|
||||
${sources_AuctionHouseBot}
|
||||
${sources_Battlefield}
|
||||
${sources_Battlegrounds}
|
||||
${sources_Calendar}
|
||||
@@ -136,6 +138,7 @@ include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/AI/ScriptedAI
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/AI/SmartScripts
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/AuctionHouse
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/AuctionHouseBot
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Battlefield
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Battlefield/Zones
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Battlegrounds
|
||||
|
||||
@@ -655,8 +655,11 @@ void Item::SetState(ItemUpdateState state, Player* forplayer)
|
||||
if (uState == ITEM_NEW && state == ITEM_REMOVED)
|
||||
{
|
||||
// pretend the item never existed
|
||||
RemoveFromUpdateQueueOf(forplayer);
|
||||
forplayer->DeleteRefundReference(GetGUIDLow());
|
||||
if (forplayer)
|
||||
{
|
||||
RemoveFromUpdateQueueOf(forplayer);
|
||||
forplayer->DeleteRefundReference(GetGUIDLow());
|
||||
}
|
||||
delete this;
|
||||
return;
|
||||
}
|
||||
@@ -666,7 +669,8 @@ void Item::SetState(ItemUpdateState state, Player* forplayer)
|
||||
if (uState != ITEM_NEW)
|
||||
uState = state;
|
||||
|
||||
AddToUpdateQueueOf(forplayer);
|
||||
if (forplayer)
|
||||
AddToUpdateQueueOf(forplayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -950,7 +950,27 @@ enum TrinityStrings
|
||||
LANG_LIST_MAIL_INFO_3 = 1154,
|
||||
LANG_LIST_MAIL_INFO_ITEM = 1155,
|
||||
LANG_LIST_MAIL_NOT_FOUND = 1156,
|
||||
// Room for more level 3 1157-1199 not used
|
||||
LANG_AHBOT_RELOAD_OK = 1157,
|
||||
LANG_AHBOT_STATUS_BAR_CONSOLE = 1158,
|
||||
LANG_AHBOT_STATUS_MIDBAR_CONSOLE = 1159,
|
||||
LANG_AHBOT_STATUS_TITLE1_CONSOLE = 1160,
|
||||
LANG_AHBOT_STATUS_TITLE1_CHAT = 1161,
|
||||
LANG_AHBOT_STATUS_FORMAT_CONSOLE = 1162,
|
||||
LANG_AHBOT_STATUS_FORMAT_CHAT = 1163,
|
||||
LANG_AHBOT_STATUS_ITEM_COUNT = 1164,
|
||||
LANG_AHBOT_STATUS_ITEM_RATIO = 1165,
|
||||
LANG_AHBOT_STATUS_TITLE2_CONSOLE = 1166,
|
||||
LANG_AHBOT_STATUS_TITLE2_CHAT = 1167,
|
||||
LANG_AHBOT_QUALITY_GRAY = 1168,
|
||||
LANG_AHBOT_QUALITY_WHITE = 1169,
|
||||
LANG_AHBOT_QUALITY_GREEN = 1170,
|
||||
LANG_AHBOT_QUALITY_BLUE = 1171,
|
||||
LANG_AHBOT_QUALITY_PURPLE = 1172,
|
||||
LANG_AHBOT_QUALITY_ORANGE = 1173,
|
||||
LANG_AHBOT_QUALITY_YELLOW = 1174,
|
||||
LANG_AHBOT_ITEMS_AMOUNT = 1175,
|
||||
LANG_AHBOT_ITEMS_RATIO = 1176,
|
||||
// Room for more level 3 1177-1199 not used
|
||||
|
||||
// Debug commands
|
||||
LANG_CINEMATIC_NOT_EXIST = 1200,
|
||||
|
||||
@@ -47,6 +47,7 @@ void AddSC_SmartScripts();
|
||||
//Commands
|
||||
void AddSC_account_commandscript();
|
||||
void AddSC_achievement_commandscript();
|
||||
void AddSC_ahbot_commandscript();
|
||||
void AddSC_arena_commandscript();
|
||||
void AddSC_ban_commandscript();
|
||||
void AddSC_battlenet_account_commandscript();
|
||||
@@ -757,6 +758,7 @@ void AddCommandScripts()
|
||||
{
|
||||
AddSC_account_commandscript();
|
||||
AddSC_achievement_commandscript();
|
||||
AddSC_ahbot_commandscript();
|
||||
AddSC_arena_commandscript();
|
||||
AddSC_ban_commandscript();
|
||||
AddSC_battlenet_account_commandscript();
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "World.h"
|
||||
#include "AchievementMgr.h"
|
||||
#include "ArenaTeamMgr.h"
|
||||
#include "AuctionHouseBot.h"
|
||||
#include "AuctionHouseMgr.h"
|
||||
#include "BattlefieldMgr.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
@@ -1297,6 +1298,9 @@ void World::LoadConfigSettings(bool reload)
|
||||
|
||||
m_bool_configs[CONFIG_IP_BASED_ACTION_LOGGING] = sConfigMgr->GetBoolDefault("Allow.IP.Based.Action.Logging", false);
|
||||
|
||||
// AHBot
|
||||
m_int_configs[CONFIG_AHBOT_UPDATE_INTERVAL] = sConfigMgr->GetIntDefault("AuctionHouseBot.Update.Interval", 20);
|
||||
|
||||
// call ScriptMgr if we're reloading the configuration
|
||||
if (reload)
|
||||
sScriptMgr->OnConfigLoad(reload);
|
||||
@@ -1801,6 +1805,9 @@ void World::SetInitialWorldSettings()
|
||||
m_timers[WUPDATE_AUTOBROADCAST].SetInterval(getIntConfig(CONFIG_AUTOBROADCAST_INTERVAL));
|
||||
m_timers[WUPDATE_DELETECHARS].SetInterval(DAY*IN_MILLISECONDS); // check for chars to delete every day
|
||||
|
||||
// for AhBot
|
||||
m_timers[WUPDATE_AHBOT].SetInterval(getIntConfig(CONFIG_AHBOT_UPDATE_INTERVAL) * IN_MILLISECONDS); // every 20 sec
|
||||
|
||||
m_timers[WUPDATE_PINGDB].SetInterval(getIntConfig(CONFIG_DB_PING_INTERVAL)*MINUTE*IN_MILLISECONDS); // Mysql ping time in minutes
|
||||
|
||||
m_timers[WUPDATE_GUILDSAVE].SetInterval(getIntConfig(CONFIG_GUILD_SAVE_INTERVAL) * MINUTE * IN_MILLISECONDS);
|
||||
@@ -1830,6 +1837,9 @@ void World::SetInitialWorldSettings()
|
||||
// Delete all characters which have been deleted X days before
|
||||
Player::DeleteOldCharacters();
|
||||
|
||||
TC_LOG_INFO("server.loading", "Initialize AuctionHouseBot...");
|
||||
sAuctionBot->Initialize();
|
||||
|
||||
// Delete all custom channels which haven't been used for PreserveCustomChannelDuration days.
|
||||
Channel::CleanOldChannelsInDB();
|
||||
|
||||
@@ -2033,6 +2043,13 @@ void World::Update(uint32 diff)
|
||||
sAuctionMgr->Update();
|
||||
}
|
||||
|
||||
/// <li> Handle AHBot operations
|
||||
if (m_timers[WUPDATE_AHBOT].Passed())
|
||||
{
|
||||
sAuctionBot->Update();
|
||||
m_timers[WUPDATE_AHBOT].Reset();
|
||||
}
|
||||
|
||||
/// <li> Handle session updates when the timer has passed
|
||||
RecordTimeDiff(NULL);
|
||||
UpdateSessions(diff);
|
||||
|
||||
@@ -84,6 +84,7 @@ enum WorldTimers
|
||||
WUPDATE_AUTOBROADCAST,
|
||||
WUPDATE_MAILBOXQUEUE,
|
||||
WUPDATE_DELETECHARS,
|
||||
WUPDATE_AHBOT,
|
||||
WUPDATE_PINGDB,
|
||||
WUPDATE_GUILDSAVE,
|
||||
WUPDATE_COUNT
|
||||
@@ -349,6 +350,7 @@ enum WorldIntConfigs
|
||||
CONFIG_BG_REWARD_WINNER_CONQUEST_FIRST,
|
||||
CONFIG_BG_REWARD_WINNER_CONQUEST_LAST,
|
||||
CONFIG_CREATURE_PICKPOCKET_REFILL,
|
||||
CONFIG_AHBOT_UPDATE_INTERVAL,
|
||||
INT_CONFIG_VALUE_COUNT
|
||||
};
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ include_directories(
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/AI/ScriptedAI
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/AI/SmartScripts
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouseBot
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Battlefield
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Battlefield/Zones
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds
|
||||
|
||||
251
src/server/scripts/Commands/cs_ahbot.cpp
Normal file
251
src/server/scripts/Commands/cs_ahbot.cpp
Normal file
@@ -0,0 +1,251 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "Language.h"
|
||||
#include "AuctionHouseBot.h"
|
||||
|
||||
static const uint32 ahbotQualityIds[MAX_AUCTION_QUALITY] =
|
||||
{
|
||||
LANG_AHBOT_QUALITY_GRAY, LANG_AHBOT_QUALITY_WHITE,
|
||||
LANG_AHBOT_QUALITY_GREEN, LANG_AHBOT_QUALITY_BLUE,
|
||||
LANG_AHBOT_QUALITY_PURPLE, LANG_AHBOT_QUALITY_ORANGE,
|
||||
LANG_AHBOT_QUALITY_YELLOW
|
||||
};
|
||||
|
||||
class ahbot_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
ahbot_commandscript(): CommandScript("ahbot_commandscript") {}
|
||||
|
||||
ChatCommand* GetCommands() const
|
||||
{
|
||||
static ChatCommand ahbotItemsAmountCommandTable[] =
|
||||
{
|
||||
{ "gray", rbac::RBAC_PERM_COMMAND_AHBOT_ITEMS_GRAY, true, &HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_GRAY>, "", NULL },
|
||||
{ "white", rbac::RBAC_PERM_COMMAND_AHBOT_ITEMS_WHITE, true, &HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_WHITE>, "", NULL },
|
||||
{ "green", rbac::RBAC_PERM_COMMAND_AHBOT_ITEMS_GREEN, true, &HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_GREEN>, "", NULL },
|
||||
{ "blue", rbac::RBAC_PERM_COMMAND_AHBOT_ITEMS_BLUE, true, &HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_BLUE>, "", NULL },
|
||||
{ "purple", rbac::RBAC_PERM_COMMAND_AHBOT_ITEMS_PURPLE, true, &HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_PURPLE>, "", NULL },
|
||||
{ "orange", rbac::RBAC_PERM_COMMAND_AHBOT_ITEMS_ORANGE, true, &HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_ORANGE>, "", NULL },
|
||||
{ "yellow", rbac::RBAC_PERM_COMMAND_AHBOT_ITEMS_YELLOW, true, &HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_YELLOW>, "", NULL },
|
||||
{ "", rbac::RBAC_PERM_COMMAND_AHBOT_ITEMS, true, &HandleAHBotItemsAmountCommand, "", NULL },
|
||||
{ NULL, 0, true, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand ahbotItemsRatioCommandTable[] =
|
||||
{
|
||||
{ "alliance", rbac::RBAC_PERM_COMMAND_AHBOT_RATIO_ALLIANCE, true, &HandleAHBotItemsRatioHouseCommand<AUCTION_HOUSE_ALLIANCE>, "", NULL },
|
||||
{ "horde", rbac::RBAC_PERM_COMMAND_AHBOT_RATIO_HORDE, true, &HandleAHBotItemsRatioHouseCommand<AUCTION_HOUSE_HORDE>, "", NULL },
|
||||
{ "neutral", rbac::RBAC_PERM_COMMAND_AHBOT_RATIO_NEUTRAL, true, &HandleAHBotItemsRatioHouseCommand<AUCTION_HOUSE_NEUTRAL>, "", NULL },
|
||||
{ "", rbac::RBAC_PERM_COMMAND_AHBOT_RATIO, true, &HandleAHBotItemsRatioCommand, "", NULL },
|
||||
{ NULL, 0, true, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand ahbotCommandTable[] =
|
||||
{
|
||||
{ "items", rbac::RBAC_PERM_COMMAND_AHBOT_ITEMS, true, NULL, "", ahbotItemsAmountCommandTable },
|
||||
{ "ratio", rbac::RBAC_PERM_COMMAND_AHBOT_RATIO, true, NULL, "", ahbotItemsRatioCommandTable },
|
||||
{ "rebuild", rbac::RBAC_PERM_COMMAND_AHBOT_REBUILD, true, &HandleAHBotRebuildCommand, "", NULL },
|
||||
{ "reload", rbac::RBAC_PERM_COMMAND_AHBOT_RELOAD, true, &HandleAHBotReloadCommand, "", NULL },
|
||||
{ "status", rbac::RBAC_PERM_COMMAND_AHBOT_STATUS, true, &HandleAHBotStatusCommand, "", NULL },
|
||||
{ NULL, 0, true, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand commandTable[] =
|
||||
{
|
||||
{ "ahbot", rbac::RBAC_PERM_COMMAND_AHBOT, false, NULL, "", ahbotCommandTable },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
static bool HandleAHBotItemsAmountCommand(ChatHandler* handler, const char* args)
|
||||
{
|
||||
uint32 qVals[MAX_AUCTION_QUALITY];
|
||||
char* arg = strtok((char*)args, " ");
|
||||
for (int i = 0; i < MAX_AUCTION_QUALITY; ++i)
|
||||
{
|
||||
if (!arg)
|
||||
return false;
|
||||
qVals[i] = atoi(arg);
|
||||
arg = strtok(NULL, " ");
|
||||
}
|
||||
|
||||
sAuctionBot->SetItemsAmount(qVals);
|
||||
|
||||
for (int i = 0; i < MAX_AUCTION_QUALITY; ++i)
|
||||
handler->PSendSysMessage(LANG_AHBOT_ITEMS_AMOUNT, handler->GetTrinityString(ahbotQualityIds[i]), sAuctionBotConfig->GetConfigItemQualityAmount(AuctionQuality(i)));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <AuctionQuality Q>
|
||||
static bool HandleAHBotItemsAmountQualityCommand(ChatHandler* handler, const char* args)
|
||||
{
|
||||
char* arg = strtok((char*)args, " ");
|
||||
if (!arg)
|
||||
return false;
|
||||
uint32 qualityVal = atoi(arg);
|
||||
|
||||
sAuctionBot->SetItemsAmountForQuality(Q, qualityVal);
|
||||
handler->PSendSysMessage(LANG_AHBOT_ITEMS_AMOUNT, handler->GetTrinityString(ahbotQualityIds[Q]),
|
||||
sAuctionBotConfig->GetConfigItemQualityAmount(Q));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleAHBotItemsRatioCommand(ChatHandler* handler, const char* args)
|
||||
{
|
||||
uint32 rVal[MAX_AUCTION_QUALITY];
|
||||
char* arg = strtok((char*)args, " ");
|
||||
for (int i = 0; i < MAX_AUCTION_QUALITY; ++i)
|
||||
{
|
||||
if (!arg)
|
||||
return false;
|
||||
rVal[i] = atoi(arg);
|
||||
arg = strtok(NULL, " ");
|
||||
}
|
||||
|
||||
sAuctionBot->SetItemsRatio(rVal[0], rVal[1], rVal[2]);
|
||||
|
||||
for (int i = 0; i < MAX_AUCTION_HOUSE_TYPE; ++i)
|
||||
handler->PSendSysMessage(LANG_AHBOT_ITEMS_RATIO, AuctionBotConfig::GetHouseTypeName(AuctionHouseType(i)), sAuctionBotConfig->GetConfigItemAmountRatio(AuctionHouseType(i)));
|
||||
return true;
|
||||
}
|
||||
|
||||
template<AuctionHouseType H>
|
||||
static bool HandleAHBotItemsRatioHouseCommand(ChatHandler* handler, const char* args)
|
||||
{
|
||||
char* arg = strtok((char*)args, " ");
|
||||
if (!arg)
|
||||
return false;
|
||||
uint32 ratioVal = atoi(arg);
|
||||
|
||||
sAuctionBot->SetItemsRatioForHouse(H, ratioVal);
|
||||
handler->PSendSysMessage(LANG_AHBOT_ITEMS_RATIO, AuctionBotConfig::GetHouseTypeName(H), sAuctionBotConfig->GetConfigItemAmountRatio(H));
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleAHBotRebuildCommand(ChatHandler* /*handler*/, const char* args)
|
||||
{
|
||||
char* arg = strtok((char*)args, " ");
|
||||
if (!arg)
|
||||
return false;
|
||||
|
||||
bool all = false;
|
||||
if (strcmp(arg, "all") == 0)
|
||||
all = true;
|
||||
|
||||
sAuctionBot->Rebuild(all);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleAHBotReloadCommand(ChatHandler* handler, const char* /*args*/)
|
||||
{
|
||||
sAuctionBot->ReloadAllConfig();
|
||||
handler->SendSysMessage(LANG_AHBOT_RELOAD_OK);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleAHBotStatusCommand(ChatHandler* handler, const char* args)
|
||||
{
|
||||
char* arg = strtok((char*)args, " ");
|
||||
if (!arg)
|
||||
return false;
|
||||
|
||||
bool all = false;
|
||||
if (strcmp(arg, "all") == 0)
|
||||
all = true;
|
||||
|
||||
AuctionHouseBotStatusInfo statusInfo;
|
||||
sAuctionBot->PrepareStatusInfos(statusInfo);
|
||||
|
||||
WorldSession* session = handler->GetSession();
|
||||
|
||||
if (!session)
|
||||
{
|
||||
handler->SendSysMessage(LANG_AHBOT_STATUS_BAR_CONSOLE);
|
||||
handler->SendSysMessage(LANG_AHBOT_STATUS_TITLE1_CONSOLE);
|
||||
handler->SendSysMessage(LANG_AHBOT_STATUS_MIDBAR_CONSOLE);
|
||||
}
|
||||
else
|
||||
handler->SendSysMessage(LANG_AHBOT_STATUS_TITLE1_CHAT);
|
||||
|
||||
uint32 fmtId = session ? LANG_AHBOT_STATUS_FORMAT_CHAT : LANG_AHBOT_STATUS_FORMAT_CONSOLE;
|
||||
|
||||
handler->PSendSysMessage(fmtId, handler->GetTrinityString(LANG_AHBOT_STATUS_ITEM_COUNT),
|
||||
statusInfo[AUCTION_HOUSE_ALLIANCE].ItemsCount,
|
||||
statusInfo[AUCTION_HOUSE_HORDE].ItemsCount,
|
||||
statusInfo[AUCTION_HOUSE_NEUTRAL].ItemsCount,
|
||||
statusInfo[AUCTION_HOUSE_ALLIANCE].ItemsCount +
|
||||
statusInfo[AUCTION_HOUSE_HORDE].ItemsCount +
|
||||
statusInfo[AUCTION_HOUSE_NEUTRAL].ItemsCount);
|
||||
|
||||
if (all)
|
||||
{
|
||||
handler->PSendSysMessage(fmtId, handler->GetTrinityString(LANG_AHBOT_STATUS_ITEM_RATIO),
|
||||
sAuctionBotConfig->GetConfig(CONFIG_AHBOT_ALLIANCE_ITEM_AMOUNT_RATIO),
|
||||
sAuctionBotConfig->GetConfig(CONFIG_AHBOT_HORDE_ITEM_AMOUNT_RATIO),
|
||||
sAuctionBotConfig->GetConfig(CONFIG_AHBOT_NEUTRAL_ITEM_AMOUNT_RATIO),
|
||||
sAuctionBotConfig->GetConfig(CONFIG_AHBOT_ALLIANCE_ITEM_AMOUNT_RATIO) +
|
||||
sAuctionBotConfig->GetConfig(CONFIG_AHBOT_HORDE_ITEM_AMOUNT_RATIO) +
|
||||
sAuctionBotConfig->GetConfig(CONFIG_AHBOT_NEUTRAL_ITEM_AMOUNT_RATIO));
|
||||
|
||||
if (!session)
|
||||
{
|
||||
handler->SendSysMessage(LANG_AHBOT_STATUS_BAR_CONSOLE);
|
||||
handler->SendSysMessage(LANG_AHBOT_STATUS_TITLE2_CONSOLE);
|
||||
handler->SendSysMessage(LANG_AHBOT_STATUS_MIDBAR_CONSOLE);
|
||||
}
|
||||
else
|
||||
handler->SendSysMessage(LANG_AHBOT_STATUS_TITLE2_CHAT);
|
||||
|
||||
for (int i = 0; i < MAX_AUCTION_QUALITY; ++i)
|
||||
handler->PSendSysMessage(fmtId, handler->GetTrinityString(ahbotQualityIds[i]),
|
||||
statusInfo[AUCTION_HOUSE_ALLIANCE].QualityInfo[i],
|
||||
statusInfo[AUCTION_HOUSE_HORDE].QualityInfo[i],
|
||||
statusInfo[AUCTION_HOUSE_NEUTRAL].QualityInfo[i],
|
||||
sAuctionBotConfig->GetConfigItemQualityAmount(AuctionQuality(i)));
|
||||
}
|
||||
|
||||
if (!session)
|
||||
handler->SendSysMessage(LANG_AHBOT_STATUS_BAR_CONSOLE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template bool ahbot_commandscript::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_GRAY>(ChatHandler* handler, const char*);
|
||||
template bool ahbot_commandscript::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_WHITE>(ChatHandler* handler, const char*);
|
||||
template bool ahbot_commandscript::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_GREEN>(ChatHandler* handler, const char*);
|
||||
template bool ahbot_commandscript::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_BLUE>(ChatHandler* handler, const char*);
|
||||
template bool ahbot_commandscript::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_PURPLE>(ChatHandler* handler, const char*);
|
||||
template bool ahbot_commandscript::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_ORANGE>(ChatHandler* handler, const char*);
|
||||
template bool ahbot_commandscript::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_YELLOW>(ChatHandler* handler, const char*);
|
||||
|
||||
template bool ahbot_commandscript::HandleAHBotItemsRatioHouseCommand<AUCTION_HOUSE_ALLIANCE>(ChatHandler* handler, const char*);
|
||||
template bool ahbot_commandscript::HandleAHBotItemsRatioHouseCommand<AUCTION_HOUSE_HORDE>(ChatHandler* handler, const char*);
|
||||
template bool ahbot_commandscript::HandleAHBotItemsRatioHouseCommand<AUCTION_HOUSE_NEUTRAL>(ChatHandler* handler, const char*);
|
||||
|
||||
void AddSC_ahbot_commandscript()
|
||||
{
|
||||
new ahbot_commandscript();
|
||||
}
|
||||
@@ -2598,6 +2598,358 @@ UI.ShowQuestLevelsInDialogs = 0
|
||||
#
|
||||
###################################################################################################
|
||||
|
||||
###################################
|
||||
# Auction House Bot Configuration #
|
||||
###################################
|
||||
|
||||
###################################################################################################################
|
||||
# AUCTION HOUSE BOT SETTINGS
|
||||
#
|
||||
# AuctionHouseBot.Update.Interval
|
||||
# Description: Interval in seconds for AHBot to get updated
|
||||
# Default: 20
|
||||
#
|
||||
|
||||
AuctionHouseBot.Update.Interval = 20
|
||||
|
||||
#
|
||||
# AuctionHouseBot.Seller.Enabled
|
||||
# Description: General enable or disable AuctionHouseBot Seller functionality
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
AuctionHouseBot.Seller.Enabled = 0
|
||||
|
||||
#
|
||||
# AuctionHouseBot.Alliance.Items.Amount.Ratio
|
||||
# Description: Enable/Disable (disabled if 0) the part of AHBot that puts items up for auction on Alliance AH
|
||||
# Default: 100 - (Enabled with 100% of items specified in AuctionHouse.Items.Amount.color section)
|
||||
|
||||
AuctionHouseBot.Alliance.Items.Amount.Ratio = 100
|
||||
|
||||
#
|
||||
# AuctionHouseBot.Horde.Items.Amount.Ratio
|
||||
# Enable/Disable (disabled if 0) the part of AHBot that puts items up for auction on Horde AH
|
||||
# Default: 100 (Enabled with 100% of items specified in AuctionHouse.Items.Amount.color section)
|
||||
|
||||
AuctionHouseBot.Horde.Items.Amount.Ratio = 100
|
||||
|
||||
#
|
||||
# AuctionHouseBot.Neutral.Items.Amount.Ratio
|
||||
# Description: Enable/Disable (disabled if 0) the part of AHBot that puts items up for auction on Neutral AH
|
||||
# Default: 100 - (Enabled with 100% of items specified in AuctionHouse.Items.Amount.color section)
|
||||
|
||||
AuctionHouseBot.Neutral.Items.Amount.Ratio = 100
|
||||
|
||||
#
|
||||
# AuctionHouseBot.MinTime
|
||||
# Description: Minimum time for the new auction in hours
|
||||
# Default: 1 - (Hour)
|
||||
|
||||
AuctionHouseBot.MinTime = 1
|
||||
|
||||
#
|
||||
# AuctionHouseBot.MaxTime
|
||||
# Description: Maximum time for the new auction in hours
|
||||
# Default: 72 - (Hours)
|
||||
|
||||
AuctionHouseBot.MaxTime = 72
|
||||
|
||||
#
|
||||
# AuctionHouseBot.Items.Vendor
|
||||
# Description: Include items that can be bought from vendors.
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
AuctionHouseBot.Items.Vendor = 0
|
||||
|
||||
#
|
||||
# AuctionHouseBot.Items.Loot
|
||||
# Description: Include items that can be looted or fished for.
|
||||
# Default: 1 - (Enabled)
|
||||
# 0 - (Disabled)
|
||||
|
||||
AuctionHouseBot.Items.Loot = 1
|
||||
|
||||
#
|
||||
# AuctionHouseBot.Items.Misc
|
||||
# Description: Include misc. items.
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
AuctionHouseBot.Items.Misc = 0
|
||||
|
||||
#
|
||||
# AuctionHouseBot.Bind.*
|
||||
# Description: Indicates which bonding types to allow the bot to put up for auction
|
||||
# No - Items that don't bind Default 1 (Allowed)
|
||||
# Pickup - Items that bind on pickup Default 0 (Not Allowed)
|
||||
# Equip - Items that bind on equip Default 1 (Allowed)
|
||||
# Use - Items that bind on use Default 1 (Allowed)
|
||||
# Quest - Quest Items Default 0 (Not Allowed)
|
||||
# Values: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
AuctionHouseBot.Bind.No = 1
|
||||
AuctionHouseBot.Bind.Pickup = 0
|
||||
AuctionHouseBot.Bind.Equip = 1
|
||||
AuctionHouseBot.Bind.Use = 1
|
||||
AuctionHouseBot.Bind.Quest = 0
|
||||
|
||||
#
|
||||
# AuctionHouseBot.LockBox.Enabled
|
||||
# Description: Enable or not lockbox in auctionhouse
|
||||
# Default 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
AuctionHouseBot.LockBox.Enabled = 0
|
||||
|
||||
#
|
||||
# AuctionHouseBot.ItemsPerCycle.Boost
|
||||
# Description: This value is used to fill DB faster than normal when there is more than this value on missed items (not auctioned items).
|
||||
# Normaly this value is only used once on server start with empty auction table.
|
||||
# Default: 1000
|
||||
|
||||
AuctionHouseBot.ItemsPerCycle.Boost = 1000
|
||||
|
||||
#
|
||||
# AuctionHouseBot.ItemsPerCycle.Normal
|
||||
# Description: This value is used to fill DB with way with less cpu/db using.
|
||||
# Normaly this value is used always when auction table is already initialised.
|
||||
# Default: 20
|
||||
|
||||
AuctionHouseBot.ItemsPerCycle.Normal = 20
|
||||
|
||||
#
|
||||
# AuctionHouseBot.BuyPrice.Seller
|
||||
# Description: Should the Seller use BuyPrice or SellPrice to determine Bid Prices
|
||||
# Default: 1 - (use SellPrice)
|
||||
# 0 - (use BuyPrice)
|
||||
|
||||
AuctionHouseBot.BuyPrice.Seller = 1
|
||||
|
||||
#
|
||||
# AuctionHouseBot.Alliance.Price.Ratio
|
||||
# Description: Percentage by which the price of items selled on Alliance Auction House is incremented / decreased
|
||||
# Default: 100 - (Not modify)
|
||||
|
||||
AuctionHouseBot.Alliance.Price.Ratio = 100
|
||||
|
||||
#
|
||||
# AuctionHouseBot.Horde.Price.Ratio
|
||||
# Description: Percentage by which the price of items selled on Horde Auction House is incremented / decreased
|
||||
# Default: 100 - (Not modify)
|
||||
|
||||
AuctionHouseBot.Horde.Price.Ratio = 100
|
||||
|
||||
#
|
||||
# AuctionHouseBot.Neutral.Price.Ratio
|
||||
# Description: Percentage by which the price of items selled on Neutral Auction House is incremented / decreased
|
||||
# Default: 100 - (Not modify)
|
||||
|
||||
AuctionHouseBot.Neutral.Price.Ratio = 100
|
||||
|
||||
#
|
||||
# AuctionHouseBot.Items.ItemLevel.*
|
||||
# Description: Prevent seller from listing items below/above this item level
|
||||
# Default: 0 - (Disabled)
|
||||
# 1-80 (Levels)
|
||||
|
||||
AuctionHouseBot.Items.ItemLevel.Min = 0
|
||||
AuctionHouseBot.Items.ItemLevel.Max = 0
|
||||
|
||||
#
|
||||
# AuctionHouseBot.Items.ReqLevel.*
|
||||
# Prevent seller from listing items below/above this required level
|
||||
# Default: - 0 (Disabled)
|
||||
|
||||
AuctionHouseBot.Items.ReqLevel.Min = 0
|
||||
AuctionHouseBot.Items.ReqLevel.Max = 0
|
||||
|
||||
#
|
||||
# AuctionHouseBot.Items.ReqSkill.*
|
||||
# Description: Prevent seller from listing items below/above this skill level
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
AuctionHouseBot.Items.ReqSkill.Min = 0
|
||||
AuctionHouseBot.Items.ReqSkill.Max = 0
|
||||
|
||||
#
|
||||
# AuctionHouseBot.Items.Amount.*
|
||||
# Description: Define here for every item qualities how many items you want to be shown in Auction House
|
||||
# This value will be adjusted by AuctionHouseBot.FACTION.Items.Amount.Ratio to define the exact amount of
|
||||
# items that will finally be shown on Auction House
|
||||
# Default: 0, 2000, 2500, 1500, 1000, 0, 0 (Gray, white, green, blue, purple, orange, yellow)
|
||||
|
||||
AuctionHouseBot.Items.Amount.Gray = 0
|
||||
AuctionHouseBot.Items.Amount.White = 2000
|
||||
AuctionHouseBot.Items.Amount.Green = 2500
|
||||
AuctionHouseBot.Items.Amount.Blue = 1500
|
||||
AuctionHouseBot.Items.Amount.Purple = 1000
|
||||
AuctionHouseBot.Items.Amount.Orange = 0
|
||||
AuctionHouseBot.Items.Amount.Yellow = 0
|
||||
|
||||
#
|
||||
# AustionHouseBot.Class.*
|
||||
# Description: Here you can set the class of items you prefer to be show on AH
|
||||
# These value are sorted by preference, from 0 (disabled) to 10 (max. preference)
|
||||
# Default: Consumable: 6
|
||||
# Container: 4
|
||||
# Weapon: 8
|
||||
# Gem: 3
|
||||
# Armor: 8
|
||||
# Reagent: 1
|
||||
# Projectile: 2
|
||||
# TradeGod: 10
|
||||
# Generic: 1
|
||||
# Recipe: 6
|
||||
# Quiver: 1
|
||||
# Quest: 1
|
||||
# Key: 1
|
||||
# Misc: 5
|
||||
# Glyph: 3
|
||||
|
||||
AuctionHouseBot.Class.Consumable = 6
|
||||
AuctionHouseBot.Class.Container = 4
|
||||
AuctionHouseBot.Class.Weapon = 8
|
||||
AuctionHouseBot.Class.Gem = 3
|
||||
AuctionHouseBot.Class.Armor = 8
|
||||
AuctionHouseBot.Class.Reagent = 1
|
||||
AuctionHouseBot.Class.Projectile = 2
|
||||
AuctionHouseBot.Class.TradeGood = 10
|
||||
AuctionHouseBot.Class.Generic = 1
|
||||
AuctionHouseBot.Class.Recipe = 6
|
||||
AuctionHouseBot.Class.Quiver = 1
|
||||
AuctionHouseBot.Class.Quest = 1
|
||||
AuctionHouseBot.Class.Key = 1
|
||||
AuctionHouseBot.Class.Misc = 5
|
||||
AuctionHouseBot.Class.Glyph = 3
|
||||
|
||||
###################################################################################################################
|
||||
#
|
||||
# AHBot ITEM FINE TUNING
|
||||
# The following are usefull for limiting what character levels can
|
||||
# benefit from the auction house
|
||||
#
|
||||
# AuctionHouseBot.Class.Misc.Mount.ReqLevel.*
|
||||
# Description: Prevent seller from listing mounts below/above this required level
|
||||
# Default: 0
|
||||
|
||||
AuctionHouseBot.Class.Misc.Mount.ReqLevel.Min = 0
|
||||
AuctionHouseBot.Class.Misc.Mount.ReqLevel.Max = 0
|
||||
|
||||
#
|
||||
# AuctionHouseBot.Class.Misc.Mount.ReqSkill.*
|
||||
# Description: Prevent seller from listing mounts below/above this skill level
|
||||
# Default: 0
|
||||
|
||||
AuctionHouseBot.Class.Misc.Mount.ReqSkill.Min = 0
|
||||
AuctionHouseBot.Class.Misc.Mount.ReqSkill.Max = 0
|
||||
|
||||
#
|
||||
# AuctionHouseBot.Class.Glyph.ReqLevel.*
|
||||
# Description: Prevent seller from listing glyphs below/above this required level
|
||||
# Default: 0
|
||||
|
||||
AuctionHouseBot.Class.Glyph.ReqLevel.Min = 0
|
||||
AuctionHouseBot.Class.Glyph.ReqLevel.Max = 0
|
||||
|
||||
#
|
||||
# AuctionHouseBot.Class.Glyph.ItemLevel.*
|
||||
# Description: Prevent seller from listing glyphs below/above this item level
|
||||
# Default: 0
|
||||
|
||||
AuctionHouseBot.Class.Glyph.ItemLevel.Min = 0
|
||||
AuctionHouseBot.Class.Glyph.ItemLevel.Max = 0
|
||||
|
||||
#
|
||||
# AuctionHouseBot.Class.TradeGood.ItemLevel.*
|
||||
# Description: Prevent seller from listing trade good items below/above this item level
|
||||
# Default: 0
|
||||
|
||||
AuctionHouseBot.Class.TradeGood.ItemLevel.Min = 0
|
||||
AuctionHouseBot.Class.TradeGood.ItemLevel.Max = 0
|
||||
|
||||
#
|
||||
# AuctionHouseBot.Class.Container.ItemLevel.*
|
||||
# Description: Prevent seller from listing contianers below/above this item level
|
||||
# Default: 0
|
||||
|
||||
AuctionHouseBot.Class.Container.ItemLevel.Min = 0
|
||||
AuctionHouseBot.Class.Container.ItemLevel.Max = 0
|
||||
|
||||
#
|
||||
# AuctionHouseBot.forceIncludeItems
|
||||
# Description: Include these items and ignore ALL filters
|
||||
# List of ids with delimiter ','
|
||||
# Default: ""
|
||||
|
||||
AuctionHouseBot.forceIncludeItems = ""
|
||||
|
||||
#
|
||||
# AuctionHouseBot.forceExcludeItems
|
||||
# Description: Exclude these items even if they would pass the filters
|
||||
# List of ids with delimiter ','
|
||||
# Example: "21878,27774,27811,28117,28122,43949" (this removes old items)
|
||||
# Default: ""
|
||||
#
|
||||
|
||||
AuctionHouseBot.forceExcludeItems = ""
|
||||
|
||||
#
|
||||
###################################################################################################################
|
||||
|
||||
###################################################################################################################
|
||||
# AHBot Buyer config
|
||||
#
|
||||
# AuctionHouseBot.Buyer.Enabled
|
||||
# Description: General enable or disable AuctionHouseBot Buyer functionality
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
AuctionHouseBot.Buyer.Enabled = 0
|
||||
|
||||
#
|
||||
# AuctionHouseBot.Buyer.FACTION.Enabled
|
||||
# Description: Enable or disable buyer independently by faction
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
AuctionHouseBot.Buyer.Alliance.Enabled = 0
|
||||
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.Buyprice = 1
|
||||
|
||||
#
|
||||
# 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.
|
||||
# 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
|
||||
|
||||
#
|
||||
###################################################################################################################
|
||||
|
||||
###################################################################################################
|
||||
# LOGGING SYSTEM SETTINGS
|
||||
#
|
||||
@@ -2694,6 +3046,7 @@ Logger.commands.gm=3,Console GM
|
||||
Logger.sql.sql=5,Console DBErrors
|
||||
|
||||
#Logger.achievement=3,Console Server
|
||||
#Logger.ahbot=3,Console Server
|
||||
#Logger.auctionHouse=3,Console Server
|
||||
#Logger.bg.arena=3,Console Server
|
||||
#Logger.bg.battlefield=3,Console Server
|
||||
|
||||
Reference in New Issue
Block a user