729{
731
732
734
735 std::vector<AuctionEntry*> auctionShortlist;
736
737
738 if (itemClass == 0xffffffff && itemSubClass == 0xffffffff && inventoryType == 0xffffffff && quality == 0xffffffff && levelmin == 0x00 && levelmax == 0x00 && usable == 0x00 && wsearchedname.empty())
739 {
742 {
743 auctionShortlist.push_back(itr->second);
744 }
745 }
746 else
747 {
749
752
754 {
755 if ((itrcounter++) % 100 == 0)
756 {
758 {
759 return false;
760 }
761 }
762
764 if (!Aentry)
765 return false;
766
767
769 {
770 continue;
771 }
772
774 if (!item)
775 {
776 continue;
777 }
778
780 if (itemClass != 0xffffffff && proto->
Class != itemClass)
781 {
782 continue;
783 }
784
785 if (itemSubClass != 0xffffffff && proto->
SubClass != itemSubClass)
786 {
787 continue;
788 }
789
790 if (inventoryType != 0xffffffff && proto->
InventoryType != inventoryType)
791 {
792
794 {
795 continue;
796 }
797 }
798
799 if (quality != 0xffffffff && proto->
Quality < quality)
800 {
801 continue;
802 }
803
805 {
806 continue;
807 }
808
809 if (usable != 0x00)
810 {
812 {
813 continue;
814 }
815
816
818 {
819 continue;
820 }
821 }
822
823
824
825 if (!wsearchedname.empty())
826 {
827 std::string name = proto->
Name1;
828 if (name.empty())
829 {
830 continue;
831 }
832
833
834 if (loc_idx >= 0)
837
838
839
840
842
843 if (propRefID)
844 {
845
846
847
848 std::array<char const*, 16> const* suffix = nullptr;
849
850 if (propRefID < 0)
851 {
853 if (itemRandEntry)
854 suffix = &itemRandEntry->
Name;
855 }
856 else
857 {
859 if (itemRandEntry)
860 suffix = &itemRandEntry->
Name;
861 }
862
863
864 if (suffix)
865 {
866
867
868 name += ' ';
869 name += (*suffix)[locdbc_idx >= 0 ? locdbc_idx :
LOCALE_enUS];
870 }
871 }
872
873
875 {
876 continue;
877 }
878 }
879
880 auctionShortlist.push_back(Aentry);
881 }
882 }
883
884 if (auctionShortlist.empty())
885 {
886 return true;
887 }
888
889
890 if (!sortOrder.empty())
891 {
894 {
895
896 if (listfrom + 50 <= auctionShortlist.size())
897 {
898 std::partial_sort(auctionShortlist.begin(), auctionShortlist.begin() + listfrom + 50, auctionShortlist.end(),
900 }
901 else
902 {
903 std::sort(auctionShortlist.begin(), auctionShortlist.end(), std::bind(
SortAuction, std::placeholders::_1, std::placeholders::_2, sortOrder,
905 }
906 }
907 }
908
909 for (auto& auction : auctionShortlist)
910 {
911
912 if (count < 50 && totalcount >= listfrom)
913 {
915 if (!item)
916 {
917 continue;
918 }
919
920 ++count;
921 auction->BuildAuctionInfo(data);
922 }
923 ++totalcount;
924 }
925
926 return true;
927}
@ LOCALE_enUS
Definition: Common.h:68
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:476
static bool SortAuction(AuctionEntry *left, AuctionEntry *right, AuctionSortOrderVector &sortOrder, Player *player, bool checkMinBidBuyout)
Definition: AuctionHouseMgr.cpp:36
@ 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:545
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:1961
bool HasSpell(uint32 spell) const override
Definition: Player.cpp:3831
InventoryResult CanUseItem(Item *pItem, bool not_loading=true) const
Definition: PlayerStorage.cpp:2239
static std::string_view GetLocaleString(std::vector< std::string > const &data, size_t locale)
Definition: ObjectMgr.h:1416
LocaleConstant GetSessionDbLocaleIndex() const
Definition: WorldSession.h:500
LocaleConstant GetSessionDbcLocale() const
Definition: WorldSession.h:499
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