[Bug Fix] Radiant/Ebon Crystals should only extract to 1000 (#4195)

* [Bug] Radiant/Ebon Crystals should only extract to 1000

Creating a stack larger than 1000 can cause potential dupe issues further down the stream if other tasks are performed on the stack.

* Use stacksize instead

---------

Co-authored-by: Kinglykrab <kinglykrab@gmail.com>
This commit is contained in:
Fryguy 2024-03-23 13:56:59 -04:00 committed by GitHub
parent ea9b7841d4
commit d2372de982
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 1 deletions

View File

@ -130,6 +130,11 @@ enum CrystalReclaimTypes
Radiant = 4, Radiant = 4,
}; };
namespace ItemStackSizeConstraint {
constexpr int16 Minimum = 1;
constexpr int16 Maximum = 1000;
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -5596,9 +5596,20 @@ void Client::Handle_OP_CrystalCreate(const EQApplicationPacket *app)
} }
// Prevent the client from creating more than they have. // Prevent the client from creating more than they have.
const uint32 amount = EQ::ClampUpper(quantity, current_quantity); uint32 amount = EQ::ClampUpper(quantity, current_quantity);
const uint32 item_id = is_radiant ? RuleI(Zone, RadiantCrystalItemID) : RuleI(Zone, EbonCrystalItemID); const uint32 item_id = is_radiant ? RuleI(Zone, RadiantCrystalItemID) : RuleI(Zone, EbonCrystalItemID);
const auto item = database.GetItem(item_id);
// Prevent pulling more than max stack size or 1,000 (if stackable), whichever is lesser
const uint32 max_reclaim_amount = EQ::Clamp(
item && item->Stackable ? item->StackSize : ItemStackSizeConstraint::Minimum,
ItemStackSizeConstraint::Minimum,
ItemStackSizeConstraint::Maximum
);
if (amount > max_reclaim_amount) {
amount = max_reclaim_amount;
}
const bool success = SummonItem(item_id, amount); const bool success = SummonItem(item_id, amount);
if (!success) { if (!success) {
return; return;