初始化提交.

This commit is contained in:
Ayase
2018-05-13 23:26:08 +08:00
parent 27c31b1442
commit 28b01026a6
13 changed files with 4190 additions and 8 deletions

View File

@@ -1,8 +1,8 @@
AC_ADD_SCRIPT("${CMAKE_CURRENT_LIST_DIR}/src/MyWorld.cpp")
AC_ADD_SCRIPT("${CMAKE_CURRENT_LIST_DIR}/src/MyPlayer.cpp")
AC_ADD_SCRIPT_LOADER("MyWorld" "${CMAKE_CURRENT_LIST_DIR}/src/loader.h")
AC_ADD_SCRIPT_LOADER("MyPlayer" "${CMAKE_CURRENT_LIST_DIR}/src/loader.h")
CU_ADD_HOOK(AFTER_WORLDSERVER_CMAKE "${CMAKE_CURRENT_LIST_DIR}/src/cmake/after_ws_install.cmake")
CU_SET_PATH("CMAKE_MOD_AHBOT_DIR" "${CMAKE_CURRENT_LIST_DIR}")
CU_ADD_HOOK(AFTER_LOAD_CONF "${CMAKE_CURRENT_LIST_DIR}/cmake/after_load_conf.cmake")
CU_ADD_HOOK(BEFORE_GAME_LIBRARY "${CMAKE_CURRENT_LIST_DIR}/cmake/before_game_lib.cmake")
CU_ADD_HOOK(BEFORE_SCRIPTS_LIBRARY "${CMAKE_CURRENT_LIST_DIR}/cmake/before_scripts_lib.cmake")
CU_ADD_HOOK(AFTER_GAME_LIBRARY "${CMAKE_CURRENT_LIST_DIR}/cmake/after_game_lib.cmake")
AC_ADD_SCRIPT("${CMAKE_CURRENT_LIST_DIR}/src/cs_ah_bot.cpp")
AC_ADD_SCRIPT_LOADER("AHBotCommand" "${CMAKE_CURRENT_LIST_DIR}/src/loader_cs_ah_bot.h")
CU_ADD_HOOK(AFTER_WORLDSERVER_CMAKE "${CMAKE_CURRENT_LIST_DIR}/cmake/after_ws_install.cmake")

151
ahbot.patch Normal file
View File

@@ -0,0 +1,151 @@
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index 4aba5703b2..5c9a332016 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -21,6 +21,9 @@
#include <vector>
#include "AvgDiffTracker.h"
#include "AsyncAuctionListing.h"
+#ifdef MOD_AH_BOT
+#include "AuctionHouseBot.h"
+#endif
enum eAuctionHouse
{
@@ -139,8 +142,11 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransa
if (owner || owner_accId)
{
uint32 profit = auction->bid + auction->deposit - auction->GetAuctionCut();
-
+#ifdef MOD_AH_BOT
+ if (owner && owner->GetGUIDLow() != auctionbot->GetAHBplayerGUID())
+#else
if (owner)
+#endif
{
owner->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS, profit);
owner->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_SOLD, auction->bid);
@@ -183,7 +189,11 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransacti
// owner exist
if (owner || owner_accId)
{
+#ifdef MOD_AH_BOT
+ if (owner && owner->GetGUIDLow() != auctionbot->GetAHBplayerGUID())
+#else
if (owner)
+#endif
owner->GetSession()->SendAuctionOwnerNotification(auction);
MailDraft(auction->BuildAuctionMailSubject(AUCTION_EXPIRED), AuctionEntry::BuildAuctionMailBody(0, 0, auction->buyout, auction->deposit, 0))
@@ -207,6 +217,11 @@ void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 new
// old bidder exist
if (oldBidder || oldBidder_accId)
{
+#ifdef MOD_AH_BOT
+ if (oldBidder && !newBidder)
+ oldBidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, auctionbot->GetAHBplayerGUID(), newPrice, auction->GetAuctionOutBid(), auction->item_template);
+#endif // MOD_AH_BOT
+
if (oldBidder && newBidder)
oldBidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, newBidder->GetGUID(), newPrice, auction->GetAuctionOutBid(), auction->item_template);
@@ -407,10 +422,16 @@ void AuctionHouseObject::AddAuction(AuctionEntry* auction)
AuctionsMap[auction->Id] = auction;
sScriptMgr->OnAuctionAdd(this, auction);
+#ifdef MOD_AH_BOT
+ auctionbot->IncrementItemCounts(auction);
+#endif
}
bool AuctionHouseObject::RemoveAuction(AuctionEntry* auction)
{
+#ifdef MOD_AH_BOT
+ auctionbot->DecrementItemCounts(auction, auction->item_template);
+#endif
bool wasInMap = AuctionsMap.erase(auction->Id) ? true : false;
sScriptMgr->OnAuctionRemove(this, auction);
diff --git a/src/server/game/Mails/Mail.cpp b/src/server/game/Mails/Mail.cpp
index ef72cbfe2c..2f57ac9687 100644
--- a/src/server/game/Mails/Mail.cpp
+++ b/src/server/game/Mails/Mail.cpp
@@ -15,6 +15,9 @@
#include "Item.h"
#include "AuctionHouseMgr.h"
#include "CalendarMgr.h"
+#ifdef MOD_AH_BOT
+#include "AuctionHouseBot.h"
+#endif
MailSender::MailSender(Object* sender, MailStationery stationery) : m_stationery(stationery)
{
@@ -168,6 +171,15 @@ void MailDraft::SendMailTo(SQLTransaction& trans, MailReceiver const& receiver,
uint32 mailId = sObjectMgr->GenerateMailID();
+#ifdef MOD_AH_BOT
+ if (receiver.GetPlayerGUIDLow() == auctionbot->GetAHBplayerGUID())
+ {
+ if (sender.GetMailMessageType() == MAIL_AUCTION) // auction mail with items
+ deleteIncludedItems(trans, true);
+ return;
+ }
+#endif
+
time_t deliver_time = time(NULL) + deliver_delay;
//expire time if COD 3 days, if no COD 30 days, if auction sale pending 1 hour
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 01b1fe0acb..cf3e65bc94 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -76,6 +76,9 @@
#include "AsyncAuctionListing.h"
#include "SavingSystem.h"
#include <VMapManager2.h>
+#ifdef MOD_AH_BOT
+#include "AuctionHouseBot.h"
+#endif
ACE_Atomic_Op<ACE_Thread_Mutex, bool> World::m_stopEvent = false;
uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE;
@@ -1635,6 +1638,16 @@ void World::SetInitialWorldSettings()
sLog->outString("Loading Completed Achievements...");
sAchievementMgr->LoadCompletedAchievements();
+#ifdef MOD_AH_BOT
+ std::string cfg_file = "mod_ahbot.conf";
+ std::string cfg_def_file = cfg_file + ".dist";
+ sConfigMgr->LoadMore(cfg_def_file.c_str());
+ sConfigMgr->LoadMore(cfg_file.c_str());
+
+ // Initialize AHBot settings before deleting expired auctions due to AHBot hooks
+ auctionbot->InitializeConfiguration();
+#endif
+
///- Load dynamic data tables from the database
sLog->outString("Loading Item Auctions...");
sAuctionMgr->LoadAuctionItems();
@@ -1871,6 +1884,11 @@ void World::SetInitialWorldSettings()
mgr = ChannelMgr::forTeam(TEAM_HORDE);
mgr->LoadChannels();
+#ifdef MOD_AH_BOT
+ TC_LOG_INFO("server.loading", "Initialize AuctionHouseBot...");
+ auctionbot->Initialize();
+#endif
+
uint32 startupDuration = GetMSTimeDiffToNow(startupBegin);
sLog->outString();
sLog->outError("WORLD: World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000));
@@ -2031,6 +2049,9 @@ void World::Update(uint32 diff)
// pussywizard: handle auctions when the timer has passed
if (m_timers[WUPDATE_AUCTIONS].Passed())
{
+#ifdef MOD_AH_BOT
+ auctionbot->Update();
+#endif
m_timers[WUPDATE_AUCTIONS].Reset();
// pussywizard: handle expired auctions, auctions expired when realm was offline are also handled here (not during loading when many required things aren't loaded yet)

View File

@@ -0,0 +1 @@
include_directories(${CMAKE_MOD_AHBOT_DIR}/src)

View File

@@ -0,0 +1 @@
add_definitions(-DMOD_AH_BOT)

View File

@@ -0,0 +1,15 @@
if( WIN32 )
if ( MSVC )
add_custom_command(TARGET worldserver
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_MOD_AHBOT_DIR}/conf/mod_ahbot.conf.dist" ${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/
)
elseif ( MINGW )
add_custom_command(TARGET worldserver
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_MOD_AHBOT_DIR}/conf/mod_ahbot.conf.dist" ${CMAKE_BINARY_DIR}/bin/
)
endif()
endif()
install(FILES "${CMAKE_MOD_AHBOT_DIR}/conf/mod_ahbot.conf.dist" DESTINATION ${CONF_DIR})

View File

@@ -0,0 +1,5 @@
set(game_STAT_SRCS
${game_STAT_SRCS}
${CMAKE_MOD_AHBOT_DIR}/src/AuctionHouseBot.cpp
${CMAKE_MOD_AHBOT_DIR}/src/AuctionHouseBot.h
)

View File

@@ -0,0 +1 @@
include_directories(${CMAKE_MOD_AHBOT_DIR}/src)

266
conf/mod_ahbot.conf.dist Normal file
View File

@@ -0,0 +1,266 @@
###############################################################################
# AUCTION HOUSE BOT SETTINGS
#
# AuctionHouseBot.DEBUG
# Enable/Disable Debugging output
# Default 0 (disabled)
#
# AuctionHouseBot.DEBUG_FILTERS
# Enable/Disable Debugging output from Filters
# Default 0 (disabled)
#
# AuctionHouseBot.EnableSeller
# Enable/Disable the part of AHBot that puts items up for auction
# Default 0 (disabled)
#
# AuctionHouseBot.EnableBuyer
# Enable/Disable the part of AHBot that buys items from players
# Default 0 (disabled)
#
# AuctionHouseBot.UseBuyPriceForSeller
# Should the Seller use BuyPrice or SellPrice to determine Bid Prices
# Default 0 (use SellPrice)
#
# AuctionHouseBot.UseBuyPriceForBuyer
# Should the Buyer use BuyPrice or SellPrice to determine Bid Prices
# Default 0 (use SellPrice)
#
# Auction House Bot character data
# AuctionHouseBot.Account is the account number
# (in realmd->account table) of the player you want to run
# as the auction bot.
# AuctionHouseBot.GUID is the GUID (in characters->characters table)
# of the player you want to run as the auction bot.
# Default: 0 (Auction House Bot disabled)
#
# AuctionHouseBot.ItemsPerCycle
# Number of Items to Add/Remove from the AH during mass operations
# Default 200
#
###############################################################################
AuctionHouseBot.DEBUG = 0
AuctionHouseBot.DEBUG_FILTERS = 0
AuctionHouseBot.EnableSeller = 0
AuctionHouseBot.EnableBuyer = 0
AuctionHouseBot.UseBuyPriceForSeller = 0
AuctionHouseBot.UseBuyPriceForBuyer = 0
AuctionHouseBot.Account = 0
AuctionHouseBot.GUID = 0
AuctionHouseBot.ItemsPerCycle = 200
###############################################################################
# AUCTION HOUSE BOT FILTERS PART 1
#
# AuctionHouseBot.VendorItems
# Include items that can be bought from vendors.
# Default 0 (False)
#
# AuctionHouseBot.VendorTradeGoods
# Include Trade Goods that can be bought from vendors.
# Default 0 (False)
#
# AuctionHouseBot.LootItems
# Include items that can be looted or fished for.
# Default 1 (True)
#
# AuctionHouseBot.LootTradeGoods
# Include Trade Goods that can be looted or fished for.
# Default 1 (True)
#
# AuctionHouseBot.OtherItems
# Include misc. items.
# Default 0 (False)
#
# AuctionHouseBot.OtherTradeGoods
# Include misc. Trade Goods.
# Default 0 (False)
#
# AuctionHouseBot.Bonding_types
# Indicates which bonding types to allow seller to put up for auction
# No_Bind
# Default 1 (True)
# Bind_When_Picked_Up
# Default 0 (False)
# Bind_When_Equipped
# Default 1 (True)
# Bind_When_Use
# Default 1 (True)
# Bind_Quest_Item
# Default 0 (False)
#
# AuctionHouseBot.DisableBeta_PTR_Unused
# Disable certain items that are usually unavailable to Players
# Default 0 (False)
#
# AuctionHouseBot.DisablePermEnchant
# Disable Items with a Permanent Enchantment
# Default 0 (False)
#
# AuctionHouseBot.DisableConjured
# Disable Conjured Items
# Default 0 (False)
#
# AuctionHouseBot.DisableGems
# Disable Gems
# Default 0 (False)
#
# AuctionHouseBot.DisableMoney
# Disable Items that are used as money
# Default 0 (False)
#
# AuctionHouseBot.DisableMoneyLoot
# Disable Items that have Money as a loot
# Default 0 (False)
#
# AuctionHouseBot.DisableLootable
# Disable Items that have other items as loot
# Default 0 (False)
#
# AuctionHouseBot.DisableKeys
# Disable Items that are keys
# Default 0 (False)
#
# AuctionHouseBot.DisableDuration
# Disable Items with a duration
# Default 0 (False)
#
# AuctionHouseBot.DisableBOP_Or_Quest_NoReqLevel
# Disable items that are BOP or Quest Item
# with a Required level that is less than the Item Level
# (This prevents a level 10 with a level 60 weapon or armor)
# (May need further refinement)
# Default 0 (False)
#
###############################################################################
AuctionHouseBot.VendorItems = 0
AuctionHouseBot.VendorTradeGoods = 0
AuctionHouseBot.LootItems = 1
AuctionHouseBot.LootTradeGoods = 1
AuctionHouseBot.OtherItems = 0
AuctionHouseBot.OtherTradeGoods = 0
AuctionHouseBot.No_Bind = 1
AuctionHouseBot.Bind_When_Picked_Up = 0
AuctionHouseBot.Bind_When_Equipped = 1
AuctionHouseBot.Bind_When_Use = 1
AuctionHouseBot.Bind_Quest_Item = 0
AuctionHouseBot.DisableBeta_PTR_Unused = 0
AuctionHouseBot.DisablePermEnchant = 0
AuctionHouseBot.DisableConjured = 0
AuctionHouseBot.DisableGems = 0
AuctionHouseBot.DisableMoney = 0
AuctionHouseBot.DisableMoneyLoot = 0
AuctionHouseBot.DisableLootable = 0
AuctionHouseBot.DisableKeys = 0
AuctionHouseBot.DisableDuration = 0
AuctionHouseBot.DisableBOP_Or_Quest_NoReqLevel = 0
###############################################################################
# AUCTION HOUSE BOT FILTERS PART 2
#
# These Filters are boolean (0 or 1) and will disable items that are
# specifically meant for the Class named.
# (UnusedClass is Class 10, which was skipped for some reason)
# Default 0 (allowed)
#
###############################################################################
AuctionHouseBot.DisableWarriorItems = 0
AuctionHouseBot.DisablePaladinItems = 0
AuctionHouseBot.DisableHunterItems = 0
AuctionHouseBot.DisableRogueItems = 0
AuctionHouseBot.DisablePriestItems = 0
AuctionHouseBot.DisableDKItems = 0
AuctionHouseBot.DisableShamanItems = 0
AuctionHouseBot.DisableMageItems = 0
AuctionHouseBot.DisableWarlockItems = 0
AuctionHouseBot.DisableUnusedClassItems = 0
AuctionHouseBot.DisableDruidItems = 0
###############################################################################
# AUCTION HOUSE BOT FILTERS PART 3
#
# AuctionHouseBot.DisableItemsBelowLevel
# Prevent Seller from listing Items below this Level
# Default 0 (Off)
#
# AuctionHouseBot.DisableItemsAboveLevel
# Prevent Seller from listing Items above this Level
# Default 0 (Off)
#
# AuctionHouseBot.DisableTGsBelowLevel
# Prevent Seller from listing Trade Goods below this Level
# Default 0 (Off)
#
# AuctionHouseBot.DisableTGsAboveLevel
# Prevent Seller from listing Trade Goods above this Level
# Default 0 (Off)
#
# AuctionHouseBot.DisableItemsBelowGUID
# Prevent Seller from listing Items below this GUID
# Default 0 (Off)
#
# AuctionHouseBot.DisableItemsAboveGUID
# Prevent Seller from listing Items above this GUID
# Default 0 (Off)
#
# AuctionHouseBot.DisableTGsBelowGUID
# Prevent Seller from listing Trade Goods below this GUID
# Default 0 (Off)
#
# AuctionHouseBot.DisableTGsAboveGUID
# Prevent Seller from listing Trade Goods above this GUID
# Default 0 (Off)
#
# AuctionHouseBot.DisableItemsBelowReqLevel
# Prevent Seller from listing Items below this Required Level
# Default 0 (Off)
#
# AuctionHouseBot.DisableItemsAboveReqLevel
# Prevent Seller from listing Items above this Required Level
# Default 0 (Off)
#
# AuctionHouseBot.DisableTGsBelowReqLevel
# Prevent Seller from listing Trade Goods below this Required Level
# Default 0 (Off)
#
# AuctionHouseBot.DisableTGsAboveReqLevel
# Prevent Seller from listing Trade Goods above this Required Level
# Default 0 (Off)
#
# AuctionHouseBot.DisableItemsBelowReqSkillRank
# Prevent Seller from listing Items below this Required Skill Rank
# Default 0 (Off)
#
# AuctionHouseBot.DisableItemsAboveReqSkillRank
# Prevent Seller from listing Items above this Required Skill Rank
# Default 0 (Off)
#
# AuctionHouseBot.DisableTGsBelowReqSkillRank
# Prevent Seller from listing Trade Goods below this Required Skill Rank
# Default 0 (Off)
#
# AuctionHouseBot.DisableTGsAboveReqSkillRank
# Prevent Seller from listing Trade Goods above this Required Skill Rank
# Default 0 (Off)
#
###############################################################################
AuctionHouseBot.DisableItemsBelowLevel = 0
AuctionHouseBot.DisableItemsAboveLevel = 0
AuctionHouseBot.DisableTGsBelowLevel = 0
AuctionHouseBot.DisableTGsAboveLevel = 0
AuctionHouseBot.DisableItemsBelowGUID = 0
AuctionHouseBot.DisableItemsAboveGUID = 0
AuctionHouseBot.DisableTGsBelowGUID = 0
AuctionHouseBot.DisableTGsAboveGUID = 0
AuctionHouseBot.DisableItemsBelowReqLevel = 0
AuctionHouseBot.DisableItemsAboveReqLevel = 0
AuctionHouseBot.DisableTGsBelowReqLevel = 0
AuctionHouseBot.DisableTGsAboveReqLevel = 0
AuctionHouseBot.DisableItemsBelowReqSkillRank = 0
AuctionHouseBot.DisableItemsAboveReqSkillRank = 0
AuctionHouseBot.DisableTGsBelowReqSkillRank = 0
AuctionHouseBot.DisableTGsAboveReqSkillRank = 0

View File

@@ -0,0 +1,93 @@
/*
Navicat MySQL Data Transfer
Source Server : localhost_3306
Source Server Version : 50509
Source Host : 127.0.0.1:3306
Source Database : _test_world
Target Server Type : MYSQL
Target Server Version : 50509
File Encoding : 65001
Date: 2018-05-13 21:34:11
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for auctionhousebot
-- ----------------------------
DROP TABLE IF EXISTS `auctionhousebot`;
CREATE TABLE `auctionhousebot` (
`auctionhouse` int(11) NOT NULL DEFAULT '0' COMMENT 'mapID of the auctionhouse.',
`name` char(25) DEFAULT NULL COMMENT 'Text name of the auctionhouse.',
`minitems` int(11) DEFAULT '0' COMMENT 'This is the minimum number of items you want to keep in the auction house. a 0 here will make it the same as the maximum.',
`maxitems` int(11) DEFAULT '0' COMMENT 'This is the number of items you want to keep in the auction house.',
`percentgreytradegoods` int(11) DEFAULT '0' COMMENT 'Sets the percentage of the Grey Trade Goods auction items',
`percentwhitetradegoods` int(11) DEFAULT '27' COMMENT 'Sets the percentage of the White Trade Goods auction items',
`percentgreentradegoods` int(11) DEFAULT '12' COMMENT 'Sets the percentage of the Green Trade Goods auction items',
`percentbluetradegoods` int(11) DEFAULT '10' COMMENT 'Sets the percentage of the Blue Trade Goods auction items',
`percentpurpletradegoods` int(11) DEFAULT '1' COMMENT 'Sets the percentage of the Purple Trade Goods auction items',
`percentorangetradegoods` int(11) DEFAULT '0' COMMENT 'Sets the percentage of the Orange Trade Goods auction items',
`percentyellowtradegoods` int(11) DEFAULT '0' COMMENT 'Sets the percentage of the Yellow Trade Goods auction items',
`percentgreyitems` int(11) DEFAULT '0' COMMENT 'Sets the percentage of the non trade Grey auction items',
`percentwhiteitems` int(11) DEFAULT '10' COMMENT 'Sets the percentage of the non trade White auction items',
`percentgreenitems` int(11) DEFAULT '30' COMMENT 'Sets the percentage of the non trade Green auction items',
`percentblueitems` int(11) DEFAULT '8' COMMENT 'Sets the percentage of the non trade Blue auction items',
`percentpurpleitems` int(11) DEFAULT '2' COMMENT 'Sets the percentage of the non trade Purple auction items',
`percentorangeitems` int(11) DEFAULT '0' COMMENT 'Sets the percentage of the non trade Orange auction items',
`percentyellowitems` int(11) DEFAULT '0' COMMENT 'Sets the percentage of the non trade Yellow auction items',
`minpricegrey` int(11) DEFAULT '100' COMMENT 'Minimum price of Grey items (percentage).',
`maxpricegrey` int(11) DEFAULT '150' COMMENT 'Maximum price of Grey items (percentage).',
`minpricewhite` int(11) DEFAULT '150' COMMENT 'Minimum price of White items (percentage).',
`maxpricewhite` int(11) DEFAULT '250' COMMENT 'Maximum price of White items (percentage).',
`minpricegreen` int(11) DEFAULT '800' COMMENT 'Minimum price of Green items (percentage).',
`maxpricegreen` int(11) DEFAULT '1400' COMMENT 'Maximum price of Green items (percentage).',
`minpriceblue` int(11) DEFAULT '1250' COMMENT 'Minimum price of Blue items (percentage).',
`maxpriceblue` int(11) DEFAULT '1750' COMMENT 'Maximum price of Blue items (percentage).',
`minpricepurple` int(11) DEFAULT '2250' COMMENT 'Minimum price of Purple items (percentage).',
`maxpricepurple` int(11) DEFAULT '4550' COMMENT 'Maximum price of Purple items (percentage).',
`minpriceorange` int(11) DEFAULT '3250' COMMENT 'Minimum price of Orange items (percentage).',
`maxpriceorange` int(11) DEFAULT '5550' COMMENT 'Maximum price of Orange items (percentage).',
`minpriceyellow` int(11) DEFAULT '5250' COMMENT 'Minimum price of Yellow items (percentage).',
`maxpriceyellow` int(11) DEFAULT '6550' COMMENT 'Maximum price of Yellow items (percentage).',
`minbidpricegrey` int(11) DEFAULT '70' COMMENT 'Starting bid price of Grey items as a percentage of the randomly chosen buyout price. Default: 70',
`maxbidpricegrey` int(11) DEFAULT '100' COMMENT 'Starting bid price of Grey items as a percentage of the randomly chosen buyout price. Default: 100',
`minbidpricewhite` int(11) DEFAULT '70' COMMENT 'Starting bid price of White items as a percentage of the randomly chosen buyout price. Default: 70',
`maxbidpricewhite` int(11) DEFAULT '100' COMMENT 'Starting bid price of White items as a percentage of the randomly chosen buyout price. Default: 100',
`minbidpricegreen` int(11) DEFAULT '80' COMMENT 'Starting bid price of Green items as a percentage of the randomly chosen buyout price. Default: 80',
`maxbidpricegreen` int(11) DEFAULT '100' COMMENT 'Starting bid price of Green items as a percentage of the randomly chosen buyout price. Default: 100',
`minbidpriceblue` int(11) DEFAULT '75' COMMENT 'Starting bid price of Blue items as a percentage of the randomly chosen buyout price. Default: 75',
`maxbidpriceblue` int(11) DEFAULT '100' COMMENT 'Starting bid price of Blue items as a percentage of the randomly chosen buyout price. Default: 100',
`minbidpricepurple` int(11) DEFAULT '80' COMMENT 'Starting bid price of Purple items as a percentage of the randomly chosen buyout price. Default: 80',
`maxbidpricepurple` int(11) DEFAULT '100' COMMENT 'Starting bid price of Purple items as a percentage of the randomly chosen buyout price. Default: 100',
`minbidpriceorange` int(11) DEFAULT '80' COMMENT 'Starting bid price of Orange items as a percentage of the randomly chosen buyout price. Default: 80',
`maxbidpriceorange` int(11) DEFAULT '100' COMMENT 'Starting bid price of Orange items as a percentage of the randomly chosen buyout price. Default: 100',
`minbidpriceyellow` int(11) DEFAULT '80' COMMENT 'Starting bid price of Yellow items as a percentage of the randomly chosen buyout price. Default: 80',
`maxbidpriceyellow` int(11) DEFAULT '100' COMMENT 'Starting bid price of Yellow items as a percentage of the randomly chosen buyout price. Default: 100',
`maxstackgrey` int(11) DEFAULT '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.',
`maxstackwhite` int(11) DEFAULT '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.',
`maxstackgreen` int(11) DEFAULT '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.',
`maxstackblue` int(11) DEFAULT '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.',
`maxstackpurple` int(11) DEFAULT '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.',
`maxstackorange` int(11) DEFAULT '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.',
`maxstackyellow` int(11) DEFAULT '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.',
`buyerpricegrey` int(11) DEFAULT '1' COMMENT 'Multiplier to vendorprice when buying grey items from auctionhouse',
`buyerpricewhite` int(11) DEFAULT '3' COMMENT 'Multiplier to vendorprice when buying white items from auctionhouse',
`buyerpricegreen` int(11) DEFAULT '5' COMMENT 'Multiplier to vendorprice when buying green items from auctionhouse',
`buyerpriceblue` int(11) DEFAULT '12' COMMENT 'Multiplier to vendorprice when buying blue items from auctionhouse',
`buyerpricepurple` int(11) DEFAULT '15' COMMENT 'Multiplier to vendorprice when buying purple items from auctionhouse',
`buyerpriceorange` int(11) DEFAULT '20' COMMENT 'Multiplier to vendorprice when buying orange items from auctionhouse',
`buyerpriceyellow` int(11) DEFAULT '22' COMMENT 'Multiplier to vendorprice when buying yellow items from auctionhouse',
`buyerbiddinginterval` int(11) DEFAULT '1' COMMENT 'Interval how frequently AHB bids on each AH. Time in minutes',
`buyerbidsperinterval` int(11) DEFAULT '1' COMMENT 'number of bids to put in per bidding interval',
PRIMARY KEY (`auctionhouse`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of auctionhousebot
-- ----------------------------
INSERT INTO `auctionhousebot` VALUES ('2', 'Alliance', '250', '250', '0', '27', '12', '10', '1', '0', '0', '0', '10', '30', '8', '2', '0', '0', '100', '150', '150', '250', '800', '1400', '1250', '1750', '2250', '4550', '3250', '5550', '5250', '6550', '70', '100', '70', '100', '80', '100', '75', '100', '80', '100', '80', '100', '80', '100', '0', '0', '3', '2', '1', '1', '1', '1', '3', '5', '12', '15', '20', '22', '1', '1');
INSERT INTO `auctionhousebot` VALUES ('6', 'Horde', '250', '250', '0', '27', '12', '10', '1', '0', '0', '0', '10', '30', '8', '2', '0', '0', '100', '150', '150', '250', '800', '1400', '1250', '1750', '2250', '4550', '3250', '5550', '5250', '6550', '70', '100', '70', '100', '80', '100', '75', '100', '80', '100', '80', '100', '80', '100', '0', '0', '3', '2', '1', '1', '1', '1', '3', '5', '12', '15', '20', '22', '1', '1');
INSERT INTO `auctionhousebot` VALUES ('7', 'Neutral', '250', '250', '0', '27', '12', '10', '1', '0', '0', '0', '10', '30', '8', '2', '0', '0', '100', '150', '150', '250', '800', '1400', '1250', '1750', '2250', '4550', '3250', '5550', '5250', '6550', '70', '100', '70', '100', '80', '100', '75', '100', '80', '100', '80', '100', '80', '100', '0', '0', '3', '2', '1', '1', '1', '1', '3', '5', '12', '15', '20', '22', '1', '1');

1898
src/AuctionHouseBot.cpp Normal file

File diff suppressed because it is too large Load Diff

1262
src/AuctionHouseBot.h Normal file

File diff suppressed because it is too large Load Diff

483
src/cs_ah_bot.cpp Normal file
View File

@@ -0,0 +1,483 @@
/*
* Copyright (C) 2008-2012 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/>.
*/
/* ScriptData
Name: ah_bot_commandscript
%Complete: 100
Comment: All ah_bot related commands
Category: commandscripts
EndScriptData */
#include "ScriptMgr.h"
#include "Chat.h"
#include "AuctionHouseBot.h"
#include "Config.h"
class ah_bot_commandscript : public CommandScript
{
public:
ah_bot_commandscript() : CommandScript("ah_bot_commandscript") { }
std::vector<ChatCommand> GetCommands() const override
{
static std::vector<ChatCommand> commandTable =
{
{ "ahbotoptions", SEC_GAMEMASTER, true, &HandleAHBotOptionsCommand, "" },
{ NULL, 0, false, NULL, "" }
};
return commandTable;
}
static bool HandleAHBotOptionsCommand(ChatHandler* handler, const char*args)
{
uint32 ahMapID = 0;
char* opt = strtok((char*)args, " ");
char* ahMapIdStr = strtok(NULL, " ");
if (ahMapIdStr)
{
ahMapID = uint32(strtoul(ahMapIdStr, NULL, 0));
switch (ahMapID)
{
case 2:
case 6:
case 7:
break;
default:
opt = NULL;
break;
}
}
if (!opt)
{
handler->PSendSysMessage("Syntax is: ahbotoptions $option $ahMapID (2, 6 or 7) $parameter");
handler->PSendSysMessage("Try ahbotoptions help to see a list of options.");
return false;
}
int l = strlen(opt);
if (strncmp(opt, "help", l) == 0)
{
handler->PSendSysMessage("AHBot commands:");
handler->PSendSysMessage("ahexpire");
handler->PSendSysMessage("minitems");
handler->PSendSysMessage("maxitems");
//handler->PSendSysMessage("");
//handler->PSendSysMessage("");
handler->PSendSysMessage("percentages");
handler->PSendSysMessage("minprice");
handler->PSendSysMessage("maxprice");
handler->PSendSysMessage("minbidprice");
handler->PSendSysMessage("maxbidprice");
handler->PSendSysMessage("maxstack");
handler->PSendSysMessage("buyerprice");
handler->PSendSysMessage("bidinterval");
handler->PSendSysMessage("bidsperinterval");
return true;
}
else if (strncmp(opt, "ahexpire", l) == 0)
{
if (!ahMapIdStr)
{
handler->PSendSysMessage("Syntax is: ahbotoptions ahexpire $ahMapID (2, 6 or 7)");
return false;
}
auctionbot->Commands(0, ahMapID, NULL, NULL);
}
else if (strncmp(opt, "minitems", l) == 0)
{
char* param1 = strtok(NULL, " ");
if (!ahMapIdStr || !param1)
{
handler->PSendSysMessage("Syntax is: ahbotoptions minitems $ahMapID (2, 6 or 7) $minItems");
return false;
}
auctionbot->Commands(1, ahMapID, NULL, param1);
}
else if (strncmp(opt, "maxitems", l) == 0)
{
char* param1 = strtok(NULL, " ");
if (!ahMapIdStr || !param1)
{
handler->PSendSysMessage("Syntax is: ahbotoptions maxitems $ahMapID (2, 6 or 7) $maxItems");
return false;
}
auctionbot->Commands(2, ahMapID, NULL, param1);
}
else if (strncmp(opt, "mintime", l) == 0)
{
handler->PSendSysMessage("ahbotoptions mintime has been deprecated");
return false;
/*
char* param1 = strtok(NULL, " ");
if (!ahMapIdStr || !param1)
{
PSendSysMessage("Syntax is: ahbotoptions mintime $ahMapID (2, 6 or 7) $mintime");
return false;
}
auctionbot.Commands(3, ahMapID, NULL, param1);
*/
}
else if (strncmp(opt, "maxtime", l) == 0)
{
handler->PSendSysMessage("ahbotoptions maxtime has been deprecated");
return false;
/*
char* param1 = strtok(NULL, " ");
if (!ahMapIdStr || !param1)
{
PSendSysMessage("Syntax is: ahbotoptions maxtime $ahMapID (2, 6 or 7) $maxtime");
return false;
}
auctionbot.Commands(4, ahMapID, NULL, param1);
*/
}
else if (strncmp(opt, "percentages", l) == 0)
{
char* param1 = strtok(NULL, " ");
char* param2 = strtok(NULL, " ");
char* param3 = strtok(NULL, " ");
char* param4 = strtok(NULL, " ");
char* param5 = strtok(NULL, " ");
char* param6 = strtok(NULL, " ");
char* param7 = strtok(NULL, " ");
char* param8 = strtok(NULL, " ");
char* param9 = strtok(NULL, " ");
char* param10 = strtok(NULL, " ");
char* param11 = strtok(NULL, " ");
char* param12 = strtok(NULL, " ");
char* param13 = strtok(NULL, " ");
char* param14 = strtok(NULL, " ");
if (!ahMapIdStr || !param14)
{
handler->PSendSysMessage("Syntax is: ahbotoptions percentages $ahMapID (2, 6 or 7) $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14");
handler->PSendSysMessage("1 GreyTradeGoods 2 WhiteTradeGoods 3 GreenTradeGoods 4 BlueTradeGoods 5 PurpleTradeGoods");
handler->PSendSysMessage("6 OrangeTradeGoods 7 YellowTradeGoods 8 GreyItems 9 WhiteItems 10 GreenItems 11 BlueItems");
handler->PSendSysMessage("12 PurpleItems 13 OrangeItems 14 YellowItems");
handler->PSendSysMessage("The total must add up to 100%%");
return false;
}
uint32 greytg = uint32(strtoul(param1, NULL, 0));
uint32 whitetg = uint32(strtoul(param2, NULL, 0));
uint32 greentg = uint32(strtoul(param3, NULL, 0));
uint32 bluetg = uint32(strtoul(param3, NULL, 0));
uint32 purpletg = uint32(strtoul(param5, NULL, 0));
uint32 orangetg = uint32(strtoul(param6, NULL, 0));
uint32 yellowtg = uint32(strtoul(param7, NULL, 0));
uint32 greyi = uint32(strtoul(param8, NULL, 0));
uint32 whitei = uint32(strtoul(param9, NULL, 0));
uint32 greeni = uint32(strtoul(param10, NULL, 0));
uint32 bluei = uint32(strtoul(param11, NULL, 0));
uint32 purplei = uint32(strtoul(param12, NULL, 0));
uint32 orangei = uint32(strtoul(param13, NULL, 0));
uint32 yellowi = uint32(strtoul(param14, NULL, 0));
uint32 totalPercent = greytg + whitetg + greentg + bluetg + purpletg + orangetg + yellowtg + greyi + whitei + greeni + bluei + purplei + orangei + yellowi;
if (totalPercent == 0 || totalPercent != 100)
{
handler->PSendSysMessage("Syntax is: ahbotoptions percentages $ahMapID (2, 6 or 7) $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14");
handler->PSendSysMessage("1 GreyTradeGoods 2 WhiteTradeGoods 3 GreenTradeGoods 4 BlueTradeGoods 5 PurpleTradeGoods");
handler->PSendSysMessage("6 OrangeTradeGoods 7 YellowTradeGoods 8 GreyItems 9 WhiteItems 10 GreenItems 11 BlueItems");
handler->PSendSysMessage("12 PurpleItems 13 OrangeItems 14 YellowItems");
handler->PSendSysMessage("The total must add up to 100%%");
return false;
}
char param[100];
param[0] = '\0';
strcat(param, param1);
strcat(param, " ");
strcat(param, param2);
strcat(param, " ");
strcat(param, param3);
strcat(param, " ");
strcat(param, param4);
strcat(param, " ");
strcat(param, param5);
strcat(param, " ");
strcat(param, param6);
strcat(param, " ");
strcat(param, param7);
strcat(param, " ");
strcat(param, param8);
strcat(param, " ");
strcat(param, param9);
strcat(param, " ");
strcat(param, param10);
strcat(param, " ");
strcat(param, param11);
strcat(param, " ");
strcat(param, param12);
strcat(param, " ");
strcat(param, param13);
strcat(param, " ");
strcat(param, param14);
auctionbot->Commands(5, ahMapID, NULL, param);
}
else if (strncmp(opt, "minprice", l) == 0)
{
char* param1 = strtok(NULL, " ");
char* param2 = strtok(NULL, " ");
if (!ahMapIdStr || !param1 || !param2)
{
handler->PSendSysMessage("Syntax is: ahbotoptions minprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price");
return false;
}
if (strncmp(param1, "grey", l) == 0)
auctionbot->Commands(6, ahMapID, AHB_GREY, param2);
else if (strncmp(param1, "white", l) == 0)
auctionbot->Commands(6, ahMapID, AHB_WHITE, param2);
else if (strncmp(param1, "green", l) == 0)
auctionbot->Commands(6, ahMapID, AHB_GREEN, param2);
else if (strncmp(param1, "blue", l) == 0)
auctionbot->Commands(6, ahMapID, AHB_BLUE, param2);
else if (strncmp(param1, "purple", l) == 0)
auctionbot->Commands(6, ahMapID, AHB_PURPLE, param2);
else if (strncmp(param1, "orange", l) == 0)
auctionbot->Commands(6, ahMapID, AHB_ORANGE, param2);
else if (strncmp(param1, "yellow", l) == 0)
auctionbot->Commands(6, ahMapID, AHB_YELLOW, param2);
else
{
handler->PSendSysMessage("Syntax is: ahbotoptions minprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price");
return false;
}
}
else if (strncmp(opt, "maxprice", l) == 0)
{
char* param1 = strtok(NULL, " ");
char* param2 = strtok(NULL, " ");
if (!ahMapIdStr || !param1 || !param2)
{
handler->PSendSysMessage("Syntax is: ahbotoptions maxprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price");
return false;
}
if (strncmp(param1, "grey", l) == 0)
auctionbot->Commands(7, ahMapID, AHB_GREY, param2);
else if (strncmp(param1, "white", l) == 0)
auctionbot->Commands(7, ahMapID, AHB_WHITE, param2);
else if (strncmp(param1, "green", l) == 0)
auctionbot->Commands(7, ahMapID, AHB_GREEN, param2);
else if (strncmp(param1, "blue", l) == 0)
auctionbot->Commands(7, ahMapID, AHB_BLUE, param2);
else if (strncmp(param1, "purple", l) == 0)
auctionbot->Commands(7, ahMapID, AHB_PURPLE, param2);
else if (strncmp(param1, "orange",l) == 0)
auctionbot->Commands(7, ahMapID, AHB_ORANGE, param2);
else if (strncmp(param1, "yellow", l) == 0)
auctionbot->Commands(7, ahMapID, AHB_YELLOW, param2);
else
{
handler->PSendSysMessage("Syntax is: ahbotoptions maxprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price");
return false;
}
}
else if (strncmp(opt, "minbidprice", l) == 0)
{
char* param1 = strtok(NULL, " ");
char* param2 = strtok(NULL, " ");
if (!ahMapIdStr || !param2 || !param2)
{
handler->PSendSysMessage("Syntax is: ahbotoptions minbidprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price");
return false;
}
uint32 minBidPrice = uint32(strtoul(param2, NULL, 0));
if (minBidPrice < 1 || minBidPrice > 100)
{
handler->PSendSysMessage("The min bid price multiplier must be between 1 and 100");
return false;
}
if (strncmp(param1, "grey", l) == 0)
auctionbot->Commands(8, ahMapID, AHB_GREY, param2);
else if (strncmp(param1, "white", l) == 0)
auctionbot->Commands(8, ahMapID, AHB_WHITE, param2);
else if (strncmp(param1, "green", l) == 0)
auctionbot->Commands(8, ahMapID, AHB_GREEN, param2);
else if (strncmp(param1, "blue", l) == 0)
auctionbot->Commands(8, ahMapID, AHB_BLUE, param2);
else if (strncmp(param1, "purple", l) == 0)
auctionbot->Commands(8, ahMapID, AHB_PURPLE, param2);
else if (strncmp(param1, "orange", l) == 0)
auctionbot->Commands(8, ahMapID, AHB_ORANGE, param2);
else if (strncmp(param1, "yellow", l) == 0)
auctionbot->Commands(8, ahMapID, AHB_YELLOW, param2);
else
{
handler->PSendSysMessage("Syntax is: ahbotoptions minbidprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price");
return false;
}
}
else if (strncmp(opt, "maxbidprice", l) == 0)
{
char* param1 = strtok(NULL, " ");
char* param2 = strtok(NULL, " ");
if (!ahMapIdStr || !param1 || !param2)
{
handler->PSendSysMessage("Syntax is: ahbotoptions maxbidprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price");
return false;
}
uint32 maxBidPrice = uint32(strtoul(param2, NULL, 0));
if (maxBidPrice < 1 || maxBidPrice > 100)
{
handler->PSendSysMessage("The max bid price multiplier must be between 1 and 100");
return false;
}
if (strncmp(param1, "grey", l) == 0)
auctionbot->Commands(9, ahMapID, AHB_GREY, param2);
else if (strncmp(param1, "white", l) == 0)
auctionbot->Commands(9, ahMapID, AHB_WHITE, param2);
else if (strncmp(param1, "green", l) == 0)
auctionbot->Commands(9, ahMapID, AHB_GREEN, param2);
else if (strncmp(param1, "blue", l) == 0)
auctionbot->Commands(9, ahMapID, AHB_BLUE, param2);
else if (strncmp(param1, "purple", l) == 0)
auctionbot->Commands(9, ahMapID, AHB_PURPLE, param2);
else if (strncmp(param1, " orange", l) == 0)
auctionbot->Commands(9, ahMapID, AHB_ORANGE, param2);
else if (strncmp(param1, "yellow", l) == 0)
auctionbot->Commands(9, ahMapID, AHB_YELLOW, param2);
else
{
handler->PSendSysMessage("Syntax is: ahbotoptions max bidprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price");
return false;
}
}
else if (strncmp(opt, "maxstack",l) == 0)
{
char* param1 = strtok(NULL, " ");
char* param2 = strtok(NULL, " ");
if (!ahMapIdStr || !param1 || !param2)
{
handler->PSendSysMessage("Syntax is: ahbotoptions maxstack $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $value");
return false;
}
// uint32 maxStack = uint32(strtoul(param2, NULL, 0));
// if (maxStack < 0)
// {
// handler->PSendSysMessage("maxstack can't be a negative number.");
// return false;
// }
if (strncmp(param1, "grey",l) == 0)
auctionbot->Commands(10, ahMapID, AHB_GREY, param2);
else if (strncmp(param1, "white", l) == 0)
auctionbot->Commands(10, ahMapID, AHB_WHITE, param2);
else if (strncmp(param1, "green", l) == 0)
auctionbot->Commands(10, ahMapID, AHB_GREEN, param2);
else if (strncmp(param1, "blue", l) == 0)
auctionbot->Commands(10, ahMapID, AHB_BLUE, param2);
else if (strncmp(param1, "purple", l) == 0)
auctionbot->Commands(10, ahMapID, AHB_PURPLE, param2);
else if (strncmp(param1, "orange", l) == 0)
auctionbot->Commands(10, ahMapID, AHB_ORANGE, param2);
else if (strncmp(param1, "yellow", l) == 0)
auctionbot->Commands(10, ahMapID, AHB_YELLOW, param2);
else
{
handler->PSendSysMessage("Syntax is: ahbotoptions maxstack $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $value");
return false;
}
}
else if (strncmp(opt, "buyerprice", l) == 0)
{
char* param1 = strtok(NULL, " ");
char* param2 = strtok(NULL, " ");
if (!ahMapIdStr || !param1 || !param2)
{
handler->PSendSysMessage("Syntax is: ahbotoptions buyerprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue or purple) $price");
return false;
}
if (strncmp(param1, "grey", l) == 0)
auctionbot->Commands(11, ahMapID, AHB_GREY, param2);
else if (strncmp(param1, "white", l) == 0)
auctionbot->Commands(11, ahMapID, AHB_WHITE, param2);
else if (strncmp(param1, "green", l) == 0)
auctionbot->Commands(11, ahMapID, AHB_GREEN, param2);
else if (strncmp(param1, "blue", l) == 0)
auctionbot->Commands(11, ahMapID, AHB_BLUE, param2);
else if (strncmp(param1, "purple", l) == 0)
auctionbot->Commands(11, ahMapID, AHB_PURPLE, param2);
else if (strncmp(param1, "orange", l) == 0)
auctionbot->Commands(11, ahMapID, AHB_ORANGE, param2);
else if (strncmp(param1, "yellow", l) == 0)
auctionbot->Commands(11, ahMapID, AHB_YELLOW, param2);
else
{
handler->PSendSysMessage("Syntax is: ahbotoptions buyerprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue or purple) $price");
return false;
}
}
else if (strncmp(opt, "bidinterval", l) == 0)
{
char* param1 = strtok(NULL, " ");
if (!ahMapIdStr || !param1)
{
handler->PSendSysMessage("Syntax is: ahbotoptions bidinterval $ahMapID (2, 6 or 7) $interval(in minutes)");
return false;
}
auctionbot->Commands(12, ahMapID, NULL, param1);
}
else if (strncmp(opt, "bidsperinterval", l) == 0)
{
char* param1 = strtok(NULL, " ");
if (!ahMapIdStr || !param1)
{
handler->PSendSysMessage("Syntax is: ahbotoptions bidsperinterval $ahMapID (2, 6 or 7) $bids");
return false;
}
auctionbot->Commands(13, ahMapID, NULL, param1);
}
else
{
handler->PSendSysMessage("Syntax is: ahbotoptions $option $ahMapID (2, 6 or 7) $parameter");
handler->PSendSysMessage("Try ahbotoptions help to see a list of options.");
return false;
}
return true;
}
};
void AddSC_ah_bot_commandscript()
{
new ah_bot_commandscript();
}

6
src/loader_cs_ah_bot.h Normal file
View File

@@ -0,0 +1,6 @@
void AddSC_ah_bot_commandscript();
void AddAHBotCommandScripts()
{
AddSC_ah_bot_commandscript();
}