[Login] Added OP_ExpansionPacketData for RoF2 and update payload for Titanium (#2186)

* Fix for GENERIC_9_STRINGS

* Update .gitignore

* OP_ExpansionPacketData for Titanium and RoF2

* Update for login_opcodes_sod.conf

* Add OP_LoginExpansionPacketData for Titanium and RoF2

* Few expansion fixes

* Update client.h

* Update client.h

* l

* Updates based on PR feedback.
Moved configuration to login.json
Set Titanium limits to constants

* Update login.json

Added the two configurations to login.json
display_expansions - true/false to display on the server select screen
max_expansions - the bitmask of expansions enabled (http://spire.akkadius.com/calculators#expansions-bitmask-calculator)

* Further cleanup based on feedback.

* Further cleanup and refactor max_expansions to max_expansions_mask to better reflect its purpose

* Missed rename of max_expansions corrected.
This commit is contained in:
neckkola
2022-07-14 04:22:50 -03:00
committed by GitHub
parent 1488c3685c
commit 3b409def2c
7 changed files with 102 additions and 1 deletions
+64
View File
@@ -563,6 +563,8 @@ void Client::DoSuccessfulLogin(
login_reply.web_offer_cooldown_minutes = 0;
memcpy(login_reply.key, m_key.c_str(), m_key.size());
SendExpansionPacketData(login_reply);
char encrypted_buffer[80] = {0};
auto rc = eqcrypt_block((const char*)&login_reply, sizeof(login_reply), encrypted_buffer, 1);
if (rc == nullptr) {
@@ -583,6 +585,68 @@ void Client::DoSuccessfulLogin(
m_client_status = cs_logged_in;
}
void Client::SendExpansionPacketData(PlayerLoginReply_Struct& plrs)
{
SerializeBuffer buf;
//from eqlsstr_us.txt id of each expansion, excluding 'Everquest'
int ExpansionLookup[20] = { 3007, 3008, 3009, 3010, 3012,
3014, 3031, 3033, 3036, 3040,
3045, 3046, 3047, 3514, 3516,
3518, 3520, 3522, 3524 };
if (server.options.IsDisplayExpansions()) {
int32_t expansion = server.options.GetMaxExpansions();
int32_t owned_expansion = (expansion << 1) | 1;
if (m_client_version == cv_sod) {
// header info of packet. Requires OP_LoginExpansionPacketData=0x0031 to be in login_opcodes_sod.conf
buf.WriteInt32(0x00);
buf.WriteInt32(0x01);
buf.WriteInt16(0x00);
buf.WriteInt32(19); //number of expansions to include in packet
//generate expansion data
for (int i = 0; i < 19; i++)
{
buf.WriteInt32(i); //sequenctial number
buf.WriteInt32((expansion & (1 << i)) == (1 << i) ? 0x01 : 0x00); //1 own 0 not own
buf.WriteInt8(0x00);
buf.WriteInt32(ExpansionLookup[i]); //from eqlsstr_us.txt
buf.WriteInt32(0x179E); //from eqlsstr_us.txt for buttons/order
buf.WriteInt32(0xFFFFFFFF); //end identification
buf.WriteInt8(0x0); //force order window to appear 1 appear 0 not appear
buf.WriteInt8(0x0);
buf.WriteInt32(0x0000);
buf.WriteInt32(0x0000);
buf.WriteInt32(0xFFFFFFFF);
}
auto out = std::make_unique<EQApplicationPacket>(OP_LoginExpansionPacketData, buf);
m_connection->QueuePacket(out.get());
}
else if (m_client_version == cv_titanium)
{
if (expansion >= EQ::expansions::bitPoR)
{
// Titanium shipped with 10 expansions. Set owned expansions to be max 10.
plrs.offer_min_days = ((EQ::expansions::bitDoD << 2) | 1) - 2;
}
else
{
plrs.offer_min_days = owned_expansion;
}
// Titanium shipped with 10 expansions. Set owned expansions to be max 10.
plrs.web_offer_min_views = ((EQ::expansions::bitDoD << 2) | 1) - 2;
}
}
}
/**
* @param username
* @param password