[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("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("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("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("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("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) || 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) void command_viewnpctype(Client *c, const Seperator *sep)
{ {
if (!sep->IsNumber(1)) if (sep->IsNumber(1)) {
c->Message(Chat::White, "Usage: #viewnpctype [npctype id]"); uint32 npc_id = std::stoul(sep->arg[1]);
else const NPCType* npc_type_data = content_db.LoadNPCTypesData(npc_id);
{ if (npc_type_data) {
uint32 npctypeid=atoi(sep->arg[1]); auto npc = new NPC(
const NPCType* npct = content_db.LoadNPCTypesData(npctypeid); npc_type_data,
if (npct) { nullptr,
c->Message(Chat::White, " NPCType Info, "); c->GetPosition(),
c->Message(Chat::White, " NPCTypeID: %u", npct->npc_id); GravityBehavior::Water
c->Message(Chat::White, " Name: %s", npct->name); );
c->Message(Chat::White, " Level: %i", npct->level); npc->ShowStats(c);
c->Message(Chat::White, " Race: %i", npct->race); } else {
c->Message(Chat::White, " Class: %i", npct->class_); c->Message(
c->Message(Chat::White, " MinDmg: %i", npct->min_dmg); Chat::White,
c->Message(Chat::White, " MaxDmg: %i", npct->max_dmg); fmt::format(
c->Message(Chat::White, " Special Abilities: %s", npct->special_abilities); "NPC ID {} was not found.",
c->Message(Chat::White, " Spells: %i", npct->npc_spells_id); npc_id
c->Message(Chat::White, " Loot Table: %i", npct->loottable_id); ).c_str()
c->Message(Chat::White, " NPCFactionID: %i", npct->npc_faction_id); );
} }
else } else {
c->Message(Chat::White, "NPC #%d not found", npctypeid); c->Message(Chat::White, "Usage: #viewnpctype [NPC ID]");
} }
} }

View File

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