Skip to content
This repository has been archived by the owner on Dec 4, 2020. It is now read-only.

Commit

Permalink
Fix assimilaton merit
Browse files Browse the repository at this point in the history
Possible fix for assimilation.
Credits to Devi for decompiling the game and to Caelic for the actual code.
  • Loading branch information
Xaver-DaRed committed Jul 15, 2020
1 parent 809baec commit aed67b5
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions src/map/packets/menu_merit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,18 @@ CMenuMeritPacket::CMenuMeritPacket(CCharEntity* PChar)
ref<uint8>(0x06) = 0x0C;

ref<uint16>(0x08) = PChar->PMeritPoints->GetLimitPoints();
ref<uint8>(0x0A) = PChar->PMeritPoints->GetMeritPoints();

uint8 flag = 0x00;
uint16 bits = 0;
bits += PChar->PMeritPoints->GetMeritPoints() & 0b0000000001111111; // first seven bits are merit points
if (PChar->GetMJob() == JOB_BLU && PChar->GetMLevel() > 74)
bits += (PChar->PMeritPoints->GetMeritValue(MERIT_ASSIMILATION, PChar) << 7) & 0b0001111110000000; // next six bits are assimilation points. the last three bits are the three flags below:
bits += (PChar->jobs.job[PChar->GetMJob()] >= 75 && charutils::hasKeyItem(PChar, 606)) << 13; // is 75 and has limit breaker KI
bits += ((PChar->jobs.job[PChar->GetMJob()] >= PChar->jobs.genkai &&
PChar->jobs.exp[PChar->GetMJob()] == charutils::GetExpNEXTLevel(PChar->jobs.job[PChar->GetMJob()]) - 1) || PChar->MeritMode) << 14; // my exp is capped
bits += (bits & (1 << 13) && PChar->MeritMode) << 15; // flag 13 is set and merit mode is on

if (PChar->jobs.job[PChar->GetMJob()] >= 75 && charutils::hasKeyItem(PChar, 606)) // keyitem Limit Breaker
{
flag |= 0x20;
if (PChar->MeritMode)
{
flag |= 0x80;
}
}

//capped EXP
if ((PChar->jobs.job[PChar->GetMJob()] >= PChar->jobs.genkai && PChar->jobs.exp[PChar->GetMJob()] == charutils::GetExpNEXTLevel(PChar->jobs.job[PChar->GetMJob()]) - 1)
|| PChar->MeritMode)
{
flag |= 0x40;
}
ref<uint16>(0x0A) = bits;

ref<uint8>(0x0B) = flag;
ref<uint8>(0x0C) = map_config.max_merit_points + PChar->PMeritPoints->GetMeritValue(MERIT_MAX_MERIT, PChar);

PChar->pushPacket(new CBasicPacket(*this));
Expand Down

0 comments on commit aed67b5

Please sign in to comment.