AHBot/AH changes

--HG--
branch : trunk
This commit is contained in:
2009-02-28 17:42:29 -05:00
parent 449bf7b34e
commit ef8d2ac080
19 changed files with 1114 additions and 1358 deletions
+55 -50
View File
@@ -53,21 +53,53 @@ AuctionHouseBot.UseBuyPriceForBuyer Use SellPrice (0) or BuyPrice (1) for determ
#These are the settings in the Database:
#Each Auctionhouse has it's own set of these
MinItems = 0
MaxItems = 0
MinTime = 8
MaxTime = 24
MinItems = 0
#The Minimum number of items you want to keep in the auction houses.
#(default 0 - minimum will be the same as maximum).
#If it is higher than the value of the corresponding maxItems setting,
#it will be set down to match the maxItems setting.
MaxItems = 0
#The Maximum number of items you want to keep in the auction houses.
MinTime = 8
#The minimum number of hours for an auction.
MaxTime = 24
#The maximum number of hours for an auction.
#These must add up to 100 each one is the percentage
#of the auction items that should be trade goods of
#that quality. A value of 0 will disable.
PercentGreyTradeGoods = 0
PercentWhiteTradeGoods = 27
PercentGreenTradeGoods = 12
PercentBlueTradeGoods = 10
PercentPurpleTradeGoods = 1
PercentOrangeTradeGoods = 0
PercentYellowTradeGoods = 0
PercentGreyItems = 0
PercentWhiteItems = 10
PercentGreenItems = 30
PercentBlueItems = 8
PercentPurpleItems = 2
PercentOrangeItems = 0
PercentYellowItems = 0
#MinPrice(Color) is the minimum price adjustment for items. For example the default is 150, which means 150%. So if an item vendors for 1g it would go to auction for a minimum of 1.5g.
#MaxPrice(Color) is the maximum price adjustment for items.
#MinBidPrice(Color) these two control the starting bid as a percent of the buyout price. For example, if MinBidPrice is 30 and MaxBidPrice is 80 the starting bid for the auction will randomly be between 30-80% of the randomly chosen buyout price.
#MaxBidPrice(Color) these two control the starting bid as a percent of the buyout price. For example, if MinBidPrice is 30 and MaxBidPrice is 80 the starting bid for the auction will randomly be between 30-80% of the randomly chosen buyout price.
#MaxStack(Color) is maximum stack size to create for this quality type. A value of zero will disable the maximum stack size for this quality allowing the bot to create stacks (of random size) of items as big as the item type allows.
MinPriceGrey = 100
MaxPriceGrey = 150
MinBidPriceGrey = 70
MaxBidPriceGrey = 100
MaxStackGrey = 0
MinPriceWhite = 150
MaxPriceWhite = 250
MinBidPriceWhite = 70
@@ -88,62 +120,35 @@ MaxPricePurple = 4550
MinBidPricePurple = 80
MaxBidPricePurple = 100
MaxStackPurple = 1
MinPriceOrange = 4250
MaxPriceOrange = 5550
MinBidPriceOrange = 80
MaxBidPriceOrange = 100
MaxStackOrange = 0
MinPriceYellow = 5250
MaxPriceYellow = 6550
MinBidPriceYellow = 80
MaxBidPriceYellow = 100
MaxStackYellow = 0
#These are the multipliers that are applied to the vendor price for an item, that determines if AHBot will buy it or not.
#1 means AHBot will pay the same as (or less than) a vendor would pay, 2 means up to twice as much, etc.
BuyerPriceGrey = 1
BuyerPriceWhite = 1
BuyerPriceGreen = 5
BuyerPriceBlue = 12
BuyerPricePurple = 15
BuyerPriceOrange = 20
BuyerPriceYellow = 22
#BuyerBiddingInterval is the time (in minutes) between bids.
#BuyerBidsPerInterval is the number of bids the buyer will make in a cycle
BuyerBiddingInterval = 1
BuyerBidsPerInterval = 1
MaxItems is the number of items you want to keep in the auction houses.
MinItems Minimum items in auctionhouses (default 0 - minimum will be the same as maximum). If it is higher than the value of the corresponding maxItems setting, it will be set down to match the maxItems setting.
MinTime is the minimum number of hours for an auction.
MaxTime is the maximum number of hours for an auction.
#These must add up to 100
PercentWhiteTradeGoods is the percentage of the auction items that should be trade goods of white quality. A value of 0 will disable.
PercentGreenTradeGoods is the percentage of the auction items that should be trade goods of green quality. A value of 0 will disable.
PercentBlueTradeGoods is the percentage of the auction items that should be trade goods of blue quality. A value of 0 will disable.
PercentPurpleTradeGoods is the percentage of the auction items that should be trade goods of purple quality. A value of 0 will disable.
PercentWhiteItems is the percentage of the auction items that should be items of white quality. A value of 0 will disable.
PercentGreenItems is the percentage of the auction items that should be items of green quality. A value of 0 will disable.
PercentBlueItems is the percentage of the auction items that should be items of blue quality. A value of 0 will disable.
PercentPurpleItems is the percentage of the auction items that should be items of purple quality. A value of 0 will disable.
MinPriceWhite is the minimum price adjustment for white items. For example the default is 150, which means 150%. So if an item vendors for 1g it would go to auction for a minimum of 1.5g.
MaxPriceWhite is the maximum price adjustment for white items.
MinBidPriceWhite these two control the starting bid as a percent of the buyout price. For example, if MinBidPrice is 30 and MaxBidPrice is 80 the starting bid for the auction will randomly be between 30-80% of the randomly chosen buyout price.
MaxBidPriceWhite these two control the starting bid as a percent of the buyout price. For example, if MinBidPrice is 30 and MaxBidPrice is 80 the starting bid for the auction will randomly be between 30-80% of the randomly chosen buyout price.
MaxStackWhite is maximum stack size to create for this quality type. A value of zero will disable the maximum stack size for this quality allowing the bot to create stacks (of random size) of items as big as the item type allows.
MinPriceGreen - see above
MaxPriceGreen - see above
MinBidPriceGreen - see above
MaxBidPriceGreen - see above
MaxStackGreen - see above
MinPriceBlue - see above
MaxPriceBlue - see above
MinBidPriceBlue - see above
MaxBidPriceBlue - see above
MaxStackBlue - see above
MinPricePurple - see above
MaxPricePurple - see above
MinBidPricePurple - see above
MaxBidPricePurple - see above
MaxStackPurple - see above
#These are the multipliers that are applied to the vendor price for an item, that determines if AHBot will buy it or not.
#1 means AHBot will pay the same as (or less than) a vendor would pay, 2 means up to twice as much, etc.
BuyerPriceGrey
BuyerPriceWhite
BuyerPriceGreen
BuyerPriceBlue
BuyerPricePurple
BuyerBiddingInterval is the time (in minutes) between bids.
BuyerBidsPerInterval is the number of bids the buyer will make in a cycle
How to use ahcommands from the console (CLI) or in game with GM level 3 players:
ahbotoptions - will display usage instructions
+35 -12
View File
@@ -156,14 +156,22 @@ CREATE TABLE `auctionhousebot` (
`maxitems` int(11) default '0' COMMENT 'This is the number of items you want to keep in the auction house.',
`mintime` int(11) default '8' COMMENT 'Sets the minimum number of hours for an auction.',
`maxtime` int(11) default '24' COMMENT 'Sets the maximum number of hours for an auction.',
`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).',
@@ -172,23 +180,38 @@ CREATE TABLE `auctionhousebot` (
`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).',
`minbidpricewhite` int(11) default '70' COMMENT 'Starting bid price of White items as a percentage of the randomly chosen buyout price. Default: 100 (Bid and buyout price the same)',
`maxbidpricewhite` int(11) default '100' COMMENT 'Starting bid price of White items as a percentage of the randomly chosen buyout price. Default: 100 (Bid and buyout price the same)',
`minbidpricegreen` int(11) default '80' COMMENT 'Starting bid price of Green items as a percentage of the randomly chosen buyout price. Default: 100 (Bid and buyout price the same)',
`maxbidpricegreen` int(11) default '100' COMMENT 'Starting bid price of Green items as a percentage of the randomly chosen buyout price. Default: 100 (Bid and buyout price the same)',
`minbidpriceblue` int(11) default '75' COMMENT 'Starting bid price of Blue items as a percentage of the randomly chosen buyout price. Default: 100 (Bid and buyout price the same)',
`maxbidpriceblue` int(11) default '100' COMMENT 'Starting bid price of Blue items as a percentage of the randomly chosen buyout price. Default: 100 (Bid and buyout price the same)',
`minbidpricepurple` int(11) default '80' COMMENT 'Starting bid price of Purple items as a percentage of the randomly chosen buyout price. Default: 100 (Bid and buyout price the same)',
`maxbidpricepurple` int(11) default '100' COMMENT 'Starting bid price of Purple items as a percentage of the randomly chosen buyout price. Default: 100 (Bid and buyout price the same)',
`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 '3' 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 '2' 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 '1' 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 '1' 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 '1' 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 '1' 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`)
@@ -198,10 +221,10 @@ CREATE TABLE `auctionhousebot` (
-- Data for table `auctionhousebot`
--
insert into `auctionhousebot`(`auctionhouse`,`name`,`minitems`,`maxitems`,`mintime`,`maxtime`,`percentwhitetradegoods`,`percentgreentradegoods`,`percentbluetradegoods`,`percentpurpletradegoods`,`percentwhiteitems`,`percentgreenitems`,`percentblueitems`,`percentpurpleitems`,`minpricewhite`,`maxpricewhite`,`minpricegreen`,`maxpricegreen`,`minpriceblue`,`maxpriceblue`,`minpricepurple`,`maxpricepurple`,`minbidpricewhite`,`maxbidpricewhite`,`minbidpricegreen`,`maxbidpricegreen`,`minbidpriceblue`,`maxbidpriceblue`,`minbidpricepurple`,`maxbidpricepurple`,`maxstackwhite`,`maxstackgreen`,`maxstackblue`,`maxstackpurple`,`buyerpricegrey`,`buyerpricewhite`,`buyerpricegreen`,`buyerpriceblue`,`buyerpricepurple`,`buyerbiddinginterval`,`buyerbidsperinterval`) values
(2,'Alliance',0,0,8,24,27,12,10,1,10,30,8,2,150,250,800,1400,1250,1750,2250,4550,70,100,80,100,75,100,80,100,0,3,2,1,1,1,5,12,15,1,1),
(6,'Horde',0,0,8,24,27,12,10,1,10,30,8,2,150,250,800,1400,1250,1750,2250,4550,70,100,80,100,75,100,80,100,0,3,2,1,1,1,5,12,15,1,1),
(7,'Neutral',0,0,8,24,27,12,10,1,10,30,8,2,150,250,800,1400,1250,1750,2250,4550,70,100,80,100,75,100,80,100,0,3,2,1,1,1,5,12,15,1,1);
insert into `auctionhousebot`(`auctionhouse`,`name`,`minitems`,`maxitems`,`mintime`,`maxtime`,`percentgreytradegoods`,`percentwhitetradegoods`,`percentgreentradegoods`,`percentbluetradegoods`,`percentpurpletradegoods`,`percentorangetradegoods`,`percentyellowtradegoods`,`percentgreyitems`,`percentwhiteitems`,`percentgreenitems`,`percentblueitems`,`percentpurpleitems`,`percentorangeitems`,`percentyellowitems`,`minpricegrey`,`maxpricegrey`,`minpricewhite`,`maxpricewhite`,`minpricegreen`,`maxpricegreen`,`minpriceblue`,`maxpriceblue`,`minpricepurple`,`maxpricepurple`,`minpriceorange`,`maxpriceorange`,`minpriceyellow`,`maxpriceyellow`,`minbidpricegrey`,`maxbidpricegrey`,`minbidpricewhite`,`maxbidpricewhite`,`minbidpricegreen`,`maxbidpricegreen`,`minbidpriceblue`,`maxbidpriceblue`,`minbidpricepurple`,`maxbidpricepurple`,`minbidpriceorange`,`maxbidpriceorange`,`minbidpriceyellow`,`maxbidpriceyellow`,`maxstackgrey`,`maxstackwhite`,`maxstackgreen`,`maxstackblue`,`maxstackpurple`,`maxstackorange`,`maxstackyellow`,`buyerpricegrey`,`buyerpricewhite`,`buyerpricegreen`,`buyerpriceblue`,`buyerpricepurple`,`buyerpriceorange`,`buyerpriceyellow`,`buyerbiddinginterval`,`buyerbidsperinterval`) values
(2,'Alliance',0,0,8,24,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,1,5,12,15,20,22,1,1),
(6,'Horde',0,0,8,24,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,1,5,12,15,20,22,1,1),
(7,'Neutral',0,0,8,24,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,1,5,12,15,20,22,1,1);
--
-- Table structure for table `bugreport`
@@ -0,0 +1,24 @@
ALTER TABLE `auctionhousebot`
ADD COLUMN `percentgreytradegoods` int(11) default '0' COMMENT 'Sets the percentage of the Grey Trade Goods auction items' AFTER `maxtime`,
ADD COLUMN `percentorangetradegoods` int(11) default '0' COMMENT 'Sets the percentage of the Orange Trade Goods auction items' AFTER `percentpurpletradegoods`,
ADD COLUMN `percentyellowtradegoods` int(11) default '0' COMMENT 'Sets the percentage of the Yellow Trade Goods auction items' AFTER `percentorangetradegoods`,
ADD COLUMN `percentgreyitems` int(11) default '0' COMMENT 'Sets the percentage of the non trade Grey auction items' AFTER `percentyellowtradegoods`,
ADD COLUMN `percentorangeitems` int(11) default '0' COMMENT 'Sets the percentage of the non trade Orange auction items' AFTER `percentpurpleitems`,
ADD COLUMN `percentyellowitems` int(11) default '0' COMMENT 'Sets the percentage of the non trade Yellow auction items' AFTER `percentorangeitems`,
ADD COLUMN `minpricegrey` int(11) default '100' COMMENT 'Minimum price of Grey items (percentage).' AFTER `percentyellowitems`,
ADD COLUMN `maxpricegrey` int(11) default '150' COMMENT 'Maximum price of Grey items (percentage).' AFTER `minpricegrey`,
ADD COLUMN `minpriceorange` int(11) default '3250' COMMENT 'Minimum price of Orange items (percentage).' AFTER `maxpricepurple`,
ADD COLUMN `maxpriceorange` int(11) default '5550' COMMENT 'Maximum price of Orange items (percentage).' AFTER `minpriceorange`,
ADD COLUMN `minpriceyellow` int(11) default '5250' COMMENT 'Minimum price of Yellow items (percentage).' AFTER `maxpriceorange`,
ADD COLUMN `maxpriceyellow` int(11) default '6550' COMMENT 'Maximum price of Yellow items (percentage).' AFTER `minpriceyellow`,
ADD COLUMN `minbidpricegrey` int(11) default '70' COMMENT 'Starting bid price of Grey items as a percentage of the randomly chosen buyout price. Default: 70' AFTER `maxpriceyellow`,
ADD COLUMN `maxbidpricegrey` int(11) default '100' COMMENT 'Starting bid price of Grey items as a percentage of the randomly chosen buyout price. Default: 100' AFTER `minbidpricegrey`,
ADD COLUMN `minbidpriceorange` int(11) default '80' COMMENT 'Starting bid price of Orange items as a percentage of the randomly chosen buyout price. Default: 80' AFTER `maxbidpricepurple`,
ADD COLUMN `maxbidpriceorange` int(11) default '100' COMMENT 'Starting bid price of Orange items as a percentage of the randomly chosen buyout price. Default: 100' AFTER `minbidpriceorange`,
ADD COLUMN `minbidpriceyellow` int(11) default '80' COMMENT 'Starting bid price of Yellow items as a percentage of the randomly chosen buyout price. Default: 80' AFTER `maxbidpriceorange`,
ADD COLUMN `maxbidpriceyellow` int(11) default '100' COMMENT 'Starting bid price of Yellow items as a percentage of the randomly chosen buyout price. Default: 100' AFTER `minbidpriceyellow`,
ADD COLUMN `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.' AFTER `maxbidpriceyellow`,
ADD COLUMN `maxstackorange` int(11) default '1' 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.' AFTER `maxstackpurple`,
ADD COLUMN `maxstackyellow` int(11) default '1' 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.' AFTER `maxstackorange`,
ADD COLUMN `buyerpriceorange` int(11) default '20' COMMENT 'Multiplier to vendorprice when buying orange items from auctionhouse' AFTER `buyerpricepurple`,
ADD COLUMN `buyerpriceyellow` int(11) default '22' COMMENT 'Multiplier to vendorprice when buying yellow items from auctionhouse' AFTER `buyerpriceorange`;
+2
View File
@@ -50,4 +50,6 @@ INSTALL(FILES
1558_world_spell_linked_spell.sql
1559_world.sql
1570_world.sql
1613_world_scripts.sql
1614_characters_auctionhouse.sql
DESTINATION share/trinity/sql/updates)
-759
View File
@@ -1,759 +0,0 @@
/*
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
*
* Copyright (C) 2008 Trinity <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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "WorldPacket.h"
#include "WorldSession.h"
#include "Opcodes.h"
#include "Log.h"
#include "World.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "UpdateMask.h"
#include "AuctionHouseObject.h"
#include "Util.h"
#include "AuctionHouseBot.h"
//please DO NOT use iterator++, because it is slower than ++iterator!!!
//post-incrementation is always slower than pre-incrementation !
//void called when player click on auctioneer npc
void WorldSession::HandleAuctionHelloOpcode( WorldPacket & recv_data )
{
CHECK_PACKET_SIZE(recv_data,8);
uint64 guid; //NPC guid
recv_data >> guid;
Creature *unit = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid,UNIT_NPC_FLAG_AUCTIONEER);
if (!unit)
{
sLog.outDebug( "WORLD: HandleAuctionHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
return;
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
SendAuctionHello(guid, unit);
}
static uint8 AuctioneerFactionToLocation(uint32 faction)
{
if(sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
return 7; // neutral
FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(faction);
if(!u_entry)
return 7; // neutral
if(u_entry->ourMask & FACTION_MASK_ALLIANCE)
return 2;
else if(u_entry->ourMask & FACTION_MASK_HORDE)
return 6;
else
return 7;
}
//this void causes that auction window is opened
void WorldSession::SendAuctionHello( uint64 guid, Creature* unit )
{
WorldPacket data( MSG_AUCTION_HELLO, 12 );
data << (uint64) guid;
data << (uint32) AuctioneerFactionToLocation(unit->getFaction());
SendPacket( &data );
}
//this function inserts to WorldPacket auction's data
bool WorldSession::SendAuctionInfo(WorldPacket & data, AuctionEntry* auction)
{
Item *pItem = objmgr.GetAItem(auction->item_guidlow);
if (!pItem)
{
sLog.outError("auction to item, that doesn't exist !!!!");
return false;
}
data << (uint32) auction->Id;
data << (uint32) pItem->GetEntry();
for (uint8 i = 0; i < MAX_INSPECTED_ENCHANTMENT_SLOT; i++)
{
data << (uint32) pItem->GetEnchantmentId(EnchantmentSlot(i));
data << (uint32) pItem->GetEnchantmentDuration(EnchantmentSlot(i));
data << (uint32) pItem->GetEnchantmentCharges(EnchantmentSlot(i));
}
data << (uint32) pItem->GetItemRandomPropertyId(); //random item property id
data << (uint32) pItem->GetItemSuffixFactor(); //SuffixFactor
data << (uint32) pItem->GetCount(); //item->count
data << (uint32) pItem->GetSpellCharges(); //item->charge FFFFFFF
data << (uint32) 0; //Unknown
data << (uint64) auction->owner; //Auction->owner
data << (uint32) auction->startbid; //Auction->startbid (not sure if useful)
data << (uint32) ((auction->bid)? objmgr.GetAuctionOutBid(auction->bid) : 0);
//minimal outbid
data << (uint32) auction->buyout; //auction->buyout
data << (uint32) (auction->time - time(NULL)) * 1000; //time left
data << (uint64) auction->bidder; //auction->bidder current
data << (uint32) auction->bid; //current bid
return true;
}
//call this method when player bids, creates, or deletes auction
void WorldSession::SendAuctionCommandResult(uint32 auctionId, uint32 Action, uint32 ErrorCode, uint32 bidError )
{
WorldPacket data( SMSG_AUCTION_COMMAND_RESULT, 16 );
data << auctionId;
data << Action;
data << ErrorCode;
if ( !ErrorCode && Action )
data << bidError; //when bid, then send 0, once...
SendPacket(&data);
}
//this function sends notification, if bidder is online
void WorldSession::SendAuctionBidderNotification( uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 item_template)
{
WorldPacket data(SMSG_AUCTION_BIDDER_NOTIFICATION, (8*4));
data << location;
data << auctionId;
data << (uint64) bidder;
data << bidSum;
data << (uint32) diff;
data << item_template;
data << (uint32) 0;
SendPacket(&data);
}
//this void causes on client to display: "Your auction sold"
void WorldSession::SendAuctionOwnerNotification( AuctionEntry* auction)
{
WorldPacket data(SMSG_AUCTION_OWNER_NOTIFICATION, (7*4));
data << auction->Id;
data << auction->bid;
data << (uint32) 0; //unk
data << (uint32) 0; //unk
data << (uint32) 0; //unk
data << auction->item_template;
data << (uint32) 0; //unk
SendPacket(&data);
}
//this function sends mail to old bidder
void WorldSession::SendAuctionOutbiddedMail(AuctionEntry *auction, uint32 newPrice)
{
uint64 oldBidder_guid = MAKE_NEW_GUID(auction->bidder,0, HIGHGUID_PLAYER);
Player *oldBidder = objmgr.GetPlayer(oldBidder_guid);
uint32 oldBidder_accId = 0;
if(!oldBidder)
oldBidder_accId = objmgr.GetPlayerAccountIdByGUID(oldBidder_guid);
// old bidder exist
if(oldBidder || oldBidder_accId)
{
std::ostringstream msgAuctionOutbiddedSubject;
msgAuctionOutbiddedSubject << auction->item_template << ":0:" << AUCTION_OUTBIDDED;
if (oldBidder && !_player)
oldBidder->GetSession()->SendAuctionBidderNotification( auction->location, auction->Id, AHBplayerGUID, newPrice, objmgr.GetAuctionOutBid(auction->bid), auction->item_template);
if (oldBidder && _player)
oldBidder->GetSession()->SendAuctionBidderNotification( auction->location, auction->Id, _player->GetGUID(), newPrice, objmgr.GetAuctionOutBid(auction->bid), auction->item_template);
WorldSession::SendMailTo(oldBidder, MAIL_AUCTION, MAIL_STATIONERY_AUCTION, auction->location, auction->bidder, msgAuctionOutbiddedSubject.str(), 0, NULL, auction->bid, 0, MAIL_CHECK_MASK_NONE);
}
}
//this function sends mail, when auction is canceled to old bidder
void WorldSession::SendAuctionCancelledToBidderMail( AuctionEntry* auction )
{
uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
Player *bidder = objmgr.GetPlayer(bidder_guid);
uint32 bidder_accId = 0;
if(!bidder)
bidder_accId = objmgr.GetPlayerAccountIdByGUID(bidder_guid);
// bidder exist
if(bidder || bidder_accId)
{
std::ostringstream msgAuctionCancelledSubject;
msgAuctionCancelledSubject << auction->item_template << ":0:" << AUCTION_CANCELLED_TO_BIDDER;
WorldSession::SendMailTo(bidder, MAIL_AUCTION, MAIL_STATIONERY_AUCTION, auction->location, auction->bidder, msgAuctionCancelledSubject.str(), 0, NULL, auction->bid, 0, MAIL_CHECK_MASK_NONE);
}
}
//this void creates new auction and adds auction to some auctionhouse
void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data )
{
CHECK_PACKET_SIZE(recv_data,8+8+4+4+4);
uint64 auctioneer, item;
uint32 etime, bid, buyout;
recv_data >> auctioneer >> item;
recv_data >> bid >> buyout >> etime;
Player *pl = GetPlayer();
if (!item || !bid || !etime)
return; //check for cheaters
Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, auctioneer,UNIT_NPC_FLAG_AUCTIONEER);
if (!pCreature)
{
sLog.outDebug( "WORLD: HandleAuctionSellItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)) );
return;
}
// client send time in minutes, convert to common used sec time
etime *= MINUTE;
// client understand only 3 auction time
switch(etime)
{
case 1*MIN_AUCTION_TIME:
case 2*MIN_AUCTION_TIME:
case 4*MIN_AUCTION_TIME:
break;
default:
return;
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
Item *it = pl->GetItemByGuid( item );
//do not allow to sell already auctioned items
if(objmgr.GetAItem(GUID_LOPART(item)))
{
sLog.outError("AuctionError, player %s is sending item id: %u, but item is already in another auction", pl->GetName(), GUID_LOPART(item));
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
return;
}
// prevent sending bag with items (cheat: can be placed in bag after adding equiped empty bag to auction)
if(!it)
{
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_ITEM_NOT_FOUND);
return;
}
if(!it->CanBeTraded())
{
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
return;
}
if (it->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_CONJURED) || it->GetUInt32Value(ITEM_FIELD_DURATION))
{
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
return;
}
uint32 location = AuctioneerFactionToLocation(pCreature->getFaction());
AuctionHouseObject * mAuctions;
mAuctions = objmgr.GetAuctionsMap( location );
//we have to take deposit :
uint32 deposit = objmgr.GetAuctionDeposit( location, etime, it );
if ( pl->GetMoney() < deposit )
{
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_NOT_ENOUGHT_MONEY);
return;
}
if( GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
{
sLog.outCommand(GetAccountId(),"GM %s (Account: %u) create auction: %s (Entry: %u Count: %u)",
GetPlayerName(),GetAccountId(),it->GetProto()->Name1,it->GetEntry(),it->GetCount());
}
pl->ModifyMoney( -int32(deposit) );
uint32 auction_time = uint32(etime * sWorld.getRate(RATE_AUCTION_TIME));
AuctionEntry *AH = new AuctionEntry;
AH->Id = objmgr.GenerateAuctionID();
AH->auctioneer = GUID_LOPART(auctioneer);
AH->item_guidlow = GUID_LOPART(item);
AH->item_template = it->GetEntry();
AH->owner = pl->GetGUIDLow();
AH->startbid = bid;
AH->bidder = 0;
AH->bid = 0;
AH->buyout = buyout;
AH->time = time(NULL) + auction_time;
AH->deposit = deposit;
AH->location = location;
sLog.outDetail("selling item %u to auctioneer %u with initial bid %u with buyout %u and with time %u (in sec) in location: %u", GUID_LOPART(item), GUID_LOPART(auctioneer), bid, buyout, auction_time, location);
mAuctions->AddAuction(AH);
objmgr.AddAItem(it);
pl->MoveItemFromInventory( it->GetBagSlot(), it->GetSlot(), true);
CharacterDatabase.BeginTransaction();
it->DeleteFromInventoryDB();
it->SaveToDB(); // recursive and not have transaction guard into self, not in inventiory and can be save standalone
CharacterDatabase.PExecute("INSERT INTO auctionhouse (id,auctioneerguid,itemguid,item_template,itemowner,buyoutprice,time,buyguid,lastbid,startbid,deposit,location) "
"VALUES ('%u', '%u', '%u', '%u', '%u', '%u', '" I64FMTD "', '%u', '%u', '%u', '%u', '%u')",
AH->Id, AH->auctioneer, AH->item_guidlow, AH->item_template, AH->owner, AH->buyout, (uint64)AH->time, AH->bidder, AH->bid, AH->startbid, AH->deposit, AH->location);
pl->SaveInventoryAndGoldToDB();
CharacterDatabase.CommitTransaction();
SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, AUCTION_OK);
}
//this function is called when client bids or buys out auction
void WorldSession::HandleAuctionPlaceBid( WorldPacket & recv_data )
{
CHECK_PACKET_SIZE(recv_data,8+4+4);
uint64 auctioneer;
uint32 auctionId;
uint32 price;
recv_data >> auctioneer;
recv_data >> auctionId >> price;
if (!auctionId || !price)
return; //check for cheaters
Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, auctioneer,UNIT_NPC_FLAG_AUCTIONEER);
if (!pCreature)
{
sLog.outDebug( "WORLD: HandleAuctionPlaceBid - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)) );
return;
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
uint32 location = AuctioneerFactionToLocation(pCreature->getFaction());
AuctionHouseObject * mAuctions;
mAuctions = objmgr.GetAuctionsMap( location );
AuctionEntry *auction = mAuctions->GetAuction(auctionId);
Player *pl = GetPlayer();
if( !auction || auction->owner == pl->GetGUIDLow() )
{
//you cannot bid your own auction:
SendAuctionCommandResult( 0, AUCTION_PLACE_BID, CANNOT_BID_YOUR_AUCTION_ERROR );
return;
}
// impossible have online own another character (use this for speedup check in case online owner)
Player* auction_owner = objmgr.GetPlayer(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER));
if( !auction_owner && objmgr.GetPlayerAccountIdByGUID(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)) == pl->GetSession()->GetAccountId())
{
//you cannot bid your another character auction:
SendAuctionCommandResult( 0, AUCTION_PLACE_BID, CANNOT_BID_YOUR_AUCTION_ERROR );
return;
}
// cheating
if(price <= auction->bid)
return;
// price too low for next bid if not buyout
if ((price < auction->buyout || auction->buyout == 0) &&
price < auction->bid + objmgr.GetAuctionOutBid(auction->bid))
{
//auction has already higher bid, client tests it!
return;
}
if (price > pl->GetMoney())
{
//you don't have enought money!, client tests!
//SendAuctionCommandResult(auction->auctionId, AUCTION_PLACE_BID, ???);
return;
}
if ((price < auction->buyout) || (auction->buyout == 0))
{
if (auction->bidder > 0)
{
if ( auction->bidder == pl->GetGUIDLow() )
{
pl->ModifyMoney( -int32(price - auction->bid));
}
else
{
// mail to last bidder and return money
SendAuctionOutbiddedMail( auction , price );
pl->ModifyMoney( -int32(price) );
}
}
else
{
pl->ModifyMoney( -int32(price) );
}
auction->bidder = pl->GetGUIDLow();
auction->bid = price;
// after this update we should save player's money ...
CharacterDatabase.PExecute("UPDATE auctionhouse SET buyguid = '%u',lastbid = '%u' WHERE id = '%u'", auction->bidder, auction->bid, auction->Id);
SendAuctionCommandResult(auction->Id, AUCTION_PLACE_BID, AUCTION_OK, 0 );
}
else
{
//buyout:
if (pl->GetGUIDLow() == auction->bidder )
{
pl->ModifyMoney(-int32(auction->buyout - auction->bid));
}
else
{
pl->ModifyMoney(-int32(auction->buyout));
if ( auction->bidder ) //buyout for bidded auction ..
{
SendAuctionOutbiddedMail( auction, auction->buyout );
}
}
auction->bidder = pl->GetGUIDLow();
auction->bid = auction->buyout;
objmgr.SendAuctionSalePendingMail( auction );
objmgr.SendAuctionSuccessfulMail( auction );
objmgr.SendAuctionWonMail( auction );
SendAuctionCommandResult(auction->Id, AUCTION_PLACE_BID, AUCTION_OK);
objmgr.RemoveAItem(auction->item_guidlow);
mAuctions->RemoveAuction(auction->Id);
CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE id = '%u'",auction->Id);
delete auction;
}
CharacterDatabase.BeginTransaction();
pl->SaveInventoryAndGoldToDB();
CharacterDatabase.CommitTransaction();
}
//this void is called when auction_owner cancels his auction
void WorldSession::HandleAuctionRemoveItem( WorldPacket & recv_data )
{
CHECK_PACKET_SIZE(recv_data,8+4);
uint64 auctioneer;
uint32 auctionId;
recv_data >> auctioneer;
recv_data >> auctionId;
//sLog.outDebug( "Cancel AUCTION AuctionID: %u", auctionId);
Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, auctioneer,UNIT_NPC_FLAG_AUCTIONEER);
if (!pCreature)
{
sLog.outDebug( "WORLD: HandleAuctionRemoveItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)) );
return;
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
uint32 location = AuctioneerFactionToLocation(pCreature->getFaction());
AuctionHouseObject * mAuctions;
mAuctions = objmgr.GetAuctionsMap( location );
AuctionEntry *auction = mAuctions->GetAuction(auctionId);
Player *pl = GetPlayer();
if (auction && auction->owner == pl->GetGUIDLow())
{
Item *pItem = objmgr.GetAItem(auction->item_guidlow);
if (pItem)
{
if (auction->bidder > 0) // If we have a bidder, we have to send him the money he paid
{
uint32 auctionCut = objmgr.GetAuctionCut( auction->location, auction->bid);
if ( pl->GetMoney() < auctionCut ) //player doesn't have enough money, maybe message needed
return;
//some auctionBidderNotification would be needed, but don't know that parts..
SendAuctionCancelledToBidderMail( auction );
pl->ModifyMoney( -int32(auctionCut) );
}
// Return the item by mail
std::ostringstream msgAuctionCanceledOwner;
msgAuctionCanceledOwner << auction->item_template << ":0:" << AUCTION_CANCELED;
MailItemsInfo mi;
mi.AddItem(auction->item_guidlow, auction->item_template, pItem);
// item will deleted or added to received mail list
WorldSession::SendMailTo(pl, MAIL_AUCTION, MAIL_STATIONERY_AUCTION, auction->location, pl->GetGUIDLow(), msgAuctionCanceledOwner.str(), 0, &mi, 0, 0, MAIL_CHECK_MASK_NONE);
}
else
{
sLog.outError("Auction id: %u has non-existed item (item guid : %u)!!!", auction->Id, auction->item_guidlow);
SendAuctionCommandResult( 0, AUCTION_CANCEL, AUCTION_INTERNAL_ERROR );
return;
}
}
else
{
SendAuctionCommandResult( 0, AUCTION_CANCEL, AUCTION_INTERNAL_ERROR );
//this code isn't possible ... maybe there should be assert
sLog.outError("CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is NULL", pl->GetGUIDLow(), auctionId );
return;
}
//inform player, that auction is removed
SendAuctionCommandResult( auction->Id, AUCTION_CANCEL, AUCTION_OK );
// Now remove the auction
CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE id = '%u'",auction->Id);
pl->SaveInventoryAndGoldToDB();
CharacterDatabase.CommitTransaction();
objmgr.RemoveAItem( auction->item_guidlow );
mAuctions->RemoveAuction( auction->Id );
delete auction;
}
//called when player lists his bids
void WorldSession::HandleAuctionListBidderItems( WorldPacket & recv_data )
{
CHECK_PACKET_SIZE(recv_data,8+4+4);
uint64 guid; //NPC guid
uint32 listfrom; //page of auctions
uint32 outbiddedCount; //count of outbidded auctions
recv_data >> guid;
recv_data >> listfrom; // not used in fact (this list not have page control in client)
recv_data >> outbiddedCount;
if (recv_data.size() != (16 + outbiddedCount * 4 ))
{
sLog.outError("Client sent bad opcode!!! with count: %u and size : %d (mustbe: %d", outbiddedCount, recv_data.size(),(16 + outbiddedCount * 4 ));
outbiddedCount = 0;
}
Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid,UNIT_NPC_FLAG_AUCTIONEER);
if (!pCreature)
{
sLog.outDebug( "WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
return;
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
uint32 location = AuctioneerFactionToLocation(pCreature->getFaction());
AuctionHouseObject* mAuctions = objmgr.GetAuctionsMap( location );
WorldPacket data( SMSG_AUCTION_BIDDER_LIST_RESULT, (4+4+4) );
Player *pl = GetPlayer();
data << (uint32) 0; //add 0 as count
uint32 count = 0;
uint32 totalcount = 0;
while ( outbiddedCount > 0) //add all data, which client requires
{
--outbiddedCount;
uint32 outbiddedAuctionId;
recv_data >> outbiddedAuctionId;
AuctionEntry * auction = mAuctions->GetAuction( outbiddedAuctionId );
if ( auction && SendAuctionInfo(data, auction))
{
++totalcount;
++count;
}
}
for (AuctionHouseObject::AuctionEntryMap::iterator itr = mAuctions->GetAuctionsBegin();itr != mAuctions->GetAuctionsEnd();++itr)
{
AuctionEntry *Aentry = itr->second;
if( Aentry && Aentry->bidder == pl->GetGUIDLow() )
{
if (SendAuctionInfo(data, itr->second))
++count;
++totalcount;
}
}
data.put<uint32>( 0, count ); // add count to placeholder
data << totalcount;
data << (uint32)300; //unk 2.3.0
SendPacket(&data);
}
//this void sends player info about his auctions
void WorldSession::HandleAuctionListOwnerItems( WorldPacket & recv_data )
{
CHECK_PACKET_SIZE(recv_data,8+4);
uint32 listfrom;
uint64 guid;
recv_data >> guid;
recv_data >> listfrom; // not used in fact (this list not have page control in client)
Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid,UNIT_NPC_FLAG_AUCTIONEER);
if (!pCreature)
{
sLog.outDebug( "WORLD: HandleAuctionListOwnerItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
return;
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
uint32 location = AuctioneerFactionToLocation(pCreature->getFaction());
AuctionHouseObject* mAuctions = objmgr.GetAuctionsMap( location );
WorldPacket data( SMSG_AUCTION_OWNER_LIST_RESULT, (4+4+4) );
data << (uint32) 0; // amount place holder
uint32 count = 0;
uint32 totalcount = 0;
for (AuctionHouseObject::AuctionEntryMap::iterator itr = mAuctions->GetAuctionsBegin();itr != mAuctions->GetAuctionsEnd();++itr)
{
AuctionEntry *Aentry = itr->second;
if( Aentry && Aentry->owner == _player->GetGUIDLow() )
{
if(SendAuctionInfo(data, itr->second))
++count;
++totalcount;
}
}
data.put<uint32>(0, count);
data << (uint32) totalcount;
data << (uint32) 0;
SendPacket(&data);
}
//this void is called when player clicks on search button
void WorldSession::HandleAuctionListItems( WorldPacket & recv_data )
{
CHECK_PACKET_SIZE(recv_data,8+4+1+1+1+4+4+4+4+1);
std::string searchedname, name;
uint8 levelmin, levelmax, usable, location;
uint32 count, totalcount, listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality;
uint64 guid;
recv_data >> guid;
recv_data >> listfrom; // start, used for page control listing by 50 elements
recv_data >> searchedname;
// recheck with known string size
CHECK_PACKET_SIZE(recv_data,8+4+(searchedname.size()+1)+1+1+4+4+4+4+1);
recv_data >> levelmin >> levelmax;
recv_data >> auctionSlotID >> auctionMainCategory >> auctionSubCategory;
recv_data >> quality >> usable;
Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid,UNIT_NPC_FLAG_AUCTIONEER);
if (!pCreature)
{
sLog.outDebug( "WORLD: HandleAuctionListItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
return;
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
location = AuctioneerFactionToLocation(pCreature->getFaction());
AuctionHouseObject * mAuctions;
mAuctions = objmgr.GetAuctionsMap( location );
//sLog.outDebug("Auctionhouse search guid: " I64FMTD ", list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", guid, listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable);
WorldPacket data( SMSG_AUCTION_LIST_RESULT, (4+4+4) );
count = 0;
totalcount = 0;
data << (uint32) 0;
// converting string that we try to find to lower case
std::wstring wsearchedname;
if(!Utf8toWStr(searchedname,wsearchedname))
return;
wstrToLower(wsearchedname);
for (AuctionHouseObject::AuctionEntryMap::iterator itr = mAuctions->GetAuctionsBegin();itr != mAuctions->GetAuctionsEnd();++itr)
{
AuctionEntry *Aentry = itr->second;
Item *item = objmgr.GetAItem(Aentry->item_guidlow);
if( item )
{
ItemPrototype const *proto = item->GetProto();
if( proto )
{
if( auctionMainCategory == (0xffffffff) || proto->Class == auctionMainCategory )
{
if( auctionSubCategory == (0xffffffff) || proto->SubClass == auctionSubCategory )
{
if( auctionSlotID == (0xffffffff) || proto->InventoryType == auctionSlotID )
{
if( quality == (0xffffffff) || proto->Quality == quality )
{
if( usable == (0x00) || _player->CanUseItem( item ) == EQUIP_ERR_OK )
{
if( ( levelmin == (0x00) || proto->RequiredLevel >= levelmin ) && ( levelmax == (0x00) || proto->RequiredLevel <= levelmax ) )
{
name = proto->Name1;
// local name
int loc_idx = GetSessionDbLocaleIndex();
if ( loc_idx >= 0 )
{
ItemLocale const *il = objmgr.GetItemLocale(proto->ItemId);
if (il)
{
if (il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty())
name = il->Name[loc_idx];
}
}
if(name.empty())
continue;
if( wsearchedname.empty() || Utf8FitTo(name, wsearchedname) )
{
if ((count < 50) && (totalcount >= listfrom))
{
++count;
SendAuctionInfo( data, Aentry);
}
++totalcount;
}
}
}
}
}
}
}
}
}
}
data.put<uint32>(0, count);
data << (uint32) totalcount;
data << (uint32) 300; // unk 2.3.0 const?
SendPacket(&data);
}
+440 -183
View File
@@ -1,14 +1,15 @@
#include "AuctionHouseBot.h"
#include "Bag.h"
#include "Config/ConfigEnv.h"
#include "Database/DatabaseEnv.h"
#include "Item.h"
#include "Log.h"
#include "AuctionHouseMgr.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "World.h"
#include "WorldSession.h"
#include "time.h"
#include "AuctionHouseBot.h"
#include <vector>
#include <iostream>
@@ -18,14 +19,20 @@ static bool debug_Out = sConfig.GetIntDefault("AuctionHouseBot.DEBUG", 0);
static vector<uint32> npcItems;
static vector<uint32> lootItems;
static vector<uint32> whiteTradeGoods;
static vector<uint32> greenTradeGoods;
static vector<uint32> blueTradeGoods;
static vector<uint32> purpleTradeGoods;
static vector<uint32> whiteItems;
static vector<uint32> greenItems;
static vector<uint32> blueItems;
static vector<uint32> purpleItems;
static vector<uint32> greyTradeGoodsBin;
static vector<uint32> whiteTradeGoodsBin;
static vector<uint32> greenTradeGoodsBin;
static vector<uint32> blueTradeGoodsBin;
static vector<uint32> purpleTradeGoodsBin;
static vector<uint32> orangeTradeGoodsBin;
static vector<uint32> yellowTradeGoodsBin;
static vector<uint32> greyItemsBin;
static vector<uint32> whiteItemsBin;
static vector<uint32> greenItemsBin;
static vector<uint32> blueItemsBin;
static vector<uint32> purpleItemsBin;
static vector<uint32> orangeItemsBin;
static vector<uint32> yellowItemsBin;
static bool AHBSeller = 0;
static bool AHBBuyer = 0;
@@ -40,9 +47,9 @@ static bool Bind_When_Equipped = 0;
static bool Bind_When_Use = 0;
static bool Bind_Quest_Item = 0;
static AHBConfig AllianceConfig = AHBConfig(AUCTION_ALLIANCE);
static AHBConfig HordeConfig = AHBConfig(AUCTION_HORDE);
static AHBConfig NeutralConfig = AHBConfig(AUCTION_NEUTRAL);
static AHBConfig AllianceConfig = AHBConfig(2);
static AHBConfig HordeConfig = AHBConfig(6);
static AHBConfig NeutralConfig = AHBConfig(7);
time_t _lastrun_a;
time_t _lastrun_h;
time_t _lastrun_n;
@@ -62,11 +69,23 @@ static void addNewAuctions(Player *AHBplayer, AHBConfig *config)
{
if (!AHBSeller)
return;
AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMapByLocation(config->GetAHID());
AuctionHouseEntry const* ahEntry = auctionmgr.GetAuctionHouseEntry(config->GetAHFID());
AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap(config->GetAHFID());
uint32 items = 0;
uint32 minItems = config->GetMinItems();
uint32 maxItems = config->GetMaxItems();
uint32 auctions = auctionHouse->Getcount();
uint32 AuctioneerGUID = 0;
switch (config->GetAHID()){
case 2:
AuctioneerGUID = 79707; //Human in stormwind.
case 6:
AuctioneerGUID = 4656; //orc in Orgrimmar
case 7:
AuctioneerGUID = 23442; //goblin in GZ
default:
AuctioneerGUID = 23442; //default to neutral 7
}
if (auctions >= minItems)
return;
@@ -77,24 +96,41 @@ static void addNewAuctions(Player *AHBplayer, AHBConfig *config)
else
items = (maxItems - auctions);
}
uint32 wtgbin = config->GetPercents(AHB_WHITE_TG);
uint32 gtgbin = config->GetPercents(AHB_GREEN_TG);
uint32 btgbin = config->GetPercents(AHB_BLUE_TG);
uint32 ptgbin = config->GetPercents(AHB_PURPLE_TG);
uint32 wibin = config->GetPercents(AHB_WHITE_I);
uint32 gibin = config->GetPercents(AHB_GREEN_I);
uint32 bibin = config->GetPercents(AHB_BLUE_I);
uint32 pibin = config->GetPercents(AHB_PURPLE_I);
uint32 total = wtgbin + gtgbin + btgbin + ptgbin + wibin + gibin + bibin + pibin;
uint32 greyTGcount = config->GetPercents(AHB_GREY_TG);
uint32 whiteTGcount = config->GetPercents(AHB_WHITE_TG);
uint32 greenTGcount = config->GetPercents(AHB_GREEN_TG);
uint32 blueTGcount = config->GetPercents(AHB_BLUE_TG);
uint32 purpleTGcount = config->GetPercents(AHB_PURPLE_TG);
uint32 orangeTGcount = config->GetPercents(AHB_ORANGE_TG);
uint32 yellowTGcount = config->GetPercents(AHB_YELLOW_TG);
uint32 greyIcount = config->GetPercents(AHB_GREY_I);
uint32 whiteIcount = config->GetPercents(AHB_WHITE_I);
uint32 greenIcount = config->GetPercents(AHB_GREEN_I);
uint32 blueIcount = config->GetPercents(AHB_BLUE_I);
uint32 purpleIcount = config->GetPercents(AHB_PURPLE_I);
uint32 orangeIcount = config->GetPercents(AHB_ORANGE_I);
uint32 yellowIcount = config->GetPercents(AHB_YELLOW_I);
uint32 total = greyTGcount + whiteTGcount + greenTGcount + blueTGcount
+ purpleTGcount + orangeTGcount + yellowTGcount
+ whiteIcount + greenIcount + blueIcount + purpleIcount
+ orangeIcount + yellowIcount;
uint32 greyTGoods = 0;
uint32 whiteTGoods = 0;
uint32 greenTGoods = 0;
uint32 blueTGoods = 0;
uint32 purpleTGoods = 0;
uint32 orangeTGoods = 0;
uint32 yellowTGoods = 0;
uint32 greyItems = 0;
uint32 whiteItems = 0;
uint32 greenItems = 0;
uint32 blueItems = 0;
uint32 purpleItems = 0;
uint32 orangeItems = 0;
uint32 yellowItems = 0;
uint32 pItems = 0;
uint32 bItems = 0;
uint32 gItems = 0;
uint32 wItems = 0;
uint32 pTGoods = 0;
uint32 bTGoods = 0;
uint32 gTGoods = 0;
uint32 wTGoods = 0;
for (AuctionHouseObject::AuctionEntryMap::iterator itr = auctionHouse->GetAuctionsBegin();itr != auctionHouse->GetAuctionsEnd();++itr)
{
AuctionEntry *Aentry = itr->second;
@@ -108,37 +144,51 @@ static void addNewAuctions(Player *AHBplayer, AHBConfig *config)
{
case 0:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
wTGoods = wTGoods + 1;
++greyTGoods;
else
wItems = wItems + 1;
++greyItems;
break;
case 1:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
wTGoods = wTGoods + 1;
++whiteTGoods;
else
wItems = wItems + 1;
++whiteItems;
break;
case 2:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
gTGoods = gTGoods + 1;
++greenTGoods;
else
gItems = gItems + 1;
++greenItems;
break;
case 3:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
bTGoods = bTGoods + 1;
++blueTGoods;
else
bItems = bItems + 1;
++blueItems;
break;
case 4:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
pTGoods = pTGoods + 1;
++purpleTGoods;
else
pItems = pItems + 1;
++purpleItems;
break;
case 5:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
++orangeTGoods;
else
++orangeItems;
break;
case 6:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
++yellowTGoods;
else
++yellowItems;
break;
}
}
@@ -150,78 +200,132 @@ static void addNewAuctions(Player *AHBplayer, AHBConfig *config)
uint32 itemID = 0;
while (itemID == 0)
{
uint32 choice = urand(1, 8);
uint32 choice = urand(0, 13);
switch (choice)
{
case 0:
{
if ((greyItemsBin.size() > 0) && (greyItems < greyIcount))
{
itemID = greyItemsBin[urand(0, greyItemsBin.size() - 1)];
++greyItems;
break;
}
}
case 1:
{
if ((purpleItems.size() > 0) && (pItems < pibin))
if ((whiteItemsBin.size() > 0) && (whiteItems < whiteIcount))
{
itemID = purpleItems[urand(0, purpleItems.size() - 1)];
pItems = pItems + 1;
break;
itemID = whiteItemsBin[urand(0, whiteItemsBin.size() - 1)];
++whiteItems;
break;
}
}
case 2:
{
if ((blueItems.size() > 0) && (bItems < bibin))
if ((greenItemsBin.size() > 0) && (greenItems < greenIcount))
{
itemID = blueItems[urand(0, blueItems.size() - 1)];
bItems = bItems + 1;
itemID = greenItemsBin[urand(0, greenItemsBin.size() - 1)];
++greenItems;
break;
}
}
case 3:
{
if ((greenItems.size() > 0) && (gItems < gibin))
if ((blueItemsBin.size() > 0) && (blueItems < blueIcount))
{
itemID = greenItems[urand(0, greenItems.size() - 1)];
gItems = gItems + 1;
itemID = blueItemsBin[urand(0, blueItemsBin.size() - 1)];
++blueItems;
break;
}
}
case 4:
{
if ((whiteItems.size() > 0) && (wItems < wibin))
if ((purpleItemsBin.size() > 0) && (purpleItems < purpleIcount))
{
itemID = whiteItems[urand(0, whiteItems.size() - 1)];
wItems = wItems + 1;
break;
itemID = purpleItemsBin[urand(0, purpleItemsBin.size() - 1)];
++purpleItems;
break;
}
}
case 5:
{
if ((purpleTradeGoods.size() > 0) && (pTGoods < ptgbin))
if ((orangeItemsBin.size() > 0) && (orangeItems < orangeIcount))
{
itemID = purpleTradeGoods[urand(0, purpleTradeGoods.size() - 1)];
pTGoods = pTGoods + 1;
break;
itemID = orangeItemsBin[urand(0, orangeItemsBin.size() - 1)];
++orangeItems;
break;
}
}
case 6:
{
if ((blueTradeGoods.size() > 0) && (bTGoods < btgbin))
if ((yellowItemsBin.size() > 0) && (yellowItems < yellowIcount))
{
itemID = blueTradeGoods[urand(0, blueTradeGoods.size() - 1)];
bTGoods = bTGoods + 1;
break;
itemID = yellowItemsBin[urand(0, yellowItemsBin.size() - 1)];
++yellowItems;
break;
}
}
case 7:
{
if ((greenTradeGoods.size() > 0) && (gTGoods < gtgbin))
if ((greyTradeGoodsBin.size() > 0) && (greyTGoods < greyTGcount))
{
itemID = greenTradeGoods[urand(0, greenTradeGoods.size() - 1)];
gTGoods = gTGoods + 1;
itemID = whiteTradeGoodsBin[urand(0, whiteTradeGoodsBin.size() - 1)];
++greyTGoods;
break;
}
}
case 8:
{
if ((whiteTradeGoods.size() > 0) && (wTGoods < wtgbin))
if ((whiteTradeGoodsBin.size() > 0) && (whiteTGoods < whiteTGcount))
{
itemID = whiteTradeGoods[urand(0, whiteTradeGoods.size() - 1)];
wTGoods = wTGoods + 1;
itemID = whiteTradeGoodsBin[urand(0, whiteTradeGoodsBin.size() - 1)];
++whiteTGoods;
break;
}
}
case 9:
{
if ((greenTradeGoodsBin.size() > 0) && (greenTGoods < greenTGcount))
{
itemID = greenTradeGoodsBin[urand(0, greenTradeGoodsBin.size() - 1)];
++greenTGoods;
break;
}
}
case 10:
{
if ((blueTradeGoodsBin.size() > 0) && (blueTGoods < blueTGcount))
{
itemID = blueTradeGoodsBin[urand(0, blueTradeGoodsBin.size() - 1)];
++blueTGoods;
break;
}
}
case 11:
{
if ((purpleTradeGoodsBin.size() > 0) && (purpleTGoods < purpleTGcount))
{
itemID = purpleTradeGoodsBin[urand(0, purpleTradeGoodsBin.size() - 1)];
++purpleTGoods;
break;
}
}
case 12:
{
if ((orangeTradeGoodsBin.size() > 0) && (orangeTGoods < orangeTGcount))
{
itemID = orangeTradeGoodsBin[urand(0, orangeTradeGoodsBin.size() - 1)];
++orangeTGoods;
break;
}
}
case 13:
{
if ((yellowTradeGoodsBin.size() > 0) && (yellowTGoods < yellowTGcount))
{
itemID = yellowTradeGoodsBin[urand(0, yellowTradeGoodsBin.size() - 1)];
++yellowTGoods;
break;
}
}
@@ -270,6 +374,17 @@ static void addNewAuctions(Player *AHBplayer, AHBConfig *config)
switch (prototype->Quality)
{
case 0:
if (config->GetMaxStack(AHB_GREY) != 0)
{
stackCount = urand(1, minValue(item->GetMaxStackCount(), config->GetMaxStack(AHB_GREY)));
}
buyoutPrice *= urand(config->GetMinPrice(AHB_GREY), config->GetMaxPrice(AHB_GREY)) * stackCount;
buyoutPrice /= 100;
bidPrice = buyoutPrice * urand(config->GetMinBidPrice(AHB_GREY), config->GetMaxBidPrice(AHB_GREY));
bidPrice /= 100;
break;
case 1:
if (config->GetMaxStack(AHB_WHITE) != 0)
{
@@ -313,13 +428,33 @@ static void addNewAuctions(Player *AHBplayer, AHBConfig *config)
bidPrice = buyoutPrice * urand(config->GetMinBidPrice(AHB_PURPLE), config->GetMaxBidPrice(AHB_PURPLE));
bidPrice /= 100;
break;
case 5:
if (config->GetMaxStack(AHB_ORANGE) != 0)
{
stackCount = urand(1, minValue(item->GetMaxStackCount(), config->GetMaxStack(AHB_ORANGE)));
}
buyoutPrice *= urand(config->GetMinPrice(AHB_ORANGE), config->GetMaxPrice(AHB_ORANGE)) * stackCount;
buyoutPrice /= 100;
bidPrice = buyoutPrice * urand(config->GetMinBidPrice(AHB_ORANGE), config->GetMaxBidPrice(AHB_ORANGE));
bidPrice /= 100;
break;
case 6:
if (config->GetMaxStack(AHB_YELLOW) != 0)
{
stackCount = urand(1, minValue(item->GetMaxStackCount(), config->GetMaxStack(AHB_YELLOW)));
}
buyoutPrice *= urand(config->GetMinPrice(AHB_YELLOW), config->GetMaxPrice(AHB_YELLOW)) * stackCount;
buyoutPrice /= 100;
bidPrice = buyoutPrice * urand(config->GetMinBidPrice(AHB_YELLOW), config->GetMaxBidPrice(AHB_YELLOW));
bidPrice /= 100;
break;
}
item->SetCount(stackCount);
AuctionEntry* auctionEntry = new AuctionEntry;
auctionEntry->Id = objmgr.GenerateAuctionID();
auctionEntry->auctioneer = 0;
auctionEntry->auctioneer = AuctioneerGUID;
auctionEntry->item_guidlow = item->GetGUIDLow();
auctionEntry->item_template = item->GetEntry();
auctionEntry->owner = AHBplayer->GetGUIDLow();
@@ -329,28 +464,12 @@ static void addNewAuctions(Player *AHBplayer, AHBConfig *config)
auctionEntry->bid = 0;
auctionEntry->deposit = 0;
auctionEntry->expire_time = (time_t) (urand(config->GetMinTime(), config->GetMaxTime()) * 60 * 60 + time(NULL));
auctionEntry->auctionHouseEntry = ahEntry;
item->SaveToDB();
item->RemoveFromUpdateQueueOf(AHBplayer);
auctionmgr.AddAItem(item);
auctionHouse->AddAuction(auctionEntry);
CharacterDatabase.PExecute("INSERT INTO `auctionhouse` (`id`,"
"`auctioneerguid`,`itemguid`,`item_template`,"
"`itemowner`,`buyoutprice`,`time`,`buyguid`,"
"`lastbid`,`startbid`,`deposit`) "
"VALUES ('%u', '%u', '%u', '%u', '%u', '%u', "
"'" I64FMTD "', '%u', '%u', '%u', '%u')",
auctionEntry->Id,
auctionEntry->auctioneer,
auctionEntry->item_guidlow,
auctionEntry->item_template,
auctionEntry->owner,
auctionEntry->buyout,
(uint64) auctionEntry->expire_time,
auctionEntry->bidder,
auctionEntry->bid,
auctionEntry->startbid,
auctionEntry->deposit);
auctionEntry->SaveToDB();
}
}
@@ -360,7 +479,7 @@ static void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, World
return;
// Fetches content of selected AH
AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMapByLocation(config->GetAHID());
AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap(config->GetAHFID());
AuctionHouseObject::AuctionEntryMap::iterator itr;
itr = auctionHouse->GetAuctionsBegin();
@@ -393,7 +512,7 @@ static void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, World
// Choose random auction from possible auctions
uint32 auctionID = possibleBids[urand(0, possibleBids.size() - 1)];
// from auctionhouse.cpp, creates auction pointer & player pointer
// from auctionhousehandler.cpp, creates auction pointer & player pointer
AuctionEntry* auction = auctionHouse->GetAuction(auctionID);
// get exact item information
@@ -408,16 +527,14 @@ static void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, World
ItemPrototype const* prototype = objmgr.GetItemPrototype(auction->item_template);
// check which price we have to use, startbid or if it is bidded already
if(debug_Out)
{sLog.outError("Auction Number: %u", auction->Id);}
if(debug_Out)
{sLog.outError("Item Template: %u", auction->item_template);}
if(debug_Out)
{sLog.outError("Buy Price: %u", prototype->BuyPrice);}
if(debug_Out)
{sLog.outError("Sell Price: %u", prototype->SellPrice);}
if(debug_Out)
{sLog.outError("Quality: %u", prototype->Quality);}
if(debug_Out)
{
sLog.outError("Auction Number: %u", auction->Id);
sLog.outError("Item Template: %u", auction->item_template);
sLog.outError("Buy Price: %u", prototype->BuyPrice);
sLog.outError("Sell Price: %u", prototype->SellPrice);
sLog.outError("Quality: %u", prototype->Quality);
}
uint32 currentprice;
if(auction->bid)
{
@@ -478,6 +595,16 @@ static void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, World
{
bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE);
}
case 5:
if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE))
{
bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE);
}
case 6:
if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW))
{
bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW);
}
break;
default:
// quality is something it shouldn't be, let's get out of here
@@ -519,6 +646,16 @@ static void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, World
{
bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE);
}
case 5:
if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE))
{
bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE);
}
case 6:
if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW))
{
bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW);
}
break;
default:
// quality is something it shouldn't be, let's get out of here
@@ -620,7 +757,7 @@ static void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, World
// Remove auction
auctionHouse->RemoveAuction(auction->Id);
// Remove from database
CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE id = '%u'",auction->Id);
auction->DeleteFromDB();
delete auction;
}
@@ -639,7 +776,7 @@ void AuctionHouseBot()
_AHBplayer.MinimalLoadFromDB(NULL, AHBplayerGUID);
ObjectAccessor::Instance().AddObject(&_AHBplayer);
if(sConfig.GetIntDefault("AllowTwoSide.Interaction.Auction",0) == 0)
if(!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
{
addNewAuctions(&_AHBplayer, &AllianceConfig);
if (((_newrun - _lastrun_a) > (AllianceConfig.GetBiddingInterval() * 60)) && (AllianceConfig.GetBidsPerInterval() > 0))
@@ -687,7 +824,7 @@ void AuctionHouseBotInit()
Bind_When_Use = sConfig.GetBoolDefault("AuctionHouseBot.Bind_When_Use", 1);
Bind_Quest_Item = sConfig.GetBoolDefault("AuctionHouseBot.Bind_Quest_Item", 0);
if(sConfig.GetBoolDefault("AllowTwoSide.Interaction.Auction",0) == 0)
if(!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
{
AuctionHouseBotLoadValues(&AllianceConfig);
AuctionHouseBotLoadValues(&HordeConfig);
@@ -794,7 +931,7 @@ void AuctionHouseBotInit()
break;
}
if ((prototype->Quality < 1) || (prototype->Quality > 4))
if ((prototype->Quality < 0) || (prototype->Quality > 6))
continue;
if (Vendor_Items == 0)
@@ -846,75 +983,110 @@ void AuctionHouseBotInit()
switch (prototype->Quality)
{
case 0:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
greyTradeGoodsBin.push_back(itemID);
else
greyItemsBin.push_back(itemID);
break;
case 1:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
whiteTradeGoods.push_back(itemID);
whiteTradeGoodsBin.push_back(itemID);
else
whiteItems.push_back(itemID);
whiteItemsBin.push_back(itemID);
break;
case 2:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
greenTradeGoods.push_back(itemID);
greenTradeGoodsBin.push_back(itemID);
else
greenItems.push_back(itemID);
greenItemsBin.push_back(itemID);
break;
case 3:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
blueTradeGoods.push_back(itemID);
blueTradeGoodsBin.push_back(itemID);
else
blueItems.push_back(itemID);
blueItemsBin.push_back(itemID);
break;
case 4:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
purpleTradeGoods.push_back(itemID);
purpleTradeGoodsBin.push_back(itemID);
else
purpleItems.push_back(itemID);
purpleItemsBin.push_back(itemID);
break;
case 5:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
orangeTradeGoodsBin.push_back(itemID);
else
orangeItemsBin.push_back(itemID);
break;
case 6:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
yellowTradeGoodsBin.push_back(itemID);
else
yellowItemsBin.push_back(itemID);
break;
}
}
if ((whiteTradeGoods.size() == 0) &&
(greenTradeGoods.size() == 0) &&
(blueTradeGoods.size() == 0) &&
(purpleTradeGoods.size() == 0) &&
(whiteItems.size() == 0) &&
(greenItems.size() == 0) &&
(blueItems.size() == 0) &&
(purpleItems.size() == 0))
if (
(greyTradeGoodsBin.size() == 0) &&
(whiteTradeGoodsBin.size() == 0) &&
(greenTradeGoodsBin.size() == 0) &&
(blueTradeGoodsBin.size() == 0) &&
(purpleTradeGoodsBin.size() == 0) &&
(orangeTradeGoodsBin.size() == 0) &&
(yellowTradeGoodsBin.size() == 0) &&
(greyItemsBin.size() == 0) &&
(whiteItemsBin.size() == 0) &&
(greenItemsBin.size() == 0) &&
(blueItemsBin.size() == 0) &&
(purpleItemsBin.size() == 0) &&
(orangeItemsBin.size() == 0) &&
(yellowItemsBin.size() == 0)
)
{
sLog.outString("AuctionHouseBot: No items");
AHBSeller = 0;
}
sLog.outString("AuctionHouseBot:");
sLog.outString("loaded %d white trade goods", whiteTradeGoods.size());
sLog.outString("loaded %d green trade goods", greenTradeGoods.size());
sLog.outString("loaded %d blue trade goods", blueTradeGoods.size());
sLog.outString("loaded %d purple trade goods", purpleTradeGoods.size());
sLog.outString("loaded %d white items", whiteItems.size());
sLog.outString("loaded %d green items", greenItems.size());
sLog.outString("loaded %d blue items", blueItems.size());
sLog.outString("loaded %d purple items", purpleItems.size());
sLog.outString("loaded %d grey trade goods", greyTradeGoodsBin.size());
sLog.outString("loaded %d white trade goods", whiteTradeGoodsBin.size());
sLog.outString("loaded %d green trade goods", greenTradeGoodsBin.size());
sLog.outString("loaded %d blue trade goods", blueTradeGoodsBin.size());
sLog.outString("loaded %d purple trade goods", purpleTradeGoodsBin.size());
sLog.outString("loaded %d orange trade goods", orangeTradeGoodsBin.size());
sLog.outString("loaded %d yellow trade goods", yellowTradeGoodsBin.size());
sLog.outString("loaded %d grey items", greyItemsBin.size());
sLog.outString("loaded %d white items", whiteItemsBin.size());
sLog.outString("loaded %d green items", greenItemsBin.size());
sLog.outString("loaded %d blue items", blueItemsBin.size());
sLog.outString("loaded %d purple items", purpleItemsBin.size());
sLog.outString("loaded %d orange items", orangeItemsBin.size());
sLog.outString("loaded %d yellow items", yellowItemsBin.size());
}
sLog.outString("AuctionHouseBot by Paradox (original by ChrisK) has been loaded.");
sLog.outString("AuctionHouseBot now includes AHBuyer by Kerbe and Paradox");
}
void AuctionHouseBotCommands(uint32 command, AuctionLocation ahMapID, uint32 col, char* args)
void AuctionHouseBotCommands(uint32 command, uint32 ahMapID, uint32 col, char* args)
{
AHBConfig *config;
switch (ahMapID)
{
case AUCTION_ALLIANCE:
case 2:
config = &AllianceConfig;
break;
case AUCTION_HORDE:
case 6:
config = &HordeConfig;
break;
case AUCTION_NEUTRAL:
case 7:
config = &NeutralConfig;
break;
}
@@ -936,14 +1108,20 @@ void AuctionHouseBotCommands(uint32 command, AuctionLocation ahMapID, uint32 col
case AHB_PURPLE:
color = "purple";
break;
case AHB_ORANGE:
color = "orange";
break;
case AHB_YELLOW:
color = "yellow";
break;
default:
break;
}
switch (command)
{
case 0: //ahexpire
case 0: //ahexpire
{
AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMapByLocation(ahMapID);
AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap(config->GetAHFID());
AuctionHouseObject::AuctionEntryMap::iterator itr;
itr = auctionHouse->GetAuctionsBegin();
@@ -956,35 +1134,35 @@ void AuctionHouseBotCommands(uint32 command, AuctionLocation ahMapID, uint32 col
++itr;
}
}break;
case 1: //min items
case 1: //min items
{
char * param1 = strtok(args, " ");
uint32 minItems = (uint32) strtoul(param1, NULL, 0);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET minitems = '%u' WHERE auctionhouse = '%u'", minItems, ahMapID);
config->SetMinItems(minItems);
}break;
case 2: //max items
case 2: //max items
{
char * param1 = strtok(args, " ");
uint32 maxItems = (uint32) strtoul(param1, NULL, 0);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxitems = '%u' WHERE auctionhouse = '%u'", maxItems, ahMapID);
config->SetMaxItems(maxItems);
}break;
case 3: //min time
case 3: //min time
{
char * param1 = strtok(args, " ");
uint32 minTime = (uint32) strtoul(param1, NULL, 0);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET mintime = '%u' WHERE auctionhouse = '%u'", minTime, ahMapID);
config->SetMinTime(minTime);
}break;
case 4: //max time
case 4: //max time
{
char * param1 = strtok(args, " ");
uint32 maxTime = (uint32) strtoul(param1, NULL, 0);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxtime = '%u' WHERE auctionhouse = '%u'", maxTime, ahMapID);
config->SetMaxTime(maxTime);
}break;
case 5: //percentages
case 5: //percentages
{
char * param1 = strtok(args, " ");
char * param2 = strtok(NULL, " ");
@@ -994,49 +1172,67 @@ void AuctionHouseBotCommands(uint32 command, AuctionLocation ahMapID, uint32 col
char * param6 = strtok(NULL, " ");
char * param7 = strtok(NULL, " ");
char * param8 = strtok(NULL, " ");
uint32 wtg = (uint32) strtoul(param1, NULL, 0);
uint32 gtg = (uint32) strtoul(param2, NULL, 0);
uint32 btg = (uint32) strtoul(param3, NULL, 0);
uint32 ptg = (uint32) strtoul(param4, NULL, 0);
uint32 wi = (uint32) strtoul(param5, NULL, 0);
uint32 gi = (uint32) strtoul(param6, NULL, 0);
uint32 bi = (uint32) strtoul(param7, NULL, 0);
uint32 pi = (uint32) strtoul(param8, NULL, 0);
char * param9 = strtok(NULL, " ");
char * param10 = strtok(NULL, " ");
char * param11 = strtok(NULL, " ");
char * param12 = strtok(NULL, " ");
char * param13 = strtok(NULL, " ");
char * param14 = strtok(NULL, " ");
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(param4, 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);
CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentwhitetradegoods = '%u' WHERE auctionhouse = '%u'", wtg, ahMapID);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentgreentradegoods = '%u' WHERE auctionhouse = '%u'", gtg, ahMapID);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentbluetradegoods = '%u' WHERE auctionhouse = '%u'", btg, ahMapID);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentpurpletradegoods = '%u' WHERE auctionhouse = '%u'", ptg, ahMapID);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentwhiteitems = '%u' WHERE auctionhouse = '%u'", wi, ahMapID);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentgreenitems = '%u' WHERE auctionhouse = '%u'", gi, ahMapID);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentblueitems = '%u' WHERE auctionhouse = '%u'", bi, ahMapID);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentpurpleitems = '%u' WHERE auctionhouse = '%u'", pi, ahMapID);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentgreytradegoods = '%u' WHERE auctionhouse = '%u'", greytg, ahMapID);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentwhitetradegoods = '%u' WHERE auctionhouse = '%u'", whitetg, ahMapID);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentgreentradegoods = '%u' WHERE auctionhouse = '%u'", greentg, ahMapID);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentbluetradegoods = '%u' WHERE auctionhouse = '%u'", bluetg, ahMapID);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentpurpletradegoods = '%u' WHERE auctionhouse = '%u'", purpletg, ahMapID);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentorangetradegoods = '%u' WHERE auctionhouse = '%u'", orangetg, ahMapID);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentyellowtradegoods = '%u' WHERE auctionhouse = '%u'", yellowtg, ahMapID);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentgreyitems = '%u' WHERE auctionhouse = '%u'", greyi, ahMapID);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentwhiteitems = '%u' WHERE auctionhouse = '%u'", whitei, ahMapID);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentgreenitems = '%u' WHERE auctionhouse = '%u'", greeni, ahMapID);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentblueitems = '%u' WHERE auctionhouse = '%u'", bluei, ahMapID);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentpurpleitems = '%u' WHERE auctionhouse = '%u'", purplei, ahMapID);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentorangeitems = '%u' WHERE auctionhouse = '%u'", orangei, ahMapID);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentyellowitems = '%u' WHERE auctionhouse = '%u'", yellowi, ahMapID);
CharacterDatabase.CommitTransaction();
config->SetPercentages(wtg, gtg, btg, ptg, wi, gi, bi, pi);
config->SetPercentages(greytg, whitetg, greentg, bluetg, purpletg, orangetg, yellowtg, greyi, whitei, greeni, bluei, purplei, orangei, yellowi);
}break;
case 6: //min prices
case 6: //min prices
{
char * param1 = strtok(args, " ");
uint32 minPrice = (uint32) strtoul(param1, NULL, 0);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET minprice%s = '%u' WHERE auctionhouse = '%u'",color.c_str(), minPrice, ahMapID);
config->SetMinPrice(col, minPrice);
}break;
case 7: //max prices
case 7: //max prices
{
char * param1 = strtok(args, " ");
uint32 maxPrice = (uint32) strtoul(param1, NULL, 0);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxprice%s = '%u' WHERE auctionhouse = '%u'",color.c_str(), maxPrice, ahMapID);
config->SetMaxPrice(col, maxPrice);
}break;
case 8: //min bid price
case 8: //min bid price
{
char * param1 = strtok(args, " ");
uint32 minBidPrice = (uint32) strtoul(param1, NULL, 0);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET minbidprice%s = '%u' WHERE auctionhouse = '%u'",color.c_str(), minBidPrice, ahMapID);
config->SetMinBidPrice(col, minBidPrice);
}break;
case 9: //max bid price
case 9: //max bid price
{
char * param1 = strtok(args, " ");
uint32 maxBidPrice = (uint32) strtoul(param1, NULL, 0);
@@ -1092,25 +1288,44 @@ void AuctionHouseBotLoadValues(AHBConfig *config)
{sLog.outError("minTime = %u", config->GetMinTime());
sLog.outError("maxTime = %u", config->GetMaxTime());}
//load percentages
uint32 wtg = CharacterDatabase.PQuery("SELECT percentwhitetradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
uint32 gtg = CharacterDatabase.PQuery("SELECT percentgreentradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
uint32 btg = CharacterDatabase.PQuery("SELECT percentbluetradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
uint32 ptg = CharacterDatabase.PQuery("SELECT percentpurpletradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
uint32 wi = CharacterDatabase.PQuery("SELECT percentwhiteitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
uint32 gi = CharacterDatabase.PQuery("SELECT percentgreenitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
uint32 bi = CharacterDatabase.PQuery("SELECT percentblueitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
uint32 pi = CharacterDatabase.PQuery("SELECT percentpurpleitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
config->SetPercentages(wtg, gtg, btg, ptg, wi, gi, bi, pi);
uint32 greytg = CharacterDatabase.PQuery("SELECT percentgreytradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
uint32 whitetg = CharacterDatabase.PQuery("SELECT percentwhitetradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
uint32 greentg = CharacterDatabase.PQuery("SELECT percentgreentradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
uint32 bluetg = CharacterDatabase.PQuery("SELECT percentbluetradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
uint32 purpletg = CharacterDatabase.PQuery("SELECT percentpurpletradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
uint32 orangetg = CharacterDatabase.PQuery("SELECT percentorangetradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
uint32 yellowtg = CharacterDatabase.PQuery("SELECT percentyellowtradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
uint32 greyi = CharacterDatabase.PQuery("SELECT percentgreyitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
uint32 whitei = CharacterDatabase.PQuery("SELECT percentwhiteitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
uint32 greeni = CharacterDatabase.PQuery("SELECT percentgreenitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
uint32 bluei = CharacterDatabase.PQuery("SELECT percentblueitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
uint32 purplei = CharacterDatabase.PQuery("SELECT percentpurpleitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
uint32 orangei = CharacterDatabase.PQuery("SELECT percentorangeitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
uint32 yellowi = CharacterDatabase.PQuery("SELECT percentyellowitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
config->SetPercentages(greytg, whitetg, greentg, bluetg, purpletg, orangetg, yellowtg, greyi, whitei, greeni, bluei, purplei, orangei, yellowi);
if(debug_Out)
{sLog.outError("percentWhiteTradeGoods = %u", config->GetPercentages(AHB_WHITE_TG));
sLog.outError("percentGreenTradeGoods = %u", config->GetPercentages(AHB_GREEN_TG));
sLog.outError("percentBlueTradeGoods = %u", config->GetPercentages(AHB_BLUE_TG));
sLog.outError("percentPurpleTradeGoods = %u", config->GetPercentages(AHB_PURPLE_TG));
sLog.outError("percentWhiteItems = %u", config->GetPercentages(AHB_WHITE_I));
sLog.outError("percentGreenItems = %u", config->GetPercentages(AHB_GREEN_I));
sLog.outError("percentBlueItems = %u", config->GetPercentages(AHB_BLUE_I));
sLog.outError("percentPurpleItems = %u", config->GetPercentages(AHB_PURPLE_I));}
{
sLog.outError("percentGreyTradeGoods = %u", config->GetPercentages(AHB_GREY_TG));
sLog.outError("percentWhiteTradeGoods = %u", config->GetPercentages(AHB_WHITE_TG));
sLog.outError("percentGreenTradeGoods = %u", config->GetPercentages(AHB_GREEN_TG));
sLog.outError("percentBlueTradeGoods = %u", config->GetPercentages(AHB_BLUE_TG));
sLog.outError("percentPurpleTradeGoods = %u", config->GetPercentages(AHB_PURPLE_TG));
sLog.outError("percentOrangeTradeGoods = %u", config->GetPercentages(AHB_ORANGE_TG));
sLog.outError("percentYellowTradeGoods = %u", config->GetPercentages(AHB_YELLOW_TG));
sLog.outError("percentGreyItems = %u", config->GetPercentages(AHB_GREY_I));
sLog.outError("percentWhiteItems = %u", config->GetPercentages(AHB_WHITE_I));
sLog.outError("percentGreenItems = %u", config->GetPercentages(AHB_GREEN_I));
sLog.outError("percentBlueItems = %u", config->GetPercentages(AHB_BLUE_I));
sLog.outError("percentPurpleItems = %u", config->GetPercentages(AHB_PURPLE_I));
sLog.outError("percentOrangeItems = %u", config->GetPercentages(AHB_ORANGE_I));
sLog.outError("percentYellowItems = %u", config->GetPercentages(AHB_YELLOW_I));
}
//load min and max prices
config->SetMinPrice(AHB_GREY, CharacterDatabase.PQuery("SELECT minpricegrey FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
config->SetMaxPrice(AHB_GREY, CharacterDatabase.PQuery("SELECT maxpricegrey FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
if(debug_Out)
{sLog.outError("minPriceGrey = %u", config->GetMinPrice(AHB_GREY));
sLog.outError("maxPriceGrey = %u", config->GetMaxPrice(AHB_GREY));}
config->SetMinPrice(AHB_WHITE, CharacterDatabase.PQuery("SELECT minpricewhite FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
config->SetMaxPrice(AHB_WHITE, CharacterDatabase.PQuery("SELECT maxpricewhite FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
if(debug_Out)
@@ -1131,7 +1346,23 @@ void AuctionHouseBotLoadValues(AHBConfig *config)
if(debug_Out)
{sLog.outError("minPricePurple = %u", config->GetMinPrice(AHB_PURPLE));
sLog.outError("maxPricePurple = %u", config->GetMaxPrice(AHB_PURPLE));}
config->SetMinPrice(AHB_ORANGE, CharacterDatabase.PQuery("SELECT minpriceorange FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
config->SetMaxPrice(AHB_ORANGE, CharacterDatabase.PQuery("SELECT maxpriceorange FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
if(debug_Out)
{sLog.outError("minPriceOrange = %u", config->GetMinPrice(AHB_ORANGE));
sLog.outError("maxPriceOrange = %u", config->GetMaxPrice(AHB_ORANGE));}
config->SetMinPrice(AHB_YELLOW, CharacterDatabase.PQuery("SELECT minpriceyellow FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
config->SetMaxPrice(AHB_YELLOW, CharacterDatabase.PQuery("SELECT maxpriceyellow FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
if(debug_Out)
{sLog.outError("minPriceYellow = %u", config->GetMinPrice(AHB_YELLOW));
sLog.outError("maxPriceYellow = %u", config->GetMaxPrice(AHB_YELLOW));}
//load min and max bid prices
config->SetMinBidPrice(AHB_GREY, CharacterDatabase.PQuery("SELECT minbidpricegrey FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
if(debug_Out)
{sLog.outError(",minBidPriceGrey = %u", config->GetMinBidPrice(AHB_GREY));}
config->SetMaxBidPrice(AHB_GREY, CharacterDatabase.PQuery("SELECT maxbidpricegrey FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
if(debug_Out)
{sLog.outError("maxBidPriceGrey = %u", config->GetMaxBidPrice(AHB_GREY));}
config->SetMinBidPrice(AHB_WHITE, CharacterDatabase.PQuery("SELECT minbidpricewhite FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
if(debug_Out)
{sLog.outError(",minBidPriceWhite = %u", config->GetMinBidPrice(AHB_WHITE));}
@@ -1156,7 +1387,22 @@ void AuctionHouseBotLoadValues(AHBConfig *config)
config->SetMaxBidPrice(AHB_PURPLE, CharacterDatabase.PQuery("SELECT maxbidpricepurple FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
if(debug_Out)
{sLog.outError("maxBidPricePurple = %u", config->GetMaxBidPrice(AHB_PURPLE));}
config->SetMinBidPrice(AHB_ORANGE, CharacterDatabase.PQuery("SELECT minbidpriceorange FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
if(debug_Out)
{sLog.outError("minBidPriceOrange = %u", config->GetMinBidPrice(AHB_ORANGE));}
config->SetMaxBidPrice(AHB_ORANGE, CharacterDatabase.PQuery("SELECT maxbidpriceorange FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
if(debug_Out)
{sLog.outError("maxBidPriceOrange = %u", config->GetMaxBidPrice(AHB_ORANGE));}
config->SetMinBidPrice(AHB_YELLOW, CharacterDatabase.PQuery("SELECT minbidpriceyellow FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
if(debug_Out)
{sLog.outError("minBidPriceYellow = %u", config->GetMinBidPrice(AHB_YELLOW));}
config->SetMaxBidPrice(AHB_YELLOW, CharacterDatabase.PQuery("SELECT maxbidpriceyellow FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
if(debug_Out)
{sLog.outError("maxBidPriceYellow = %u", config->GetMaxBidPrice(AHB_YELLOW));}
//load max stacks
config->SetMaxStack(AHB_GREY, CharacterDatabase.PQuery("SELECT maxstackgrey FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
if(debug_Out)
{sLog.outError("maxStackGrey = %u", config->GetMaxStack(AHB_GREY));}
config->SetMaxStack(AHB_WHITE, CharacterDatabase.PQuery("SELECT maxstackwhite FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
if(debug_Out)
{sLog.outError("maxStackWhite = %u", config->GetMaxStack(AHB_WHITE));}
@@ -1169,6 +1415,12 @@ void AuctionHouseBotLoadValues(AHBConfig *config)
config->SetMaxStack(AHB_PURPLE, CharacterDatabase.PQuery("SELECT maxstackpurple FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
if(debug_Out)
{sLog.outError("maxStackPurple = %u", config->GetMaxStack(AHB_PURPLE));}
config->SetMaxStack(AHB_ORANGE, CharacterDatabase.PQuery("SELECT maxstackorange FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
if(debug_Out)
{sLog.outError("maxStackOrange = %u", config->GetMaxStack(AHB_ORANGE));}
config->SetMaxStack(AHB_YELLOW, CharacterDatabase.PQuery("SELECT maxstackyellow FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
if(debug_Out)
{sLog.outError("maxStackYellow = %u", config->GetMaxStack(AHB_YELLOW));}
}
if (AHBBuyer)
{
@@ -1178,12 +1430,18 @@ void AuctionHouseBotLoadValues(AHBConfig *config)
config->SetBuyerPrice(AHB_GREEN, CharacterDatabase.PQuery("SELECT buyerpricegreen FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
config->SetBuyerPrice(AHB_BLUE, CharacterDatabase.PQuery("SELECT buyerpriceblue FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
config->SetBuyerPrice(AHB_PURPLE, CharacterDatabase.PQuery("SELECT buyerpricepurple FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
config->SetBuyerPrice(AHB_ORANGE, CharacterDatabase.PQuery("SELECT buyerpriceorange FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
config->SetBuyerPrice(AHB_YELLOW, CharacterDatabase.PQuery("SELECT buyerpriceyellow FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
if(debug_Out)
{sLog.outError("buyerPriceGrey = %u", config->GetBuyerPrice(AHB_GREY));
sLog.outError("buyerPriceWhite = %u", config->GetBuyerPrice(AHB_WHITE));
sLog.outError("buyerPriceGreen = %u", config->GetBuyerPrice(AHB_GREEN));
sLog.outError("buyerPriceBlue = %u", config->GetBuyerPrice(AHB_BLUE));
sLog.outError("buyerPricePurple = %u", config->GetBuyerPrice(AHB_PURPLE));}
{
sLog.outError("buyerPriceGrey = %u", config->GetBuyerPrice(AHB_GREY));
sLog.outError("buyerPriceWhite = %u", config->GetBuyerPrice(AHB_WHITE));
sLog.outError("buyerPriceGreen = %u", config->GetBuyerPrice(AHB_GREEN));
sLog.outError("buyerPriceBlue = %u", config->GetBuyerPrice(AHB_BLUE));
sLog.outError("buyerPricePurple = %u", config->GetBuyerPrice(AHB_PURPLE));
sLog.outError("buyerPriceOrange = %u", config->GetBuyerPrice(AHB_ORANGE));
sLog.outError("buyerPriceYellow = %u", config->GetBuyerPrice(AHB_YELLOW));
}
//load bidding interval
config->SetBiddingInterval(CharacterDatabase.PQuery("SELECT buyerbiddinginterval FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
if(debug_Out)
@@ -1194,4 +1452,3 @@ void AuctionHouseBotLoadValues(AHBConfig *config)
{sLog.outError("buyerBidsPerInterval = %u", config->GetBidsPerInterval());}
}
}
+307 -77
View File
@@ -3,22 +3,27 @@
#include "Common.h"
#include "Log.h"
#include "Config/ConfigEnv.h"
#include "AuctionHouseMgr.h"
#define AHB_GREY 0
#define AHB_WHITE 1
#define AHB_GREEN 2
#define AHB_BLUE 3
#define AHB_PURPLE 4
#define AHB_ORANGE 5
#define AHB_YELLOW 6
#define AHB_GREY_TG 0
#define AHB_WHITE_TG 1
#define AHB_GREEN_TG 2
#define AHB_BLUE_TG 3
#define AHB_PURPLE_TG 4
#define AHB_GREY_I 5
#define AHB_WHITE_I 6
#define AHB_GREEN_I 7
#define AHB_BLUE_I 8
#define AHB_PURPLE_I 9
#define AHB_ORANGE_TG 5
#define AHB_YELLOW_TG 6
#define AHB_GREY_I 7
#define AHB_WHITE_I 8
#define AHB_GREEN_I 9
#define AHB_BLUE_I 10
#define AHB_PURPLE_I 11
#define AHB_ORANGE_I 12
#define AHB_YELLOW_I 13
#define AHBplayerAccount sConfig.GetIntDefault("AuctionHouseBot.Account", 0)
#define AHBplayerGUID sConfig.GetIntDefault("AuctionHouseBot.GUID", 0)
#define ItemsPerCycle sConfig.GetIntDefault("AuctionHouseBot.ItemsPerCycle", 200)
@@ -28,19 +33,31 @@
class AHBConfig
{
private:
AuctionLocation AHID;
uint32 AHID;
uint32 AHFID;
uint32 minItems;
uint32 maxItems;
uint32 minTime;
uint32 maxTime;
uint32 percentGreyTradeGoods;
uint32 percentWhiteTradeGoods;
uint32 percentGreenTradeGoods;
uint32 percentBlueTradeGoods;
uint32 percentPurpleTradeGoods;
uint32 percentOrangeTradeGoods;
uint32 percentYellowTradeGoods;
uint32 percentGreyItems;
uint32 percentWhiteItems;
uint32 percentGreenItems;
uint32 percentBlueItems;
uint32 percentPurpleItems;
uint32 percentOrangeItems;
uint32 percentYellowItems;
uint32 minPriceGrey;
uint32 maxPriceGrey;
uint32 minBidPriceGrey;
uint32 maxBidPriceGrey;
uint32 maxStackGrey;
uint32 minPriceWhite;
uint32 maxPriceWhite;
uint32 minBidPriceWhite;
@@ -61,35 +78,72 @@ class AHBConfig
uint32 minBidPricePurple;
uint32 maxBidPricePurple;
uint32 maxStackPurple;
uint32 minPriceOrange;
uint32 maxPriceOrange;
uint32 minBidPriceOrange;
uint32 maxBidPriceOrange;
uint32 maxStackOrange;
uint32 minPriceYellow;
uint32 maxPriceYellow;
uint32 minBidPriceYellow;
uint32 maxBidPriceYellow;
uint32 maxStackYellow;
uint32 buyerPriceGrey;
uint32 buyerPriceWhite;
uint32 buyerPriceGreen;
uint32 buyerPriceBlue;
uint32 buyerPricePurple;
uint32 buyerPriceOrange;
uint32 buyerPriceYellow;
uint32 buyerBiddingInterval;
uint32 buyerBidsPerInterval;
uint32 wtgp;
uint32 gtgp;
uint32 btgp;
uint32 ptgp;
uint32 wip;
uint32 gip;
uint32 bip;
uint32 pip;
uint32 greytgp;
uint32 whitetgp;
uint32 greentgp;
uint32 bluetgp;
uint32 purpletgp;
uint32 orangetgp;
uint32 yellowtgp;
uint32 greyip;
uint32 whiteip;
uint32 greenip;
uint32 blueip;
uint32 purpleip;
uint32 orangeip;
uint32 yellowip;
public:
AHBConfig(AuctionLocation ahid)
AHBConfig(uint32 ahid)
{
AHID = ahid;
switch(ahid)
{
case 2:
AHFID = 55;
break;
case 6:
AHFID = 29;
break;
case 7:
AHFID = 120;
break;
default:
AHFID = 120;
break;
}
}
AHBConfig()
{
}
AuctionLocation GetAHID()
uint32 GetAHID()
{
return AHID;
}
uint32 GetAHFID()
{
return AHFID;
}
void SetMinItems(uint32 value)
{
minItems = value;
@@ -133,9 +187,9 @@ class AHBConfig
{
return maxTime;
}
void SetPercentages(uint32 wtg, uint32 gtg, uint32 btg, uint32 ptg, uint32 wi, uint32 gi, uint32 bi, uint32 pi)
void SetPercentages(uint32 greytg, uint32 whitetg, uint32 greentg, uint32 bluetg, uint32 purpletg, uint32 orangetg, uint32 yellowtg, uint32 greyi, uint32 whitei, uint32 greeni, uint32 bluei, uint32 purplei, uint32 orangei, uint32 yellowi)
{
uint32 totalPercent = wtg + gtg + btg + ptg + wi + gi + bi + pi;
uint32 totalPercent = greytg + whitetg + greentg + bluetg + purpletg + orangetg + yellowtg + greyi + whitei + greeni + bluei + purplei + orangei + yellowi;
if (totalPercent == 0)
{
@@ -143,26 +197,35 @@ class AHBConfig
}
else if (totalPercent != 100)
{
double scale = (double) 100 / (double) totalPercent;
wtg = (uint32) (scale * (double) pi);
gtg = (uint32) (scale * (double) gtg);
btg = (uint32) (scale * (double) btg);
ptg = (uint32) (scale * (double) ptg);
wi = (uint32) (scale * (double) wi);
gi = (uint32) (scale * (double) gi);
bi = (uint32) (scale * (double) bi);
pi = 100 - wtg - gtg - btg - ptg - wi - gi - bi;
greytg = 0;
whitetg = 27;
greentg = 12;
bluetg = 10;
purpletg = 1;
orangetg = 0;
yellowtg = 0;
greyi = 0;
whitei = 10;
greeni = 30;
bluei = 8;
purplei = 2;
orangei = 0;
yellowi = 0;
}
percentWhiteTradeGoods = wtg;
percentGreenTradeGoods = gtg;
percentBlueTradeGoods = btg;
percentPurpleTradeGoods = ptg;
percentWhiteItems = wi;
percentGreenItems = gi;
percentBlueItems = bi;
percentPurpleItems = pi;
percentGreyTradeGoods = greytg;
percentWhiteTradeGoods = whitetg;
percentGreenTradeGoods = greentg;
percentBlueTradeGoods = bluetg;
percentPurpleTradeGoods = purpletg;
percentOrangeTradeGoods = orangetg;
percentYellowTradeGoods = yellowtg;
percentGreyItems = greyi;
percentWhiteItems = whitei;
percentGreenItems = greeni;
percentBlueItems = bluei;
percentPurpleItems = purplei;
percentOrangeItems = orangei;
percentYellowItems = yellowi;
CalculatePercents();
}
uint32 GetPercentages(uint32 color)
@@ -170,7 +233,7 @@ class AHBConfig
switch(color)
{
case AHB_GREY_TG:
return 0;
return percentGreyTradeGoods;
break;
case AHB_WHITE_TG:
return percentWhiteTradeGoods;
@@ -184,8 +247,14 @@ class AHBConfig
case AHB_PURPLE_TG:
return percentPurpleTradeGoods;
break;
case AHB_ORANGE_TG:
return percentOrangeTradeGoods;
break;
case AHB_YELLOW_TG:
return percentYellowTradeGoods;
break;
case AHB_GREY_I:
return 0;
return percentGreyItems;
break;
case AHB_WHITE_I:
return percentWhiteItems;
@@ -199,6 +268,12 @@ class AHBConfig
case AHB_PURPLE_I:
return percentPurpleItems;
break;
case AHB_ORANGE_I:
return percentOrangeItems;
break;
case AHB_YELLOW_I:
return percentYellowItems;
break;
default:
return 0;
break;
@@ -209,6 +284,7 @@ class AHBConfig
switch(color)
{
case AHB_GREY:
minPriceGrey = value;
break;
case AHB_WHITE:
minPriceWhite = value;
@@ -222,6 +298,12 @@ class AHBConfig
case AHB_PURPLE:
minPricePurple = value;
break;
case AHB_ORANGE:
minPriceOrange = value;
break;
case AHB_YELLOW:
minPriceYellow = value;
break;
default:
break;
}
@@ -232,7 +314,12 @@ class AHBConfig
{
case AHB_GREY:
{
return 0;
if (minPriceGrey == 0)
return 100;
else if (minPriceGrey > maxPriceGrey)
return maxPriceGrey;
else
return minPriceGrey;
break;
}
case AHB_WHITE:
@@ -275,6 +362,26 @@ class AHBConfig
return minPricePurple;
break;
}
case AHB_ORANGE:
{
if (minPriceOrange == 0)
return 400;
else if (minPriceOrange > maxPriceOrange)
return maxPriceOrange;
else
return minPriceOrange;
break;
}
case AHB_YELLOW:
{
if (minPriceYellow == 0)
return 500;
else if (minPriceYellow > maxPriceYellow)
return maxPriceYellow;
else
return minPriceYellow;
break;
}
default:
{
return 0;
@@ -287,6 +394,7 @@ class AHBConfig
switch(color)
{
case AHB_GREY:
maxPriceGrey = value;
break;
case AHB_WHITE:
maxPriceWhite = value;
@@ -300,6 +408,12 @@ class AHBConfig
case AHB_PURPLE:
maxPricePurple = value;
break;
case AHB_ORANGE:
maxPriceOrange = value;
break;
case AHB_YELLOW:
maxPriceYellow = value;
break;
default:
break;
}
@@ -310,7 +424,10 @@ class AHBConfig
{
case AHB_GREY:
{
return 0;
if (maxPriceGrey == 0)
return 150;
else
return maxPriceGrey;
break;
}
case AHB_WHITE:
@@ -345,6 +462,22 @@ class AHBConfig
return maxPricePurple;
break;
}
case AHB_ORANGE:
{
if (maxPriceOrange == 0)
return 550;
else
return maxPriceOrange;
break;
}
case AHB_YELLOW:
{
if (maxPriceYellow == 0)
return 650;
else
return maxPriceYellow;
break;
}
default:
{
return 0;
@@ -357,6 +490,7 @@ class AHBConfig
switch(color)
{
case AHB_GREY:
minBidPriceGrey = value;
break;
case AHB_WHITE:
minBidPriceWhite = value;
@@ -370,6 +504,12 @@ class AHBConfig
case AHB_PURPLE:
minBidPricePurple = value;
break;
case AHB_ORANGE:
minBidPriceOrange = value;
break;
case AHB_YELLOW:
minBidPriceYellow = value;
break;
default:
break;
}
@@ -380,7 +520,10 @@ class AHBConfig
{
case AHB_GREY:
{
return 0;
if (minBidPriceGrey > 100)
return 100;
else
return minBidPriceGrey;
break;
}
case AHB_WHITE:
@@ -415,6 +558,22 @@ class AHBConfig
return minBidPricePurple;
break;
}
case AHB_ORANGE:
{
if (minBidPriceOrange > 100)
return 100;
else
return minBidPriceOrange;
break;
}
case AHB_YELLOW:
{
if (minBidPriceYellow > 100)
return 100;
else
return minBidPriceYellow;
break;
}
default:
{
return 0;
@@ -427,6 +586,7 @@ class AHBConfig
switch(color)
{
case AHB_GREY:
maxBidPriceGrey = value;
break;
case AHB_WHITE:
maxBidPriceWhite = value;
@@ -440,6 +600,12 @@ class AHBConfig
case AHB_PURPLE:
maxBidPricePurple = value;
break;
case AHB_ORANGE:
maxBidPriceOrange = value;
break;
case AHB_YELLOW:
maxBidPriceYellow = value;
break;
default:
break;
}
@@ -450,7 +616,10 @@ class AHBConfig
{
case AHB_GREY:
{
return 0;
if (maxBidPriceGrey > 100)
return 100;
else
return maxBidPriceGrey;
break;
}
case AHB_WHITE:
@@ -485,6 +654,22 @@ class AHBConfig
return maxBidPricePurple;
break;
}
case AHB_ORANGE:
{
if (maxBidPriceOrange > 100)
return 100;
else
return maxBidPriceOrange;
break;
}
case AHB_YELLOW:
{
if (maxBidPriceYellow > 100)
return 100;
else
return maxBidPriceYellow;
break;
}
default:
{
return 0;
@@ -497,6 +682,7 @@ class AHBConfig
switch(color)
{
case AHB_GREY:
maxStackGrey = value;
break;
case AHB_WHITE:
maxStackWhite = value;
@@ -510,6 +696,12 @@ class AHBConfig
case AHB_PURPLE:
maxStackPurple = value;
break;
case AHB_ORANGE:
maxStackOrange = value;
break;
case AHB_YELLOW:
maxStackYellow = value;
break;
default:
break;
}
@@ -520,7 +712,7 @@ class AHBConfig
{
case AHB_GREY:
{
return 0;
return maxStackGrey;
break;
}
case AHB_WHITE:
@@ -543,6 +735,16 @@ class AHBConfig
return maxStackPurple;
break;
}
case AHB_ORANGE:
{
return maxStackOrange;
break;
}
case AHB_YELLOW:
{
return maxStackYellow;
break;
}
default:
{
return 0;
@@ -569,6 +771,12 @@ class AHBConfig
case AHB_PURPLE:
buyerPricePurple = value;
break;
case AHB_ORANGE:
buyerPriceOrange = value;
break;
case AHB_YELLOW:
buyerPriceYellow = value;
break;
default:
break;
}
@@ -592,6 +800,12 @@ class AHBConfig
case AHB_PURPLE:
return buyerPricePurple;
break;
case AHB_ORANGE:
return buyerPriceOrange;
break;
case AHB_YELLOW:
return buyerPriceYellow;
break;
default:
return 0;
break;
@@ -607,62 +821,79 @@ class AHBConfig
}
void CalculatePercents()
{
wtgp = (uint32) (((double)percentWhiteTradeGoods / 100.0) * maxItems);
gtgp = (uint32) (((double)percentGreenTradeGoods / 100.0) * maxItems);
btgp = (uint32) (((double)percentBlueTradeGoods / 100.0) * maxItems);
ptgp = (uint32) (((double)percentPurpleTradeGoods / 100.0) * maxItems);
wip = (uint32) (((double)percentWhiteItems / 100.0) * maxItems);
gip = (uint32) (((double)percentGreenItems / 100.0) * maxItems);
bip = (uint32) (((double)percentBlueItems / 100.0) * maxItems);
pip = (uint32) (((double)percentPurpleItems / 100.0) * maxItems);
uint32 total = wtgp + gtgp + btgp + ptgp + wip + gip + bip + pip;
if (total != maxItems)
greytgp = (uint32) (((double)percentGreyTradeGoods / 100.0) * maxItems);
whitetgp = (uint32) (((double)percentWhiteTradeGoods / 100.0) * maxItems);
greentgp = (uint32) (((double)percentGreenTradeGoods / 100.0) * maxItems);
bluetgp = (uint32) (((double)percentBlueTradeGoods / 100.0) * maxItems);
purpletgp = (uint32) (((double)percentPurpleTradeGoods / 100.0) * maxItems);
orangetgp = (uint32) (((double)percentOrangeTradeGoods / 100.0) * maxItems);
yellowtgp = (uint32) (((double)percentYellowTradeGoods / 100.0) * maxItems);
greyip = (uint32) (((double)percentGreyItems / 100.0) * maxItems);
whiteip = (uint32) (((double)percentWhiteItems / 100.0) * maxItems);
greenip = (uint32) (((double)percentGreenItems / 100.0) * maxItems);
blueip = (uint32) (((double)percentBlueItems / 100.0) * maxItems);
purpleip = (uint32) (((double)percentPurpleItems / 100.0) * maxItems);
orangeip = (uint32) (((double)percentOrangeItems / 100.0) * maxItems);
yellowip = (uint32) (((double)percentYellowItems / 100.0) * maxItems);
uint32 total = greytgp + whitetgp + greentgp + bluetgp + purpletgp + orangetgp + yellowtgp + greyip + whiteip + greenip + blueip + purpleip + orangeip + yellowip;
int32 diff = (maxItems - total);
if (diff < 0)
{
wtgp = (uint32) (maxItems * (double) wtgp);
gtgp = (uint32) (maxItems * (double) gtgp);
btgp = (uint32) (maxItems * (double) btgp);
ptgp = (uint32) (maxItems * (double) ptgp);
wip = (uint32) (maxItems * (double) wip);
gip = (uint32) (maxItems * (double) gip);
bip = (uint32) (maxItems * (double) bip);
pip = (maxItems - (wtgp + gtgp + btgp + ptgp + wip + gip + bip));
total = wtgp + gtgp + btgp + ptgp + wip + gip + bip + pip;
if ((whiteip - diff) > 0)
whiteip -= diff;
else if ((greenip - diff) > 0)
greenip -= diff;
}
else if (diff < 0)
{
whiteip += diff;
}
//sLog.outString("%u %u %u %u %u %u %u %u", wtgp, gtgp, btgp, ptgp, wip, gip, bip, pip);
}
uint32 GetPercents(uint32 color)
{
switch(color)
{
case AHB_GREY_TG:
return 0;
return greytgp;
break;
case AHB_WHITE_TG:
return wtgp;
return whitetgp;
break;
case AHB_GREEN_TG:
return gtgp;
return greentgp;
break;
case AHB_BLUE_TG:
return btgp;
return bluetgp;
break;
case AHB_PURPLE_TG:
return ptgp;
return purpletgp;
break;
case AHB_ORANGE_TG:
return orangetgp;
break;
case AHB_YELLOW_TG:
return yellowtgp;
break;
case AHB_GREY_I:
return 0;
return greyip;
break;
case AHB_WHITE_I:
return wip;
return whiteip;
break;
case AHB_GREEN_I:
return gip;
return greenip;
break;
case AHB_BLUE_I:
return bip;
return blueip;
break;
case AHB_PURPLE_I:
return pip;
return purpleip;
break;
case AHB_ORANGE_I:
return orangeip;
break;
case AHB_YELLOW_I:
return yellowip;
break;
default:
return 0;
@@ -684,6 +915,5 @@ class AHBConfig
void AuctionHouseBot();
void AuctionHouseBotInit();
void AuctionHouseBotLoadValues(AHBConfig*);
void AuctionHouseBotCommands(uint32, AuctionLocation, uint32, char*);
void AuctionHouseBotCommands(uint32, uint32, uint32, char*);
#endif
+7 -4
View File
@@ -125,7 +125,7 @@ void WorldSession::SendAuctionOutbiddedMail(AuctionEntry *auction, uint32 newPri
msgAuctionOutbiddedSubject << auction->item_template << ":0:" << AUCTION_OUTBIDDED;
if (oldBidder && !_player)
oldBidder->GetSession()->SendAuctionBidderNotification( auction->GetHouseId(), auction->Id, AHBplayerGUID, newPrice, auction->GetAuctionOutBid(), auction->item_template);
oldBidder->GetSession()->SendAuctionBidderNotification( auction->GetHouseId(), auction->Id, AHBplayerGUID, newPrice, auction->GetAuctionOutBid(), auction->item_template);
if (oldBidder && _player)
oldBidder->GetSession()->SendAuctionBidderNotification( auction->GetHouseId(), auction->Id, _player->GetGUID(), newPrice, auction->GetAuctionOutBid(), auction->item_template);
@@ -134,7 +134,7 @@ void WorldSession::SendAuctionOutbiddedMail(AuctionEntry *auction, uint32 newPri
}
}
//this function sends mail, when auction is canceled to old bidder
//this function sends mail, when auction is cancelled to old bidder
void WorldSession::SendAuctionCancelledToBidderMail( AuctionEntry* auction )
{
uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
@@ -250,7 +250,10 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data )
AuctionEntry *AH = new AuctionEntry;
AH->Id = objmgr.GenerateAuctionID();
AH->auctioneer = GUID_LOPART(auctioneer);
if(sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
AH->auctioneer = 23442;
else
AH->auctioneer = GUID_LOPART(auctioneer);
AH->item_guidlow = GUID_LOPART(item);
AH->item_template = it->GetEntry();
AH->owner = pl->GetGUIDLow();
@@ -262,7 +265,7 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data )
AH->deposit = deposit;
AH->auctionHouseEntry = auctionHouseEntry;
sLog.outDetail("selling item %u to auctioneer %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", GUID_LOPART(item), GUID_LOPART(auctioneer), bid, buyout, auction_time, AH->GetHouseId());
sLog.outDetail("selling item %u to auctioneer %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", GUID_LOPART(item), AH->auctioneer, bid, buyout, auction_time, AH->GetHouseId());
auctionHouse->AddAuction(AH);
auctionmgr.AddAItem(it);
+22 -32
View File
@@ -47,16 +47,6 @@ AuctionHouseMgr::~AuctionHouseMgr()
delete itr->second;
}
AuctionHouseObject * AuctionHouseMgr::GetAuctionsMapByLocation( AuctionLocation location )
{
switch(location)
{
case AUCTION_ALLIANCE: return &mAllianceAuctions;
case AUCTION_HORDE: return &mHordeAuctions;
default: return &mNeutralAuctions;
}
}
AuctionHouseObject * AuctionHouseMgr::GetAuctionsMap( uint32 factionTemplateId )
{
if(sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
@@ -109,7 +99,7 @@ void AuctionHouseMgr::SendAuctionWonMail( AuctionEntry *auction )
bidder_accId = objmgr.GetPlayerAccountIdByGUID(bidder_guid);
bidder_security = accmgr.GetSecurity(bidder_accId);
if(bidder_security > SEC_PLAYER ) // not do redundant DB requests
if(bidder_security > SEC_PLAYER ) // not do redundant DB requests
{
if(!objmgr.GetPlayerNameByGUID(bidder_guid,bidder_name))
bidder_name = objmgr.GetTrinityStringForDBCLocale(LANG_UNKNOWN);
@@ -157,7 +147,7 @@ void AuctionHouseMgr::SendAuctionWonMail( AuctionEntry *auction )
if (bidder)
bidder->GetSession()->SendAuctionBidderNotification( auction->GetHouseId(), auction->Id, bidder_guid, 0, 0, auction->item_template);
else
RemoveAItem(pItem->GetGUIDLow()); // we have to remove the item, before we delete it !!
RemoveAItem(pItem->GetGUIDLow()); // we have to remove the item, before we delete it !!
// will delete item or place to receiver mail list
WorldSession::SendMailTo(bidder, MAIL_AUCTION, MAIL_STATIONERY_AUCTION, auction->GetHouseId(), auction->bidder, msgAuctionWonSubject.str(), itemTextId, &mi, 0, 0, MAIL_CHECK_MASK_AUCTION);
@@ -166,7 +156,7 @@ void AuctionHouseMgr::SendAuctionWonMail( AuctionEntry *auction )
else
{
CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid='%u'", pItem->GetGUIDLow());
RemoveAItem(pItem->GetGUIDLow()); // we have to remove the item, before we delete it !!
RemoveAItem(pItem->GetGUIDLow()); // we have to remove the item, before we delete it !!
delete pItem;
}
}
@@ -243,7 +233,7 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail( AuctionEntry * auction )
//does not clear ram
void AuctionHouseMgr::SendAuctionExpiredMail( AuctionEntry * auction )
{ //return an item in auction to its owner by mail
{ //return an item in auction to its owner by mail
Item *pItem = GetAItem(auction->item_guidlow);
if(!pItem)
{
@@ -279,7 +269,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail( AuctionEntry * auction )
else
{
CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid='%u'",pItem->GetGUIDLow());
RemoveAItem(pItem->GetGUIDLow()); // we have to remove the item, before we delete it !!
RemoveAItem(pItem->GetGUIDLow()); // we have to remove the item, before we delete it !!
delete pItem;
}
}
@@ -469,36 +459,36 @@ void AuctionHouseMgr::Update()
AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(uint32 factionTemplateId)
{
uint32 houseid = 1; // dwarf auction house (used for normal cut/etc percents)
uint32 houseid = 7; // goblin auction house
if(!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
{
//FIXME: found way for proper auctionhouse selection by another way
// AuctionHo use.dbc have faction field with _player_ factions associated with auction house races.
// AuctionHouse.dbc have faction field with _player_ factions associated with auction house races.
// but no easy way convert creature faction to player race faction for specific city
switch(factionTemplateId)
{
case 12: houseid = 1; break; // human
case 29: houseid = 6; break; // orc, and generic for horde
case 55: houseid = 2; break; // dwarf, and generic for alliance
case 68: houseid = 4; break; // undead
case 80: houseid = 3; break; // n-elf
case 104: houseid = 5; break; // trolls
case 120: houseid = 7; break; // booty bay, neutral
case 474: houseid = 7; break; // gadgetzan, neutral
case 855: houseid = 7; break; // everlook, neutral
case 1604: houseid = 6; break; // b-elfs,
default: // for unknown case
case 12: houseid = 1; break; // human
case 29: houseid = 6; break; // orc, and generic for horde
case 55: houseid = 2; break; // dwarf, and generic for alliance
case 68: houseid = 4; break; // undead
case 80: houseid = 3; break; // n-elf
case 104: houseid = 5; break; // trolls
case 120: houseid = 7; break; // booty bay, neutral
case 474: houseid = 7; break; // gadgetzan, neutral
case 855: houseid = 7; break; // everlook, neutral
case 1604: houseid = 6; break; // b-elfs,
default: // for unknown case
{
FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(factionTemplateId);
if(!u_entry)
houseid = 7; // goblin auction house
houseid = 7; // goblin auction house
else if(u_entry->ourMask & FACTION_MASK_ALLIANCE)
houseid = 1; // human auction house
houseid = 1; // human auction house
else if(u_entry->ourMask & FACTION_MASK_HORDE)
houseid = 6; // orc auction house
houseid = 6; // orc auction house
else
houseid = 7; // goblin auction house
houseid = 7; // goblin auction house
break;
}
}
+66 -76
View File
@@ -30,14 +30,6 @@ class WorldPacket;
#define MIN_AUCTION_TIME (12*HOUR)
//only used for bot
enum AuctionLocation
{
AUCTION_ALLIANCE = 2,
AUCTION_HORDE = 6,
AUCTION_NEUTRAL = 7
};
enum AuctionError
{
AUCTION_OK = 0,
@@ -82,99 +74,97 @@ struct AuctionEntry
//this class is used as auctionhouse instance
class AuctionHouseObject
{
public:
AuctionHouseObject() {}
~AuctionHouseObject()
{
for (AuctionEntryMap::iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr)
delete itr->second;
}
public:
AuctionHouseObject() {}
~AuctionHouseObject()
{
for (AuctionEntryMap::iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr)
delete itr->second;
}
typedef std::map<uint32, AuctionEntry*> AuctionEntryMap;
typedef std::map<uint32, AuctionEntry*> AuctionEntryMap;
uint32 Getcount() { return AuctionsMap.size(); }
uint32 Getcount() { return AuctionsMap.size(); }
void AddAuction(AuctionEntry *ah)
{
ASSERT( ah );
AuctionsMap[ah->Id] = ah;
}
AuctionEntryMap::iterator GetAuctionsBegin() {return AuctionsMap.begin();}
AuctionEntryMap::iterator GetAuctionsEnd() {return AuctionsMap.end();}
AuctionEntry* GetAuction(uint32 id) const
{
AuctionEntryMap::const_iterator itr = AuctionsMap.find( id );
return itr != AuctionsMap.end() ? itr->second : NULL;
}
void AddAuction(AuctionEntry *ah)
{
ASSERT( ah );
AuctionsMap[ah->Id] = ah;
}
bool RemoveAuction(uint32 id)
{
return AuctionsMap.erase(id) ? true : false;
}
AuctionEntry* GetAuction(uint32 id) const
{
AuctionEntryMap::const_iterator itr = AuctionsMap.find( id );
return itr != AuctionsMap.end() ? itr->second : NULL;
}
// for AHBot
AuctionEntryMap::iterator GetAuctionsBegin() {return AuctionsMap.begin();}
AuctionEntryMap::iterator GetAuctionsEnd() {return AuctionsMap.end();}
bool RemoveAuction(uint32 id)
{
return AuctionsMap.erase(id) ? true : false;
}
void Update();
void Update();
void BuildListBidderItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount);
void BuildListOwnerItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount);
void BuildListAuctionItems(WorldPacket& data, Player* player,
std::wstring const& searchedname, uint32 listfrom, uint32 levelmin, uint32 levelmax, uint32 usable,
uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality,
uint32& count, uint32& totalcount);
void BuildListBidderItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount);
void BuildListOwnerItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount);
void BuildListAuctionItems(WorldPacket& data, Player* player,
std::wstring const& searchedname, uint32 listfrom, uint32 levelmin, uint32 levelmax, uint32 usable,
uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality,
uint32& count, uint32& totalcount);
private:
AuctionEntryMap AuctionsMap;
private:
AuctionEntryMap AuctionsMap;
};
class AuctionHouseMgr
{
public:
AuctionHouseMgr();
~AuctionHouseMgr();
public:
AuctionHouseMgr();
~AuctionHouseMgr();
typedef UNORDERED_MAP<uint32, Item*> ItemMap;
typedef UNORDERED_MAP<uint32, Item*> ItemMap;
AuctionHouseObject* GetAuctionsMapByLocation( AuctionLocation location );
AuctionHouseObject* GetAuctionsMap( uint32 factionTemplateId );
AuctionHouseObject* GetAuctionsMap( uint32 factionTemplateId );
Item* GetAItem(uint32 id)
Item* GetAItem(uint32 id)
{
ItemMap::const_iterator itr = mAitems.find(id);
if (itr != mAitems.end())
{
ItemMap::const_iterator itr = mAitems.find(id);
if (itr != mAitems.end())
{
return itr->second;
}
return NULL;
return itr->second;
}
return NULL;
}
//auction messages
void SendAuctionWonMail( AuctionEntry * auction );
void SendAuctionSalePendingMail( AuctionEntry * auction );
void SendAuctionSuccessfulMail( AuctionEntry * auction );
void SendAuctionExpiredMail( AuctionEntry * auction );
static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item *pItem);
static AuctionHouseEntry const* GetAuctionHouseEntry(uint32 factionTemplateId);
//auction messages
void SendAuctionWonMail( AuctionEntry * auction );
void SendAuctionSalePendingMail( AuctionEntry * auction );
void SendAuctionSuccessfulMail( AuctionEntry * auction );
void SendAuctionExpiredMail( AuctionEntry * auction );
static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item *pItem);
static AuctionHouseEntry const* GetAuctionHouseEntry(uint32 factionTemplateId);
public:
//load first auction items, because of check if item exists, when loading
void LoadAuctionItems();
void LoadAuctions();
public:
//load first auction items, because of check if item exists, when loading
void LoadAuctionItems();
void LoadAuctions();
void AddAItem(Item* it);
bool RemoveAItem(uint32 id);
void AddAItem(Item* it);
bool RemoveAItem(uint32 id);
void Update();
void Update();
private:
AuctionHouseObject mHordeAuctions;
AuctionHouseObject mAllianceAuctions;
AuctionHouseObject mNeutralAuctions;
private:
AuctionHouseObject mHordeAuctions;
AuctionHouseObject mAllianceAuctions;
AuctionHouseObject mNeutralAuctions;
ItemMap mAitems;
ItemMap mAitems;
};
#define auctionmgr MaNGOS::Singleton<AuctionHouseMgr>::Instance()
#define auctionmgr Trinity::Singleton<AuctionHouseMgr>::Instance()
#endif
-107
View File
@@ -1,107 +0,0 @@
/*
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
*
* Copyright (C) 2008 Trinity <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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _AUCTION_HOUSE_H
#define _AUCTION_HOUSE_H
#include "SharedDefines.h"
#define MIN_AUCTION_TIME (12*HOUR)
enum AuctionError
{
AUCTION_OK = 0,
AUCTION_INTERNAL_ERROR = 2,
AUCTION_NOT_ENOUGHT_MONEY = 3,
AUCTION_ITEM_NOT_FOUND = 4,
CANNOT_BID_YOUR_AUCTION_ERROR = 10
};
enum AuctionAction
{
AUCTION_SELL_ITEM = 0,
AUCTION_CANCEL = 1,
AUCTION_PLACE_BID = 2
};
struct AuctionEntry
{
uint32 Id;
uint32 auctioneer;
uint32 item_guidlow;
uint32 item_template;
uint32 owner;
uint32 startbid; //maybe useless
uint32 bid;
uint32 buyout;
time_t time;
uint32 bidder;
uint32 deposit; //deposit can be calculated only when creating auction
uint32 location;
};
//this class is used as auctionhouse instance
class AuctionHouseObject
{
public:
AuctionHouseObject() {}
~AuctionHouseObject()
{
for (AuctionEntryMap::iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr)
delete itr->second;
}
typedef std::map<uint32, AuctionEntry*> AuctionEntryMap;
uint32 Getcount() { return AuctionsMap.size(); }
AuctionEntryMap::iterator GetAuctionsBegin() {return AuctionsMap.begin();}
AuctionEntryMap::iterator GetAuctionsEnd() {return AuctionsMap.end();}
void AddAuction(AuctionEntry *ah)
{
ASSERT( ah );
AuctionsMap[ah->Id] = ah;
}
AuctionEntry* GetAuction(uint32 id) const
{
AuctionEntryMap::const_iterator itr = AuctionsMap.find( id );
if( itr != AuctionsMap.end() )
return itr->second;
return NULL;
}
bool RemoveAuction(uint32 id)
{
AuctionEntryMap::iterator i = AuctionsMap.find(id);
if (i == AuctionsMap.end())
{
return false;
}
AuctionsMap.erase(i);
return true;
}
private:
AuctionEntryMap AuctionsMap;
};
#endif
+1
View File
@@ -296,6 +296,7 @@ ChatCommand * ChatHandler::getCommandTable()
{ "locales_page_text", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesPageTextCommand, "", NULL },
{ "locales_points_of_interest", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesPointsOfInterestCommand, "", NULL },
{ "locales_quest", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesQuestCommand, "", NULL },
// { "auctions", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAuctionsCommand, "", NULL },
{ "milling_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesMillingCommand, "", NULL },
{ "npc_gossip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadNpcGossipCommand, "", NULL },
{ "npc_option", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadNpcOptionCommand, "", NULL },
+1
View File
@@ -243,6 +243,7 @@ class ChatHandler
bool HandleReloadLocalesPageTextCommand(const char* args);
bool HandleReloadLocalesPointsOfInterestCommand(const char* args);
bool HandleReloadLocalesQuestCommand(const char* args);
// bool HandleReloadAuctionsCommand(const char* args);
bool HandleReloadLootTemplatesCreatureCommand(const char* args);
bool HandleReloadLootTemplatesDisenchantCommand(const char* args);
bool HandleReloadLootTemplatesFishingCommand(const char* args);
+150 -41
View File
@@ -24,6 +24,7 @@
#include "WorldSession.h"
#include "World.h"
#include "ObjectMgr.h"
#include "AuctionHouseMgr.h"
#include "AccountMgr.h"
#include "PlayerDump.h"
#include "SpellMgr.h"
@@ -56,12 +57,12 @@
bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
{
AuctionLocation ahMapID = AUCTION_NEUTRAL;
uint32 ahMapID = 0;
char * opt = strtok((char*)args, " ");
char * ahMapIdStr = strtok(NULL, " ");
if (ahMapIdStr)
{
ahMapID = (AuctionLocation) strtoul(ahMapIdStr, NULL, 0);
ahMapID = (uint32) strtoul(ahMapIdStr, NULL, 0);
}
if (!opt)
{
@@ -149,28 +150,42 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
char * param6 = strtok(NULL, " ");
char * param7 = strtok(NULL, " ");
char * param8 = strtok(NULL, " ");
if ((!ahMapIdStr) || (!param1) || (!param2) || (!param3) || (!param4) || (!param5) || (!param6) || (!param7) || (!param8))
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))
{
PSendSysMessage("Syntax is: ahbotoptions percentages $ahMapID (2, 6 or 7) $1 $2 $3 $4 $5 $6 $7 $8");
PSendSysMessage("1 WhiteTradeGoods 2 GreenTradeGoods 3 BlueTradeGoods 4 PurpleTradeGoods");
PSendSysMessage("5 WhiteItems 6 GreenItems 7 BlueItems 8 PurpleItems");
PSendSysMessage("Syntax is: ahbotoptions percentages $ahMapID (2, 6 or 7) $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14");
PSendSysMessage("1 GreyTradeGoods 2 WhiteTradeGoods 3 GreenTradeGoods 4 BlueTradeGoods 5 PurpleTradeGoods");
PSendSysMessage("6 OrangeTradeGoods 7 YellowTradeGoods 8 GreyItems 9 WhiteItems 10 GreenItems 11 BlueItems");
PSendSysMessage("12 PurpleItems 13 OrangeItems 14 YellowItems");
PSendSysMessage("The total must add up to 100%");
return false;
}
uint32 wtg = (uint32) strtoul(param1, NULL, 0);
uint32 gtg = (uint32) strtoul(param2, NULL, 0);
uint32 btg = (uint32) strtoul(param3, NULL, 0);
uint32 ptg = (uint32) strtoul(param4, NULL, 0);
uint32 wi = (uint32) strtoul(param5, NULL, 0);
uint32 gi = (uint32) strtoul(param6, NULL, 0);
uint32 bi = (uint32) strtoul(param7, NULL, 0);
uint32 pi = (uint32) strtoul(param8, NULL, 0);
uint32 totalPercent = wtg + gtg + btg + ptg + wi + gi + bi + pi;
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))
{
PSendSysMessage("Syntax is: ahbotoptions percentages $ahMapID (2, 6 or 7) $1 $2 $3 $4 $5 $6 $7 $8");
PSendSysMessage("1 WhiteTradeGoods 2 GreenTradeGoods 3 BlueTradeGoods 4 PurpleTradeGoods");
PSendSysMessage("5 WhiteItems 6 GreenItems 7 BlueItems 8 PurpleItems");
PSendSysMessage("Syntax is: ahbotoptions percentages $ahMapID (2, 6 or 7) $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14");
PSendSysMessage("1 GreyTradeGoods 2 WhiteTradeGoods 3 GreenTradeGoods 4 BlueTradeGoods 5 PurpleTradeGoods");
PSendSysMessage("6 OrangeTradeGoods 7 YellowTradeGoods 8 GreyItems 9 WhiteItems 10 GreenItems 11 BlueItems");
PSendSysMessage("12 PurpleItems 13 OrangeItems 14 YellowItems");
PSendSysMessage("The total must add up to 100%");
return false;
}
@@ -191,6 +206,18 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
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);
AuctionHouseBotCommands(5, ahMapID, NULL, param);
}
else if (strncmp(opt,"minprice",l) == 0)
@@ -199,10 +226,14 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
char * param2 = strtok(NULL, " ");
if ((!ahMapIdStr) || (!param1) || (!param2))
{
PSendSysMessage("Syntax is: ahbotoptions minprice $ahMapID (2, 6 or 7) $color (white, green, blue or purple) $price");
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,"white",l) == 0)
if (strncmp(param1,"grey",l) == 0)
{
AuctionHouseBotCommands(6, ahMapID, AHB_GREY, param2);
}
else if (strncmp(param1,"white",l) == 0)
{
AuctionHouseBotCommands(6, ahMapID, AHB_WHITE, param2);
}
@@ -214,13 +245,21 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
{
AuctionHouseBotCommands(6, ahMapID, AHB_BLUE, param2);
}
else if (strncmp(param1,"purple",l) == 0)
else if (strncmp(param1,"purple",l) == 0)
{
AuctionHouseBotCommands(6, ahMapID, AHB_PURPLE, param2);
}
else if (strncmp(param1,"orange",l) == 0)
{
AuctionHouseBotCommands(6, ahMapID, AHB_ORANGE, param2);
}
else if (strncmp(param1,"yellow",l) == 0)
{
AuctionHouseBotCommands(6, ahMapID, AHB_YELLOW, param2);
}
else
{
PSendSysMessage("Syntax is: ahbotoptions minprice $ahMapID (2, 6 or 7) $color (white, green, blue or purple) $price");
PSendSysMessage("Syntax is: ahbotoptions minprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price");
return false;
}
}
@@ -230,10 +269,14 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
char * param2 = strtok(NULL, " ");
if ((!ahMapIdStr) || (!param1) || (!param2))
{
PSendSysMessage("Syntax is: ahbotoptions maxprice $ahMapID (2, 6 or 7) $color (white, green, blue or purple) $price");
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,"white",l) == 0)
if (strncmp(param1,"grey",l) == 0)
{
AuctionHouseBotCommands(7, ahMapID, AHB_GREY, param2);
}
else if (strncmp(param1,"white",l) == 0)
{
AuctionHouseBotCommands(7, ahMapID, AHB_WHITE, param2);
}
@@ -245,13 +288,21 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
{
AuctionHouseBotCommands(7, ahMapID, AHB_BLUE, param2);
}
else if (strncmp(param1,"purple",l) == 0)
else if (strncmp(param1,"purple",l) == 0)
{
AuctionHouseBotCommands(7, ahMapID, AHB_PURPLE, param2);
}
else if (strncmp(param1,"orange",l) == 0)
{
AuctionHouseBotCommands(7, ahMapID, AHB_ORANGE, param2);
}
else if (strncmp(param1,"yellow",l) == 0)
{
AuctionHouseBotCommands(7, ahMapID, AHB_YELLOW, param2);
}
else
{
PSendSysMessage("Syntax is: ahbotoptions maxprice $ahMapID (2, 6 or 7) $color (white, green, blue or purple) $price");
PSendSysMessage("Syntax is: ahbotoptions maxprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price");
return false;
}
}
@@ -261,7 +312,7 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
char * param2 = strtok(NULL, " ");
if ((!ahMapIdStr) || (!param1) || (!param2))
{
PSendSysMessage("Syntax is: ahbotoptions minbidprice $ahMapID (2, 6 or 7) $color (white, green, blue or purple) $price");
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);
@@ -270,7 +321,11 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
PSendSysMessage("The min bid price multiplier must be between 1 and 100");
return false;
}
if (strncmp(param1,"white",l) == 0)
if (strncmp(param1,"grey",l) == 0)
{
AuctionHouseBotCommands(8, ahMapID, AHB_GREY, param2);
}
else if (strncmp(param1,"white",l) == 0)
{
AuctionHouseBotCommands(8, ahMapID, AHB_WHITE, param2);
}
@@ -282,13 +337,21 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
{
AuctionHouseBotCommands(8, ahMapID, AHB_BLUE, param2);
}
else if (strncmp(param1,"purple",l) == 0)
else if (strncmp(param1,"purple",l) == 0)
{
AuctionHouseBotCommands(8, ahMapID, AHB_PURPLE, param2);
}
else if (strncmp(param1,"orange",l) == 0)
{
AuctionHouseBotCommands(8, ahMapID, AHB_ORANGE, param2);
}
else if (strncmp(param1,"yellow",l) == 0)
{
AuctionHouseBotCommands(8, ahMapID, AHB_YELLOW, param2);
}
else
{
PSendSysMessage("Syntax is: ahbotoptions minbidprice $ahMapID (2, 6 or 7) $color (white, green, blue or purple) $price");
PSendSysMessage("Syntax is: ahbotoptions minbidprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price");
return false;
}
}
@@ -298,7 +361,7 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
char * param2 = strtok(NULL, " ");
if ((!ahMapIdStr) || (!param1) || (!param2))
{
PSendSysMessage("Syntax is: ahbotoptions maxbidprice $ahMapID (2, 6 or 7) $color (white, green, blue or purple) $price");
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);
@@ -307,7 +370,11 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
PSendSysMessage("The max bid price multiplier must be between 1 and 100");
return false;
}
if (strncmp(param1,"white",l) == 0)
if (strncmp(param1,"grey",l) == 0)
{
AuctionHouseBotCommands(9, ahMapID, AHB_GREY, param2);
}
else if (strncmp(param1,"white",l) == 0)
{
AuctionHouseBotCommands(9, ahMapID, AHB_WHITE, param2);
}
@@ -319,13 +386,21 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
{
AuctionHouseBotCommands(9, ahMapID, AHB_BLUE, param2);
}
else if (strncmp(param1,"purple",l) == 0)
else if (strncmp(param1,"purple",l) == 0)
{
AuctionHouseBotCommands(9, ahMapID, AHB_PURPLE, param2);
}
else if (strncmp(param1,"orange",l) == 0)
{
AuctionHouseBotCommands(9, ahMapID, AHB_ORANGE, param2);
}
else if (strncmp(param1,"yellow",l) == 0)
{
AuctionHouseBotCommands(9, ahMapID, AHB_YELLOW, param2);
}
else
{
PSendSysMessage("Syntax is: ahbotoptions max bidprice $ahMapID (2, 6 or 7) $color (white, green, blue or purple) $price");
PSendSysMessage("Syntax is: ahbotoptions max bidprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price");
return false;
}
}
@@ -335,7 +410,7 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
char * param2 = strtok(NULL, " ");
if ((!ahMapIdStr) || (!param1) || (!param2))
{
PSendSysMessage("Syntax is: ahbotoptions maxstack $ahMapID (2, 6 or 7) $color (white, green, blue or purple) $value");
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);
@@ -344,7 +419,11 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
PSendSysMessage("maxstack can't be a negative number.");
return false;
}
if (strncmp(param1,"white",l) == 0)
if (strncmp(param1,"grey",l) == 0)
{
AuctionHouseBotCommands(10, ahMapID, AHB_GREY, param2);
}
else if (strncmp(param1,"white",l) == 0)
{
AuctionHouseBotCommands(10, ahMapID, AHB_WHITE, param2);
}
@@ -356,13 +435,21 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
{
AuctionHouseBotCommands(10, ahMapID, AHB_BLUE, param2);
}
else if (strncmp(param1,"purple",l) == 0)
else if (strncmp(param1,"purple",l) == 0)
{
AuctionHouseBotCommands(10, ahMapID, AHB_PURPLE, param2);
}
else if (strncmp(param1,"orange",l) == 0)
{
AuctionHouseBotCommands(10, ahMapID, AHB_ORANGE, param2);
}
else if (strncmp(param1,"yellow",l) == 0)
{
AuctionHouseBotCommands(10, ahMapID, AHB_YELLOW, param2);
}
else
{
PSendSysMessage("Syntax is: ahbotoptions maxstack $ahMapID (2, 6 or 7) $color (white, green, blue or purple) $value");
PSendSysMessage("Syntax is: ahbotoptions maxstack $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $value");
return false;
}
}
@@ -375,7 +462,11 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
PSendSysMessage("Syntax is: ahbotoptions buyerprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue or purple) $price");
return false;
}
if (strncmp(param1,"white",l) == 0)
if (strncmp(param1,"grey",l) == 0)
{
AuctionHouseBotCommands(11, ahMapID, AHB_GREY, param2);
}
else if (strncmp(param1,"white",l) == 0)
{
AuctionHouseBotCommands(11, ahMapID, AHB_WHITE, param2);
}
@@ -387,10 +478,18 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
{
AuctionHouseBotCommands(11, ahMapID, AHB_BLUE, param2);
}
else if (strncmp(param1,"purple",l) == 0)
else if (strncmp(param1,"purple",l) == 0)
{
AuctionHouseBotCommands(11, ahMapID, AHB_PURPLE, param2);
}
else if (strncmp(param1,"orange",l) == 0)
{
AuctionHouseBotCommands(11, ahMapID, AHB_ORANGE, param2);
}
else if (strncmp(param1,"yellow",l) == 0)
{
AuctionHouseBotCommands(11, ahMapID, AHB_YELLOW, param2);
}
else
{
PSendSysMessage("Syntax is: ahbotoptions buyerprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue or purple) $price");
@@ -1142,7 +1241,17 @@ bool ChatHandler::HandleLoadScriptsCommand(const char* args)
sWorld.SendGMText(LANG_SCRIPTS_RELOADED);
return true;
}
/*
bool ChatHandler::HandleReloadAuctionsCommand(const char* args)
{
///- Reload dynamic data tables from the database
sLog.outString( "Re-Loading Auctions..." );
auctionmgr.LoadAuctionItems();
auctionmgr.LoadAuctions();
SendGlobalGMSysMessage("Auctions reloaded.");
return true;
}
*/
bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args)
{
if(!*args)
+2
View File
@@ -42,6 +42,8 @@ libmangosgame_a_SOURCES = \
ArenaTeam.cpp \
ArenaTeam.h \
ArenaTeamHandler.cpp \
AuctionHouseBot.cpp \
AuctionHouseBot.h \
AuctionHouseHandler.cpp \
AuctionHouseMgr.cpp \
AuctionHouseMgr.h \
-3
View File
@@ -167,9 +167,6 @@ ObjectMgr::~ObjectMgr()
for (CachePlayerInfoMap::iterator itr = m_mPlayerInfoMap.begin(); itr != m_mPlayerInfoMap.end(); ++itr)
delete itr->second;
//for(ItemMap::iterator itr = mAitems.begin(); itr != mAitems.end(); ++itr)
// delete itr->second;
for (CacheVendorItemMap::iterator itr = m_mCacheVendorItemMap.begin(); itr != m_mCacheVendorItemMap.end(); ++itr)
itr->second.Clear();
+2 -2
View File
@@ -281,7 +281,7 @@ bool World::HasRecentlyDisconnected(WorldSession* session)
if(!session) return false;
if(uint32 tolerance = getConfig(CONFIG_INTERVAL_DISCONNECT_TOLERANCE))
{
{
for(DisconnectMap::iterator i = m_disconnects.begin(); i != m_disconnects.end(); ++i)
{
if(difftime(i->second, time(NULL)) < tolerance)
@@ -1606,7 +1606,7 @@ void World::Update(uint32 diff)
if (m_timers[WUPDATE_AUCTIONS].Passed())
{
AuctionHouseBot();
m_timers[WUPDATE_AUCTIONS].Reset();
m_timers[WUPDATE_AUCTIONS].Reset();
///- Update mails (return old mails with item, or delete them)
//(tested... works on win)
-6
View File
@@ -201,12 +201,6 @@
<File
RelativePath="..\..\src\game\BattleGroundDS.h">
</File>
<File
RelativePath="..\..\src\game\AuctionHouseBot.cpp">
</File>
<File
RelativePath="..\..\src\game\AuctionHouseBot.h">
</File>
<File
RelativePath="..\..\src\game\BattleGroundEY.cpp">
</File>
-6
View File
@@ -439,12 +439,6 @@
RelativePath="..\..\src\game\BattleGroundDS.h"
>
</File>
<File
RelativePath="..\..\src\game\AuctionHouseBot.cpp">
</File>
<File
RelativePath="..\..\src\game\AuctionHouseBot.h">
</File>
<File
RelativePath="..\..\src\game\BattleGroundEY.cpp"
>