mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
* [Commands] Cleanup #reloadzps Command. - Cleanup messages and logic. - Make reloading of zone points global instead of zone specific. * Further cleanup. - Add zone->GetZoneDescription(). - Add mob->GetTargetDescription(mob). * Final cleanup. * Typo.
38 lines
804 B
C++
Executable File
38 lines
804 B
C++
Executable File
#include "../client.h"
|
|
|
|
void command_attack(Client *c, const Seperator *sep)
|
|
{
|
|
if (!c->GetTarget() || !c->GetTarget()->IsNPC()) {
|
|
c->Message(Chat::White, "You must target an NPC to use this command.");
|
|
return;
|
|
}
|
|
|
|
std::string entity_name = sep->argplus[1];
|
|
if (entity_name.empty()) {
|
|
c->Message(Chat::White, "Usage: #attack [Entity Name]");
|
|
return;
|
|
}
|
|
|
|
auto entity = entity_list.GetMob(entity_name.c_str());
|
|
if (entity) {
|
|
c->GetTarget()->AddToHateList(entity, 1);
|
|
c->Message(
|
|
Chat::EchoChat1,
|
|
fmt::format(
|
|
"{} whispers, 'Attacking {}.'",
|
|
c->GetTarget()->GetCleanName(),
|
|
c->GetTargetDescription(entity)
|
|
).c_str()
|
|
);
|
|
} else {
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"No entity by the name of '{}' could be found.",
|
|
entity_name
|
|
).c_str()
|
|
);
|
|
}
|
|
}
|
|
|