mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
[Commands] Cleanup #trapinfo Command. (#2148)
* [Commands] Cleanup #trapinfo Command. - Cleanup messages. - Does not modify the command file, as it's only one line that calls the method in zones/trap.cpp. * Cleanup. * Update trap.cpp * Update trap.cpp
This commit is contained in:
parent
b583d95f09
commit
b03d47b9cd
@ -366,21 +366,66 @@ void EntityList::UpdateAllTraps(bool respawn, bool repopnow)
|
|||||||
|
|
||||||
void EntityList::GetTrapInfo(Client* client)
|
void EntityList::GetTrapInfo(Client* client)
|
||||||
{
|
{
|
||||||
uint8 count = 0;
|
uint32 trap_count = 0;
|
||||||
auto it = trap_list.begin();
|
uint32 trap_number = 1;
|
||||||
while (it != trap_list.end())
|
|
||||||
{
|
for (const auto& trap : trap_list) {
|
||||||
Trap* cur = it->second;
|
auto t = trap.second;
|
||||||
if (cur->IsTrap())
|
if (t->IsTrap()) {
|
||||||
{
|
bool is_set = (t->chkarea_timer.Enabled() && !t->reset_timer.Enabled());
|
||||||
bool isset = (cur->chkarea_timer.Enabled() && !cur->reset_timer.Enabled());
|
|
||||||
client->Message(Chat::Default, " Trap: (%d) found at %0.2f,%0.2f,%0.2f. Times Triggered: %d Is Active: %d Group: %d Message: %s", cur->trap_id, cur->m_Position.x, cur->m_Position.y, cur->m_Position.z, cur->times_triggered, isset, cur->group, cur->message.c_str());
|
client->Message(
|
||||||
++count;
|
Chat::White,
|
||||||
}
|
fmt::format(
|
||||||
++it;
|
"Trap {} | ID: {} Active: {} Coordinates: {:.2f}, {:.2f}, {:.2f}",
|
||||||
|
trap_number,
|
||||||
|
t->trap_id,
|
||||||
|
is_set ? "Yes" : "No",
|
||||||
|
t->m_Position.x,
|
||||||
|
t->m_Position.y,
|
||||||
|
t->m_Position.z
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
|
||||||
|
client->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"Trap {} | Times Triggered: {} Group: {}",
|
||||||
|
trap_number,
|
||||||
|
t->times_triggered,
|
||||||
|
t->group
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!t->message.empty()) {
|
||||||
|
client->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"Trap {} | Message: {}",
|
||||||
|
trap_number,
|
||||||
|
t->message
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
client->Message(Chat::Default, "%d traps found.", count);
|
trap_count++;
|
||||||
|
trap_number++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!trap_count) {
|
||||||
|
client->Message(Chat::White, "No traps were found in this zone.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
client->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"{} trap{} found.",
|
||||||
|
trap_count,
|
||||||
|
trap_count != 1 ? "s" : ""
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityList::ClearTrapPointers()
|
void EntityList::ClearTrapPointers()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user