731{
733
734
736
737 std::vector<AuctionEntry*> auctionShortlist;
738
739
740 if (itemClass == 0xffffffff && itemSubClass == 0xffffffff && inventoryType == 0xffffffff && quality == 0xffffffff && levelmin == 0x00 && levelmax == 0x00 && usable == 0x00 && wsearchedname.empty())
741 {
744 {
745 auctionShortlist.push_back(itr->second);
746 }
747 }
748 else
749 {
751
754
756 {
757 if ((itrcounter++) % 100 == 0)
758 {
760 {
761 return false;
762 }
763 }
764
766
768 {
769 continue;
770 }
771
773 if (!item)
774 {
775 continue;
776 }
777
779 if (itemClass != 0xffffffff && proto->
Class != itemClass)
780 {
781 continue;
782 }
783
784 if (itemSubClass != 0xffffffff && proto->
SubClass != itemSubClass)
785 {
786 continue;
787 }
788
789 if (inventoryType != 0xffffffff && proto->
InventoryType != inventoryType)
790 {
791
793 {
794 continue;
795 }
796 }
797
798 if (quality != 0xffffffff && proto->
Quality < quality)
799 {
800 continue;
801 }
802
804 {
805 continue;
806 }
807
808 if (usable != 0x00)
809 {
811 {
812 continue;
813 }
814
815
817 {
818 continue;
819 }
820 }
821
822
823
824 if (!wsearchedname.empty())
825 {
826 std::string name = proto->
Name1;
827 if (name.empty())
828 {
829 continue;
830 }
831
832
833 if (loc_idx >= 0)
836
837
838
839
841
842 if (propRefID)
843 {
844
845
846
847 std::array<char const*, 16> const* suffix = nullptr;
848
849 if (propRefID < 0)
850 {
852 if (itemRandEntry)
853 suffix = &itemRandEntry->
Name;
854 }
855 else
856 {
858 if (itemRandEntry)
859 suffix = &itemRandEntry->
Name;
860 }
861
862
863 if (suffix)
864 {
865
866
867 name += ' ';
868 name += (*suffix)[locdbc_idx >= 0 ? locdbc_idx :
LOCALE_enUS];
869 }
870 }
871
872
874 {
875 continue;
876 }
877 }
878
879 auctionShortlist.push_back(Aentry);
880 }
881 }
882
883 if (auctionShortlist.empty())
884 {
885 return true;
886 }
887
888
889 if (!sortOrder.empty())
890 {
893 {
894
895 if (listfrom + 50 <= auctionShortlist.size())
896 {
897 std::partial_sort(auctionShortlist.begin(), auctionShortlist.begin() + listfrom + 50, auctionShortlist.end(),
899 }
900 else
901 {
902 std::sort(auctionShortlist.begin(), auctionShortlist.end(), std::bind(
SortAuction, std::placeholders::_1, std::placeholders::_2, sortOrder,
904 }
905 }
906 }
907
908 for (auto& auction : auctionShortlist)
909 {
910
911 if (count < 50 && totalcount >= listfrom)
912 {
914 if (!item)
915 {
916 continue;
917 }
918
919 ++count;
920 auction->BuildAuctionInfo(data);
921 }
922 ++totalcount;
923 }
924
925 return true;
926}
@ LOCALE_enUS
Definition: Common.h:75
std::int32_t int32
Definition: Define.h:104
std::uint32_t uint32
Definition: Define.h:108
Milliseconds GetTimeMS()
Definition: Timer.h:84
Milliseconds GetMSTimeDiff(Milliseconds oldMSTime, Milliseconds newMSTime)
Definition: Timer.h:91
bool Utf8FitTo(std::string_view str, std::wstring_view search)
Definition: Util.cpp:477
static bool SortAuction(AuctionEntry *left, AuctionEntry *right, AuctionSortOrderVector &sortOrder, Player *player, bool checkMinBidBuyout)
Definition: AuctionHouseMgr.cpp:38
@ AUCTION_SORT_BID
Definition: AuctionHouseMgr.h:83
@ AUCTION_SORT_MINLEVEL
Definition: AuctionHouseMgr.h:75
@ AUCTION_SORT_UNK4
Definition: AuctionHouseMgr.h:79
@ AUCTION_SORT_MAX
Definition: AuctionHouseMgr.h:87
#define sAuctionMgr
Definition: AuctionHouseMgr.h:227
DBCStorage< ItemRandomSuffixEntry > sItemRandomSuffixStore(ItemRandomSuffixfmt)
DBCStorage< ItemRandomPropertiesEntry > sItemRandomPropertiesStore(ItemRandomPropertiesfmt)
@ EQUIP_ERR_OK
Definition: Item.h:41
@ INVTYPE_ROBE
Definition: ItemTemplate.h:285
@ INVTYPE_CHEST
Definition: ItemTemplate.h:270
@ ITEM_SPELLTRIGGER_LEARN_SPELL_ID
Definition: ItemTemplate.h:89
#define sObjectMgr
Definition: ObjectMgr.h:1640
Milliseconds GetGameTimeMS()
Definition: GameTime.cpp:43
Seconds GetGameTime()
Definition: GameTime.cpp:38
Definition: AuctionHouseMgr.h:91
AuctionSortOrder sortOrder
Definition: AuctionHouseMgr.h:94
Definition: AuctionHouseMgr.h:101
time_t expire_time
Definition: AuctionHouseMgr.h:111
ObjectGuid item_guid
Definition: AuctionHouseMgr.h:104
AuctionEntryMap::iterator GetAuctionsEnd()
Definition: AuctionHouseMgr.h:145
AuctionEntryMap const & GetAuctions()
Definition: AuctionHouseMgr.h:146
AuctionEntryMap::iterator GetAuctionsBegin()
Definition: AuctionHouseMgr.h:144
int32 GetItemRandomPropertyId() const
Definition: Item.h:286
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:546
uint32 SpellTrigger
Definition: ItemTemplate.h:601
int32 SpellId
Definition: ItemTemplate.h:600
Definition: ItemTemplate.h:628
uint32 Quality
Definition: ItemTemplate.h:635
_Spell Spells[MAX_ITEM_PROTO_SPELLS]
Definition: ItemTemplate.h:671
uint32 RequiredLevel
Definition: ItemTemplate.h:645
std::string Name1
Definition: ItemTemplate.h:633
uint32 Class
Definition: ItemTemplate.h:630
uint32 InventoryType
Definition: ItemTemplate.h:641
uint32 SubClass
Definition: ItemTemplate.h:631
uint32 ItemId
Definition: ItemTemplate.h:629
Definition: ItemTemplate.h:843
WorldSession * GetSession() const
Definition: Player.h:1958
bool HasSpell(uint32 spell) const override
Definition: Player.cpp:3826
InventoryResult CanUseItem(Item *pItem, bool not_loading=true) const
Definition: PlayerStorage.cpp:2245
static std::string_view GetLocaleString(std::vector< std::string > const &data, size_t locale)
Definition: ObjectMgr.h:1416
LocaleConstant GetSessionDbLocaleIndex() const
Definition: WorldSession.h:498
LocaleConstant GetSessionDbcLocale() const
Definition: WorldSession.h:497
Definition: DBCStructure.h:1198
std::array< char const *, 16 > Name
Definition: DBCStructure.h:1203
Definition: DBCStructure.h:1208
std::array< char const *, 16 > Name
Definition: DBCStructure.h:1210