mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-01 11:36:36 +00:00
[Feature] Add Rule for dealing with augments when an item evolves (#4758)
This commit is contained in:
+2
-1
@@ -404,6 +404,7 @@ public:
|
||||
void LoadParcels();
|
||||
std::map<uint32, CharacterParcelsRepository::CharacterParcels> GetParcels() { return m_parcels; }
|
||||
int32 FindNextFreeParcelSlot(uint32 char_id);
|
||||
int32 FindNextFreeParcelSlotUsingMemory();
|
||||
void SendParcelIconStatus();
|
||||
|
||||
void SendBecomeTraderToWorld(Client *trader, BazaarTraderBarterActions action);
|
||||
@@ -1900,7 +1901,7 @@ public:
|
||||
void SendEvolvingPacket(int8 action, const CharacterEvolvingItemsRepository::CharacterEvolvingItems &item);
|
||||
void DoEvolveItemToggle(const EQApplicationPacket* app);
|
||||
void DoEvolveItemDisplayFinalResult(const EQApplicationPacket* app);
|
||||
bool DoEvolveCheckProgression(const EQ::ItemInstance &inst);
|
||||
bool DoEvolveCheckProgression(EQ::ItemInstance &inst);
|
||||
void SendEvolveXPWindowDetails(const EQApplicationPacket* app);
|
||||
void DoEvolveTransferXP(const EQApplicationPacket* app);
|
||||
void SendEvolveXPTransferWindow();
|
||||
|
||||
@@ -71,7 +71,7 @@ void Client::SendEvolvingPacket(const int8 action, const CharacterEvolvingItemsR
|
||||
|
||||
void Client::ProcessEvolvingItem(const uint64 exp, const Mob *mob)
|
||||
{
|
||||
std::vector<const EQ::ItemInstance *> queue{};
|
||||
std::vector<EQ::ItemInstance *> queue{};
|
||||
|
||||
for (auto &[key, inst]: GetInv().GetWorn()) {
|
||||
LogEvolveItemDetail(
|
||||
@@ -298,7 +298,7 @@ void Client::DoEvolveItemDisplayFinalResult(const EQApplicationPacket *app)
|
||||
}
|
||||
}
|
||||
|
||||
bool Client::DoEvolveCheckProgression(const EQ::ItemInstance &inst)
|
||||
bool Client::DoEvolveCheckProgression(EQ::ItemInstance &inst)
|
||||
{
|
||||
if (inst.GetEvolveProgression() < 100 || inst.GetEvolveLvl() == inst.GetMaxEvolveLvl()) {
|
||||
return false;
|
||||
@@ -315,6 +315,48 @@ bool Client::DoEvolveCheckProgression(const EQ::ItemInstance &inst)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (RuleB(EvolvingItems, EnableParcelMerchants) &&
|
||||
!RuleB(EvolvingItems, DestroyAugmentsOnEvolve) &&
|
||||
inst.IsAugmented()
|
||||
) {
|
||||
auto const augs = inst.GetAugmentIDs();
|
||||
std::vector<CharacterParcelsRepository::CharacterParcels> parcels;
|
||||
for (auto const &item_id: augs) {
|
||||
if (!item_id) {
|
||||
continue;
|
||||
}
|
||||
|
||||
CharacterParcelsRepository::CharacterParcels p{};
|
||||
p.char_id = CharacterID();
|
||||
p.from_name = "Evolving Item Sub-System";
|
||||
p.note = fmt::format(
|
||||
"System automatically removed from {} which recently evolved.",
|
||||
inst.GetItem()->Name
|
||||
);
|
||||
p.slot_id = FindNextFreeParcelSlotUsingMemory();
|
||||
p.sent_date = time(nullptr);
|
||||
p.item_id = item_id;
|
||||
p.quantity = 1;
|
||||
|
||||
if (player_event_logs.IsEventEnabled(PlayerEvent::PARCEL_SEND)) {
|
||||
PlayerEvent::ParcelSend e{};
|
||||
e.from_player_name = p.from_name;
|
||||
e.to_player_name = GetCleanName();
|
||||
e.item_id = p.item_id;
|
||||
e.quantity = 1;
|
||||
e.sent_date = p.sent_date;
|
||||
|
||||
RecordPlayerEventLog(PlayerEvent::PARCEL_SEND, e);
|
||||
}
|
||||
|
||||
parcels.push_back(p);
|
||||
}
|
||||
|
||||
CharacterParcelsRepository::InsertMany(database, parcels);
|
||||
SendParcelStatus();
|
||||
SendParcelIconStatus();
|
||||
}
|
||||
|
||||
CheckItemDiscoverability(new_inst->GetID());
|
||||
|
||||
PlayerEvent::EvolveItem e{};
|
||||
|
||||
+17
-1
@@ -888,6 +888,22 @@ void Client::AddParcel(CharacterParcelsRepository::CharacterParcels &parcel)
|
||||
"Unable to send parcel at this time. Please try again later."
|
||||
);
|
||||
SendParcelAck();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int32 Client::FindNextFreeParcelSlotUsingMemory()
|
||||
{
|
||||
auto const results = GetParcels();
|
||||
|
||||
if (results.empty()) {
|
||||
return PARCEL_BEGIN_SLOT;
|
||||
}
|
||||
|
||||
for (uint32 i = PARCEL_BEGIN_SLOT; i <= RuleI(Parcel, ParcelMaxItems); i++) {
|
||||
if (!results.contains(i)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return INVALID_INDEX;
|
||||
}
|
||||
Reference in New Issue
Block a user