mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[10254] Remove dependence auction data from auctioneer guid.
* Field `auctioneerguid` replaced by `houseid` and table reanmed to `auction` (it list auctions and `id` is auction id). * Update related code. * SQL update fill `houseid` field by old `auctioneerguid` BUT: SQL update expect that you world DB named `mangos`. If this not true for your case you need modify SQL update BEFORE APPLY in 2 placed in part "mangos.creature AS c, mangos.creature_template AS ct" * Another small possitive result: now possible easy select auctions related to some auction store (1-3 is one team actions, 4-6 another team auction, and 7 is neutral auction store for both teams
This commit is contained in:
parent
6c6ce87867
commit
e3befa2072
10 changed files with 54 additions and 39 deletions
|
|
@ -284,7 +284,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail( AuctionEntry * auction )
|
|||
void AuctionHouseMgr::LoadAuctionItems()
|
||||
{
|
||||
// data needs to be at first place for Item::LoadFromDB 0 1 2 3
|
||||
QueryResult *result = CharacterDatabase.Query( "SELECT data,text,itemguid,item_template FROM auctionhouse JOIN item_instance ON itemguid = guid" );
|
||||
QueryResult *result = CharacterDatabase.Query( "SELECT data,text,itemguid,item_template FROM auction JOIN item_instance ON itemguid = guid" );
|
||||
|
||||
if( !result )
|
||||
{
|
||||
|
|
@ -336,13 +336,13 @@ void AuctionHouseMgr::LoadAuctionItems()
|
|||
|
||||
void AuctionHouseMgr::LoadAuctions()
|
||||
{
|
||||
QueryResult *result = CharacterDatabase.Query("SELECT COUNT(*) FROM auctionhouse");
|
||||
QueryResult *result = CharacterDatabase.Query("SELECT COUNT(*) FROM auction");
|
||||
if( !result )
|
||||
{
|
||||
barGoLink bar(1);
|
||||
bar.step();
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
|
||||
sLog.outString(">> Loaded 0 auctions. DB table `auction` is empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -355,17 +355,17 @@ void AuctionHouseMgr::LoadAuctions()
|
|||
barGoLink bar(1);
|
||||
bar.step();
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
|
||||
sLog.outString(">> Loaded 0 auctions. DB table `auction` is empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
result = CharacterDatabase.Query( "SELECT id,auctioneerguid,itemguid,item_template,itemowner,buyoutprice,time,buyguid,lastbid,startbid,deposit FROM auctionhouse" );
|
||||
result = CharacterDatabase.Query( "SELECT id,houseid,itemguid,item_template,itemowner,buyoutprice,time,buyguid,lastbid,startbid,deposit FROM auction" );
|
||||
if( !result )
|
||||
{
|
||||
barGoLink bar(1);
|
||||
bar.step();
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
|
||||
sLog.outString(">> Loaded 0 auctions. DB table `auction` is empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -381,7 +381,7 @@ void AuctionHouseMgr::LoadAuctions()
|
|||
|
||||
auction = new AuctionEntry;
|
||||
auction->Id = fields[0].GetUInt32();
|
||||
auction->auctioneer = fields[1].GetUInt32();
|
||||
uint32 houseid = fields[1].GetUInt32();
|
||||
auction->item_guidlow = fields[2].GetUInt32();
|
||||
auction->item_template = fields[3].GetUInt32();
|
||||
auction->owner = fields[4].GetUInt32();
|
||||
|
|
@ -404,21 +404,9 @@ void AuctionHouseMgr::LoadAuctions()
|
|||
continue;
|
||||
}
|
||||
|
||||
CreatureData const* auctioneerData = sObjectMgr.GetCreatureData(auction->auctioneer);
|
||||
if(!auctioneerData)
|
||||
{
|
||||
sLog.outError("Auction %u has not a existing auctioneer (GUID : %u), will mail to owner (GUID: %u)",
|
||||
auction->Id, auction->auctioneer, auction->owner);
|
||||
}
|
||||
auction->auctionHouseEntry = sAuctionHouseStore.LookupEntry(houseid);
|
||||
|
||||
CreatureInfo const* auctioneerInfo = auctioneerData ? ObjectMgr::GetCreatureTemplate(auctioneerData->id) : NULL;
|
||||
if(auctioneerData && !auctioneerInfo)
|
||||
{
|
||||
sLog.outError("Auction %u has not a existing auctioneer (GUID : %u Entry: %u), will mail to owner (GUID: %u)",
|
||||
auction->Id, auction->auctioneer,auctioneerData->id, auction->owner);
|
||||
}
|
||||
|
||||
if (!auctioneerInfo)
|
||||
if (!houseid)
|
||||
{
|
||||
// need for send mail, use goblin auctionhouse
|
||||
auction->auctionHouseEntry = sAuctionHouseStore.LookupEntry(7);
|
||||
|
|
@ -439,9 +427,6 @@ void AuctionHouseMgr::LoadAuctions()
|
|||
continue;
|
||||
}
|
||||
|
||||
// always return pointer
|
||||
auction->auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(auctioneerInfo->faction_A);
|
||||
|
||||
GetAuctionsMap(auction->auctionHouseEntry)->AddAuction(auction);
|
||||
|
||||
} while (result->NextRow());
|
||||
|
|
@ -711,13 +696,13 @@ uint32 AuctionEntry::GetAuctionOutBid() const
|
|||
void AuctionEntry::DeleteFromDB() const
|
||||
{
|
||||
//No SQL injection (Id is integer)
|
||||
CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE id = '%u'",Id);
|
||||
CharacterDatabase.PExecute("DELETE FROM auction WHERE id = '%u'",Id);
|
||||
}
|
||||
|
||||
void AuctionEntry::SaveToDB() const
|
||||
{
|
||||
//No SQL injection (no strings)
|
||||
CharacterDatabase.PExecute("INSERT INTO auctionhouse (id,auctioneerguid,itemguid,item_template,itemowner,buyoutprice,time,buyguid,lastbid,startbid,deposit) "
|
||||
CharacterDatabase.PExecute("INSERT INTO auction (id,houseid,itemguid,item_template,itemowner,buyoutprice,time,buyguid,lastbid,startbid,deposit) "
|
||||
"VALUES ('%u', '%u', '%u', '%u', '%u', '%u', '" UI64FMTD "', '%u', '%u', '%u', '%u')",
|
||||
Id, auctioneer, item_guidlow, item_template, owner, buyout, (uint64)expire_time, bidder, bid, startbid, deposit);
|
||||
Id, auctionHouseEntry->houseId, item_guidlow, item_template, owner, buyout, (uint64)expire_time, bidder, bid, startbid, deposit);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue