Updates based on comments.

This commit is contained in:
Mitch Freeman 2025-08-11 16:03:32 -07:00
parent efda9975de
commit 4ded4d6b58
7 changed files with 54 additions and 103 deletions

View File

@ -264,7 +264,6 @@ Bazaar::GetSearchResults(
std::vector<BazaarSearchResultsFromDB_Struct> all_entries; std::vector<BazaarSearchResultsFromDB_Struct> all_entries;
std::unordered_set<std::string> trader_items_ids{}; std::unordered_set<std::string> trader_items_ids{};
// auto const trader_results = TraderRepository::GetBazaarTraderDetails(db, search_criteria_trader, search.max_results);
auto const trader_results = TraderRepository::GetBazaarTraderDetails( auto const trader_results = TraderRepository::GetBazaarTraderDetails(
db, db,
search_criteria_trader, search_criteria_trader,
@ -281,7 +280,6 @@ Bazaar::GetSearchResults(
for (auto const &i: trader_results) { for (auto const &i: trader_results) {
trader_items_ids.emplace(std::to_string(i.trader.item_id)); trader_items_ids.emplace(std::to_string(i.trader.item_id));
//trader_items_ids.push_back(std::to_string(i.trader.item_id));
} }
auto const item_results = ItemsRepository::GetItemsForBazaarSearch( auto const item_results = ItemsRepository::GetItemsForBazaarSearch(
@ -333,39 +331,6 @@ Bazaar::GetSearchResults(
all_entries.push_back(r); all_entries.push_back(r);
} }
// for (auto const& t:item_results) {
// BazaarSearchResultsFromDB_Struct r{};
// r.count = 1;
// r.trader_id = t.trader.character_id;
// r.item_unique_id = t.trader.item_unique_id;
// r.cost = t.trader.item_cost;
// r.slot_id = t.trader.slot_id;
// r.charges = t.trader.item_charges;
// r.stackable = t.stackable;
// r.icon_id = t.icon;
// r.trader_zone_id = t.trader.char_zone_id;
// r.trader_zone_instance_id = t.trader.char_zone_instance_id;
// r.trader_entity_id = t.trader.char_entity_id;
// r.item_name = fmt::format("{:.63}\0", t.name);
// r.trader_name = fmt::format("{:.63}\0", t.trader_name);
// r.item_stat = t.stats;
//
// if (RuleB(Bazaar, UseAlternateBazaarSearch)) {
// if (convert ||
// char_zone_id != Zones::BAZAAR ||
// (char_zone_id == Zones::BAZAAR && r.trader_zone_instance_id != char_zone_instance_id)
// ) {
// r.trader_id = TraderRepository::TRADER_CONVERT_ID + r.trader_zone_instance_id;
// }
// }
//
// all_entries.push_back(r);
// }
// if (all_entries.size() > search.max_results) {
// all_entries.resize(search.max_results);
// }
LogTrading("Returning [{}] items from search results", all_entries.size()); LogTrading("Returning [{}] items from search results", all_entries.size());
return all_entries; return all_entries;

View File

@ -252,9 +252,6 @@ int16 EQ::InventoryProfile::PutItem(int16 slot_id, const ItemInstance& inst)
return slot_id; return slot_id;
} }
// if (inst.GetSerialNumber2().empty()) {
// inst.GenerateUniqueSerialNumber();
// }
// Delegate to internal method // Delegate to internal method
return _PutItem(slot_id, inst.Clone()); return _PutItem(slot_id, inst.Clone());
} }

View File

@ -439,7 +439,6 @@ namespace RoF2
break; break;
} }
default: { default: {
//LogTradingDetail("Unhandled action <red>[{}]", sub_action);
dest->FastQueuePacket(&in); dest->FastQueuePacket(&in);
} }
} }
@ -533,7 +532,6 @@ namespace RoF2
break; break;
} }
default: { default: {
//LogTradingDetail("(RoF2) Unhandled action <red>[{}]", action);
dest->FastQueuePacket(&in, ack_req); dest->FastQueuePacket(&in, ack_req);
} }
} }
@ -622,10 +620,6 @@ namespace RoF2
break; break;
} }
default: { default: {
// LogTradingDetail(
// "(RoF2) Unhandled action <red>[{}]",
// in->action
// );
dest->QueuePacket(inapp); dest->QueuePacket(inapp);
} }
} }
@ -4337,7 +4331,6 @@ namespace RoF2
break; break;
} }
default: { default: {
// LogTradingDetail("(RoF2) Unhandled action <red>[{}]", action);
EQApplicationPacket *in = *p; EQApplicationPacket *in = *p;
*p = nullptr; *p = nullptr;
@ -5111,7 +5104,6 @@ namespace RoF2
} }
default: { default: {
auto emu = (BuyerGeneric_Struct *) __packet->pBuffer; auto emu = (BuyerGeneric_Struct *) __packet->pBuffer;
LogTradingDetail("(RoF2) Pass thru OP_Barter packet action <red>[{}]", emu->action);
} }
} }
} }
@ -6228,7 +6220,6 @@ namespace RoF2
break; break;
} }
default: { default: {
//LogTradingDetail("(RoF2) Unhandled action <red>[{}]", action);
} }
} }
} }

View File

@ -2528,7 +2528,6 @@ namespace Titanium
IN(action); IN(action);
memcpy(emu->player_name, eq->player_name, sizeof(emu->player_name)); memcpy(emu->player_name, eq->player_name, sizeof(emu->player_name));
//FIXIN(serial_number);
FINISH_DIRECT_DECODE(); FINISH_DIRECT_DECODE();
break; break;

View File

@ -3617,7 +3617,6 @@ namespace UF
IN(action); IN(action);
memcpy(emu->player_name, eq->player_name, sizeof(emu->player_name)); memcpy(emu->player_name, eq->player_name, sizeof(emu->player_name));
//FIXIN(serial_number);
FINISH_DIRECT_DECODE(); FINISH_DIRECT_DECODE();
break; break;

View File

@ -121,7 +121,7 @@ public:
static void ClearAllOfflineStatus(Database& db) static void ClearAllOfflineStatus(Database& db)
{ {
auto query = fmt::format("UPDATE {} SET `offline` = '0' WHERE `offline` = '1';", auto query = fmt::format("UPDATE {} SET `offline` = 0 WHERE `offline` = 1;",
TableName() TableName()
); );
@ -133,7 +133,7 @@ public:
auto query = fmt::format("SELECT a.`offline` " auto query = fmt::format("SELECT a.`offline` "
"FROM `account` AS a " "FROM `account` AS a "
"INNER JOIN character_data AS c ON c.account_id = a.id " "INNER JOIN character_data AS c ON c.account_id = a.id "
"WHERE c.id = '{}'", "WHERE c.id = {}",
character_id character_id
); );
auto results = db.QueryDatabase(query); auto results = db.QueryDatabase(query);

View File

@ -73,7 +73,7 @@ public:
{ {
const std::string &query = fmt::format( const std::string &query = fmt::format(
"SELECT COUNT(*) FROM (SELECT * FROM `inventory_snapshots` a WHERE " "SELECT COUNT(*) FROM (SELECT * FROM `inventory_snapshots` a WHERE "
"`character_id` = '{}' GROUP BY `time_index`) b", "`character_id` = {} GROUP BY `time_index`) b",
character_id character_id
); );
@ -103,14 +103,14 @@ public:
del_time -= RuleI(Character, InvSnapshotHistoryD) * 86400; del_time -= RuleI(Character, InvSnapshotHistoryD) * 86400;
} }
DeleteWhere(db, fmt::format("`character_id` = '{}' AND `time_index` <= '{}'", character_id, del_time)); DeleteWhere(db, fmt::format("`character_id` = {} AND `time_index` <= {}", character_id, del_time));
} }
static void ListCharacterInvSnapshots(Database &db, uint32 character_id, std::list<std::pair<uint32, int>> &is_list) static void ListCharacterInvSnapshots(Database &db, uint32 character_id, std::list<std::pair<uint32, int>> &is_list)
{ {
const std::string &query = fmt::format( const std::string &query = fmt::format(
"SELECT `time_index`, COUNT(*) FROM `inventory_snapshots` WHERE " "SELECT `time_index`, COUNT(*) FROM `inventory_snapshots` WHERE "
"`character_id` = '{}' GROUP BY `time_index` ORDER BY `time_index` DESC", "`character_id` = {} GROUP BY `time_index` ORDER BY `time_index` DESC",
character_id character_id
); );
auto results = db.QueryDatabase(query); auto results = db.QueryDatabase(query);
@ -130,8 +130,8 @@ public:
} }
const std::string &query = fmt::format( const std::string &query = fmt::format(
"SELECT * FROM `inventory_snapshots` WHERE `character_id` = '{}' " "SELECT * FROM `inventory_snapshots` WHERE `character_id` = {} "
"AND `time_index` = '{}' LIMIT 1", "AND `time_index` = {} LIMIT 1",
character_id, character_id,
timestamp timestamp
); );
@ -152,7 +152,7 @@ public:
{ {
const std::string &query = fmt::format( const std::string &query = fmt::format(
"SELECT `slot_id`, `item_id` FROM `inventory_snapshots` " "SELECT `slot_id`, `item_id` FROM `inventory_snapshots` "
"WHERE `character_id` = '{}' AND `time_index` = '{}' ORDER BY `slot_id`", "WHERE `character_id` = {} AND `time_index` = {} ORDER BY `slot_id`",
character_id, character_id,
timestamp timestamp
); );
@ -175,9 +175,9 @@ public:
{ {
const std::string &query = fmt::format( const std::string &query = fmt::format(
"SELECT slot_id, item_id FROM `inventory_snapshots` " "SELECT slot_id, item_id FROM `inventory_snapshots` "
"WHERE `time_index` = '{0}' AND `character_id` = '{1}' AND `slot_id` NOT IN (" "WHERE `time_index` = {0} AND `character_id` = {1} AND `slot_id` NOT IN ("
"SELECT a.`slot_id` FROM `inventory_snapshots` a JOIN `inventory` b USING (`slot_id`, `item_id`) " "SELECT a.`slot_id` FROM `inventory_snapshots` a JOIN `inventory` b USING (`slot_id`, `item_id`) "
"WHERE a.`time_index` = '{0}' AND a.`character_id` = '{1}' AND b.`character_id` = '{1}')", "WHERE a.`time_index` = {0} AND a.`character_id` = {1} AND b.`character_id` = {1})",
timestamp, timestamp,
character_id character_id
); );
@ -197,9 +197,9 @@ public:
{ {
const std::string &query = fmt::format( const std::string &query = fmt::format(
"SELECT `slot_id`, `item_id` FROM `inventory` WHERE " "SELECT `slot_id`, `item_id` FROM `inventory` WHERE "
"`character_id` = '{0}' AND `slot_id` NOT IN (" "`character_id` = {0} AND `slot_id` NOT IN ("
"SELECT a.`slot_id` FROM `inventory` a JOIN `inventory_snapshots` b USING (`slot_id`, `item_id`) " "SELECT a.`slot_id` FROM `inventory` a JOIN `inventory_snapshots` b USING (`slot_id`, `item_id`) "
"WHERE b.`time_index` = '{1}' AND b.`character_id` = '{0}' AND a.`character_id` = '{0}')", "WHERE b.`time_index` = {1} AND b.`character_id` = {0} AND a.`character_id` = {0})",
character_id, character_id,
timestamp timestamp
); );
@ -219,33 +219,33 @@ public:
uint32 time_index = time(nullptr); uint32 time_index = time(nullptr);
std::vector<InventorySnapshots> queue{}; std::vector<InventorySnapshots> queue{};
auto inventory = InventoryRepository::GetWhere(db, fmt::format("`character_id` = '{}'", character_id)); auto inventory = InventoryRepository::GetWhere(db, fmt::format("`character_id` = {}", character_id));
if (inventory.empty()) { if (inventory.empty()) {
LogError("Character ID [{}] inventory is empty. Snapshot not created", character_id); LogError("Character ID [{}] inventory is empty. Snapshot not created", character_id);
return false; return false;
} }
for (auto const &i: inventory) { for (auto const &i: inventory) {
auto snapshot = NewEntity(); auto s = NewEntity();
snapshot.character_id = i.character_id; s.character_id = i.character_id;
snapshot.item_id = i.item_id; s.item_id = i.item_id;
snapshot.item_unique_id = i.item_unique_id; s.item_unique_id = i.item_unique_id;
snapshot.augment_one = i.augment_one; s.augment_one = i.augment_one;
snapshot.augment_two = i.augment_two; s.augment_two = i.augment_two;
snapshot.augment_three = i.augment_three; s.augment_three = i.augment_three;
snapshot.augment_four = i.augment_four; s.augment_four = i.augment_four;
snapshot.augment_five = i.augment_five; s.augment_five = i.augment_five;
snapshot.augment_six = i.augment_six; s.augment_six = i.augment_six;
snapshot.charges = i.charges; s.charges = i.charges;
snapshot.color = i.color; s.color = i.color;
snapshot.custom_data = i.custom_data; s.custom_data = i.custom_data;
snapshot.instnodrop = i.instnodrop; s.instnodrop = i.instnodrop;
snapshot.ornament_hero_model = i.ornament_hero_model; s.ornament_hero_model = i.ornament_hero_model;
snapshot.ornament_icon = i.ornament_icon; s.ornament_icon = i.ornament_icon;
snapshot.ornament_idfile = i.ornament_idfile; s.ornament_idfile = i.ornament_idfile;
snapshot.slot_id = i.slot_id; s.slot_id = i.slot_id;
snapshot.time_index = time_index; s.time_index = time_index;
queue.push_back(snapshot); queue.push_back(s);
} }
if (queue.empty()) { if (queue.empty()) {
@ -264,9 +264,9 @@ public:
static bool RestoreCharacterInvSnapshot(Database &db, uint32 character_id, uint32 timestamp) static bool RestoreCharacterInvSnapshot(Database &db, uint32 character_id, uint32 timestamp)
{ {
InventoryRepository::DeleteWhere(db, fmt::format("`character_id` = '{}'", character_id)); InventoryRepository::DeleteWhere(db, fmt::format("`character_id` = {}", character_id));
auto snapshot = GetWhere(db, fmt::format("`character_id` = '{}' AND `time_index` = '{}'", character_id, timestamp)); auto snapshot = GetWhere(db, fmt::format("`character_id` = {} AND `time_index` = {}", character_id, timestamp));
if (snapshot.empty()) { if (snapshot.empty()) {
LogError("The snapshot requested could not be found. Restore failed for character id [{}] @ [{}] failed", LogError("The snapshot requested could not be found. Restore failed for character id [{}] @ [{}] failed",
character_id, character_id,
@ -277,25 +277,25 @@ public:
std::vector<InventoryRepository::Inventory> queue{}; std::vector<InventoryRepository::Inventory> queue{};
for (auto const &i: snapshot) { for (auto const &i: snapshot) {
auto inventory_entry = InventoryRepository::NewEntity(); auto e = InventoryRepository::NewEntity();
inventory_entry.character_id = i.character_id; e.character_id = i.character_id;
inventory_entry.item_id = i.item_id; e.item_id = i.item_id;
inventory_entry.item_unique_id = i.item_unique_id; e.item_unique_id = i.item_unique_id;
inventory_entry.augment_one = i.augment_one; e.augment_one = i.augment_one;
inventory_entry.augment_two = i.augment_two; e.augment_two = i.augment_two;
inventory_entry.augment_three = i.augment_three; e.augment_three = i.augment_three;
inventory_entry.augment_four = i.augment_four; e.augment_four = i.augment_four;
inventory_entry.augment_five = i.augment_five; e.augment_five = i.augment_five;
inventory_entry.augment_six = i.augment_six; e.augment_six = i.augment_six;
inventory_entry.charges = i.charges; e.charges = i.charges;
inventory_entry.color = i.color; e.color = i.color;
inventory_entry.custom_data = i.custom_data; e.custom_data = i.custom_data;
inventory_entry.instnodrop = i.instnodrop; e.instnodrop = i.instnodrop;
inventory_entry.ornament_hero_model = i.ornament_hero_model; e.ornament_hero_model = i.ornament_hero_model;
inventory_entry.ornament_icon = i.ornament_icon; e.ornament_icon = i.ornament_icon;
inventory_entry.ornament_idfile = i.ornament_idfile; e.ornament_idfile = i.ornament_idfile;
inventory_entry.slot_id = i.slot_id; e.slot_id = i.slot_id;
queue.push_back(inventory_entry); queue.push_back(e);
} }
if (queue.empty()) { if (queue.empty()) {