[Commands] Cleanup #viewnpctype Command. (#1713)

* [Commands] Cleanup #viewnpctype Command.
- Create a temporary NPC to use ShowStats() instead.
- Cleanup message.

* Cleanup spawn/emote/textures logic in ShowStats() when unused.

* Formatting.
This commit is contained in:
Kinglykrab 2021-11-12 08:58:43 -05:00 committed by GitHub
parent 0997a8a31e
commit f591378ed3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 75 additions and 56 deletions

View File

@ -438,7 +438,7 @@ int command_init(void)
command_add("untraindiscs", "- Untrains all disciplines from your target.", 180, command_untraindiscs) ||
command_add("uptime", "[zone server id] - Get uptime of worldserver, or zone server if argument provided", 10, command_uptime) ||
command_add("version", "- Display current version of EQEmu server", 0, command_version) ||
command_add("viewnpctype", "[npctype id] - Show info about an npctype", 100, command_viewnpctype) ||
command_add("viewnpctype", "[NPC ID] - Show stats for an NPC by NPC ID", 100, command_viewnpctype) ||
command_add("viewpetition", "[petition number] - View a petition", 20, command_viewpetition) ||
command_add("viewzoneloot", "[item id] - Allows you to search a zone's loot for a specific item ID. (0 shows all loot in the zone)", 80, command_viewzoneloot) ||
command_add("wc", "[wear slot] [material] - Sends an OP_WearChange for your target", 200, command_wc) ||
@ -5397,28 +5397,28 @@ void command_findzone(Client *c, const Seperator *sep)
void command_viewnpctype(Client *c, const Seperator *sep)
{
if (!sep->IsNumber(1))
c->Message(Chat::White, "Usage: #viewnpctype [npctype id]");
else
{
uint32 npctypeid=atoi(sep->arg[1]);
const NPCType* npct = content_db.LoadNPCTypesData(npctypeid);
if (npct) {
c->Message(Chat::White, " NPCType Info, ");
c->Message(Chat::White, " NPCTypeID: %u", npct->npc_id);
c->Message(Chat::White, " Name: %s", npct->name);
c->Message(Chat::White, " Level: %i", npct->level);
c->Message(Chat::White, " Race: %i", npct->race);
c->Message(Chat::White, " Class: %i", npct->class_);
c->Message(Chat::White, " MinDmg: %i", npct->min_dmg);
c->Message(Chat::White, " MaxDmg: %i", npct->max_dmg);
c->Message(Chat::White, " Special Abilities: %s", npct->special_abilities);
c->Message(Chat::White, " Spells: %i", npct->npc_spells_id);
c->Message(Chat::White, " Loot Table: %i", npct->loottable_id);
c->Message(Chat::White, " NPCFactionID: %i", npct->npc_faction_id);
if (sep->IsNumber(1)) {
uint32 npc_id = std::stoul(sep->arg[1]);
const NPCType* npc_type_data = content_db.LoadNPCTypesData(npc_id);
if (npc_type_data) {
auto npc = new NPC(
npc_type_data,
nullptr,
c->GetPosition(),
GravityBehavior::Water
);
npc->ShowStats(c);
} else {
c->Message(
Chat::White,
fmt::format(
"NPC ID {} was not found.",
npc_id
).c_str()
);
}
else
c->Message(Chat::White, "NPC #%d not found", npctypeid);
} else {
c->Message(Chat::White, "Usage: #viewnpctype [NPC ID]");
}
}

View File

@ -1641,15 +1641,21 @@ void Mob::ShowStats(Client* client)
);
// Spawn Data
client->Message(
Chat::White,
fmt::format(
"Spawn | Group: {} Point: {} Grid: {}",
target->GetSpawnGroupId(),
target->GetSpawnPointID(),
target->GetGrid()
).c_str()
);
if (
target->GetGrid() ||
target->GetSpawnGroupId() ||
target->GetSpawnPointID()
) {
client->Message(
Chat::White,
fmt::format(
"Spawn | Group: {} Point: {} Grid: {}",
target->GetSpawnGroupId(),
target->GetSpawnPointID(),
target->GetGrid()
).c_str()
);
}
client->Message(
Chat::White,
@ -1817,24 +1823,35 @@ void Mob::ShowStats(Client* client)
).c_str()
);
client->Message(
Chat::White,
fmt::format(
"Textures | Arms: {} Bracers: {} Hands: {}",
target->GetArmTexture(),
target->GetBracerTexture(),
target->GetHandTexture()
).c_str()
);
if (
target->GetArmTexture() ||
target->GetBracerTexture() ||
target->GetHandTexture()
) {
client->Message(
Chat::White,
fmt::format(
"Textures | Arms: {} Bracers: {} Hands: {}",
target->GetArmTexture(),
target->GetBracerTexture(),
target->GetHandTexture()
).c_str()
);
}
client->Message(
Chat::White,
fmt::format(
"Textures | Legs: {} Feet: {}",
target->GetLegTexture(),
target->GetFeetTexture()
).c_str()
);
if (
target->GetFeetTexture() ||
target->GetLegTexture()
) {
client->Message(
Chat::White,
fmt::format(
"Textures | Legs: {} Feet: {}",
target->GetLegTexture(),
target->GetFeetTexture()
).c_str()
);
}
// Hero's Forge
if (target->GetHeroForgeModel()) {
@ -2147,14 +2164,16 @@ void Mob::ShowStats(Client* client)
).c_str()
);
// Emote
client->Message(
Chat::White,
fmt::format(
"Emote: {}",
target->GetEmoteID()
).c_str()
);
// Emote
if (target->GetEmoteID()) {
client->Message(
Chat::White,
fmt::format(
"Emote: {}",
target->GetEmoteID()
).c_str()
);
}
// Run/Walk Speed
client->Message(