add raidtarget / respawntimer to #npcedit

This commit is contained in:
Matthew Silvia 2021-01-30 19:43:37 -05:00
parent b74edd9dc2
commit a751339c99

View File

@ -8798,6 +8798,8 @@ void command_npcedit(Client *c, const Seperator *sep)
c->Message(Chat::White, "#npcedit version - Set an NPC's version");
c->Message(Chat::White, "#npcedit slow_mitigation - Set an NPC's slow mitigation");
c->Message(Chat::White, "#npcedit flymode - Set an NPC's flymode [0 = ground, 1 = flying, 2 = levitate, 3 = water, 4 = floating]");
c->Message(Chat::White, "#npcedit raidtarget - Set an NPCs raid_target field");
c->Message(Chat::White, "#npcedit respawntime - Set an NPCs respawn timer in seconds");
}
@ -9396,6 +9398,24 @@ void command_npcedit(Client *c, const Seperator *sep)
return;
}
if (strcasecmp(sep->arg[1], "raidtarget") == 0) {
if (sep->arg[2][0] && sep->IsNumber(sep->arg[2]) && atoi(sep->arg[2]) >= 0) {
c->Message(Chat::Yellow, "NPCID %u is %s as a raid target.", npcTypeID, atoi(sep->arg[2]) == 0 ? "no longer designated" : "now designated");
std::string query = StringFormat("UPDATE npc_types SET raid_target = %i WHERE id = %i", atoi(sep->arg[2]), npcTypeID);
content_db.QueryDatabase(query);
return;
}
}
if (strcasecmp(sep->arg[1], "respawntime") == 0) {
if (sep->arg[2][0] && sep->IsNumber(sep->arg[2]) && atoi(sep->arg[2]) > 0) {
c->Message(Chat::Yellow, "NPCID %u (spawngroup %i) respawn time set to %i.", npcTypeID, c->GetTarget()->CastToNPC()->GetSpawnGroupId(), atoi(sep->arg[2]));
std::string query = StringFormat("UPDATE spawn2 SET respawntime = %i WHERE spawngroupID = %i AND version = %i", atoi(sep->arg[2]), c->GetTarget()->CastToNPC()->GetSpawnGroupId(), zone->GetInstanceVersion());
content_db.QueryDatabase(query);
return;
}
}
if((sep->arg[1][0] == 0 || strcasecmp(sep->arg[1],"*")==0) || ((c->GetTarget()==0) || (c->GetTarget()->IsClient())))
c->Message(Chat::White, "Type #npcedit help for more info");