mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
[Commands] Cleanup #npctypespawn Command. (#2110)
- Cleanup messages and logic.
This commit is contained in:
parent
ee86001132
commit
26b26af8d7
@ -259,7 +259,7 @@ int command_init(void)
|
|||||||
command_add("npcspecialattk", "[flagchar] [perm] - Set NPC special attack flags. Flags are E(nrage) F(lurry) R(ampage) S(ummon).", AccountStatus::QuestTroupe, command_npcspecialattk) ||
|
command_add("npcspecialattk", "[flagchar] [perm] - Set NPC special attack flags. Flags are E(nrage) F(lurry) R(ampage) S(ummon).", AccountStatus::QuestTroupe, command_npcspecialattk) ||
|
||||||
command_add("npcstats", "- Show stats about target NPC", AccountStatus::QuestTroupe, command_npcstats) ||
|
command_add("npcstats", "- Show stats about target NPC", AccountStatus::QuestTroupe, command_npcstats) ||
|
||||||
command_add("npctype_cache", "[id] or all - Clears the npc type cache for either the id or all npcs.", AccountStatus::GMImpossible, command_npctype_cache) ||
|
command_add("npctype_cache", "[id] or all - Clears the npc type cache for either the id or all npcs.", AccountStatus::GMImpossible, command_npctype_cache) ||
|
||||||
command_add("npctypespawn", "[npctypeid] [factionid] - Spawn an NPC from the db", AccountStatus::Steward, command_npctypespawn) ||
|
command_add("npctypespawn", "[NPC ID] [Faction ID] - Spawn an NPC by ID from the database with an option of setting its Faction ID", AccountStatus::Steward, command_npctypespawn) ||
|
||||||
command_add("nudge", "- Nudge your target's current position by specific values", AccountStatus::QuestTroupe, command_nudge) ||
|
command_add("nudge", "- Nudge your target's current position by specific values", AccountStatus::QuestTroupe, command_nudge) ||
|
||||||
command_add("nukebuffs", "[Beneficial|Detrimental|Help] - Strip all buffs by type on you or your target (no argument to remove all buffs)", AccountStatus::Guide, command_nukebuffs) ||
|
command_add("nukebuffs", "[Beneficial|Detrimental|Help] - Strip all buffs by type on you or your target (no argument to remove all buffs)", AccountStatus::Guide, command_nukebuffs) ||
|
||||||
command_add("nukeitem", "[Item ID] - Removes the specified Item ID from you or your player target's inventory", AccountStatus::GMLeadAdmin, command_nukeitem) ||
|
command_add("nukeitem", "[Item ID] - Removes the specified Item ID from you or your player target's inventory", AccountStatus::GMLeadAdmin, command_nukeitem) ||
|
||||||
|
|||||||
@ -2,13 +2,22 @@
|
|||||||
|
|
||||||
void command_npctypespawn(Client *c, const Seperator *sep)
|
void command_npctypespawn(Client *c, const Seperator *sep)
|
||||||
{
|
{
|
||||||
if (sep->IsNumber(1)) {
|
int arguments = sep->argnum;
|
||||||
const NPCType *tmp = 0;
|
if (!arguments || !sep->IsNumber(1)) {
|
||||||
if ((tmp = content_db.LoadNPCTypesData(atoi(sep->arg[1])))) {
|
c->Message(Chat::White, "Usage: #npctypespawn [NPC ID] [Faction ID]");
|
||||||
//tmp->fixedZ = 1;
|
return;
|
||||||
auto npc = new NPC(tmp, 0, c->GetPosition(), GravityBehavior::Water);
|
}
|
||||||
if (npc && sep->IsNumber(2)) {
|
|
||||||
npc->SetNPCFactionID(atoi(sep->arg[2]));
|
auto npc_id = std::stoul(sep->arg[1]);
|
||||||
|
int faction_id = 0;
|
||||||
|
|
||||||
|
auto npc_type = content_db.LoadNPCTypesData(npc_id);
|
||||||
|
if (npc_type) {
|
||||||
|
auto npc = new NPC(npc_type, 0, c->GetPosition(), GravityBehavior::Water);
|
||||||
|
if (npc) {
|
||||||
|
if (sep->IsNumber(2)) {
|
||||||
|
faction_id = std::stoi(sep->arg[2]);
|
||||||
|
npc->SetNPCFactionID(faction_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
npc->AddLootTable();
|
npc->AddLootTable();
|
||||||
@ -16,14 +25,41 @@ void command_npctypespawn(Client *c, const Seperator *sep)
|
|||||||
npc->CheckGlobalLootTables();
|
npc->CheckGlobalLootTables();
|
||||||
}
|
}
|
||||||
entity_list.AddNPC(npc);
|
entity_list.AddNPC(npc);
|
||||||
}
|
|
||||||
else {
|
|
||||||
c->Message(Chat::White, "NPC Type %i not found", atoi(sep->arg[1]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
c->Message(Chat::White, "Usage: #npctypespawn npctypeid factionid");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"Spawned {} ({}){}.",
|
||||||
|
npc->GetCleanName(),
|
||||||
|
npc_id,
|
||||||
|
(
|
||||||
|
faction_id ?
|
||||||
|
fmt::format(
|
||||||
|
" on the {} Faction ({})",
|
||||||
|
content_db.GetFactionName(faction_id),
|
||||||
|
faction_id
|
||||||
|
) :
|
||||||
|
""
|
||||||
|
)
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"Failed to spawn NPC ID {}.",
|
||||||
|
npc_id
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"NPC ID {} was not found.",
|
||||||
|
npc_id
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user