mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-15 00:01:28 +00:00
NoRentExpired converted to QueryDatabase
This commit is contained in:
parent
41769a3fa8
commit
74d3192c2e
@ -918,20 +918,19 @@ bool ZoneDatabase::GetCharacterInfoForLogin_result(MYSQL_RES* result,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ZoneDatabase::NoRentExpired(const char* name){
|
bool ZoneDatabase::NoRentExpired(const char* name){
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
std::string query = StringFormat("SELECT (UNIX_TIMESTAMP(NOW())-timelaston) "
|
||||||
char *query = 0;
|
"FROM character_ WHERE name = '%s'", name);
|
||||||
MYSQL_RES *result;
|
auto results = QueryDatabase(query);
|
||||||
MYSQL_ROW row;
|
if (!results.Success())
|
||||||
if (RunQuery(query, MakeAnyLenString(&query, "Select (UNIX_TIMESTAMP(NOW())-timelaston) from character_ where name='%s'", name), errbuf, &result)) {
|
return false;
|
||||||
safe_delete_array(query);
|
|
||||||
if (mysql_num_rows(result) == 1) {
|
if (results.RowCount() != 1)
|
||||||
row = mysql_fetch_row(result);
|
return false;
|
||||||
uint32 seconds = atoi(row[0]);
|
|
||||||
mysql_free_result(result);
|
auto row = results.begin();
|
||||||
return (seconds>1800);
|
uint32 seconds = atoi(row[0]);
|
||||||
}
|
|
||||||
}
|
return (seconds>1800);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Searches npctable for matching id, and returns the item if found,
|
/* Searches npctable for matching id, and returns the item if found,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user