mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-02 12:36:36 +00:00
[GM Commands] Split GM Commands Into Separate Files (#1766)
* Split GM commands into their own files * Code cleanup
This commit is contained in:
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#include "../client.h"
|
||||
|
||||
void command_killallnpcs(Client *c, const Seperator *sep)
|
||||
{
|
||||
std::string search_string;
|
||||
if (sep->arg[1]) {
|
||||
search_string = sep->arg[1];
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
for (auto &itr : entity_list.GetMobList()) {
|
||||
Mob *entity = itr.second;
|
||||
if (!entity->IsNPC()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string entity_name = entity->GetName();
|
||||
|
||||
/**
|
||||
* Filter by name
|
||||
*/
|
||||
if (search_string.length() > 0 && entity_name.find(search_string) == std::string::npos) {
|
||||
continue;
|
||||
}
|
||||
|
||||
bool is_not_attackable =
|
||||
(
|
||||
entity->IsInvisible() ||
|
||||
!entity->IsAttackAllowed(c) ||
|
||||
entity->GetRace() == 127 ||
|
||||
entity->GetRace() == 240
|
||||
);
|
||||
|
||||
if (is_not_attackable) {
|
||||
continue;
|
||||
}
|
||||
|
||||
entity->Damage(c, 1000000000, 0, EQ::skills::SkillDragonPunch);
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
c->Message(Chat::Yellow, "Killed (%i) npc(s)", count);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user