mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[10250] Select auction store by house id only.
After this commit auction auctioneer guid used only for select auction house in packet or loading. Next task replace it in DB by houseid, dependence DB data from creature guid isn't good.
This commit is contained in:
parent
02532a469a
commit
9350c9990d
8 changed files with 150 additions and 128 deletions
|
|
@ -35,13 +35,13 @@
|
|||
// void called when player click on auctioneer npc
|
||||
void WorldSession::HandleAuctionHelloOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
uint64 guid; // NPC guid
|
||||
recv_data >> guid;
|
||||
ObjectGuid auctioneerGuid; // NPC guid
|
||||
recv_data >> auctioneerGuid;
|
||||
|
||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_AUCTIONEER);
|
||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(auctioneerGuid, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
if (!unit)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: HandleAuctionHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
||||
DEBUG_LOG("WORLD: HandleAuctionHelloOpcode - %s not found or you can't interact with him.", auctioneerGuid.GetString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -49,21 +49,20 @@ void WorldSession::HandleAuctionHelloOpcode( WorldPacket & recv_data )
|
|||
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
SendAuctionHello(guid, unit);
|
||||
SendAuctionHello(unit);
|
||||
}
|
||||
|
||||
// this void causes that auction window is opened
|
||||
void WorldSession::SendAuctionHello( uint64 guid, Creature* unit )
|
||||
void WorldSession::SendAuctionHello(Creature* unit)
|
||||
{
|
||||
// always return pointer
|
||||
AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntry(unit->getFaction());
|
||||
if(!ahEntry)
|
||||
return;
|
||||
|
||||
WorldPacket data( MSG_AUCTION_HELLO, 12 );
|
||||
data << uint64(guid);
|
||||
data << unit->GetObjectGuid();
|
||||
data << uint32(ahEntry->houseId);
|
||||
data << uint8(1); // 3.3.3: 1 - AH enabled, 0 - AH disabled
|
||||
SendPacket( &data );
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
// call this method when player bids, creates, or deletes auction
|
||||
|
|
@ -153,12 +152,28 @@ void WorldSession::SendAuctionCancelledToBidderMail( AuctionEntry* auction )
|
|||
}
|
||||
}
|
||||
|
||||
AuctionHouseEntry const* WorldSession::GetCheckedAuctionHouseForAuctioneer(ObjectGuid guid)
|
||||
{
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
if (!pCreature)
|
||||
{
|
||||
DEBUG_LOG("Auctioneeer %s accessed in cheating way.", guid.GetString().c_str());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// always return pointer
|
||||
return AuctionHouseMgr::GetAuctionHouseEntry(pCreature->getFaction());
|
||||
}
|
||||
|
||||
// this void creates new auction and adds auction to some auctionhouse
|
||||
void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data )
|
||||
{
|
||||
uint64 auctioneer, item;
|
||||
DEBUG_LOG("WORLD: HandleAuctionSellItem");
|
||||
|
||||
ObjectGuid auctioneerGuid;
|
||||
uint64 item;
|
||||
uint32 etime, bid, buyout;
|
||||
recv_data >> auctioneer;
|
||||
recv_data >> auctioneerGuid;
|
||||
recv_data.read_skip<uint32>(); // const 1?
|
||||
recv_data >> item;
|
||||
recv_data.read_skip<uint32>(); // stack size
|
||||
|
|
@ -166,24 +181,17 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data )
|
|||
recv_data >> buyout;
|
||||
recv_data >> etime;
|
||||
|
||||
Player *pl = GetPlayer();
|
||||
|
||||
if (!item || !bid || !etime)
|
||||
return; // check for cheaters
|
||||
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
if (!pCreature)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: HandleAuctionSellItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)) );
|
||||
return;
|
||||
}
|
||||
Player *pl = GetPlayer();
|
||||
|
||||
AuctionHouseEntry const* auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(pCreature->getFaction());
|
||||
if(!auctionHouseEntry)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: HandleAuctionSellItem - Unit (GUID: %u) has wrong faction.", uint32(GUID_LOPART(auctioneer)) );
|
||||
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
||||
if (!auctionHouseEntry)
|
||||
return;
|
||||
}
|
||||
|
||||
// always return pointer
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
|
||||
|
||||
// client send time in minutes, convert to common used sec time
|
||||
etime *= MINUTE;
|
||||
|
|
@ -230,8 +238,6 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data )
|
|||
return;
|
||||
}
|
||||
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap( pCreature->getFaction() );
|
||||
|
||||
//we have to take deposit :
|
||||
uint32 deposit = AuctionHouseMgr::GetAuctionDeposit( auctionHouseEntry, etime, it );
|
||||
if ( pl->GetMoney() < deposit )
|
||||
|
|
@ -252,7 +258,7 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data )
|
|||
|
||||
AuctionEntry *AH = new AuctionEntry;
|
||||
AH->Id = sObjectMgr.GenerateAuctionID();
|
||||
AH->auctioneer = GUID_LOPART(auctioneer);
|
||||
AH->auctioneer = auctioneerGuid.GetCounter();
|
||||
AH->item_guidlow = GUID_LOPART(item);
|
||||
AH->item_template = it->GetEntry();
|
||||
AH->owner = pl->GetGUIDLow();
|
||||
|
|
@ -264,7 +270,8 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data )
|
|||
AH->deposit = deposit;
|
||||
AH->auctionHouseEntry = auctionHouseEntry;
|
||||
|
||||
DETAIL_LOG("selling item %u to auctioneer %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", GUID_LOPART(item), GUID_LOPART(auctioneer), bid, buyout, auction_time, AH->GetHouseId());
|
||||
DETAIL_LOG("selling item %u to auctioneer %s with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u",
|
||||
GUID_LOPART(item), auctioneerGuid.GetString().c_str(), bid, buyout, auction_time, AH->GetHouseId());
|
||||
auctionHouse->AddAuction(AH);
|
||||
|
||||
sAuctionMgr.AddAItem(it);
|
||||
|
|
@ -285,27 +292,28 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data )
|
|||
// this function is called when client bids or buys out auction
|
||||
void WorldSession::HandleAuctionPlaceBid( WorldPacket & recv_data )
|
||||
{
|
||||
uint64 auctioneer;
|
||||
DEBUG_LOG("WORLD: HandleAuctionPlaceBid");
|
||||
|
||||
ObjectGuid auctioneerGuid;
|
||||
uint32 auctionId;
|
||||
uint32 price;
|
||||
recv_data >> auctioneer;
|
||||
recv_data >> auctioneerGuid;
|
||||
recv_data >> auctionId >> price;
|
||||
|
||||
if (!auctionId || !price)
|
||||
return; // check for cheaters
|
||||
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer,UNIT_NPC_FLAG_AUCTIONEER);
|
||||
if (!pCreature)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: HandleAuctionPlaceBid - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)) );
|
||||
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
||||
if (!auctionHouseEntry)
|
||||
return;
|
||||
}
|
||||
|
||||
// always return pointer
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
|
||||
|
||||
// remove fake death
|
||||
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap( pCreature->getFaction() );
|
||||
|
||||
AuctionEntry *auction = auctionHouse->GetAuction(auctionId);
|
||||
Player *pl = GetPlayer();
|
||||
|
|
@ -412,25 +420,25 @@ void WorldSession::HandleAuctionPlaceBid( WorldPacket & recv_data )
|
|||
// this void is called when auction_owner cancels his auction
|
||||
void WorldSession::HandleAuctionRemoveItem( WorldPacket & recv_data )
|
||||
{
|
||||
uint64 auctioneer;
|
||||
DEBUG_LOG("WORLD: HandleAuctionRemoveItem");
|
||||
|
||||
ObjectGuid auctioneerGuid;
|
||||
uint32 auctionId;
|
||||
recv_data >> auctioneer;
|
||||
recv_data >> auctioneerGuid;
|
||||
recv_data >> auctionId;
|
||||
//DEBUG_LOG( "Cancel AUCTION AuctionID: %u", auctionId);
|
||||
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
if (!pCreature)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: HandleAuctionRemoveItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)) );
|
||||
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
||||
if (!auctionHouseEntry)
|
||||
return;
|
||||
}
|
||||
|
||||
// always return pointer
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
|
||||
|
||||
// remove fake death
|
||||
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap( pCreature->getFaction() );
|
||||
|
||||
AuctionEntry *auction = auctionHouse->GetAuction(auctionId);
|
||||
Player *pl = GetPlayer();
|
||||
|
||||
|
|
@ -487,11 +495,13 @@ void WorldSession::HandleAuctionRemoveItem( WorldPacket & recv_data )
|
|||
//called when player lists his bids
|
||||
void WorldSession::HandleAuctionListBidderItems( WorldPacket & recv_data )
|
||||
{
|
||||
uint64 guid; // NPC guid
|
||||
DEBUG_LOG("WORLD: HandleAuctionListBidderItems");
|
||||
|
||||
ObjectGuid auctioneerGuid; // NPC guid
|
||||
uint32 listfrom; // page of auctions
|
||||
uint32 outbiddedCount; // count of outbidded auctions
|
||||
|
||||
recv_data >> guid;
|
||||
recv_data >> auctioneerGuid;
|
||||
recv_data >> listfrom; // not used in fact (this list not have page control in client)
|
||||
recv_data >> outbiddedCount;
|
||||
if (recv_data.size() != (16 + outbiddedCount * 4 ))
|
||||
|
|
@ -500,19 +510,17 @@ void WorldSession::HandleAuctionListBidderItems( WorldPacket & recv_data )
|
|||
outbiddedCount = 0;
|
||||
}
|
||||
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_AUCTIONEER);
|
||||
if (!pCreature)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
||||
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
||||
if (!auctionHouseEntry)
|
||||
return;
|
||||
}
|
||||
|
||||
// always return pointer
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
|
||||
|
||||
// remove fake death
|
||||
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap( pCreature->getFaction() );
|
||||
|
||||
WorldPacket data( SMSG_AUCTION_BIDDER_LIST_RESULT, (4+4+4) );
|
||||
Player *pl = GetPlayer();
|
||||
data << uint32(0); // add 0 as count
|
||||
|
|
@ -541,25 +549,25 @@ void WorldSession::HandleAuctionListBidderItems( WorldPacket & recv_data )
|
|||
// this void sends player info about his auctions
|
||||
void WorldSession::HandleAuctionListOwnerItems( WorldPacket & recv_data )
|
||||
{
|
||||
uint32 listfrom;
|
||||
uint64 guid;
|
||||
DEBUG_LOG("WORLD: HandleAuctionListOwnerItems");
|
||||
|
||||
recv_data >> guid;
|
||||
ObjectGuid auctioneerGuid;
|
||||
uint32 listfrom;
|
||||
|
||||
recv_data >> auctioneerGuid;
|
||||
recv_data >> listfrom; // not used in fact (this list not have page control in client)
|
||||
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
if (!pCreature)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: HandleAuctionListOwnerItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
||||
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
||||
if (!auctionHouseEntry)
|
||||
return;
|
||||
}
|
||||
|
||||
// always return pointer
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
|
||||
|
||||
// remove fake death
|
||||
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap( pCreature->getFaction() );
|
||||
|
||||
WorldPacket data( SMSG_AUCTION_OWNER_LIST_RESULT, (4+4+4) );
|
||||
data << (uint32) 0; // amount place holder
|
||||
|
||||
|
|
@ -576,12 +584,14 @@ void WorldSession::HandleAuctionListOwnerItems( WorldPacket & recv_data )
|
|||
//this void is called when player clicks on search button
|
||||
void WorldSession::HandleAuctionListItems( WorldPacket & recv_data )
|
||||
{
|
||||
DEBUG_LOG("WORLD: HandleAuctionListItems");
|
||||
|
||||
ObjectGuid auctioneerGuid;
|
||||
std::string searchedname;
|
||||
uint8 levelmin, levelmax, usable;
|
||||
uint32 listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality;
|
||||
uint64 guid;
|
||||
|
||||
recv_data >> guid;
|
||||
recv_data >> auctioneerGuid;
|
||||
recv_data >> listfrom; // start, used for page control listing by 50 elements
|
||||
recv_data >> searchedname;
|
||||
|
||||
|
|
@ -591,19 +601,17 @@ void WorldSession::HandleAuctionListItems( WorldPacket & recv_data )
|
|||
|
||||
recv_data.read_skip(16); // unknown 16 bytes: 00 07 01 00 00 01 05 00 06 00 09 01 08 00 03 00
|
||||
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
if (!pCreature)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: HandleAuctionListItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
||||
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
||||
if (!auctionHouseEntry)
|
||||
return;
|
||||
}
|
||||
|
||||
// always return pointer
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
|
||||
|
||||
// remove fake death
|
||||
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap( pCreature->getFaction() );
|
||||
|
||||
//DEBUG_LOG("Auctionhouse search (GUID: %u TypeId: %u)", , list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u",
|
||||
// GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid)), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable);
|
||||
|
||||
|
|
@ -634,7 +642,13 @@ void WorldSession::HandleAuctionListPendingSales( WorldPacket & recv_data )
|
|||
{
|
||||
DEBUG_LOG("CMSG_AUCTION_LIST_PENDING_SALES");
|
||||
|
||||
recv_data.read_skip<uint64>(); // auctioneer guid
|
||||
ObjectGuid auctioneerGuid;
|
||||
|
||||
recv_data >> auctioneerGuid; // auctioneer guid
|
||||
|
||||
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
||||
if (!auctionHouseEntry)
|
||||
return;
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -49,21 +49,18 @@ AuctionHouseMgr::~AuctionHouseMgr()
|
|||
delete itr->second;
|
||||
}
|
||||
|
||||
AuctionHouseObject * AuctionHouseMgr::GetAuctionsMap( uint32 factionTemplateId )
|
||||
AuctionHouseObject * AuctionHouseMgr::GetAuctionsMap(AuctionHouseEntry const* house)
|
||||
{
|
||||
if(sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
|
||||
return &mNeutralAuctions;
|
||||
|
||||
// team have linked auction houses
|
||||
FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(factionTemplateId);
|
||||
if(!u_entry)
|
||||
return &mNeutralAuctions;
|
||||
else if(u_entry->ourMask & FACTION_MASK_ALLIANCE)
|
||||
return &mAllianceAuctions;
|
||||
else if(u_entry->ourMask & FACTION_MASK_HORDE)
|
||||
return &mHordeAuctions;
|
||||
else
|
||||
return &mNeutralAuctions;
|
||||
switch(GetAuctionHouseTeam(house))
|
||||
{
|
||||
case ALLIANCE: return &mAllianceAuctions;
|
||||
case HORDE: return &mHordeAuctions;
|
||||
default: return &mNeutralAuctions;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item *pItem)
|
||||
|
|
@ -407,44 +404,24 @@ void AuctionHouseMgr::LoadAuctions()
|
|||
continue;
|
||||
}
|
||||
|
||||
bool success = true;
|
||||
|
||||
CreatureData const* auctioneerData = sObjectMgr.GetCreatureData(auction->auctioneer);
|
||||
if(!auctioneerData)
|
||||
{
|
||||
success = false;
|
||||
sLog.outError("Auction %u has not a existing auctioneer (GUID : %u), will mail to owner (GUID: %u)",
|
||||
auction->Id, auction->auctioneer, auction->owner);
|
||||
}
|
||||
|
||||
CreatureInfo const* auctioneerInfo;
|
||||
if (success)
|
||||
CreatureInfo const* auctioneerInfo = auctioneerData ? ObjectMgr::GetCreatureTemplate(auctioneerData->id) : NULL;
|
||||
if(auctioneerData && !auctioneerInfo)
|
||||
{
|
||||
auctioneerInfo = ObjectMgr::GetCreatureTemplate(auctioneerData->id);
|
||||
if(!auctioneerInfo)
|
||||
{
|
||||
success = false;
|
||||
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);
|
||||
}
|
||||
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 (success)
|
||||
{
|
||||
auction->auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(auctioneerInfo->faction_A);
|
||||
if(!auction->auctionHouseEntry)
|
||||
{
|
||||
success = false;
|
||||
sLog.outError("Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u, will mail to owner (GUID: %u)",
|
||||
auction->Id, auction->auctioneer, auctioneerData->id, auctioneerInfo->faction_A, auction->owner);
|
||||
}
|
||||
}
|
||||
|
||||
if(!success)
|
||||
if (!auctioneerInfo)
|
||||
{
|
||||
// need for send mail, use goblin auctionhouse
|
||||
if (!auction->auctionHouseEntry)
|
||||
auction->auctionHouseEntry = sAuctionHouseStore.LookupEntry(7);
|
||||
auction->auctionHouseEntry = sAuctionHouseStore.LookupEntry(7);
|
||||
|
||||
// Attempt send item back to owner
|
||||
std::ostringstream msgAuctionCanceledOwner;
|
||||
|
|
@ -458,10 +435,14 @@ void AuctionHouseMgr::LoadAuctions()
|
|||
RemoveAItem(auction->item_guidlow);
|
||||
auction->DeleteFromDB();
|
||||
delete auction;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
GetAuctionsMap( auctioneerInfo->faction_A )->AddAuction(auction);
|
||||
// always return pointer
|
||||
auction->auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(auctioneerInfo->faction_A);
|
||||
|
||||
GetAuctionsMap(auction->auctionHouseEntry)->AddAuction(auction);
|
||||
|
||||
} while (result->NextRow());
|
||||
delete result;
|
||||
|
|
@ -495,6 +476,23 @@ void AuctionHouseMgr::Update()
|
|||
mNeutralAuctions.Update();
|
||||
}
|
||||
|
||||
uint32 AuctionHouseMgr::GetAuctionHouseTeam(AuctionHouseEntry const* house)
|
||||
{
|
||||
// auction houses have faction field pointing to PLAYER,* factions,
|
||||
// but player factions not have filled team field, and hard go from faction value to faction_template value,
|
||||
// so more easy just sort by auction house ids
|
||||
switch(house->houseId)
|
||||
{
|
||||
case 1: case 2: case 3:
|
||||
return ALLIANCE;
|
||||
case 4: case 5: case 6:
|
||||
return HORDE;
|
||||
case 7:
|
||||
default:
|
||||
return 0; // neutral
|
||||
}
|
||||
}
|
||||
|
||||
AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(uint32 factionTemplateId)
|
||||
{
|
||||
uint32 houseid = 1; // dwarf auction house (used for normal cut/etc percents)
|
||||
|
|
@ -508,14 +506,16 @@ AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(uint32 factionTem
|
|||
{
|
||||
case 12: houseid = 1; break; // human
|
||||
case 29: houseid = 6; break; // orc, and generic for horde
|
||||
case 55: houseid = 2; break; // dwarf, and generic for alliance
|
||||
case 55: houseid = 2; break; // dwarf/gnome, and generic for alliance
|
||||
case 68: houseid = 4; break; // undead
|
||||
case 80: houseid = 3; break; // n-elf
|
||||
case 104: houseid = 5; break; // trolls
|
||||
case 120: houseid = 7; break; // booty bay, neutral
|
||||
case 474: houseid = 7; break; // gadgetzan, neutral
|
||||
case 534: houseid = 2; break; // Alliance Generic
|
||||
case 855: houseid = 7; break; // everlook, neutral
|
||||
case 1604: houseid = 6; break; // b-elfs,
|
||||
case 1638: houseid = 2; break; // exodar, alliance
|
||||
default: // for unknown case
|
||||
{
|
||||
FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(factionTemplateId);
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ class AuctionHouseMgr
|
|||
|
||||
typedef UNORDERED_MAP<uint32, Item*> ItemMap;
|
||||
|
||||
AuctionHouseObject* GetAuctionsMap( uint32 factionTemplateId );
|
||||
AuctionHouseObject* GetAuctionsMap(AuctionHouseEntry const* house);
|
||||
|
||||
Item* GetAItem(uint32 id)
|
||||
{
|
||||
|
|
@ -140,6 +140,8 @@ class AuctionHouseMgr
|
|||
void SendAuctionSuccessfulMail( AuctionEntry * auction );
|
||||
void SendAuctionExpiredMail( AuctionEntry * auction );
|
||||
static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item *pItem);
|
||||
|
||||
static uint32 GetAuctionHouseTeam(AuctionHouseEntry const* house);
|
||||
static AuctionHouseEntry const* GetAuctionHouseEntry(uint32 factionTemplateId);
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -700,18 +700,18 @@ void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket)
|
|||
{
|
||||
DEBUG_LOG("WORLD: Received MSG_SAVE_GUILD_EMBLEM");
|
||||
|
||||
uint64 vendorGuid;
|
||||
ObjectGuid vendorGuid;
|
||||
uint32 EmblemStyle, EmblemColor, BorderStyle, BorderColor, BackgroundColor;
|
||||
|
||||
recvPacket >> vendorGuid;
|
||||
recvPacket >> EmblemStyle >> EmblemColor >> BorderStyle >> BorderColor >> BackgroundColor;
|
||||
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorGuid,UNIT_NPC_FLAG_TABARDDESIGNER);
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorGuid, UNIT_NPC_FLAG_TABARDDESIGNER);
|
||||
if (!pCreature)
|
||||
{
|
||||
//"That's not an emblem vendor!"
|
||||
SendSaveGuildEmblem(ERR_GUILDEMBLEM_INVALIDVENDOR);
|
||||
DEBUG_LOG("WORLD: HandleSaveGuildEmblemOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(vendorGuid));
|
||||
DEBUG_LOG("WORLD: HandleSaveGuildEmblemOpcode - %s not found or you can't interact with him.", vendorGuid.GetString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -487,18 +487,22 @@ void WorldSession::HandlePageQuerySkippedOpcode( WorldPacket & recv_data )
|
|||
void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
DEBUG_LOG( "WORLD: Received CMSG_SELL_ITEM" );
|
||||
uint64 vendorguid, itemguid;
|
||||
|
||||
ObjectGuid vendorGuid;
|
||||
uint64 itemguid;
|
||||
uint32 count;
|
||||
|
||||
recv_data >> vendorguid >> itemguid >> count;
|
||||
recv_data >> vendorGuid;
|
||||
recv_data >> itemguid;
|
||||
recv_data >> count;
|
||||
|
||||
if(!itemguid)
|
||||
return;
|
||||
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorGuid, UNIT_NPC_FLAG_VENDOR);
|
||||
if (!pCreature)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: HandleSellItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) );
|
||||
DEBUG_LOG("WORLD: HandleSellItemOpcode - %s not found or you can't interact with him.", vendorGuid.GetString().c_str());
|
||||
_player->SendSellError( SELL_ERR_CANT_FIND_VENDOR, NULL, itemguid, 0);
|
||||
return;
|
||||
}
|
||||
|
|
@ -596,15 +600,15 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
|
|||
void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: Received CMSG_BUYBACK_ITEM" );
|
||||
uint64 vendorguid;
|
||||
ObjectGuid vendorGuid;
|
||||
uint32 slot;
|
||||
|
||||
recv_data >> vendorguid >> slot;
|
||||
recv_data >> vendorGuid >> slot;
|
||||
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorGuid, UNIT_NPC_FLAG_VENDOR);
|
||||
if (!pCreature)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: HandleBuybackItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) );
|
||||
DEBUG_LOG("WORLD: HandleBuybackItem - %s not found or you can't interact with him.", vendorGuid.GetString().c_str());
|
||||
_player->SendSellError( SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12957,7 +12957,7 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me
|
|||
GetSession()->SendTabardVendorActivate(guid);
|
||||
break;
|
||||
case GOSSIP_OPTION_AUCTIONEER:
|
||||
GetSession()->SendAuctionHello(guid, ((Creature*)pSource));
|
||||
GetSession()->SendAuctionHello(((Creature*)pSource));
|
||||
break;
|
||||
case GOSSIP_OPTION_SPIRITGUIDE:
|
||||
PrepareGossipMenu(pSource);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
struct ItemPrototype;
|
||||
struct AuctionEntry;
|
||||
struct AuctionHouseEntry;
|
||||
struct DeclinedName;
|
||||
|
||||
class ObjectGuid;
|
||||
|
|
@ -263,12 +264,13 @@ class MANGOS_DLL_SPEC WorldSession
|
|||
bool SendItemInfo( uint32 itemid, WorldPacket data );
|
||||
|
||||
//auction
|
||||
void SendAuctionHello( uint64 guid, Creature * unit );
|
||||
void SendAuctionHello(Creature * unit);
|
||||
void SendAuctionCommandResult( uint32 auctionId, uint32 Action, uint32 ErrorCode, uint32 bidError = 0);
|
||||
void SendAuctionBidderNotification( uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 item_template);
|
||||
void SendAuctionOwnerNotification( AuctionEntry * auction );
|
||||
void SendAuctionOutbiddedMail( AuctionEntry * auction, uint32 newPrice );
|
||||
void SendAuctionCancelledToBidderMail( AuctionEntry* auction );
|
||||
AuctionHouseEntry const* GetCheckedAuctionHouseForAuctioneer(ObjectGuid guid);
|
||||
|
||||
//Item Enchantment
|
||||
void SendEnchantmentLog(uint64 Target, uint64 Caster,uint32 ItemID,uint32 SpellID);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10249"
|
||||
#define REVISION_NR "10250"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue