mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-06 08:02:25 +00:00
- License was intended to be GPLv3 per earlier commit of GPLv3 LICENSE FILE - This is confirmed by the inclusion of libraries that are incompatible with GPLv2 - This is also confirmed by KLS and the agreement of KLS's predecessors - Added GPLv3 license headers to the compilable source files - Removed Folly licensing in strings.h since the string functions do not match the Folly functions and are standard functions - this must have been left over from previous implementations - Removed individual contributor license headers since the project has been under the "developer" mantle for many years - Removed comments on files that were previously automatically generated since they've been manually modified multiple times and there are no automatic scripts referencing them (removed in 2023)
165 lines
4.0 KiB
C++
165 lines
4.0 KiB
C++
/* EQEmu: EQEmulator
|
|
|
|
Copyright (C) 2001-2026 EQEmu Development Team
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#include "zone/client.h"
|
|
|
|
void ShowSpawnStatus(Client *c, const Seperator *sep)
|
|
{
|
|
const auto arguments = sep->argnum;
|
|
if (arguments < 2) {
|
|
c->Message(Chat::White, "Usage: #show spawn_status all - Show all spawn statuses for your current zone");
|
|
c->Message(Chat::White, "Usage: #show spawn_status disabled - Show all disabled spawn statuses for your current zone");
|
|
c->Message(Chat::White, "Usage: #show spawn_status enabled - Show all enabled spawn statuses for your current zone");
|
|
c->Message(Chat::White, "Usage: #show spawn_status [Spawn ID] - Show spawn status by ID for your current zone");
|
|
return;
|
|
}
|
|
|
|
const bool is_all = !strcasecmp(sep->arg[2], "all");
|
|
const bool is_disabled = !strcasecmp(sep->arg[2], "disabled");
|
|
const bool is_enabled = !strcasecmp(sep->arg[2], "enabled");
|
|
const bool is_search = sep->IsNumber(2);
|
|
|
|
if (
|
|
!is_all &&
|
|
!is_disabled &&
|
|
!is_enabled &&
|
|
!is_search
|
|
) {
|
|
c->Message(Chat::White, "Usage: #show spawn_status all - Show all spawn statuses for your current zone");
|
|
c->Message(Chat::White, "Usage: #show spawn_status disabled - Show all disabled spawn statuses for your current zone");
|
|
c->Message(Chat::White, "Usage: #show spawn_status enabled - Show all enabled spawn statuses for your current zone");
|
|
c->Message(Chat::White, "Usage: #show spawn_status [Spawn ID] - Show spawn status by ID for your current zone");
|
|
return;
|
|
}
|
|
|
|
std::string filter_type;
|
|
if (is_disabled) {
|
|
filter_type = "Disabled";
|
|
} else if (is_enabled) {
|
|
filter_type = "Enabled";
|
|
}
|
|
|
|
const uint32 spawn_id = (
|
|
is_search ?
|
|
Strings::ToUnsignedInt(sep->arg[2]) :
|
|
0
|
|
);
|
|
|
|
LinkedListIterator<Spawn2*> iterator(zone->spawn2_list);
|
|
iterator.Reset();
|
|
|
|
uint32 filtered_count = 0;
|
|
uint32 spawn_count = 0;
|
|
uint32 spawn_number = 1;
|
|
|
|
while (iterator.MoreElements()) {
|
|
const auto& e = iterator.GetData();
|
|
|
|
const uint32 time_remaining = e->GetTimer().GetRemainingTime();
|
|
|
|
if (
|
|
is_all ||
|
|
(
|
|
is_disabled &&
|
|
time_remaining == UINT32_MAX
|
|
) ||
|
|
(
|
|
is_enabled &&
|
|
time_remaining != UINT32_MAX
|
|
) ||
|
|
(
|
|
is_search &&
|
|
e->GetID() == spawn_id
|
|
)
|
|
) {
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"Spawn {} | ID: {} Coordinates: {:.2f}, {:.2f}, {:.2f}, {:.2f}",
|
|
spawn_number,
|
|
e->GetID(),
|
|
e->GetX(),
|
|
e->GetY(),
|
|
e->GetZ(),
|
|
e->GetHeading()
|
|
).c_str()
|
|
);
|
|
|
|
if (time_remaining != UINT32_MAX) {
|
|
const uint32 seconds_remaining = (time_remaining / 1000);
|
|
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"Spawn {} | Respawn: {}",
|
|
spawn_number,
|
|
Strings::SecondsToTime(seconds_remaining)
|
|
).c_str()
|
|
);
|
|
}
|
|
|
|
filtered_count++;
|
|
spawn_number++;
|
|
}
|
|
|
|
spawn_count++;
|
|
iterator.Advance();
|
|
}
|
|
|
|
if (!spawn_count) {
|
|
c->Message(Chat::White, "No spawns were found.");
|
|
return;
|
|
}
|
|
|
|
if (
|
|
(is_disabled || is_enabled) &&
|
|
!filtered_count
|
|
) {
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"No {} spawns were found.",
|
|
filter_type
|
|
).c_str()
|
|
);
|
|
return;
|
|
}
|
|
|
|
if (is_all) {
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"{} Spawn{} found.",
|
|
spawn_count,
|
|
spawn_count != 1 ? "s" : ""
|
|
).c_str()
|
|
);
|
|
|
|
return;
|
|
}
|
|
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"{} of {} spawn{} found.",
|
|
filtered_count,
|
|
spawn_count,
|
|
spawn_count != 1 ? "s" : ""
|
|
).c_str()
|
|
);
|
|
}
|