mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
[Fix] Add Bazaar BulkSendTrader Limit for RoF2 (#4590)
Add Bazaar BulkSendTrader Limit
This commit is contained in:
parent
533dc997fd
commit
15684567cf
@ -47,6 +47,7 @@ static const EQ::constants::LookupEntry constants_static_lookup_entries[EQ::vers
|
||||
ClientUnknown::constants::EXPANSION_BIT,
|
||||
ClientUnknown::constants::EXPANSIONS_MASK,
|
||||
ClientUnknown::INULL,
|
||||
ClientUnknown::INULL,
|
||||
ClientUnknown::INULL
|
||||
),
|
||||
/*[ClientVersion::Client62] =*/
|
||||
@ -55,6 +56,7 @@ static const EQ::constants::LookupEntry constants_static_lookup_entries[EQ::vers
|
||||
Client62::constants::EXPANSION_BIT,
|
||||
Client62::constants::EXPANSIONS_MASK,
|
||||
Client62::INULL,
|
||||
Client62::INULL,
|
||||
Client62::INULL
|
||||
),
|
||||
/*[ClientVersion::Titanium] =*/
|
||||
@ -63,7 +65,8 @@ static const EQ::constants::LookupEntry constants_static_lookup_entries[EQ::vers
|
||||
Titanium::constants::EXPANSION_BIT,
|
||||
Titanium::constants::EXPANSIONS_MASK,
|
||||
Titanium::constants::CHARACTER_CREATION_LIMIT,
|
||||
Titanium::constants::SAY_LINK_BODY_SIZE
|
||||
Titanium::constants::SAY_LINK_BODY_SIZE,
|
||||
Titanium::INULL
|
||||
),
|
||||
/*[ClientVersion::SoF] =*/
|
||||
EQ::constants::LookupEntry(
|
||||
@ -71,7 +74,8 @@ static const EQ::constants::LookupEntry constants_static_lookup_entries[EQ::vers
|
||||
SoF::constants::EXPANSION_BIT,
|
||||
SoF::constants::EXPANSIONS_MASK,
|
||||
SoF::constants::CHARACTER_CREATION_LIMIT,
|
||||
SoF::constants::SAY_LINK_BODY_SIZE
|
||||
SoF::constants::SAY_LINK_BODY_SIZE,
|
||||
SoF::INULL
|
||||
),
|
||||
/*[ClientVersion::SoD] =*/
|
||||
EQ::constants::LookupEntry(
|
||||
@ -79,7 +83,8 @@ static const EQ::constants::LookupEntry constants_static_lookup_entries[EQ::vers
|
||||
SoD::constants::EXPANSION_BIT,
|
||||
SoD::constants::EXPANSIONS_MASK,
|
||||
SoD::constants::CHARACTER_CREATION_LIMIT,
|
||||
SoD::constants::SAY_LINK_BODY_SIZE
|
||||
SoD::constants::SAY_LINK_BODY_SIZE,
|
||||
SoD::INULL
|
||||
),
|
||||
/*[ClientVersion::UF] =*/
|
||||
EQ::constants::LookupEntry(
|
||||
@ -87,7 +92,8 @@ static const EQ::constants::LookupEntry constants_static_lookup_entries[EQ::vers
|
||||
UF::constants::EXPANSION_BIT,
|
||||
UF::constants::EXPANSIONS_MASK,
|
||||
UF::constants::CHARACTER_CREATION_LIMIT,
|
||||
UF::constants::SAY_LINK_BODY_SIZE
|
||||
UF::constants::SAY_LINK_BODY_SIZE,
|
||||
UF::INULL
|
||||
),
|
||||
/*[ClientVersion::RoF] =*/
|
||||
EQ::constants::LookupEntry(
|
||||
@ -95,7 +101,8 @@ static const EQ::constants::LookupEntry constants_static_lookup_entries[EQ::vers
|
||||
RoF::constants::EXPANSION_BIT,
|
||||
RoF::constants::EXPANSIONS_MASK,
|
||||
RoF::constants::CHARACTER_CREATION_LIMIT,
|
||||
RoF::constants::SAY_LINK_BODY_SIZE
|
||||
RoF::constants::SAY_LINK_BODY_SIZE,
|
||||
RoF::INULL
|
||||
),
|
||||
/*[ClientVersion::RoF2] =*/
|
||||
EQ::constants::LookupEntry(
|
||||
@ -103,7 +110,8 @@ static const EQ::constants::LookupEntry constants_static_lookup_entries[EQ::vers
|
||||
RoF2::constants::EXPANSION_BIT,
|
||||
RoF2::constants::EXPANSIONS_MASK,
|
||||
RoF2::constants::CHARACTER_CREATION_LIMIT,
|
||||
RoF2::constants::SAY_LINK_BODY_SIZE
|
||||
RoF2::constants::SAY_LINK_BODY_SIZE,
|
||||
RoF2::constants::MAX_BAZAAR_TRADERS
|
||||
)
|
||||
};
|
||||
|
||||
|
||||
@ -42,6 +42,7 @@ namespace EQ
|
||||
uint32 ExpansionsMask;
|
||||
int16 CharacterCreationLimit;
|
||||
size_t SayLinkBodySize;
|
||||
uint32 BazaarTraderLimit;
|
||||
|
||||
LookupEntry(const LookupEntry *lookup_entry) { }
|
||||
LookupEntry(
|
||||
@ -49,13 +50,15 @@ namespace EQ
|
||||
uint32 ExpansionBit,
|
||||
uint32 ExpansionsMask,
|
||||
int16 CharacterCreationLimit,
|
||||
size_t SayLinkBodySize
|
||||
size_t SayLinkBodySize,
|
||||
uint32 BazaarTraderLimit
|
||||
) :
|
||||
Expansion(Expansion),
|
||||
ExpansionBit(ExpansionBit),
|
||||
ExpansionsMask(ExpansionsMask),
|
||||
CharacterCreationLimit(CharacterCreationLimit),
|
||||
SayLinkBodySize(SayLinkBodySize)
|
||||
SayLinkBodySize(SayLinkBodySize),
|
||||
BazaarTraderLimit(BazaarTraderLimit)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
@ -272,6 +272,7 @@ namespace RoF2
|
||||
|
||||
const size_t SAY_LINK_BODY_SIZE = 56;
|
||||
const uint32 MAX_GUILD_ID = 50000;
|
||||
const uint32 MAX_BAZAAR_TRADERS = 600;
|
||||
|
||||
} /*constants*/
|
||||
|
||||
|
||||
@ -286,8 +286,8 @@ namespace Titanium
|
||||
|
||||
const size_t CHARACTER_CREATION_LIMIT = 8; // Hard-coded in client - DO NOT ALTER
|
||||
|
||||
const size_t SAY_LINK_BODY_SIZE = 45;
|
||||
const uint32 MAX_GUILD_ID = 1500;
|
||||
const size_t SAY_LINK_BODY_SIZE = 45;
|
||||
const uint32 MAX_GUILD_ID = 1500;
|
||||
|
||||
} /*constants*/
|
||||
|
||||
|
||||
@ -40,15 +40,18 @@ public:
|
||||
int32 char_zone_instance_id
|
||||
);
|
||||
|
||||
static BulkTraders_Struct GetDistinctTraders(Database &db)
|
||||
static BulkTraders_Struct GetDistinctTraders(Database &db, uint32 char_zone_instance_id, uint32 max_results)
|
||||
{
|
||||
BulkTraders_Struct all_entries{};
|
||||
std::vector<DistinctTraders_Struct> distinct_traders;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
auto results = db.QueryDatabase(fmt::format(
|
||||
"SELECT DISTINCT(t.char_id), t.char_zone_id, t.char_zone_instance_id, t.char_entity_id, c.name "
|
||||
"FROM trader AS t "
|
||||
"JOIN character_data AS c ON t.char_id = c.id;"
|
||||
"JOIN character_data AS c ON t.char_id = c.id "
|
||||
"ORDER BY t.char_zone_instance_id = {} DESC LIMIT {};",
|
||||
char_zone_instance_id,
|
||||
max_results)
|
||||
);
|
||||
|
||||
distinct_traders.reserve(results.RowCount());
|
||||
|
||||
@ -3219,7 +3219,12 @@ void Client::SendBulkBazaarTraders()
|
||||
return;
|
||||
}
|
||||
|
||||
auto results = TraderRepository::GetDistinctTraders(database);
|
||||
auto results = TraderRepository::GetDistinctTraders(
|
||||
database,
|
||||
GetInstanceID(),
|
||||
EQ::constants::StaticLookup(ClientVersion())->BazaarTraderLimit
|
||||
);
|
||||
|
||||
auto p_size = 4 + 12 * results.count + results.name_length;
|
||||
auto buffer = std::make_unique<char[]>(p_size);
|
||||
memset(buffer.get(), 0, p_size);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user