mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
[Feature] Evolving Item Support for RoF2 (#4496)
* basic evolving items framework created * Implement evolving tab in the inventory window * Implement experience and number of kills * Move zone evolving map to a evolvingitemsmanager class * rework gm commands * rework GetInventory * wip * wip loot testing * Fix Duplicate Message * reworked evolving item looting, swapping, etc * reworked const functions for evolving methods * Functioning Player Trade of evolving items test item_id is 89550 * First pass of Final Result link working * First pass of item upgrading when reaching 100% * Add strings and logic for displaying the evolving item xp transfer window in Corathus * Prototype of xp transfer window sending items * WIP for evolve xp transfer * WIP for evolve xp transfer. First tests passed * XP Transfer Cleanup * XP Transfer Cleanup * Add Rule for evolving items equip timer/ default is 30 secs * Add logging and player events Add logging and player events * Formatting * Database updates * Updates for linux build * Perl/Cleanup * Command cleanup * Lua * Added a crash condition check if final item id is blank or not found. * Review Changes Updates to resolve review comments and a rebase. * migrate to content_db for items_evolving_details migrate to content_db for items_evolving_details * Simplify, don't hit database unless evolving * Update 2025_01_19_items_evolving_details.sql * Update client.cpp * Update manifest with items_evolving_details * character_id vs char_id * Remove _Struct from structs * Remove license header in evolving.cpp * Move evolving constants from eq_constants.h to evolving.h since it is more specific * Update database_schema.h * General cleanup * Be more specific with `evolving_items` vs `evolving` --------- Co-authored-by: Kinglykrab <kinglykrab@gmail.com> Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
+68
-12
@@ -37,11 +37,13 @@
|
||||
#include "strings.h"
|
||||
#include "eqemu_config.h"
|
||||
#include "data_verification.h"
|
||||
#include "evolving_items.h"
|
||||
#include "repositories/criteria/content_filter_criteria.h"
|
||||
#include "repositories/account_repository.h"
|
||||
#include "repositories/faction_association_repository.h"
|
||||
#include "repositories/starting_items_repository.h"
|
||||
#include "path_manager.h"
|
||||
#include "../zone/client.h"
|
||||
#include "repositories/loottable_repository.h"
|
||||
#include "repositories/character_item_recast_repository.h"
|
||||
#include "repositories/character_corpses_repository.h"
|
||||
@@ -645,15 +647,23 @@ bool SharedDatabase::GetSharedBank(uint32 id, EQ::InventoryProfile *inv, bool is
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Overloaded: Retrieve character inventory based on character id (zone entry)
|
||||
bool SharedDatabase::GetInventory(uint32 char_id, EQ::InventoryProfile *inv)
|
||||
//bool SharedDatabase::GetInventory(uint32 char_id, EQ::InventoryProfile *inv)
|
||||
bool SharedDatabase::GetInventory(Client *c)
|
||||
{
|
||||
if (!char_id || !inv)
|
||||
if (!c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 char_id = c->CharacterID();
|
||||
EQ::InventoryProfile &inv = c->GetInv();
|
||||
|
||||
// Retrieve character inventory
|
||||
auto results = InventoryRepository::GetWhere(*this, fmt::format("`charid` = '{}' ORDER BY `slotid`;", char_id));
|
||||
auto results = InventoryRepository::GetWhere(*this, fmt::format("`charid` = '{}' ORDER BY `slotid`", char_id));
|
||||
auto e_results = CharacterEvolvingItemsRepository::GetWhere(
|
||||
*this, fmt::format("`char_id` = '{}' AND `deleted_at` IS NULL", char_id)
|
||||
);
|
||||
|
||||
if (results.empty()) {
|
||||
LogError("Error loading inventory for char_id {} from the database.", char_id);
|
||||
return false;
|
||||
@@ -667,8 +677,8 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQ::InventoryProfile *inv)
|
||||
|
||||
const auto timestamps = GetItemRecastTimestamps(char_id);
|
||||
auto cv_conflict = false;
|
||||
const auto pmask = inv->GetLookup()->PossessionsBitmask;
|
||||
const auto bank_size = inv->GetLookup()->InventoryTypeSize.Bank;
|
||||
const auto pmask = inv.GetLookup()->PossessionsBitmask;
|
||||
const auto bank_size = inv.GetLookup()->InventoryTypeSize.Bank;
|
||||
|
||||
std::vector<InventoryRepository::Inventory> queue{};
|
||||
for (auto &row: results) {
|
||||
@@ -785,9 +795,55 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQ::InventoryProfile *inv)
|
||||
}
|
||||
}
|
||||
|
||||
if (item->EvolvingItem) {
|
||||
if (slot_id >= EQ::invslot::EQUIPMENT_BEGIN && slot_id <= EQ::invslot::EQUIPMENT_END) {
|
||||
inst->SetEvolveEquipped(true);
|
||||
}
|
||||
|
||||
auto t = std::ranges::find_if(
|
||||
e_results.cbegin(),
|
||||
e_results.cend(),
|
||||
[&](const CharacterEvolvingItemsRepository::CharacterEvolvingItems &x) {
|
||||
return x.item_id == item_id;
|
||||
}
|
||||
);
|
||||
|
||||
if (t == std::end(e_results)) {
|
||||
auto e = CharacterEvolvingItemsRepository::NewEntity();
|
||||
|
||||
e.character_id = char_id;
|
||||
e.item_id = item_id;
|
||||
e.equipped = inst->GetEvolveEquipped();
|
||||
e.final_item_id = evolving_items_manager.GetFinalItemID(*inst);
|
||||
|
||||
auto r = CharacterEvolvingItemsRepository::InsertOne(*this, e);
|
||||
e.id = r.id;
|
||||
e_results.push_back(e);
|
||||
|
||||
inst->SetEvolveUniqueID(e.id);
|
||||
inst->SetEvolveCharID(e.character_id);
|
||||
inst->SetEvolveItemID(e.item_id);
|
||||
inst->SetEvolveActivated(e.activated);
|
||||
inst->SetEvolveEquipped(e.equipped);
|
||||
inst->SetEvolveCurrentAmount(e.current_amount);
|
||||
inst->CalculateEvolveProgression();
|
||||
inst->SetEvolveFinalItemID(e.final_item_id);
|
||||
}
|
||||
else {
|
||||
inst->SetEvolveUniqueID(t->id);
|
||||
inst->SetEvolveCharID(t->character_id);
|
||||
inst->SetEvolveItemID(t->item_id);
|
||||
inst->SetEvolveActivated(t->activated);
|
||||
inst->SetEvolveEquipped(t->equipped);
|
||||
inst->SetEvolveCurrentAmount(t->current_amount);
|
||||
inst->CalculateEvolveProgression();
|
||||
inst->SetEvolveFinalItemID(t->final_item_id);
|
||||
}
|
||||
}
|
||||
|
||||
int16 put_slot_id;
|
||||
if (slot_id >= 8000 && slot_id <= 8999) {
|
||||
put_slot_id = inv->PushCursor(*inst);
|
||||
put_slot_id = inv.PushCursor(*inst);
|
||||
}
|
||||
else if (slot_id >= 3111 && slot_id <= 3179) {
|
||||
// Admins: please report any occurrences of this error
|
||||
@@ -797,10 +853,10 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQ::InventoryProfile *inv)
|
||||
item_id,
|
||||
slot_id
|
||||
);
|
||||
put_slot_id = inv->PushCursor(*inst);
|
||||
put_slot_id = inv.PushCursor(*inst);
|
||||
}
|
||||
else {
|
||||
put_slot_id = inv->PutItem(slot_id, *inst);
|
||||
put_slot_id = inv.PutItem(slot_id, *inst);
|
||||
}
|
||||
|
||||
row.guid = inst->GetSerialNumber();
|
||||
@@ -825,8 +881,8 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQ::InventoryProfile *inv)
|
||||
"ClientVersion/Expansion conflict during inventory load at zone entry for [{}] (charid: [{}], inver: [{}], gmi: [{}])",
|
||||
char_name,
|
||||
char_id,
|
||||
EQ::versions::MobVersionName(inv->InventoryVersion()),
|
||||
(inv->GMInventory() ? "true" : "false")
|
||||
EQ::versions::MobVersionName(inv.InventoryVersion()),
|
||||
(inv.GMInventory() ? "true" : "false")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -837,7 +893,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQ::InventoryProfile *inv)
|
||||
EQ::ItemInstance::ClearGUIDMap();
|
||||
|
||||
// Retrieve shared inventory
|
||||
return GetSharedBank(char_id, inv, true);
|
||||
return GetSharedBank(char_id, &inv, true);
|
||||
}
|
||||
|
||||
// Overloaded: Retrieve character inventory based on account_id and character name (char select)
|
||||
|
||||
Reference in New Issue
Block a user