[Regen] Implement Per Second HP Regen for NPCs (#2086)

* Implement NPC per second regen

* Add hp_regen_per_second to ModifyNPCStat

* Take per second regen the rest of the way

* Add #npcedit hp_regen_per_second

* Add db migration
This commit is contained in:
Chris Miles authored and GitHub committed 2022-05-01 10:26:16 -04:00
1 parent 5b4aeaa457
commit 90da136b7a
10 files changed
+112 -67

No files matched your search

+18
View File
@@ -28,6 +28,7 @@ void command_npcedit(Client *c, const Seperator *sep)
c->Message(Chat::White, "#npcedit herosforgemodel - Sets an NPC's Hero's Forge Model");
c->Message(Chat::White, "#npcedit size - Sets an NPC's Size");
c->Message(Chat::White, "#npcedit hpregen - Sets an NPC's Hitpoints Regeneration Rate Per Tick");
c->Message(Chat::White, "#npcedit hp_regen_per_second - Sets an NPC's HP regeneration per second");
c->Message(Chat::White, "#npcedit manaregen - Sets an NPC's Mana Regeneration Rate Per Tick");
c->Message(Chat::White, "#npcedit loottable - Sets an NPC's Loottable ID");
c->Message(Chat::White, "#npcedit merchantid - Sets an NPC's Merchant ID");
@@ -308,6 +309,23 @@ void command_npcedit(Client *c, const Seperator *sep)
return;
}
if (strcasecmp(sep->arg[1], "hp_regen_per_second") == 0) {
c->Message(
Chat::Yellow,
fmt::format(
"NPC ID {} now regenerates {} HP per second.",
npc_id,
atoi(sep->arg[2])).c_str()
);
std::string query = fmt::format(
"UPDATE npc_types SET hp_regen_per_second = {} WHERE id = {}",
atoi(sep->arg[2]),
npc_id
);
content_db.QueryDatabase(query);
return;
}
if (strcasecmp(sep->arg[1], "manaregen") == 0) {
c->Message(
Chat::Yellow,