mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 19:03:43 +00:00
Staff list contraband items on a new dashboard page (item search, reason, flag or flag and remove; contraband_manage to edit, reports_view to see). World servers check every inventory when a character loads and every item a player receives: each find is an economy flag of the new kind Contraband, shown with the other flags and in the character's related data. Items marked for removal are taken away, with a character snapshot kept first so they can be given back, an audit entry and a mail or chat message telling the player why. Staff are skipped unless contraband_ignore_staff is off. Worlds reload the list when it changes (RELOAD_CONTRABAND, added at the end of ePlayerAction). Fixes #1563 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
23 lines
1.0 KiB
C++
23 lines
1.0 KiB
C++
#include "SQLiteDatabase.h"
|
|
|
|
std::vector<IContraband::ContrabandItem> SQLiteDatabase::GetContrabandItems() {
|
|
std::vector<ContrabandItem> items;
|
|
auto [_, result] = ExecuteSelect("SELECT * FROM contraband_items ORDER BY lot;");
|
|
for (; !result.eof(); result.nextRow()) {
|
|
items.push_back({ result.getIntField("lot"), result.getStringField("reason"), static_cast<eContrabandAction>(result.getIntField("action")),
|
|
result.getStringField("added_by"), result.getInt64Field("added_at") });
|
|
}
|
|
return items;
|
|
}
|
|
|
|
void SQLiteDatabase::SetContrabandItem(const ContrabandItem& item) {
|
|
ExecuteInsert(
|
|
"INSERT INTO contraband_items (lot, reason, action, added_by, added_at) VALUES (?, ?, ?, ?, ?) "
|
|
"ON CONFLICT(lot) DO UPDATE SET reason = excluded.reason, action = excluded.action, added_by = excluded.added_by, added_at = excluded.added_at;",
|
|
item.lot, item.reason, static_cast<uint32_t>(item.action), item.addedBy, item.addedAt);
|
|
}
|
|
|
|
bool SQLiteDatabase::DeleteContrabandItem(LOT lot) {
|
|
return ExecuteUpdate("DELETE FROM contraband_items WHERE lot = ?;", lot) > 0;
|
|
}
|