ExpeditionSay converted to QueryDatabase

This commit is contained in:
Arthur Ice 2014-08-23 23:26:45 -07:00
parent 2dbd616725
commit 3262bee6c5

View File

@ -8170,29 +8170,21 @@ void Client::PlayMP3(const char* fname)
safe_delete(outapp); safe_delete(outapp);
} }
void Client::ExpeditionSay(const char *str, int ExpID) { void Client::ExpeditionSay(const char *str, int expID) {
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
if (!database.RunQuery(query,MakeAnyLenString(&query, "SELECT `player_name` FROM `cust_inst_players` WHERE `inst_id` = %i", ExpID),errbuf,&result)){ std::string query = StringFormat("SELECT `player_name` FROM "
safe_delete_array(query); "`cust_inst_players` WHERE "
"`inst_id` = %i", expID);
auto results = database.QueryDatabase(query);
if (!results.Success())
return; return;
this->Message(14, "You say to the expedition, '%s'", str);
for (auto row = results.begin(); row != results.end(); ++row) {
const char* charName = row[0];
if(strcmp(charName, this->GetCleanName()) != 0)
worldserver.SendEmoteMessage(charName, 0, 0, 14, "%s says to the expedition, '%s'", this->GetCleanName(), str);
} }
safe_delete_array(query);
if(result)
this->Message(14, "You say to the expedition, '%s'", str);
while((row = mysql_fetch_row(result))) {
const char* CharName = row[0];
if(strcmp(CharName, this->GetCleanName()) != 0)
worldserver.SendEmoteMessage(CharName, 0, 0, 14, "%s says to the expedition, '%s'", this->GetCleanName(), str);
// ChannelList->CreateChannel(ChannelName, ChannelOwner, ChannelPassword, true, atoi(row[3]));
}
mysql_free_result(result);
} }