mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
Remove cross boundary dependency in command_who [skip ci]
This commit is contained in:
parent
22180d4bac
commit
5dc351e5d5
114
zone/command.cpp
114
zone/command.cpp
@ -13106,24 +13106,83 @@ void command_databuckets(Client *c, const Seperator *sep)
|
|||||||
void command_who(Client *c, const Seperator *sep)
|
void command_who(Client *c, const Seperator *sep)
|
||||||
{
|
{
|
||||||
std::string query =
|
std::string query =
|
||||||
"SELECT\n"
|
SQL (
|
||||||
" character_data.account_id,\n"
|
SELECT
|
||||||
" character_data.name,\n"
|
character_data.account_id,
|
||||||
" character_data.zone_id,\n"
|
character_data.name,
|
||||||
" COALESCE((select zone.short_name from zone where zoneidnumber = character_data.zone_id LIMIT 1), \"Not Found\") as zone_name,\n"
|
character_data.zone_id,
|
||||||
" character_data.zone_instance,\n"
|
character_data.zone_instance,
|
||||||
" COALESCE((select guilds.name from guilds where id = ((select guild_id from guild_members where char_id = character_data.id))), \"\") as guild_name,\n"
|
COALESCE(
|
||||||
" character_data.level,\n"
|
(
|
||||||
" character_data.race,\n"
|
select
|
||||||
" character_data.class,\n"
|
guilds.name
|
||||||
" COALESCE((select account.status from account where account.id = character_data.account_id LIMIT 1), 0) as account_status,\n"
|
from
|
||||||
" COALESCE((select account.name from account where account.id = character_data.account_id LIMIT 1), \"\") as account_name,\n"
|
guilds
|
||||||
" COALESCE((select account_ip.ip from account_ip where account_ip.accid = character_data.account_id ORDER BY account_ip.lastused DESC LIMIT 1), \"\") as account_ip\n"
|
where
|
||||||
"FROM\n"
|
id = (
|
||||||
" character_data\n"
|
(
|
||||||
"WHERE\n"
|
select
|
||||||
" last_login > (UNIX_TIMESTAMP() - 600)\n"
|
guild_id
|
||||||
"ORDER BY character_data.name;";
|
from
|
||||||
|
guild_members
|
||||||
|
where
|
||||||
|
char_id = character_data.id
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
""
|
||||||
|
) as guild_name,
|
||||||
|
character_data.level,
|
||||||
|
character_data.race,
|
||||||
|
character_data.class,
|
||||||
|
COALESCE(
|
||||||
|
(
|
||||||
|
select
|
||||||
|
account.status
|
||||||
|
from
|
||||||
|
account
|
||||||
|
where
|
||||||
|
account.id = character_data.account_id
|
||||||
|
LIMIT
|
||||||
|
1
|
||||||
|
), 0
|
||||||
|
) as account_status,
|
||||||
|
COALESCE(
|
||||||
|
(
|
||||||
|
select
|
||||||
|
account.name
|
||||||
|
from
|
||||||
|
account
|
||||||
|
where
|
||||||
|
account.id = character_data.account_id
|
||||||
|
LIMIT
|
||||||
|
1
|
||||||
|
),
|
||||||
|
0
|
||||||
|
) as account_name,
|
||||||
|
COALESCE(
|
||||||
|
(
|
||||||
|
select
|
||||||
|
account_ip.ip
|
||||||
|
from
|
||||||
|
account_ip
|
||||||
|
where
|
||||||
|
account_ip.accid = character_data.account_id
|
||||||
|
ORDER BY
|
||||||
|
account_ip.lastused DESC
|
||||||
|
LIMIT
|
||||||
|
1
|
||||||
|
),
|
||||||
|
""
|
||||||
|
) as account_ip
|
||||||
|
FROM
|
||||||
|
character_data
|
||||||
|
WHERE
|
||||||
|
last_login > (UNIX_TIMESTAMP() - 600)
|
||||||
|
ORDER BY
|
||||||
|
character_data.name;
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
auto results = database.QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
@ -13149,16 +13208,15 @@ void command_who(Client *c, const Seperator *sep)
|
|||||||
auto account_id = static_cast<uint32>(atoi(row[0]));
|
auto account_id = static_cast<uint32>(atoi(row[0]));
|
||||||
std::string player_name = row[1];
|
std::string player_name = row[1];
|
||||||
auto zone_id = static_cast<uint32>(atoi(row[2]));
|
auto zone_id = static_cast<uint32>(atoi(row[2]));
|
||||||
std::string zone_short_name = row[3];
|
std::string zone_short_name = ZoneName(zone_id);
|
||||||
auto zone_instance = static_cast<uint32>(atoi(row[4]));
|
auto zone_instance = static_cast<uint32>(atoi(row[3]));
|
||||||
std::string guild_name = row[5];
|
std::string guild_name = row[4];
|
||||||
auto player_level = static_cast<uint32>(atoi(row[6]));
|
auto player_level = static_cast<uint32>(atoi(row[5]));
|
||||||
auto player_race = static_cast<uint32>(atoi(row[7]));
|
auto player_race = static_cast<uint32>(atoi(row[6]));
|
||||||
auto player_class = static_cast<uint32>(atoi(row[8]));
|
auto player_class = static_cast<uint32>(atoi(row[7]));
|
||||||
auto account_status = static_cast<uint32>(atoi(row[9]));
|
auto account_status = static_cast<uint32>(atoi(row[8]));
|
||||||
std::string account_name = row[10];
|
std::string account_name = row[9];
|
||||||
std::string account_ip = row[11];
|
std::string account_ip = row[10];
|
||||||
|
|
||||||
std::string base_class_name = GetClassIDName(static_cast<uint8>(player_class), 1);
|
std::string base_class_name = GetClassIDName(static_cast<uint8>(player_class), 1);
|
||||||
std::string displayed_race_name = GetRaceIDName(static_cast<uint16>(player_race));
|
std::string displayed_race_name = GetRaceIDName(static_cast<uint16>(player_race));
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user