From a751339c99cfcb0890082777897c1f13a77ebf03 Mon Sep 17 00:00:00 2001 From: Matthew Silvia Date: Sat, 30 Jan 2021 19:43:37 -0500 Subject: [PATCH] add raidtarget / respawntimer to #npcedit --- zone/command.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/zone/command.cpp b/zone/command.cpp index 72ee3fab8..c156d4331 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -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");