737{
739
740
742
743 std::vector<AuctionEntry*> auctionShortlist;
744
745
746 if (itemClass == 0xffffffff && itemSubClass == 0xffffffff && inventoryType == 0xffffffff && quality == 0xffffffff && levelmin == 0x00 && levelmax == 0x00 && usable == 0x00 && wsearchedname.empty())
747 {
750 {
751 auctionShortlist.push_back(itr->second);
752 }
753 }
754 else
755 {
757
760
762 {
763 if ((itrcounter++) % 100 == 0)
764 {
766 {
767 return false;
768 }
769 }
770
772 if (!Aentry)
773 return false;
774
775
777 {
778 continue;
779 }
780
782 if (!item)
783 {
784 continue;
785 }
786
788 if (itemClass != 0xffffffff && proto->
Class != itemClass)
789 {
790 continue;
791 }
792
793 if (itemSubClass != 0xffffffff && proto->
SubClass != itemSubClass)
794 {
795 continue;
796 }
797
798 if (inventoryType != 0xffffffff && proto->
InventoryType != inventoryType)
799 {
800
802 {
803 continue;
804 }
805 }
806
807 if (quality != 0xffffffff && proto->
Quality < quality)
808 {
809 continue;
810 }
811
813 {
814 continue;
815 }
816
817 if (usable != 0x00)
818 {
820 {
821 continue;
822 }
823
824
826 {
827 continue;
828 }
829 }
830
831
832
833 if (!wsearchedname.empty())
834 {
835 std::string name = proto->
Name1;
836 if (name.empty())
837 {
838 continue;
839 }
840
841
842 if (loc_idx >= 0)
845
846
847
848
850
851 if (propRefID)
852 {
853
854
855
856 std::array<char const*, 16> const* suffix = nullptr;
857
858 if (propRefID < 0)
859 {
861 if (itemRandEntry)
862 suffix = &itemRandEntry->
Name;
863 }
864 else
865 {
867 if (itemRandEntry)
868 suffix = &itemRandEntry->
Name;
869 }
870
871
872 if (suffix)
873 {
874
875
876 name += ' ';
877 name += (*suffix)[locdbc_idx >= 0 ? locdbc_idx :
LOCALE_enUS];
878 }
879 }
880
881
883 {
884 continue;
885 }
886 }
887
888 auctionShortlist.push_back(Aentry);
889 }
890 }
891
892 if (auctionShortlist.empty())
893 {
894 return true;
895 }
896
897
898 if (!sortOrder.empty())
899 {
902 {
903
904 if (listfrom + 50 <= auctionShortlist.size())
905 {
906 std::partial_sort(auctionShortlist.begin(), auctionShortlist.begin() + listfrom + 50, auctionShortlist.end(),
908 }
909 else
910 {
911 std::sort(auctionShortlist.begin(), auctionShortlist.end(), std::bind(
SortAuction, std::placeholders::_1, std::placeholders::_2, sortOrder,
913 }
914 }
915 }
916
917 for (auto& auction : auctionShortlist)
918 {
919
920 if (count < 50 && totalcount >= listfrom)
921 {
923 if (!item)
924 {
925 continue;
926 }
927
928 ++count;
929 auction->BuildAuctionInfo(data);
930 }
931 ++totalcount;
932 }
933
934 return true;
935}
@ LOCALE_enUS
Definition: Common.h:66
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:481
std::int32_t int32
Definition: Define.h:103
std::uint32_t uint32
Definition: Define.h:107
#define sObjectMgr
Definition: ObjectMgr.h:1623
@ 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
static bool SortAuction(AuctionEntry *left, AuctionEntry *right, AuctionSortOrderVector &sortOrder, Player *player, bool checkMinBidBuyout)
Definition: AuctionHouseMgr.cpp:36
DBCStorage< ItemRandomSuffixEntry > sItemRandomSuffixStore(ItemRandomSuffixfmt)
DBCStorage< ItemRandomPropertiesEntry > sItemRandomPropertiesStore(ItemRandomPropertiesfmt)
@ INVTYPE_ROBE
Definition: ItemTemplate.h:276
@ INVTYPE_CHEST
Definition: ItemTemplate.h:261
@ ITEM_SPELLTRIGGER_LEARN_SPELL_ID
Definition: ItemTemplate.h:88
@ EQUIP_ERR_OK
Definition: Item.h:47
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:295
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:545
uint32 SpellTrigger
Definition: ItemTemplate.h:592
int32 SpellId
Definition: ItemTemplate.h:591
Definition: ItemTemplate.h:619
uint32 Quality
Definition: ItemTemplate.h:626
_Spell Spells[MAX_ITEM_PROTO_SPELLS]
Definition: ItemTemplate.h:662
uint32 RequiredLevel
Definition: ItemTemplate.h:636
std::string Name1
Definition: ItemTemplate.h:624
uint32 Class
Definition: ItemTemplate.h:621
uint32 InventoryType
Definition: ItemTemplate.h:632
uint32 SubClass
Definition: ItemTemplate.h:622
uint32 ItemId
Definition: ItemTemplate.h:620
Definition: ItemTemplate.h:838
WorldSession * GetSession() const
Definition: Player.h:1978
bool HasSpell(uint32 spell) const override
Definition: Player.cpp:3859
InventoryResult CanUseItem(Item *pItem, bool not_loading=true) const
Definition: PlayerStorage.cpp:2225
static std::string_view GetLocaleString(std::vector< std::string > const &data, std::size_t locale)
Definition: ObjectMgr.h:1405
LocaleConstant GetSessionDbLocaleIndex() const
Definition: WorldSession.h:498
LocaleConstant GetSessionDbcLocale() const
Definition: WorldSession.h:497
Definition: DBCStructure.h:1207
std::array< char const *, 16 > Name
Definition: DBCStructure.h:1212
Definition: DBCStructure.h:1217
std::array< char const *, 16 > Name
Definition: DBCStructure.h:1219