mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-05 19:32:25 +00:00
- License was intended to be GPLv3 per earlier commit of GPLv3 LICENSE FILE - This is confirmed by the inclusion of libraries that are incompatible with GPLv2 - This is also confirmed by KLS and the agreement of KLS's predecessors - Added GPLv3 license headers to the compilable source files - Removed Folly licensing in strings.h since the string functions do not match the Folly functions and are standard functions - this must have been left over from previous implementations - Removed individual contributor license headers since the project has been under the "developer" mantle for many years - Removed comments on files that were previously automatically generated since they've been manually modified multiple times and there are no automatic scripts referencing them (removed in 2023)
154 lines
4.0 KiB
C++
Executable File
154 lines
4.0 KiB
C++
Executable File
/* EQEmu: EQEmulator
|
|
|
|
Copyright (C) 2001-2026 EQEmu Development Team
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#include "zone/client.h"
|
|
|
|
std::map<std::string, std::string> GetModifyNPCStatMap()
|
|
{
|
|
std::map<std::string, std::string> identifiers_map = {
|
|
{ "ac", "Armor Class" },
|
|
{ "accuracy", "Accuracy" },
|
|
{ "aggro", "Aggro" },
|
|
{ "agi", "Agility" },
|
|
{ "assist", "Assist" },
|
|
{ "atk", "Attack" },
|
|
{ "attack_count", "Attack Count" },
|
|
{ "attack_delay", "Attack Delay" },
|
|
{ "attack_speed", "Attack Speed" },
|
|
{ "avoidance", "Avoidance" },
|
|
{ "cha", "Charisma" },
|
|
{ "cr", "Cold Resist" },
|
|
{ "dex", "Dexterity" },
|
|
{ "dr", "Disease Resist" },
|
|
{ "fr", "Fire Resist" },
|
|
{ "healscale", "Heal Scale" },
|
|
{ "heroic_strikethrough", "Heroic Strikethrough" },
|
|
{ "hp_regen", "HP Regen" },
|
|
{ "hp_regen_per_second", "HP Regen Per Second" },
|
|
{ "int", "Intelligence" },
|
|
{ "_int", "Intelligence" },
|
|
{ "keeps_sold_items", "Keeps Sold Items" },
|
|
{ "level", "Level" },
|
|
{ "loottable_id", "Loottable ID" },
|
|
{ "mana_regen", "Mana Regen" },
|
|
{ "max_hit", "Maximum Damage" },
|
|
{ "max_hp", "Maximum Hit Points" },
|
|
{ "min_hit", "Minimum Damage" },
|
|
{ "mr", "Magic Resist" },
|
|
{ "npc_spells_id", "NPC Spells ID" },
|
|
{ "npc_spells_effects_id", "NPC Spells Effects ID" },
|
|
{ "phr", "Physical Resist" },
|
|
{ "pr", "Poison Resist" },
|
|
{ "runspeed", "Run Speed" },
|
|
{ "see_invis", "See Invisible" },
|
|
{ "see_invis_undead", "See Invisible vs. Undead" },
|
|
{ "see_hide", "See Hide" },
|
|
{ "see_improved_hide", "See Improved Hide" },
|
|
{ "slow_mitigation", "Slow Mitigation" },
|
|
{ "special_attacks", "Special Attacks" },
|
|
{ "special_abilities", "Special Abilities" },
|
|
{ "spellscale", "Spell Scale" },
|
|
{ "sta", "Stamina" },
|
|
{ "str", "Strength" },
|
|
{ "trackable", "Trackable" },
|
|
{ "wis", "Wisdom" }
|
|
};
|
|
|
|
return identifiers_map;
|
|
}
|
|
|
|
std::string GetModifyNPCStatDescription(std::string stat)
|
|
{
|
|
if (GetModifyNPCStatMap().find(stat) != GetModifyNPCStatMap().end()) {
|
|
return GetModifyNPCStatMap().find(stat)->second;
|
|
}
|
|
|
|
return std::string();
|
|
}
|
|
|
|
void ListModifyNPCStatMap(Client *c)
|
|
{
|
|
for (const auto& s : GetModifyNPCStatMap()) {
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"Usage: #modifynpcstat {} [Value] - Modifies an NPC's {}",
|
|
s.first,
|
|
s.second
|
|
).c_str()
|
|
);
|
|
}
|
|
}
|
|
|
|
void command_modifynpcstat(Client *c, const Seperator *sep)
|
|
{
|
|
auto arguments = sep->argnum;
|
|
if (!arguments) {
|
|
c->Message(Chat::White, "Usage: #modifynpcstat [Stat] [Value]");
|
|
ListModifyNPCStatMap(c);
|
|
return;
|
|
}
|
|
|
|
if (!c->GetTarget() || !c->GetTarget()->IsNPC()) {
|
|
c->Message(Chat::White, "You must target an NPC to use this command.");
|
|
return;
|
|
}
|
|
|
|
auto target = c->GetTarget()->CastToNPC();
|
|
|
|
const std::string& stat = sep->arg[1] ? sep->arg[1] : "";
|
|
const std::string& value = sep->arg[2] ? sep->arg[2] : "";
|
|
|
|
if (stat.empty() || value.empty()) {
|
|
c->Message(Chat::White, "Usage: #modifynpcstat [Stat] [Value]");
|
|
ListModifyNPCStatMap(c);
|
|
return;
|
|
}
|
|
|
|
auto stat_description = GetModifyNPCStatDescription(stat);
|
|
if (!stat_description.length()) {
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"Stat '{}' does not exist.",
|
|
stat
|
|
).c_str()
|
|
);
|
|
return;
|
|
}
|
|
|
|
target->ModifyNPCStat(stat, value);
|
|
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"Stat Modified | Target: {}",
|
|
c->GetTargetDescription(target)
|
|
).c_str()
|
|
);
|
|
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"Stat Modified | Stat: {} ({}) Value: {}",
|
|
GetModifyNPCStatDescription(stat),
|
|
stat,
|
|
value
|
|
).c_str()
|
|
);
|
|
}
|