mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
[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:
parent
ea9b7841d4
commit
d2372de982
@ -130,6 +130,11 @@ enum CrystalReclaimTypes
|
|||||||
Radiant = 4,
|
Radiant = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace ItemStackSizeConstraint {
|
||||||
|
constexpr int16 Minimum = 1;
|
||||||
|
constexpr int16 Maximum = 1000;
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user