aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormegamage <none@none>2009-06-05 22:44:30 -0500
committermegamage <none@none>2009-06-05 22:44:30 -0500
commit00582cf9d4bebbf812f2cccb14be8dce288c2f07 (patch)
tree8941964eb29c5da1e86dc3e0364c6145aea4b0c2
parentc8e398281ac87abd43e87772cfab5c24d654aceb (diff)
parent8f41a7b86fc9267718759f10293d3d8a5652542a (diff)
*Merge.
--HG-- branch : trunk
-rw-r--r--sql/characters.sql2
-rw-r--r--sql/updates/3791_characters_ahbot.sql3
-rw-r--r--src/game/AuctionHouseBot.cpp56
-rw-r--r--src/game/AuctionHouseBot.h23
-rw-r--r--src/game/AuctionHouseMgr.cpp12
-rw-r--r--src/game/Chat.cpp2
-rw-r--r--src/game/Level3.cpp12
7 files changed, 59 insertions, 51 deletions
diff --git a/sql/characters.sql b/sql/characters.sql
index 3d061185ada..25935727428 100644
--- a/sql/characters.sql
+++ b/sql/characters.sql
@@ -176,8 +176,6 @@ CREATE TABLE `auctionhousebot` (
`name` char(25) default NULL COMMENT 'Text name of the auctionhouse.',
`minitems` int(11) default '0' COMMENT 'This is the minimum number of items you want to keep in the auction house. a 0 here will make it the same as the maximum.',
`maxitems` int(11) default '0' COMMENT 'This is the number of items you want to keep in the auction house.',
- `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',
diff --git a/sql/updates/3791_characters_ahbot.sql b/sql/updates/3791_characters_ahbot.sql
new file mode 100644
index 00000000000..85c0b14bac4
--- /dev/null
+++ b/sql/updates/3791_characters_ahbot.sql
@@ -0,0 +1,3 @@
+ALTER TABLE `auctionhousebot`
+ DROP COLUMN `minTime`,
+ DROP COLUMN `maxTime`;
diff --git a/src/game/AuctionHouseBot.cpp b/src/game/AuctionHouseBot.cpp
index 4ef4eb0e494..c2af4c92c15 100644
--- a/src/game/AuctionHouseBot.cpp
+++ b/src/game/AuctionHouseBot.cpp
@@ -452,6 +452,40 @@ static void addNewAuctions(Player *AHBplayer, AHBConfig *config)
break;
}
+ if(auctionmgr.GetAItem(GUID_LOPART(item->GetGUID())))
+ {
+ sLog.outError("Item %u not found", item->GetEntry());
+ break;
+ }
+ if(!item->CanBeTraded())
+ {
+ sLog.outError("Item %u can't be traded", item->GetEntry());
+ break;
+ }
+
+ if (item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_CONJURED) || item->GetUInt32Value(ITEM_FIELD_DURATION))
+ {
+ sLog.outError("Item %u is conjured or has a duration", item->GetEntry());
+ break;
+ }
+ uint32 etime = urand(1,3);
+ switch(etime)
+ {
+ case 1:
+ etime = 43200;
+ break;
+ case 2:
+ etime = 86400;
+ break;
+ case 3:
+ etime = 172800;
+ break;
+ default:
+ etime = 86400;
+ break;
+ }
+ uint32 dep = auctionmgr.GetAuctionDeposit( ahEntry, etime, item );
+
item->SetCount(stackCount);
AuctionEntry* auctionEntry = new AuctionEntry;
@@ -464,8 +498,8 @@ static void addNewAuctions(Player *AHBplayer, AHBConfig *config)
auctionEntry->buyout = buyoutPrice;
auctionEntry->bidder = 0;
auctionEntry->bid = 0;
- auctionEntry->deposit = 0;
- auctionEntry->expire_time = (time_t) (urand(config->GetMinTime(), config->GetMaxTime()) * 60 * 60 + time(NULL));
+ auctionEntry->deposit = dep;
+ auctionEntry->expire_time = (time_t) etime + time(NULL);
auctionEntry->auctionHouseEntry = ahEntry;
item->SaveToDB();
item->RemoveFromUpdateQueueOf(AHBplayer);
@@ -1119,19 +1153,11 @@ void AuctionHouseBotCommands(uint32 command, uint32 ahMapID, uint32 col, char* a
CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxitems = '%u' WHERE auctionhouse = '%u'", maxItems, ahMapID);
config->SetMaxItems(maxItems);
}break;
- case 3: //min time
+ case 3: //min time Deprecated (Place holder for future commands)
{
- 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 Deprecated (Place holder for future commands)
{
- 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
{
@@ -1252,12 +1278,6 @@ void AuctionHouseBotLoadValues(AHBConfig *config)
if(debug_Out)
{sLog.outError("minItems = %u", config->GetMinItems());
sLog.outError("maxItems = %u", config->GetMaxItems());}
- //load min and max auction times
- config->SetMinTime(CharacterDatabase.PQuery("SELECT mintime FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- config->SetMaxTime(CharacterDatabase.PQuery("SELECT maxtime FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("minTime = %u", config->GetMinTime());
- sLog.outError("maxTime = %u", config->GetMaxTime());}
//load percentages
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();
diff --git a/src/game/AuctionHouseBot.h b/src/game/AuctionHouseBot.h
index 9cd073885a3..906a857d206 100644
--- a/src/game/AuctionHouseBot.h
+++ b/src/game/AuctionHouseBot.h
@@ -40,8 +40,6 @@ class AHBConfig
uint32 AHFID;
uint32 minItems;
uint32 maxItems;
- uint32 minTime;
- uint32 maxTime;
uint32 percentGreyTradeGoods;
uint32 percentWhiteTradeGoods;
uint32 percentGreenTradeGoods;
@@ -169,27 +167,6 @@ class AHBConfig
{
return maxItems;
}
- void SetMinTime(uint32 value)
- {
- minTime = value;
- }
- uint32 GetMinTime()
- {
- if (minTime < 1)
- return 1;
- else if ((maxTime) && (minTime > maxTime))
- return maxTime;
- else
- return minTime;
- }
- void SetMaxTime(uint32 value)
- {
- maxTime = value;
- }
- uint32 GetMaxTime()
- {
- return maxTime;
- }
void SetPercentages(uint32 greytg, uint32 whitetg, uint32 greentg, uint32 bluetg, uint32 purpletg, uint32 orangetg, uint32 yellowtg, uint32 greyi, uint32 whitei, uint32 greeni, uint32 bluei, uint32 purplei, uint32 orangei, uint32 yellowi)
{
uint32 totalPercent = greytg + whitetg + greentg + bluetg + purpletg + orangetg + yellowtg + greyi + whitei + greeni + bluei + purplei + orangei + yellowi;
diff --git a/src/game/AuctionHouseMgr.cpp b/src/game/AuctionHouseMgr.cpp
index c8876c36063..ba412dea8be 100644
--- a/src/game/AuctionHouseMgr.cpp
+++ b/src/game/AuctionHouseMgr.cpp
@@ -92,11 +92,13 @@ uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32
faction_pct = 0.0f;
deposit = 0.0f;
}
- //sLog.outString("SellPrice:\t\t%u", MSV);
- //sLog.outString("Deposit Percent:\t%f", faction_pct);
- //sLog.outString("Min Auction Time:\t%u", (time / MIN_AUCTION_TIME ));
- //sLog.outString("Count:\t\t\t%u", pItem->GetCount());
- //sLog.outString("Deposit:\t\t%f", deposit);
+ sLog.outDebug("SellPrice:\t\t%u", MSV);
+ sLog.outDebug("Deposit Percent:\t%f", faction_pct);
+ sLog.outDebug("Auction Time1:\t\t%u", time);
+ sLog.outDebug("Auction Time2:\t\t%u", MIN_AUCTION_TIME);
+ sLog.outDebug("Auction Time3:\t\t%u", (time / MIN_AUCTION_TIME ));
+ sLog.outDebug("Count:\t\t\t%u", pItem->GetCount());
+ sLog.outDebug("Deposit:\t\t%f", deposit);
if (deposit > 0)
return (uint32)deposit;
else
diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
index 785ecf740ac..ba9cc5d7a2d 100644
--- a/src/game/Chat.cpp
+++ b/src/game/Chat.cpp
@@ -646,7 +646,7 @@ ChatCommand * ChatHandler::getCommandTable()
{ "pet", SEC_GAMEMASTER, false, NULL, "", petCommandTable },
{ "loadpath", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadAllPaths, "", NULL },
- { "ahbotoptions", SEC_GAMEMASTER, false, &ChatHandler::HandleAHBotOptionsCommand, "", NULL },
+ { "ahbotoptions", SEC_GAMEMASTER, true, &ChatHandler::HandleAHBotOptionsCommand, "", NULL },
{ "ticket", SEC_MODERATOR, false, NULL, "", ticketCommandTable },
{ "aura", SEC_ADMINISTRATOR, false, &ChatHandler::HandleAuraCommand, "", NULL },
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 2082c7e5339..bc0e3b8f80f 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -88,8 +88,8 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
PSendSysMessage("ahexpire");
PSendSysMessage("minitems");
PSendSysMessage("maxitems");
- PSendSysMessage("mintime");
- PSendSysMessage("maxtime");
+ //PSendSysMessage("");
+ //PSendSysMessage("");
PSendSysMessage("percentages");
PSendSysMessage("minprice");
PSendSysMessage("maxprice");
@@ -132,6 +132,9 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
}
else if (strncmp(opt,"mintime",l) == 0)
{
+ PSendSysMessage("ahbotoptions mintime has been deprecated");
+ return false;
+ /*
char * param1 = strtok(NULL, " ");
if ((!ahMapIdStr) || (!param1))
{
@@ -139,9 +142,13 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
return false;
}
AuctionHouseBotCommands(3, ahMapID, NULL, param1);
+ */
}
else if (strncmp(opt,"maxtime",l) == 0)
{
+ PSendSysMessage("ahbotoptions maxtime has been deprecated");
+ return false;
+ /*
char * param1 = strtok(NULL, " ");
if ((!ahMapIdStr) || (!param1))
{
@@ -149,6 +156,7 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
return false;
}
AuctionHouseBotCommands(4, ahMapID, NULL, param1);
+ */
}
else if (strncmp(opt,"percentages",l) == 0)
{