mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-18 22:19:54 -04:00
*Merge.
--HG-- branch : trunk
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE `auctionhousebot`
|
||||
DROP COLUMN `minTime`,
|
||||
DROP COLUMN `maxTime`;
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-1
@@ -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 },
|
||||
|
||||
+10
-2
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user