[11731] AHBot chat/console commands.

Originaly provided in ahbot patch but havy rewrited.
This commit is contained in:
VladimirMangos 2011-07-10 06:01:29 +04:00
parent 8e48e44c22
commit 0cbb8e311e
11 changed files with 418 additions and 39 deletions

View file

@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
`version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL,
`cache_id` int(10) default '0',
`required_11717_01_mangos_spell_proc_event` bit(1) default NULL
`required_11731_02_mangos_mangos_string` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
--
@ -504,6 +504,21 @@ INSERT INTO `command` VALUES
('achievement criteria remove',3,'Syntax: .achievement criteria remove $playername #criteriaid #change\r\n\r\necrease progress for criteria at #change for selected player in game or by player name. If #chnage not provided then criteria progress reset to 0.'),
('additem',3,'Syntax: .additem #itemid/[#itemname]/#shift-click-item-link #itemcount\r\n\r\nAdds the specified number of items of id #itemid (or exact (!) name $itemname in brackets, or link created by shift-click at item in inventory or recipe) to your or selected character inventory. If #itemcount is omitted, only one item will be added.\r\n.'),
('additemset',3,'Syntax: .additemset #itemsetid\r\n\r\nAdd items from itemset of id #itemsetid to your or selected character inventory. Will add by one example each item from itemset.'),
('ahbot items amount',3,'Syntax: .ahbot items amount $GreyItems $WhiteItems $GreenItems $BlueItems $PurpleItems $OrangeItems $YellowItems\r\n\r\nSet amount of each items color be selled on auction.'),
('ahbot items amount grey',3,'Syntax: .ahbot items amount grey $GreyItems\r\n\r\nSet amount of Grey color items be selled on auction.'),
('ahbot items amount white',3,'Syntax: .ahbot items amount white $WhiteItems\r\n\r\nSet amount of White color items be selled on auction.'),
('ahbot items amount green',3,'Syntax: .ahbot items amount green $GreenItems\r\n\r\nSet amount of Green color items be selled on auction.'),
('ahbot items amount blue',3,'Syntax: .ahbot items amount blue $BlueItems\r\n\r\nSet amount of Blue color items be selled on auction.'),
('ahbot items amount purple',3,'Syntax: .ahbot items amount purple $PurpleItems\r\n\r\nSet amount of Purple color items be selled on auction.'),
('ahbot items amount orange',3,'Syntax: .ahbot items amount orange $OrangeItems\r\n\r\nSet amount of Orange color items be selled on auction.'),
('ahbot items amount yellow',3,'Syntax: .ahbot items amount yellow $YellowItems\r\n\r\nSet amount of Yellow color items be selled on auction.'),
('ahbot items ratio',3,'Syntax: .ahbot items ratio $allianceratio $horderatio $neutralratio\r\n\r\nSet ratio of items in 3 auctions house.'),
('ahbot items ratio alliance',3,'Syntax: .ahbot items ratio alliance $allianceratio\r\n\r\nSet ratio of items in alliance auction house.'),
('ahbot items ratio horde',3,'Syntax: .ahbot items ratio horde $horderatio\r\n\r\nSet ratio of items in horde auction house.'),
('ahbot items ratio neutral',3,'Syntax: .ahbot items ratio neutral $neutralratio\r\n\r\nSet ratio of items in $neutral auction house.'),
('ahbot rebuild',3,'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',3,'Syntax: .ahbot reload\r\n\r\nReload AHBot settings from configuration file.'),
('ahbot status',3,'Syntax: .ahbot status [all]\r\n\r\nShow current ahbot state data in short form, and with "all" with details.'),
('announce',1,'Syntax: .announce $MessageToBroadcast\r\n\r\nSend a global message to all players online in chat log.'),
('auction',3,'Syntax: .auction\r\n\r\nShow your team auction store.'),
('auction alliance',3,'Syntax: .auction alliance\r\n\r\nShow alliance auction store independent from your team.'),
@ -3883,6 +3898,27 @@ INSERT INTO `mangos_string` VALUES
(1168,'Scripting library reloaded.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1169,'Scripting library build for different mangosd revision.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1170,'Player selected: %s.\nFaction: %u.\nnpcFlags: %u.\nBase Entry: %u, Spawned Entry %u (Difficulty %u).\nDisplayID: %u (Native: %u).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1171,'All config are reloaded from ahbot configuration file.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1172,'Error while trying to reload ahbot config.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1173,'==========================================================',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1174,'|--------------------------------------------------------|',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1175,'| | Alliance | Horde | Neutral | Total |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1176,' Alliance/Horde/Neutral/Total',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1177,'| %-10s | %8u | %8u | %8u | %8u |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1178,'%-10s = %6u / %6u / %6u / %6u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1179,'Count',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1180,'Item Ratio',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1181,'| | Alliance | Horde | Neutral | Amount |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1182,' Alliance/Horde/Neutral/Amount',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1183,'Grey',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1184,'White',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1185,'Green',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1186,'Blue',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1187,'Purple',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1188,'Orange',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1189,'Yellow',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1190,'Amount of %s items is set to %u.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1191,'Items ratio for %s is set to %u.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1200,'You try to view cinemitic %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1201,'You try to view movie %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1202,'Spell %u %s = %f (*1.88 = %f) DB = %f AP = %f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),

View file

@ -0,0 +1,26 @@
ALTER TABLE db_version CHANGE COLUMN required_11717_01_mangos_spell_proc_event required_11731_01_mangos_command bit;
DELETE FROM command WHERE name IN ('ahbot items amount','ahbot items amount grey',
'ahbot items amount white','ahbot items amount green','ahbot items amount blue',
'ahbot items amount purple','ahbot items amount orange','ahbot items amount yellow',
'ahbot items ratio','ahbot items ratio alliance','ahbot items ratio horde','ahbot items ratio neutral',
'ahbot rebuild','ahbot reload','ahbot status'
);
INSERT INTO command (name, security, help) VALUES
('ahbot items amount',3,'Syntax: .ahbot items amount $GreyItems $WhiteItems $GreenItems $BlueItems $PurpleItems $OrangeItems $YellowItems\r\n\r\nSet amount of each items color be selled on auction.'),
('ahbot items amount grey',3,'Syntax: .ahbot items amount grey $GreyItems\r\n\r\nSet amount of Grey color items be selled on auction.'),
('ahbot items amount white',3,'Syntax: .ahbot items amount white $WhiteItems\r\n\r\nSet amount of White color items be selled on auction.'),
('ahbot items amount green',3,'Syntax: .ahbot items amount green $GreenItems\r\n\r\nSet amount of Green color items be selled on auction.'),
('ahbot items amount blue',3,'Syntax: .ahbot items amount blue $BlueItems\r\n\r\nSet amount of Blue color items be selled on auction.'),
('ahbot items amount purple',3,'Syntax: .ahbot items amount purple $PurpleItems\r\n\r\nSet amount of Purple color items be selled on auction.'),
('ahbot items amount orange',3,'Syntax: .ahbot items amount orange $OrangeItems\r\n\r\nSet amount of Orange color items be selled on auction.'),
('ahbot items amount yellow',3,'Syntax: .ahbot items amount yellow $YellowItems\r\n\r\nSet amount of Yellow color items be selled on auction.'),
('ahbot items ratio',3,'Syntax: .ahbot items ratio $allianceratio $horderatio $neutralratio\r\n\r\nSet ratio of items in 3 auctions house.'),
('ahbot items ratio alliance',3,'Syntax: .ahbot items ratio alliance $allianceratio\r\n\r\nSet ratio of items in alliance auction house.'),
('ahbot items ratio horde',3,'Syntax: .ahbot items ratio horde $horderatio\r\n\r\nSet ratio of items in horde auction house.'),
('ahbot items ratio neutral',3,'Syntax: .ahbot items ratio neutral $neutralratio\r\n\r\nSet ratio of items in $neutral auction house.'),
('ahbot rebuild',3,'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',3,'Syntax: .ahbot reload\r\n\r\nReload AHBot settings from configuration file.'),
('ahbot status',3,'Syntax: .ahbot status [all]\r\n\r\nShow current ahbot state data in short form, and with "all" with details.');

View file

@ -0,0 +1,26 @@
ALTER TABLE db_version CHANGE COLUMN required_11731_01_mangos_command required_11731_02_mangos_mangos_string bit;
DELETE FROM mangos_string WHERE entry IN (1171,1172,1173,1174,1175,1176,1177,1178,1179,1180,1181,1182,1183,1184,1185,1186,1187,1188,1189,1190,1191);
INSERT INTO mangos_string VALUES
(1171,'All config are reloaded from ahbot configuration file.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1172,'Error while trying to reload ahbot config.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1173,'==========================================================',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1174,'|--------------------------------------------------------|',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1175,'| | Alliance | Horde | Neutral | Total |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1176,' Alliance/Horde/Neutral/Total',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1177,'| %-10s | %8u | %8u | %8u | %8u |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1178,'%-10s = %6u / %6u / %6u / %6u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1179,'Count',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1180,'Item Ratio',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1181,'| | Alliance | Horde | Neutral | Amount |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1182,' Alliance/Horde/Neutral/Amount',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1183,'Grey',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1184,'White',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1185,'Green',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1186,'Blue',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1187,'Purple',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1188,'Orange',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1189,'Yellow',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1190,'Amount of %s items is set to %u.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1191,'Items ratio for %s is set to %u.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);

View file

@ -184,13 +184,15 @@ class AuctionBotSeller : public AuctionBotAgent
AuctionBotSeller();
~AuctionBotSeller();
bool Initialize() override;
bool Update(AuctionHouseType houseType) override;
bool Initialize() override;
bool Update(AuctionHouseType houseType) override;
void addNewAuctions(AHB_Seller_Config& config);
void SetItemsRatio(uint32* al, uint32* ho, uint32* ne);
void SetItemsAmount(uint32* grey_i, uint32* white_i, uint32* green_i, uint32* blue_i, uint32* purple_i, uint32* orange_i, uint32* yellow_i);
void LoadConfig();
void addNewAuctions(AHB_Seller_Config& 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:
AHB_Seller_Config m_HouseConfig[MAX_AUCTION_HOUSE_TYPE];
@ -427,6 +429,20 @@ bool AuctionBotConfig::getConfigBuyerEnabled(AuctionHouseType houseType) const
}
}
uint32 AuctionBotConfig::getConfigItemQualityAmount(AuctionQuality quality) const
{
switch (quality)
{
case AUCTION_QUALITY_GREY: return getConfig(CONFIG_UINT32_AHBOT_ITEM_GREY_AMOUNT);
case AUCTION_QUALITY_WHITE: return getConfig(CONFIG_UINT32_AHBOT_ITEM_WHITE_AMOUNT);
case AUCTION_QUALITY_GREEN: return getConfig(CONFIG_UINT32_AHBOT_ITEM_GREEN_AMOUNT);
case AUCTION_QUALITY_BLUE: return getConfig(CONFIG_UINT32_AHBOT_ITEM_BLUE_AMOUNT);
case AUCTION_QUALITY_PURPLE:return getConfig(CONFIG_UINT32_AHBOT_ITEM_PURPLE_AMOUNT);
case AUCTION_QUALITY_ORANGE:return getConfig(CONFIG_UINT32_AHBOT_ITEM_ORANGE_AMOUNT);
default: return getConfig(CONFIG_UINT32_AHBOT_ITEM_YELLOW_AMOUNT);
}
}
//== AuctionBotBuyer functions =============================
AuctionBotBuyer::AuctionBotBuyer()
@ -1462,35 +1478,57 @@ void AuctionBotSeller::SetPricesOfItem(ItemPrototype const *itemProto, AHB_Selle
bidp = (urand(temp_bidp-urandrange, temp_bidp+urandrange)/100)+1;
}
void AuctionBotSeller::SetItemsRatio(uint32* al, uint32* ho, uint32* ne)
void AuctionBotSeller::SetItemsRatio(uint32 al, uint32 ho, uint32 ne)
{
if (al)
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ALLIANCE_ITEM_AMOUNT_RATIO, *al < 10000 ? *al : 10000);
if (ho)
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_HORDE_ITEM_AMOUNT_RATIO, *ho < 10000 ? *ho : 10000);
if (ne)
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_NEUTRAL_ITEM_AMOUNT_RATIO, *ne < 10000 ? *ne : 10000);
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ALLIANCE_ITEM_AMOUNT_RATIO, al < 10000 ? al : 10000);
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_HORDE_ITEM_AMOUNT_RATIO, ho < 10000 ? ho : 10000);
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_NEUTRAL_ITEM_AMOUNT_RATIO, ne < 10000 ? ne : 10000);
for (int i = 0; i < MAX_AUCTION_HOUSE_TYPE; ++i)
LoadItemsQuantity(m_HouseConfig[i]);
}
void AuctionBotSeller::SetItemsAmount(uint32* grey_i, uint32* white_i, uint32* green_i, uint32* blue_i, uint32* purple_i, uint32* orange_i, uint32* yellow_i)
void AuctionBotSeller::SetItemsRatioForHouse(AuctionHouseType house, uint32 val)
{
if (grey_i)
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_GREY_AMOUNT, *grey_i);
if (white_i)
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_WHITE_AMOUNT, *white_i);
if (green_i)
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_GREEN_AMOUNT, *green_i);
if (blue_i)
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_BLUE_AMOUNT, *blue_i);
if (purple_i)
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_PURPLE_AMOUNT, *purple_i);
if (orange_i)
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_ORANGE_AMOUNT, *orange_i);
if (yellow_i)
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_YELLOW_AMOUNT, *yellow_i);
if (val > 10000) // apply same upper limit as used for config load
val = 10000;
switch (house)
{
case AUCTION_HOUSE_ALLIANCE: sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ALLIANCE_ITEM_AMOUNT_RATIO, val); break;
case AUCTION_HOUSE_HORDE: sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_HORDE_ITEM_AMOUNT_RATIO, val); break;
default: sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_NEUTRAL_ITEM_AMOUNT_RATIO, val); break;
}
LoadItemsQuantity(m_HouseConfig[house]);
}
void AuctionBotSeller::SetItemsAmount(uint32 (&vals) [MAX_AUCTION_QUALITY])
{
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_GREY_AMOUNT, vals[AUCTION_QUALITY_GREY]);
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_WHITE_AMOUNT, vals[AUCTION_QUALITY_WHITE]);
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_GREEN_AMOUNT, vals[AUCTION_QUALITY_GREEN]);
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_BLUE_AMOUNT, vals[AUCTION_QUALITY_BLUE]);
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_PURPLE_AMOUNT, vals[AUCTION_QUALITY_PURPLE]);
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_ORANGE_AMOUNT, vals[AUCTION_QUALITY_ORANGE]);
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_YELLOW_AMOUNT, vals[AUCTION_QUALITY_YELLOW]);
for (int i = 0; i < MAX_AUCTION_HOUSE_TYPE; ++i)
LoadItemsQuantity(m_HouseConfig[i]);
}
void AuctionBotSeller::SetItemsAmountForQuality(AuctionQuality quality, uint32 val)
{
switch (quality)
{
case AUCTION_QUALITY_GREY: sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_GREY_AMOUNT, val); break;
case AUCTION_QUALITY_WHITE: sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_WHITE_AMOUNT, val); break;
case AUCTION_QUALITY_GREEN: sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_GREEN_AMOUNT, val); break;
case AUCTION_QUALITY_BLUE: sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_BLUE_AMOUNT, val); break;
case AUCTION_QUALITY_PURPLE:sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_PURPLE_AMOUNT, val); break;
case AUCTION_QUALITY_ORANGE:sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_ORANGE_AMOUNT, val); break;
default: sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_YELLOW_AMOUNT, val); break;
}
for (int i = 0; i < MAX_AUCTION_HOUSE_TYPE; ++i)
LoadItemsQuantity(m_HouseConfig[i]);
@ -1629,16 +1667,28 @@ void AuctionHouseBot::Initialize()
InitilizeAgents();
}
void AuctionHouseBot::SetItemsRatio(uint32* al, uint32* ho, uint32* ne)
void AuctionHouseBot::SetItemsRatio(uint32 al, uint32 ho, uint32 ne)
{
if (AuctionBotSeller* seller = dynamic_cast<AuctionBotSeller*>(m_Seller))
seller->SetItemsRatio( al, ho, ne);
seller->SetItemsRatio(al, ho, ne);
}
void AuctionHouseBot::SetItemsAmount(uint32* grey_i, uint32* white_i, uint32* green_i, uint32* blue_i, uint32* purple_i, uint32* orange_i, uint32* yellow_i)
void AuctionHouseBot::SetItemsRatioForHouse(AuctionHouseType house, uint32 val)
{
if (AuctionBotSeller* seller = dynamic_cast<AuctionBotSeller*>(m_Seller))
seller->SetItemsAmount(grey_i, white_i, green_i, blue_i, purple_i, orange_i, yellow_i);
seller->SetItemsRatioForHouse(house, val);
}
void AuctionHouseBot::SetItemsAmount(uint32 (&vals) [MAX_AUCTION_QUALITY])
{
if (AuctionBotSeller* seller = dynamic_cast<AuctionBotSeller*>(m_Seller))
seller->SetItemsAmount(vals);
}
void AuctionHouseBot::SetItemsAmountForQuality(AuctionQuality quality, uint32 val)
{
if (AuctionBotSeller* seller = dynamic_cast<AuctionBotSeller*>(m_Seller))
seller->SetItemsAmountForQuality(quality, val);
}
bool AuctionHouseBot::ReloadAllConfig()

View file

@ -120,6 +120,7 @@ class AuctionBotConfig
uint32 getConfigItemAmountRatio(AuctionHouseType houseType) const;
bool getConfigBuyerEnabled(AuctionHouseType houseType) const;
uint32 getConfigItemQualityAmount(AuctionQuality quality) const;
uint32 GetItemPerCycleBoost() const { return m_ItemsPerCycleBoost; }
@ -181,8 +182,10 @@ class AuctionHouseBot
void Initialize();
// Followed method is mainly used by level3.cpp for ingame/console command
void SetItemsRatio(uint32* al, uint32* ho, uint32* ne);
void SetItemsAmount(uint32* grey_i, uint32* white_i, uint32* green_i, uint32* blue_i, uint32* purple_i, uint32* orange_i, uint32* yellow_i);
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);
bool ReloadAllConfig();
void Rebuild(bool all);

View file

@ -34,6 +34,7 @@
#include "SpellMgr.h"
#include "PoolManager.h"
#include "GameEventMgr.h"
#include "AuctionHouseBot/AuctionHouseBot.h"
// Supported shift-links (client generated and server side)
// |color|Hachievement:achievement_id:player_guid_hex:completed_0_1:mm:dd:yy_from_2000:criteriaMask1:criteriaMask2:criteriaMask3:criteriaMask4|h[name]|h|r
@ -104,6 +105,44 @@ ChatCommand * ChatHandler::getCommandTable()
{ NULL, 0, true, NULL, "", NULL }
};
static ChatCommand ahbotItemsAmountCommandTable[] =
{
{ "grey", SEC_ADMINISTRATOR, true, &ChatHandler::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_GREY>, "", NULL },
{ "white", SEC_ADMINISTRATOR, true, &ChatHandler::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_WHITE>, "", NULL },
{ "green", SEC_ADMINISTRATOR, true, &ChatHandler::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_GREEN>, "", NULL },
{ "blue", SEC_ADMINISTRATOR, true, &ChatHandler::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_BLUE>, "", NULL },
{ "purple", SEC_ADMINISTRATOR, true, &ChatHandler::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_PURPLE>,"", NULL },
{ "orange", SEC_ADMINISTRATOR, true, &ChatHandler::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_ORANGE>,"", NULL },
{ "yellow", SEC_ADMINISTRATOR, true, &ChatHandler::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_YELLOW>,"", NULL },
{ "", SEC_ADMINISTRATOR, true, &ChatHandler::HandleAHBotItemsAmountCommand, "", NULL },
{ NULL, 0, true, NULL, "", NULL }
};
static ChatCommand ahbotItemsRatioCommandTable[] =
{
{ "alliance", SEC_ADMINISTRATOR, true, &ChatHandler::HandleAHBotItemsRatioHouseCommand<AUCTION_HOUSE_ALLIANCE>, "", NULL },
{ "horde", SEC_ADMINISTRATOR, true, &ChatHandler::HandleAHBotItemsRatioHouseCommand<AUCTION_HOUSE_HORDE>, "", NULL },
{ "neutral", SEC_ADMINISTRATOR, true, &ChatHandler::HandleAHBotItemsRatioHouseCommand<AUCTION_HOUSE_NEUTRAL>, "", NULL },
{ "", SEC_ADMINISTRATOR, true, &ChatHandler::HandleAHBotItemsRatioCommand, "", NULL },
{ NULL, 0, true, NULL, "", NULL }
};
static ChatCommand ahbotItemsCommandTable[] =
{
{ "amount", SEC_ADMINISTRATOR, true, NULL, "", ahbotItemsAmountCommandTable},
{ "ratio", SEC_ADMINISTRATOR, true, NULL, "", ahbotItemsRatioCommandTable},
{ NULL, 0, true, NULL, "", NULL }
};
static ChatCommand ahbotCommandTable[] =
{
{ "items", SEC_GAMEMASTER, true, NULL, "", ahbotItemsCommandTable},
{ "rebuild", SEC_ADMINISTRATOR, true, &ChatHandler::HandleAHBotRebuildCommand, "", NULL },
{ "reload", SEC_ADMINISTRATOR, true, &ChatHandler::HandleAHBotReloadCommand, "", NULL },
{ "status", SEC_ADMINISTRATOR, true, &ChatHandler::HandleAHBotStatusCommand, "", NULL },
{ NULL, 0, true, NULL, "", NULL }
};
static ChatCommand auctionCommandTable[] =
{
{ "alliance", SEC_ADMINISTRATOR, false, &ChatHandler::HandleAuctionAllianceCommand, "", NULL },
@ -685,6 +724,7 @@ ChatCommand * ChatHandler::getCommandTable()
{ "account", SEC_PLAYER, true, NULL, "", accountCommandTable },
{ "achievement", SEC_ADMINISTRATOR, true, NULL, "", achievementCommandTable },
{ "auction", SEC_ADMINISTRATOR, false, NULL, "", auctionCommandTable },
{ "ahbot", SEC_ADMINISTRATOR, true, NULL, "", ahbotCommandTable },
{ "cast", SEC_ADMINISTRATOR, false, NULL, "", castCommandTable },
{ "character", SEC_GAMEMASTER, true, NULL, "", characterCommandTable},
{ "debug", SEC_MODERATOR, true, NULL, "", debugCommandTable },
@ -845,7 +885,7 @@ bool ChatHandler::HasLowerSecurity(Player* target, ObjectGuid guid, bool strong)
if (target)
target_session = target->GetSession();
else if (guid)
else
target_account = sObjectMgr.GetPlayerAccountIdByGUID(guid);
if(!target_session && !target_account)

View file

@ -142,6 +142,16 @@ class MANGOS_DLL_SPEC ChatHandler
bool HandleAccountSetGmLevelCommand(char* args);
bool HandleAccountSetPasswordCommand(char* args);
bool HandleAHBotItemsAmountCommand(char* args);
template <int Q>
bool HandleAHBotItemsAmountQualityCommand(char* args);
bool HandleAHBotItemsRatioCommand(char* args);
template <int H>
bool HandleAHBotItemsRatioHouseCommand(char* args);
bool HandleAHBotRebuildCommand(char* args);
bool HandleAHBotReloadCommand(char* args);
bool HandleAHBotStatusCommand(char* args);
bool HandleAuctionAllianceCommand(char* args);
bool HandleAuctionGoblinCommand(char* args);
bool HandleAuctionHordeCommand(char* args);

View file

@ -916,7 +916,28 @@ enum MangosStrings
LANG_SCRIPTS_RELOADED_OK = 1168,
LANG_SCRIPTS_OUTDATED = 1169,
LANG_NPCINFO_CHAR_DIFFICULTY = 1170,
// Room for more level 3 1171-1199 not used
LANG_AHBOT_RELOAD_OK = 1171,
LANG_AHBOT_RELOAD_FAIL = 1172,
LANG_AHBOT_STATUS_BAR_CONSOLE = 1173,
LANG_AHBOT_STATUS_MIDBAR_CONSOLE = 1174,
LANG_AHBOT_STATUS_TITLE1_CONSOLE = 1175,
LANG_AHBOT_STATUS_TITLE1_CHAT = 1176,
LANG_AHBOT_STATUS_FORMAT_CONSOLE = 1177,
LANG_AHBOT_STATUS_FORMAT_CHAT = 1178,
LANG_AHBOT_STATUS_ITEM_COUNT = 1179,
LANG_AHBOT_STATUS_ITEM_RATIO = 1180,
LANG_AHBOT_STATUS_TITLE2_CONSOLE = 1181,
LANG_AHBOT_STATUS_TITLE2_CHAT = 1182,
LANG_AHBOT_QUALITY_GREY = 1183,
LANG_AHBOT_QUALITY_WHITE = 1184,
LANG_AHBOT_QUALITY_GREEN = 1185,
LANG_AHBOT_QUALITY_BLUE = 1186,
LANG_AHBOT_QUALITY_PURPLE = 1187,
LANG_AHBOT_QUALITY_ORANGE = 1188,
LANG_AHBOT_QUALITY_YELLOW = 1189,
LANG_AHBOT_ITEMS_AMOUNT = 1190,
LANG_AHBOT_ITEMS_RATIO = 1191,
// Room for more level 3 1192-1199 not used
// Debug commands
LANG_CINEMATIC_NOT_EXIST = 1200,

View file

@ -54,6 +54,173 @@
#include "InstanceData.h"
#include "CreatureEventAIMgr.h"
#include "DBCEnums.h"
#include "AuctionHouseBot/AuctionHouseBot.h"
static uint32 ahbotQualityIds[MAX_AUCTION_QUALITY] =
{
LANG_AHBOT_QUALITY_GREY, LANG_AHBOT_QUALITY_WHITE,
LANG_AHBOT_QUALITY_GREEN, LANG_AHBOT_QUALITY_BLUE,
LANG_AHBOT_QUALITY_PURPLE, LANG_AHBOT_QUALITY_ORANGE,
LANG_AHBOT_QUALITY_YELLOW
};
bool ChatHandler::HandleAHBotItemsAmountCommand(char* args)
{
uint32 qVals[MAX_AUCTION_QUALITY];
for (int i = 0; i < MAX_AUCTION_QUALITY; ++i)
if (!ExtractUInt32(&args, qVals[i]))
return false;
sAuctionBot.SetItemsAmount(qVals);
for (int i = 0; i < MAX_AUCTION_QUALITY; ++i)
PSendSysMessage(LANG_AHBOT_ITEMS_AMOUNT, GetMangosString(ahbotQualityIds[i]), sAuctionBotConfig.getConfigItemQualityAmount(AuctionQuality(i)));
return true;
}
template<int Q>
bool ChatHandler::HandleAHBotItemsAmountQualityCommand(char* args)
{
uint32 qVal;
if (!ExtractUInt32(&args, qVal))
return false;
sAuctionBot.SetItemsAmountForQuality(AuctionQuality(Q), qVal);
PSendSysMessage(LANG_AHBOT_ITEMS_AMOUNT, GetMangosString(ahbotQualityIds[Q]),
sAuctionBotConfig.getConfigItemQualityAmount(AuctionQuality(Q)));
return true;
}
template bool ChatHandler::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_GREY>(char*);
template bool ChatHandler::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_WHITE>(char*);
template bool ChatHandler::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_GREEN>(char*);
template bool ChatHandler::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_BLUE>(char*);
template bool ChatHandler::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_PURPLE>(char*);
template bool ChatHandler::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_ORANGE>(char*);
template bool ChatHandler::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_YELLOW>(char*);
bool ChatHandler::HandleAHBotItemsRatioCommand(char* args)
{
uint32 rVal[MAX_AUCTION_HOUSE_TYPE];
for (int i = 0; i < MAX_AUCTION_HOUSE_TYPE; ++i)
if (!ExtractUInt32(&args, rVal[i]))
return false;
sAuctionBot.SetItemsRatio(rVal[0], rVal[1], rVal[2]);
for (int i = 0; i < MAX_AUCTION_HOUSE_TYPE; ++i)
PSendSysMessage(LANG_AHBOT_ITEMS_RATIO, AuctionBotConfig::GetHouseTypeName(AuctionHouseType(i)), sAuctionBotConfig.getConfigItemAmountRatio(AuctionHouseType(i)));
return true;
}
template<int H>
bool ChatHandler::HandleAHBotItemsRatioHouseCommand(char* args)
{
uint32 rVal;
if (!ExtractUInt32(&args, rVal))
return false;
sAuctionBot.SetItemsRatioForHouse(AuctionHouseType(H), rVal);
PSendSysMessage(LANG_AHBOT_ITEMS_RATIO, AuctionBotConfig::GetHouseTypeName(AuctionHouseType(H)), sAuctionBotConfig.getConfigItemAmountRatio(AuctionHouseType(H)));
return true;
}
template bool ChatHandler::HandleAHBotItemsRatioHouseCommand<AUCTION_HOUSE_ALLIANCE>(char*);
template bool ChatHandler::HandleAHBotItemsRatioHouseCommand<AUCTION_HOUSE_HORDE>(char*);
template bool ChatHandler::HandleAHBotItemsRatioHouseCommand<AUCTION_HOUSE_NEUTRAL>(char*);
bool ChatHandler::HandleAHBotRebuildCommand(char* args)
{
bool all = false;
if (*args)
{
if (!ExtractLiteralArg(&args, "all"))
return false;
all = true;
}
sAuctionBot.Rebuild(all);
return true;
}
bool ChatHandler::HandleAHBotReloadCommand(char* args)
{
if (sAuctionBot.ReloadAllConfig())
{
SendSysMessage(LANG_AHBOT_RELOAD_OK);
return true;
}
else
{
SendSysMessage(LANG_AHBOT_RELOAD_FAIL);
SetSentErrorMessage(true);
return false;
}
}
bool ChatHandler::HandleAHBotStatusCommand(char* args)
{
bool all = false;
if (*args)
{
if (!ExtractLiteralArg(&args, "all"))
return false;
all = true;
}
AuctionHouseBotStatusInfo statusInfo;
sAuctionBot.PrepareStatusInfos(statusInfo);
if (!m_session)
{
SendSysMessage(LANG_AHBOT_STATUS_BAR_CONSOLE);
SendSysMessage(LANG_AHBOT_STATUS_TITLE1_CONSOLE);
SendSysMessage(LANG_AHBOT_STATUS_MIDBAR_CONSOLE);
}
else
SendSysMessage(LANG_AHBOT_STATUS_TITLE1_CHAT);
uint32 fmtId = m_session ? LANG_AHBOT_STATUS_FORMAT_CHAT : LANG_AHBOT_STATUS_FORMAT_CONSOLE;
PSendSysMessage(fmtId, GetMangosString(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)
{
PSendSysMessage(fmtId, GetMangosString(LANG_AHBOT_STATUS_ITEM_RATIO),
sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_ALLIANCE_ITEM_AMOUNT_RATIO),
sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_HORDE_ITEM_AMOUNT_RATIO),
sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_NEUTRAL_ITEM_AMOUNT_RATIO),
sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_ALLIANCE_ITEM_AMOUNT_RATIO) +
sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_HORDE_ITEM_AMOUNT_RATIO) +
sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_NEUTRAL_ITEM_AMOUNT_RATIO));
if (!m_session)
{
SendSysMessage(LANG_AHBOT_STATUS_BAR_CONSOLE);
SendSysMessage(LANG_AHBOT_STATUS_TITLE2_CONSOLE);
SendSysMessage(LANG_AHBOT_STATUS_MIDBAR_CONSOLE);
}
else
SendSysMessage(LANG_AHBOT_STATUS_TITLE2_CHAT);
for (int i = 0; i < MAX_AUCTION_QUALITY; ++i)
PSendSysMessage(fmtId, GetMangosString(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 (!m_session)
SendSysMessage(LANG_AHBOT_STATUS_BAR_CONSOLE);
return true;
}
//reload commands
bool ChatHandler::HandleReloadAllCommand(char* /*args*/)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11730"
#define REVISION_NR "11731"
#endif // __REVISION_NR_H__

View file

@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_11716_10_characters_mail"
#define REVISION_DB_MANGOS "required_11717_01_mangos_spell_proc_event"
#define REVISION_DB_MANGOS "required_11731_02_mangos_mangos_string"
#define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version"
#endif // __REVISION_SQL_H__