aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChaz Brown <iamparadox@netscape.net>2009-06-05 21:12:12 -0400
committerChaz Brown <iamparadox@netscape.net>2009-06-05 21:12:12 -0400
commit715f410fb7fdebe1c22401cb749ad57eae637040 (patch)
treec43f21e862007a5d294cf3da08866176f9ef3541 /src
parenta319125b4f49109cf008b5f055cf56cd30a7ed7f (diff)
Fix AHBot to calculate the deposit for auctions so it can be used to check the code for figuring deposit amount on a wide range of items. Fix ahbotoptions command so it works from the server console again. change commented out lines in GetAuctionDeposit so they display in debug loglevel. Min/Max Time settings replaced with a function that selects 12 24 and 48 randomly as the auction times. Backport from TC2
--HG-- branch : trunk
Diffstat (limited to 'src')
-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/Level3.cpp12
4 files changed, 55 insertions, 48 deletions
diff --git a/src/game/AuctionHouseBot.cpp b/src/game/AuctionHouseBot.cpp
index b139358b74a..1c1fdd57384 100644
--- a/src/game/AuctionHouseBot.cpp
+++ b/src/game/AuctionHouseBot.cpp
@@ -450,6 +450,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;
@@ -462,8 +496,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);
@@ -1117,19 +1151,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
{
@@ -1250,12 +1276,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 8d5c067a354..f1d4ba86ec9 100644
--- a/src/game/AuctionHouseBot.h
+++ b/src/game/AuctionHouseBot.h
@@ -37,8 +37,6 @@ class AHBConfig
uint32 AHFID;
uint32 minItems;
uint32 maxItems;
- uint32 minTime;
- uint32 maxTime;
uint32 percentGreyTradeGoods;
uint32 percentWhiteTradeGoods;
uint32 percentGreenTradeGoods;
@@ -166,27 +164,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 2619d589ec7..adb4a4a2787 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/Level3.cpp b/src/game/Level3.cpp
index 128971f0153..b0cb3c5fc9f 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -78,8 +78,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");
@@ -112,6 +112,9 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
}
else if (strncmp(opt,"maxitems",l) == 0)
{
+ PSendSysMessage("ahbotoptions mintime has been deprecated");
+ return false;
+ /*
char * param1 = strtok(NULL, " ");
if ((!ahMapIdStr) || (!param1))
{
@@ -119,9 +122,13 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
return false;
}
AuctionHouseBotCommands(2, ahMapID, NULL, param1);
+ */
}
else if (strncmp(opt,"mintime",l) == 0)
{
+ PSendSysMessage("ahbotoptions maxtime has been deprecated");
+ return false;
+ /*
char * param1 = strtok(NULL, " ");
if ((!ahMapIdStr) || (!param1))
{
@@ -129,6 +136,7 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
return false;
}
AuctionHouseBotCommands(3, ahMapID, NULL, param1);
+ */
}
else if (strncmp(opt,"maxtime",l) == 0)
{