aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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/Chat.cpp2
-rw-r--r--src/game/Level3.cpp12
5 files changed, 56 insertions, 49 deletions
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)
{