Skip to content

Commit

Permalink
[Bug Fix] Allow Items in ROF2 to Stack to 32,767 (EQEmu#4556)
Browse files Browse the repository at this point in the history
* [Bug Fix] Allow Items in ROF2 to Stack to 32,767

* Update rof2.cpp
  • Loading branch information
Kinglykrab authored and MortimerGreenwald committed Dec 13, 2024
1 parent 612b03a commit c9422ae
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions common/patches/rof2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6365,9 +6365,18 @@ namespace RoF2
//sprintf(hdr.unknown000, "06e0002Y1W00");
strn0cpy(hdr.unknown000, fmt::format("{:016}\0", inst->GetSerialNumber()).c_str(),sizeof(hdr.unknown000));

hdr.stacksize =
item->ID == PARCEL_MONEY_ITEM_ID ? inst->GetPrice() : (inst->IsStackable() ? ((inst->GetCharges() > 1000)
? 0xFFFFFFFF : inst->GetCharges()) : 1);
hdr.stacksize = 1;

if (item->ID == PARCEL_MONEY_ITEM_ID) {
hdr.stacksize = inst->GetPrice();
} else if (inst->IsStackable()) {
if (inst->GetCharges() > std::numeric_limits<int16>::max()) {
hdr.stacksize = std::numeric_limits<uint32>::max();
} else {
hdr.stacksize = inst->GetCharges();
}
}

hdr.unknown004 = 0;

structs::InventorySlot_Struct slot_id{};
Expand Down

0 comments on commit c9422ae

Please sign in to comment.