mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-02 12:36:36 +00:00
[Commands] Add #petitems Command. (#1823)
- Add #petitems command to show a person's pet items if they have access to the command. - Adds a default false parameter to QueryLoot for NPCs that keeps messages and logic from being ran on pets for no reason. - Cleaned up message a bit for loot and stuff. - Remove check for loottable ID when using #npcstats for NPCs that get items from a script or otherwise.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#include "../client.h"
|
||||
|
||||
void command_petitems(Client *c, const Seperator *sep)
|
||||
{
|
||||
if (!c->GetPet()) {
|
||||
c->Message(Chat::White, "You must have a pet to use this command.");
|
||||
return;
|
||||
}
|
||||
|
||||
auto pet = c->GetPet()->CastToNPC();
|
||||
auto loot_list = pet->GetLootList();
|
||||
if (!loot_list.empty()) {
|
||||
pet->QueryLoot(c, true);
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Your pet has {} item{}.",
|
||||
loot_list.size(),
|
||||
loot_list.size() != 1 ? "s" : ""
|
||||
).c_str()
|
||||
);
|
||||
} else {
|
||||
c->Message(Chat::White, "Your pet has no items.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user