Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Fix issue with set-update-style packets (CMonipulatorPacket1 & 2) #4621

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/map/packets/monipulator1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,17 @@ CMonipulatorPacket1::CMonipulatorPacket1(CCharEntity* PChar)
this->setType(0x63);
this->setSize(0xDC);

// NOTE: These packets have to be at least partially populated, or the
// player will lose their abilities and get a big selection of incorrect traits.

ref<uint8>(0x04) = 0x03; // Update Type
ref<uint8>(0x06) = 0xD8; // Variable Data Size

if (PChar->m_PMonstrosity == nullptr)
{
return;
}

ref<uint8>(0x04) = 0x03; // Update Type
ref<uint8>(0x06) = 0xD8; // Variable Data Size

ref<uint16>(0x08) = PChar->m_PMonstrosity->Species;
ref<uint16>(0x0A) = PChar->m_PMonstrosity->Flags;

Expand Down
16 changes: 11 additions & 5 deletions src/map/packets/monipulator2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,23 @@ CMonipulatorPacket2::CMonipulatorPacket2(CCharEntity* PChar)
this->setType(0x63);
this->setSize(0xB4);

if (PChar->m_PMonstrosity == nullptr)
{
return;
}
// NOTE: These packets have to be at least partially populated, or the
// player will lose their abilities and get a big selection of incorrect traits.

std::memset(data + 4, 0, PACKET_SIZE - 4);

// TODO: What are these?
// NOTE: These are the equivalent entries from Monipulator1 packet
// ref<uint8>(0x04) = 0x03; // Update Type
// ref<uint8>(0x06) = 0xD8; // Variable Data Size

std::array<uint8, 3> packet2 = { 0x04, 0x00, 0xB0 };
std::memcpy(data + 0x04, &packet2, sizeof(packet2));

if (PChar->m_PMonstrosity == nullptr)
{
return;
}

// NOTE: SE added these after-the-fact, so they're not sent in Monipulator1 and they're at the end of the array!
// Slime Level
ref<uint8>(0x86) = PChar->m_PMonstrosity->levels[126];
Expand Down