mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-16 05:11:29 +00:00
SendBazaarWelcome converted to QueryDatabase
This commit is contained in:
parent
091c8ea5f1
commit
6eba672013
@ -1624,18 +1624,10 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs,Client* Trader,const EQApplicat
|
|||||||
|
|
||||||
void Client::SendBazaarWelcome(){
|
void Client::SendBazaarWelcome(){
|
||||||
|
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
const std::string query = "SELECT COUNT(DISTINCT char_id), count(char_id) FROM trader";
|
||||||
|
auto results = database.QueryDatabase(query);
|
||||||
char* query = 0;
|
if (results.Success() && results.RowCount() == 1){
|
||||||
|
auto row = results.begin();
|
||||||
MYSQL_RES *result;
|
|
||||||
|
|
||||||
MYSQL_ROW row;
|
|
||||||
|
|
||||||
if (database.RunQuery(query,MakeAnyLenString(&query, "select count(distinct char_id),count(char_id) from trader"),errbuf,&result)){
|
|
||||||
if(mysql_num_rows(result)==1){
|
|
||||||
|
|
||||||
row = mysql_fetch_row(result);
|
|
||||||
|
|
||||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_BazaarSearch, sizeof(BazaarWelcome_Struct));
|
EQApplicationPacket* outapp = new EQApplicationPacket(OP_BazaarSearch, sizeof(BazaarWelcome_Struct));
|
||||||
|
|
||||||
@ -1645,29 +1637,22 @@ void Client::SendBazaarWelcome(){
|
|||||||
|
|
||||||
bws->Beginning.Action = BazaarWelcome;
|
bws->Beginning.Action = BazaarWelcome;
|
||||||
|
|
||||||
bws->Items = atoi(row[1]);
|
|
||||||
|
|
||||||
bws->Traders = atoi(row[0]);
|
bws->Traders = atoi(row[0]);
|
||||||
|
bws->Items = atoi(row[1]);
|
||||||
|
|
||||||
QueuePacket(outapp);
|
QueuePacket(outapp);
|
||||||
|
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
}
|
}
|
||||||
mysql_free_result(result);
|
|
||||||
}
|
|
||||||
safe_delete_array(query);
|
|
||||||
|
|
||||||
if (database.RunQuery(query,MakeAnyLenString(&query, "select count(distinct charid) from buyer"),errbuf,&result)){
|
const std::string buyerCountQuery = "SELECT COUNT(DISTINCT charid) FROM buyer";
|
||||||
if(mysql_num_rows(result)==1) {
|
results = database.QueryDatabase(query);
|
||||||
|
if (!results.Success() || results.RowCount() != 1)
|
||||||
|
return;
|
||||||
|
|
||||||
row = mysql_fetch_row(result);
|
auto row = results.begin();
|
||||||
|
Message(10, "There are %i Buyers waiting to purchase your loot. Type /barter to search for them, "
|
||||||
Message(10, "There are %i Buyers waiting to purchase your loot. Type /barter to search for them,"
|
"or use /buyer to set up your own Buy Lines.", atoi(row[0]));
|
||||||
" or use /buyer to set up your own Buy Lines.", atoi(row[0]));
|
|
||||||
}
|
|
||||||
mysql_free_result(result);
|
|
||||||
}
|
|
||||||
safe_delete_array(query);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint32 ItemStat, uint32 Slot, uint32 Type,
|
void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint32 ItemStat, uint32 Slot, uint32 Type,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user