eqemu-server/zone/gm_commands/evolving_items.cpp
Mitch Freeman f21cc170df
[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>
2025-01-19 18:10:19 -06:00

302 lines
6.2 KiB
C++

#include "../client.h"
#include "../command.h"
#include "../../common/evolving_items.h"
void command_evolvingitems(Client *c, const Seperator *sep)
{
const uint16 arguments = sep->argnum;
if (!arguments) {
SendEvolvingItemsSubCommands(c);
return;
}
Client* t = c;
if (c->GetTarget() && c->GetTarget()->IsClient()) {
t = c->GetTarget()->CastToClient();
}
const bool is_item = !strcasecmp(sep->arg[1], "item");
const bool is_target = !strcasecmp(sep->arg[1], "target");
if (!is_item && !is_target) {
SendEvolvingItemsSubCommands(c);
return;
}
if (is_target) {
if (arguments > 1) {
c->Message(Chat::White, "Usage: #evolve target");
} else {
c->Message(Chat::Red, "Worn Items");
for (auto const &[key, value]: t->GetInv().GetWorn()) {
if (!value->IsEvolving()) {
continue;
}
auto item = evolving_items_manager.GetEvolvingItemsCache().at(value->GetID());
c->Message(
Chat::Yellow,
fmt::format(
"Evolving Items | {:0d}",
value->GetID()
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Unique ID | {:0d}",
value->GetEvolveUniqueID()
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Final Item ID | {:0d}",
value->GetEvolveFinalItemID()
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Activated | {}",
value->GetEvolveActivated() ? "Yes" : "No"
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Equipped | {}",
value->GetEvolveEquipped() ? "Yes" : "No"
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Current Amount | {:0d}",
value->GetEvolveCurrentAmount()
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Required Amount | {:0d}",
item.required_amount
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Progression (%) | {:.2f}",
value->GetEvolveProgression()
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Type | {}",
item.type
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Subtype | {}",
item.sub_type
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Timer | {}",
value->GetTimers().at("evolve").Enabled()
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Timer Remaining | {}",
value->GetTimers().at("evolve").GetRemainingTime()
).c_str()
);
}
c->Message(Chat::Red, "Personal Items");
for (auto const &[key, value]: t->GetInv().GetPersonal()) {
if (!value->IsEvolving()) {
continue;
}
auto item = evolving_items_manager.GetEvolvingItemsCache().at(value->GetID());
c->Message(
Chat::Yellow,
fmt::format(
"Evolving Items | {:0d}",
value->GetID()
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Unique ID | {:0d}",
value->GetEvolveUniqueID()
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Final Item ID | {:0d}",
value->GetEvolveFinalItemID()
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Activated | {}",
value->GetEvolveActivated() ? "Yes" : "No"
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Equipped | {}",
value->GetEvolveEquipped() ? "Yes" : "No"
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Current Amount | {:0d}",
value->GetEvolveCurrentAmount()
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Required Amount | {:0d}",
item.required_amount
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Progression (%) | {:.2f}",
value->GetEvolveProgression()
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Type | {}",
item.type
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Subtype | {}",
item.sub_type
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Timer | {}",
value->GetTimers().at("evolve").Enabled()
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Timer Remaining | {}",
value->GetTimers().at("evolve").GetRemainingTime()
).c_str()
);
}
}
} else if (is_item) {
if (arguments > 2) {
c->Message(Chat::White, "Usage: #evolve item item_id");
} else if (sep->IsNumber(2)) {
auto item_id = Strings::ToUnsignedInt(sep->arg[2]);
auto item = c->GetInv().GetItem(c->GetInv().HasItem(item_id));
if (item) {
c->Message(
Chat::Yellow,
fmt::format(
"Evolving Items | {:0d}",
item->GetID()
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Slot | {:0d}",
c->GetInv().HasItem(item_id)
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Activated | {}",
item->GetEvolveActivated() ? "Yes" : "No"
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Equipped | {}",
item->GetEvolveEquipped() ? "Yes" : "No"
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Unique ID | {:0d}",
item->GetEvolveUniqueID()
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Progression (%) | {:.2f}",
item->GetEvolveProgression()
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Timer | {}",
item->GetTimers().at("evolve").Enabled()
).c_str()
);
c->Message(
Chat::Yellow,
fmt::format(
"Timer Remaining | {}",
item->GetTimers().at("evolve").GetRemainingTime()
).c_str()
);
} else {
c->Message(
Chat::Red,
fmt::format(
"Item {} could not be found in your inventory.",
item_id
).c_str()
);
}
} else {
SendEvolvingItemsSubCommands(c);
}
}
}
void SendEvolvingItemsSubCommands(Client *c)
{
c->Message(Chat::White, "#evolve item item_id (Shows evolve values within the iteminstance)");
c->Message(
Chat::White,
"#evolve target (Shows evolve values within the target's cache - Must have a player target selected.)"
);
}