mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-03 06:23:53 +00:00
Testing
This commit is contained in:
parent
2174f41505
commit
8c6a99dc18
@ -2300,7 +2300,7 @@ void Database::ConvertInventoryToNewUniqueId()
|
||||
|
||||
TransactionBegin();
|
||||
uint32 index = 0;
|
||||
uint32 batch_size = 1000;
|
||||
const uint32 batch_size = 1000;
|
||||
std::vector<InventoryRepository::Inventory> queue{};
|
||||
queue.reserve(batch_size);
|
||||
|
||||
@ -2321,4 +2321,4 @@ void Database::ConvertInventoryToNewUniqueId()
|
||||
|
||||
TransactionCommit();
|
||||
LogInfo("Converted {} records", results.size());
|
||||
}
|
||||
}
|
||||
|
||||
@ -382,6 +382,7 @@ public:
|
||||
void NukeTraderItem(uint16 slot, int16 charges, int16 quantity, Client* customer, uint16 trader_slot, const std::string &serial_number, int32 item_id = 0);
|
||||
void ReturnTraderReq(const EQApplicationPacket* app,int16 traderitemcharges, uint32 itemid = 0);
|
||||
void TradeRequestFailed(const EQApplicationPacket* app);
|
||||
void TradeRequestFailed(TraderBuy_Struct &in);
|
||||
void BuyTraderItem(const EQApplicationPacket* app);
|
||||
void BuyTraderItemFromBazaarWindow(const EQApplicationPacket* app);
|
||||
void FinishTrade(
|
||||
|
||||
@ -1381,22 +1381,43 @@ void Client::TradeRequestFailed(const EQApplicationPacket *app)
|
||||
safe_delete(outapp);
|
||||
}
|
||||
|
||||
static void BazaarAuditTrail(const char *seller, const char *buyer, const char *itemName, int quantity, int totalCost, int tranType) {
|
||||
void Client::TradeRequestFailed(TraderBuy_Struct &in)
|
||||
{
|
||||
auto outapp = EQApplicationPacket(OP_TraderBuy, sizeof(TraderBuy_Struct));
|
||||
auto data = reinterpret_cast<TraderBuy_Struct *>(outapp.pBuffer);
|
||||
|
||||
const std::string& query = fmt::format(
|
||||
"INSERT INTO `trader_audit` "
|
||||
"(`time`, `seller`, `buyer`, `itemname`, `quantity`, `totalcost`, `trantype`) "
|
||||
"VALUES (NOW(), '{}', '{}', '{}', {}, {}, {})",
|
||||
seller,
|
||||
buyer,
|
||||
Strings::Escape(itemName),
|
||||
quantity,
|
||||
totalCost,
|
||||
tranType
|
||||
);
|
||||
database.QueryDatabase(query);
|
||||
data->method = in.method;
|
||||
data->action = in.action;
|
||||
data->sub_action = Failed;
|
||||
data->already_sold = 0xFFFFFFFF;
|
||||
data->item_id = in.item_id;
|
||||
data->price = in.price;
|
||||
data->quantity = in.quantity;
|
||||
data->trader_id = 0xFFFFFFFF;
|
||||
strn0cpy(data->buyer_name, in.buyer_name, sizeof(data->buyer_name));
|
||||
strn0cpy(data->item_name, in.item_name, sizeof(data->item_name));
|
||||
strn0cpy(data->item_unique_id, in.item_unique_id, sizeof(data->item_unique_id));
|
||||
strn0cpy(data->seller_name, in.seller_name, sizeof(data->seller_name));
|
||||
|
||||
QueuePacket(&outapp);
|
||||
}
|
||||
|
||||
// static void BazaarAuditTrail(const char *seller, const char *buyer, const char *itemName, int quantity, int totalCost, int tranType) {
|
||||
//
|
||||
// const std::string& query = fmt::format(
|
||||
// "INSERT INTO `trader_audit` "
|
||||
// "(`time`, `seller`, `buyer`, `itemname`, `quantity`, `totalcost`, `trantype`) "
|
||||
// "VALUES (NOW(), '{}', '{}', '{}', {}, {}, {})",
|
||||
// seller,
|
||||
// buyer,
|
||||
// Strings::Escape(itemName),
|
||||
// quantity,
|
||||
// totalCost,
|
||||
// tranType
|
||||
// );
|
||||
// database.QueryDatabase(query);
|
||||
// }
|
||||
|
||||
void Client::BuyTraderItem(const EQApplicationPacket *app)
|
||||
{
|
||||
auto in = reinterpret_cast<TraderBuy_Struct *>(app->pBuffer);
|
||||
@ -2893,8 +2914,9 @@ void Client::BuyTraderItemFromBazaarWindow(const EQApplicationPacket *app)
|
||||
Message(Chat::Red, fmt::format("You paid {} for the parcel delivery.", DetermineMoneyString(fee)).c_str());
|
||||
SendMoneyUpdate();
|
||||
|
||||
LogTradingDetail("Step 2:Bazaar Purchase. Took [{}] from Buyer [{}] for purchase of [{}] {}{}",
|
||||
LogTradingDetail("Step 2:Bazaar Purchase. Took [{}] {}from Buyer [{}] for purchase of [{}] {}{}",
|
||||
DetermineMoneyString(total_cost),
|
||||
fee > 0 ? fmt::format("plus a fee of [{}] ", fee) : std::string(""),
|
||||
CharacterID(),
|
||||
quantity,
|
||||
quantity > 1 ? fmt::format("{}s", in->item_name) : in->item_name,
|
||||
|
||||
@ -3815,7 +3815,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
);
|
||||
}
|
||||
else {
|
||||
TraderRepository::DeleteOne(database, in->trader_buy_struct.item_id);
|
||||
TraderRepository::DeleteOne(database, in->id);
|
||||
LogTradingDetail(
|
||||
"Step 4:Bazaar Purchase. Deleted database id [{}] because database quantity [{}] equals [{}] purchased quantity",
|
||||
in->trader_buy_struct.item_id,
|
||||
@ -3908,8 +3908,13 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
buyer->SendMoneyUpdate();
|
||||
|
||||
buyer->Message(Chat::Red, "Bazaar purchased failed. Returning your money.");
|
||||
LogTradingDetail("Bazaar Purchase Failed. Returning money [{}] to Buyer [{}]", total_cost + fee, buyer->CharacterID());
|
||||
|
||||
LogTradingDetail(
|
||||
"Bazaar Purchase Failed. Returning money [{}] + fee [{}] to Buyer [{}]",
|
||||
total_cost,
|
||||
fee,
|
||||
buyer->CharacterID()
|
||||
);
|
||||
buyer->TradeRequestFailed(in->trader_buy_struct);
|
||||
break;
|
||||
}
|
||||
case BazaarPurchaseSuccess: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user