[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,6 +1641,11 @@ void Mob::ShowStats(Client* client)
); );
// Spawn Data // Spawn Data
if (
target->GetGrid() ||
target->GetSpawnGroupId() ||
target->GetSpawnPointID()
) {
client->Message( client->Message(
Chat::White, Chat::White,
fmt::format( fmt::format(
@ -1650,6 +1655,7 @@ void Mob::ShowStats(Client* client)
target->GetGrid() target->GetGrid()
).c_str() ).c_str()
); );
}
client->Message( client->Message(
Chat::White, Chat::White,
@ -1817,6 +1823,11 @@ void Mob::ShowStats(Client* client)
).c_str() ).c_str()
); );
if (
target->GetArmTexture() ||
target->GetBracerTexture() ||
target->GetHandTexture()
) {
client->Message( client->Message(
Chat::White, Chat::White,
fmt::format( fmt::format(
@ -1826,7 +1837,12 @@ void Mob::ShowStats(Client* client)
target->GetHandTexture() target->GetHandTexture()
).c_str() ).c_str()
); );
}
if (
target->GetFeetTexture() ||
target->GetLegTexture()
) {
client->Message( client->Message(
Chat::White, Chat::White,
fmt::format( fmt::format(
@ -1835,6 +1851,7 @@ void Mob::ShowStats(Client* client)
target->GetFeetTexture() target->GetFeetTexture()
).c_str() ).c_str()
); );
}
// Hero's Forge // Hero's Forge
if (target->GetHeroForgeModel()) { if (target->GetHeroForgeModel()) {
@ -2148,6 +2165,7 @@ void Mob::ShowStats(Client* client)
); );
// Emote // Emote
if (target->GetEmoteID()) {
client->Message( client->Message(
Chat::White, Chat::White,
fmt::format( fmt::format(
@ -2155,6 +2173,7 @@ void Mob::ShowStats(Client* client)
target->GetEmoteID() target->GetEmoteID()
).c_str() ).c_str()
); );
}
// Run/Walk Speed // Run/Walk Speed
client->Message( client->Message(