rendered paste bodyIndex: game/AuctionHouse.cpp
===================================================================
RCS file: C:/CVSROOT/src/game/AuctionHouse.cpp,v
retrieving revision 1.1
diff -u -r1.1 AuctionHouse.cpp
--- game/AuctionHouse.cpp 26 Feb 2008 23:04:27 -0000 1.1
+++ game/AuctionHouse.cpp 29 Feb 2008 01:35:26 -0000
@@ -616,84 +633,104 @@
//this void is called when player clicks on search button
void WorldSession::HandleAuctionListItems( WorldPacket & recv_data )
{
- CHECK_PACKET_SIZE(recv_data,8+4+1+1+1+4+4+4+4+1);
-
- std::string searchedname, name;
- uint8 levelmin, levelmax, usable, location;
- uint32 count, totalcount, listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality;
- uint64 guid;
-
- recv_data >> guid;
- recv_data >> listfrom;
- recv_data >> searchedname;
-
- // recheck with known string size
- CHECK_PACKET_SIZE(recv_data,8+4+(searchedname.size()+1)+1+1+4+4+4+4+1);
-
- recv_data >> levelmin >> levelmax;
- recv_data >> auctionSlotID >> auctionMainCategory >> auctionSubCategory;
- recv_data >> quality >> usable;
-
- Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid,UNIT_NPC_FLAG_AUCTIONEER);
- if (!pCreature)
- {
- sLog.outDebug( "WORLD: HandleAuctionListItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
- return;
- }
-
- location = AuctioneerFactionToLocation(pCreature->getFaction());
- AuctionHouseObject * mAuctions;
- mAuctions = objmgr.GetAuctionsMap( location );
+ CHECK_PACKET_SIZE(recv_data,8+4+1+1+1+4+4+4+4+1);
- //sLog.outDebug("Auctionhouse search guid: " I64FMTD ", list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", guid, listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable);
-
- WorldPacket data( SMSG_AUCTION_LIST_RESULT, (4+4+4) );
- count = 0;
- totalcount = 0;
- data << (uint32) 0;
- for (AuctionHouseObject::AuctionEntryMap::iterator itr = mAuctions->GetAuctionsBegin();itr != mAuctions->GetAuctionsEnd();++itr)
- {
- AuctionEntry *Aentry = itr->second;
- Item *item = objmgr.GetAItem(Aentry->item_guid);
- if( item )
- {
- ItemPrototype const *proto = item->GetProto();
- if( proto )
+ std::string searchedname, name, FullName;
+ uint8 levelmin, levelmax, usable, location;
+ uint32 count, totalcount, listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, ItemEnchant;
+ uint64 guid;
+
+ recv_data >> guid;
+ recv_data >> listfrom;
+ recv_data >> searchedname;
+
+ // recheck with known string size
+ CHECK_PACKET_SIZE(recv_data,8+4+(searchedname.size()+1)+1+1+4+4+4+4+1);
+
+ recv_data >> levelmin >> levelmax;
+ recv_data >> auctionSlotID >> auctionMainCategory >> auctionSubCategory;
+ recv_data >> quality >> usable;
+
+ Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid,UNIT_NPC_FLAG_AUCTIONEER);
+ if (!pCreature)
+ {
+ sLog.outDebug( "WORLD: HandleAuctionListItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
+ return;
+ }
+
+ location = AuctioneerFactionToLocation(pCreature->getFaction());
+ AuctionHouseObject * mAuctions;
+ mAuctions = objmgr.GetAuctionsMap( location );
+
+ //sLog.outDebug("Auctionhouse search guid: " I64FMTD ", list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", guid, listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable);
+
+ WorldPacket data( SMSG_AUCTION_LIST_RESULT, (4+4+4) );
+ count = 0;
+ totalcount = 0;
+ data << (uint32) 0;
+ uint8 SubType = NULL;
+
+ //pre-load...
+ std::transform( searchedname.begin(), searchedname.end(), searchedname.begin(), ::tolower );
+ uint32 RandomPropertiesValidid = sItemRandomPropertiesStore.GetNumRows();
+
+ for (AuctionHouseObject::AuctionEntryMap::iterator itr = mAuctions->GetAuctionsBegin();itr != mAuctions->GetAuctionsEnd();++itr)
+ {
+ if (totalcount > 299) break;
+ AuctionEntry *Aentry = itr->second;
+ Item *item = objmgr.GetAItem(Aentry->item_guid);
+ if(!item) continue;
+ ItemPrototype const *proto = item->GetProto();
+ if(!proto) continue;
+
+ if( auctionMainCategory == (0xffffffff) || proto->Class == auctionMainCategory )
+ {
+ if( auctionSubCategory == (0xffffffff) || proto->SubClass == auctionSubCategory )
+ {
+ if( auctionSlotID == (0xffffffff) || proto->InventoryType == auctionSlotID )
+ {
+ if( quality == (0xffffffff) || proto->Quality == quality )
+ {
+ if( usable == (0x00) || _player->CanUseItem( item ) == EQUIP_ERR_OK )
{
- if( auctionMainCategory == (0xffffffff) || proto->Class == auctionMainCategory )
+ if( ( levelmin == (0x00) || proto->RequiredLevel >= levelmin ) && ( levelmax == (0x00) || proto->RequiredLevel <= levelmax ) )
+ {
+ if(searchedname.empty())
{
- if( auctionSubCategory == (0xffffffff) || proto->SubClass == auctionSubCategory )
- {
- if( auctionSlotID == (0xffffffff) || proto->InventoryType == auctionSlotID )
- {
- if( quality == (0xffffffff) || proto->Quality == quality )
- {
- if( usable == (0x00) || _player->CanUseItem( item ) == EQUIP_ERR_OK )
- {
- if( ( levelmin == (0x00) || proto->RequiredLevel >= levelmin ) && ( levelmax == (0x00) || proto->RequiredLevel <= levelmax ) )
- {
- name = proto->Name1;
- std::transform( name.begin(), name.end(), name.begin(), ::tolower );
- std::transform( searchedname.begin(), searchedname.end(), searchedname.begin(), ::tolower );
- if( searchedname.empty() || name.find( searchedname ) != std::string::npos )
- {
- if ((count < 50) && (totalcount >= listfrom))
- {
- count++;
- SendAuctionInfo( data, Aentry);
- }
- totalcount++;
- }
- }
- }
- }
- }
- }
- }
+ totalcount++;
+ if (totalcount < listfrom) continue;
+ if (count > 49) continue;
+ count++;
+ SendAuctionInfo( data, Aentry);
+ continue;
+ }
+ FullName = "";
+ FullName += proto->Name1;
+ ItemEnchant = item->GetItemRandomPropertyId();
+ if(ItemEnchant)
+ { //SantaCl hf036: add Item Enchantmant name support to text search of items.
+ ItemRandomPropertiesEntry const *rp_data = sItemRandomPropertiesStore.LookupEntry(ItemEnchant);
+ if(rp_data)
+ {
+ FullName += " ";
+ FullName += rp_data->internalName;
+ }
+ }
+ std::transform( FullName.begin(), FullName.end(), FullName.begin(), ::tolower );
+ if(FullName.find( searchedname ) == std::string::npos) continue;
+ totalcount++;
+ if (totalcount < listfrom) continue;
+ if (count > 49) continue;
+ count++;
+ SendAuctionInfo( data, Aentry);
+ }
}
+ }
}
+ }
}
- data.put<uint32>(0, count);
- data << (uint32) totalcount;
- SendPacket(&data);
-}
+ }
+ data.put<uint32>(0, count);
+ data << (uint32) totalcount;
+ SendPacket(&data);
+}
\ No newline at end of file
Index: shared/Database/DBCStructure.h
===================================================================
RCS file: C:/CVSROOT/src/shared/Database/DBCStructure.h,v
retrieving revision 1.1
diff -u -r1.1 DBCStructure.h
--- shared/Database/DBCStructure.h 26 Feb 2008 23:04:31 -0000 1.1
+++ shared/Database/DBCStructure.h 28 Feb 2008 01:11:34 -0000
@@ -297,7 +297,7 @@
struct ItemRandomPropertiesEntry
{
uint32 ID; //0
- //char* internalName //1 unused
+ char* internalName; //1 SantaCL used for AH lookups...
uint32 enchant_id[3]; //2-4
//5-6 unused, 0 only values, reserved for additional enchantments?
//char* nameSuffix[16] //7-22, unused
Index: shared/Database/DBCfmt.cpp
===================================================================
RCS file: C:/CVSROOT/src/shared/Database/DBCfmt.cpp,v
retrieving revision 1.1
diff -u -r1.1 DBCfmt.cpp
--- shared/Database/DBCfmt.cpp 26 Feb 2008 23:04:31 -0000 1.1
+++ shared/Database/DBCfmt.cpp 28 Feb 2008 00:46:47 -0000
@@ -43,7 +43,7 @@
const char GtRegenMPPerSptfmt[]="f";
const char ItemDisplayTemplateEntryfmt[]="nxxxxxxxxxxixxxxxxxxxxx";
const char ItemExtendedCostEntryfmt[]="niiiiixxiiixx";
-const char ItemRandomPropertiesfmt[]="nxiiixxxxxxxxxxxxxxxxxxx";
+const char ItemRandomPropertiesfmt[]="nsiiixxxxxxxxxxxxxxxxxxx";
const char ItemRandomSuffixfmt[]="nxxxxxxxxxxxxxxxxxxiiiiii";
const char ItemSetEntryfmt[]="dssssssssssssssssxxxxxxxxxxxxxxxxxxiiiiiiiiiiiiiiiiii";
const char LockEntryfmt[]="niiiiixxxiiiiixxxiixxxxxxxxxxxxxx";