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::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(
db,
search_criteria_trader,
@ -281,7 +280,6 @@ Bazaar::GetSearchResults(
for (auto const &i: trader_results) {
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(
@ -333,39 +331,6 @@ Bazaar::GetSearchResults(
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());
return all_entries;

View File

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

View File

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

View File

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

View File

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

View File

@ -121,7 +121,7 @@ public:
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()
);
@ -133,7 +133,7 @@ public:
auto query = fmt::format("SELECT a.`offline` "
"FROM `account` AS a "
"INNER JOIN character_data AS c ON c.account_id = a.id "
"WHERE c.id = '{}'",
"WHERE c.id = {}",
character_id
);
auto results = db.QueryDatabase(query);

View File

@ -73,7 +73,7 @@ public:
{
const std::string &query = fmt::format(
"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
);
@ -103,14 +103,14 @@ public:
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)
{
const std::string &query = fmt::format(
"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
);
auto results = db.QueryDatabase(query);
@ -130,8 +130,8 @@ public:
}
const std::string &query = fmt::format(
"SELECT * FROM `inventory_snapshots` WHERE `character_id` = '{}' "
"AND `time_index` = '{}' LIMIT 1",
"SELECT * FROM `inventory_snapshots` WHERE `character_id` = {} "
"AND `time_index` = {} LIMIT 1",
character_id,
timestamp
);
@ -152,7 +152,7 @@ public:
{
const std::string &query = fmt::format(
"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,
timestamp
);
@ -175,9 +175,9 @@ public:
{
const std::string &query = fmt::format(
"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`) "
"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,
character_id
);
@ -197,9 +197,9 @@ public:
{
const std::string &query = fmt::format(
"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`) "
"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,
timestamp
);
@ -219,33 +219,33 @@ public:
uint32 time_index = time(nullptr);
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()) {
LogError("Character ID [{}] inventory is empty. Snapshot not created", character_id);
return false;
}
for (auto const &i: inventory) {
auto snapshot = NewEntity();
snapshot.character_id = i.character_id;
snapshot.item_id = i.item_id;
snapshot.item_unique_id = i.item_unique_id;
snapshot.augment_one = i.augment_one;
snapshot.augment_two = i.augment_two;
snapshot.augment_three = i.augment_three;
snapshot.augment_four = i.augment_four;
snapshot.augment_five = i.augment_five;
snapshot.augment_six = i.augment_six;
snapshot.charges = i.charges;
snapshot.color = i.color;
snapshot.custom_data = i.custom_data;
snapshot.instnodrop = i.instnodrop;
snapshot.ornament_hero_model = i.ornament_hero_model;
snapshot.ornament_icon = i.ornament_icon;
snapshot.ornament_idfile = i.ornament_idfile;
snapshot.slot_id = i.slot_id;
snapshot.time_index = time_index;
queue.push_back(snapshot);
auto s = NewEntity();
s.character_id = i.character_id;
s.item_id = i.item_id;
s.item_unique_id = i.item_unique_id;
s.augment_one = i.augment_one;
s.augment_two = i.augment_two;
s.augment_three = i.augment_three;
s.augment_four = i.augment_four;
s.augment_five = i.augment_five;
s.augment_six = i.augment_six;
s.charges = i.charges;
s.color = i.color;
s.custom_data = i.custom_data;
s.instnodrop = i.instnodrop;
s.ornament_hero_model = i.ornament_hero_model;
s.ornament_icon = i.ornament_icon;
s.ornament_idfile = i.ornament_idfile;
s.slot_id = i.slot_id;
s.time_index = time_index;
queue.push_back(s);
}
if (queue.empty()) {
@ -264,9 +264,9 @@ public:
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()) {
LogError("The snapshot requested could not be found. Restore failed for character id [{}] @ [{}] failed",
character_id,
@ -277,25 +277,25 @@ public:
std::vector<InventoryRepository::Inventory> queue{};
for (auto const &i: snapshot) {
auto inventory_entry = InventoryRepository::NewEntity();
inventory_entry.character_id = i.character_id;
inventory_entry.item_id = i.item_id;
inventory_entry.item_unique_id = i.item_unique_id;
inventory_entry.augment_one = i.augment_one;
inventory_entry.augment_two = i.augment_two;
inventory_entry.augment_three = i.augment_three;
inventory_entry.augment_four = i.augment_four;
inventory_entry.augment_five = i.augment_five;
inventory_entry.augment_six = i.augment_six;
inventory_entry.charges = i.charges;
inventory_entry.color = i.color;
inventory_entry.custom_data = i.custom_data;
inventory_entry.instnodrop = i.instnodrop;
inventory_entry.ornament_hero_model = i.ornament_hero_model;
inventory_entry.ornament_icon = i.ornament_icon;
inventory_entry.ornament_idfile = i.ornament_idfile;
inventory_entry.slot_id = i.slot_id;
queue.push_back(inventory_entry);
auto e = InventoryRepository::NewEntity();
e.character_id = i.character_id;
e.item_id = i.item_id;
e.item_unique_id = i.item_unique_id;
e.augment_one = i.augment_one;
e.augment_two = i.augment_two;
e.augment_three = i.augment_three;
e.augment_four = i.augment_four;
e.augment_five = i.augment_five;
e.augment_six = i.augment_six;
e.charges = i.charges;
e.color = i.color;
e.custom_data = i.custom_data;
e.instnodrop = i.instnodrop;
e.ornament_hero_model = i.ornament_hero_model;
e.ornament_icon = i.ornament_icon;
e.ornament_idfile = i.ornament_idfile;
e.slot_id = i.slot_id;
queue.push_back(e);
}
if (queue.empty()) {