mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-14 07:21:48 +00:00
[Command] Fix #killallnpcs from crashing (#2037)
This commit is contained in:
parent
31ad0da811
commit
4e40d7eacc
@ -8,31 +8,22 @@ void command_killallnpcs(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
int killed_count = 0;
|
||||
for (auto& npc_entity : entity_list.GetNPCList()) {
|
||||
auto entity_id = npc_entity.first;
|
||||
if (!entity_id) {
|
||||
|
||||
for (auto &e: entity_list.GetMobList()) {
|
||||
auto *entity = e.second;
|
||||
if (!entity || !entity->IsNPC()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto npc = npc_entity.second;
|
||||
if (!npc) {
|
||||
std::string entity_name = str_tolower(entity->GetName());
|
||||
if ((!search_string.empty() && entity_name.find(search_string) == std::string::npos) ||
|
||||
!entity->IsAttackAllowed(c)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string entity_name = str_tolower(npc->GetName());
|
||||
if (
|
||||
(
|
||||
!search_string.empty() &&
|
||||
entity_name.find(search_string) == std::string::npos
|
||||
) ||
|
||||
!npc->IsAttackAllowed(c)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
npc->Damage(
|
||||
entity->Damage(
|
||||
c,
|
||||
npc->GetHP(),
|
||||
entity->GetHP() + 1000,
|
||||
SPELL_UNKNOWN,
|
||||
EQ::skills::SkillDragonPunch
|
||||
);
|
||||
@ -57,7 +48,8 @@ void command_killallnpcs(Client *c, const Seperator *sep)
|
||||
)
|
||||
).c_str()
|
||||
);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user