mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-31 02:02:26 +00:00
Testing
This commit is contained in:
parent
2174f41505
commit
8c6a99dc18
@ -2300,7 +2300,7 @@ void Database::ConvertInventoryToNewUniqueId()
|
|||||||
|
|
||||||
TransactionBegin();
|
TransactionBegin();
|
||||||
uint32 index = 0;
|
uint32 index = 0;
|
||||||
uint32 batch_size = 1000;
|
const uint32 batch_size = 1000;
|
||||||
std::vector<InventoryRepository::Inventory> queue{};
|
std::vector<InventoryRepository::Inventory> queue{};
|
||||||
queue.reserve(batch_size);
|
queue.reserve(batch_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 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 ReturnTraderReq(const EQApplicationPacket* app,int16 traderitemcharges, uint32 itemid = 0);
|
||||||
void TradeRequestFailed(const EQApplicationPacket* app);
|
void TradeRequestFailed(const EQApplicationPacket* app);
|
||||||
|
void TradeRequestFailed(TraderBuy_Struct &in);
|
||||||
void BuyTraderItem(const EQApplicationPacket* app);
|
void BuyTraderItem(const EQApplicationPacket* app);
|
||||||
void BuyTraderItemFromBazaarWindow(const EQApplicationPacket* app);
|
void BuyTraderItemFromBazaarWindow(const EQApplicationPacket* app);
|
||||||
void FinishTrade(
|
void FinishTrade(
|
||||||
|
|||||||
@ -1381,22 +1381,43 @@ void Client::TradeRequestFailed(const EQApplicationPacket *app)
|
|||||||
safe_delete(outapp);
|
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(
|
data->method = in.method;
|
||||||
"INSERT INTO `trader_audit` "
|
data->action = in.action;
|
||||||
"(`time`, `seller`, `buyer`, `itemname`, `quantity`, `totalcost`, `trantype`) "
|
data->sub_action = Failed;
|
||||||
"VALUES (NOW(), '{}', '{}', '{}', {}, {}, {})",
|
data->already_sold = 0xFFFFFFFF;
|
||||||
seller,
|
data->item_id = in.item_id;
|
||||||
buyer,
|
data->price = in.price;
|
||||||
Strings::Escape(itemName),
|
data->quantity = in.quantity;
|
||||||
quantity,
|
data->trader_id = 0xFFFFFFFF;
|
||||||
totalCost,
|
strn0cpy(data->buyer_name, in.buyer_name, sizeof(data->buyer_name));
|
||||||
tranType
|
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));
|
||||||
database.QueryDatabase(query);
|
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)
|
void Client::BuyTraderItem(const EQApplicationPacket *app)
|
||||||
{
|
{
|
||||||
auto in = reinterpret_cast<TraderBuy_Struct *>(app->pBuffer);
|
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());
|
Message(Chat::Red, fmt::format("You paid {} for the parcel delivery.", DetermineMoneyString(fee)).c_str());
|
||||||
SendMoneyUpdate();
|
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),
|
DetermineMoneyString(total_cost),
|
||||||
|
fee > 0 ? fmt::format("plus a fee of [{}] ", fee) : std::string(""),
|
||||||
CharacterID(),
|
CharacterID(),
|
||||||
quantity,
|
quantity,
|
||||||
quantity > 1 ? fmt::format("{}s", in->item_name) : in->item_name,
|
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 {
|
else {
|
||||||
TraderRepository::DeleteOne(database, in->trader_buy_struct.item_id);
|
TraderRepository::DeleteOne(database, in->id);
|
||||||
LogTradingDetail(
|
LogTradingDetail(
|
||||||
"Step 4:Bazaar Purchase. Deleted database id [{}] because database quantity [{}] equals [{}] purchased quantity",
|
"Step 4:Bazaar Purchase. Deleted database id [{}] because database quantity [{}] equals [{}] purchased quantity",
|
||||||
in->trader_buy_struct.item_id,
|
in->trader_buy_struct.item_id,
|
||||||
@ -3908,8 +3908,13 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
|||||||
buyer->SendMoneyUpdate();
|
buyer->SendMoneyUpdate();
|
||||||
|
|
||||||
buyer->Message(Chat::Red, "Bazaar purchased failed. Returning your money.");
|
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;
|
break;
|
||||||
}
|
}
|
||||||
case BazaarPurchaseSuccess: {
|
case BazaarPurchaseSuccess: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user