diff options
author | click <none@none> | 2010-05-25 16:15:22 +0200 |
---|---|---|
committer | click <none@none> | 2010-05-25 16:15:22 +0200 |
commit | 2b9eef87e4812890ec7875c581ce9e5b67644abc (patch) | |
tree | 6f951365522834c0169054f9ce89fc3497deab55 | |
parent | aaf6b425fc99e95caa31b459d0199b3771fd1396 (diff) |
Slap auctioneers in the face telling them to search for items with partial names or suffixes - patch by MrSmite
Will require more testing, but base functionality is there. Fixes issue #1510. Closes issue #1534.
+ Skip some excess (unused) packetdata sent from client during AH-usage (click)
--HG--
branch : trunk
-rw-r--r-- | src/game/AuctionHouseHandler.cpp | 5 | ||||
-rw-r--r-- | src/game/AuctionHouseMgr.cpp | 78 |
2 files changed, 64 insertions, 19 deletions
diff --git a/src/game/AuctionHouseHandler.cpp b/src/game/AuctionHouseHandler.cpp index 5f9b727cd21..8fec3b7df1d 100644 --- a/src/game/AuctionHouseHandler.cpp +++ b/src/game/AuctionHouseHandler.cpp @@ -601,6 +601,8 @@ void WorldSession::HandleAuctionListItems(WorldPacket & recv_data) recv_data >> auctionSlotID >> auctionMainCategory >> auctionSubCategory; recv_data >> quality >> usable; + 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) { @@ -643,7 +645,8 @@ void WorldSession::HandleAuctionListItems(WorldPacket & recv_data) void WorldSession::HandleAuctionListPendingSales(WorldPacket & recv_data) { sLog.outDebug("CMSG_AUCTION_LIST_PENDING_SALES"); - recv_data.hexlike(); + + recv_data.read_skip<uint64>(); uint32 count = 0; diff --git a/src/game/AuctionHouseMgr.cpp b/src/game/AuctionHouseMgr.cpp index cac9cf9940a..94bb8180953 100644 --- a/src/game/AuctionHouseMgr.cpp +++ b/src/game/AuctionHouseMgr.cpp @@ -611,24 +611,66 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player 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; - + // 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) + { + 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]; + } + } + + // 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* const* temp = itemRandProp->nameSuffix; + //char* temp = itemRandProp->nameSuffix; + + if (temp) + { + if (loc_idx >= 0) + { + // Append the suffix (ie: of the Monkey) to the name using localization + name += " "; + name += temp[loc_idx]; + } + else + { + // Invalid localization? Append the suffix using default enUS + name += " "; + name += temp[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; |