本文整理汇总了C++中AuctionEntry::BuildAuctionInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ AuctionEntry::BuildAuctionInfo方法的具体用法?C++ AuctionEntry::BuildAuctionInfo怎么用?C++ AuctionEntry::BuildAuctionInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AuctionEntry
的用法示例。
在下文中一共展示了AuctionEntry::BuildAuctionInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildListAuctionItems
void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player,
std::wstring const& wsearchedname, uint32 listfrom, uint32 levelmin, uint32 levelmax, uint32 usable,
uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality,
uint32& count, uint32& totalcount)
{
int loc_idx = player->GetSession()->GetSessionDbLocaleIndex();
for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin();itr != AuctionsMap.end();++itr)
{
AuctionEntry *Aentry = itr->second;
Item *item = auctionmgr.GetAItem(Aentry->item_guidlow);
if (!item)
continue;
ItemPrototype const *proto = item->GetProto();
if (itemClass != 0xffffffff && proto->Class != itemClass)
continue;
if (itemSubClass != 0xffffffff && proto->SubClass != itemSubClass)
continue;
if (inventoryType != 0xffffffff && proto->InventoryType != inventoryType)
continue;
if (quality != 0xffffffff && proto->Quality != quality)
continue;
if (levelmin != 0x00 && (proto->RequiredLevel < levelmin || (levelmax != 0x00 && proto->RequiredLevel > levelmax)))
continue;
if (usable != 0x00 && player->CanUseItem( item ) != EQUIP_ERR_OK)
continue;
std::string name = proto->Name1;
if(name.empty())
continue;
// local name
if ( loc_idx >= 0 )
{
ItemLocale const *il = objmgr.GetItemLocale(proto->ItemId);
if (il)
{
if (il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty())
name = il->Name[loc_idx];
}
}
if (!wsearchedname.empty() && !Utf8FitTo(name, wsearchedname) )
continue;
if (count < 50 && totalcount >= listfrom)
{
++count;
Aentry->BuildAuctionInfo(data);
}
++totalcount;
}
}
示例2: HandleAuctionListBidderItems
//called when player lists his bids
void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data) {
uint64 guid; //NPC guid
uint32 listfrom; //page of auctions
uint32 outbiddedCount; //count of outbidded auctions
recv_data >> guid;
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)) {
sLog->outError(
"Client sent bad opcode!!! with count: %u and size : %lu (must be: %u)",
outbiddedCount, (unsigned long) recv_data.size(),
(16 + outbiddedCount * 4));
outbiddedCount = 0;
}
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid,
UNIT_NPC_FLAG_AUCTIONEER);
if (!pCreature) {
sLog->outDebug(
LOG_FILTER_NETWORKIO,
"WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.",
uint32(GUID_LOPART(guid)));
return;
}
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(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
uint32 count = 0;
uint32 totalcount = 0;
while (outbiddedCount > 0) //add all data, which client requires
{
--outbiddedCount;
uint32 outbiddedAuctionId;
recv_data >> outbiddedAuctionId;
AuctionEntry * auction = auctionHouse->GetAuction(outbiddedAuctionId);
if (auction && auction->BuildAuctionInfo(data)) {
++totalcount;
++count;
}
}
auctionHouse->BuildListBidderItems(data, pl, count, totalcount);
data.put<uint32>(0, count); // add count to placeholder
data << totalcount;
data << (uint32) 300; //unk 2.3.0
SendPacket(&data);
}
示例3: HandleAuctionListBidderItems
//called when player lists his bids
void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_BIDDER_ITEMS");
ObjectGuid guid; //NPC guid
uint32 listfrom; //page of auctions
uint32 outbiddedCount; //count of outbidded auctions
recvData >> guid;
recvData >> listfrom; // not used in fact (this list not have page control in client)
recvData >> outbiddedCount;
if (recvData.size() != (16 + outbiddedCount * 4))
{
TC_LOG_ERROR("network", "Client sent bad opcode!!! with count: %u and size : %lu (must be: %u)", outbiddedCount, (unsigned long)recvData.size(), (16 + outbiddedCount * 4));
outbiddedCount = 0;
}
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
{
TC_LOG_DEBUG("network", "WORLD: HandleAuctionListBidderItems - %s not found or you can't interact with him.", guid.ToString().c_str());
recvData.rfinish();
return;
}
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, (4+4+4));
Player* player = GetPlayer();
data << (uint32) 0; //add 0 as count
uint32 count = 0;
uint32 totalcount = 0;
while (outbiddedCount > 0) //add all data, which client requires
{
--outbiddedCount;
uint32 outbiddedAuctionId;
recvData >> outbiddedAuctionId;
AuctionEntry* auction = auctionHouse->GetAuction(outbiddedAuctionId);
if (auction && auction->BuildAuctionInfo(data))
{
++totalcount;
++count;
}
}
auctionHouse->BuildListBidderItems(data, player, count, totalcount);
data.put<uint32>(0, count); // add count to placeholder
data << totalcount;
data << (uint32)300; //unk 2.3.0
SendPacket(&data);
}
示例4: BuildListOwnerItems
void AuctionHouseObject::BuildListOwnerItems(WorldPackets::AuctionHouse::AuctionListOwnerItemsResult& packet, Player* player, uint32& totalcount)
{
for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr)
{
AuctionEntry* Aentry = itr->second;
if (Aentry && Aentry->owner == player->GetGUID().GetCounter())
{
Aentry->BuildAuctionInfo(packet.Items, false);
++totalcount;
}
}
}
示例5: HandleAuctionListBidderItems
// called when player lists his bids
void WorldSession::HandleAuctionListBidderItems(WorldPacket& recv_data)
{
DEBUG_LOG("WORLD: CMSG_AUCTION_LIST_BIDDER_ITEMS");
ObjectGuid auctioneerGuid; // NPC guid
uint32 listfrom; // page of auctions
uint32 outbiddedCount; // count of outbidded auctions
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))
{
sLog.outError("Client sent bad opcode!!! with count: %u and size : %u (must be: %u)", outbiddedCount, (uint32)recv_data.size(), (16 + outbiddedCount * 4));
outbiddedCount = 0;
}
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);
WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, (4 + 4 + 4));
Player* pl = GetPlayer();
data << uint32(0); // add 0 as count
uint32 count = 0;
uint32 totalcount = 0;
while (outbiddedCount > 0) // add all data, which client requires
{
--outbiddedCount;
uint32 outbiddedAuctionId;
recv_data >> outbiddedAuctionId;
AuctionEntry* auction = auctionHouse->GetAuction(outbiddedAuctionId);
if (auction && auction->BuildAuctionInfo(data))
{
++totalcount;
++count;
}
}
auctionHouse->BuildListBidderItems(data, pl, count, totalcount);
data.put<uint32>(0, count); // add count to placeholder
data << uint32(totalcount);
data << uint32(300); // unk 2.3.0 delay for next isFull request?
SendPacket(&data);
DEBUG_LOG("WORLD: SMSG_AUCTION_BIDDER_LIST_RESULT");
}
示例6: BuildListOwnerItems
void AuctionHouseObject::BuildListOwnerItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount)
{
for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin();itr != AuctionsMap.end();++itr)
{
AuctionEntry *Aentry = itr->second;
if (Aentry && Aentry->owner == player->GetGUIDLow())
{
if (Aentry->BuildAuctionInfo(data))
++count;
++totalcount;
}
}
}
示例7: BuildListOwnerItems
void AuctionHouseObject::BuildListOwnerItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount)
{
for (auto auctionsMap : AuctionsMap)
{
AuctionEntry* Aentry = auctionsMap.second;
if (Aentry && Aentry->owner == player->GetGUIDLow())
{
if (Aentry->BuildAuctionInfo(data))
++count;
++totalcount;
}
}
}
示例8: HandleAuctionListBidderItems
// called when player lists his bids
void WorldSession::HandleAuctionListBidderItems(WorldPacket& recv_data)
{
DEBUG_LOG("WORLD: HandleAuctionListBidderItems");
ObjectGuid auctioneerGuid; // NPC guid
uint32 listfrom; // page of auctions
uint32 outbiddedCount; // count of outbidded auctions
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))
{
sLog.outError("Client sent bad opcode!!! with count: %u and size : %u (must be: %u)", outbiddedCount, (uint32)recv_data.size(), (16 + outbiddedCount * 4));
outbiddedCount = 0;
}
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
if (!auctionHouseEntry)
return;
// always return pointer
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, (4 + 4 + 4));
Player* pl = GetPlayer();
data << uint32(0); // add 0 as count
uint32 count = 0;
uint32 totalcount = 0;
while (outbiddedCount > 0) // add all data, which client requires
{
--outbiddedCount;
uint32 outbiddedAuctionId;
recv_data >> outbiddedAuctionId;
AuctionEntry* auction = auctionHouse->GetAuction(outbiddedAuctionId);
if (auction && auction->BuildAuctionInfo(data))
{
++totalcount;
++count;
}
}
auctionHouse->BuildListBidderItems(data, pl, count, totalcount);
data.put<uint32>(0, count); // add count to placeholder
data << uint32(totalcount);
SendPacket(data);
}
示例9: BuildListAuctionItems
void WorldSession::BuildListAuctionItems(std::list<AuctionEntry*> &auctions, WorldPacket& data, std::wstring const& wsearchedname, uint32 listfrom, uint32 levelmin,
uint32 levelmax, uint32 usable, uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality, uint32& count, uint32& totalcount, bool isFull)
{
int loc_idx = _player->GetSession()->GetSessionDbLocaleIndex();
for (std::list<AuctionEntry*>::const_iterator itr = auctions.begin(); itr != auctions.end();++itr)
{
AuctionEntry *Aentry = *itr;
if (Aentry->moneyDeliveryTime)
continue;
Item *item = sAuctionMgr.GetAItem(Aentry->itemGuidLow);
if (!item)
continue;
if (isFull)
{
++count;
Aentry->BuildAuctionInfo(data);
}
else
{
ItemPrototype const *proto = item->GetProto();
if (itemClass != 0xffffffff && proto->Class != itemClass)
continue;
if (itemSubClass != 0xffffffff && proto->SubClass != itemSubClass)
continue;
if (inventoryType != 0xffffffff && proto->InventoryType != inventoryType)
continue;
if (quality != 0xffffffff && proto->Quality < quality)
continue;
if (levelmin != 0x00 && (proto->RequiredLevel < levelmin || (levelmax != 0x00 && proto->RequiredLevel > levelmax)))
continue;
if (usable != 0x00 && _player->CanUseItem(item) != EQUIP_ERR_OK)
continue;
std::string name = proto->Name1;
if (name.empty())
continue;
// local name
if (loc_idx >= 0)
{
ItemLocale const *il = sObjectMgr.GetItemLocale(proto->ItemId);
if (il)
{
if (il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty())
name = il->Name[loc_idx];
}
}
if (!wsearchedname.empty() && !Utf8FitTo(name, wsearchedname))
continue;
if (count < 50 && totalcount >= listfrom)
{
++count;
Aentry->BuildAuctionInfo(data);
}
}
++totalcount;
}
}
示例10: BuildListAuctionItems
void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player,
std::wstring const& wsearchedname, uint32 listfrom, uint8 levelmin, uint8 levelmax, uint8 usable,
uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality,
uint32& count, uint32& totalcount)
{
int loc_idx = player->GetSession()->GetSessionDbLocaleIndex();
int locdbc_idx = player->GetSession()->GetSessionDbcLocale();
for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr)
{
AuctionEntry* Aentry = itr->second;
Item* item = sAuctionMgr->GetAItem(Aentry->item_guidlow);
if (!item)
continue;
ItemTemplate const* proto = item->GetTemplate();
if (itemClass != 0xffffffff && proto->Class != itemClass)
continue;
if (itemSubClass != 0xffffffff && proto->SubClass != itemSubClass)
continue;
if (inventoryType != 0xffffffff && proto->InventoryType != inventoryType)
continue;
if (quality != 0xffffffff && proto->Quality != quality)
continue;
if (levelmin != 0x00 && (proto->RequiredLevel < levelmin || (levelmax != 0x00 && proto->RequiredLevel > levelmax)))
continue;
if (usable != 0x00 && player->CanUseItem(item) != EQUIP_ERR_OK)
continue;
// Allow search by suffix (ie: of the Monkey) or partial name (ie: Monkey)
// No need to do any of this if no search term was entered
if (!wsearchedname.empty())
{
std::string name = proto->Name1;
if (name.empty())
continue;
// local name
if (loc_idx >= 0)
if (ItemLocale const* il = sObjectMgr->GetItemLocale(proto->ItemId))
ObjectMgr::GetLocaleString(il->Name, loc_idx, name);
// DO NOT use GetItemEnchantMod(proto->RandomProperty) as it may return a result
// that matches the search but it may not equal item->GetItemRandomPropertyId()
// used in BuildAuctionInfo() which then causes wrong items to be listed
int32 propRefID = item->GetItemRandomPropertyId();
if (propRefID)
{
// Append the suffix to the name (ie: of the Monkey) if one exists
// These are found in ItemRandomProperties.dbc, not ItemRandomSuffix.dbc
// even though the DBC names seem misleading
const ItemRandomPropertiesEntry* itemRandProp = sItemRandomPropertiesStore.LookupEntry(propRefID);
if (itemRandProp)
{
char* temp = itemRandProp->nameSuffix;
// dbc local name
if (temp)
{
// Append the suffix (ie: of the Monkey) to the name using localization
// or default enUS if localization is invalid
name += ' ';
name += temp[locdbc_idx >= 0 ? locdbc_idx : LOCALE_enUS];
}
}
}
// Perform the search (with or without suffix)
if (!Utf8FitTo(name, wsearchedname))
continue;
}
// Add the item if no search term or if entered search term was found
if (count < 50 && totalcount >= listfrom)
{
++count;
Aentry->BuildAuctionInfo(data);
}
++totalcount;
}
}
示例11: BuildListAuctionItems
void WorldSession::BuildListAuctionItems(std::vector<AuctionEntry*> const& auctions, WorldPacket& data, std::wstring const& wsearchedname, uint32 listfrom, uint32 levelmin,
uint32 levelmax, uint32 usable, uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality, uint32& count, uint32& totalcount, bool isFull) const
{
int loc_idx = _player->GetSession()->GetSessionDbLocaleIndex();
for (std::vector<AuctionEntry*>::const_iterator itr = auctions.begin(); itr != auctions.end(); ++itr)
{
AuctionEntry* Aentry = *itr;
Item* item = sAuctionMgr.GetAItem(Aentry->itemGuidLow);
if (!item)
continue;
if (isFull)
{
++count;
Aentry->BuildAuctionInfo(data);
}
else
{
ItemPrototype const* proto = item->GetProto();
if (itemClass != 0xffffffff && proto->Class != itemClass)
continue;
if (itemSubClass != 0xffffffff && proto->SubClass != itemSubClass)
continue;
if (inventoryType != 0xffffffff && proto->InventoryType != inventoryType)
continue;
if (quality != 0xffffffff && proto->Quality < quality)
continue;
if (levelmin != 0x00 && (proto->RequiredLevel < levelmin || (levelmax != 0x00 && proto->RequiredLevel > levelmax)))
continue;
if (usable != 0x00)
{
if (_player->CanUseItem(item) != EQUIP_ERR_OK)
continue;
if (proto->Class == ITEM_CLASS_RECIPE)
{
if (SpellEntry const* spell = sSpellTemplate.LookupEntry<SpellEntry>(proto->Spells[0].SpellId))
{
if (_player->HasSpell(spell->EffectTriggerSpell[EFFECT_INDEX_0]))
continue;
}
}
}
std::string name = proto->Name1;
sObjectMgr.GetItemLocaleStrings(proto->ItemId, loc_idx, &name);
if (!wsearchedname.empty() && !Utf8FitTo(name, wsearchedname))
continue;
if (count < 50 && totalcount >= listfrom)
{
++count;
Aentry->BuildAuctionInfo(data);
}
}
++totalcount;
}
}
示例12: HandleAuctionListBidderItems
//called when player lists his bids
void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_BIDDER_ITEMS");
ObjectGuid guid; //NPC guid
uint32 listfrom; //page of auctions
uint32 outbiddedCount; //count of outbidded auctions
std::list<uint32> outbiddedAuctionIds;
recvData >> listfrom; // not used in fact (this list not have page control in client)
outbiddedCount = recvData.ReadBits(7);
uint8 bitOrder[8] = { 6, 0, 2, 1, 7, 3, 4, 5 };
recvData.ReadBitInOrder(guid, bitOrder);
recvData.FlushBits();
recvData.ReadByteSeq(guid[5]);
recvData.ReadByteSeq(guid[4]);
recvData.ReadByteSeq(guid[6]);
recvData.ReadByteSeq(guid[1]);
recvData.ReadByteSeq(guid[0]);
recvData.ReadByteSeq(guid[7]);
recvData.ReadByteSeq(guid[3]);
uint32 t;
for (uint8 i = 0; i < outbiddedCount; i++)
{
recvData >> t;
outbiddedAuctionIds.push_back(t);
}
recvData.ReadByteSeq(guid[2]);
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
return;
}
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, (4 + 4 + 4));
Player* player = GetPlayer();
data << uint32(0); //add 0 as count
uint32 count = 0;
uint32 totalcount = 0;
for (std::list<uint32>::iterator itr = outbiddedAuctionIds.begin(); itr != outbiddedAuctionIds.end(); ++itr)
{
AuctionEntry* auction = auctionHouse->GetAuction(*itr);
if (auction && auction->BuildAuctionInfo(data))
{
++totalcount;
++count;
}
}
auctionHouse->BuildListBidderItems(data, player, count, totalcount);
data.put<uint32>(0, count); // add count to placeholder
data << totalcount;
data << uint32(300); // Official datas
SendPacket(&data);
}
示例13: HandleAuctionListBidderItems
//called when player lists his bids
void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_BIDDER_ITEMS");
ObjectGuid guid; //NPC guid
uint32 listfrom; //page of auctions
uint8 outbiddedCount; //count of outbidded auctions
std::vector<uint32> outbiddedAuctionIdList;
recvData >> listfrom; // not used in fact (this list not have page control in client)
outbiddedCount = recvData.ReadBits(7);
guid[6] = recvData.ReadBit();
guid[7] = recvData.ReadBit();
guid[4] = recvData.ReadBit();
guid[3] = recvData.ReadBit();
guid[2] = recvData.ReadBit();
guid[5] = recvData.ReadBit();
guid[0] = recvData.ReadBit();
guid[1] = recvData.ReadBit();
recvData.ReadByteSeq(guid[1]);
recvData.ReadByteSeq(guid[4]);
recvData.ReadByteSeq(guid[5]);
recvData.ReadByteSeq(guid[6]);
for(uint8 i = 0 ; i < outbiddedCount ; i++)
{
uint32 outBiddedAuctionId;
recvData >> outBiddedAuctionId;
outbiddedAuctionIdList.push_back(outBiddedAuctionId);
}
recvData.ReadByteSeq(guid[0]);
recvData.ReadByteSeq(guid[2]);
recvData.ReadByteSeq(guid[3]);
recvData.ReadByteSeq(guid[7]);
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
recvData.rfinish();
return;
}
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, (4+4+4));
Player* player = GetPlayer();
data << uint32(0); //add 0 as count
uint32 count = 0;
uint32 totalcount = 0;
for(int i = 0 ; i < outbiddedCount ; i++) //add all data, which client requires
{
uint32 outbiddedAuctionId = outbiddedAuctionIdList[i];
AuctionEntry* auction = auctionHouse->GetAuction(outbiddedAuctionId);
if (auction && auction->BuildAuctionInfo(data))
{
++totalcount;
++count;
}
}
auctionHouse->BuildListBidderItems(data, player, count, totalcount);
data.put<uint32>(0, count); // add count to placeholder
data << totalcount;
data << uint32(300); //unk 2.3.0
SendPacket(&data);
}
示例14: HandleAuctionListBidderItems
//called when player lists his bids
void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_BIDDER_ITEMS");
ObjectGuid auctioneer;
uint32 listFrom; // page of auctions
uint8 outbiddedCount; // count of outbidded auctions
uint32 outbiddedAuctionIds[128];
recvData >> auctioneer;
recvData >> listFrom; // not used in fact (this list not have page control in client)
outbiddedCount = recvData.ReadBits(7);
recvData.FlushBits();
for (uint8 i = 0; i < outbiddedCount; i++)
recvData >> outbiddedAuctionIds[i];
/*if (recvData.size() != (16 + outbiddedCount * 4))
{
TC_LOG_ERROR("network", "Client sent bad opcode!!! with count: %u and size : %lu (must be: %u)", outbiddedCount, (unsigned long)recvData.size(), (16 + outbiddedCount * 4));
outbiddedCount = 0;
}*/
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
{
TC_LOG_DEBUG("network", "WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)));
recvData.rfinish();
return;
}
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
uint32 count = 0;
uint32 totalcount = 0;
WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, 500); // guess size
data << uint32(0); // amount place holder
data << uint32(AUCTION_SEARCH_DELAY);
data << totalcount;
for (uint8 i = 0; i < outbiddedCount; i++)
{
AuctionEntry* auction = auctionHouse->GetAuction(outbiddedAuctionIds[i]);
if (auction && auction->BuildAuctionInfo(data))
{
++totalcount;
++count;
}
}
auctionHouse->BuildListBidderItems(data, GetPlayer(), count, totalcount);
data.put<uint32>(0, count); // add count to placeholder
SendPacket(&data);
}
示例15: BuildListAuctionItems
void AuctionHouseObject::BuildListAuctionItems(WorldPackets::AuctionHouse::AuctionListItemsResult& packet, Player* player,
std::wstring const& wsearchedname, uint32 listfrom, uint8 levelmin, uint8 levelmax, uint8 usable,
uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality, uint32& totalcount)
{
time_t curTime = sWorld->GetGameTime();
for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr)
{
AuctionEntry* Aentry = itr->second;
// Skip expired auctions
if (Aentry->expire_time < curTime)
continue;
Item* item = sAuctionMgr->GetAItem(Aentry->itemGUIDLow);
if (!item)
continue;
ItemTemplate const* proto = item->GetTemplate();
if (itemClass != 0xffffffff && proto->GetClass() != itemClass)
continue;
if (itemSubClass != 0xffffffff && proto->GetSubClass() != itemSubClass)
continue;
if (inventoryType != 0xffffffff && proto->GetInventoryType() != InventoryType(inventoryType))
continue;
if (quality != 0xffffffff && proto->GetQuality() != quality)
continue;
if (levelmin != 0 && (proto->GetBaseRequiredLevel() < levelmin || (levelmax != 0 && proto->GetBaseRequiredLevel() > levelmax)))
continue;
if (usable != 0 && player->CanUseItem(item) != EQUIP_ERR_OK)
continue;
// Allow search by suffix (ie: of the Monkey) or partial name (ie: Monkey)
// No need to do any of this if no search term was entered
if (!wsearchedname.empty())
{
std::string name = proto->GetName(player->GetSession()->GetSessionDbcLocale());
if (name.empty())
continue;
// DO NOT use GetItemEnchantMod(proto->RandomProperty) as it may return a result
// that matches the search but it may not equal item->GetItemRandomPropertyId()
// used in BuildAuctionInfo() which then causes wrong items to be listed
int32 propRefID = item->GetItemRandomPropertyId();
if (propRefID)
{
// Append the suffix to the name (ie: of the Monkey) if one exists
// These are found in ItemRandomSuffix.dbc and ItemRandomProperties.dbc
// even though the DBC names seem misleading
const char* suffix = nullptr;
if (propRefID < 0)
{
const ItemRandomSuffixEntry* itemRandSuffix = sItemRandomSuffixStore.LookupEntry(-propRefID);
if (itemRandSuffix)
suffix = itemRandSuffix->Name_lang;
}
else
{
const ItemRandomPropertiesEntry* itemRandProp = sItemRandomPropertiesStore.LookupEntry(propRefID);
if (itemRandProp)
suffix = itemRandProp->Name_lang;
}
// dbc local name
if (suffix)
{
// Append the suffix (ie: of the Monkey) to the name using localization
// or default enUS if localization is invalid
name += ' ';
name += suffix;
}
}
// Perform the search (with or without suffix)
if (!Utf8FitTo(name, wsearchedname))
continue;
}
// Add the item if no search term or if entered search term was found
if (packet.Items.size() < 50 && totalcount >= listfrom)
Aentry->BuildAuctionInfo(packet.Items, true);
++totalcount;
}
}