[Feature] Add RoF2 Bazaar Support (#4315)

* Add RoF2 Bazaar Support

Enable RoF2 bazaar features

* Add augments to Trader Items

* Cleanup

Cleanup of formatting and unused functions

* Update PlayerProfile for correct char_id in trader transactions.  Further cleanup.

* Add parcel delivery price functionality

Add parcel delivery price functionality via rules and new delivery cost struct.

* Add RoF support for bazaar window outside of bazaar with parcel delivery

* Further Testing and ActiveTransaction added

Further testing and a few fixes and messages added.  Add active transaction check to ensure two clients cannot purchase from the bazaar window at the same time

* Cleanup and Formatting updates

Cleanup and Formatting updates

* Update database manifest for the trader table against default peq trader table

* Logs and formatting

* Update bazaarsearch to be content_db aware

* Fix crash

* Simplify search

* Search fixes

* Push up more search logging

* More search fixes

* Formatting

* Update trader_repository.h

* Add Rule for Bazaar Parcel Delivery

Add a rule Bazaar:EnableParcelDelivery to enable/disable bazaar parcel delivery.  Default is True.

* Fix crash

* Update Bazaar Search

Adds/Tested bazaar search with move to content_db
- race, class, money, number of returned items, stats, name, slot, level, traders, local traders, specific trader.
Outstanding
- type, more stats to add (heroic, etc)

* Formatting

* Push

* Update bazaarsearch to include all stats that are available in RoF2

* Update BazaarSearch

Updates the bazaar search for item types.  They should be working as per RoF2+ types.

* Formatting

* Final updates to BazaarSearch

Add search by augmentation slots available on the item.
This enables all but Prestige, which I believe are not implemented yet.

* Add Titanium functionality correct ItemType Search

Add Titanium /trader /bazaar functionality.
Added itemtype=armor bazaar search.  It was missed in the search work

* Close off for loops

---------

Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
Mitch Freeman
2024-05-26 17:38:25 -03:00
committed by GitHub
parent d767217461
commit fc79614fac
51 changed files with 4793 additions and 2258 deletions
+23 -23
View File
@@ -41,7 +41,7 @@ void command_parcels(Client *c, const Seperator *sep)
return;
}
auto results = CharacterParcelsRepository::GetWhere(
auto results = CharacterParcelsRepository::GetWhere(
database,
fmt::format("char_id = '{}' ORDER BY slot_id ASC", player_id.at(0).char_id)
);
@@ -120,8 +120,8 @@ void command_parcels(Client *c, const Seperator *sep)
auto note = std::string(sep->argplus[5]);
auto send_to_client = CharacterParcelsRepository::GetParcelCountAndCharacterName(
database,
to_name
database,
to_name
);
if (send_to_client.at(0).character_name.empty()) {
c->MessageString(Chat::Yellow, CANT_FIND_PLAYER, to_name.c_str());
@@ -164,14 +164,14 @@ void command_parcels(Client *c, const Seperator *sep)
}
CharacterParcelsRepository::CharacterParcels parcel_out;
parcel_out.from_name = c->GetName();
parcel_out.note = note;
parcel_out.sent_date = time(nullptr);
parcel_out.quantity = quantity == 0 ? 1 : quantity;
parcel_out.item_id = PARCEL_MONEY_ITEM_ID;
parcel_out.char_id = send_to_client.at(0).char_id;
parcel_out.slot_id = next_slot;
parcel_out.id = 0;
parcel_out.from_name = c->GetName();
parcel_out.note = note;
parcel_out.sent_date = time(nullptr);
parcel_out.quantity = quantity == 0 ? 1 : quantity;
parcel_out.item_id = PARCEL_MONEY_ITEM_ID;
parcel_out.char_id = send_to_client.at(0).char_id;
parcel_out.slot_id = next_slot;
parcel_out.id = 0;
auto result = CharacterParcelsRepository::InsertOne(database, parcel_out);
if (!result.id) {
@@ -205,7 +205,7 @@ void command_parcels(Client *c, const Seperator *sep)
e.quantity = parcel_out.quantity;
e.sent_date = parcel_out.sent_date;
RecordPlayerEventLogWithClient(c, PlayerEvent::PARCEL_SEND, e);
RecordPlayerEventLogWithClient (c, PlayerEvent::PARCEL_SEND, e);
}
Parcel_Struct ps{};
@@ -242,14 +242,14 @@ void command_parcels(Client *c, const Seperator *sep)
}
CharacterParcelsRepository::CharacterParcels parcel_out;
parcel_out.from_name = c->GetName();
parcel_out.note = note.empty() ? "" : note;
parcel_out.sent_date = time(nullptr);
parcel_out.quantity = quantity;
parcel_out.item_id = item_id;
parcel_out.char_id = send_to_client.at(0).char_id;
parcel_out.slot_id = next_slot;
parcel_out.id = 0;
parcel_out.from_name = c->GetName();
parcel_out.note = note.empty() ? "" : note;
parcel_out.sent_date = time(nullptr);
parcel_out.quantity = quantity;
parcel_out.item_id = item_id;
parcel_out.char_id = send_to_client.at(0).char_id;
parcel_out.slot_id = next_slot;
parcel_out.id = 0;
auto result = CharacterParcelsRepository::InsertOne(database, parcel_out);
if (!result.id) {
@@ -283,7 +283,7 @@ void command_parcels(Client *c, const Seperator *sep)
e.quantity = parcel_out.quantity;
e.sent_date = parcel_out.sent_date;
RecordPlayerEventLogWithClient(c, PlayerEvent::PARCEL_SEND, e);
RecordPlayerEventLogWithClient (c, PlayerEvent::PARCEL_SEND, e);
}
Parcel_Struct ps{};
@@ -300,8 +300,8 @@ void SendParcelsSubCommands(Client *c)
c->Message(Chat::White, "#parcels listdb [Character Name]");
c->Message(Chat::White, "#parcels listmemory [Character Name] (Must be in the same zone)");
c->Message(
Chat::White,
"#parcels add [Character Name] [item id] [quantity] [note]. To send money use item id of 99990. Quantity is valid for stackable items, charges on an item, or amount of copper."
Chat::White,
"#parcels add [Character Name] [item id] [quantity] [note]. To send money use item id of 99990. Quantity is valid for stackable items, charges on an item, or amount of copper."
);
c->Message(Chat::White, "#parcels details [Character Name]");
}