mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
[Cleanup] Cleanup #show ip_lookup Message (#5005)
* [Cleanup] Cleanup #show ip_lookup Message * Test * Update clientlist.cpp
This commit is contained in:
parent
0c65a4febe
commit
822a5dcac4
@ -281,61 +281,106 @@ ClientListEntry* ClientList::FindCLEByCharacterID(uint32 iCharID) {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientList::SendCLEList(const int16& admin, const char* to, WorldTCPConnection* connection, const char* iName) {
|
void ClientList::SendCLEList(const int16& admin, const char* to, WorldTCPConnection* connection, const char* search_criteria)
|
||||||
|
{
|
||||||
LinkedListIterator<ClientListEntry*> iterator(clientlist);
|
LinkedListIterator<ClientListEntry*> iterator(clientlist);
|
||||||
int x = 0, y = 0;
|
|
||||||
int namestrlen = iName == 0 ? 0 : strlen(iName);
|
|
||||||
bool addnewline = false;
|
|
||||||
char newline[3];
|
|
||||||
if (connection->IsConsole())
|
|
||||||
strcpy(newline, "\r\n");
|
|
||||||
else
|
|
||||||
strcpy(newline, "^");
|
|
||||||
|
|
||||||
auto out = fmt::memory_buffer();
|
int found_count = 0;
|
||||||
|
int total_count = 0;
|
||||||
|
int name_length = search_criteria ? strlen(search_criteria) : 0;
|
||||||
|
|
||||||
|
const char* new_line = connection->IsConsole() ? "\r\n" : "^";
|
||||||
|
bool add_new_line = false;
|
||||||
|
|
||||||
|
std::string message;
|
||||||
|
|
||||||
iterator.Reset();
|
iterator.Reset();
|
||||||
|
|
||||||
while (iterator.MoreElements()) {
|
while (iterator.MoreElements()) {
|
||||||
ClientListEntry* cle = iterator.GetData();
|
ClientListEntry* cle = iterator.GetData();
|
||||||
if (admin >= cle->Admin() && (iName == 0 || namestrlen == 0 || strncasecmp(cle->name(), iName, namestrlen) == 0 || strncasecmp(cle->AccountName(), iName, namestrlen) == 0 || strncasecmp(cle->LSName(), iName, namestrlen) == 0)) {
|
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
in.s_addr = cle->GetIP();
|
in.s_addr = cle->GetIP();
|
||||||
if (addnewline) {
|
|
||||||
fmt::format_to(std::back_inserter(out), fmt::runtime(newline));
|
if (
|
||||||
|
admin >= cle->Admin() &&
|
||||||
|
(
|
||||||
|
!search_criteria ||
|
||||||
|
Strings::Contains(std::string(inet_ntoa(in)), search_criteria) ||
|
||||||
|
Strings::Contains(cle->name(), search_criteria) == 0 ||
|
||||||
|
Strings::Contains(cle->AccountName(), search_criteria) == 0 ||
|
||||||
|
Strings::Contains(cle->LSName(), search_criteria) == 0
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
if (add_new_line) {
|
||||||
|
message += new_line;
|
||||||
}
|
}
|
||||||
fmt::format_to(std::back_inserter(out), "ID: {} Acc# {} AccName: {} IP: {}", cle->GetID(), cle->AccountID(), cle->AccountName(), inet_ntoa(in));
|
|
||||||
fmt::format_to(std::back_inserter(out), "{} Stale: {} Online: {} Admin: {}", newline, cle->GetStaleCounter(), static_cast<int>(cle->Online()), cle->Admin());
|
message += fmt::format(
|
||||||
if (cle->LSID())
|
"Account: {} ({}) | IP: {} | Admin: {}",
|
||||||
fmt::format_to(std::back_inserter(out), "{} LSID: {} LSName: {} WorldAdmin: {}", newline, cle->LSID(), cle->LSName(), cle->WorldAdmin());
|
cle->AccountName(),
|
||||||
if (cle->CharID())
|
cle->AccountID(),
|
||||||
fmt::format_to(std::back_inserter(out), "{} CharID: {} CharName: {} Zone: {} ({})", newline, cle->CharID(), cle->name(), ZoneName(cle->zone()), cle->zone());
|
inet_ntoa(in),
|
||||||
if (out.size() >= 3072) {
|
cle->Admin()
|
||||||
connection->SendEmoteMessageRaw(
|
|
||||||
to,
|
|
||||||
0,
|
|
||||||
AccountStatus::Player,
|
|
||||||
Chat::NPCQuestSay,
|
|
||||||
out.data()
|
|
||||||
);
|
);
|
||||||
addnewline = false;
|
|
||||||
out.clear();
|
if (cle->CharID()) {
|
||||||
} else {
|
message += fmt::format(
|
||||||
addnewline = true;
|
"{}Character: {} ({}) | Zone: {} ({})",
|
||||||
}
|
new_line,
|
||||||
y++;
|
cle->name(),
|
||||||
}
|
cle->CharID(),
|
||||||
iterator.Advance();
|
ZoneLongName(cle->zone()),
|
||||||
x++;
|
cle->zone()
|
||||||
}
|
|
||||||
fmt::format_to(std::back_inserter(out), "{}{} CLEs in memory. {} CLEs listed. numplayers = {}.", newline, x, y, numplayers);
|
|
||||||
connection->SendEmoteMessageRaw(
|
|
||||||
to,
|
|
||||||
0,
|
|
||||||
AccountStatus::Player,
|
|
||||||
Chat::NPCQuestSay,
|
|
||||||
out.data()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (message.size() >= 3072) {
|
||||||
|
connection->SendEmoteMessageRaw(
|
||||||
|
to,
|
||||||
|
0,
|
||||||
|
AccountStatus::Player,
|
||||||
|
Chat::NPCQuestSay,
|
||||||
|
message.c_str()
|
||||||
|
);
|
||||||
|
message.clear();
|
||||||
|
add_new_line = false;
|
||||||
|
} else {
|
||||||
|
add_new_line = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
found_count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator.Advance();
|
||||||
|
total_count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
message += fmt::format(
|
||||||
|
"{}{}Player Count: {}",
|
||||||
|
new_line,
|
||||||
|
(
|
||||||
|
found_count != total_count ?
|
||||||
|
fmt::format(
|
||||||
|
"Total: {} CLE{} | Found: {} CLE{} | ",
|
||||||
|
total_count,
|
||||||
|
(total_count != 1 ? "s" : ""),
|
||||||
|
found_count,
|
||||||
|
(found_count != 1 ? "s" : "")
|
||||||
|
) :
|
||||||
|
""
|
||||||
|
),
|
||||||
|
numplayers
|
||||||
|
);
|
||||||
|
|
||||||
|
connection->SendEmoteMessageRaw(
|
||||||
|
to,
|
||||||
|
0,
|
||||||
|
AccountStatus::Player,
|
||||||
|
Chat::NPCQuestSay,
|
||||||
|
message.c_str()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void ClientList::CLEAdd(
|
void ClientList::CLEAdd(
|
||||||
uint32 login_server_id,
|
uint32 login_server_id,
|
||||||
|
|||||||
@ -45,7 +45,7 @@ public:
|
|||||||
void SendClientVersionSummary(const char *Name);
|
void SendClientVersionSummary(const char *Name);
|
||||||
void SendLFGMatches(ServerLFGMatchesRequest_Struct *LFGMatchesRequest);
|
void SendLFGMatches(ServerLFGMatchesRequest_Struct *LFGMatchesRequest);
|
||||||
void ConsoleSendWhoAll(const char* to, int16 admin, Who_All_Struct* whom, WorldTCPConnection* connection);
|
void ConsoleSendWhoAll(const char* to, int16 admin, Who_All_Struct* whom, WorldTCPConnection* connection);
|
||||||
void SendCLEList(const int16& admin, const char* to, WorldTCPConnection* connection, const char* iName = 0);
|
void SendCLEList(const int16& admin, const char* to, WorldTCPConnection* connection, const char* search_criteria = 0);
|
||||||
|
|
||||||
bool SendPacket(const char* to, ServerPacket* pack);
|
bool SendPacket(const char* to, ServerPacket* pack);
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ void ShowIPLookup(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
auto pack = new ServerPacket(
|
auto pack = new ServerPacket(
|
||||||
ServerOP_IPLookup,
|
ServerOP_IPLookup,
|
||||||
sizeof(ServerGenericWorldQuery_Struct) + ip_length + 1
|
sizeof(ServerGenericWorldQuery_Struct) + ip_length
|
||||||
);
|
);
|
||||||
|
|
||||||
auto s = (ServerGenericWorldQuery_Struct *) pack->pBuffer;
|
auto s = (ServerGenericWorldQuery_Struct *) pack->pBuffer;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user